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:
hjk
2019-03-14 12:21:47 +01:00
parent f3922acc71
commit 4d5da2938a
3 changed files with 42 additions and 43 deletions

View File

@@ -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)