QmlProjectPlugin: Dissolve QmlProjectPluginPrivate

Not really used anymore.

Change-Id: I125ca6573cb0fd56cc925379dc0e97b0564e1b7c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-18 10:29:47 +01:00
parent aad933c09d
commit 6d4bbba27a

View File

@@ -101,9 +101,6 @@ static void clearAlwaysOpenWithMode()
class QmlProjectPluginPrivate class QmlProjectPluginPrivate
{ {
public: public:
QPointer<QMessageBox> lastMessageBox;
QdsLandingPage *landingPage = nullptr;
QdsLandingPageWidget *landingPageWidget = nullptr;
}; };
void openQDS(const FilePath &fileName) void openQDS(const FilePath &fileName)
@@ -238,13 +235,12 @@ class QmlProjectPlugin final : public ExtensionSystem::IPlugin
public: public:
~QmlProjectPlugin() ~QmlProjectPlugin()
{ {
if (d->lastMessageBox) if (m_lastMessageBox)
d->lastMessageBox->deleteLater(); m_lastMessageBox->deleteLater();
if (d->landingPage) if (m_landingPage)
d->landingPage->deleteLater(); m_landingPage->deleteLater();
if (d->landingPageWidget) if (m_landingPageWidget)
d->landingPageWidget->deleteLater(); m_landingPageWidget->deleteLater();
delete d;
} }
public slots: public slots:
@@ -267,30 +263,30 @@ private:
void hideQmlLandingPage(); void hideQmlLandingPage();
void updateQmlLandingPageProjectInfo(const Utils::FilePath &projectFile); void updateQmlLandingPageProjectInfo(const Utils::FilePath &projectFile);
class QmlProjectPluginPrivate *d = nullptr; QPointer<QMessageBox> m_lastMessageBox;
QdsLandingPage *m_landingPage = nullptr;
QdsLandingPageWidget *m_landingPageWidget = nullptr;
}; };
void QmlProjectPlugin::initialize() void QmlProjectPlugin::initialize()
{ {
setupQmlProjectRunConfiguration(); setupQmlProjectRunConfiguration();
d = new QmlProjectPluginPrivate;
if (!qmlDesignerEnabled()) { if (!qmlDesignerEnabled()) {
d->landingPage = new QdsLandingPage(); m_landingPage = new QdsLandingPage();
qmlRegisterSingletonInstance<QdsLandingPage>("LandingPageApi", qmlRegisterSingletonInstance<QdsLandingPage>("LandingPageApi",
1, 1,
0, 0,
"LandingPageApi", "LandingPageApi",
d->landingPage); m_landingPage);
d->landingPageWidget = new QdsLandingPageWidget(); m_landingPageWidget = new QdsLandingPageWidget();
const QStringList mimeTypes = {Utils::Constants::QMLUI_MIMETYPE}; const QStringList mimeTypes = {Utils::Constants::QMLUI_MIMETYPE};
auto context = new Internal::DesignModeContext(d->landingPageWidget); auto context = new Internal::DesignModeContext(m_landingPageWidget);
ICore::addContextObject(context); ICore::addContextObject(context);
DesignMode::registerDesignWidget(d->landingPageWidget, mimeTypes, context->context()); DesignMode::registerDesignWidget(m_landingPageWidget, mimeTypes, context->context());
connect(ModeManager::instance(), &ModeManager::currentModeChanged, connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &QmlProjectPlugin::editorModeChanged); this, &QmlProjectPlugin::editorModeChanged);
@@ -395,21 +391,21 @@ void QmlProjectPlugin::initialize()
void QmlProjectPlugin::displayQmlLandingPage() void QmlProjectPlugin::displayQmlLandingPage()
{ {
if (!d->landingPage) if (!m_landingPage)
return; return;
d->landingPage->setWidget(d->landingPageWidget->widget()); m_landingPage->setWidget(m_landingPageWidget->widget());
updateQmlLandingPageProjectInfo(projectFilePath()); updateQmlLandingPageProjectInfo(projectFilePath());
d->landingPage->setQdsInstalled(qdsInstallationExists()); m_landingPage->setQdsInstalled(qdsInstallationExists());
d->landingPage->setCmakeResources(ProjectFileContentTools::rootCmakeFiles()); m_landingPage->setCmakeResources(ProjectFileContentTools::rootCmakeFiles());
d->landingPage->show(); m_landingPage->show();
} }
void QmlProjectPlugin::hideQmlLandingPage() void QmlProjectPlugin::hideQmlLandingPage()
{ {
if (d->landingPage) if (m_landingPage)
d->landingPage->hide(); m_landingPage->hide();
} }
static bool isDesignerMode(Id mode) static bool isDesignerMode(Id mode)
@@ -439,7 +435,7 @@ void QmlProjectPlugin::openQtc(bool permanent)
if (permanent) if (permanent)
setAlwaysOpenWithMode(Core::Constants::MODE_EDIT); setAlwaysOpenWithMode(Core::Constants::MODE_EDIT);
if (d->landingPage) if (m_landingPage)
hideQmlLandingPage(); hideQmlLandingPage();
ModeManager::activateMode(Core::Constants::MODE_EDIT); ModeManager::activateMode(Core::Constants::MODE_EDIT);
@@ -450,7 +446,7 @@ void QmlProjectPlugin::openQds(bool permanent)
if (permanent) if (permanent)
setAlwaysOpenWithMode(Core::Constants::MODE_DESIGN); setAlwaysOpenWithMode(Core::Constants::MODE_DESIGN);
if (d->landingPage) if (m_landingPage)
hideQmlLandingPage(); hideQmlLandingPage();
if (IEditor *editor = EditorManager::currentEditor()) if (IEditor *editor = EditorManager::currentEditor())
@@ -459,14 +455,14 @@ void QmlProjectPlugin::openQds(bool permanent)
void QmlProjectPlugin::updateQmlLandingPageProjectInfo(const FilePath &projectFile) void QmlProjectPlugin::updateQmlLandingPageProjectInfo(const FilePath &projectFile)
{ {
if (!d->landingPage) if (!m_landingPage)
return; return;
const QString qtVersionString = ProjectFileContentTools::qtVersion(projectFile); const QString qtVersionString = ProjectFileContentTools::qtVersion(projectFile);
const QString qdsVersionString = ProjectFileContentTools::qdsVersion(projectFile); const QString qdsVersionString = ProjectFileContentTools::qdsVersion(projectFile);
d->landingPage->setProjectFileExists(projectFile.exists()); m_landingPage->setProjectFileExists(projectFile.exists());
d->landingPage->setQtVersion(qtVersionString); m_landingPage->setQtVersion(qtVersionString);
d->landingPage->setQdsVersion(qdsVersionString); m_landingPage->setQdsVersion(qdsVersionString);
} }
FilePath projectFilePath() FilePath projectFilePath()