Core: Use a constant for the default creator theme

Change-Id: I53ba63cf55fb6918d959b0d396175a3188d62bd9
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Alessandro Portale
2016-03-18 11:15:20 +01:00
parent a0806dedd5
commit 3e040d4c3d
3 changed files with 4 additions and 3 deletions

View File

@@ -198,6 +198,7 @@ const char SETTINGS_ID_MIMETYPES[] = "E.MimeTypes";
const char SETTINGS_DEFAULTTEXTENCODING[] = "General/DefaultFileEncoding";
const char SETTINGS_THEME[] = "Core/CreatorTheme";
const char DEFAULT_THEME[] = "default";
const char ALL_FILES_FILTER[] = QT_TRANSLATE_NOOP("Core", "All Files (*)");

View File

@@ -97,7 +97,7 @@ CorePlugin::~CorePlugin()
void CorePlugin::parseArguments(const QStringList &arguments)
{
const Id settingsThemeId = Id::fromSetting(ICore::settings()->value(
QLatin1String(Constants::SETTINGS_THEME), QLatin1String("default")));
QLatin1String(Constants::SETTINGS_THEME), QLatin1String(Constants::DEFAULT_THEME)));
Id themeId = settingsThemeId;
QColor overrideColor;
bool presentationMode = false;

View File

@@ -172,7 +172,7 @@ void ThemeChooser::apply()
const QString themeId = d->m_themeListModel->themeAt(index).id().toString();
QSettings *settings = ICore::settings();
const QString currentThemeId = settings->value(QLatin1String(Constants::SETTINGS_THEME),
QLatin1String("default")).toString();
QLatin1String(Constants::DEFAULT_THEME)).toString();
if (currentThemeId != themeId) {
QMessageBox::information(ICore::mainWindow(), tr("Restart Required"),
tr("The theme change will take effect after a restart of Qt Creator."));
@@ -206,7 +206,7 @@ QList<ThemeEntry> ThemeEntry::availableThemes()
qWarning() << "Warning: No themes found in installation: "
<< QDir::toNativeSeparators(installThemeDir);
// move default theme to front
int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, Id("default")));
int defaultIndex = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, Id(Constants::DEFAULT_THEME)));
if (defaultIndex > 0) { // == exists and not at front
ThemeEntry defaultEntry = themes.takeAt(defaultIndex);
themes.prepend(defaultEntry);