Debugger: Replace Internal::mainWindow

... by DebuggerMainWindow::instance() and clean up a few uses.

Change-Id: I7ae4073aa97fc2f00108533bed91db330b07880f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-08-22 14:40:49 +02:00
parent 0303b84fff
commit 4b7a9ae5db
5 changed files with 20 additions and 24 deletions

View File

@@ -68,7 +68,6 @@ enum TestCases
// Some convenience. // Some convenience.
void openTextEditor(const QString &titlePattern, const QString &contents); void openTextEditor(const QString &titlePattern, const QString &contents);
QWidget *mainWindow();
void showModuleSymbols(const QString &moduleName, const QVector<Internal::Symbol> &symbols); void showModuleSymbols(const QString &moduleName, const QVector<Internal::Symbol> &symbols);
void showModuleSections(const QString &moduleName, const QVector<Internal::Section> &sections); void showModuleSections(const QString &moduleName, const QVector<Internal::Section> &sections);

View File

@@ -1258,7 +1258,7 @@ void DebuggerEngine::notifyInferiorSpontaneousStop()
showMessage(tr("Stopped."), StatusBar); showMessage(tr("Stopped."), StatusBar);
setState(InferiorStopOk); setState(InferiorStopOk);
if (boolSetting(RaiseOnInterrupt)) if (boolSetting(RaiseOnInterrupt))
ICore::raiseWindow(Internal::mainWindow()); ICore::raiseWindow(DebuggerMainWindow::instance());
EngineManager::activateEngine(this); EngineManager::activateEngine(this);
} }
@@ -1423,7 +1423,7 @@ void DebuggerEnginePrivate::updateState(bool alsoUpdateCompanion)
m_detachAction.setEnabled(detachable); m_detachAction.setEnabled(detachable);
if (stopped) if (stopped)
QApplication::alert(mainWindow(), 3000); QApplication::alert(ICore::mainWindow(), 3000);
updateReverseActions(); updateReverseActions();

View File

@@ -2318,11 +2318,6 @@ void openTextEditor(const QString &titlePattern0, const QString &contents)
QTC_ASSERT(editor, return); QTC_ASSERT(editor, return);
} }
QWidget *mainWindow()
{
return DebuggerMainWindow::instance();
}
QSharedPointer<Internal::GlobalDebuggerOptions> globalDebuggerOptions() QSharedPointer<Internal::GlobalDebuggerOptions> globalDebuggerOptions()
{ {
return dd->m_globalDebuggerOptions; return dd->m_globalDebuggerOptions;

View File

@@ -24,16 +24,18 @@
****************************************************************************/ ****************************************************************************/
#include "debuggertooltipmanager.h" #include "debuggertooltipmanager.h"
#include "debuggerinternalconstants.h"
#include "debuggerengine.h"
#include "debuggerprotocol.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "snapshothandler.h"
#include "stackhandler.h"
#include "debuggercore.h" #include "debuggercore.h"
#include "debuggerengine.h"
#include "debuggerinternalconstants.h"
#include "debuggermainwindow.h"
#include "debuggerprotocol.h"
#include "snapshothandler.h"
#include "sourceutils.h"
#include "stackhandler.h"
#include "watchhandler.h" #include "watchhandler.h"
#include "watchwindow.h" #include "watchwindow.h"
#include "sourceutils.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
@@ -797,7 +799,7 @@ void DebuggerToolTipHolder::updateTooltip(DebuggerEngine *engine)
if (state == PendingUnshown) { if (state == PendingUnshown) {
setState(PendingShown); setState(PendingShown);
ToolTip::show(context.mousePosition, widget, Internal::mainWindow()); ToolTip::show(context.mousePosition, widget, DebuggerMainWindow::instance());
} }
if (item && sameFrame) { if (item && sameFrame) {
@@ -845,7 +847,7 @@ void DebuggerToolTipHolder::releaseEngine()
// (Out of scope items, keywords, ...) // (Out of scope items, keywords, ...)
ToolTip::show(context.mousePosition, ToolTip::show(context.mousePosition,
DebuggerToolTipManager::tr("No valid expression"), DebuggerToolTipManager::tr("No valid expression"),
Internal::mainWindow()); DebuggerMainWindow::instance());
widget->deleteLater(); widget->deleteLater();
return; return;
} }
@@ -1156,7 +1158,7 @@ static void slotTooltipOverrideRequested
if (context.expression.isEmpty()) { if (context.expression.isEmpty()) {
ToolTip::show(point, DebuggerToolTipManager::tr("No valid expression"), ToolTip::show(point, DebuggerToolTipManager::tr("No valid expression"),
Internal::mainWindow()); DebuggerMainWindow::instance());
*handled = true; *handled = true;
return; return;
} }
@@ -1178,13 +1180,13 @@ static void slotTooltipOverrideRequested
if (tooltip) { if (tooltip) {
DEBUG("REUSING LOCALS TOOLTIP"); DEBUG("REUSING LOCALS TOOLTIP");
tooltip->context.mousePosition = point; tooltip->context.mousePosition = point;
ToolTip::move(point, Internal::mainWindow()); ToolTip::move(point, DebuggerMainWindow::instance());
} else { } else {
DEBUG("CREATING LOCALS, WAITING..."); DEBUG("CREATING LOCALS, WAITING...");
tooltip = new DebuggerToolTipHolder(context); tooltip = new DebuggerToolTipHolder(context);
tooltip->setState(Acquired); tooltip->setState(Acquired);
m_tooltips.push_back(tooltip); m_tooltips.push_back(tooltip);
ToolTip::show(point, tooltip->widget, Internal::mainWindow()); ToolTip::show(point, tooltip->widget, DebuggerMainWindow::instance());
} }
DEBUG("SYNC IN STATE" << tooltip->state); DEBUG("SYNC IN STATE" << tooltip->state);
tooltip->updateTooltip(engine); tooltip->updateTooltip(engine);
@@ -1202,7 +1204,7 @@ static void slotTooltipOverrideRequested
if (tooltip) { if (tooltip) {
//tooltip->destroy(); //tooltip->destroy();
tooltip->context.mousePosition = point; tooltip->context.mousePosition = point;
ToolTip::move(point, Internal::mainWindow()); ToolTip::move(point, DebuggerMainWindow::instance());
DEBUG("UPDATING DELAYED."); DEBUG("UPDATING DELAYED.");
*handled = true; *handled = true;
} else { } else {
@@ -1215,7 +1217,7 @@ static void slotTooltipOverrideRequested
engine->updateItem(context.iname); engine->updateItem(context.iname);
} else { } else {
ToolTip::show(point, DebuggerToolTipManager::tr("Expression too complex"), ToolTip::show(point, DebuggerToolTipManager::tr("Expression too complex"),
Internal::mainWindow()); DebuggerMainWindow::instance());
tooltip->destroy(); tooltip->destroy();
} }
} }

View File

@@ -31,6 +31,7 @@
#include "debuggerdialogs.h" #include "debuggerdialogs.h"
#include "debuggerengine.h" #include "debuggerengine.h"
#include "debuggerinternalconstants.h" #include "debuggerinternalconstants.h"
#include "debuggermainwindow.h"
#include "debuggerprotocol.h" #include "debuggerprotocol.h"
#include "debuggertooltipmanager.h" #include "debuggertooltipmanager.h"
#include "imageviewer.h" #include "imageviewer.h"
@@ -269,7 +270,7 @@ static void saveFormats()
class SeparatedView : public QTabWidget class SeparatedView : public QTabWidget
{ {
public: public:
SeparatedView() : QTabWidget(Internal::mainWindow()) SeparatedView() : QTabWidget(DebuggerMainWindow::instance())
{ {
setTabsClosable(true); setTabsClosable(true);
connect(this, &QTabWidget::tabCloseRequested, this, &SeparatedView::closeTab); connect(this, &QTabWidget::tabCloseRequested, this, &SeparatedView::closeTab);
@@ -1975,8 +1976,7 @@ void WatchHandler::cleanup()
saveWatchers(); saveWatchers();
m_model->reinitialize(); m_model->reinitialize();
emit m_model->updateFinished(); emit m_model->updateFinished();
if (Internal::mainWindow()) m_model->m_separatedView->hide();
m_model->m_separatedView->hide();
} }
static bool sortByName(const WatchItem *a, const WatchItem *b) static bool sortByName(const WatchItem *a, const WatchItem *b)