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 *checkBoxFontSizeFollowsEditor;
|
||||||
QCheckBox *checkBoxUseToolTipsInMainEditor;
|
QCheckBox *checkBoxUseToolTipsInMainEditor;
|
||||||
QCheckBox *checkBoxListSourceFiles;
|
QCheckBox *checkBoxListSourceFiles;
|
||||||
QCheckBox *checkBoxCloseBuffersOnExit;
|
QCheckBox *checkBoxCloseSourceBuffersOnExit;
|
||||||
|
QCheckBox *checkBoxCloseMemoryBuffersOnExit;
|
||||||
QCheckBox *checkBoxSwitchModeOnExit;
|
QCheckBox *checkBoxSwitchModeOnExit;
|
||||||
QCheckBox *checkBoxBringToForegroundOnInterrrupt;
|
QCheckBox *checkBoxBringToForegroundOnInterrrupt;
|
||||||
QCheckBox *checkBoxShowQmlObjectTree;
|
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->setToolTip(tr("Populates the source file view automatically. This might slow down debugger startup considerably."));
|
||||||
checkBoxListSourceFiles->setText(tr("Populate source file view automatically"));
|
checkBoxListSourceFiles->setText(tr("Populate source file view automatically"));
|
||||||
|
|
||||||
checkBoxCloseBuffersOnExit = new QCheckBox(behaviorBox);
|
QString t = tr("Stopping and stepping in the debugger "
|
||||||
checkBoxCloseBuffersOnExit->setText(tr("Close temporary views on debugger exit"));
|
"will automatically open views associated with the current location.") + QLatin1Char('\n');
|
||||||
checkBoxCloseBuffersOnExit->setToolTip(tr("Stopping and stepping in the debugger "
|
checkBoxCloseSourceBuffersOnExit = new QCheckBox(behaviorBox);
|
||||||
"will automatically open source or disassembler views associated with the "
|
checkBoxCloseSourceBuffersOnExit->setText(tr("Close temporary source views on debugger exit"));
|
||||||
"current location. Select this option to automatically close them when "
|
checkBoxCloseSourceBuffersOnExit->setToolTip(t + tr("Select this option to close "
|
||||||
"the debugger exits."));
|
"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 = new QCheckBox(behaviorBox);
|
||||||
checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit"));
|
checkBoxSwitchModeOnExit->setText(tr("Switch to previous mode on debugger exit"));
|
||||||
@@ -160,11 +166,12 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
|||||||
QGridLayout *gridLayout = new QGridLayout(behaviorBox);
|
QGridLayout *gridLayout = new QGridLayout(behaviorBox);
|
||||||
gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1);
|
gridLayout->addWidget(checkBoxUseAlternatingRowColors, 0, 0, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1);
|
gridLayout->addWidget(checkBoxUseToolTipsInMainEditor, 1, 0, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxCloseBuffersOnExit, 2, 0, 1, 1);
|
gridLayout->addWidget(checkBoxCloseSourceBuffersOnExit, 2, 0, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 3, 0, 1, 1);
|
gridLayout->addWidget(checkBoxCloseMemoryBuffersOnExit, 3, 0, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxBreakpointsFullPath, 4, 0, 1, 1);
|
gridLayout->addWidget(checkBoxBringToForegroundOnInterrrupt, 4, 0, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 5, 0, 1, 1);
|
gridLayout->addWidget(checkBoxBreakpointsFullPath, 5, 0, 1, 1);
|
||||||
gridLayout->addLayout(horizontalLayout, 6, 0, 1, 2);
|
gridLayout->addWidget(checkBoxWarnOnReleaseBuilds, 6, 0, 1, 1);
|
||||||
|
gridLayout->addLayout(horizontalLayout, 7, 0, 1, 2);
|
||||||
|
|
||||||
gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1);
|
gridLayout->addWidget(checkBoxFontSizeFollowsEditor, 0, 1, 1, 1);
|
||||||
gridLayout->addWidget(checkBoxListSourceFiles, 1, 1, 1, 1);
|
gridLayout->addWidget(checkBoxListSourceFiles, 1, 1, 1, 1);
|
||||||
@@ -186,8 +193,10 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
|
|||||||
checkBoxUseAlternatingRowColors);
|
checkBoxUseAlternatingRowColors);
|
||||||
m_group->insert(action(UseToolTipsInMainEditor),
|
m_group->insert(action(UseToolTipsInMainEditor),
|
||||||
checkBoxUseToolTipsInMainEditor);
|
checkBoxUseToolTipsInMainEditor);
|
||||||
m_group->insert(action(CloseBuffersOnExit),
|
m_group->insert(action(CloseSourceBuffersOnExit),
|
||||||
checkBoxCloseBuffersOnExit);
|
checkBoxCloseSourceBuffersOnExit);
|
||||||
|
m_group->insert(action(CloseMemoryBuffersOnExit),
|
||||||
|
checkBoxCloseMemoryBuffersOnExit);
|
||||||
m_group->insert(action(SwitchModeOnExit),
|
m_group->insert(action(SwitchModeOnExit),
|
||||||
checkBoxSwitchModeOnExit);
|
checkBoxSwitchModeOnExit);
|
||||||
m_group->insert(action(BreakpointsFullPathByDefault),
|
m_group->insert(action(BreakpointsFullPathByDefault),
|
||||||
|
@@ -433,7 +433,13 @@ DebuggerSettings::DebuggerSettings()
|
|||||||
item->setSettingsKey(debugModeGroup, QLatin1String("CloseBuffersOnExit"));
|
item->setSettingsKey(debugModeGroup, QLatin1String("CloseBuffersOnExit"));
|
||||||
item->setCheckable(true);
|
item->setCheckable(true);
|
||||||
item->setDefaultValue(false);
|
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 = new SavedAction(this);
|
||||||
item->setSettingsKey(debugModeGroup, QLatin1String("SwitchModeOnExit"));
|
item->setSettingsKey(debugModeGroup, QLatin1String("SwitchModeOnExit"));
|
||||||
|
@@ -99,7 +99,8 @@ enum DebuggerActionCode
|
|||||||
LogTimeStamps,
|
LogTimeStamps,
|
||||||
VerboseLog,
|
VerboseLog,
|
||||||
OperateByInstruction,
|
OperateByInstruction,
|
||||||
CloseBuffersOnExit,
|
CloseSourceBuffersOnExit,
|
||||||
|
CloseMemoryBuffersOnExit,
|
||||||
SwitchModeOnExit,
|
SwitchModeOnExit,
|
||||||
BreakpointsFullPathByDefault,
|
BreakpointsFullPathByDefault,
|
||||||
RaiseOnInterrupt,
|
RaiseOnInterrupt,
|
||||||
|
@@ -1982,21 +1982,22 @@ void DebuggerPluginPrivate::cleanupViews()
|
|||||||
m_reverseDirectionAction->setChecked(false);
|
m_reverseDirectionAction->setChecked(false);
|
||||||
m_reverseDirectionAction->setEnabled(false);
|
m_reverseDirectionAction->setEnabled(false);
|
||||||
|
|
||||||
if (!boolSetting(CloseBuffersOnExit))
|
const bool closeSource = boolSetting(CloseSourceBuffersOnExit);
|
||||||
return;
|
const bool closeMemory = boolSetting(CloseMemoryBuffersOnExit);
|
||||||
|
|
||||||
QList<IDocument *> toClose;
|
QList<IDocument *> toClose;
|
||||||
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
||||||
|
const bool isMemory = document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool();
|
||||||
if (document->property(Constants::OPENED_BY_DEBUGGER).toBool()) {
|
if (document->property(Constants::OPENED_BY_DEBUGGER).toBool()) {
|
||||||
bool keepIt = true;
|
bool keepIt = true;
|
||||||
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool())
|
if (document->isModified())
|
||||||
keepIt = false;
|
|
||||||
else if (document->isModified())
|
|
||||||
keepIt = true;
|
keepIt = true;
|
||||||
else if (document->filePath().contains(_("qeventdispatcher")))
|
else if (document->filePath().contains(_("qeventdispatcher")))
|
||||||
keepIt = false;
|
keepIt = false;
|
||||||
|
else if (isMemory)
|
||||||
|
keepIt = !closeMemory;
|
||||||
else
|
else
|
||||||
keepIt = (document == EditorManager::currentDocument());
|
keepIt = !closeSource;
|
||||||
|
|
||||||
if (keepIt)
|
if (keepIt)
|
||||||
document->setProperty(Constants::OPENED_BY_DEBUGGER, false);
|
document->setProperty(Constants::OPENED_BY_DEBUGGER, false);
|
||||||
|
Reference in New Issue
Block a user