Debugger: Use Core::AsynchronousMessageBox

Nested event loops can lead to crashes, so it is better to use a dialog
which does not have have its own event loop.

Change-Id: Icd2390c9026bc1ef88e72a570df5813fe5cbdaa2
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Marco Bubke
2014-11-25 13:08:18 +01:00
committed by hjk
parent 7e8db09c50
commit 2ee9a06f4c
17 changed files with 65 additions and 63 deletions

View File

@@ -49,7 +49,6 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QMessageBox>
#include <QMenu> #include <QMenu>
#include <QSpinBox> #include <QSpinBox>
#include <QTextEdit> #include <QTextEdit>

View File

@@ -55,6 +55,7 @@
#include <debugger/shared/hostutils.h> #include <debugger/shared/hostutils.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <projectexplorer/taskhub.h> #include <projectexplorer/taskhub.h>
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
@@ -72,7 +73,6 @@
#include <cpptools/cppworkingcopy.h> #include <cpptools/cppworkingcopy.h>
#include <QDir> #include <QDir>
#include <QMessageBox>
#include <cctype> #include <cctype>
@@ -534,7 +534,7 @@ void CdbEngine::consoleStubError(const QString &msg)
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineIll") STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineIll")
notifyEngineIll(); notifyEngineIll();
} }
showMessageBox(QMessageBox::Critical, tr("Debugger Error"), msg); Core::AsynchronousMessageBox::critical(tr("Debugger Error"), msg);
} }
void CdbEngine::consoleStubProcessStarted() void CdbEngine::consoleStubProcessStarted()
@@ -552,7 +552,7 @@ void CdbEngine::consoleStubProcessStarted()
QString errorMessage; QString errorMessage;
if (!launchCDB(attachParameters, &errorMessage)) { if (!launchCDB(attachParameters, &errorMessage)) {
showMessage(errorMessage, LogError); showMessage(errorMessage, LogError);
showMessageBox(QMessageBox::Critical, tr("Failed to Start the Debugger"), errorMessage); Core::AsynchronousMessageBox::critical(tr("Failed to Start the Debugger"), errorMessage);
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupFailed") STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupFailed")
notifyEngineSetupFailed(); notifyEngineSetupFailed();
} }
@@ -599,7 +599,7 @@ void CdbEngine::setupEngine()
qDebug("<setupEngine ok=%d", ok); qDebug("<setupEngine ok=%d", ok);
if (!ok) { if (!ok) {
showMessage(errorMessage, LogError); showMessage(errorMessage, LogError);
showMessageBox(QMessageBox::Critical, tr("Failed to Start the Debugger"), errorMessage); Core::AsynchronousMessageBox::critical(tr("Failed to Start the Debugger"), errorMessage);
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupFailed") STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyEngineSetupFailed")
notifyEngineSetupFailed(); notifyEngineSetupFailed();
} }

View File

@@ -52,6 +52,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/progressmanager/futureprogress.h> #include <coreplugin/progressmanager/futureprogress.h>
@@ -72,8 +73,6 @@
#include <QFileInfo> #include <QFileInfo>
#include <QDir> #include <QDir>
#include <QMessageBox>
using namespace Core; using namespace Core;
using namespace Debugger::Internal; using namespace Debugger::Internal;
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -1733,7 +1732,7 @@ void DebuggerEngine::showStoppedBySignalMessageBox(QString meaning, QString name
"<table><tr><td>Signal name : </td><td>%1</td></tr>" "<table><tr><td>Signal name : </td><td>%1</td></tr>"
"<tr><td>Signal meaning : </td><td>%2</td></tr></table>") "<tr><td>Signal meaning : </td><td>%2</td></tr></table>")
.arg(name, meaning); .arg(name, meaning);
showMessageBox(QMessageBox::Information, tr("Signal received"), msg); Core::AsynchronousMessageBox::information(tr("Signal received"), msg);
} }
void DebuggerEngine::showStoppedByExceptionMessageBox(const QString &description) void DebuggerEngine::showStoppedByExceptionMessageBox(const QString &description)
@@ -1741,7 +1740,7 @@ void DebuggerEngine::showStoppedByExceptionMessageBox(const QString &description
const QString msg = const QString msg =
tr("<p>The inferior stopped because it triggered an exception.<p>%1"). tr("<p>The inferior stopped because it triggered an exception.<p>%1").
arg(description); arg(description);
showMessageBox(QMessageBox::Information, tr("Exception Triggered"), msg); Core::AsynchronousMessageBox::information(tr("Exception Triggered"), msg);
} }
void DebuggerEngine::openMemoryView(quint64 startAddr, unsigned flags, void DebuggerEngine::openMemoryView(quint64 startAddr, unsigned flags,
@@ -1897,7 +1896,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
return; return;
} }
if (warnOnRelease) { if (warnOnRelease) {
showMessageBox(QMessageBox::Information, tr("Warning"), Core::AsynchronousMessageBox::information(tr("Warning"),
tr("This does not seem to be a \"Debug\" build.\n" tr("This does not seem to be a \"Debug\" build.\n"
"Setting breakpoints by file name and line number may fail.") "Setting breakpoints by file name and line number may fail.")
+ QLatin1Char('\n') + detailedWarning); + QLatin1Char('\n') + detailedWarning);

View File

@@ -42,7 +42,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QDebug; class QDebug;
class QPoint; class QPoint;
class QMessageBox;
class QAbstractItemModel; class QAbstractItemModel;
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@@ -78,6 +78,7 @@
#include <coreplugin/imode.h> #include <coreplugin/imode.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
@@ -1589,7 +1590,7 @@ DebuggerRunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
IDevice::ConstPtr device = DeviceKitInformation::device(kit); IDevice::ConstPtr device = DeviceKitInformation::device(kit);
QTC_ASSERT(device, return 0); QTC_ASSERT(device, return 0);
if (process.pid == 0) { if (process.pid == 0) {
QMessageBox::warning(ICore::dialogParent(), tr("Warning"), Core::AsynchronousMessageBox::warning(tr("Warning"),
tr("Cannot attach to process with PID 0")); tr("Cannot attach to process with PID 0"));
return 0; return 0;
} }
@@ -1598,14 +1599,14 @@ DebuggerRunControl *DebuggerPluginPrivate::attachToRunningProcess(Kit *kit,
if (const ToolChain *tc = ToolChainKitInformation::toolChain(kit)) if (const ToolChain *tc = ToolChainKitInformation::toolChain(kit))
isWindows = tc->targetAbi().os() == Abi::WindowsOS; isWindows = tc->targetAbi().os() == Abi::WindowsOS;
if (isWindows && isWinProcessBeingDebugged(process.pid)) { if (isWindows && isWinProcessBeingDebugged(process.pid)) {
QMessageBox::warning(ICore::mainWindow(), tr("Process Already Under Debugger Control"), Core::AsynchronousMessageBox::warning(tr("Process Already Under Debugger Control"),
tr("The process %1 is already under the control of a debugger.\n" tr("The process %1 is already under the control of a debugger.\n"
"Qt Creator cannot attach to it.").arg(process.pid)); "Qt Creator cannot attach to it.").arg(process.pid));
return 0; return 0;
} }
if (device->type() != PE::DESKTOP_DEVICE_TYPE) { if (device->type() != PE::DESKTOP_DEVICE_TYPE) {
QMessageBox::warning(ICore::mainWindow(), tr("Not a Desktop Device Type"), Core::AsynchronousMessageBox::warning(tr("Not a Desktop Device Type"),
tr("It is only possible to attach to a locally running process.")); tr("It is only possible to attach to a locally running process."));
return 0; return 0;
} }

View File

@@ -30,6 +30,8 @@
#include "coregdbadapter.h" #include "coregdbadapter.h"
#include <coreplugin/messagebox.h>
#include <debugger/debuggercore.h> #include <debugger/debuggercore.h>
#include <debugger/debuggerprotocol.h> #include <debugger/debuggerprotocol.h>
#include <debugger/debuggerstartparameters.h> #include <debugger/debuggerstartparameters.h>
@@ -39,7 +41,6 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDir> #include <QDir>
#include <QMessageBox>
#include <QTemporaryFile> #include <QTemporaryFile>
using namespace Utils; using namespace Utils;
@@ -185,7 +186,7 @@ void GdbCoreEngine::continueSetupEngine()
if (cinfo.isCore) { if (cinfo.isCore) {
m_executable = cinfo.foundExecutableName; m_executable = cinfo.foundExecutableName;
if (m_executable.isEmpty()) { if (m_executable.isEmpty()) {
showMessageBox(QMessageBox::Warning, Core::AsynchronousMessageBox::warning(
tr("Error Loading Symbols"), tr("Error Loading Symbols"),
tr("No executable to load symbols from specified core.")); tr("No executable to load symbols from specified core."));
notifyEngineSetupFailed(); notifyEngineSetupFailed();
@@ -196,7 +197,7 @@ void GdbCoreEngine::continueSetupEngine()
if (isCore) { if (isCore) {
startGdb(); startGdb();
} else { } else {
showMessageBox(QMessageBox::Warning, Core::AsynchronousMessageBox::warning(
tr("Error Loading Core File"), tr("Error Loading Core File"),
tr("The specified file does not appear to be a core file.")); tr("The specified file does not appear to be a core file."));
notifyEngineSetupFailed(); notifyEngineSetupFailed();

View File

@@ -65,6 +65,7 @@
#include <debugger/shared/hostutils.h> #include <debugger/shared/hostutils.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <projectexplorer/devicesupport/deviceprocess.h> #include <projectexplorer/devicesupport/deviceprocess.h>
#include <projectexplorer/itaskhandler.h> #include <projectexplorer/itaskhandler.h>
#include <projectexplorer/taskhub.h> #include <projectexplorer/taskhub.h>
@@ -1072,7 +1073,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// with helpers enabled. In this case we get a second response with // with helpers enabled. In this case we get a second response with
// msg="Cannot find new threads: generic error" // msg="Cannot find new threads: generic error"
showMessage(_("APPLYING WORKAROUND #1")); showMessage(_("APPLYING WORKAROUND #1"));
showMessageBox(QMessageBox::Critical, Core::AsynchronousMessageBox::critical(
tr("Executable failed"), QString::fromLocal8Bit(msg)); tr("Executable failed"), QString::fromLocal8Bit(msg));
showStatusMessage(tr("Process failed to start")); showStatusMessage(tr("Process failed to start"));
//shutdown(); //shutdown();
@@ -1098,7 +1099,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
//showStatusMessage(tr("Executable failed: %1") //showStatusMessage(tr("Executable failed: %1")
// .arg(QString::fromLocal8Bit(msg))); // .arg(QString::fromLocal8Bit(msg)));
//shutdown(); //shutdown();
//showMessageBox(QMessageBox::Critical, //Core::AsynchronousMessageBox::critical(
// tr("Executable failed"), QString::fromLocal8Bit(msg)); // tr("Executable failed"), QString::fromLocal8Bit(msg));
} else if (msg.contains("Cannot insert breakpoint")) { } else if (msg.contains("Cannot insert breakpoint")) {
// For breakpoints set by address to non-existent addresses we // For breakpoints set by address to non-existent addresses we
@@ -1112,7 +1113,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
// long as the breakpoints are enabled. // long as the breakpoints are enabled.
// FIXME: Should we silently disable the offending breakpoints? // FIXME: Should we silently disable the offending breakpoints?
showMessage(_("APPLYING WORKAROUND #5")); showMessage(_("APPLYING WORKAROUND #5"));
showMessageBox(QMessageBox::Critical, Core::AsynchronousMessageBox::critical(
tr("Setting breakpoints failed"), QString::fromLocal8Bit(msg)); tr("Setting breakpoints failed"), QString::fromLocal8Bit(msg));
QTC_CHECK(state() == InferiorRunOk); QTC_CHECK(state() == InferiorRunOk);
notifyInferiorSpontaneousStop(); notifyInferiorSpontaneousStop();
@@ -1128,7 +1129,7 @@ void GdbEngine::handleResultRecord(GdbResponse *response)
if (!m_lastWinException.isEmpty()) if (!m_lastWinException.isEmpty())
logMsg = m_lastWinException + QLatin1Char('\n'); logMsg = m_lastWinException + QLatin1Char('\n');
logMsg += QString::fromLocal8Bit(msg); logMsg += QString::fromLocal8Bit(msg);
showMessageBox(QMessageBox::Critical, tr("Executable Failed"), logMsg); Core::AsynchronousMessageBox::critical(tr("Executable Failed"), logMsg);
showStatusMessage(tr("Executable failed: %1").arg(logMsg)); showStatusMessage(tr("Executable failed: %1").arg(logMsg));
} }
} }
@@ -1793,7 +1794,7 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
QString out1 = _("The selected build of GDB does not support Python scripting."); QString out1 = _("The selected build of GDB does not support Python scripting.");
QString out2 = _("It cannot be used in Qt Creator."); QString out2 = _("It cannot be used in Qt Creator.");
showStatusMessage(out1 + QLatin1Char(' ') + out2); showStatusMessage(out1 + QLatin1Char(' ') + out2);
showMessageBox(QMessageBox::Critical, tr("Execution Error"), out1 + _("<br>") + out2); Core::AsynchronousMessageBox::critical(tr("Execution Error"), out1 + _("<br>") + out2);
} }
notifyEngineSetupFailed(); notifyEngineSetupFailed();
} }
@@ -1801,7 +1802,7 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response)
void GdbEngine::showExecutionError(const QString &message) void GdbEngine::showExecutionError(const QString &message)
{ {
showMessageBox(QMessageBox::Critical, tr("Execution Error"), Core::AsynchronousMessageBox::critical(tr("Execution Error"),
tr("Cannot continue debugged process:") + QLatin1Char('\n') + message); tr("Cannot continue debugged process:") + QLatin1Char('\n') + message);
} }
@@ -1933,7 +1934,7 @@ void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
notifyInferiorShutdownOk(); notifyInferiorShutdownOk();
return; return;
} }
showMessageBox(QMessageBox::Critical, Core::AsynchronousMessageBox::critical(
tr("Failed to shut down application"), tr("Failed to shut down application"),
msgInferiorStopFailed(QString::fromLocal8Bit(ba))); msgInferiorStopFailed(QString::fromLocal8Bit(ba)));
notifyInferiorShutdownFailed(); notifyInferiorShutdownFailed();
@@ -2206,7 +2207,7 @@ void GdbEngine::handleExecuteNext(const GdbResponse &response)
showExecutionError(QString::fromLocal8Bit(msg)); showExecutionError(QString::fromLocal8Bit(msg));
notifyInferiorRunFailed(); notifyInferiorRunFailed();
} else { } else {
showMessageBox(QMessageBox::Critical, tr("Execution Error"), Core::AsynchronousMessageBox::critical(tr("Execution Error"),
tr("Cannot continue debugged process:") + QLatin1Char('\n') + QString::fromLocal8Bit(msg)); tr("Cannot continue debugged process:") + QLatin1Char('\n') + QString::fromLocal8Bit(msg));
notifyInferiorIll(); notifyInferiorIll();
} }
@@ -3061,7 +3062,7 @@ void GdbEngine::handleShowModuleSymbols(const GdbResponse &response)
file.remove(); file.remove();
Internal::showModuleSymbols(modulePath, symbols); Internal::showModuleSymbols(modulePath, symbols);
} else { } else {
showMessageBox(QMessageBox::Critical, tr("Cannot Read Symbols"), Core::AsynchronousMessageBox::critical(tr("Cannot Read Symbols"),
tr("Cannot read symbols for module \"%1\".").arg(fileName)); tr("Cannot read symbols for module \"%1\".").arg(fileName));
} }
} }
@@ -3528,7 +3529,7 @@ void GdbEngine::createSnapshot()
postCommand("gcore " + fileName.toLocal8Bit(), postCommand("gcore " + fileName.toLocal8Bit(),
NeedsStop|ConsoleCommand, CB(handleMakeSnapshot), fileName); NeedsStop|ConsoleCommand, CB(handleMakeSnapshot), fileName);
} else { } else {
showMessageBox(QMessageBox::Critical, tr("Snapshot Creation Error"), Core::AsynchronousMessageBox::critical(tr("Snapshot Creation Error"),
tr("Cannot create snapshot file.")); tr("Cannot create snapshot file."));
} }
} }
@@ -3551,7 +3552,7 @@ void GdbEngine::handleMakeSnapshot(const GdbResponse &response)
DebuggerRunControlFactory::createAndScheduleRun(sp); DebuggerRunControlFactory::createAndScheduleRun(sp);
} else { } else {
QByteArray msg = response.data["msg"].data(); QByteArray msg = response.data["msg"].data();
showMessageBox(QMessageBox::Critical, tr("Snapshot Creation Error"), Core::AsynchronousMessageBox::critical(tr("Snapshot Creation Error"),
tr("Cannot create snapshot:") + QLatin1Char('\n') + QString::fromLocal8Bit(msg)); tr("Cannot create snapshot:") + QLatin1Char('\n') + QString::fromLocal8Bit(msg));
} }
} }
@@ -4299,7 +4300,7 @@ void GdbEngine::loadInitScript()
if (QFileInfo(script).isReadable()) { if (QFileInfo(script).isReadable()) {
postCommand("source " + script.toLocal8Bit()); postCommand("source " + script.toLocal8Bit());
} else { } else {
showMessageBox(QMessageBox::Warning, Core::AsynchronousMessageBox::warning(
tr("Cannot find debugger initialization script"), tr("Cannot find debugger initialization script"),
tr("The debugger settings point to a script file at \"%1\" " tr("The debugger settings point to a script file at \"%1\" "
"which is not accessible. If a script file is not needed, " "which is not accessible. If a script file is not needed, "
@@ -4336,7 +4337,7 @@ void GdbEngine::handleGdbError(QProcess::ProcessError error)
default: default:
//m_gdbProc->kill(); //m_gdbProc->kill();
//notifyEngineIll(); //notifyEngineIll();
showMessageBox(QMessageBox::Critical, tr("GDB I/O Error"), msg); Core::AsynchronousMessageBox::critical(tr("GDB I/O Error"), msg);
break; break;
} }
} }
@@ -4364,7 +4365,7 @@ void GdbEngine::handleGdbFinished(int code, QProcess::ExitStatus type)
const QString msg = type == QProcess::CrashExit ? const QString msg = type == QProcess::CrashExit ?
tr("The gdb process terminated.") : tr("The gdb process terminated.") :
tr("The gdb process terminated unexpectedly (code %1)").arg(code); tr("The gdb process terminated unexpectedly (code %1)").arg(code);
showMessageBox(QMessageBox::Critical, tr("Unexpected GDB Exit"), msg); Core::AsynchronousMessageBox::critical(tr("Unexpected GDB Exit"), msg);
break; break;
} }
} }
@@ -4531,7 +4532,7 @@ void GdbEngine::notifyInferiorSetupFailed(const QString &msg)
return; // Adapter crashed meanwhile, so this notification is meaningless. return; // Adapter crashed meanwhile, so this notification is meaningless.
} }
showMessage(_("INFERIOR START FAILED")); showMessage(_("INFERIOR START FAILED"));
showMessageBox(QMessageBox::Critical, tr("Failed to start application"), msg); Core::AsynchronousMessageBox::critical(tr("Failed to start application"), msg);
DebuggerEngine::notifyInferiorSetupFailed(); DebuggerEngine::notifyInferiorSetupFailed();
} }
@@ -4553,7 +4554,7 @@ void GdbEngine::handleAdapterCrashed(const QString &msg)
m_gdbProc->kill(); m_gdbProc->kill();
if (!msg.isEmpty()) if (!msg.isEmpty())
showMessageBox(QMessageBox::Critical, tr("Adapter crashed"), msg); Core::AsynchronousMessageBox::critical(tr("Adapter crashed"), msg);
} }
void GdbEngine::createFullBacktrace() void GdbEngine::createFullBacktrace()

View File

@@ -38,12 +38,13 @@
#include <debugger/debuggerstartparameters.h> #include <debugger/debuggerstartparameters.h>
#include <debugger/debuggerstringutils.h> #include <debugger/debuggerstringutils.h>
#include <coreplugin/messagebox.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox>
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -130,7 +131,7 @@ void GdbRemoteServerEngine::uploadProcError(QProcess::ProcessError error)
} }
showMessage(msg, StatusBar); showMessage(msg, StatusBar);
showMessageBox(QMessageBox::Critical, tr("Error"), msg); Core::AsynchronousMessageBox::critical(tr("Error"), msg);
} }
void GdbRemoteServerEngine::readUploadStandardOutput() void GdbRemoteServerEngine::readUploadStandardOutput()

View File

@@ -37,6 +37,7 @@
#include <debugger/debuggerstartparameters.h> #include <debugger/debuggerstartparameters.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <projectexplorer/kitchooser.h> #include <projectexplorer/kitchooser.h>
#include <projectexplorer/devicesupport/deviceprocesslist.h> #include <projectexplorer/devicesupport/deviceprocesslist.h>
#include <projectexplorer/devicesupport/deviceprocessesdialog.h> #include <projectexplorer/devicesupport/deviceprocessesdialog.h>
@@ -45,7 +46,6 @@
#include <utils/portlist.h> #include <utils/portlist.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QMessageBox>
#include <QFileInfo> #include <QFileInfo>
using namespace Core; using namespace Core;
@@ -90,7 +90,7 @@ GdbServerStarter::~GdbServerStarter()
void GdbServerStarter::handleRemoteError(const QString &errorMsg) void GdbServerStarter::handleRemoteError(const QString &errorMsg)
{ {
QMessageBox::critical(0, tr("Remote Error"), errorMsg); Core::AsynchronousMessageBox::critical(tr("Remote Error"), errorMsg);
} }
void GdbServerStarter::portGathererError(const QString &text) void GdbServerStarter::portGathererError(const QString &text)
@@ -191,7 +191,7 @@ void GdbServerStarter::attach(int port)
localExecutable = candidate; localExecutable = candidate;
} }
if (localExecutable.isEmpty()) { if (localExecutable.isEmpty()) {
QMessageBox::warning(ICore::mainWindow(), tr("Warning"), Core::AsynchronousMessageBox::warning(tr("Warning"),
tr("Cannot find local executable for remote process \"%1\".") tr("Cannot find local executable for remote process \"%1\".")
.arg(d->process.exe)); .arg(d->process.exe));
return; return;
@@ -199,7 +199,7 @@ void GdbServerStarter::attach(int port)
QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(localExecutable)); QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(localExecutable));
if (abis.isEmpty()) { if (abis.isEmpty()) {
QMessageBox::warning(ICore::mainWindow(), tr("Warning"), Core::AsynchronousMessageBox::warning(tr("Warning"),
tr("Cannot find ABI for remote process \"%1\".") tr("Cannot find ABI for remote process \"%1\".")
.arg(d->process.exe)); .arg(d->process.exe));
return; return;

View File

@@ -39,8 +39,7 @@
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <QMessageBox>
using namespace Utils; using namespace Utils;
@@ -188,7 +187,7 @@ void GdbTermEngine::interruptInferior2()
void GdbTermEngine::stubError(const QString &msg) void GdbTermEngine::stubError(const QString &msg)
{ {
showMessageBox(QMessageBox::Critical, tr("Debugger Error"), msg); Core::AsynchronousMessageBox::critical(tr("Debugger Error"), msg);
} }
void GdbTermEngine::stubExited() void GdbTermEngine::stubExited()

View File

@@ -55,6 +55,7 @@
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
#include <coreplugin/messagebox.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
@@ -66,7 +67,6 @@
#include <QVariant> #include <QVariant>
#include <QApplication> #include <QApplication>
#include <QMessageBox>
#include <QToolTip> #include <QToolTip>
using namespace Utils; using namespace Utils;
@@ -949,7 +949,7 @@ void LldbEngine::handleLldbError(QProcess::ProcessError error)
default: default:
//setState(EngineShutdownRequested, true); //setState(EngineShutdownRequested, true);
m_lldbProc.kill(); m_lldbProc.kill();
showMessageBox(QMessageBox::Critical, tr("LLDB I/O Error"), Core::AsynchronousMessageBox::critical(tr("LLDB I/O Error"),
errorMessage(error)); errorMessage(error));
break; break;
} }
@@ -1441,7 +1441,7 @@ void LldbEngine::stubStarted()
void LldbEngine::stubError(const QString &msg) void LldbEngine::stubError(const QString &msg)
{ {
showMessageBox(QMessageBox::Critical, tr("Debugger Error"), msg); Core::AsynchronousMessageBox::critical(tr("Debugger Error"), msg);
} }
void LldbEngine::stubExited() void LldbEngine::stubExited()

View File

@@ -40,13 +40,12 @@
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/messagebox.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <extensionsystem/invoker.h> #include <extensionsystem/invoker.h>
#include <QMessageBox>
#include <cstring> #include <cstring>
using namespace Core; using namespace Core;
@@ -197,7 +196,7 @@ void MemoryAgent::createBinEditor(quint64 addr, unsigned flags,
const QString &title, QWidget *parent) const QString &title, QWidget *parent)
{ {
if (!doCreateBinEditor(addr, flags, ml, pos, title, parent)) if (!doCreateBinEditor(addr, flags, ml, pos, title, parent))
showMessageBox(QMessageBox::Warning, Core::AsynchronousMessageBox::warning(
tr("No Memory Viewer Available"), tr("No Memory Viewer Available"),
tr("The memory contents cannot be shown as no viewer plugin " tr("The memory contents cannot be shown as no viewer plugin "
"for binary data has been loaded.")); "for binary data has been loaded."));

View File

@@ -52,6 +52,7 @@
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <QDateTime> #include <QDateTime>
#include <QDebug> #include <QDebug>
@@ -61,7 +62,6 @@
#include <QVariant> #include <QVariant>
#include <QApplication> #include <QApplication>
#include <QMessageBox>
#include <QToolTip> #include <QToolTip>
@@ -198,7 +198,7 @@ void PdbEngine::setupInferior()
QString fileName = QFileInfo(startParameters().executable).absoluteFilePath(); QString fileName = QFileInfo(startParameters().executable).absoluteFilePath();
QFile scriptFile(fileName); QFile scriptFile(fileName);
if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) { if (!scriptFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
showMessageBox(QMessageBox::Critical, tr("Python Error"), Core::AsynchronousMessageBox::critical(tr("Python Error"),
_("Cannot open script file %1:\n%2"). _("Cannot open script file %1:\n%2").
arg(fileName, scriptFile.errorString())); arg(fileName, scriptFile.errorString()));
notifyInferiorSetupFailed(); notifyInferiorSetupFailed();
@@ -555,7 +555,7 @@ void PdbEngine::handlePdbError(QProcess::ProcessError error)
default: default:
//setState(EngineShutdownRequested, true); //setState(EngineShutdownRequested, true);
m_pdbProc.kill(); m_pdbProc.kill();
showMessageBox(QMessageBox::Critical, tr("Pdb I/O Error"), Core::AsynchronousMessageBox::critical(tr("Pdb I/O Error"),
errorMessage(error)); errorMessage(error));
break; break;
} }

View File

@@ -37,8 +37,9 @@
#include <debugger/debuggerstringutils.h> #include <debugger/debuggerstringutils.h>
#include <qmldebug/qmldebugclient.h> #include <qmldebug/qmldebugclient.h>
#include <coreplugin/messagebox.h>
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using QmlDebug::QmlDebugStream; using QmlDebug::QmlDebugStream;
@@ -448,7 +449,7 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
.arg(error.toHtmlEscaped()) .arg(error.toHtmlEscaped())
: tr("<p>An uncaught exception occurred in \"%1\":</p><p>%2</p>") : tr("<p>An uncaught exception occurred in \"%1\":</p><p>%2</p>")
.arg(QLatin1String(stackFrames.value(0).fileUrl), error.toHtmlEscaped()); .arg(QLatin1String(stackFrames.value(0).fileUrl), error.toHtmlEscaped());
showMessageBox(QMessageBox::Information, tr("Uncaught Exception"), msg); Core::AsynchronousMessageBox::information(tr("Uncaught Exception"), msg);
} else { } else {
QString file; QString file;
int line = -1; int line = -1;

View File

@@ -31,6 +31,7 @@
#include "cdbsymbolpathlisteditor.h" #include "cdbsymbolpathlisteditor.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/checkablemessagebox.h> #include <utils/checkablemessagebox.h>
@@ -98,14 +99,14 @@ void CacheDirectoryDialog::accept()
} }
// Does a file of the same name exist? // Does a file of the same name exist?
if (fi.exists()) { if (fi.exists()) {
QMessageBox::warning(this, tr("Already Exists"), Core::AsynchronousMessageBox::warning(tr("Already Exists"),
tr("A file named \"%1\" already exists.").arg(cache)); tr("A file named \"%1\" already exists.").arg(cache));
return; return;
} }
// Create // Create
QDir root(QDir::root()); QDir root(QDir::root());
if (!root.mkpath(cache)) { if (!root.mkpath(cache)) {
QMessageBox::warning(this, tr("Cannot Create"), Core::AsynchronousMessageBox::warning(tr("Cannot Create"),
tr("The folder \"%1\" could not be created.").arg(cache)); tr("The folder \"%1\" could not be created.").arg(cache));
return; return;
} }

View File

@@ -37,6 +37,7 @@
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include "memoryagent.h" #include "memoryagent.h"
#include <coreplugin/messagebox.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
@@ -50,7 +51,6 @@
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QInputDialog> #include <QInputDialog>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox>
#include <QMenu> #include <QMenu>
namespace Debugger { namespace Debugger {
@@ -127,7 +127,7 @@ void saveTaskFile(QWidget *parent, const StackHandler *sh)
const QString fileName = fileDialog.selectedFiles().front(); const QString fileName = fileDialog.selectedFiles().front();
file.setFileName(fileName); file.setFileName(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::warning(parent, StackTreeView::tr("Cannot Open Task File"), Core::AsynchronousMessageBox::warning(StackTreeView::tr("Cannot Open Task File"),
StackTreeView::tr("Cannot open \"%1\": %2").arg(QDir::toNativeSeparators(fileName), file.errorString())); StackTreeView::tr("Cannot open \"%1\": %2").arg(QDir::toNativeSeparators(fileName), file.errorString()));
} }
} }

View File

@@ -44,6 +44,8 @@
#include <texteditor/syntaxhighlighter.h> #include <texteditor/syntaxhighlighter.h>
#include <coreplugin/messagebox.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
#include <utils/fancylineedit.h> #include <utils/fancylineedit.h>
@@ -55,7 +57,6 @@
#include <QInputDialog> #include <QInputDialog>
#include <QItemDelegate> #include <QItemDelegate>
#include <QMenu> #include <QMenu>
#include <QMessageBox>
#include <QMetaProperty> #include <QMetaProperty>
#include <QMimeData> #include <QMimeData>
#include <QScrollBar> #include <QScrollBar>
@@ -436,7 +437,7 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
end += 8 - remainder; end += 8 - remainder;
// Anything found and everything in a sensible range (static data in-between)? // Anything found and everything in a sensible range (static data in-between)?
if (end <= start || end - start > 100 * 1024) { if (end <= start || end - start > 100 * 1024) {
QMessageBox::information(parent, Core::AsynchronousMessageBox::information(
WatchTreeView::tr("Cannot Display Stack Layout"), WatchTreeView::tr("Cannot Display Stack Layout"),
WatchTreeView::tr("Could not determine a suitable address range.")); WatchTreeView::tr("Could not determine a suitable address range."));
return; return;