mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Initial FlightGear plugin commit
This commit is contained in:
29
src/plugins/simulator/flightgearconfig/flightgearconfig.pro
Normal file
29
src/plugins/simulator/flightgearconfig/flightgearconfig.pro
Normal file
@@ -0,0 +1,29 @@
|
||||
load(common_pre)
|
||||
|
||||
QT += core dbus network widgets
|
||||
|
||||
TARGET = simulatorflightgearconfig
|
||||
TEMPLATE = lib
|
||||
|
||||
CONFIG += plugin shared
|
||||
CONFIG += blackmisc blackcore blackgui
|
||||
|
||||
DEPENDPATH += . $$SourceRoot/src
|
||||
INCLUDEPATH += . $$SourceRoot/src
|
||||
|
||||
SOURCES += *.cpp
|
||||
HEADERS += *.h
|
||||
FORMS += *.ui
|
||||
DISTFILES += simulatorxplaneconfig.json
|
||||
|
||||
DESTDIR = $$DestRoot/bin/plugins/simulator
|
||||
|
||||
win32 {
|
||||
dlltarget.path = $$PREFIX/bin/plugins/simulator
|
||||
INSTALLS += dlltarget
|
||||
} else {
|
||||
target.path = $$PREFIX/bin/plugins/simulator
|
||||
INSTALLS += target
|
||||
}
|
||||
|
||||
load(common_post)
|
||||
@@ -0,0 +1,30 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include "simulatorxplaneconfig.h"
|
||||
#include "simulatorxplaneconfigwindow.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
namespace XPlane
|
||||
{
|
||||
CSimulatorXPlaneConfig::CSimulatorXPlaneConfig(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BlackGui::CPluginConfigWindow *CSimulatorXPlaneConfig::createConfigWindow(QWidget *parent)
|
||||
{
|
||||
CSimulatorXPlaneConfigWindow* w = new CSimulatorXPlaneConfigWindow(parent);
|
||||
return w;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/* 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"
|
||||
#include "blackmisc/settingscache.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace BlackGui { class CPluginConfigWindow; }
|
||||
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 "simulatorxplaneconfig.json")
|
||||
Q_INTERFACES(BlackGui::IPluginConfig)
|
||||
|
||||
public:
|
||||
//! Ctor
|
||||
CSimulatorXPlaneConfig(QObject *parent = nullptr);
|
||||
|
||||
//! Dtor
|
||||
virtual ~CSimulatorXPlaneConfig() {}
|
||||
|
||||
//! \copydoc BlackGui::IPluginConfig::createConfigWindow()
|
||||
BlackGui::CPluginConfigWindow *createConfigWindow(QWidget *parent) override;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"identifier" : "org.swift-project.plugins.simulator.flightgear.config"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include "simulatorxplaneconfigwindow.h"
|
||||
#include "blackcore/application.h"
|
||||
#include "ui_simulatorxplaneconfigwindow.h"
|
||||
#include "blackmisc/simulation/xplane/xswiftbusconfigwriter.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
using namespace BlackGui;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation::XPlane;
|
||||
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
namespace XPlane
|
||||
{
|
||||
CSimulatorXPlaneConfigWindow::CSimulatorXPlaneConfigWindow(QWidget *parent) :
|
||||
CPluginConfigWindow(parent),
|
||||
ui(new Ui::CSimulatorXPlaneConfigWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->comp_SettingsXSwiftBus->setDefaultP2PAddress(m_xswiftbusServerSetting.getDefault());
|
||||
ui->comp_SettingsXSwiftBus->set(m_xswiftbusServerSetting.getThreadLocal());
|
||||
|
||||
connect(ui->bb_OkCancel, &QDialogButtonBox::accepted, this, &CSimulatorXPlaneConfigWindow::onSettingsAccepted);
|
||||
connect(ui->bb_OkCancel, &QDialogButtonBox::rejected, this, &CSimulatorXPlaneConfigWindow::close);
|
||||
}
|
||||
|
||||
CSimulatorXPlaneConfigWindow::~CSimulatorXPlaneConfigWindow()
|
||||
{ }
|
||||
|
||||
void CSimulatorXPlaneConfigWindow::onSettingsAccepted()
|
||||
{
|
||||
const QString currentAddress = m_xswiftbusServerSetting.getThreadLocal();
|
||||
const QString updatedAddress = ui->comp_SettingsXSwiftBus->getDBusAddress();
|
||||
if (currentAddress != ui->comp_SettingsXSwiftBus->getDBusAddress())
|
||||
{
|
||||
m_xswiftbusServerSetting.set(updatedAddress);
|
||||
CXSwiftBusConfigWriter xswiftbusConfigWriter;
|
||||
xswiftbusConfigWriter.setDBusAddress(updatedAddress);
|
||||
xswiftbusConfigWriter.updateInAllXPlaneVersions();
|
||||
}
|
||||
close();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
@@ -0,0 +1,50 @@
|
||||
/* 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 "blackgui/pluginconfigwindow.h"
|
||||
#include "blackmisc/simulation/settings/mysettings.h"
|
||||
#include "simulatorxplaneconfig.h"
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CSimulatorXPlaneConfigWindow; }
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
namespace XPlane
|
||||
{
|
||||
/**
|
||||
* A window that shows all the X-Plane plugin options.
|
||||
*/
|
||||
class CSimulatorXPlaneConfigWindow : public BlackGui::CPluginConfigWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Ctor.
|
||||
CSimulatorXPlaneConfigWindow(QWidget *parent);
|
||||
|
||||
//! Dtor.
|
||||
virtual ~CSimulatorXPlaneConfigWindow();
|
||||
|
||||
private:
|
||||
//! Settings have been accepted
|
||||
void onSettingsAccepted();
|
||||
|
||||
QScopedPointer<Ui::CSimulatorXPlaneConfigWindow> ui;
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TXSwiftBusServer> m_xswiftbusServerSetting { this };
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
@@ -0,0 +1,70 @@
|
||||
<?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>275</width>
|
||||
<height>175</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>X-Plane plugin settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_ConfigWindow">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<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>
|
||||
<item row="0" column="0" alignment="Qt::AlignTop">
|
||||
<widget class="BlackGui::Components::CDBusServerAddressSelector" name="comp_SettingsXSwiftBus">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CDBusServerAddressSelector</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/dbusserveraddressselector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user