forked from qt-creator/qt-creator
Debugger: Streamline settings access pattern
Change-Id: Ie73b8d9fa945ee9dcbab67177410cc782979c8ad Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -335,7 +335,7 @@ void BreakHandler::saveBreakpoints()
|
|||||||
map.insert(_("message"), data.message);
|
map.insert(_("message"), data.message);
|
||||||
list.append(map);
|
list.append(map);
|
||||||
}
|
}
|
||||||
debuggerCore()->setSessionValue(QLatin1String("Breakpoints"), list);
|
DebuggerCore::setSessionValue("Breakpoints", list);
|
||||||
//qDebug() << "SAVED BREAKPOINTS" << this << list.size();
|
//qDebug() << "SAVED BREAKPOINTS" << this << list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ void BreakHandler::loadBreakpoints()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(debuggerCore(), return);
|
QTC_ASSERT(debuggerCore(), return);
|
||||||
//qDebug() << "LOADING BREAKPOINTS...";
|
//qDebug() << "LOADING BREAKPOINTS...";
|
||||||
QVariant value = debuggerCore()->sessionValue(QLatin1String("Breakpoints"));
|
QVariant value = DebuggerCore::sessionValue("Breakpoints");
|
||||||
QList<QVariant> list = value.toList();
|
QList<QVariant> list = value.toList();
|
||||||
//clear();
|
//clear();
|
||||||
foreach (const QVariant &var, list) {
|
foreach (const QVariant &var, list) {
|
||||||
|
@@ -260,13 +260,12 @@ void CommonOptionsPage::apply()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(!m_widget.isNull() && !m_group.isNull(), return);
|
QTC_ASSERT(!m_widget.isNull() && !m_group.isNull(), return);
|
||||||
|
|
||||||
QSettings *settings = ICore::settings();
|
m_group->apply(ICore::settings());
|
||||||
m_group->apply(settings);
|
|
||||||
|
|
||||||
const GlobalDebuggerOptions newGlobalOptions = m_widget->globalOptions();
|
const GlobalDebuggerOptions newGlobalOptions = m_widget->globalOptions();
|
||||||
if (newGlobalOptions != *m_options) {
|
if (newGlobalOptions != *m_options) {
|
||||||
*m_options = newGlobalOptions;
|
*m_options = newGlobalOptions;
|
||||||
m_options->toSettings(settings);
|
m_options->toSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "registerpostmortemaction.h"
|
#include "registerpostmortemaction.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -50,8 +51,9 @@ static const char sourcePathMappingTargetKeyC[] = "Target";
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
void GlobalDebuggerOptions::toSettings(QSettings *s) const
|
void GlobalDebuggerOptions::toSettings() const
|
||||||
{
|
{
|
||||||
|
QSettings *s = Core::ICore::settings();
|
||||||
s->beginWriteArray(QLatin1String(sourcePathMappingArrayNameC));
|
s->beginWriteArray(QLatin1String(sourcePathMappingArrayNameC));
|
||||||
if (!sourcePathMap.isEmpty()) {
|
if (!sourcePathMap.isEmpty()) {
|
||||||
const QString sourcePathMappingSourceKey = QLatin1String(sourcePathMappingSourceKeyC);
|
const QString sourcePathMappingSourceKey = QLatin1String(sourcePathMappingSourceKeyC);
|
||||||
@@ -67,8 +69,9 @@ void GlobalDebuggerOptions::toSettings(QSettings *s) const
|
|||||||
s->endArray();
|
s->endArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalDebuggerOptions::fromSettings(QSettings *s)
|
void GlobalDebuggerOptions::fromSettings()
|
||||||
{
|
{
|
||||||
|
QSettings *s = Core::ICore::settings();
|
||||||
sourcePathMap.clear();
|
sourcePathMap.clear();
|
||||||
if (const int count = s->beginReadArray(QLatin1String(sourcePathMappingArrayNameC))) {
|
if (const int count = s->beginReadArray(QLatin1String(sourcePathMappingArrayNameC))) {
|
||||||
const QString sourcePathMappingSourceKey = QLatin1String(sourcePathMappingSourceKeyC);
|
const QString sourcePathMappingSourceKey = QLatin1String(sourcePathMappingSourceKeyC);
|
||||||
@@ -88,9 +91,8 @@ void GlobalDebuggerOptions::fromSettings(QSettings *s)
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DebuggerSettings::DebuggerSettings(QSettings *settings)
|
DebuggerSettings::DebuggerSettings()
|
||||||
{
|
{
|
||||||
m_settings = settings;
|
|
||||||
const QString debugModeGroup = QLatin1String(debugModeSettingsGroupC);
|
const QString debugModeGroup = QLatin1String(debugModeSettingsGroupC);
|
||||||
const QString cdbSettingsGroup = QLatin1String(cdbSettingsGroupC);
|
const QString cdbSettingsGroup = QLatin1String(cdbSettingsGroupC);
|
||||||
|
|
||||||
@@ -667,14 +669,16 @@ void DebuggerSettings::insertItem(int code, SavedAction *item)
|
|||||||
|
|
||||||
void DebuggerSettings::readSettings()
|
void DebuggerSettings::readSettings()
|
||||||
{
|
{
|
||||||
|
QSettings *settings = Core::ICore::settings();
|
||||||
foreach (SavedAction *item, m_items)
|
foreach (SavedAction *item, m_items)
|
||||||
item->readSettings(m_settings);
|
item->readSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerSettings::writeSettings() const
|
void DebuggerSettings::writeSettings() const
|
||||||
{
|
{
|
||||||
|
QSettings *settings = Core::ICore::settings();
|
||||||
foreach (SavedAction *item, m_items)
|
foreach (SavedAction *item, m_items)
|
||||||
item->writeSettings(m_settings);
|
item->writeSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
SavedAction *DebuggerSettings::item(int code) const
|
SavedAction *DebuggerSettings::item(int code) const
|
||||||
|
@@ -34,13 +34,7 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
namespace Utils { class SavedAction; }
|
||||||
class QSettings;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Utils {
|
|
||||||
class SavedAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -51,8 +45,8 @@ class GlobalDebuggerOptions
|
|||||||
public:
|
public:
|
||||||
typedef QMap<QString, QString> SourcePathMap;
|
typedef QMap<QString, QString> SourcePathMap;
|
||||||
|
|
||||||
void toSettings(QSettings *) const;
|
void toSettings() const;
|
||||||
void fromSettings(QSettings *);
|
void fromSettings();
|
||||||
bool operator==(const GlobalDebuggerOptions &rhs) const
|
bool operator==(const GlobalDebuggerOptions &rhs) const
|
||||||
{ return sourcePathMap == rhs.sourcePathMap; }
|
{ return sourcePathMap == rhs.sourcePathMap; }
|
||||||
bool operator!=(const GlobalDebuggerOptions &rhs) const
|
bool operator!=(const GlobalDebuggerOptions &rhs) const
|
||||||
@@ -66,7 +60,7 @@ class DebuggerSettings : public QObject
|
|||||||
Q_OBJECT // For tr().
|
Q_OBJECT // For tr().
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DebuggerSettings(QSettings *setting);
|
explicit DebuggerSettings();
|
||||||
~DebuggerSettings();
|
~DebuggerSettings();
|
||||||
|
|
||||||
void insertItem(int code, Utils::SavedAction *item);
|
void insertItem(int code, Utils::SavedAction *item);
|
||||||
@@ -79,7 +73,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<int, Utils::SavedAction *> m_items;
|
QHash<int, Utils::SavedAction *> m_items;
|
||||||
QSettings *m_settings;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@@ -81,10 +81,11 @@ class DebuggerCore : public QObject
|
|||||||
public:
|
public:
|
||||||
DebuggerCore() {}
|
DebuggerCore() {}
|
||||||
|
|
||||||
virtual QVariant sessionValue(const QString &name) = 0;
|
static QVariant sessionValue(const QByteArray &name);
|
||||||
virtual void setSessionValue(const QString &name, const QVariant &value) = 0;
|
static void setSessionValue(const QByteArray &name, const QVariant &value);
|
||||||
virtual QVariant configValue(const QString &name) const = 0;
|
static QVariant configValue(const QByteArray &name);
|
||||||
virtual void setConfigValue(const QString &name, const QVariant &value) = 0;
|
static void setConfigValue(const QByteArray &name, const QVariant &value);
|
||||||
|
|
||||||
virtual void updateState(DebuggerEngine *engine) = 0;
|
virtual void updateState(DebuggerEngine *engine) = 0;
|
||||||
virtual void updateWatchersWindow(bool showWatch, bool showReturn) = 0;
|
virtual void updateWatchersWindow(bool showWatch, bool showReturn) = 0;
|
||||||
virtual QIcon locationMarkIcon() const = 0;
|
virtual QIcon locationMarkIcon() const = 0;
|
||||||
|
@@ -343,13 +343,14 @@ void StartApplicationDialog::updateState()
|
|||||||
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(okEnabled);
|
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(okEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerStartParameters *sp)
|
bool StartApplicationDialog::run(QWidget *parent, DebuggerStartParameters *sp)
|
||||||
{
|
{
|
||||||
const bool attachRemote = sp->startMode == AttachToRemoteServer;
|
const bool attachRemote = sp->startMode == AttachToRemoteServer;
|
||||||
const QString settingsGroup = QLatin1String("DebugMode");
|
const QString settingsGroup = QLatin1String("DebugMode");
|
||||||
const QString arrayName = QLatin1String("StartApplication");
|
const QString arrayName = QLatin1String("StartApplication");
|
||||||
|
|
||||||
QList<StartApplicationParameters> history;
|
QList<StartApplicationParameters> history;
|
||||||
|
QSettings *settings = ICore::settings();
|
||||||
settings->beginGroup(settingsGroup);
|
settings->beginGroup(settingsGroup);
|
||||||
if (const int arraySize = settings->beginReadArray(arrayName)) {
|
if (const int arraySize = settings->beginReadArray(arrayName)) {
|
||||||
for (int i = 0; i < arraySize; ++i) {
|
for (int i = 0; i < arraySize; ++i) {
|
||||||
|
@@ -82,8 +82,7 @@ public:
|
|||||||
explicit StartApplicationDialog(QWidget *parent);
|
explicit StartApplicationDialog(QWidget *parent);
|
||||||
~StartApplicationDialog();
|
~StartApplicationDialog();
|
||||||
|
|
||||||
static bool run(QWidget *parent, QSettings *settings,
|
static bool run(QWidget *parent, DebuggerStartParameters *sp);
|
||||||
DebuggerStartParameters *sp);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void historyIndexChanged(int);
|
void historyIndexChanged(int);
|
||||||
|
@@ -922,9 +922,6 @@ public slots:
|
|||||||
BreakHandler *breakHandler() const { return m_breakHandler; }
|
BreakHandler *breakHandler() const { return m_breakHandler; }
|
||||||
SnapshotHandler *snapshotHandler() const { return m_snapshotHandler; }
|
SnapshotHandler *snapshotHandler() const { return m_snapshotHandler; }
|
||||||
|
|
||||||
void setConfigValue(const QString &name, const QVariant &value);
|
|
||||||
QVariant configValue(const QString &name) const;
|
|
||||||
|
|
||||||
void displayDebugger(DebuggerEngine *engine, bool updateEngine = true);
|
void displayDebugger(DebuggerEngine *engine, bool updateEngine = true);
|
||||||
|
|
||||||
void dumpLog();
|
void dumpLog();
|
||||||
@@ -1181,8 +1178,6 @@ public slots:
|
|||||||
return m_mainWindow->activeDebugLanguages() & lang;
|
return m_mainWindow->activeDebugLanguages() & lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant sessionValue(const QString &name);
|
|
||||||
void setSessionValue(const QString &name, const QVariant &value);
|
|
||||||
QIcon locationMarkIcon() const { return m_locationMarkIcon; }
|
QIcon locationMarkIcon() const { return m_locationMarkIcon; }
|
||||||
|
|
||||||
void openTextEditor(const QString &titlePattern0, const QString &contents);
|
void openTextEditor(const QString &titlePattern0, const QString &contents);
|
||||||
@@ -1283,7 +1278,6 @@ public:
|
|||||||
bool m_shuttingDown;
|
bool m_shuttingDown;
|
||||||
DebuggerEngine *m_currentEngine;
|
DebuggerEngine *m_currentEngine;
|
||||||
DebuggerSettings *m_debuggerSettings;
|
DebuggerSettings *m_debuggerSettings;
|
||||||
QSettings *m_coreSettings;
|
|
||||||
QStringList m_arguments;
|
QStringList m_arguments;
|
||||||
DebuggerToolTipManager *m_toolTipManager;
|
DebuggerToolTipManager *m_toolTipManager;
|
||||||
CommonOptionsPage *m_commonOptionsPage;
|
CommonOptionsPage *m_commonOptionsPage;
|
||||||
@@ -1516,18 +1510,14 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::setConfigValue(const QString &name, const QVariant &value)
|
void DebuggerCore::setConfigValue(const QByteArray &name, const QVariant &value)
|
||||||
{
|
{
|
||||||
m_coreSettings->setValue(_("DebugMode/") + name, value);
|
ICore::settings()->setValue(_("DebugMode/" + name), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant DebuggerPluginPrivate::configValue(const QString &name) const
|
QVariant DebuggerCore::configValue(const QByteArray &name)
|
||||||
{
|
{
|
||||||
const QVariant value = m_coreSettings->value(_("DebugMode/") + name);
|
return ICore::settings()->value(_("DebugMode/" + name));
|
||||||
if (value.isValid())
|
|
||||||
return value;
|
|
||||||
// Legacy (pre-2.1): Check old un-namespaced-settings.
|
|
||||||
return m_coreSettings->value(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
|
void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
|
||||||
@@ -1597,7 +1587,7 @@ void DebuggerPluginPrivate::debugProjectBreakMain()
|
|||||||
void DebuggerPluginPrivate::startAndDebugApplication()
|
void DebuggerPluginPrivate::startAndDebugApplication()
|
||||||
{
|
{
|
||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
if (StartApplicationDialog::run(mainWindow(), m_coreSettings, &sp))
|
if (StartApplicationDialog::run(mainWindow(), &sp))
|
||||||
DebuggerRunControlFactory::createAndScheduleRun(sp);
|
DebuggerRunControlFactory::createAndScheduleRun(sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1605,24 +1595,24 @@ void DebuggerPluginPrivate::attachCore()
|
|||||||
{
|
{
|
||||||
AttachCoreDialog dlg(mainWindow());
|
AttachCoreDialog dlg(mainWindow());
|
||||||
|
|
||||||
const QString lastExternalKit = configValue(_("LastExternalKit")).toString();
|
const QString lastExternalKit = configValue("LastExternalKit").toString();
|
||||||
if (!lastExternalKit.isEmpty())
|
if (!lastExternalKit.isEmpty())
|
||||||
dlg.setKitId(Id::fromString(lastExternalKit));
|
dlg.setKitId(Id::fromString(lastExternalKit));
|
||||||
dlg.setLocalExecutableFile(configValue(_("LastExternalExecutableFile")).toString());
|
dlg.setLocalExecutableFile(configValue("LastExternalExecutableFile").toString());
|
||||||
dlg.setLocalCoreFile(configValue(_("LastLocalCoreFile")).toString());
|
dlg.setLocalCoreFile(configValue("LastLocalCoreFile").toString());
|
||||||
dlg.setRemoteCoreFile(configValue(_("LastRemoteCoreFile")).toString());
|
dlg.setRemoteCoreFile(configValue("LastRemoteCoreFile").toString());
|
||||||
dlg.setOverrideStartScript(configValue(_("LastExternalStartScript")).toString());
|
dlg.setOverrideStartScript(configValue("LastExternalStartScript").toString());
|
||||||
dlg.setForceLocalCoreFile(configValue(_("LastForceLocalCoreFile")).toBool());
|
dlg.setForceLocalCoreFile(configValue("LastForceLocalCoreFile").toBool());
|
||||||
|
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setConfigValue(_("LastExternalExecutableFile"), dlg.localExecutableFile());
|
setConfigValue("LastExternalExecutableFile", dlg.localExecutableFile());
|
||||||
setConfigValue(_("LastLocalCoreFile"), dlg.localCoreFile());
|
setConfigValue("LastLocalCoreFile", dlg.localCoreFile());
|
||||||
setConfigValue(_("LastRemoteCoreFile"), dlg.remoteCoreFile());
|
setConfigValue("LastRemoteCoreFile", dlg.remoteCoreFile());
|
||||||
setConfigValue(_("LastExternalKit"), dlg.kit()->id().toSetting());
|
setConfigValue("LastExternalKit", dlg.kit()->id().toSetting());
|
||||||
setConfigValue(_("LastExternalStartScript"), dlg.overrideStartScript());
|
setConfigValue("LastExternalStartScript", dlg.overrideStartScript());
|
||||||
setConfigValue(_("LastForceLocalCoreFile"), dlg.forcesLocalCoreFile());
|
setConfigValue("LastForceLocalCoreFile", dlg.forcesLocalCoreFile());
|
||||||
|
|
||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
QString display = dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile();
|
QString display = dlg.useLocalCoreFile() ? dlg.localCoreFile() : dlg.remoteCoreFile();
|
||||||
@@ -1639,7 +1629,7 @@ void DebuggerPluginPrivate::attachCore()
|
|||||||
|
|
||||||
void DebuggerPluginPrivate::startRemoteCdbSession()
|
void DebuggerPluginPrivate::startRemoteCdbSession()
|
||||||
{
|
{
|
||||||
const QString connectionKey = _("CdbRemoteConnection");
|
const QByteArray connectionKey = "CdbRemoteConnection";
|
||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
Kit *kit = CdbMatcher::findUniversalCdbKit();
|
Kit *kit = CdbMatcher::findUniversalCdbKit();
|
||||||
QTC_ASSERT(kit && fillParameters(&sp, kit), return);
|
QTC_ASSERT(kit && fillParameters(&sp, kit), return);
|
||||||
@@ -1661,7 +1651,7 @@ void DebuggerPluginPrivate::attachToRemoteServer()
|
|||||||
{
|
{
|
||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
sp.startMode = AttachToRemoteServer;
|
sp.startMode = AttachToRemoteServer;
|
||||||
if (StartApplicationDialog::run(mainWindow(), m_coreSettings, &sp)) {
|
if (StartApplicationDialog::run(mainWindow(), &sp)) {
|
||||||
sp.closeMode = KillAtClose;
|
sp.closeMode = KillAtClose;
|
||||||
sp.serverStartScript.clear();
|
sp.serverStartScript.clear();
|
||||||
DebuggerRunControlFactory::createAndScheduleRun(sp);
|
DebuggerRunControlFactory::createAndScheduleRun(sp);
|
||||||
@@ -1749,13 +1739,13 @@ void DebuggerPluginPrivate::attachToQmlPort()
|
|||||||
DebuggerStartParameters sp;
|
DebuggerStartParameters sp;
|
||||||
AttachToQmlPortDialog dlg(mainWindow());
|
AttachToQmlPortDialog dlg(mainWindow());
|
||||||
|
|
||||||
const QVariant qmlServerPort = configValue(_("LastQmlServerPort"));
|
const QVariant qmlServerPort = configValue("LastQmlServerPort");
|
||||||
if (qmlServerPort.isValid())
|
if (qmlServerPort.isValid())
|
||||||
dlg.setPort(qmlServerPort.toInt());
|
dlg.setPort(qmlServerPort.toInt());
|
||||||
else
|
else
|
||||||
dlg.setPort(sp.qmlServerPort);
|
dlg.setPort(sp.qmlServerPort);
|
||||||
|
|
||||||
const Id kitId = Id::fromSetting(configValue(_("LastProfile")));
|
const Id kitId = Id::fromSetting(configValue("LastProfile"));
|
||||||
if (kitId.isValid())
|
if (kitId.isValid())
|
||||||
dlg.setKitId(kitId);
|
dlg.setKitId(kitId);
|
||||||
|
|
||||||
@@ -1764,8 +1754,8 @@ void DebuggerPluginPrivate::attachToQmlPort()
|
|||||||
|
|
||||||
Kit *kit = dlg.kit();
|
Kit *kit = dlg.kit();
|
||||||
QTC_ASSERT(kit && fillParameters(&sp, kit), return);
|
QTC_ASSERT(kit && fillParameters(&sp, kit), return);
|
||||||
setConfigValue(_("LastQmlServerPort"), dlg.port());
|
setConfigValue("LastQmlServerPort", dlg.port());
|
||||||
setConfigValue(_("LastProfile"), kit->id().toSetting());
|
setConfigValue("LastProfile", kit->id().toSetting());
|
||||||
|
|
||||||
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
|
||||||
if (device) {
|
if (device) {
|
||||||
@@ -2515,18 +2505,16 @@ const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const
|
|||||||
return m_codeModelSnapshot;
|
return m_codeModelSnapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::setSessionValue(const QString &name, const QVariant &value)
|
void DebuggerCore::setSessionValue(const QByteArray &key, const QVariant &value)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(sessionManager(), return);
|
QTC_ASSERT(sessionManager(), return);
|
||||||
sessionManager()->setValue(name, value);
|
sessionManager()->setValue(QString::fromUtf8(key), value);
|
||||||
//qDebug() << "SET SESSION VALUE: " << name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant DebuggerPluginPrivate::sessionValue(const QString &name)
|
QVariant DebuggerCore::sessionValue(const QByteArray &key)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(sessionManager(), return QVariant());
|
QTC_ASSERT(sessionManager(), return QVariant());
|
||||||
//qDebug() << "GET SESSION VALUE: " << name;
|
return sessionManager()->value(QString::fromUtf8(key));
|
||||||
return sessionManager()->value(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::openTextEditor(const QString &titlePattern0,
|
void DebuggerPluginPrivate::openTextEditor(const QString &titlePattern0,
|
||||||
@@ -2708,9 +2696,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
|||||||
{
|
{
|
||||||
const QKeySequence debugKey = QKeySequence(UseMacShortcuts ? tr("Ctrl+Y") : tr("F5"));
|
const QKeySequence debugKey = QKeySequence(UseMacShortcuts ? tr("Ctrl+Y") : tr("F5"));
|
||||||
|
|
||||||
m_coreSettings = ICore::settings();
|
m_debuggerSettings = new DebuggerSettings;
|
||||||
|
|
||||||
m_debuggerSettings = new DebuggerSettings(m_coreSettings);
|
|
||||||
m_debuggerSettings->readSettings();
|
m_debuggerSettings->readSettings();
|
||||||
|
|
||||||
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown()));
|
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown()));
|
||||||
@@ -3294,8 +3280,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
|||||||
m_commonOptionsPage = new CommonOptionsPage(m_globalDebuggerOptions);
|
m_commonOptionsPage = new CommonOptionsPage(m_globalDebuggerOptions);
|
||||||
m_plugin->addAutoReleasedObject(m_commonOptionsPage);
|
m_plugin->addAutoReleasedObject(m_commonOptionsPage);
|
||||||
|
|
||||||
QTC_CHECK(m_coreSettings);
|
m_globalDebuggerOptions->fromSettings();
|
||||||
m_globalDebuggerOptions->fromSettings(m_coreSettings);
|
|
||||||
m_watchersWindow->setVisible(false);
|
m_watchersWindow->setVisible(false);
|
||||||
m_returnWindow->setVisible(false);
|
m_returnWindow->setVisible(false);
|
||||||
|
|
||||||
|
@@ -1176,7 +1176,7 @@ void DebuggerToolTipManager::sessionAboutToChange()
|
|||||||
|
|
||||||
void DebuggerToolTipManager::loadSessionData()
|
void DebuggerToolTipManager::loadSessionData()
|
||||||
{
|
{
|
||||||
const QString data = debuggerCore()->sessionValue(QLatin1String(sessionSettingsKeyC)).toString();
|
const QString data = DebuggerCore::sessionValue(sessionSettingsKeyC).toString();
|
||||||
if (data.isEmpty())
|
if (data.isEmpty())
|
||||||
return;
|
return;
|
||||||
QXmlStreamReader r(data);
|
QXmlStreamReader r(data);
|
||||||
@@ -1209,7 +1209,7 @@ void DebuggerToolTipManager::saveSessionData()
|
|||||||
}
|
}
|
||||||
if (debugToolTips)
|
if (debugToolTips)
|
||||||
qDebug() << "DebuggerToolTipManager::saveSessionData" << m_tooltips.size() << data ;
|
qDebug() << "DebuggerToolTipManager::saveSessionData" << m_tooltips.size() << data ;
|
||||||
debuggerCore()->setSessionValue(QLatin1String(sessionSettingsKeyC), QVariant(data));
|
DebuggerCore::setSessionValue(sessionSettingsKeyC, QVariant(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerToolTipManager::closeAllToolTips()
|
void DebuggerToolTipManager::closeAllToolTips()
|
||||||
|
@@ -1442,8 +1442,7 @@ WatchHandler::WatchHandler(DebuggerEngine *engine)
|
|||||||
{
|
{
|
||||||
m_separateWindow = 0;
|
m_separateWindow = 0;
|
||||||
m_engine = engine;
|
m_engine = engine;
|
||||||
m_watcherCounter = debuggerCore()->sessionValue(QLatin1String("Watchers"))
|
m_watcherCounter = DebuggerCore::sessionValue("Watchers").toStringList().count();
|
||||||
.toStringList().count();
|
|
||||||
m_model = new WatchModel(this);
|
m_model = new WatchModel(this);
|
||||||
m_contentsValid = false;
|
m_contentsValid = false;
|
||||||
m_contentsValid = true; // FIXME
|
m_contentsValid = true; // FIXME
|
||||||
@@ -1453,7 +1452,7 @@ WatchHandler::WatchHandler(DebuggerEngine *engine)
|
|||||||
WatchHandler::~WatchHandler()
|
WatchHandler::~WatchHandler()
|
||||||
{
|
{
|
||||||
if (m_separateWindow) {
|
if (m_separateWindow) {
|
||||||
debuggerCore()->setSessionValue(QLatin1String("DebuggerSeparateWidgetGeometry"),
|
DebuggerCore::setSessionValue("DebuggerSeparateWidgetGeometry",
|
||||||
m_separateWindow->geometry());
|
m_separateWindow->geometry());
|
||||||
delete m_separateWindow;
|
delete m_separateWindow;
|
||||||
m_separateWindow = 0;
|
m_separateWindow = 0;
|
||||||
@@ -1644,8 +1643,7 @@ void WatchHandler::showSeparateWidget(QWidget *w)
|
|||||||
{
|
{
|
||||||
if (m_separateWindow.isNull()) {
|
if (m_separateWindow.isNull()) {
|
||||||
m_separateWindow = new SeparateViewWidget(debuggerCore()->mainWindow());
|
m_separateWindow = new SeparateViewWidget(debuggerCore()->mainWindow());
|
||||||
QVariant geometry = debuggerCore()->
|
QVariant geometry = DebuggerCore::sessionValue("DebuggerSeparateWidgetGeometry");
|
||||||
sessionValue(QLatin1String("DebuggerSeparateWidgetGeometry"));
|
|
||||||
if (geometry.isValid())
|
if (geometry.isValid())
|
||||||
m_separateWindow->setGeometry(geometry.toRect());
|
m_separateWindow->setGeometry(geometry.toRect());
|
||||||
}
|
}
|
||||||
@@ -1803,12 +1801,12 @@ QStringList WatchHandler::watchedExpressions()
|
|||||||
|
|
||||||
void WatchHandler::saveWatchers()
|
void WatchHandler::saveWatchers()
|
||||||
{
|
{
|
||||||
debuggerCore()->setSessionValue(QLatin1String("Watchers"), QVariant(watchedExpressions()));
|
DebuggerCore::setSessionValue("Watchers", watchedExpressions());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::loadTypeFormats()
|
void WatchHandler::loadTypeFormats()
|
||||||
{
|
{
|
||||||
QVariant value = debuggerCore()->sessionValue(QLatin1String("DefaultFormats"));
|
QVariant value = DebuggerCore::sessionValue("DefaultFormats");
|
||||||
QMap<QString, QVariant> typeFormats = value.toMap();
|
QMap<QString, QVariant> typeFormats = value.toMap();
|
||||||
QMapIterator<QString, QVariant> it(typeFormats);
|
QMapIterator<QString, QVariant> it(typeFormats);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
@@ -1831,8 +1829,7 @@ void WatchHandler::saveTypeFormats()
|
|||||||
typeFormats.insert(QLatin1String(key), format);
|
typeFormats.insert(QLatin1String(key), format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debuggerCore()->setSessionValue(QLatin1String("DefaultFormats"),
|
DebuggerCore::setSessionValue("DefaultFormats", typeFormats);
|
||||||
QVariant(typeFormats));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::saveSessionData()
|
void WatchHandler::saveSessionData()
|
||||||
@@ -1846,7 +1843,7 @@ void WatchHandler::loadSessionData()
|
|||||||
loadTypeFormats();
|
loadTypeFormats();
|
||||||
theWatcherNames.clear();
|
theWatcherNames.clear();
|
||||||
m_watcherCounter = 0;
|
m_watcherCounter = 0;
|
||||||
QVariant value = debuggerCore()->sessionValue(QLatin1String("Watchers"));
|
QVariant value = DebuggerCore::sessionValue("Watchers");
|
||||||
m_model->destroyChildren(m_model->m_watchRoot);
|
m_model->destroyChildren(m_model->m_watchRoot);
|
||||||
foreach (const QString &exp, value.toStringList())
|
foreach (const QString &exp, value.toStringList())
|
||||||
watchExpression(exp);
|
watchExpression(exp);
|
||||||
|
Reference in New Issue
Block a user