ActionManager: Remove fallback path for Qt Creator 3.1 settings

Change-Id: I2fe0c76e0ed30b69da9fdba5d9b9de6b46d647d8
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-03-16 17:07:50 +01:00
parent 693e1b7227
commit 5d71986585
4 changed files with 1 additions and 49 deletions

View File

@@ -51,7 +51,6 @@ namespace {
} }
static const char kKeyboardSettingsKey[] = "KeyboardShortcuts"; static const char kKeyboardSettingsKey[] = "KeyboardShortcuts";
static const char kKeyboardSettingsTransferredKey[] = "OldSettingsTransferred";
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
@@ -364,12 +363,6 @@ bool ActionManager::isPresentationModeEnabled()
return d->m_presentationModeEnabled; return d->m_presentationModeEnabled;
} }
void ActionManager::initialize(QObject *parent)
{
new ActionManager(parent);
d->initialize();
}
void ActionManager::saveSettings(QSettings *settings) void ActionManager::saveSettings(QSettings *settings)
{ {
d->saveSettings(settings); d->saveSettings(settings);
@@ -488,44 +481,6 @@ void ActionManagerPrivate::readUserSettings(Id id, Action *cmd)
settings->endGroup(); 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<Id, QKeySequence> 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<Id, QKeySequence> it(shortcutMap);
while (it.hasNext()) {
it.next();
settings->setValue(it.key().toString(), it.value().toString());
}
settings->endGroup();
}
void ActionManagerPrivate::saveSettings(QSettings *settings) void ActionManagerPrivate::saveSettings(QSettings *settings)
{ {
settings->beginGroup(QLatin1String(kKeyboardSettingsKey)); settings->beginGroup(QLatin1String(kKeyboardSettingsKey));

View File

@@ -86,7 +86,6 @@ signals:
private: private:
ActionManager(QObject *parent = 0); ActionManager(QObject *parent = 0);
~ActionManager(); ~ActionManager();
static void initialize(QObject *parent);
static void saveSettings(QSettings *settings); static void saveSettings(QSettings *settings);
static void setContext(const Context &context); static void setContext(const Context &context);

View File

@@ -64,8 +64,6 @@ public:
explicit ActionManagerPrivate(); explicit ActionManagerPrivate();
~ActionManagerPrivate(); ~ActionManagerPrivate();
void initialize();
void setContext(const Context &context); void setContext(const Context &context);
bool hasContext(int context) const; bool hasContext(int context) const;

View File

@@ -170,7 +170,7 @@ void CorePlugin::parseArguments(const QStringList &arguments)
bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
ActionManager::initialize(this); new ActionManager(this);
Theme::initialPalette(); // Initialize palette before setting it Theme::initialPalette(); // Initialize palette before setting it
qsrand(QDateTime::currentDateTime().toTime_t()); qsrand(QDateTime::currentDateTime().toTime_t());
parseArguments(arguments); parseArguments(arguments);