mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
refs #185 , added config panel for FSX to GUI. Allows to write a simconnect.cfg, if FSX is running remotely.
This commit is contained in:
@@ -5,9 +5,7 @@
|
|||||||
#include "blackcore/context_network.h"
|
#include "blackcore/context_network.h"
|
||||||
#include "blackcore/context_application.h"
|
#include "blackcore/context_application.h"
|
||||||
#include "blackcore/network.h"
|
#include "blackcore/network.h"
|
||||||
|
|
||||||
#include "blackmisc/avaircraft.h"
|
#include "blackmisc/avaircraft.h"
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
|
|||||||
@@ -405,14 +405,10 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void toggleNetworkConnection();
|
void toggleNetworkConnection();
|
||||||
|
|
||||||
/*!
|
//! \brief Menu item clicked
|
||||||
* \brief Menu item clicked
|
|
||||||
*/
|
|
||||||
void menuClicked();
|
void menuClicked();
|
||||||
|
|
||||||
/*!
|
//! \brief Terminated connection
|
||||||
* \brief Terminated connection
|
|
||||||
*/
|
|
||||||
void connectionTerminated();
|
void connectionTerminated();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -432,9 +428,7 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void alterTrafficServer();
|
void alterTrafficServer();
|
||||||
|
|
||||||
/*!
|
//! \brief Network settings have been changed
|
||||||
* \brief Network settings have been changed
|
|
||||||
*/
|
|
||||||
void changedSettings();
|
void changedSettings();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -454,28 +448,19 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void middlePanelChanged(int index);
|
void middlePanelChanged(int index);
|
||||||
|
|
||||||
/*!
|
//! \brief Command entered
|
||||||
* \brief Command entered
|
|
||||||
*/
|
|
||||||
void commandEntered();
|
void commandEntered();
|
||||||
|
|
||||||
/*!
|
//! \brief Get METAR for given ICAO airport code
|
||||||
* \brief Get METAR
|
|
||||||
* \param airportIcaoCode
|
|
||||||
*/
|
|
||||||
void getMetar(const QString &airportIcaoCode = "");
|
void getMetar(const QString &airportIcaoCode = "");
|
||||||
|
|
||||||
//! \brief Request new ATIS
|
//! \brief Request new ATIS
|
||||||
void requestAtis();
|
void requestAtis();
|
||||||
|
|
||||||
/*!
|
//! \brief Close text message tab
|
||||||
* \brief Close text message tab
|
|
||||||
*/
|
|
||||||
void closeTextMessageTab();
|
void closeTextMessageTab();
|
||||||
|
|
||||||
/*!
|
//! \brief Cockpit values changed
|
||||||
* \brief Cockpit values changed
|
|
||||||
*/
|
|
||||||
void cockpitValuesChanged();
|
void cockpitValuesChanged();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -484,9 +469,7 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void audioDeviceSelected(int index);
|
void audioDeviceSelected(int index);
|
||||||
|
|
||||||
/*!
|
//! \brief Reset transponder to Standby / Charly
|
||||||
* \brief Reset transponder to Standby / Charly
|
|
||||||
*/
|
|
||||||
void resetTransponderMode();
|
void resetTransponderMode();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -525,6 +508,13 @@ private slots:
|
|||||||
|
|
||||||
//! Clear single hotkey
|
//! Clear single hotkey
|
||||||
void clearHotkey();
|
void clearHotkey();
|
||||||
|
|
||||||
|
//! Test the SIM connect connectivity
|
||||||
|
void testSimConnectConnection();
|
||||||
|
|
||||||
|
//! Save a simconnect.cfg file for FSX
|
||||||
|
void saveSimConnectCfg();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pop_macro("interface")
|
#pragma pop_macro("interface")
|
||||||
|
|||||||
@@ -1798,9 +1798,9 @@ QStatusBar QLabel {
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tb_Settings">
|
<widget class="QTabWidget" name="Simulator">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tb_SettingsTrafficNetwork">
|
<widget class="QWidget" name="tb_SettingsTrafficNetwork">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -2289,6 +2289,73 @@ QStatusBar QLabel {
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tb_SettingsSimulator">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Simulator</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="fl_SettingsSimulator">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_SettingsSimulatorFsxAddress">
|
||||||
|
<property name="text">
|
||||||
|
<string>FSX address</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_SettingsSimulatorFsxAddress">
|
||||||
|
<property name="text">
|
||||||
|
<string>127.0.0.1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_SettingsSimulatorFsxPort">
|
||||||
|
<property name="text">
|
||||||
|
<string>FSX port</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_SettingsSimulatorFsxPort">
|
||||||
|
<property name="text">
|
||||||
|
<string>500</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_SettingsSimulatorFsxOpenSimconnectCfg">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_SettingsSimulatorFsxSaveSimconnectCfg">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_SettingsSimulatorFsxTestConnection">
|
||||||
|
<property name="text">
|
||||||
|
<string>Test connection</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
<widget class="QWidget" name="tb_SettingsGui">
|
<widget class="QWidget" name="tb_SettingsGui">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>GUI</string>
|
<string>GUI</string>
|
||||||
@@ -3168,7 +3235,7 @@ QStatusBar QLabel {
|
|||||||
<tabstop>te_TextMessagesUnicom</tabstop>
|
<tabstop>te_TextMessagesUnicom</tabstop>
|
||||||
<tabstop>te_TextMessagesCOM1</tabstop>
|
<tabstop>te_TextMessagesCOM1</tabstop>
|
||||||
<tabstop>te_TextMessagesCOM2</tabstop>
|
<tabstop>te_TextMessagesCOM2</tabstop>
|
||||||
<tabstop>tb_Settings</tabstop>
|
<tabstop>Simulator</tabstop>
|
||||||
<tabstop>tv_SettingsTnServers</tabstop>
|
<tabstop>tv_SettingsTnServers</tabstop>
|
||||||
<tabstop>le_SettingsTnCsName</tabstop>
|
<tabstop>le_SettingsTnCsName</tabstop>
|
||||||
<tabstop>le_SettingsTnCsDescription</tabstop>
|
<tabstop>le_SettingsTnCsDescription</tabstop>
|
||||||
|
|||||||
@@ -367,6 +367,10 @@ void MainWindow::initGuiSignals()
|
|||||||
this->connect(this->ui->pb_SettingsMiscSave, &QPushButton::clicked, this, &MainWindow::saveHotkeys);
|
this->connect(this->ui->pb_SettingsMiscSave, &QPushButton::clicked, this, &MainWindow::saveHotkeys);
|
||||||
this->connect(this->ui->pb_SettingsMiscRemove, &QPushButton::clicked, this, &MainWindow::clearHotkey);
|
this->connect(this->ui->pb_SettingsMiscRemove, &QPushButton::clicked, this, &MainWindow::clearHotkey);
|
||||||
|
|
||||||
|
// Settings simulator
|
||||||
|
this->connect(this->ui->pb_SettingsSimulatorFsxTestConnection, &QPushButton::clicked, this, &MainWindow::testSimConnectConnection);
|
||||||
|
this->connect(this->ui->pb_SettingsSimulatorFsxSaveSimconnectCfg, &QPushButton::clicked, this, &MainWindow::saveSimConnectCfg);
|
||||||
|
|
||||||
// no warnings in release build
|
// no warnings in release build
|
||||||
Q_UNUSED(connected);
|
Q_UNUSED(connected);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#include "blackcore/dbus_server.h"
|
#include "blackcore/dbus_server.h"
|
||||||
#include "blackcore/context_network.h"
|
#include "blackcore/context_network.h"
|
||||||
#include "blackmisc/hwkeyboardkey.h"
|
#include "blackmisc/hwkeyboardkey.h"
|
||||||
|
#include "blackmisc/networkchecks.h"
|
||||||
|
#include "blacksim/fsx/simconnectutilities.h"
|
||||||
|
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -13,6 +15,7 @@ using namespace BlackMisc::Aviation;
|
|||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
using namespace BlackMisc::Geo;
|
using namespace BlackMisc::Geo;
|
||||||
using namespace BlackMisc::Settings;
|
using namespace BlackMisc::Settings;
|
||||||
|
using namespace BlackSim::Fsx;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reload settings
|
* Reload settings
|
||||||
@@ -146,3 +149,69 @@ void MainWindow::clearHotkey()
|
|||||||
defKey.setFunction(key.getFunction());
|
defKey.setFunction(key.getFunction());
|
||||||
this->m_modelSettingsHotKeys->update(i, defKey);
|
this->m_modelSettingsHotKeys->update(i, defKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::testSimConnectConnection()
|
||||||
|
{
|
||||||
|
QString address = this->ui->le_SettingsSimulatorFsxAddress->text().trimmed();
|
||||||
|
QString port = this->ui->le_SettingsSimulatorFsxPort->text().trimmed();
|
||||||
|
|
||||||
|
if (address.isEmpty() || port.isEmpty())
|
||||||
|
{
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, "no address or port"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!CNetworkChecks::isValidIPv4Address(address))
|
||||||
|
{
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, "IPv4 address invalid"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!CNetworkChecks::isValidPort(port))
|
||||||
|
{
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, "invalid port"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
quint16 p = port.toUInt();
|
||||||
|
QString msg;
|
||||||
|
if (!CNetworkChecks::canConnect(address, p, msg))
|
||||||
|
{
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, msg));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = QString("Connected to %1:%2").arg(address).arg(port);
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityInfo, msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::saveSimConnectCfg()
|
||||||
|
{
|
||||||
|
QString address = this->ui->le_SettingsSimulatorFsxAddress->text().trimmed();
|
||||||
|
QString port = this->ui->le_SettingsSimulatorFsxPort->text().trimmed();
|
||||||
|
|
||||||
|
if (address.isEmpty() || port.isEmpty())
|
||||||
|
{
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, "no address or port"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!CNetworkChecks::isValidIPv4Address(address))
|
||||||
|
{
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, "IPv4 address invalid"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!CNetworkChecks::isValidPort(port))
|
||||||
|
{
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityWarning, "invalid port"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
quint16 p = port.toUInt();
|
||||||
|
QString file = CSimConnectUtilities::getLocalSimConnectCfgFilename();
|
||||||
|
if (CSimConnectUtilities::writeSimConnectCfg(file, address, p))
|
||||||
|
{
|
||||||
|
QString m = QString("Written ").append(file);
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityInfo, m));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString m = QString("Cannot write ").append(file);
|
||||||
|
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityError, m));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,20 +10,22 @@ TEMPLATE = app
|
|||||||
SOURCES += *.cpp
|
SOURCES += *.cpp
|
||||||
HEADERS += *.h
|
HEADERS += *.h
|
||||||
FORMS += *.ui
|
FORMS += *.ui
|
||||||
CONFIG += blackmisc blacksound blackcore blackgui
|
CONFIG += blackmisc blacksound blackcore blackgui blacksim
|
||||||
|
|
||||||
DEPENDPATH += . ../../src/blackmisc ../../src/blackgui ../../src/blacksound ../../src/blackcore
|
DEPENDPATH += . ../../src/blackmisc ../../src/blackgui ../../src/blacksound ../../src/blacksim ../../src/blackcore
|
||||||
INCLUDEPATH += . ../../src
|
INCLUDEPATH += . ../../src
|
||||||
|
|
||||||
DESTDIR = ../../bin
|
DESTDIR = ../../bin
|
||||||
|
|
||||||
win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib \
|
win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib \
|
||||||
../../lib/blackgui.lib \
|
../../lib/blackgui.lib \
|
||||||
|
../../lib/blacksim.lib \
|
||||||
../../lib/blacksound.lib \
|
../../lib/blacksound.lib \
|
||||||
../../lib/blackcore.lib
|
../../lib/blackcore.lib
|
||||||
|
|
||||||
else: PRE_TARGETDEPS += ../../lib/libblackmisc.a \
|
else: PRE_TARGETDEPS += ../../lib/libblackmisc.a \
|
||||||
../../lib/libblackgui.a \
|
../../lib/libblackgui.a \
|
||||||
|
../../lib/libblacksim.a \
|
||||||
../../lib/libblacksound.a \
|
../../lib/libblacksound.a \
|
||||||
../../lib/libblackcore.a
|
../../lib/libblackcore.a
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user