summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/moduleswindow.cpp
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2010-06-16 11:08:54 +0200
committerhjk <qtc-committer@nokia.com>2010-06-22 10:59:57 +0200
commit6a6cba5518fb88345c53a7cd645f6cb6466a84e3 (patch)
tree88d7875ae5bd6f70a3654b11f80c6ed9b9685369 /src/plugins/debugger/moduleswindow.cpp
parent4cc244469a4c7d9fb2b3e598727c6d8a2e7c1813 (diff)
downloadqt-creator-6a6cba5518fb88345c53a7cd645f6cb6466a84e3.tar.gz
debugger: The DebuggerEngine refactoring.
This replaces the (de facto) singleton engines and data handlers by classes that are instantiated per run. The DebuggerRunControl will now create an object of (a class derived from) DebuggerEngine that contains all the relevant "dynamic" data. DebuggerManager is no more. The "singleton" bits are merged into DebuggerPlugin, whereas the data bits went to DebuggerEngine. There is no formal notion of a "current" DebuggerEngine. However, as there's only one DebuggerEngine at a time that has its data models connected to the view, there's still some "de facto" notion of a "current" engine. Calling SomeModel::setData(int role, QVariant data) with custom role is used as the primary dispatch mechanism from the views to the "current" data models (and the engine, as all data models know their engine).
Diffstat (limited to 'src/plugins/debugger/moduleswindow.cpp')
-rw-r--r--src/plugins/debugger/moduleswindow.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp
index 5d0fc0cd67..cb821f7bd6 100644
--- a/src/plugins/debugger/moduleswindow.cpp
+++ b/src/plugins/debugger/moduleswindow.cpp
@@ -72,8 +72,8 @@ ModulesWindow::ModulesWindow(QWidget *parent)
void ModulesWindow::moduleActivated(const QModelIndex &index)
{
qDebug() << "ACTIVATED: " << index.row() << index.column()
- << model()->data(index);
- emit fileOpenRequested(model()->data(index).toString());
+ << index.data().toString();
+ setModelData(RequestOpenFileRole, index.data().toString());
}
void ModulesWindow::resizeEvent(QResizeEvent *event)
@@ -104,7 +104,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
const bool enabled =
model() && model()->data(index, EngineActionsEnabledRole).toBool();
const unsigned capabilities =
- model()->data(index, EngineCapabilityRole).toInt();
+ model()->data(index, EngineCapabilitiesRole).toInt();
QMenu menu;
QAction *act0 = new QAction(tr("Update Module List"), &menu);
@@ -149,8 +149,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *act = menu.exec(ev->globalPos());
if (act == act0) {
- QTC_ASSERT(model(), return);
- model()->setData(QModelIndex(), QVariant(), RequestReloadModulesRole);
+ setModelData(RequestReloadModulesRole);
} else if (act == actAdjustColumnWidths) {
resizeColumnsToContents();
} else if (act == actAlwaysAdjustColumnWidth) {
@@ -158,16 +157,13 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
//} else if (act == act3) {
// emit displaySourceRequested(name);
} else if (act == act4) {
- QTC_ASSERT(model(), return);
- model()->setData(QModelIndex(), QVariant(), RequestAllSymbolsRole);
+ setModelData(RequestAllSymbolsRole);
} else if (act == act5) {
- QTC_ASSERT(model(), return);
- model()->setData(QModelIndex(), name, RequestModuleSymbolsRole);
+ setModelData(RequestModuleSymbolsRole, name);
} else if (act == act6) {
- emit fileOpenRequested(name);
+ setModelData(RequestOpenFileRole, name);
} else if (act == act7) {
- QTC_ASSERT(model(), return);
- model()->setData(QModelIndex(), name, RequestModuleSymbolsRole);
+ setModelData(RequestModuleSymbolsRole, name);
}
}
@@ -198,5 +194,12 @@ void ModulesWindow::setModel(QAbstractItemModel *model)
setAlwaysResizeColumnsToContents(true);
}
+void ModulesWindow::setModelData
+ (int role, const QVariant &value, const QModelIndex &index)
+{
+ QTC_ASSERT(model(), return);
+ model()->setData(index, value, role);
+}
+
} // namespace Internal
} // namespace Debugger