OSDN Git Service

debugger: less indirections when opening files
authorhjk <qtc-committer@nokia.com>
Mon, 8 Nov 2010 14:57:40 +0000 (15:57 +0100)
committerhjk <qtc-committer@nokia.com>
Mon, 8 Nov 2010 16:44:00 +0000 (17:44 +0100)
src/plugins/debugger/debuggerengine.cpp
src/plugins/debugger/debuggerengine.h
src/plugins/debugger/debuggerplugin.h
src/plugins/debugger/moduleswindow.cpp
src/plugins/debugger/sourcefileswindow.cpp
src/plugins/debugger/sourcefileswindow.h

index daad800..a4ff424 100644 (file)
@@ -1168,11 +1168,6 @@ DebuggerPlugin *DebuggerEngine::plugin()
     return DebuggerPlugin::instance();
 }
 
-void DebuggerEngine::openFile(const QString &fileName, int lineNumber)
-{
-    plugin()->gotoLocation(fileName, lineNumber, false);
-}
-
 bool DebuggerEngine::isReverseDebugging() const
 {
     return plugin()->isReverseDebugging();
index c827200..badb9fe 100644 (file)
@@ -278,7 +278,6 @@ public:
     Q_SLOT void showStatusMessage(const QString &msg, int timeout = -1) const;
 
     void resetLocation();
-    void openFile(const QString &fileName, int lineNumber = -1);
     virtual void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
     virtual void gotoLocation(const Internal::StackFrame &frame, bool setMarker);
     virtual void quitDebugger(); // called by DebuggerRunControl
index 75f49f6..d4ef387 100644 (file)
@@ -101,7 +101,8 @@ public slots:
 
     // void runTest(const QString &fileName);
     void showMessage(const QString &msg, int channel, int timeout = -1);
-    void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
+    void gotoLocation(const QString &fileName, int lineNumber = -1,
+        bool setMarker = false);
 
 private:
     friend class DebuggerEngine;
index 3933463..8cff295 100644 (file)
 namespace Debugger {
 namespace Internal {
 
+static DebuggerPlugin *plugin()
+{
+    return DebuggerPlugin::instance();
+}
+
 static DebuggerEngine *currentEngine()
 {
     return DebuggerPlugin::instance()->currentEngine();
@@ -77,7 +82,7 @@ ModulesWindow::ModulesWindow(QWidget *parent)
 
 void ModulesWindow::moduleActivated(const QModelIndex &index)
 {
-    currentEngine()->openFile(index.data().toString());
+    plugin()->gotoLocation(index.data().toString());
 }
 
 void ModulesWindow::resizeEvent(QResizeEvent *event)
@@ -186,7 +191,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
     } else if (act == actLoadSymbolsForModule) {
         engine->loadSymbols(name);
     } else if (act == actEditFile) {
-        engine->openFile(name);
+        plugin()->gotoLocation(name);
     } else if (act == actShowSymbols) {
         // FIXME setModelData(RequestModuleSymbolsRole, name);
     }
index b3f90d7..0267ca8 100644 (file)
 namespace Debugger {
 namespace Internal {
 
+static DebuggerPlugin *plugin()
+{
+    return DebuggerPlugin::instance();
+}
+
 static DebuggerEngine *currentEngine()
 {
     return DebuggerPlugin::instance()->currentEngine();
@@ -81,7 +86,7 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent)
 
 void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
 {
-    currentEngine()->openFile(index.data().toString());
+    plugin()->gotoLocation(index.data().toString());
 }
 
 void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
@@ -115,14 +120,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
     if (act == act1)
         currentEngine()->reloadSourceFiles();
     else if (act == act2)
-        currentEngine()->openFile(name);
-}
-
-void SourceFilesWindow::setModelData
-    (int role, const QVariant &value, const QModelIndex &index)
-{
-    QTC_ASSERT(model(), return);
-    model()->setData(index, value, role);
+        plugin()->gotoLocation(name);
 }
 
 } // namespace Internal
index 1dfeaf1..9a5677e 100644 (file)
@@ -30,7 +30,6 @@
 #ifndef DEBUGGER_SOURCEFILEWINDOW_H
 #define DEBUGGER_SOURCEFILEWINDOW_H
 
-
 #include <QtGui/QTreeView>
 
 namespace Debugger {
@@ -49,8 +48,6 @@ private slots:
 
 private:
     void contextMenuEvent(QContextMenuEvent *ev);
-    void setModelData(int role, const QVariant &value = QVariant(),
-        const QModelIndex &index = QModelIndex());
 };
 
 } // namespace Internal