forked from qt-creator/qt-creator
Debugger: Introduce "Close memory buffers on exit" option
The usual case is probably to want normal editors stay open, but memory/diassembler removed, but all other combinations may be useful at times. So use two options instead of one. Change-Id: I58c3951cc507c7e66a8d7a65b459a036e6a5d801 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -69,7 +69,8 @@ private:
|
||||
QCheckBox *checkBoxFontSizeFollowsEditor;
|
||||
QCheckBox *checkBoxUseToolTipsInMainEditor;
|
||||
QCheckBox *checkBoxListSourceFiles;
|
||||
QCheckBox *checkBoxCloseBuffersOnExit;
|
||||
QCheckBox *checkBoxCloseSourceBuffersOnExit;
|
||||
QCheckBox *checkBoxCloseMemoryBuffersOnExit;
|
||||
QCheckBox *checkBoxSwitchModeOnExit;
|
||||
QCheckBox *checkBoxBringToForegroundOnInterrrupt;
|
||||
QCheckBox *checkBoxShowQmlObjectTree;
|
||||
@@ -105,12 +106,17 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
||||
checkBoxListSourceFiles->setToolTip(tr("Populates the source file view automatically. This might slow down debugger startup considerably."));
|
||||
checkBoxListSourceFiles->setText(tr("Populate source file view automatically"));
|
||||
|
||||
checkBoxCloseBuffersOnExit = new QCheckBox(behaviorBox);
|
||||
checkBoxCloseBuffersOnExit->setText(tr("Close temporary views on debugger exit"));
|
||||
checkBoxCloseBuffersOnExit->setToolTip(tr("Stopping and stepping in the debugger "
|
||||
"will automatically open source or disassembler views associated with the "
|
||||
"current location. Select this option to automatically close them when "
|
||||
"the debugger exits."));
|
||||
QString t = tr("Stopping and stepping in the debugger "
|
||||
"will automatically open views associated with the current location.") + QLatin1Char('\n');
|
||||
checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox);
|
||||
checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit"));
|
||||
checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Select this option to close "
|
||||
"automatically opened source views when the debugger exits."));
|
||||
|
||||
checkBoxCloseMemoryBuffersOnExit = new QCheckBox(behaviorBox);
|
||||
checkBoxCloseMemoryBuffersOnExit->setText(tr("Close temporary memory views on debugger exit"));
|
||||
checkBoxCloseMemoryBuffersOnExit->setToolTip(t + tr("Select this option to close "
|
||||
"automatically opened memory views when the debugger exits."));
|
||||
|
||||
checkBoxSwitchModeOnExit = new QCheckBox(behaviorBox);
|
||||
checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit"));
|
||||
@@ -160,11 +166,12 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
||||
QGridLayout *gridLayout = new QGridLayout(behaviorBox);
|
||||
gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxCloseBuffersOnExit, 2, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 3, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxBreakpointsFullPath, 4, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 5, 0, 1, 1);
|
||||
gridLayout->addLayout(horizontalLayout, 6, 0, 1, 2);
|
||||
gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxCloseMemoryBuffersOnExit, 3, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 4, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxBreakpointsFullPath, 5, 0, 1, 1);
|
||||
gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 6, 0, 1, 1);
|
||||
gridLayout->addLayout(horizontalLayout, 7, 0, 1, 2);
|
||||
|
||||
gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1);
|
||||
gridLayout->addWidget(checkBoxListSourceFiles, 1, 1, 1, 1);
|
||||
@@ -186,8 +193,10 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
||||
checkBoxUseAlternatingRowColors);
|
||||
m_group->insert(action(UseToolTipsInMainEditor),
|
||||
checkBoxUseToolTipsInMainEditor);
|
||||
m_group->insert(action(CloseBuffersOnExit),
|
||||
checkBoxCloseBuffersOnExit);
|
||||
m_group->insert(action(CloseSourceBuffersOnExit),
|
||||
checkBoxCloseSourceBuffersOnExit);
|
||||
m_group->insert(action(CloseMemoryBuffersOnExit),
|
||||
checkBoxCloseMemoryBuffersOnExit);
|
||||
m_group->insert(action(SwitchModeOnExit),
|
||||
checkBoxSwitchModeOnExit);
|
||||
m_group->insert(action(BreakpointsFullPathByDefault),
|
||||
|
@@ -433,7 +433,13 @@ DebuggerSettings::DebuggerSettings()
|
||||
item->setSettingsKey(debugModeGroup, QLatin1String("CloseBuffersOnExit"));
|
||||
item->setCheckable(true);
|
||||
item->setDefaultValue(false);
|
||||
insertItem(CloseBuffersOnExit, item);
|
||||
insertItem(CloseSourceBuffersOnExit, item);
|
||||
|
||||
item = new SavedAction(this);
|
||||
item->setSettingsKey(debugModeGroup, QLatin1String("CloseMemoryBuffersOnExit"));
|
||||
item->setCheckable(true);
|
||||
item->setDefaultValue(true);
|
||||
insertItem(CloseMemoryBuffersOnExit, item);
|
||||
|
||||
item = new SavedAction(this);
|
||||
item->setSettingsKey(debugModeGroup, QLatin1String("SwitchModeOnExit"));
|
||||
|
@@ -99,7 +99,8 @@ enum DebuggerActionCode
|
||||
LogTimeStamps,
|
||||
VerboseLog,
|
||||
OperateByInstruction,
|
||||
CloseBuffersOnExit,
|
||||
CloseSourceBuffersOnExit,
|
||||
CloseMemoryBuffersOnExit,
|
||||
SwitchModeOnExit,
|
||||
BreakpointsFullPathByDefault,
|
||||
RaiseOnInterrupt,
|
||||
|
@@ -1982,21 +1982,22 @@ void DebuggerPluginPrivate::cleanupViews()
|
||||
m_reverseDirectionAction->setChecked(false);
|
||||
m_reverseDirectionAction->setEnabled(false);
|
||||
|
||||
if (!boolSetting(CloseBuffersOnExit))
|
||||
return;
|
||||
const bool closeSource = boolSetting(CloseSourceBuffersOnExit);
|
||||
const bool closeMemory = boolSetting(CloseMemoryBuffersOnExit);
|
||||
|
||||
QList<IDocument *> toClose;
|
||||
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
||||
const bool isMemory = document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool();
|
||||
if (document->property(Constants::OPENED_BY_DEBUGGER).toBool()) {
|
||||
bool keepIt = true;
|
||||
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool())
|
||||
keepIt = false;
|
||||
else if (document->isModified())
|
||||
if (document->isModified())
|
||||
keepIt = true;
|
||||
else if (document->filePath().contains(_("qeventdispatcher")))
|
||||
keepIt = false;
|
||||
else if (isMemory)
|
||||
keepIt = !closeMemory;
|
||||
else
|
||||
keepIt = (document == EditorManager::currentDocument());
|
||||
keepIt = !closeSource;
|
||||
|
||||
if (keepIt)
|
||||
document->setProperty(Constants::OPENED_BY_DEBUGGER, false);
|
||||
|
Reference in New Issue
Block a user