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