refs #392 Added BlackGui::IPluginConfig

* BlackGui::IPluginConfig is an interface for plugin configurations
* Added plugin_xplane_config target
* Adapted IPluginManager
* Adapted CPluginManagerSimulator
* Adaptem CSettingsSimulatorComponent
This commit is contained in:
Michał Garapich
2015-09-02 00:54:06 +02:00
committed by Mathew Sutcliffe
parent 584616de7a
commit a0b4d47736
21 changed files with 356 additions and 51 deletions

View File

@@ -13,6 +13,7 @@ INCLUDEPATH += . $$SourceRoot/src
SOURCES += *.cpp
HEADERS += *.h
DISTFILES += simulator_xplane.json
DESTDIR = $$DestRoot/bin/plugins/simulator

View File

@@ -2,5 +2,6 @@
"identifier" : "org.swift-project.plugins.simulator.xplane",
"name" : "X-Plane generic plugin",
"simulator" : "xplane",
"description" : "Support for the X-Plane simulator via the xbus plugin."
}
"description" : "Support for the X-Plane simulator via the xbus plugin.",
"config" : "org.swift-project.plugins.simulator.xplane.config"
}

View File

@@ -0,0 +1,20 @@
include ($$SourceRoot/config.pri)
include ($$SourceRoot/build.pri)
QT += core widgets dbus
TARGET = simulator_xplane_config
TEMPLATE = lib
CONFIG += plugin shared
CONFIG += blackmisc blackcore
DEPENDPATH += . $$SourceRoot/src
INCLUDEPATH += . $$SourceRoot/src
SOURCES += *.cpp
HEADERS += *.h
FORMS += *.ui
DISTFILES += simulator_xplane_config.json
DESTDIR = $$BuildRoot/bin/plugins/simulator
include ($$SourceRoot/libraries.pri)

View File

@@ -0,0 +1,3 @@
{
"identifier" : "org.swift-project.plugins.simulator.xplane.config"
}

View File

@@ -0,0 +1,21 @@
#include "simulatorxplaneconfig.h"
#include "simulatorxplaneconfigwindow.h"
namespace BlackSimPlugin
{
namespace XPlane
{
CSimulatorXPlaneConfig::CSimulatorXPlaneConfig(QObject *parent) : QObject(parent)
{
}
QWidget *CSimulatorXPlaneConfig::createConfigWindow()
{
CSimulatorXPlaneConfigWindow* w = new CSimulatorXPlaneConfigWindow();
return w;
}
}
}

View File

@@ -0,0 +1,42 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIMPLUGIN_SIMULATOR_XPLANE_CONFIG_H
#define BLACKSIMPLUGIN_SIMULATOR_XPLANE_CONFIG_H
#include "blackgui/pluginconfig.h"
namespace BlackSimPlugin
{
namespace XPlane
{
/**
* Config plugin for the X-Plane plugin.
*/
class CSimulatorXPlaneConfig : public QObject, public BlackGui::IPluginConfig
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.swift-project.blackgui.pluginconfiginterface" FILE "simulator_xplane_config.json")
Q_INTERFACES(BlackGui::IPluginConfig)
public:
//! Ctor
CSimulatorXPlaneConfig(QObject *parent = nullptr);
//! \copydoc BlackGui::IPluginConfig::createConfigWindow()
QWidget *createConfigWindow() override;
};
}
}
#endif // SIMULATORXPLANECONFIG_H

View File

@@ -0,0 +1,29 @@
#include "simulatorxplaneconfigwindow.h"
#include "ui_simulatorxplaneconfigwindow.h"
#include "blackcore/dbus_server.h"
namespace BlackSimPlugin
{
namespace XPlane
{
CSimulatorXPlaneConfigWindow::CSimulatorXPlaneConfigWindow() :
QWidget(nullptr),
ui(new Ui::CSimulatorXPlaneConfigWindow)
{
ui->setupUi(this);
ui->cp_XBusServer->addItem(BlackCore::CDBusServer::sessionDBusServer());
ui->cp_XBusServer->addItem(BlackCore::CDBusServer::systemDBusServer());
connect(ui->bb_OkCancel, &QDialogButtonBox::rejected, this, &CSimulatorXPlaneConfigWindow::close);
}
CSimulatorXPlaneConfigWindow::~CSimulatorXPlaneConfigWindow()
{
}
}
}

View File

@@ -0,0 +1,47 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKSIMPLUGIN_SIMULATOR_XPLANE_CONFIG_WINDOW_H
#define BLACKSIMPLUGIN_SIMULATOR_XPLANE_CONFIG_WINDOW_H
#include <QWidget>
#include <QScopedPointer>
namespace Ui {
class CSimulatorXPlaneConfigWindow;
}
namespace BlackSimPlugin
{
namespace XPlane
{
/**
* A window that shows all the X-Plane plugin options.
*/
class CSimulatorXPlaneConfigWindow : public QWidget
{
Q_OBJECT
public:
//! Ctor.
CSimulatorXPlaneConfigWindow();
//! Dtor.
virtual ~CSimulatorXPlaneConfigWindow();
private:
QScopedPointer<Ui::CSimulatorXPlaneConfigWindow> ui;
};
}
}
#endif // guard

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSimulatorXPlaneConfigWindow</class>
<widget class="QWidget" name="CSimulatorXPlaneConfigWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>74</height>
</rect>
</property>
<property name="windowTitle">
<string>X-Plane plugin settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QComboBox" name="cp_XBusServer"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_XBusServer">
<property name="text">
<string>XBus server:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QDialogButtonBox" name="bb_OkCancel">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>