From 5d719865850f0fa553fbc72d69b6939731247206 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 16 Mar 2015 17:07:50 +0100 Subject: [PATCH] ActionManager: Remove fallback path for Qt Creator 3.1 settings Change-Id: I2fe0c76e0ed30b69da9fdba5d9b9de6b46d647d8 Reviewed-by: David Schulz --- .../actionmanager/actionmanager.cpp | 45 ------------------- .../coreplugin/actionmanager/actionmanager.h | 1 - .../actionmanager/actionmanager_p.h | 2 - src/plugins/coreplugin/coreplugin.cpp | 2 +- 4 files changed, 1 insertion(+), 49 deletions(-) diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index f189e4b7c2e..f6e4c9900c5 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -51,7 +51,6 @@ namespace { } static const char kKeyboardSettingsKey[] = "KeyboardShortcuts"; -static const char kKeyboardSettingsTransferredKey[] = "OldSettingsTransferred"; using namespace Core; using namespace Core::Internal; @@ -364,12 +363,6 @@ bool ActionManager::isPresentationModeEnabled() return d->m_presentationModeEnabled; } -void ActionManager::initialize(QObject *parent) -{ - new ActionManager(parent); - d->initialize(); -} - void ActionManager::saveSettings(QSettings *settings) { d->saveSettings(settings); @@ -488,44 +481,6 @@ void ActionManagerPrivate::readUserSettings(Id id, Action *cmd) settings->endGroup(); } -static const char oldSettingsGroup[] = "KeyBindings"; -static const char oldIdKey[] = "ID"; -static const char oldSequenceKey[] = "Keysequence"; - -void ActionManagerPrivate::initialize() -{ - // TODO remove me after some period after 3.1 - // TODO also remove the old settings after some period after 3.1 - // settings->remove(QLatin1String(oldSettingsGroup)); - // settings->contains(QLatin1String(kKeyboardSettingsKey) + QLatin1Char('/') - // + QLatin1String(kKeyboardSettingsTransferredKey)) - // check if settings in old style (pre 3.1) exist - QSettings *settings = ICore::settings(); - if (settings->contains(QLatin1String(kKeyboardSettingsKey) + QLatin1Char('/') - + QLatin1String(kKeyboardSettingsTransferredKey))) { - return; - } - // move old settings style to new settings style - QMap shortcutMap; - const int shortcuts = settings->beginReadArray(QLatin1String(oldSettingsGroup)); - for (int i = 0; i < shortcuts; ++i) { - settings->setArrayIndex(i); - const QKeySequence key(settings->value(QLatin1String(oldSequenceKey)).toString()); - const Id id = Id::fromSetting(settings->value(QLatin1String(oldIdKey))); - shortcutMap.insert(id, key); - } - settings->endArray(); - // write settings in new style - settings->beginGroup(QLatin1String(kKeyboardSettingsKey)); - settings->setValue(QLatin1String(kKeyboardSettingsTransferredKey), true); - QMapIterator it(shortcutMap); - while (it.hasNext()) { - it.next(); - settings->setValue(it.key().toString(), it.value().toString()); - } - settings->endGroup(); -} - void ActionManagerPrivate::saveSettings(QSettings *settings) { settings->beginGroup(QLatin1String(kKeyboardSettingsKey)); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.h b/src/plugins/coreplugin/actionmanager/actionmanager.h index 7e924af38c9..e65ef5fe73e 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager.h @@ -86,7 +86,6 @@ signals: private: ActionManager(QObject *parent = 0); ~ActionManager(); - static void initialize(QObject *parent); static void saveSettings(QSettings *settings); static void setContext(const Context &context); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager_p.h b/src/plugins/coreplugin/actionmanager/actionmanager_p.h index fa106014e44..8718108693c 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager_p.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager_p.h @@ -64,8 +64,6 @@ public: explicit ActionManagerPrivate(); ~ActionManagerPrivate(); - void initialize(); - void setContext(const Context &context); bool hasContext(int context) const; diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index 43731dd3723..e710af2a640 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -170,7 +170,7 @@ void CorePlugin::parseArguments(const QStringList &arguments) bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) { - ActionManager::initialize(this); + new ActionManager(this); Theme::initialPalette(); // Initialize palette before setting it qsrand(QDateTime::currentDateTime().toTime_t()); parseArguments(arguments);