diff --git a/src/plugins/debugger/debuggeragents.cpp b/src/plugins/debugger/debuggeragents.cpp index 2e6ded73730d463817a652dbdb3c04e576f165f0..8c0028f0d0002f169ebe6ce3731f17dc39cf8309 100644 --- a/src/plugins/debugger/debuggeragents.cpp +++ b/src/plugins/debugger/debuggeragents.cpp @@ -126,7 +126,7 @@ void MemoryViewAgent::createBinEditor(quint64 addr) QMetaObject::invokeMethod(editor->widget(), "setLazyData", Q_ARG(quint64, addr), Q_ARG(int, DataRange), Q_ARG(int, BinBlockSize)); } else { - DebuggerPlugin::instance()->showMessageBox(QMessageBox::Warning, + DebuggerEngine::showMessageBox(QMessageBox::Warning, tr("No memory viewer available"), tr("The memory contents cannot be shown as no viewer plugin " "for binary data has been loaded.")); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index fc296df742146e2856013267b788457822a00e22..90e31216b55f4120ea219fb3846dec36aa743287 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -1422,7 +1422,7 @@ qint64 DebuggerEngine::inferiorPid() const return d->m_inferiorPid; } -DebuggerPlugin *DebuggerEngine::plugin() const +DebuggerPlugin *DebuggerEngine::plugin() { return DebuggerPlugin::instance(); } @@ -1475,6 +1475,12 @@ void DebuggerEngine::progressPing() d->m_progress.setProgressValue(qMin(70, progress + 1)); } +QMessageBox *DebuggerEngine::showMessageBox(int icon, const QString &title, + const QString &text, int buttons) +{ + return plugin()->showMessageBox(icon, title, text, buttons); +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index a4840c9f323ab04e6a1c5846b6b106fc898f43a3..33293a2c2efa02117169565fac9b4c34c40c9040 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -43,6 +43,7 @@ QT_BEGIN_NAMESPACE class QDebug; class QPoint; +class QMessageBox; QT_END_NAMESPACE namespace TextEditor { @@ -161,6 +162,10 @@ public: virtual void assignValueInDebugger(const QString &expr, const QString &value) { Q_UNUSED(expr); Q_UNUSED(value); } + // Convenience + static QMessageBox *showMessageBox + (int icon, const QString &title, const QString &text, int buttons = 0); + protected: virtual void detachDebugger() {} virtual void executeStep() {} @@ -188,7 +193,7 @@ protected: virtual void frameDown(); public: - DebuggerPlugin *plugin() const; + static DebuggerPlugin *plugin(); const DebuggerStartParameters &startParameters() const; DebuggerStartParameters &startParameters(); diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 71dab8c888aa66030bbb24d9aa71949652d36d38..dac005b51f71ba181eac1ae08753e1ef4526e03d 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -89,9 +89,6 @@ public: static void startDebugger(ProjectExplorer::RunControl *runControl); static void displayDebugger(ProjectExplorer::RunControl *runControl); - QMessageBox *showMessageBox(int icon, const QString &title, - const QString &text, int buttons = 0); - const CPlusPlus::Snapshot &cppCodeModelSnapshot() const; QIcon locationMarkIcon() const; @@ -118,6 +115,9 @@ signals: void stateChanged(int); private: + QMessageBox *showMessageBox(int icon, const QString &title, + const QString &text, int buttons = 0); + friend class Internal::DebuggerEngine; friend class Internal::DebuggerListener; diff --git a/src/plugins/debugger/gdb/abstractgdbadapter.h b/src/plugins/debugger/gdb/abstractgdbadapter.h index 2a40e4ddd46f4ec0b40c6dccf76cb057cb1bab86..bdbf457484fa86772b904c3035482d7785e923d3 100644 --- a/src/plugins/debugger/gdb/abstractgdbadapter.h +++ b/src/plugins/debugger/gdb/abstractgdbadapter.h @@ -92,8 +92,6 @@ protected: { return m_engine->startParameters(); } void showMessage(const QString &msg, int channel = LogDebug, int timeout = 1) { m_engine->showMessage(msg, channel, timeout); } - void showMessageBox(int icon, const QString &title, const QString &text) const - { m_engine->showMessageBox(icon, title, text); } GdbEngine * const m_engine; }; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index babc74cd947855412c2fed0972ab8c81186cfb4f..06b81a2c003ca8c5ed60920c57f87684c6ca9773 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -4232,12 +4232,6 @@ void GdbEngine::handleAdapterCrashed(const QString &msg) showMessageBox(QMessageBox::Critical, tr("Adapter crashed"), msg); } -QMessageBox *GdbEngine::showMessageBox(int icon, const QString &title, - const QString &text, int buttons) -{ - return plugin()->showMessageBox(icon, title, text, buttons); -} - void GdbEngine::setUseDebuggingHelpers(const QVariant &on) { //qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on; diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index e3f679eca37d4d34989ccc0f6dbcce40fd2090c4..37f9eccd05c17e929a8ee04f728a4b65ef4d2550 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -527,8 +527,6 @@ private: ////////// View & Data Stuff ////////// // Convenience Functions // QString errorMessage(QProcess::ProcessError error); - QMessageBox *showMessageBox(int icon, const QString &title, const QString &text, - int buttons = 0); QMainWindow *mainWindow() const; AbstractGdbProcess *gdbProc() const; void showExecutionError(const QString &message); diff --git a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp index abcd5622450ebe05bad885aad625ed4f72960478..0d5f73140392438eeb3dd9a835988ecc19bc2005 100644 --- a/src/plugins/debugger/gdb/remotegdbserveradapter.cpp +++ b/src/plugins/debugger/gdb/remotegdbserveradapter.cpp @@ -128,7 +128,7 @@ void RemoteGdbServerAdapter::uploadProcError(QProcess::ProcessError error) } showMessage(msg, StatusBar); - showMessageBox(QMessageBox::Critical, tr("Error"), msg); + DebuggerEngine::showMessageBox(QMessageBox::Critical, tr("Error"), msg); } void RemoteGdbServerAdapter::readUploadStandardOutput() diff --git a/src/plugins/debugger/gdb/termgdbadapter.cpp b/src/plugins/debugger/gdb/termgdbadapter.cpp index a74f16b96e7b4247679512bd512346366153d987..fd109469db0654202c00b0f803098cd9f02df93a 100644 --- a/src/plugins/debugger/gdb/termgdbadapter.cpp +++ b/src/plugins/debugger/gdb/termgdbadapter.cpp @@ -167,7 +167,7 @@ void TermGdbAdapter::interruptInferior() void TermGdbAdapter::stubMessage(const QString &msg, bool) { - showMessageBox(QMessageBox::Critical, tr("Debugger Error"), msg); + DebuggerEngine::showMessageBox(QMessageBox::Critical, tr("Debugger Error"), msg); } void TermGdbAdapter::stubExited() diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index 4d4fa0e1022f5f419284b23dac7f88f26aeadf70..0863a9f074223f3292f3a085e8c7ce9a18c56fda 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -560,7 +560,7 @@ void PdbEngine::handlePdbError(QProcess::ProcessError error) default: //setState(EngineShutdownRequested, true); m_pdbProc.kill(); - plugin()->showMessageBox(QMessageBox::Critical, tr("Pdb I/O Error"), + showMessageBox(QMessageBox::Critical, tr("Pdb I/O Error"), errorMessage(error)); break; }