diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2023-05-16 18:17:58 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2023-05-17 10:15:48 +0000 |
commit | 3fc461e7129d24184e5850f412892a2426c43293 (patch) | |
tree | 4e904f03eeeb7146b9e89038c2298f8d51f03b2a /src | |
parent | cbeac777a61322fbc2d365c7b83ead8aaaaf4bbf (diff) | |
download | qt-creator-3fc461e7129d24184e5850f412892a2426c43293.tar.gz |
CppEditor/QmlJSTools: Remove settings migration from Qt Creator 2.3
This removes settings migration from Cpp Code Style Settings migration
from Qt Creator <= 2.3 to 2.3+
Let's assume that most active Qt Creator users launched a Qt Creator 2.4
or later in the last decade if they still work with their decade-old
installation.
Change-Id: I9c49dd9c1c0bd85e2b8c58a0d4eb6c393abf94a1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/cppeditor/cpptoolssettings.cpp | 48 | ||||
-rw-r--r-- | src/plugins/qmljstools/qmljstoolssettings.cpp | 39 |
2 files changed, 0 insertions, 87 deletions
diff --git a/src/plugins/cppeditor/cpptoolssettings.cpp b/src/plugins/cppeditor/cpptoolssettings.cpp index 3d5b4658b8..0b5536fdd7 100644 --- a/src/plugins/cppeditor/cpptoolssettings.cpp +++ b/src/plugins/cppeditor/cpptoolssettings.cpp @@ -134,54 +134,6 @@ CppToolsSettings::CppToolsSettings() // load global settings (after built-in settings are added to the pool) d->m_globalCodeStyle->fromSettings(QLatin1String(Constants::CPP_SETTINGS_ID), s); - // legacy handling start (Qt Creator Version < 2.4) - const bool legacyTransformed = - s->value(QLatin1String("CppCodeStyleSettings/LegacyTransformed"), false).toBool(); - - if (!legacyTransformed) { - // creator 2.4 didn't mark yet the transformation (first run of creator 2.4) - - // we need to transform the settings only if at least one from - // below settings was already written - otherwise we use - // defaults like it would be the first run of creator 2.4 without stored settings - const QStringList groups = s->childGroups(); - const bool needTransform = groups.contains(QLatin1String("textTabPreferences")) || - groups.contains(QLatin1String("CppTabPreferences")) || - groups.contains(QLatin1String("CppCodeStyleSettings")); - if (needTransform) { - CppCodeStyleSettings legacyCodeStyleSettings; - if (groups.contains(QLatin1String("CppCodeStyleSettings"))) { - Utils::fromSettings(QLatin1String("CppCodeStyleSettings"), - QString(), s, &legacyCodeStyleSettings); - } - - const QString currentFallback = s->value(QLatin1String("CppTabPreferences/CurrentFallback")).toString(); - TabSettings legacyTabSettings; - if (currentFallback == QLatin1String("CppGlobal")) { - // no delegate, global overwritten - Utils::fromSettings(QLatin1String("CppTabPreferences"), - QString(), s, &legacyTabSettings); - } else { - // delegating to global - legacyTabSettings = TextEditorSettings::codeStyle()->currentTabSettings(); - } - - // create custom code style out of old settings - QVariant v; - v.setValue(legacyCodeStyleSettings); - ICodeStylePreferences *oldCreator = pool->createCodeStyle( - "legacy", legacyTabSettings, v, Tr::tr("Old Creator")); - - // change the current delegate and save - d->m_globalCodeStyle->setCurrentDelegate(oldCreator); - d->m_globalCodeStyle->toSettings(QLatin1String(Constants::CPP_SETTINGS_ID), s); - } - // mark old settings as transformed - s->setValue(QLatin1String("CppCodeStyleSettings/LegacyTransformed"), true); - // legacy handling stop - } - - // mimetypes to be handled TextEditorSettings::registerMimeTypeForLanguageId(Constants::C_SOURCE_MIMETYPE, Constants::CPP_SETTINGS_ID); TextEditorSettings::registerMimeTypeForLanguageId(Constants::C_HEADER_MIMETYPE, Constants::CPP_SETTINGS_ID); diff --git a/src/plugins/qmljstools/qmljstoolssettings.cpp b/src/plugins/qmljstools/qmljstoolssettings.cpp index 093fb676c2..caeb6dfa26 100644 --- a/src/plugins/qmljstools/qmljstoolssettings.cpp +++ b/src/plugins/qmljstools/qmljstoolssettings.cpp @@ -71,45 +71,6 @@ QmlJSToolsSettings::QmlJSToolsSettings() QSettings *s = Core::ICore::settings(); m_globalCodeStyle->fromSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s); - // legacy handling start (Qt Creator Version < 2.4) - const bool legacyTransformed = - s->value(QLatin1String("QmlJSTabPreferences/LegacyTransformed"), false).toBool(); - - if (!legacyTransformed) { - // creator 2.4 didn't mark yet the transformation (first run of creator 2.4) - - // we need to transform the settings only if at least one from - // below settings was already written - otherwise we use - // defaults like it would be the first run of creator 2.4 without stored settings - const QStringList groups = s->childGroups(); - const bool needTransform = groups.contains(QLatin1String("textTabPreferences")) || - groups.contains(QLatin1String("QmlJSTabPreferences")); - - if (needTransform) { - const QString currentFallback = s->value(QLatin1String("QmlJSTabPreferences/CurrentFallback")).toString(); - TabSettings legacyTabSettings; - if (currentFallback == QLatin1String("QmlJSGlobal")) { - // no delegate, global overwritten - Utils::fromSettings(QLatin1String("QmlJSTabPreferences"), - QString(), s, &legacyTabSettings); - } else { - // delegating to global - legacyTabSettings = TextEditorSettings::codeStyle()->currentTabSettings(); - } - - // create custom code style out of old settings - ICodeStylePreferences *oldCreator = pool->createCodeStyle( - "legacy", legacyTabSettings, QVariant(), Tr::tr("Old Creator")); - - // change the current delegate and save - m_globalCodeStyle->setCurrentDelegate(oldCreator); - m_globalCodeStyle->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s); - } - // mark old settings as transformed - s->setValue(QLatin1String("QmlJSTabPreferences/LegacyTransformed"), true); - // legacy handling stop - } - // mimetypes to be handled TextEditorSettings::registerMimeTypeForLanguageId(Constants::QML_MIMETYPE, Constants::QML_JS_SETTINGS_ID); TextEditorSettings::registerMimeTypeForLanguageId(Constants::QMLUI_MIMETYPE, Constants::QML_JS_SETTINGS_ID); |