From 4cf7742fed145d7a2f582c496683e6367f6d27e0 Mon Sep 17 00:00:00 2001 From: Eike Ziller <eike.ziller@theqtcompany.com> Date: Tue, 16 Dec 2014 12:01:35 +0100 Subject: [PATCH] Welcome: Use Core::Id instead of enum Change-Id: Id65eb262d02bb4db765abefa361d407837b45782 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> --- src/libs/utils/iwelcomepage.h | 12 +++--------- src/plugins/projectexplorer/projectwelcomepage.cpp | 4 ++-- src/plugins/projectexplorer/projectwelcomepage.h | 2 +- src/plugins/qtsupport/gettingstartedwelcomepage.cpp | 4 ++-- src/plugins/qtsupport/gettingstartedwelcomepage.h | 2 +- src/plugins/welcome/welcomeplugin.cpp | 4 ++-- 6 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/libs/utils/iwelcomepage.h b/src/libs/utils/iwelcomepage.h index 88ea8aa9b5..85e5d3e422 100644 --- a/src/libs/utils/iwelcomepage.h +++ b/src/libs/utils/iwelcomepage.h @@ -33,6 +33,8 @@ #include "utils_global.h" +#include <coreplugin/id.h> + #include <QObject> QT_FORWARD_DECLARE_CLASS(QUrl) @@ -50,14 +52,6 @@ class QTCREATOR_UTILS_EXPORT IWelcomePage : public QObject Q_PROPERTY(bool hasSearchBar READ hasSearchBar CONSTANT) public: - enum Id { - GettingStarted = 0, - Develop = 1, - Examples = 2, - Tutorials = 3, - UserDefined = 32 - }; - IWelcomePage(); virtual ~IWelcomePage(); @@ -66,7 +60,7 @@ public: virtual int priority() const { return 0; } virtual void facilitateQml(QQmlEngine *) {} virtual bool hasSearchBar() const { return false; } - virtual Id id() const = 0; + virtual Core::Id id() const = 0; }; } diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index 0b26517ed2..895077a273 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -236,9 +236,9 @@ QUrl ProjectWelcomePage::pageLocation() const return QUrl::fromLocalFile(resourcePath + QLatin1String("/welcomescreen/develop.qml")); } -ProjectWelcomePage::Id ProjectWelcomePage::id() const +Core::Id ProjectWelcomePage::id() const { - return Develop; + return "Develop"; } void ProjectWelcomePage::reloadWelcomeScreenData() diff --git a/src/plugins/projectexplorer/projectwelcomepage.h b/src/plugins/projectexplorer/projectwelcomepage.h index d472fe91f8..5c1a1b6fc9 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.h +++ b/src/plugins/projectexplorer/projectwelcomepage.h @@ -89,7 +89,7 @@ public: QWidget *page() { return 0; } QString title() const { return tr("Projects"); } int priority() const { return 20; } - Id id() const; + Core::Id id() const; void reloadWelcomeScreenData(); diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index c830133385..fc73a306c2 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -275,9 +275,9 @@ void ExamplesWelcomePage::facilitateQml(QQmlEngine *engine) rootContenxt->setContextProperty(QLatin1String("gettingStarted"), this); } -ExamplesWelcomePage::Id ExamplesWelcomePage::id() const +Core::Id ExamplesWelcomePage::id() const { - return m_showExamples ? Examples : Tutorials; + return m_showExamples ? "Examples" : "Tutorials"; } void ExamplesWelcomePage::openHelpInExtraWindow(const QUrl &help) diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.h b/src/plugins/qtsupport/gettingstartedwelcomepage.h index 3a3131d6e4..507a1144be 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.h +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.h @@ -58,7 +58,7 @@ public: int priority() const; bool hasSearchBar() const; void facilitateQml(QQmlEngine *); - Id id() const; + Core::Id id() const; Q_INVOKABLE void openUrl(const QUrl &url); public slots: diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index 0364836925..4e20e7440c 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -216,7 +216,7 @@ void WelcomeMode::initPlugins() }); QList<Utils::IWelcomePage*> plugins; - QHash<Utils::IWelcomePage::Id, Utils::IWelcomePage*> pluginHash; + QHash<Core::Id, Utils::IWelcomePage*> pluginHash; //avoid duplicate ids - choose by priority foreach (Utils::IWelcomePage* plugin, duplicatePlugins) { @@ -270,7 +270,7 @@ void WelcomeMode::initPlugins() void WelcomeMode::welcomePluginAdded(QObject *obj) { - QHash<Utils::IWelcomePage::Id, Utils::IWelcomePage*> pluginHash; + QHash<Core::Id, Utils::IWelcomePage*> pluginHash; foreach (QObject *obj, m_pluginList) { Utils::IWelcomePage *plugin = qobject_cast<Utils::IWelcomePage*>(obj); -- GitLab