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 @@
#include "analyzerbase_global.h"
#include <coreplugin/id.h>
#include <projectexplorer/runconfiguration.h>
namespace Analyzer {
......@@ -73,7 +74,7 @@ public:
virtual void fromMap(const QVariantMap &map) = 0;
/// unique ID for this configuration
virtual QString id() const = 0;
virtual Core::Id id() const = 0;
/// user readable display name for this configuration
virtual QString displayName() const = 0;
/// create a configuration widget for this configuration
......
......@@ -40,7 +40,7 @@ namespace Internal {
AndroidSettingsPage::AndroidSettingsPage(QObject *parent)
: Core::IOptionsPage(parent)
{
setId(QLatin1String(Constants::ANDROID_SETTINGS_ID));
setId(Constants::ANDROID_SETTINGS_ID);
setDisplayName(tr("Android Configurations"));
setCategory(Constants::ANDROID_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("Android",
......
......@@ -91,7 +91,7 @@ QString OptionsPageWidget::searchKeywords() const
OptionsPage::OptionsPage()
{
setId(QLatin1String(VcsBase::Constants::VCS_ID_BAZAAR));
setId(VcsBase::Constants::VCS_ID_BAZAAR);
setDisplayName(tr("Bazaar"));
}
......
......@@ -127,7 +127,7 @@ QString SettingsPageWidget::searchKeywords() const
SettingsPage::SettingsPage() :
m_widget(0)
{
setId(QLatin1String(ClearCase::Constants::VCS_ID_CLEARCASE));
setId(ClearCase::Constants::VCS_ID_CLEARCASE);
setDisplayName(tr("ClearCase"));
}
......
......@@ -243,7 +243,7 @@ QString CMakeManager::qtVersionForQMake(const QString &qmakePath)
CMakeSettingsPage::CMakeSettingsPage()
: m_pathchooser(0)
{
setId(QLatin1String("Z.CMake"));
setId("Z.CMake");
setDisplayName(tr("CMake"));
setCategory(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("ProjectExplorer",
......
......@@ -44,9 +44,9 @@ class CORE_EXPORT IOptionsPage : public QObject
public:
IOptionsPage(QObject *parent = 0) : QObject(parent) {}
QString id() const { return m_id; }
Id id() const { return m_id; }
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; }
QIcon categoryIcon() const { return QIcon(m_categoryIcon); }
......@@ -56,15 +56,15 @@ public:
virtual void finish() = 0;
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 setCategory(Id category) { m_category = category; }
void setDisplayCategory(const QString &displayCategory) { m_displayCategory = displayCategory; }
void setCategoryIcon(const QString &categoryIcon) { m_categoryIcon = categoryIcon; }
QString m_id;
Id m_id;
QString m_displayName;
Core::Id m_category;
Id m_category;
QString m_displayCategory;
QString m_categoryIcon;
};
......
......@@ -272,7 +272,7 @@ bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2)
{
if (const int cc = p1->category().toString().compare(p2->category().toString()))
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()
......@@ -331,11 +331,11 @@ void SettingsDialog::showPage(Id categoryId, Id pageId)
{
// handle the case of "show last page"
Id initialCategory = categoryId;
QString initialPage = pageId.toString();
if (!initialCategory.isValid() && initialPage.isEmpty()) {
Id initialPage = pageId;
if (!initialCategory.isValid() && !initialPage.isValid()) {
QSettings *settings = ICore::settings();
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;
......@@ -542,8 +542,8 @@ void SettingsDialog::apply()
void SettingsDialog::done(int val)
{
QSettings *settings = ICore::settings();
settings->setValue(QLatin1String(categoryKeyC), m_currentCategory.toString());
settings->setValue(QLatin1String(pageKeyC), m_currentPage);
settings->setValue(QLatin1String(categoryKeyC), m_currentCategory.toSetting());
settings->setValue(QLatin1String(pageKeyC), m_currentPage.toSetting());
ICore::saveSettings(); // save all settings
......
......@@ -93,13 +93,13 @@ private:
void ensureCategoryWidget(Category *category);
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;
CategoryModel *m_model;
Core::Id m_currentCategory;
QString m_currentPage;
Id m_currentCategory;
Id m_currentPage;
QStackedLayout *m_stackedLayout;
Utils::FilterLineEdit *m_filterLineEdit;
QListView *m_categoryList;
......
......@@ -60,7 +60,7 @@ ShortcutSettings::ShortcutSettings(QObject *parent)
{
connect(ActionManager::instance(), SIGNAL(commandListChanged()), this, SLOT(initialize()));
setId(QLatin1String(Core::Constants::SETTINGS_ID_SHORTCUTS));
setId(Core::Constants::SETTINGS_ID_SHORTCUTS);
setDisplayName(tr("Keyboard"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE));
......
......@@ -55,7 +55,7 @@ using namespace Core::Internal;
GeneralSettings::GeneralSettings():
m_page(0), m_dialog(0)
{
setId(QLatin1String(Core::Constants::SETTINGS_ID_ENVIRONMENT));
setId(Core::Constants::SETTINGS_ID_ENVIRONMENT);
setDisplayName(tr("General"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE));
......
......@@ -547,7 +547,7 @@ void MimeTypeSettingsPrivate::resetMimeTypes()
void MimeTypeSettingsPrivate::updateMagicHeaderButtons()
{
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.editMagicButton->setEnabled(enabled);
......@@ -558,7 +558,7 @@ MimeTypeSettings::MimeTypeSettings(QObject *parent)
: IOptionsPage(parent)
, d(new MimeTypeSettingsPrivate)
{
setId(QLatin1String(Core::Constants::SETTINGS_ID_MIMETYPES));
setId(Core::Constants::SETTINGS_ID_MIMETYPES);
setDisplayName(tr("MIME Types"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core",
......
......@@ -50,7 +50,7 @@ using namespace Core::Internal;
ToolSettings::ToolSettings(QObject *parent) :
IOptionsPage(parent)
{
setId(QLatin1String(Core::Constants::SETTINGS_ID_TOOLS));
setId(Core::Constants::SETTINGS_ID_TOOLS);
setDisplayName(tr("External Tools"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Constants::SETTINGS_TR_CATEGORY_CORE));
......
......@@ -51,7 +51,7 @@ namespace CodePaster {
CodePasterSettingsPage::CodePasterSettingsPage()
{
setId(QLatin1String("C.CodePaster"));
setId("C.CodePaster");
setDisplayName(tr("CodePaster"));
setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CodePaster",
......
......@@ -98,7 +98,7 @@ FileShareProtocolSettingsPage::FileShareProtocolSettingsPage(const QSharedPointe
QObject *parent) :
Core::IOptionsPage(parent), m_settings(s), m_widget(0)
{
setId(QLatin1String("X.FileSharePaster"));
setId("X.FileSharePaster");
setDisplayName(tr("Fileshare"));
setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY));
......
......@@ -168,9 +168,8 @@ bool Protocol::showConfigurationError(const Protocol *p,
mb.exec();
bool rc = false;
if (mb.clickedButton() == settingsButton)
rc = Core::ICore::showOptionsDialog(Core::Id(p->settingsPage()->category()),
Core::Id::fromString(p->settingsPage()->id()),
parent);
rc = Core::ICore::showOptionsDialog(p->settingsPage()->category(),
p->settingsPage()->id(), parent);
return rc;
}
......
......@@ -78,7 +78,7 @@ Settings SettingsWidget::settings()
SettingsPage::SettingsPage(const QSharedPointer<Settings> &settings) :
m_settings(settings), m_widget(0)
{
setId(QLatin1String("A.General"));
setId("A.General");
setDisplayName(tr("General"));
setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CodePaster",
......
......@@ -48,7 +48,7 @@ CompletionSettingsPage::CompletionSettingsPage(QObject *parent)
{
m_commentsSettings.fromSettings(QLatin1String(CPPTOOLS_SETTINGSGROUP), Core::ICore::settings());
setId(QLatin1String("P.Completion"));
setId("P.Completion");
setDisplayName(tr("Completion"));
}
......
......@@ -479,7 +479,7 @@ CppCodeStyleSettingsPage::CppCodeStyleSettingsPage(QWidget *parent) :
Core::IOptionsPage(parent),
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));
setCategory(Constants::CPP_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY));
......
......@@ -319,7 +319,7 @@ CppFileSettingsPage::CppFileSettingsPage(QSharedPointer<CppFileSettings> &settin
Core::IOptionsPage(parent),
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));
setCategory(Constants::CPP_SETTINGS_CATEGORY);
setDisplayCategory(QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY));
......
......@@ -94,7 +94,7 @@ QString SettingsPageWidget::searchKeywords() const
SettingsPage::SettingsPage()
{
setId(QLatin1String(VcsBase::Constants::VCS_ID_CVS));
setId(VcsBase::Constants::VCS_ID_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