Debugger: Remove some uses of semi-global currentEngine()

Make use of recent TreeModel improvements in various
tool views, push more operations into the engine-
owned data models, specifically context menu creation.

Change-Id: I479c97102b9fb81611c6461c6df1cec59295179a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
hjk
2016-07-18 12:36:31 +02:00
committed by hjk
parent 84f1466b01
commit 2d79bdc29c
36 changed files with 2636 additions and 3364 deletions

View File

@@ -33,6 +33,8 @@
#include <QCoreApplication>
#include <QPointer>
namespace Utils { class ItemViewEvent; }
namespace Debugger {
namespace Internal {
@@ -157,7 +159,9 @@ inline uint qHash(const Debugger::Internal::Breakpoint &b) { return b.hash(); }
typedef QList<Breakpoint> Breakpoints;
class BreakHandler : public Utils::LeveledTreeModel<Utils::TreeItem, BreakpointItem, LocationItem>
using BreakModel = Utils::LeveledTreeModel<Utils::TypedTreeItem<BreakpointItem>, BreakpointItem, LocationItem>;
class BreakHandler : public BreakModel
{
Q_OBJECT
@@ -200,8 +204,15 @@ public:
void setWatchpointAtExpression(const QString &exp);
Breakpoint breakpointById(BreakpointModelId id) const;
void editBreakpoint(Breakpoint bp, QWidget *parent);
private:
QVariant data(const QModelIndex &idx, int role) const override;
bool setData(const QModelIndex &idx, const QVariant &value, int role) override;
void timerEvent(QTimerEvent *event) override;
bool contextMenuEvent(const Utils::ItemViewEvent &ev);
friend class BreakpointItem;
friend class Breakpoint;
@@ -209,12 +220,17 @@ private:
void saveBreakpoints();
void appendBreakpointInternal(const BreakpointParameters &data);
void deleteBreakpoints(const Breakpoints &bps);
void deleteAllBreakpoints();
void setBreakpointsEnabled(const Breakpoints &bps, bool enabled);
void addBreakpoint();
void editBreakpoints(const Breakpoints &bps, QWidget *parent);
Q_SLOT void changeLineNumberFromMarkerHelper(Debugger::Internal::BreakpointModelId id);
Q_SLOT void deletionHelper(Debugger::Internal::BreakpointModelId id);
void scheduleSynchronization();
void timerEvent(QTimerEvent *event);
int m_syncTimerId;
};