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:
hjk
2014-11-17 10:19:18 +01:00
parent 4c614d970b
commit 1b31e8eebd
4 changed files with 39 additions and 22 deletions

View File

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