diff --git a/src/plugins/debugger/commonoptionspage.ui b/src/plugins/debugger/commonoptionspage.ui index 6d55c88a9efa72dd328336e1af3ba70159dbd438..7440d0bbdf60834aaf4e470cfbf9f10f4db1b46b 100644 --- a/src/plugins/debugger/commonoptionspage.ui +++ b/src/plugins/debugger/commonoptionspage.ui @@ -51,7 +51,27 @@ </property> </widget> </item> - <item row="4" column="0"> + <item row="4" column="0" colspan="2"> + <widget class="QCheckBox" name="checkBoxCloseBuffersOnExit"> + <property name="toolTip"> + <string>Close temporary buffers on debugger exit.</string> + </property> + <property name="text"> + <string>Close temporary buffers on debugger exit</string> + </property> + </widget> + </item> + <item row="5" column="0" colspan="2"> + <widget class="QCheckBox" name="checkBoxSwitchModeOnExit"> + <property name="toolTip"> + <string>Switch to previous mode on debugger exit.</string> + </property> + <property name="text"> + <string>Switch to previous mode on debugger exit.</string> + </property> + </widget> + </item> + <item row="6" column="0"> <widget class="QLabel" name="labelMaximalStackDepth"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> @@ -64,7 +84,7 @@ </property> </widget> </item> - <item row="4" column="1"> + <item row="6" column="1"> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QSpinBox" name="spinBoxMaximalStackDepth"> diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 424abcd4c1ffd0a7921acc710af1f8bf7219067b..3774c37793fd25bf00a55307c486b5314b92bb06 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -369,6 +369,18 @@ DebuggerSettings *DebuggerSettings::instance() item->setDefaultValue(QString()); instance->insertItem(GdbScriptFile, item); + item = new SavedAction(instance); + item->setSettingsKey(debugModeGroup, QLatin1String("CloseBuffersOnExit")); + item->setCheckable(true); + item->setDefaultValue(false); + instance->insertItem(CloseBuffersOnExit, item); + + item = new SavedAction(instance); + item->setSettingsKey(debugModeGroup, QLatin1String("SwitchModeOnExit")); + item->setCheckable(true); + item->setDefaultValue(false); + instance->insertItem(SwitchModeOnExit, item); + item = new SavedAction(instance); item->setSettingsKey(debugModeGroup, QLatin1String("AutoQuit")); item->setText(tr("Automatically Quit Debugger")); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index bf8f54a71e83ad8e9cc3a4342fb722f7db3dc504..72845ec2db1a39f4b67584eb6e618fb7569bccd1 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -92,7 +92,8 @@ enum DebuggerActionCode LogTimeStamps, VerboseLog, OperateByInstruction, - AutoDerefPointers, + CloseBuffersOnExit, + SwitchModeOnExit, UseDebuggingHelpers, UseCustomDebuggingHelperLocation, @@ -125,6 +126,7 @@ enum DebuggerActionCode ShowStdNamespace, ShowQtNamespace, SortStructMembers, + AutoDerefPointers, // Source List ListSourceFiles, diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index c3ffb668f396ef382d3f22a0b18d5e6c84dfa57c..f00f908a79cc1da17e35fd10c94c86dd757c1700 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -561,6 +561,10 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent) m_ui.checkBoxUseAlternatingRowColors); m_group.insert(theDebuggerAction(UseToolTipsInMainEditor), m_ui.checkBoxUseToolTipsInMainEditor); + m_group.insert(theDebuggerAction(CloseBuffersOnExit), + m_ui.checkBoxCloseBuffersOnExit); + m_group.insert(theDebuggerAction(SwitchModeOnExit), + m_ui.checkBoxSwitchModeOnExit); m_group.insert(theDebuggerAction(AutoDerefPointers), 0); m_group.insert(theDebuggerAction(UseToolTipsInLocalsView), 0); m_group.insert(theDebuggerAction(UseToolTipsInBreakpointsView), 0); @@ -2127,12 +2131,14 @@ void DebuggerPluginPrivate::cleanupViews() //if (d->m_engine) // d->m_engine->cleanup(); - if (EditorManager *editorManager = EditorManager::instance()) { - QList<IEditor *> toClose; - foreach (IEditor *editor, editorManager->openedEditors()) - if (editor->property("OpenedByDebugger").toBool()) - toClose.append(editor); - editorManager->closeEditors(toClose); + if (theDebuggerBoolSetting(CloseBuffersOnExit)) { + if (EditorManager *editorManager = EditorManager::instance()) { + QList<IEditor *> toClose; + foreach (IEditor *editor, editorManager->openedEditors()) + if (editor->property("OpenedByDebugger").toBool()) + toClose.append(editor); + editorManager->closeEditors(toClose); + } } } @@ -2834,8 +2840,9 @@ void DebuggerPlugin::runControlFinished(DebuggerRunControl *runControl) Q_UNUSED(runControl); d->m_snapshotHandler->removeSnapshot(runControl); d->disconnectEngine(); - if (d->m_snapshotHandler->size() == 0) - d->activatePreviousMode(); + if (theDebuggerBoolSetting(SwitchModeOnExit)) + if (d->m_snapshotHandler->size() == 0) + d->activatePreviousMode(); } DebuggerLanguages DebuggerPlugin::activeLanguages() const