Commit be48a3fa authored by hjk's avatar hjk Committed by Christian Kandeler
Browse files

Use Core::Id for IOptionsPage::m_id



Change-Id: Id9d6cf28966eeb65775cf1f16f57773af5fb6bca
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
parent 5e7cf3f0
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "analyzerbase_global.h" #include "analyzerbase_global.h"
#include <coreplugin/id.h>
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
namespace Analyzer { namespace Analyzer {
...@@ -73,7 +74,7 @@ public: ...@@ -73,7 +74,7 @@ public:
virtual void fromMap(const QVariantMap &map) = 0; virtual void fromMap(const QVariantMap &map) = 0;
/// unique ID for this configuration /// unique ID for this configuration
virtual QString id() const = 0; virtual Core::Id id() const = 0;
/// user readable display name for this configuration /// user readable display name for this configuration
virtual QString displayName() const = 0; virtual QString displayName() const = 0;
/// create a configuration widget for this configuration /// create a configuration widget for this configuration
......
...@@ -40,7 +40,7 @@ namespace Internal { ...@@ -40,7 +40,7 @@ namespace Internal {
AndroidSettingsPage::AndroidSettingsPage(QObject *parent) AndroidSettingsPage::AndroidSettingsPage(QObject *parent)
: Core::IOptionsPage(parent) : Core::IOptionsPage(parent)
{ {
setId(QLatin1String(Constants::ANDROID_SETTINGS_ID)); setId(Constants::ANDROID_SETTINGS_ID);
setDisplayName(tr("Android Configurations")); setDisplayName(tr("Android Configurations"));
setCategory(Constants::ANDROID_SETTINGS_CATEGORY); setCategory(Constants::ANDROID_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("Android", setDisplayCategory(QCoreApplication::translate("Android",
......
...@@ -91,7 +91,7 @@ QString OptionsPageWidget::searchKeywords() const ...@@ -91,7 +91,7 @@ QString OptionsPageWidget::searchKeywords() const
OptionsPage::OptionsPage() OptionsPage::OptionsPage()
{ {
setId(QLatin1String(VcsBase::Constants::VCS_ID_BAZAAR)); setId(VcsBase::Constants::VCS_ID_BAZAAR);
setDisplayName(tr("Bazaar")); setDisplayName(tr("Bazaar"));
} }
......
...@@ -127,7 +127,7 @@ QString SettingsPageWidget::searchKeywords() const ...@@ -127,7 +127,7 @@ QString SettingsPageWidget::searchKeywords() const
SettingsPage::SettingsPage() : SettingsPage::SettingsPage() :
m_widget(0) m_widget(0)
{ {
setId(QLatin1String(ClearCase::Constants::VCS_ID_CLEARCASE)); setId(ClearCase::Constants::VCS_ID_CLEARCASE);
setDisplayName(tr("ClearCase")); setDisplayName(tr("ClearCase"));
} }
......
...@@ -243,7 +243,7 @@ QString CMakeManager::qtVersionForQMake(const QString &qmakePath) ...@@ -243,7 +243,7 @@ QString CMakeManager::qtVersionForQMake(const QString &qmakePath)
CMakeSettingsPage::CMakeSettingsPage() CMakeSettingsPage::CMakeSettingsPage()
: m_pathchooser(0) : m_pathchooser(0)
{ {
setId(QLatin1String("Z.CMake")); setId("Z.CMake");
setDisplayName(tr("CMake")); setDisplayName(tr("CMake"));
setCategory(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY); setCategory(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("ProjectExplorer", setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
......
...@@ -44,9 +44,9 @@ class CORE_EXPORT IOptionsPage : public QObject ...@@ -44,9 +44,9 @@ class CORE_EXPORT IOptionsPage : public QObject
public: public:
IOptionsPage(QObject *parent = 0) : QObject(parent) {} IOptionsPage(QObject *parent = 0) : QObject(parent) {}
QString id() const { return m_id; } Id id() const { return m_id; }
QString displayName() const { return m_displayName; } QString displayName() const { return m_displayName; }
Core::Id category() const { return m_category; } Id category() const { return m_category; }
QString displayCategory() const { return m_displayCategory; } QString displayCategory() const { return m_displayCategory; }
QIcon categoryIcon() const { return QIcon(m_categoryIcon); } QIcon categoryIcon() const { return QIcon(m_categoryIcon); }
...@@ -56,15 +56,15 @@ public: ...@@ -56,15 +56,15 @@ public:
virtual void finish() = 0; virtual void finish() = 0;
protected: protected:
void setId(const QString &id) { m_id = id; } void setId(Id id) { m_id = id; }
void setDisplayName(const QString &displayName) { m_displayName = displayName; } void setDisplayName(const QString &displayName) { m_displayName = displayName; }
void setCategory(Id category) { m_category = category; } void setCategory(Id category) { m_category = category; }
void setDisplayCategory(const QString &displayCategory) { m_displayCategory = displayCategory; } void setDisplayCategory(const QString &displayCategory) { m_displayCategory = displayCategory; }
void setCategoryIcon(const QString &categoryIcon) { m_categoryIcon = categoryIcon; } void setCategoryIcon(const QString &categoryIcon) { m_categoryIcon = categoryIcon; }
QString m_id; Id m_id;
QString m_displayName; QString m_displayName;
Core::Id m_category; Id m_category;
QString m_displayCategory; QString m_displayCategory;
QString m_categoryIcon; QString m_categoryIcon;
}; };
......
...@@ -272,7 +272,7 @@ bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2) ...@@ -272,7 +272,7 @@ bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2)
{ {
if (const int cc = p1->category().toString().compare(p2->category().toString())) if (const int cc = p1->category().toString().compare(p2->category().toString()))
return cc < 0; return cc < 0;
return p1->id().compare(p2->id()) < 0; return p1->id().toString().compare(p2->id().toString()) < 0;
} }
static inline QList<Core::IOptionsPage*> sortedOptionsPages() static inline QList<Core::IOptionsPage*> sortedOptionsPages()
...@@ -331,11 +331,11 @@ void SettingsDialog::showPage(Id categoryId, Id pageId) ...@@ -331,11 +331,11 @@ void SettingsDialog::showPage(Id categoryId, Id pageId)
{ {
// handle the case of "show last page" // handle the case of "show last page"
Id initialCategory = categoryId; Id initialCategory = categoryId;
QString initialPage = pageId.toString(); Id initialPage = pageId;
if (!initialCategory.isValid() && initialPage.isEmpty()) { if (!initialCategory.isValid() && !initialPage.isValid()) {
QSettings *settings = ICore::settings(); QSettings *settings = ICore::settings();
initialCategory = Id::fromSetting(settings->value(QLatin1String(categoryKeyC))); initialCategory = Id::fromSetting(settings->value(QLatin1String(categoryKeyC)));
initialPage = settings->value(QLatin1String(pageKeyC), QVariant(QString())).toString(); initialPage = Id::fromSetting(settings->value(QLatin1String(pageKeyC)));
} }
int initialCategoryIndex = -1; int initialCategoryIndex = -1;
...@@ -542,8 +542,8 @@ void SettingsDialog::apply() ...@@ -542,8 +542,8 @@ void SettingsDialog::apply()
void SettingsDialog::done(int val) void SettingsDialog::done(int val)
{ {
QSettings *settings = ICore::settings(); QSettings *settings = ICore::settings();
settings->setValue(QLatin1String(categoryKeyC), m_currentCategory.toString()); settings->setValue(QLatin1String(categoryKeyC), m_currentCategory.toSetting());
settings->setValue(QLatin1String(pageKeyC), m_currentPage); settings->setValue(QLatin1String(pageKeyC), m_currentPage.toSetting());
ICore::saveSettings(); // save all settings ICore::saveSettings(); // save all settings
......
...@@ -93,13 +93,13 @@ private: ...@@ -93,13 +93,13 @@ private:
void ensureCategoryWidget(Category *category); void ensureCategoryWidget(Category *category);
void disconnectTabWidgets(); void disconnectTabWidgets();
const QList<Core::IOptionsPage*> m_pages; const QList<IOptionsPage *> m_pages;
QSet<Core::IOptionsPage*> m_visitedPages; QSet<IOptionsPage *> m_visitedPages;
QSortFilterProxyModel *m_proxyModel; QSortFilterProxyModel *m_proxyModel;
CategoryModel *m_model; CategoryModel *m_model;
Core::Id m_currentCategory; Id m_currentCategory;
QString m_currentPage; Id m_currentPage;
QStackedLayout *m_stackedLayout; QStackedLayout *m_stackedLayout;
Utils::FilterLineEdit *m_filterLineEdit; Utils::FilterLineEdit *m_filterLineEdit;
QListView *m_categoryList; QListView *m_categoryList;
......
...@@ -60,7 +60,7 @@ ShortcutSettings::ShortcutSettings(QObject *parent) ...@@ -60,7 +60,7 @@ ShortcutSettings::ShortcutSettings(QObject *parent)
{ {
connect(ActionManager::instance(), SIGNAL(commandListChanged()), this, SLOT(initialize())); connect(ActionManager::instance(), SIGNAL(commandListChanged()), this, SLOT(initialize()));
setId(QLatin1String(Core::Constants::SETTINGS_ID_SHORTCUTS)); setId(Core::Constants::SETTINGS_ID_SHORTCUTS);
setDisplayName(tr("Keyboard")); setDisplayName(tr("Keyboard"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE); setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE)); setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE));
......
...@@ -55,7 +55,7 @@ using namespace Core::Internal; ...@@ -55,7 +55,7 @@ using namespace Core::Internal;
GeneralSettings::GeneralSettings(): GeneralSettings::GeneralSettings():
m_page(0), m_dialog(0) m_page(0), m_dialog(0)
{ {
setId(QLatin1String(Core::Constants::SETTINGS_ID_ENVIRONMENT)); setId(Core::Constants::SETTINGS_ID_ENVIRONMENT);
setDisplayName(tr("General")); setDisplayName(tr("General"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE); setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE)); setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE));
......
...@@ -547,7 +547,7 @@ void MimeTypeSettingsPrivate::resetMimeTypes() ...@@ -547,7 +547,7 @@ void MimeTypeSettingsPrivate::resetMimeTypes()
void MimeTypeSettingsPrivate::updateMagicHeaderButtons() void MimeTypeSettingsPrivate::updateMagicHeaderButtons()
{ {
const QModelIndex &modelIndex = m_ui.magicHeadersTableWidget->selectionModel()->currentIndex(); const QModelIndex &modelIndex = m_ui.magicHeadersTableWidget->selectionModel()->currentIndex();
const bool enabled(modelIndex.isValid()); const bool enabled = modelIndex.isValid();
m_ui.removeMagicButton->setEnabled(enabled); m_ui.removeMagicButton->setEnabled(enabled);
m_ui.editMagicButton->setEnabled(enabled); m_ui.editMagicButton->setEnabled(enabled);
...@@ -558,7 +558,7 @@ MimeTypeSettings::MimeTypeSettings(QObject *parent) ...@@ -558,7 +558,7 @@ MimeTypeSettings::MimeTypeSettings(QObject *parent)
: IOptionsPage(parent) : IOptionsPage(parent)
, d(new MimeTypeSettingsPrivate) , d(new MimeTypeSettingsPrivate)
{ {
setId(QLatin1String(Core::Constants::SETTINGS_ID_MIMETYPES)); setId(Core::Constants::SETTINGS_ID_MIMETYPES);
setDisplayName(tr("MIME Types")); setDisplayName(tr("MIME Types"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE); setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", setDisplayCategory(QCoreApplication::translate("Core",
......
...@@ -50,7 +50,7 @@ using namespace Core::Internal; ...@@ -50,7 +50,7 @@ using namespace Core::Internal;
ToolSettings::ToolSettings(QObject *parent) : ToolSettings::ToolSettings(QObject *parent) :
IOptionsPage(parent) IOptionsPage(parent)
{ {
setId(QLatin1String(Core::Constants::SETTINGS_ID_TOOLS)); setId(Core::Constants::SETTINGS_ID_TOOLS);
setDisplayName(tr("External Tools")); setDisplayName(tr("External Tools"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE); setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Constants::SETTINGS_TR_CATEGORY_CORE)); setDisplayCategory(QCoreApplication::translate("Core", Constants::SETTINGS_TR_CATEGORY_CORE));
......
...@@ -51,7 +51,7 @@ namespace CodePaster { ...@@ -51,7 +51,7 @@ namespace CodePaster {
CodePasterSettingsPage::CodePasterSettingsPage() CodePasterSettingsPage::CodePasterSettingsPage()
{ {
setId(QLatin1String("C.CodePaster")); setId("C.CodePaster");
setDisplayName(tr("CodePaster")); setDisplayName(tr("CodePaster"));
setCategory(Constants::CPASTER_SETTINGS_CATEGORY); setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CodePaster", setDisplayCategory(QCoreApplication::translate("CodePaster",
......
...@@ -98,7 +98,7 @@ FileShareProtocolSettingsPage::FileShareProtocolSettingsPage(const QSharedPointe ...@@ -98,7 +98,7 @@ FileShareProtocolSettingsPage::FileShareProtocolSettingsPage(const QSharedPointe
QObject *parent) : QObject *parent) :
Core::IOptionsPage(parent), m_settings(s), m_widget(0) Core::IOptionsPage(parent), m_settings(s), m_widget(0)
{ {
setId(QLatin1String("X.FileSharePaster")); setId("X.FileSharePaster");
setDisplayName(tr("Fileshare")); setDisplayName(tr("Fileshare"));
setCategory(Constants::CPASTER_SETTINGS_CATEGORY); setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY)); setDisplayCategory(QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY));
......
...@@ -168,9 +168,8 @@ bool Protocol::showConfigurationError(const Protocol *p, ...@@ -168,9 +168,8 @@ bool Protocol::showConfigurationError(const Protocol *p,
mb.exec(); mb.exec();
bool rc = false; bool rc = false;
if (mb.clickedButton() == settingsButton) if (mb.clickedButton() == settingsButton)
rc = Core::ICore::showOptionsDialog(Core::Id(p->settingsPage()->category()), rc = Core::ICore::showOptionsDialog(p->settingsPage()->category(),
Core::Id::fromString(p->settingsPage()->id()), p->settingsPage()->id(), parent);
parent);
return rc; return rc;
} }
......
...@@ -78,7 +78,7 @@ Settings SettingsWidget::settings() ...@@ -78,7 +78,7 @@ Settings SettingsWidget::settings()
SettingsPage::SettingsPage(const QSharedPointer<Settings> &settings) : SettingsPage::SettingsPage(const QSharedPointer<Settings> &settings) :
m_settings(settings), m_widget(0) m_settings(settings), m_widget(0)
{ {
setId(QLatin1String("A.General")); setId("A.General");
setDisplayName(tr("General")); setDisplayName(tr("General"));
setCategory(Constants::CPASTER_SETTINGS_CATEGORY); setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CodePaster", setDisplayCategory(QCoreApplication::translate("CodePaster",
......
...@@ -48,7 +48,7 @@ CompletionSettingsPage::CompletionSettingsPage(QObject *parent) ...@@ -48,7 +48,7 @@ CompletionSettingsPage::CompletionSettingsPage(QObject *parent)
{ {
m_commentsSettings.fromSettings(QLatin1String(CPPTOOLS_SETTINGSGROUP), Core::ICore::settings()); m_commentsSettings.fromSettings(QLatin1String(CPPTOOLS_SETTINGSGROUP), Core::ICore::settings());
setId(QLatin1String("P.Completion")); setId("P.Completion");
setDisplayName(tr("Completion")); setDisplayName(tr("Completion"));
} }
......
...@@ -479,7 +479,7 @@ CppCodeStyleSettingsPage::CppCodeStyleSettingsPage(QWidget *parent) : ...@@ -479,7 +479,7 @@ CppCodeStyleSettingsPage::CppCodeStyleSettingsPage(QWidget *parent) :
Core::IOptionsPage(parent), Core::IOptionsPage(parent),
m_pageCppCodeStylePreferences(0) m_pageCppCodeStylePreferences(0)
{ {
setId(QLatin1String(Constants::CPP_CODE_STYLE_SETTINGS_ID)); setId(Constants::CPP_CODE_STYLE_SETTINGS_ID);
setDisplayName(QCoreApplication::translate("CppTools", Constants::CPP_CODE_STYLE_SETTINGS_NAME)); setDisplayName(QCoreApplication::translate("CppTools", Constants::CPP_CODE_STYLE_SETTINGS_NAME));
setCategory(Constants::CPP_SETTINGS_CATEGORY); setCategory(Constants::CPP_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY)); setDisplayCategory(QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY));
......
...@@ -319,7 +319,7 @@ CppFileSettingsPage::CppFileSettingsPage(QSharedPointer<CppFileSettings> &settin ...@@ -319,7 +319,7 @@ CppFileSettingsPage::CppFileSettingsPage(QSharedPointer<CppFileSettings> &settin
Core::IOptionsPage(parent), Core::IOptionsPage(parent),
m_settings(settings) m_settings(settings)
{ {
setId(QLatin1String(Constants::CPP_FILE_SETTINGS_ID)); setId(Constants::CPP_FILE_SETTINGS_ID);
setDisplayName(QCoreApplication::translate("CppTools", Constants::CPP_FILE_SETTINGS_NAME)); setDisplayName(QCoreApplication::translate("CppTools", Constants::CPP_FILE_SETTINGS_NAME));
setCategory(Constants::CPP_SETTINGS_CATEGORY); setCategory(Constants::CPP_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY)); setDisplayCategory(QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY));
......
...@@ -94,7 +94,7 @@ QString SettingsPageWidget::searchKeywords() const ...@@ -94,7 +94,7 @@ QString SettingsPageWidget::searchKeywords() const
SettingsPage::SettingsPage() SettingsPage::SettingsPage()
{ {
setId(QLatin1String(VcsBase::Constants::VCS_ID_CVS)); setId(VcsBase::Constants::VCS_ID_CVS);
setDisplayName(tr("CVS")); setDisplayName(tr("CVS"));
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment