Commit 8de20c9d authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

ExtensionSystem: Revive manual test

Change-Id: I24c627e964afa33883bde571960ed390b07be985
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 0e158115
TEMPLATE = subdirs
SUBDIRS = pluginview
<plugin name="plugin1" version="2.1.0" compatVersion="1.0.0">
<vendor>Blablubb Corp</vendor>
<copyright>(C) 2023 Blubb</copyright>
<license>
This is a default license bla
blubbblubb
end of terms
</license>
<description>
This plugin is just a test.
it demonstrates the great use of the plugin spec.
</description>
<url>http://www.blablubb-corp.com/greatplugin</url>
<dependencyList>
<dependency name="plugin2" version="1.0.0"/>
<dependency name="plugin3" version="1.0.0"/>
</dependencyList>
</plugin>
<plugin name="plugin2" version="1.0.0" compatVersion="1.0.0">
<vendor>1 &lt; 2 GmbH</vendor>
<url>http://www.somewhereintheweb.com/dodo.php?q=p</url>
</plugin>
<plugin name="plugin3" version="1.0.0" compatVersion="1.0.0">
<vendor>Günöl AG</vendor>
<dependencyList>
<dependency name="plugin2" version="1.0.0"/>
</dependencyList>
</plugin>
<plugin name="plugin4" version="1.0.0" compatVersion="1.0.0">
<dependencyList>
<dependency name="plugin2" version="1.0.0"/>
</dependencyList>
</plugin>
# -- run the plugin test from this directory.
export LD_LIBRARY_PATH=../../../../../../lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=../../../../../../bin/QtCreator.app/Contents/PlugIns:$DYLD_LIBRARY_PATH # mac
exec ./test
TEMPLATE = subdirs
SUBDIRS = auto manual
TEMPLATE=subdirs
SUBDIRS= \
fakevim \
debugger \
subdir_proparser \
shootout
fakevim \
debugger \
subdir_proparser \
shootout \
pluginview
unix {
# Uses popen
......
......@@ -28,6 +28,8 @@
#include <extensionsystem/plugindetailsview.h>
#include <extensionsystem/pluginerrorview.h>
#include <extensionsystem/pluginspec.h>
#include <utils/theme/theme.h>
#include <utils/theme/theme_p.h>
#include <QVBoxLayout>
#include <QHBoxLayout>
......@@ -36,8 +38,10 @@
#include <QApplication>
#include <QDebug>
PluginDialog::PluginDialog(ExtensionSystem::PluginManager *manager)
: m_view(new ExtensionSystem::PluginView(manager, this))
using namespace Utils;
PluginDialog::PluginDialog()
: m_view(new ExtensionSystem::PluginView(this))
{
QVBoxLayout *vl = new QVBoxLayout(this);
vl->setMargin(0);
......@@ -58,12 +62,12 @@ PluginDialog::PluginDialog(ExtensionSystem::PluginManager *manager)
resize(650, 300);
setWindowTitle(tr("Installed Plugins"));
connect(m_view, SIGNAL(currentPluginChanged(ExtensionSystem::PluginSpec*)),
this, SLOT(updateButtons()));
connect(m_view, SIGNAL(pluginActivated(ExtensionSystem::PluginSpec*)),
this, SLOT(openDetails(ExtensionSystem::PluginSpec*)));
connect(m_detailsButton, SIGNAL(clicked()), this, SLOT(openDetails()));
connect(m_errorDetailsButton, SIGNAL(clicked()), this, SLOT(openErrorDetails()));
connect(m_view, &ExtensionSystem::PluginView::currentPluginChanged,
this, &PluginDialog::updateButtons);
connect(m_view, &ExtensionSystem::PluginView::pluginActivated,
this, &PluginDialog::openDetails);
connect(m_detailsButton, &QAbstractButton::clicked, this, [this]() { openDetails(); });
connect(m_errorDetailsButton, &QAbstractButton::clicked, this, &PluginDialog::openErrorDetails);
}
void PluginDialog::updateButtons()
......@@ -79,15 +83,13 @@ void PluginDialog::updateButtons()
}
void PluginDialog::openDetails()
{
openDetails(m_view->currentPlugin());
}
void PluginDialog::openDetails(ExtensionSystem::PluginSpec *spec)
{
if (!spec)
return;
if (!spec) {
spec = m_view->currentPlugin();
if (!spec)
return;
}
QDialog dialog(this);
dialog.setWindowTitle(tr("Plugin Details of %1").arg(spec->name()));
QVBoxLayout *layout = new QVBoxLayout;
......@@ -97,8 +99,8 @@ void PluginDialog::openDetails(ExtensionSystem::PluginSpec *spec)
details->update(spec);
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, &dialog);
layout->addWidget(buttons);
connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject()));
connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
dialog.resize(400, 500);
dialog.exec();
}
......@@ -117,19 +119,24 @@ void PluginDialog::openErrorDetails()
errors->update(spec);
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, &dialog);
layout->addWidget(buttons);
connect(buttons, SIGNAL(accepted()), &dialog, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), &dialog, SLOT(reject()));
connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
dialog.resize(500, 300);
dialog.exec();
}
int main(int argc, char *argv[])
{
ExtensionSystem::PluginManager manager;
QApplication app(argc, argv);
PluginDialog dialog(&manager);
ExtensionSystem::PluginManager manager;
manager.setPluginIID(QLatin1String("plugin"));
setCreatorTheme(new Theme("default", &app));
QObject::connect(&app, &QCoreApplication::aboutToQuit,
&manager, &ExtensionSystem::PluginManager::shutdown);
PluginDialog dialog;
manager.setPluginPaths(QStringList() << "plugins");
manager.loadPlugins();
dialog.show();
app.exec();
return 0;
}
......@@ -36,12 +36,11 @@ class PluginDialog : public QWidget
Q_OBJECT
public:
PluginDialog(ExtensionSystem::PluginManager *manager);
PluginDialog();
private slots:
void updateButtons();
void openDetails();
void openDetails(ExtensionSystem::PluginSpec *spec);
void openDetails(ExtensionSystem::PluginSpec *spec = nullptr);
void openErrorDetails();
private:
......
TEMPLATE = app
macx:CONFIG-=app_bundle
TARGET = plugindialog
# Input
HEADERS += plugindialog.h
SOURCES += plugindialog.cpp
RELATIVEPATH = ../..
include(../../extensionsystem_test.pri)
QTC_LIB_DEPENDS += \
extensionsystem \
utils
include(../../auto/qttest.pri)
......@@ -27,7 +27,6 @@
#include <extensionsystem/pluginmanager.h>
#include <qplugin.h>
#include <QObject>
using namespace Plugin1;
......@@ -74,5 +73,3 @@ void MyPlugin1::extensionsInitialized()
obj->setObjectName("MyPlugin1_running");
addAutoReleasedObject(obj);
}
Q_EXPORT_PLUGIN(MyPlugin1)
......@@ -35,6 +35,7 @@ namespace Plugin1 {
class MyPlugin1 : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "plugin" FILE "plugin1.json")
public:
MyPlugin1();
......
{
"Name" : "plugin1",
"Version" : "2.1.0",
"CompatVersion" : "1.0.0",
"Vendor" : "Blablubb Corp",
"Copyright" : "(C) 2023 Blubb",
"License" : [ "This is a default license bla",
"blubbblubb",
"end of terms"
],
"Description" : "This plugin is just a test. it demonstrates the great use of the plugin spec.",
"Url" : "http://www.blablubb-corp.com/greatplugin",
"Dependencies" : [
{ "Name" : "plugin2", "Version" : "1.0.0" },
{ "Name" : "plugin3", "Version" : "1.0.0" }
]
}
TEMPLATE = lib
TARGET = plugin1
SOURCES += plugin1.cpp
HEADERS += plugin1.h
OTHER_FILES += plugin1.json
RELATIVEPATH = ../../../..
include(../../../../extensionsystem_test.pri)
QTC_LIB_DEPENDS += extensionsystem
include(../../../../auto/qttest.pri)
LIBS += -L$${OUT_PWD}/../plugin2 -L$${OUT_PWD}/../plugin3 -lplugin2 -lplugin3
TARGET = $$qtLibraryTargetName(plugin1)
macx {
LIBS += -L$${OUT_PWD}/../plugin2 -L$${OUT_PWD}/../plugin3 -l$$qtLibraryTargetName(plugin2) -l$$qtLibraryTargetName(plugin3)
osx {
} else:unix {
QMAKE_RPATHDIR += $${OUT_PWD}/../plugin2
QMAKE_RPATHDIR += $${OUT_PWD}/../plugin3
......
......@@ -27,7 +27,6 @@
#include <extensionsystem/pluginmanager.h>
#include <qplugin.h>
#include <QObject>
using namespace Plugin2;
......@@ -57,5 +56,3 @@ void MyPlugin2::extensionsInitialized()
obj->setObjectName("MyPlugin2_running");
addAutoReleasedObject(obj);
}
Q_EXPORT_PLUGIN(MyPlugin2)
......@@ -35,6 +35,7 @@ namespace Plugin2 {
class MyPlugin2 : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "plugin" FILE "plugin2.json")
public:
MyPlugin2();
......
{
"Name" : "plugin2",
"Version" : "1.0.0",
"CompatVersion" : "1.0.0",
"Vendor" : "1 < 2 GmbH",
"Url" : "http://www.somewhereintheweb.com/dodo.php?q=p"
}
TEMPLATE = lib
TARGET = plugin2
SOURCES += plugin2.cpp
HEADERS += plugin2.h
OTHER_FILES += plugin2.json
RELATIVEPATH = ../../../..
include(../../../../extensionsystem_test.pri)
QTC_LIB_DEPENDS += extensionsystem
include(../../../../auto/qttest.pri)
macx {
TARGET = $$qtLibraryTargetName(plugin2)
osx {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,$${OUT_PWD}/
}
......@@ -27,7 +27,6 @@
#include <extensionsystem/pluginmanager.h>
#include <qplugin.h>
#include <QObject>
using namespace Plugin3;
......@@ -65,5 +64,3 @@ void MyPlugin3::extensionsInitialized()
obj->setObjectName("MyPlugin3_running");
addAutoReleasedObject(obj);
}
Q_EXPORT_PLUGIN(MyPlugin3)
......@@ -35,6 +35,7 @@ namespace Plugin3 {
class MyPlugin3 : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "plugin" FILE "plugin3.json")
public:
MyPlugin3();
......
{
"Name" : "plugin3",
"Version" : "1.0.0",
"CompatVersion" : "1.0.0",
"Vendor" : "Günöl AG",
"Url" : "http://www.somewhereintheweb.com/dodo.php?q=p",
"Dependencies" : [
{ "Name" : "plugin2", "Version" : "1.0.0" }
]
}
TEMPLATE = lib
TARGET = plugin3
SOURCES += plugin3.cpp
HEADERS += plugin3.h
OTHER_FILES += plugin3.json
RELATIVEPATH = ../../../..
include(../../../../extensionsystem_test.pri)
QTC_LIB_DEPENDS += extensionsystem
include(../../../../auto/qttest.pri)
LIBS += -L$${OUT_PWD}/../plugin2 -lplugin2
TARGET = $$qtLibraryTargetName(plugin3)
macx {
LIBS += -L$${OUT_PWD}/../plugin2 -l$$qtLibraryTargetName(plugin2)
osx {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,$${OUT_PWD}/
} else:unix {
QMAKE_RPATHDIR += $${OUT_PWD}/../plugin2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment