mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
refs #392 Added BlackGui::CPluginConfigWindow
* CPluginConfigWindow is now base class for all plugin config windows * CPluginConfigWindow is styled properly * Fixed behaviour in CSimulatorXPlaneConfigWindow
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a0b4d47736
commit
06c17d7d09
@@ -11,11 +11,10 @@ namespace BlackSimPlugin
|
||||
|
||||
}
|
||||
|
||||
QWidget *CSimulatorXPlaneConfig::createConfigWindow()
|
||||
BlackGui::CPluginConfigWindow *CSimulatorXPlaneConfig::createConfigWindow()
|
||||
{
|
||||
CSimulatorXPlaneConfigWindow* w = new CSimulatorXPlaneConfigWindow();
|
||||
return w;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,21 @@
|
||||
#define BLACKSIMPLUGIN_SIMULATOR_XPLANE_CONFIG_H
|
||||
|
||||
#include "blackgui/pluginconfig.h"
|
||||
|
||||
#include "blackcore/settingscache.h"
|
||||
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
namespace XPlane
|
||||
{
|
||||
struct XBusServer : public BlackCore::CSettingTrait<QString>
|
||||
{
|
||||
//! \copydoc BlackCore::CSetting::key
|
||||
static const char *key() { return "xbus/server"; }
|
||||
|
||||
//! \copydoc BlackCore::CSetting::defaultValue
|
||||
static QString defaultValue() { return QStringLiteral("session"); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Config plugin for the X-Plane plugin.
|
||||
*/
|
||||
@@ -33,7 +42,7 @@ namespace BlackSimPlugin
|
||||
CSimulatorXPlaneConfig(QObject *parent = nullptr);
|
||||
|
||||
//! \copydoc BlackGui::IPluginConfig::createConfigWindow()
|
||||
QWidget *createConfigWindow() override;
|
||||
BlackGui::CPluginConfigWindow *createConfigWindow() override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "ui_simulatorxplaneconfigwindow.h"
|
||||
#include "blackcore/dbus_server.h"
|
||||
|
||||
using namespace BlackGui;
|
||||
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
@@ -9,7 +10,6 @@ namespace BlackSimPlugin
|
||||
{
|
||||
|
||||
CSimulatorXPlaneConfigWindow::CSimulatorXPlaneConfigWindow() :
|
||||
QWidget(nullptr),
|
||||
ui(new Ui::CSimulatorXPlaneConfigWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -17,7 +17,11 @@ namespace BlackSimPlugin
|
||||
ui->cp_XBusServer->addItem(BlackCore::CDBusServer::sessionDBusServer());
|
||||
ui->cp_XBusServer->addItem(BlackCore::CDBusServer::systemDBusServer());
|
||||
|
||||
connect(ui->bb_OkCancel, &QDialogButtonBox::accepted, this, &CSimulatorXPlaneConfigWindow::ps_storeSettings);
|
||||
connect(ui->bb_OkCancel, &QDialogButtonBox::accepted, this, &CSimulatorXPlaneConfigWindow::close);
|
||||
connect(ui->bb_OkCancel, &QDialogButtonBox::rejected, this, &CSimulatorXPlaneConfigWindow::close);
|
||||
|
||||
ui->cp_XBusServer->setCurrentText(m_xbusServerSetting.get());
|
||||
}
|
||||
|
||||
CSimulatorXPlaneConfigWindow::~CSimulatorXPlaneConfigWindow()
|
||||
@@ -25,5 +29,13 @@ namespace BlackSimPlugin
|
||||
|
||||
}
|
||||
|
||||
void CSimulatorXPlaneConfigWindow::ps_storeSettings()
|
||||
{
|
||||
if (ui->cp_XBusServer->currentText() != m_xbusServerSetting.get())
|
||||
{
|
||||
m_xbusServerSetting.set(ui->cp_XBusServer->currentText());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#ifndef BLACKSIMPLUGIN_SIMULATOR_XPLANE_CONFIG_WINDOW_H
|
||||
#define BLACKSIMPLUGIN_SIMULATOR_XPLANE_CONFIG_WINDOW_H
|
||||
|
||||
#include "simulatorxplaneconfig.h"
|
||||
#include "blackgui/pluginconfigwindow.h"
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
|
||||
@@ -26,7 +28,7 @@ namespace BlackSimPlugin
|
||||
/**
|
||||
* A window that shows all the X-Plane plugin options.
|
||||
*/
|
||||
class CSimulatorXPlaneConfigWindow : public QWidget
|
||||
class CSimulatorXPlaneConfigWindow : public BlackGui::CPluginConfigWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -37,9 +39,14 @@ namespace BlackSimPlugin
|
||||
//! Dtor.
|
||||
virtual ~CSimulatorXPlaneConfigWindow();
|
||||
|
||||
private slots:
|
||||
void ps_storeSettings();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CSimulatorXPlaneConfigWindow> ui;
|
||||
|
||||
BlackCore::CSetting<XBusServer> m_xbusServerSetting { this };
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user