forked from qt-creator/qt-creator
Marketplace: Move closer to current plugin setup pattern
Change-Id: I5c88fbe88240c826deb8aef2d1b5ee0f94f2e888 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -7,16 +7,17 @@
|
||||
|
||||
namespace Marketplace::Internal {
|
||||
|
||||
class MarketplacePlugin : public ExtensionSystem::IPlugin
|
||||
class MarketplacePlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Marketplace.json")
|
||||
|
||||
void initialize() {}
|
||||
|
||||
QtMarketplaceWelcomePage welcomePage;
|
||||
void initialize() final
|
||||
{
|
||||
setupQtMarketPlaceWelcomePage(this);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Marketplace
|
||||
} // Marketplace::Internal
|
||||
|
||||
#include "marketplaceplugin.moc"
|
||||
|
@@ -18,29 +18,13 @@
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QShowEvent>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace Marketplace {
|
||||
namespace Internal {
|
||||
|
||||
using namespace Core;
|
||||
using namespace Utils;
|
||||
|
||||
QString QtMarketplaceWelcomePage::title() const
|
||||
{
|
||||
return Tr::tr("Marketplace");
|
||||
}
|
||||
namespace Marketplace::Internal {
|
||||
|
||||
int QtMarketplaceWelcomePage::priority() const
|
||||
{
|
||||
return 60;
|
||||
}
|
||||
|
||||
Utils::Id QtMarketplaceWelcomePage::id() const
|
||||
{
|
||||
return "Marketplace";
|
||||
}
|
||||
|
||||
class QtMarketplacePageWidget : public QWidget
|
||||
class QtMarketplacePageWidget final : public QWidget
|
||||
{
|
||||
public:
|
||||
QtMarketplacePageWidget()
|
||||
@@ -100,7 +84,7 @@ public:
|
||||
this, &QtMarketplacePageWidget::onTagClicked);
|
||||
}
|
||||
|
||||
void showEvent(QShowEvent *event) override
|
||||
void showEvent(QShowEvent *event) final
|
||||
{
|
||||
if (!m_initialized) {
|
||||
m_initialized = true;
|
||||
@@ -123,11 +107,23 @@ private:
|
||||
bool m_initialized = false;
|
||||
};
|
||||
|
||||
// QtMarketplaceWelcomePage
|
||||
|
||||
QWidget *QtMarketplaceWelcomePage::createWidget() const
|
||||
class QtMarketplaceWelcomePage final : public IWelcomePage
|
||||
{
|
||||
return new QtMarketplacePageWidget;
|
||||
public:
|
||||
QtMarketplaceWelcomePage() = default;
|
||||
|
||||
QString title() const final { return Tr::tr("Marketplace"); }
|
||||
int priority() const final { return 60; }
|
||||
Utils::Id id() const final { return "Marketplace"; }
|
||||
QWidget *createWidget() const final { return new QtMarketplacePageWidget; }
|
||||
};
|
||||
|
||||
void setupQtMarketPlaceWelcomePage(QObject *guard)
|
||||
{
|
||||
auto page = new QtMarketplaceWelcomePage;
|
||||
page->setParent(guard);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Marketplace
|
||||
} // Marketplace::Internal
|
||||
|
@@ -3,23 +3,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/iwelcomepage.h>
|
||||
#include <QObject>
|
||||
|
||||
#include <QCoreApplication>
|
||||
namespace Marketplace::Internal {
|
||||
|
||||
namespace Marketplace {
|
||||
namespace Internal {
|
||||
void setupQtMarketPlaceWelcomePage(QObject *guard);
|
||||
|
||||
class QtMarketplaceWelcomePage : public Core::IWelcomePage
|
||||
{
|
||||
public:
|
||||
QtMarketplaceWelcomePage() = default;
|
||||
|
||||
QString title() const final;
|
||||
int priority() const final;
|
||||
Utils::Id id() const final;
|
||||
QWidget *createWidget() const final;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Marketplace
|
||||
} // namespace Marketplace::Internal
|
||||
|
Reference in New Issue
Block a user