Debugger: Move session load/restore handling

... to breakpoint and watchhandler.

More modular this way.

Change-Id: I4a45481fcc2bfde67b164bd7274fb7b2a12cb7ac
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2018-08-23 16:39:23 +02:00
parent 37dbc7ba85
commit a68e8c5b69
7 changed files with 46 additions and 73 deletions

View File

@@ -40,6 +40,8 @@
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
#include <projectexplorer/session.h>
#include <texteditor/textmark.h>
#include <texteditor/texteditor.h>
@@ -69,6 +71,7 @@
#include <QMenu>
using namespace Core;
using namespace ProjectExplorer;
using namespace Utils;
namespace Debugger {
@@ -2391,6 +2394,12 @@ BreakpointManager::BreakpointManager()
theBreakpointManager = this;
setHeader({tr("Debuggee"), tr("Function"), tr("File"), tr("Line"), tr("Address"),
tr("Condition"), tr("Ignore"), tr("Threads")});
connect(SessionManager::instance(), &SessionManager::sessionLoaded,
this, &BreakpointManager::loadSessionData);
connect(SessionManager::instance(), &SessionManager::aboutToSaveSession,
this, &BreakpointManager::saveSessionData);
connect(SessionManager::instance(), &SessionManager::aboutToUnloadSession,
this, &BreakpointManager::aboutToUnloadSession);
}
QAbstractItemModel *BreakpointManager::model()
@@ -2755,20 +2764,20 @@ void BreakpointManager::saveSessionData()
map.insert("message", params.message);
list.append(map);
});
setSessionValue("Breakpoints", list);
SessionManager::setValue("Breakpoints", list);
}
void BreakpointManager::aboutToUnloadSession()
{
saveSessionData();
theBreakpointManager->clear();
clear();
}
void BreakpointManager::loadSessionData()
{
theBreakpointManager->clear();
clear();
const QVariant value = sessionValue("Breakpoints");
const QVariant value = SessionManager::value("Breakpoints");
const QList<QVariant> list = value.toList();
for (const QVariant &var : list) {
const QMap<QString, QVariant> map = var.toMap();