mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Ref T349, P3D version settings UI
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
<property name="windowTitle">
|
||||
<string>FSX/P3D settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_Settings" columnstretch="0,1">
|
||||
<item row="4" column="1">
|
||||
<layout class="QGridLayout" name="gl_Settings" columnstretch="0,0">
|
||||
<item row="5" column="1">
|
||||
<widget class="QWidget" name="wi_Buttons" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item alignment="Qt::AlignRight">
|
||||
@@ -47,21 +47,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cb_TraceSimConnectCalls">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cb_UseFsuipc">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lbl_TraceSimConnectCalls">
|
||||
<property name="text">
|
||||
<string>Trace simConnect calls (this will trace sendId calls and provide further information)</string>
|
||||
@@ -71,7 +57,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="lbl_SBOffsets">
|
||||
<property name="text">
|
||||
<string>Enable SB SimConnect offsets. Those are needed to detect "Ident" and "Standby" from your transponder (supported by some vendors as PMDG).</string>
|
||||
@@ -81,34 +67,48 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cb_UseFsuipc">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cb_TraceSimConnectCalls">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="lbl_TraceTerrainProbe">
|
||||
<property name="text">
|
||||
<string>Use the terrain probe (32bit only)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="cb_EnableTerrainProbe">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lbl_UseFsuipc">
|
||||
<property name="text">
|
||||
<string>Enable FSUIPC support</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="cb_SBOffsets">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="cb_EnableTerrainProbe">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
@@ -116,6 +116,8 @@
|
||||
<tabstop>cb_UseFsuipc</tabstop>
|
||||
<tabstop>cb_SBOffsets</tabstop>
|
||||
<tabstop>cb_EnableTerrainProbe</tabstop>
|
||||
<tabstop>pb_CopyTerrainProbe</tabstop>
|
||||
<tabstop>pb_Refresh</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
*/
|
||||
|
||||
#include "SimConnectsettingscomponent.h"
|
||||
#include "ui_SimConnectsettingscomponent.h"
|
||||
#include "ui_simconnectsettingscomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackcore/context/contextapplication.h"
|
||||
#include "blackcore/context/contextsimulator.h"
|
||||
#include "blackmisc/simulation/fsx/SimConnectutilities.h"
|
||||
#include "blackmisc/simulation/fsx/simconnectutilities.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
@@ -28,13 +28,14 @@ using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Simulation::Fsx;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackGui;
|
||||
|
||||
namespace BlackSimPlugin
|
||||
{
|
||||
namespace FsxCommon
|
||||
{
|
||||
CSimConnectSettingsComponent::CSimConnectSettingsComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
COverlayMessagesFrame(parent),
|
||||
ui(new Ui::CSimConnectSettingsComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -46,8 +47,12 @@ namespace BlackSimPlugin
|
||||
connect(ui->pb_OpenUserCfgFile, &QPushButton::clicked, this, &CSimConnectSettingsComponent::openUserSimConnectCfgFile);
|
||||
connect(ui->pb_TestConnection, &QPushButton::clicked, this, &CSimConnectSettingsComponent::testSwiftSimConnectConnection);
|
||||
connect(ui->pb_SaveAsSimConnectIni, &QPushButton::clicked, this, &CSimConnectSettingsComponent::saveSimConnectIniFileDialog);
|
||||
|
||||
this->setSimConnectInfo();
|
||||
|
||||
if (m_p3d64bit)
|
||||
{
|
||||
connect(ui->cb_P3DVersion, &QComboBox::currentTextChanged, this, &CSimConnectSettingsComponent::onP3DVersionChanged);
|
||||
}
|
||||
}
|
||||
|
||||
CSimConnectSettingsComponent::~CSimConnectSettingsComponent()
|
||||
@@ -214,17 +219,49 @@ namespace BlackSimPlugin
|
||||
{
|
||||
ui->pte_SimConnectInfo->setPlainText("Static linking P3Dv4 x64");
|
||||
m_simulator = CSimulatorInfo(CSimulatorInfo::P3D);
|
||||
m_p3d64bit = true;
|
||||
|
||||
const QString v = m_p3dVersion.get();
|
||||
this->setComboBox(v);
|
||||
}
|
||||
else
|
||||
{
|
||||
const CWinDllUtils::DLLInfo SimConnectInfo = CSimConnectUtilities::simConnectDllInfo();
|
||||
ui->pte_SimConnectInfo->setPlainText(SimConnectInfo.summary());
|
||||
m_simulator = CSimulatorInfo(CSimulatorInfo::FSX);
|
||||
m_p3d64bit = false;
|
||||
}
|
||||
|
||||
ui->lbl_P3DVersion->setVisible(m_p3d64bit);
|
||||
ui->cb_P3DVersion->setVisible(m_p3d64bit);
|
||||
|
||||
ui->le_UserCfgFile->setText(CSimConnectUtilities::hasUserSimConnectCfgFile() ? CSimConnectUtilities::getUserSimConnectCfgFilename() : "");
|
||||
const QString iniFiles = CSimConnectUtilities::getSimConnectIniFiles().join("\n");
|
||||
ui->pte_SimConnectIniFiles->setPlainText(iniFiles);
|
||||
this->checkSwiftSimConnectCfgFile();
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::setComboBox(const QString &value)
|
||||
{
|
||||
QString v;
|
||||
bool found = false;
|
||||
for (int index = 0; index < ui->cb_P3DVersion->count(); index++)
|
||||
{
|
||||
v = ui->cb_P3DVersion->itemText(index);
|
||||
if (v.contains(value, Qt::CaseInsensitive)) { found = true; break; }
|
||||
}
|
||||
ui->cb_P3DVersion->setCurrentText(found ? v : "");
|
||||
}
|
||||
|
||||
void BlackSimPlugin::FsxCommon::CSimConnectSettingsComponent::onP3DVersionChanged(const QString &version)
|
||||
{
|
||||
if (m_p3dVersion.get() == version) { return; }
|
||||
const CStatusMessage saveMsg = m_p3dVersion.setAndSave(version);
|
||||
if (saveMsg.isSuccess())
|
||||
{
|
||||
const CStatusMessage m = CStatusMessage(this).info("Changed P3D version to '%1'. Requires a new start of swift to become effective!") << version;
|
||||
this->showOverlayMessage(m);
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -12,8 +12,11 @@
|
||||
#ifndef BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECTSETTINGSCOMPONENT_H
|
||||
#define BLACKSIMPLUGIN_FSXCOMMON_SIMCONNECTSETTINGSCOMPONENT_H
|
||||
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/simulation/settings/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include <QFrame>
|
||||
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui { class CSimConnectSettingsComponent; }
|
||||
@@ -24,7 +27,7 @@ namespace BlackSimPlugin
|
||||
/*!
|
||||
* A component that gathers all SimConnect related settings.
|
||||
*/
|
||||
class CSimConnectSettingsComponent : public QFrame
|
||||
class CSimConnectSettingsComponent : public BlackGui::COverlayMessagesFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -60,8 +63,16 @@ namespace BlackSimPlugin
|
||||
//! Set the simconnect info
|
||||
void setSimConnectInfo();
|
||||
|
||||
//! The the value in the combobox
|
||||
void setComboBox(const QString &value);
|
||||
|
||||
//! The P3D version has been changed
|
||||
void onP3DVersionChanged(const QString &version);
|
||||
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulator { BlackMisc::Simulation::CSimulatorInfo::FSX };
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TP3DVersion> m_p3dVersion { this };
|
||||
QScopedPointer<Ui::CSimConnectSettingsComponent> ui;
|
||||
bool m_p3d64bit = false;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<ui version="4.0">
|
||||
<class>CSimConnectSettingsComponent</class>
|
||||
<widget class="QWidget" name="CSimConnectSettingsComponent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>410</width>
|
||||
<height>466</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>FSX/P3D SimConnect config</string>
|
||||
</property>
|
||||
@@ -24,14 +32,14 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SimConnect">
|
||||
<property name="text">
|
||||
<string>SimConnect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_SimConnectIniFiles">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-style:italic;">SimConnect.ini</span> files</p></body></html></string>
|
||||
@@ -41,7 +49,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPlainTextEdit" name="pte_SimConnectIniFiles">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -54,7 +62,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_DefaultSimConnectIniFile">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Default <span style=" font-style:italic;">SimConnect.ini</span> file</p></body></html></string>
|
||||
@@ -64,7 +72,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QPlainTextEdit" name="pte_SimConnectIni">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -88,7 +96,7 @@ console=1
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QWidget" name="wi_SimConnectIniSaveAs" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
@@ -129,7 +137,7 @@ console=1
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPlainTextEdit" name="pte_SimConnectInfo">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -145,6 +153,38 @@ console=1
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cb_P3DVersion">
|
||||
<property name="currentText">
|
||||
<string>4.2 64bit</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4.1 64bit</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4.2 64bit</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4.3 64bit</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_P3DVersion">
|
||||
<property name="text">
|
||||
<string>P3V 64 bit version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -422,6 +462,7 @@ console=1
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>cb_P3DVersion</tabstop>
|
||||
<tabstop>pte_SimConnectInfo</tabstop>
|
||||
<tabstop>pte_SimConnectIniFiles</tabstop>
|
||||
<tabstop>pte_SimConnectIni</tabstop>
|
||||
|
||||
Reference in New Issue
Block a user