Theme: Remove unused ThemeSettings

Change-Id: I5f3ee8f5afa2ef8618d9a43a10e37a30f771d0af
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2016-01-11 22:56:00 +02:00
committed by Orgad Shaneh
parent 64c552f555
commit 111a230659
4 changed files with 5 additions and 55 deletions

View File

@@ -120,7 +120,7 @@ void CorePlugin::parseArguments(const QStringList &arguments)
i++; i++;
} }
} }
const QList<ThemeEntry> availableThemes = ThemeSettings::availableThemes(); const QList<ThemeEntry> availableThemes = ThemeEntry::availableThemes();
int themeIndex = Utils::indexOf(availableThemes, Utils::equal(&ThemeEntry::id, themeId)); int themeIndex = Utils::indexOf(availableThemes, Utils::equal(&ThemeEntry::id, themeId));
if (themeIndex < 0) { if (themeIndex < 0) {
themeIndex = Utils::indexOf(availableThemes, themeIndex = Utils::indexOf(availableThemes,
@@ -151,7 +151,7 @@ void CorePlugin::parseArguments(const QStringList &arguments)
bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage)
{ {
if (ThemeSettings::availableThemes().isEmpty()) { if (ThemeEntry::availableThemes().isEmpty()) {
*errorMessage = tr("No themes found in installation."); *errorMessage = tr("No themes found in installation.");
return false; return false;
} }

View File

@@ -29,7 +29,6 @@
****************************************************************************/ ****************************************************************************/
#include "themesettings.h" #include "themesettings.h"
#include "themesettingswidget.h"
#include "coreconstants.h" #include "coreconstants.h"
#include "icore.h" #include "icore.h"
@@ -71,39 +70,6 @@ QString ThemeEntry::filePath() const
return m_filePath; return m_filePath;
} }
ThemeSettings::ThemeSettings()
{
setId(Constants::SETTINGS_ID_INTERFACE);
setDisplayName(tr("Theme"));
setCategory(Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Constants::SETTINGS_TR_CATEGORY_CORE));
setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CORE_ICON));
}
ThemeSettings::~ThemeSettings()
{
delete m_widget;
}
QWidget *ThemeSettings::widget()
{
if (!m_widget)
m_widget = new ThemeSettingsWidget;
return m_widget;
}
void ThemeSettings::apply()
{
if (m_widget)
m_widget->apply();
}
void ThemeSettings::finish()
{
delete m_widget;
m_widget = 0;
}
static void addThemesFromPath(const QString &path, QList<ThemeEntry> *themes) static void addThemesFromPath(const QString &path, QList<ThemeEntry> *themes)
{ {
static const QLatin1String extension("*.creatortheme"); static const QLatin1String extension("*.creatortheme");
@@ -117,7 +83,7 @@ static void addThemesFromPath(const QString &path, QList<ThemeEntry> *themes)
} }
} }
QList<ThemeEntry> ThemeSettings::availableThemes() QList<ThemeEntry> ThemeEntry::availableThemes()
{ {
QList<ThemeEntry> themes; QList<ThemeEntry> themes;

View File

@@ -49,6 +49,7 @@ public:
Id id() const; Id id() const;
QString displayName() const; QString displayName() const;
QString filePath() const; QString filePath() const;
static QList<ThemeEntry> availableThemes();
private: private:
Id m_id; Id m_id;
@@ -56,23 +57,6 @@ private:
mutable QString m_displayName; mutable QString m_displayName;
}; };
class ThemeSettings : public IOptionsPage
{
Q_OBJECT
public:
ThemeSettings();
~ThemeSettings();
QWidget *widget();
void apply();
void finish();
static QList<ThemeEntry> availableThemes();
private:
ThemeSettingsWidget *m_widget = 0;
};
} // namespace Internal } // namespace Internal
} // namespace Core } // namespace Core

View File

@@ -143,7 +143,7 @@ ThemeSettingsWidget::~ThemeSettingsWidget()
void ThemeSettingsWidget::refreshThemeList() void ThemeSettingsWidget::refreshThemeList()
{ {
const QList<ThemeEntry> themes = ThemeSettings::availableThemes(); const QList<ThemeEntry> themes = ThemeEntry::availableThemes();
const int selected = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id, const int selected = Utils::indexOf(themes, Utils::equal(&ThemeEntry::id,
Id::fromString(creatorTheme()->id()))); Id::fromString(creatorTheme()->id())));