forked from qt-creator/qt-creator
Use Core::Id for IOptionsPage::m_id
Change-Id: Id9d6cf28966eeb65775cf1f16f57773af5fb6bca Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user