forked from qt-creator/qt-creator
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:
@@ -198,6 +198,7 @@ const char SETTINGS_ID_MIMETYPES[] = "E.MimeTypes";
|
|||||||
const char SETTINGS_DEFAULTTEXTENCODING[] = "General/DefaultFileEncoding";
|
const char SETTINGS_DEFAULTTEXTENCODING[] = "General/DefaultFileEncoding";
|
||||||
|
|
||||||
const char SETTINGS_THEME[] = "Core/CreatorTheme";
|
const char SETTINGS_THEME[] = "Core/CreatorTheme";
|
||||||
|
const char DEFAULT_THEME[] = "default";
|
||||||
|
|
||||||
const char ALL_FILES_FILTER[] = QT_TRANSLATE_NOOP("Core", "All Files (*)");
|
const char ALL_FILES_FILTER[] = QT_TRANSLATE_NOOP("Core", "All Files (*)");
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ CorePlugin::~CorePlugin()
|
|||||||
void CorePlugin::parseArguments(const QStringList &arguments)
|
void CorePlugin::parseArguments(const QStringList &arguments)
|
||||||
{
|
{
|
||||||
const Id settingsThemeId = Id::fromSetting(ICore::settings()->value(
|
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;
|
Id themeId = settingsThemeId;
|
||||||
QColor overrideColor;
|
QColor overrideColor;
|
||||||
bool presentationMode = false;
|
bool presentationMode = false;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ void ThemeChooser::apply()
|
|||||||
const QString themeId = d->m_themeListModel->themeAt(index).id().toString();
|
const QString themeId = d->m_themeListModel->themeAt(index).id().toString();
|
||||||
QSettings *settings = ICore::settings();
|
QSettings *settings = ICore::settings();
|
||||||
const QString currentThemeId = settings->value(QLatin1String(Constants::SETTINGS_THEME),
|
const QString currentThemeId = settings->value(QLatin1String(Constants::SETTINGS_THEME),
|
||||||
QLatin1String("default")).toString();
|
QLatin1String(Constants::DEFAULT_THEME)).toString();
|
||||||
if (currentThemeId != themeId) {
|
if (currentThemeId != themeId) {
|
||||||
QMessageBox::information(ICore::mainWindow(), tr("Restart Required"),
|
QMessageBox::information(ICore::mainWindow(), tr("Restart Required"),
|
||||||
tr("The theme change will take effect after a restart of Qt Creator."));
|
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: "
|
qWarning() << "Warning: No themes found in installation: "
|
||||||
<< QDir::toNativeSeparators(installThemeDir);
|
<< QDir::toNativeSeparators(installThemeDir);
|
||||||
// move default theme to front
|
// 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
|
if (defaultIndex > 0) { // == exists and not at front
|
||||||
ThemeEntry defaultEntry = themes.takeAt(defaultIndex);
|
ThemeEntry defaultEntry = themes.takeAt(defaultIndex);
|
||||||
themes.prepend(defaultEntry);
|
themes.prepend(defaultEntry);
|
||||||
|
|||||||
Reference in New Issue
Block a user