forked from qt-creator/qt-creator
Debugger: Move perspective saving to a time where mode is active
It should not make and I do not observe a difference, but it seems the better thing to do. Change-Id: I1f1f9fba72c2b20f24ebde04cf4ec3711d77d476 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -306,9 +306,8 @@ void DebuggerMainWindow::showStatusMessage(const QString &message, int timeoutMS
|
||||
theMainWindow->d->m_statusLabel->showStatusMessage(message, timeoutMS);
|
||||
}
|
||||
|
||||
void DebuggerMainWindow::onModeChanged(Core::Id mode)
|
||||
void DebuggerMainWindow::enterDebugMode()
|
||||
{
|
||||
if (mode == Debugger::Constants::MODE_DEBUG) {
|
||||
theMainWindow->setDockActionsVisible(true);
|
||||
Perspective *perspective = theMainWindow->d->m_currentPerspective;
|
||||
if (!perspective) {
|
||||
@@ -324,7 +323,10 @@ void DebuggerMainWindow::onModeChanged(Core::Id mode)
|
||||
// There's at least the debugger preset perspective that should be found above.
|
||||
QTC_ASSERT(perspective, return);
|
||||
perspective->select();
|
||||
} else {
|
||||
}
|
||||
|
||||
void DebuggerMainWindow::leaveDebugMode()
|
||||
{
|
||||
if (Perspective *perspective = theMainWindow->d->m_currentPerspective)
|
||||
perspective->d->saveLayout();
|
||||
|
||||
@@ -336,7 +338,6 @@ void DebuggerMainWindow::onModeChanged(Core::Id mode)
|
||||
dockWidget->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QWidget *DebuggerMainWindow::centralWidgetStack()
|
||||
{
|
||||
|
||||
@@ -126,7 +126,8 @@ public:
|
||||
static void doShutdown();
|
||||
|
||||
static void showStatusMessage(const QString &message, int timeoutMS);
|
||||
static void onModeChanged(Core::Id mode);
|
||||
static void enterDebugMode();
|
||||
static void leaveDebugMode();
|
||||
|
||||
static QWidget *centralWidgetStack();
|
||||
void addSubPerspectiveSwitcher(QWidget *widget);
|
||||
|
||||
@@ -696,7 +696,6 @@ public:
|
||||
int lineNumber, QMenu *menu);
|
||||
|
||||
void toggleBreakpointHelper();
|
||||
void onModeChanged(Id mode);
|
||||
void updateDebugWithoutDeployMenu();
|
||||
|
||||
void startRemoteCdbSession();
|
||||
@@ -1352,8 +1351,19 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
||||
addCdbOptionPages(&m_optionPages);
|
||||
m_optionPages.append(new LocalsAndExpressionsOptionsPage);
|
||||
|
||||
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
|
||||
this, &DebuggerPluginPrivate::onModeChanged);
|
||||
connect(ModeManager::instance(), &ModeManager::currentModeAboutToChange, this, [] {
|
||||
if (ModeManager::currentModeId() == MODE_DEBUG)
|
||||
DebuggerMainWindow::leaveDebugMode();
|
||||
});
|
||||
|
||||
connect(ModeManager::instance(), &ModeManager::currentModeChanged, this, [](Id mode) {
|
||||
if (mode == MODE_DEBUG) {
|
||||
DebuggerMainWindow::enterDebugMode();
|
||||
if (IEditor *editor = EditorManager::currentEditor())
|
||||
editor->widget()->setFocus();
|
||||
}
|
||||
});
|
||||
|
||||
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
|
||||
this, &DebuggerPluginPrivate::updateDebugWithoutDeployMenu);
|
||||
|
||||
@@ -2283,19 +2293,6 @@ void DebuggerPlugin::extensionsInitialized()
|
||||
dd->extensionsInitialized();
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::onModeChanged(Id mode)
|
||||
{
|
||||
DebuggerMainWindow::onModeChanged(mode);
|
||||
// FIXME: This one gets always called, even if switching between modes
|
||||
// different then the debugger mode. E.g. Welcome and Help mode and
|
||||
// also on shutdown.
|
||||
|
||||
if (mode == MODE_DEBUG) {
|
||||
if (IEditor *editor = EditorManager::currentEditor())
|
||||
editor->widget()->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
static bool buildTypeAccepted(QFlags<ToolMode> toolMode, BuildConfiguration::BuildType buildType)
|
||||
|
||||
Reference in New Issue
Block a user