Commit 9cbbeec6 authored by hjk's avatar hjk

debugger: move convienience function to DebuggerEngine base class

parent b31a29b1
......@@ -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."));
......
......@@ -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
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
};
......
......@@ -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;
......
......@@ -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);
......
......@@ -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()
......
......@@ -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()
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment