forked from qt-creator/qt-creator
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:
@@ -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<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)
|
||||
{
|
||||
settings->beginGroup(QLatin1String(kKeyboardSettingsKey));
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -64,8 +64,6 @@ public:
|
||||
explicit ActionManagerPrivate();
|
||||
~ActionManagerPrivate();
|
||||
|
||||
void initialize();
|
||||
|
||||
void setContext(const Context &context);
|
||||
bool hasContext(int context) const;
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user