Commit 6b88dcbe authored by Eike Ziller's avatar Eike Ziller

Welcome: Move IWelcomePage to core plugin

IWelcomePage now uses Core::Id, and it can only used by plugins anyhow.

Change-Id: I21f035fee9dec66830d3aa7b7eb2242f703095cb
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent ff658ccc
......@@ -49,7 +49,6 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/checkablemessagebox.cpp \
$$PWD/styledbar.cpp \
$$PWD/stylehelper.cpp \
$$PWD/iwelcomepage.cpp \
$$PWD/fancymainwindow.cpp \
$$PWD/detailsbutton.cpp \
$$PWD/detailswidget.cpp \
......@@ -138,7 +137,6 @@ HEADERS += \
$$PWD/qtcassert.h \
$$PWD/styledbar.h \
$$PWD/stylehelper.h \
$$PWD/iwelcomepage.h \
$$PWD/fancymainwindow.h \
$$PWD/detailsbutton.h \
$$PWD/detailswidget.h \
......
......@@ -97,8 +97,6 @@ QtcLibrary {
"htmldocextractor.h",
"itemviews.cpp",
"itemviews.h",
"iwelcomepage.cpp",
"iwelcomepage.h",
"json.cpp",
"json.h",
"linecolumnlabel.cpp",
......
......@@ -111,7 +111,8 @@ SOURCES += corejsextensions.cpp \
themeeditor/themesettingstablemodel.cpp \
themeeditor/sectionedtablemodel.cpp \
themeeditor/themesettingsitemdelegate.cpp \
messagebox.cpp
messagebox.cpp \
iwelcomepage.cpp
HEADERS += corejsextensions.h \
mainwindow.h \
......@@ -227,7 +228,8 @@ HEADERS += corejsextensions.h \
themeeditor/themesettingstablemodel.h \
themeeditor/sectionedtablemodel.h \
themeeditor/themesettingsitemdelegate.h \
messagebox.h
messagebox.h \
iwelcomepage.h
FORMS += dialogs/newdialog.ui \
dialogs/saveitemsdialog.ui \
......
......@@ -67,6 +67,7 @@ QtcPlugin {
"infobar.cpp", "infobar.h",
"ioutputpane.cpp", "ioutputpane.h",
"iversioncontrol.cpp", "iversioncontrol.h",
"iwelcomepage.cpp", "iwelcomepage.h",
"iwizardfactory.cpp", "iwizardfactory.h",
"jsexpander.cpp", "jsexpander.h",
"mainwindow.cpp", "mainwindow.h",
......
......@@ -32,7 +32,7 @@
#include <QUrl>
namespace Utils {
namespace Core {
IWelcomePage::IWelcomePage()
{
......@@ -43,5 +43,3 @@ IWelcomePage::~IWelcomePage()
}
} // namespace Utils
#include "moc_iwelcomepage.cpp"
......@@ -31,18 +31,18 @@
#ifndef IWELCOMEPAGE_H
#define IWELCOMEPAGE_H
#include "utils_global.h"
#include "core_global.h"
#include <coreplugin/id.h>
#include "id.h"
#include <QObject>
#include <QUrl>
QT_FORWARD_DECLARE_CLASS(QUrl)
QT_FORWARD_DECLARE_CLASS(QQmlEngine)
namespace Utils {
namespace Core {
class QTCREATOR_UTILS_EXPORT IWelcomePage : public QObject
class CORE_EXPORT IWelcomePage : public QObject
{
Q_OBJECT
......@@ -63,6 +63,6 @@ public:
virtual Core::Id id() const = 0;
};
}
} // Core
#endif // IWELCOMEPAGE_H
......@@ -33,7 +33,7 @@
#include <QAbstractListModel>
#include <utils/iwelcomepage.h>
#include <coreplugin/iwelcomepage.h>
QT_BEGIN_NAMESPACE
class QQmlEngine;
......@@ -78,7 +78,7 @@ public slots:
void resetProjects();
};
class ProjectWelcomePage : public Utils::IWelcomePage
class ProjectWelcomePage : public Core::IWelcomePage
{
Q_OBJECT
public:
......
......@@ -31,7 +31,7 @@
#ifndef GETTINGSTARTEDWELCOMEPAGE_H
#define GETTINGSTARTEDWELCOMEPAGE_H
#include <utils/iwelcomepage.h>
#include <coreplugin/iwelcomepage.h>
#include <QStringList>
......@@ -45,7 +45,7 @@ namespace Internal {
class ExamplesListModel;
class ExamplesWelcomePage : public Utils::IWelcomePage
class ExamplesWelcomePage : public Core::IWelcomePage
{
Q_OBJECT
......
......@@ -35,6 +35,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/imode.h>
#include <coreplugin/iwelcomepage.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/iwizardfactory.h>
......@@ -42,7 +43,6 @@
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/styledbar.h>
#include <utils/iwelcomepage.h>
#include <utils/theme/theme.h>
......@@ -208,18 +208,18 @@ void WelcomeMode::initPlugins()
QQmlContext *ctx = m_welcomePage->rootContext();
ctx->setContextProperty(QLatin1String("welcomeMode"), this);
QList<Utils::IWelcomePage*> duplicatePlugins = PluginManager::getObjects<Utils::IWelcomePage>();
Utils::sort(duplicatePlugins, [](const Utils::IWelcomePage *l, const Utils::IWelcomePage *r) {
QList<Core::IWelcomePage*> duplicatePlugins = PluginManager::getObjects<Core::IWelcomePage>();
Utils::sort(duplicatePlugins, [](const Core::IWelcomePage *l, const Core::IWelcomePage *r) {
return l->priority() < r->priority();
});
QList<Utils::IWelcomePage*> plugins;
QHash<Core::Id, Utils::IWelcomePage*> pluginHash;
QList<Core::IWelcomePage*> plugins;
QHash<Core::Id, Core::IWelcomePage*> pluginHash;
//avoid duplicate ids - choose by priority
foreach (Utils::IWelcomePage* plugin, duplicatePlugins) {
foreach (Core::IWelcomePage* plugin, duplicatePlugins) {
if (pluginHash.contains(plugin->id())) {
Utils::IWelcomePage* pluginOther = pluginHash.value(plugin->id());
Core::IWelcomePage* pluginOther = pluginHash.value(plugin->id());
if (pluginOther->priority() > plugin->priority()) {
plugins.removeAll(pluginOther);
......@@ -248,7 +248,7 @@ void WelcomeMode::initPlugins()
pluginPath += QLatin1String("/../" IDE_LIBRARY_BASENAME "/qtcreator");
engine->addImportPath(QDir::cleanPath(pluginPath));
facilitateQml(engine);
foreach (Utils::IWelcomePage *plugin, plugins) {
foreach (Core::IWelcomePage *plugin, plugins) {
plugin->facilitateQml(engine);
m_pluginList.append(plugin);
}
......@@ -275,16 +275,16 @@ void WelcomeMode::initPlugins()
void WelcomeMode::welcomePluginAdded(QObject *obj)
{
QHash<Core::Id, Utils::IWelcomePage*> pluginHash;
QHash<Core::Id, Core::IWelcomePage*> pluginHash;
foreach (QObject *obj, m_pluginList) {
Utils::IWelcomePage *plugin = qobject_cast<Utils::IWelcomePage*>(obj);
Core::IWelcomePage *plugin = qobject_cast<Core::IWelcomePage*>(obj);
pluginHash.insert(plugin->id(), plugin);
}
if (Utils::IWelcomePage *plugin = qobject_cast<Utils::IWelcomePage*>(obj)) {
if (Core::IWelcomePage *plugin = qobject_cast<Core::IWelcomePage*>(obj)) {
//check for duplicated id
if (pluginHash.contains(plugin->id())) {
Utils::IWelcomePage* pluginOther = pluginHash.value(plugin->id());
Core::IWelcomePage* pluginOther = pluginHash.value(plugin->id());
if (pluginOther->priority() > plugin->priority())
m_pluginList.removeAll(pluginOther);
......@@ -293,7 +293,7 @@ void WelcomeMode::welcomePluginAdded(QObject *obj)
}
int insertPos = 0;
foreach (Utils::IWelcomePage* p, PluginManager::getObjects<Utils::IWelcomePage>()) {
foreach (Core::IWelcomePage* p, PluginManager::getObjects<Core::IWelcomePage>()) {
if (plugin->priority() < p->priority())
insertPos++;
else
......
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