forked from qt-creator/qt-creator
QmlJSTools: Hide plugin class in .cpp
Change-Id: Idfd3741141c076e2269fee99c89ef15f6e6f3b7c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -21,11 +21,13 @@ add_qtc_plugin(QmlJSTools
|
||||
qmljstools_global.h
|
||||
qmljstoolstr.h
|
||||
qmljstoolsconstants.h
|
||||
qmljstoolsplugin.cpp qmljstoolsplugin.h
|
||||
qmljstoolsplugin.cpp
|
||||
qmljstoolssettings.cpp qmljstoolssettings.h
|
||||
)
|
||||
|
||||
extend_qtc_plugin(QmlJSTools
|
||||
CONDITION WITH_TESTS
|
||||
SOURCES qmljstools_test.cpp
|
||||
SOURCES
|
||||
qmljstools_test.cpp
|
||||
qmljstools_test.h
|
||||
)
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "qmljstoolsplugin.h"
|
||||
|
||||
#include <QLatin1String>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <qmljs/qmljslink.h>
|
||||
#include <qmljs/qmljsvalueowner.h>
|
||||
#include <qmljstools/qmljsmodelmanager.h>
|
||||
@@ -14,10 +11,17 @@
|
||||
|
||||
using namespace QmlJS;
|
||||
|
||||
namespace QmlJSTools {
|
||||
namespace Internal {
|
||||
namespace QmlJSTools::Internal {
|
||||
|
||||
void QmlJSToolsPlugin::test_basic()
|
||||
class QmlJSToolsTest final : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void test_basic();
|
||||
};
|
||||
|
||||
void QmlJSToolsTest::test_basic()
|
||||
{
|
||||
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
||||
|
||||
@@ -66,5 +70,11 @@ void QmlJSToolsPlugin::test_basic()
|
||||
QCOMPARE(qmlImageValue->propertyType(QLatin1String("source")), QLatin1String("QUrl"));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSTools
|
||||
QObject *createQmlJSToolsTest()
|
||||
{
|
||||
return new QmlJSToolsTest;
|
||||
}
|
||||
|
||||
} // QmlJSTools::Internal
|
||||
|
||||
#include "qmljstools_test.moc"
|
||||
|
||||
12
src/plugins/qmljstools/qmljstools_test.h
Normal file
12
src/plugins/qmljstools/qmljstools_test.h
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace QmlJSTools::Internal {
|
||||
|
||||
QObject *createQmlJSToolsTest();
|
||||
|
||||
} // QmlJSTools::Internal
|
||||
@@ -7,9 +7,9 @@
|
||||
#include "qmljslocatordata.h"
|
||||
#include "qmljsmodelmanager.h"
|
||||
#include "qmljstoolsconstants.h"
|
||||
#include "qmljstoolsplugin.h"
|
||||
#include "qmljstoolssettings.h"
|
||||
#include "qmljstoolstr.h"
|
||||
#include "qmljstools_test.h"
|
||||
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -18,12 +18,13 @@
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
namespace QmlJSTools {
|
||||
namespace Internal {
|
||||
namespace QmlJSTools::Internal {
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
@@ -43,16 +44,6 @@ public:
|
||||
BasicBundleProvider basicBundleProvider;
|
||||
};
|
||||
|
||||
QmlJSToolsPlugin::~QmlJSToolsPlugin()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QmlJSToolsPlugin::initialize()
|
||||
{
|
||||
d = new QmlJSToolsPluginPrivate;
|
||||
}
|
||||
|
||||
QmlJSToolsPluginPrivate::QmlJSToolsPluginPrivate()
|
||||
{
|
||||
// Core::VcsManager *vcsManager = Core::VcsManager::instance();
|
||||
@@ -91,10 +82,34 @@ QmlJSToolsPluginPrivate::QmlJSToolsPluginPrivate()
|
||||
});
|
||||
}
|
||||
|
||||
void QmlJSToolsPlugin::extensionsInitialized()
|
||||
class QmlJSToolsPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
d->modelManager.delayedInitialization();
|
||||
}
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlJSTools.json")
|
||||
|
||||
} // Internal
|
||||
} // QmlJSTools
|
||||
public:
|
||||
~QmlJSToolsPlugin() final
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
private:
|
||||
void initialize() final
|
||||
{
|
||||
#ifdef WITH_TESTS
|
||||
addTestCreator(createQmlJSToolsTest);
|
||||
#endif
|
||||
d = new QmlJSToolsPluginPrivate;
|
||||
}
|
||||
|
||||
void extensionsInitialized() final
|
||||
{
|
||||
d->modelManager.delayedInitialization();
|
||||
}
|
||||
|
||||
QmlJSToolsPluginPrivate *d = nullptr;
|
||||
};
|
||||
|
||||
} // QmlJSTools::Internal
|
||||
|
||||
#include "qmljstoolsplugin.moc"
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
namespace QmlJSTools {
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSToolsPlugin final : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlJSTools.json")
|
||||
|
||||
public:
|
||||
~QmlJSToolsPlugin() final;
|
||||
|
||||
private:
|
||||
void initialize() final;
|
||||
void extensionsInitialized() final;
|
||||
|
||||
class QmlJSToolsPluginPrivate *d = nullptr;
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
private slots:
|
||||
void test_basic();
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSTools
|
||||
Reference in New Issue
Block a user