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
|
qmljstools_global.h
|
||||||
qmljstoolstr.h
|
qmljstoolstr.h
|
||||||
qmljstoolsconstants.h
|
qmljstoolsconstants.h
|
||||||
qmljstoolsplugin.cpp qmljstoolsplugin.h
|
qmljstoolsplugin.cpp
|
||||||
qmljstoolssettings.cpp qmljstoolssettings.h
|
qmljstoolssettings.cpp qmljstoolssettings.h
|
||||||
)
|
)
|
||||||
|
|
||||||
extend_qtc_plugin(QmlJSTools
|
extend_qtc_plugin(QmlJSTools
|
||||||
CONDITION WITH_TESTS
|
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.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// 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 <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <qmljs/qmljslink.h>
|
#include <qmljs/qmljslink.h>
|
||||||
#include <qmljs/qmljsvalueowner.h>
|
#include <qmljs/qmljsvalueowner.h>
|
||||||
#include <qmljstools/qmljsmodelmanager.h>
|
#include <qmljstools/qmljsmodelmanager.h>
|
||||||
@@ -14,10 +11,17 @@
|
|||||||
|
|
||||||
using namespace QmlJS;
|
using namespace QmlJS;
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace QmlJSTools::Internal {
|
||||||
namespace 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();
|
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
||||||
|
|
||||||
@@ -66,5 +70,11 @@ void QmlJSToolsPlugin::test_basic()
|
|||||||
QCOMPARE(qmlImageValue->propertyType(QLatin1String("source")), QLatin1String("QUrl"));
|
QCOMPARE(qmlImageValue->propertyType(QLatin1String("source")), QLatin1String("QUrl"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
QObject *createQmlJSToolsTest()
|
||||||
} // namespace QmlJSTools
|
{
|
||||||
|
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 "qmljslocatordata.h"
|
||||||
#include "qmljsmodelmanager.h"
|
#include "qmljsmodelmanager.h"
|
||||||
#include "qmljstoolsconstants.h"
|
#include "qmljstoolsconstants.h"
|
||||||
#include "qmljstoolsplugin.h"
|
|
||||||
#include "qmljstoolssettings.h"
|
#include "qmljstoolssettings.h"
|
||||||
#include "qmljstoolstr.h"
|
#include "qmljstoolstr.h"
|
||||||
|
#include "qmljstools_test.h"
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -18,12 +18,13 @@
|
|||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
|
|
||||||
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace QmlJSTools::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
|
||||||
@@ -43,16 +44,6 @@ public:
|
|||||||
BasicBundleProvider basicBundleProvider;
|
BasicBundleProvider basicBundleProvider;
|
||||||
};
|
};
|
||||||
|
|
||||||
QmlJSToolsPlugin::~QmlJSToolsPlugin()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlJSToolsPlugin::initialize()
|
|
||||||
{
|
|
||||||
d = new QmlJSToolsPluginPrivate;
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlJSToolsPluginPrivate::QmlJSToolsPluginPrivate()
|
QmlJSToolsPluginPrivate::QmlJSToolsPluginPrivate()
|
||||||
{
|
{
|
||||||
// Core::VcsManager *vcsManager = Core::VcsManager::instance();
|
// Core::VcsManager *vcsManager = Core::VcsManager::instance();
|
||||||
@@ -91,10 +82,34 @@ QmlJSToolsPluginPrivate::QmlJSToolsPluginPrivate()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSToolsPlugin::extensionsInitialized()
|
class QmlJSToolsPlugin final : public ExtensionSystem::IPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QmlJSTools.json")
|
||||||
|
|
||||||
|
public:
|
||||||
|
~QmlJSToolsPlugin() final
|
||||||
|
{
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initialize() final
|
||||||
|
{
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
addTestCreator(createQmlJSToolsTest);
|
||||||
|
#endif
|
||||||
|
d = new QmlJSToolsPluginPrivate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void extensionsInitialized() final
|
||||||
{
|
{
|
||||||
d->modelManager.delayedInitialization();
|
d->modelManager.delayedInitialization();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
QmlJSToolsPluginPrivate *d = nullptr;
|
||||||
} // QmlJSTools
|
};
|
||||||
|
|
||||||
|
} // 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