mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
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:
committed by
Mathew Sutcliffe
parent
584616de7a
commit
a0b4d47736
@@ -39,26 +39,15 @@ namespace BlackCore
|
||||
QDirIterator it(pluginDir, QDirIterator::FollowSymlinks);
|
||||
while (it.hasNext())
|
||||
{
|
||||
if (!QLibrary::isLibrary(it.next()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CLogMessage(this).debug() << "Loading plugin: " << it.filePath();
|
||||
QPluginLoader loader(it.filePath());
|
||||
QJsonObject json = loader.metaData();
|
||||
if (!isValid(json))
|
||||
{
|
||||
CLogMessage(this).warning("Plugin %1 invalid, not loading it") << it.filePath();
|
||||
continue;
|
||||
}
|
||||
|
||||
QString identifier = pluginIdentifier(json);
|
||||
m_paths.insert(identifier, it.filePath());
|
||||
m_metadatas.push_back(json);
|
||||
tryLoad(it.next());
|
||||
}
|
||||
}
|
||||
|
||||
QString IPluginManager::getPluginConfigId(const QString &identifier)
|
||||
{
|
||||
return m_configs.contains(identifier) ? m_configs.value(identifier) : QString();
|
||||
}
|
||||
|
||||
QString IPluginManager::pluginDirectory() const
|
||||
{
|
||||
return qApp->applicationDirPath() % QStringLiteral("/plugins");
|
||||
@@ -100,6 +89,35 @@ namespace BlackCore
|
||||
return m_instanceIds.value(instance, QString());
|
||||
}
|
||||
|
||||
bool IPluginManager::tryLoad(QString path)
|
||||
{
|
||||
if (!QLibrary::isLibrary(path))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CLogMessage(this).debug() << "Loading plugin: " << path;
|
||||
QPluginLoader loader(path);
|
||||
QJsonObject json = loader.metaData();
|
||||
if (!isValid(json))
|
||||
{
|
||||
CLogMessage(this).warning("Plugin %1 invalid, not loading it") << path;
|
||||
return false;
|
||||
}
|
||||
|
||||
QString identifier = pluginIdentifier(json);
|
||||
m_paths.insert(identifier, path);
|
||||
m_metadatas.push_back(json);
|
||||
|
||||
if (json.value("MetaData").toObject().contains("config")) {
|
||||
QString configId = json.value("MetaData").toObject().value("config").toString();
|
||||
if (!configId.isEmpty())
|
||||
m_configs.insert(identifier, configId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QObject *IPluginManager::getPluginByIdImpl(const QString &identifier)
|
||||
{
|
||||
if (m_instances.contains(identifier))
|
||||
|
||||
@@ -36,6 +36,19 @@ namespace BlackCore
|
||||
//! Looks for all available plugins
|
||||
virtual void collectPlugins();
|
||||
|
||||
//! If the plugin specifies its config plugin, its identifier can be
|
||||
//! obtained using this method. You can get the plugin config instance
|
||||
//! later, using `getPluginById()`.
|
||||
QString getPluginConfigId(const QString &identifier);
|
||||
|
||||
//! Loads the given plugin (if necessary), casts it to the desired
|
||||
//! type and returns its instance. Returns `nullptr` on failure.
|
||||
template <class T>
|
||||
T *getPluginById(const QString &identifier)
|
||||
{
|
||||
return qobject_cast<T *>(getPluginByIdImpl(identifier));
|
||||
}
|
||||
|
||||
protected:
|
||||
//! Returns the list of valid IIDs for the implementation
|
||||
virtual BlackMisc::CSequence<QString> acceptedIids() const = 0;
|
||||
@@ -57,14 +70,6 @@ namespace BlackCore
|
||||
//! Gets plugin identifier by its instance
|
||||
QString getIdByPlugin(const QObject *instance) const;
|
||||
|
||||
//! Loads the given plugin (if necessary), casts it to the desired
|
||||
//! type and returns its instance. Returns `nullptr` on failure.
|
||||
template <class T>
|
||||
T *getPluginById(const QString &identifier)
|
||||
{
|
||||
return qobject_cast<T *>(getPluginByIdImpl(identifier));
|
||||
}
|
||||
|
||||
//! Gets direct access to all plugins' metadata
|
||||
const BlackMisc::CSequence<QJsonObject> &getPlugins()
|
||||
{
|
||||
@@ -72,6 +77,8 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
private:
|
||||
//! Tries to load the given plugin.
|
||||
bool tryLoad(QString path);
|
||||
|
||||
//! Loads the given plugin (if necessary) and returns its instance.
|
||||
//! Returns `nullptr` on failure.
|
||||
@@ -80,6 +87,7 @@ namespace BlackCore
|
||||
BlackMisc::CSequence<QJsonObject> m_metadatas;
|
||||
QMap<QString, QString> m_paths; //!< identifier <-> file path pairs
|
||||
QMap<QString, QObject *> m_instances; //!< identifier <-> instance pairs
|
||||
QMap<QString, QString> m_configs; //!< identifier <-> identifier pairs
|
||||
QMap<const QObject *, QString> m_instanceIds; //!< instance <-> identifier pairs
|
||||
|
||||
};
|
||||
|
||||
@@ -96,14 +96,20 @@ namespace BlackCore
|
||||
const CSequence<QJsonObject> &plugins = getPlugins();
|
||||
for (const QJsonObject &json : plugins)
|
||||
{
|
||||
auto it = m_plugins.insert(pluginIdentifier(json), {});
|
||||
it->info.convertFromJson(json);
|
||||
QString iid = json["IID"].toString();
|
||||
if (iid == QStringLiteral("org.swift-project.blackcore.simulatorinterface")) {
|
||||
auto it = m_plugins.insert(pluginIdentifier(json), {});
|
||||
it->info.convertFromJson(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BlackMisc::CSequence<QString> CPluginManagerSimulator::acceptedIids() const
|
||||
{
|
||||
return { QStringLiteral("org.swift-project.blackcore.simulatorinterface") };
|
||||
return {
|
||||
QStringLiteral("org.swift-project.blackcore.simulatorinterface"),
|
||||
QStringLiteral("org.swift-project.blackgui.pluginconfiginterface")
|
||||
};
|
||||
}
|
||||
|
||||
QString CPluginManagerSimulator::pluginDirectory() const
|
||||
|
||||
@@ -292,6 +292,5 @@ namespace BlackCore
|
||||
|
||||
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorinterface")
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus)
|
||||
Q_DECLARE_INTERFACE(BlackCore::ISimulatorListener, "org.swift-project.blackcore.simulatorlistener")
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
load(common_pre)
|
||||
|
||||
QT += network dbus gui svg
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
QT += network dbus gui svg widgets
|
||||
|
||||
TARGET = blackgui
|
||||
TEMPLATE = lib
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "blackcore/context_simulator.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackgui/pluginconfig.h"
|
||||
#include "blackgui/plugindetailswindow.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
@@ -24,8 +25,10 @@ namespace BlackGui
|
||||
CSettingsSimulatorComponent::CSettingsSimulatorComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
CEnableForRuntime(nullptr, false),
|
||||
ui(new Ui::CSettingsSimulatorComponent)
|
||||
ui(new Ui::CSettingsSimulatorComponent),
|
||||
m_plugins(new CPluginManagerSimulator(this))
|
||||
{
|
||||
m_plugins->collectPlugins();
|
||||
ui->setupUi(this);
|
||||
CLedWidget::LedShape shape = CLedWidget::Circle;
|
||||
this->ui->led_RestrictedRendering->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "Limited", "Unlimited", 14);
|
||||
@@ -42,13 +45,15 @@ namespace BlackGui
|
||||
// set values
|
||||
for (const auto &p : getAvailablePlugins())
|
||||
{
|
||||
ui->ps_EnabledSimulators->addPlugin(p.getIdentifier(), p.getName(), false);
|
||||
QString config = m_plugins->getPluginConfigId(p.getIdentifier());
|
||||
ui->ps_EnabledSimulators->addPlugin(p.getIdentifier(), p.getName(), !config.isEmpty(), false);
|
||||
}
|
||||
|
||||
// connects
|
||||
connect(this->getIContextSimulator(), &IContextSimulator::simulatorPluginChanged, this, &CSettingsSimulatorComponent::ps_simulatorPluginChanged);
|
||||
connect(this->ui->ps_EnabledSimulators, &CPluginSelector::pluginStateChanged, this, &CSettingsSimulatorComponent::ps_pluginStateChanged);
|
||||
connect(this->ui->ps_EnabledSimulators, &CPluginSelector::pluginDetailsRequested, this, &CSettingsSimulatorComponent::ps_showPluginDetails);
|
||||
connect(this->ui->ps_EnabledSimulators, &CPluginSelector::pluginConfigRequested, this, &CSettingsSimulatorComponent::ps_showPluginConfig);
|
||||
connect(this->ui->pb_ApplyMaxAircraft, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedAircraft);
|
||||
connect(this->ui->pb_ApplyTimeSync, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyTimeSync);
|
||||
connect(this->ui->pb_ApplyMaxDistance, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyMaxRenderedDistance);
|
||||
@@ -262,6 +267,24 @@ namespace BlackGui
|
||||
|
||||
w->show();
|
||||
}
|
||||
|
||||
void CSettingsSimulatorComponent::ps_showPluginConfig(const QString &identifier)
|
||||
{
|
||||
CSimulatorPluginInfoList simDrivers(getAvailablePlugins());
|
||||
auto selected = std::find_if(simDrivers.begin(), simDrivers.end(),
|
||||
[&identifier](const CSimulatorPluginInfo &info)
|
||||
{
|
||||
return info.getIdentifier() == identifier;
|
||||
});
|
||||
|
||||
QString configId = m_plugins->getPluginConfigId(selected->getIdentifier());
|
||||
IPluginConfig *config = m_plugins->getPluginById<IPluginConfig>(configId);
|
||||
QWidget *window = config->createConfigWindow();
|
||||
// window->setParent(qApp->activeWindow());
|
||||
window->setWindowFlags(Qt::Dialog);
|
||||
window->setAttribute(Qt::WA_DeleteOnClose);
|
||||
window->show();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef BLACKGUI_SETTINGSSIMULATORCOMPONENT_H
|
||||
#define BLACKGUI_SETTINGSSIMULATORCOMPONENT_H
|
||||
|
||||
#include "blackcore/plugin_manager_simulator.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfolist.h"
|
||||
#include "enableforruntime.h"
|
||||
@@ -64,6 +65,9 @@ namespace BlackGui
|
||||
//! Open plugin details window
|
||||
void ps_showPluginDetails(const QString &identifier);
|
||||
|
||||
//! Show plugin config
|
||||
void ps_showPluginConfig(const QString &identifier);
|
||||
|
||||
private:
|
||||
|
||||
//! Set the GUI values
|
||||
@@ -74,6 +78,8 @@ namespace BlackGui
|
||||
|
||||
QScopedPointer<Ui::CSettingsSimulatorComponent> ui; //!< UI
|
||||
bool m_pluginLoaded = false; //!< plugin loaded
|
||||
BlackCore::CPluginManagerSimulator* m_plugins = nullptr;
|
||||
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
36
src/blackgui/pluginconfig.h
Normal file
36
src/blackgui/pluginconfig.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* 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.
|
||||
*
|
||||
* Class based on qLed: Copyright (C) 2010 by P. Sereno, http://www.sereno-online.com
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_PLUGINCONFIG_H
|
||||
#define BCLAKGUI_PLUGINCONFIG_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QtPlugin>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
class BLACKGUI_EXPORT IPluginConfig
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~IPluginConfig() = default;
|
||||
|
||||
virtual QWidget *createConfigWindow() = 0;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_INTERFACE(BlackGui::IPluginConfig, "org.swift-project.blackgui.pluginconfiginterface")
|
||||
|
||||
#endif // guard
|
||||
@@ -19,17 +19,19 @@ namespace BlackGui
|
||||
{
|
||||
|
||||
CPluginSelector::CPluginSelector(QWidget *parent) : QWidget(parent),
|
||||
m_mapper(new QSignalMapper(this))
|
||||
m_detailsButtonMapper(new QSignalMapper(this)),
|
||||
m_configButtonMapper(new QSignalMapper(this))
|
||||
{
|
||||
setObjectName("CPluginSelector");
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
setLayout(layout);
|
||||
|
||||
connect(m_mapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped), this, &CPluginSelector::pluginDetailsRequested);
|
||||
connect(m_detailsButtonMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped), this, &CPluginSelector::pluginDetailsRequested);
|
||||
connect(m_configButtonMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped), this, &CPluginSelector::pluginConfigRequested);
|
||||
}
|
||||
|
||||
void CPluginSelector::addPlugin(const QString& identifier, const QString &name, bool enabled)
|
||||
void CPluginSelector::addPlugin(const QString& identifier, const QString &name, bool hasConfig, bool enabled)
|
||||
{
|
||||
QWidget *pw = new QWidget;
|
||||
QHBoxLayout *layout = new QHBoxLayout;
|
||||
@@ -51,21 +53,20 @@ namespace BlackGui
|
||||
pw->layout()->addWidget(cb);
|
||||
|
||||
QPushButton *details = new QPushButton("?");
|
||||
m_mapper->setMapping(details, identifier);
|
||||
connect(details, &QPushButton::clicked, m_mapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
m_detailsButtonMapper->setMapping(details, identifier);
|
||||
connect(details, &QPushButton::clicked, m_detailsButtonMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
pw->layout()->addWidget(details);
|
||||
|
||||
layout->setStretch(0, 1);
|
||||
layout->setStretch(1, 0);
|
||||
|
||||
/* Might be useful for #392 */
|
||||
#if 0
|
||||
QPushButton *pb = new QPushButton("...");
|
||||
pw->layout()->addWidget(pb);
|
||||
if (hasConfig) {
|
||||
QPushButton *config = new QPushButton("...");
|
||||
m_configButtonMapper->setMapping(config, identifier);
|
||||
connect(config, &QPushButton::clicked, m_configButtonMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
||||
pw->layout()->addWidget(config);
|
||||
}
|
||||
|
||||
layout->setStretch(0, 1);
|
||||
layout->setStretch(1, 0);
|
||||
#endif
|
||||
layout->setStretch(2, 0);
|
||||
|
||||
this->layout()->addWidget(pw);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace BlackGui
|
||||
//! Emitted when user clicks the "Details" button
|
||||
void pluginDetailsRequested(const QString &identifier);
|
||||
|
||||
//! Emitted when user clicks the "Settings" button
|
||||
void pluginConfigRequested(const QString &identifier);
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CPluginSelector(QWidget *parent = 0);
|
||||
@@ -43,13 +46,14 @@ namespace BlackGui
|
||||
//! \param identifier Identifier of the plugin.
|
||||
//! \param name Name of the plugin
|
||||
//! \param enabled Defines whether the plugin is initially enabled or not
|
||||
void addPlugin(const QString &identifier, const QString &name, bool enabled = true);
|
||||
void addPlugin(const QString &identifier, const QString &name, bool hasConfig = false, bool enabled = true);
|
||||
|
||||
private slots:
|
||||
void ps_handlePluginStateChange();
|
||||
|
||||
private:
|
||||
QSignalMapper *m_mapper;
|
||||
QSignalMapper *m_detailsButtonMapper;
|
||||
QSignalMapper *m_configButtonMapper;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace BlackMisc
|
||||
if (json.contains("IID")) // comes from the plugin
|
||||
{
|
||||
// json data is already validated by CPluginManagerSimulator
|
||||
Q_ASSERT(json["IID"].toString() == QStringLiteral("org.swift-project.blackcore.simulatorinterface"));
|
||||
CValueObject::convertFromJson(json["MetaData"].toObject());
|
||||
m_valid = true;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ INCLUDEPATH += . $$SourceRoot/src
|
||||
|
||||
SOURCES += *.cpp
|
||||
HEADERS += *.h
|
||||
DISTFILES += simulator_xplane.json
|
||||
|
||||
DESTDIR = $$DestRoot/bin/plugins/simulator
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
20
src/plugins/simulator/xplane_config/plugin_xplane_config.pro
Normal file
20
src/plugins/simulator/xplane_config/plugin_xplane_config.pro
Normal 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)
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"identifier" : "org.swift-project.plugins.simulator.xplane.config"
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
42
src/plugins/simulator/xplane_config/simulatorxplaneconfig.h
Normal file
42
src/plugins/simulator/xplane_config/simulatorxplaneconfig.h
Normal 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
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user