mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
SimConnect config: Allow to enable tracing of sendid via UI
This commit is contained in:
committed by
Roland Winklmeier
parent
7ba9a35c52
commit
456cb5d1ea
@@ -57,6 +57,7 @@ namespace BlackCore
|
|||||||
class BLACKCORE_EXPORT CSimulatorCommon : public ISimulator
|
class BLACKCORE_EXPORT CSimulatorCommon : public ISimulator
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(BlackCore::ISimulator)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Log categories
|
//! Log categories
|
||||||
|
|||||||
56
src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp
Normal file
56
src/plugins/simulator/fsxcommon/fsxsettingscomponent.cpp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/* Copyright (C) 2018
|
||||||
|
* 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 "fsxsettingscomponent.h"
|
||||||
|
#include "ui_fsxsettingscomponent.h"
|
||||||
|
#include "simulatorfsxcommon.h"
|
||||||
|
#include "blackgui/guiapplication.h"
|
||||||
|
|
||||||
|
using namespace BlackCore;
|
||||||
|
using namespace BlackGui;
|
||||||
|
|
||||||
|
namespace BlackSimPlugin
|
||||||
|
{
|
||||||
|
namespace FsxCommon
|
||||||
|
{
|
||||||
|
CFsxSettingsComponent::CFsxSettingsComponent(QWidget *parent) :
|
||||||
|
QFrame(parent),
|
||||||
|
ui(new Ui::CFsxSettingsComponent)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->cb_TraceSimConnectCalls->setChecked(false);
|
||||||
|
connect(ui->cb_TraceSimConnectCalls, &QCheckBox::released, this, &CFsxSettingsComponent::onSimConnectTraceChanged);
|
||||||
|
const CSimulatorFsxCommon *fsx = this->getFsxSimulator();
|
||||||
|
if (fsx)
|
||||||
|
{
|
||||||
|
ui->cb_TraceSimConnectCalls->setChecked(fsx->isTracingSendId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CFsxSettingsComponent::~CFsxSettingsComponent()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void CFsxSettingsComponent::onSimConnectTraceChanged()
|
||||||
|
{
|
||||||
|
CSimulatorFsxCommon *fsx = this->getFsxSimulator();
|
||||||
|
if (!fsx) { return; }
|
||||||
|
fsx->setTractingSendId(ui->cb_TraceSimConnectCalls->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
CSimulatorFsxCommon *CFsxSettingsComponent::getFsxSimulator() const
|
||||||
|
{
|
||||||
|
if (!sGui || !sGui->getISimulator()) { return nullptr; }
|
||||||
|
ISimulator *sim = sGui->getISimulator();
|
||||||
|
if (!sim->getSimulatorInfo().isFsxP3DFamily()) { return nullptr; }
|
||||||
|
if (sim->getSimulatorInfo() != m_simulator) { return nullptr; }
|
||||||
|
CSimulatorFsxCommon *fsx = static_cast<CSimulatorFsxCommon *>(sim); // wonder why qobject_cast does not work here
|
||||||
|
return fsx;
|
||||||
|
}
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
54
src/plugins/simulator/fsxcommon/fsxsettingscomponent.h
Normal file
54
src/plugins/simulator/fsxcommon/fsxsettingscomponent.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* Copyright (C) 2018
|
||||||
|
* 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_FSXCOMMON_FSXSETTINGSCOMPONENT_H
|
||||||
|
#define BLACKSIMPLUGIN_FSXCOMMON_FSXSETTINGSCOMPONENT_H
|
||||||
|
|
||||||
|
#include "blackmisc/simulation/simulatorinfo.h"
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QScopedPointer>
|
||||||
|
|
||||||
|
namespace Ui { class CFsxSettingsComponent; }
|
||||||
|
namespace BlackSimPlugin
|
||||||
|
{
|
||||||
|
namespace FsxCommon
|
||||||
|
{
|
||||||
|
class CSimulatorFsxCommon;
|
||||||
|
|
||||||
|
//! FSX/P3D settings
|
||||||
|
class CFsxSettingsComponent : public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
explicit CFsxSettingsComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CFsxSettingsComponent();
|
||||||
|
|
||||||
|
//! Simulator, P3D/FSX
|
||||||
|
void setSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) { m_simulator = simulator; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
//! Checkbox change
|
||||||
|
void onSimConnectTraceChanged();
|
||||||
|
|
||||||
|
//! Access the concrete implementation
|
||||||
|
CSimulatorFsxCommon *getFsxSimulator () const;
|
||||||
|
|
||||||
|
BlackMisc::Simulation::CSimulatorInfo m_simulator { "FSX" };
|
||||||
|
QScopedPointer<Ui::CFsxSettingsComponent> ui;
|
||||||
|
};
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
28
src/plugins/simulator/fsxcommon/fsxsettingscomponent.ui
Normal file
28
src/plugins/simulator/fsxcommon/fsxsettingscomponent.ui
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CFsxSettingsComponent</class>
|
||||||
|
<widget class="QFrame" name="CFsxSettingsComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>126</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Frame</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QCheckBox" name="cb_TraceSimConnectCalls">
|
||||||
|
<property name="text">
|
||||||
|
<string>Trace simConnect calls</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -213,13 +213,13 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
if (CBuildConfig::isCompiledWithP3DSupport() && CBuildConfig::buildWordSize() == 64)
|
if (CBuildConfig::isCompiledWithP3DSupport() && CBuildConfig::buildWordSize() == 64)
|
||||||
{
|
{
|
||||||
ui->lbl_SimConnectInfo->setText("Static linking P3Dv4 x64");
|
ui->pte_SimConnectInfo->setPlainText("Static linking P3Dv4 x64");
|
||||||
m_simulator = CSimulatorInfo(CSimulatorInfo::P3D);
|
m_simulator = CSimulatorInfo(CSimulatorInfo::P3D);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const CWinDllUtils::DLLInfo SimConnectInfo = CSimConnectUtilities::simConnectDllInfo();
|
const CWinDllUtils::DLLInfo SimConnectInfo = CSimConnectUtilities::simConnectDllInfo();
|
||||||
ui->lbl_SimConnectInfo->setText(SimConnectInfo.summary());
|
ui->pte_SimConnectInfo->setPlainText(SimConnectInfo.summary());
|
||||||
m_simulator = CSimulatorInfo(CSimulatorInfo::FSX);
|
m_simulator = CSimulatorInfo(CSimulatorInfo::FSX);
|
||||||
}
|
}
|
||||||
ui->le_UserCfgFile->setText(CSimConnectUtilities::hasUserSimConnectCfgFile() ? CSimConnectUtilities::getUserSimConnectCfgFilename() : "");
|
ui->le_UserCfgFile->setText(CSimConnectUtilities::hasUserSimConnectCfgFile() ? CSimConnectUtilities::getUserSimConnectCfgFilename() : "");
|
||||||
|
|||||||
@@ -45,16 +45,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="lbl_SimConnectInfo">
|
|
||||||
<property name="text">
|
|
||||||
<string>info about version, ...</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lbl_SimConnectIniFiles">
|
<widget class="QLabel" name="lbl_SimConnectIniFiles">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -112,264 +102,6 @@ console=1
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
|
||||||
<widget class="QGroupBox" name="gb_SwiftSimConnectCfg">
|
|
||||||
<property name="title">
|
|
||||||
<string>swift SimConnect.cfg</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="fl_SwiftSimConnectCfg">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_Address">
|
|
||||||
<property name="text">
|
|
||||||
<string>Address</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="le_Address">
|
|
||||||
<property name="text">
|
|
||||||
<string>127.0.0.1</string>
|
|
||||||
</property>
|
|
||||||
<property name="maxLength">
|
|
||||||
<number>128</number>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>e.g. "127.0.0.1" or "192.128.3.1"</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_Port">
|
|
||||||
<property name="text">
|
|
||||||
<string>Port</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" name="le_Port">
|
|
||||||
<property name="text">
|
|
||||||
<string>500</string>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>normally "500"</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_ExistsSimConnectCfg">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>is 'SimConnect.cfg' available?</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>.cfg file</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QWidget" name="wi_ExistsSimConnectCfg" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="hl_SettingsFsxExistsSimConnectCfg">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="le_ExistsSimConnectCfg">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>local "SimConnect.cfg" file?</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_ExistsSimConnectCfg">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>check</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<layout class="QHBoxLayout" name="hl_SimConnectCfgButtons">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_OpenSwiftSimConnectCfg">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>open</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_DeleteSwiftSimConnectCfg">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>del.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_SaveSwiftSimConnectCfg">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>save</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_TestConnection">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>50</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Test connection</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string extracomment="Test connection">test</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_UserCfgFile">
|
|
||||||
<property name="text">
|
|
||||||
<string>User's .cfg file</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QWidget" name="wi_UserSimConnectCfg" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="hl_UserCfgFile">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="le_UserCfgFile">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>User's "SimConnect.cfg" file</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_OpenUserCfgFile">
|
|
||||||
<property name="text">
|
|
||||||
<string>open</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QWidget" name="wi_SimConnectIniSaveAs" native="true">
|
<widget class="QWidget" name="wi_SimConnectIniSaveAs" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
@@ -411,11 +143,301 @@ console=1
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPlainTextEdit" name="pte_SimConnectInfo">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="documentTitle">
|
||||||
|
<string>Version info</string>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_SwiftSimConnectCfg">
|
||||||
|
<property name="title">
|
||||||
|
<string>swift SimConnect.cfg</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="fl_SwiftSimConnectCfg">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_Address">
|
||||||
|
<property name="text">
|
||||||
|
<string>Address</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_Address">
|
||||||
|
<property name="text">
|
||||||
|
<string>127.0.0.1</string>
|
||||||
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>128</number>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>e.g. "127.0.0.1" or "192.128.3.1"</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_Port">
|
||||||
|
<property name="text">
|
||||||
|
<string>Port</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_Port">
|
||||||
|
<property name="text">
|
||||||
|
<string>500</string>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>normally "500"</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_ExistsSimConnectCfg">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>is 'SimConnect.cfg' available?</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>.cfg file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QWidget" name="wi_ExistsSimConnectCfg" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="hl_SettingsFsxExistsSimConnectCfg">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="le_ExistsSimConnectCfg">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>local "SimConnect.cfg" file?</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_ExistsSimConnectCfg">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>check</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="hl_SimConnectCfgButtons">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_OpenSwiftSimConnectCfg">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>open</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_DeleteSwiftSimConnectCfg">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>del.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_SaveSwiftSimConnectCfg">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>save</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_TestConnection">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Test connection</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string extracomment="Test connection">test</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_UserCfgFile">
|
||||||
|
<property name="text">
|
||||||
|
<string>User's .cfg file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QWidget" name="wi_UserSimConnectCfg" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="hl_UserCfgFile">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="le_UserCfgFile">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>User's "SimConnect.cfg" file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_OpenUserCfgFile">
|
||||||
|
<property name="text">
|
||||||
|
<string>open</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>pte_SimConnectInfo</tabstop>
|
||||||
|
<tabstop>pte_SimConnectIniFiles</tabstop>
|
||||||
|
<tabstop>pte_SimConnectIni</tabstop>
|
||||||
|
<tabstop>pb_SaveAsSimConnectIni</tabstop>
|
||||||
|
<tabstop>le_UserCfgFile</tabstop>
|
||||||
|
<tabstop>pb_OpenUserCfgFile</tabstop>
|
||||||
|
<tabstop>le_Address</tabstop>
|
||||||
|
<tabstop>le_Port</tabstop>
|
||||||
|
<tabstop>le_ExistsSimConnectCfg</tabstop>
|
||||||
|
<tabstop>pb_ExistsSimConnectCfg</tabstop>
|
||||||
|
<tabstop>pb_OpenSwiftSimConnectCfg</tabstop>
|
||||||
|
<tabstop>pb_DeleteSwiftSimConnectCfg</tabstop>
|
||||||
|
<tabstop>pb_SaveSwiftSimConnectCfg</tabstop>
|
||||||
|
<tabstop>pb_TestConnection</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -279,13 +279,13 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
if (m_simConnectProbes.isEmpty()) { return this->physicallyAddAITerrainProbe(pos); }
|
if (m_simConnectProbes.isEmpty()) { return this->physicallyAddAITerrainProbe(pos); }
|
||||||
if (m_simConnectProbes.countConfirmedAdded() < 1) { return false; } // pending probes
|
if (m_simConnectProbes.countConfirmedAdded() < 1) { return false; } // pending probes
|
||||||
CSimConnectObject simObj = m_simConnectProbes.values().front();
|
CSimConnectObject simObject = m_simConnectProbes.values().front();
|
||||||
|
|
||||||
SIMCONNECT_DATA_INITPOSITION position = this->coordinateToFsxPosition(pos);
|
SIMCONNECT_DATA_INITPOSITION position = this->coordinateToFsxPosition(pos);
|
||||||
const HRESULT hr = SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftSetPosition,
|
const HRESULT hr = SimConnect_SetDataOnSimObject(m_hSimConnect, CSimConnectDefinitions::DataRemoteAircraftSetPosition,
|
||||||
simObj.getObjectId(), 0, 0,
|
simObject.getObjectId(), 0, 0,
|
||||||
sizeof(SIMCONNECT_DATA_INITPOSITION), &position);
|
sizeof(SIMCONNECT_DATA_INITPOSITION), &position);
|
||||||
if (m_traceSendId) { this->traceSendId(simObj.getObjectId(), Q_FUNC_INFO); }
|
if (m_traceSendId) { this->traceSendId(simObject.getObjectId(), Q_FUNC_INFO); }
|
||||||
|
|
||||||
if (hr == S_OK)
|
if (hr == S_OK)
|
||||||
{
|
{
|
||||||
@@ -393,7 +393,12 @@ namespace BlackSimPlugin
|
|||||||
this->safeKillTimer();
|
this->safeKillTimer();
|
||||||
|
|
||||||
// if called from dispatch function, avoid that SimConnectProc disconnects itself while in SimConnectProc
|
// if called from dispatch function, avoid that SimConnectProc disconnects itself while in SimConnectProc
|
||||||
QTimer::singleShot(0, this, &CSimulatorFsxCommon::disconnectFrom);
|
QPointer<CSimulatorFsxCommon> myself(this);
|
||||||
|
QTimer::singleShot(0, this, [ = ]
|
||||||
|
{
|
||||||
|
if (myself.isNull()) { return; }
|
||||||
|
myself->disconnectFrom();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
SIMCONNECT_DATA_REQUEST_ID CSimulatorFsxCommon::obtainRequestIdForSimData()
|
SIMCONNECT_DATA_REQUEST_ID CSimulatorFsxCommon::obtainRequestIdForSimData()
|
||||||
@@ -884,7 +889,7 @@ namespace BlackSimPlugin
|
|||||||
}
|
}
|
||||||
else if (m_dispatchErrors > 5)
|
else if (m_dispatchErrors > 5)
|
||||||
{
|
{
|
||||||
// this normally happens during a FSX crash or shutdown
|
// this normally happens during a FSX crash or shutdown with simconnect
|
||||||
CLogMessage(this).error("%1: Multiple dispatch errors, disconnecting") << this->getSimulatorPluginInfo().getIdentifier();
|
CLogMessage(this).error("%1: Multiple dispatch errors, disconnecting") << this->getSimulatorPluginInfo().getIdentifier();
|
||||||
this->disconnectFrom();
|
this->disconnectFrom();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ namespace BlackSimPlugin
|
|||||||
class CSimulatorFsxCommon : public BlackSimPlugin::FsCommon::CSimulatorFsCommon
|
class CSimulatorFsxCommon : public BlackSimPlugin::FsCommon::CSimulatorFsCommon
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(BlackCore::ISimulator)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Constructor, parameters as in \sa BlackCore::ISimulatorFactory::create
|
//! Constructor, parameters as in \sa BlackCore::ISimulatorFactory::create
|
||||||
@@ -134,6 +135,12 @@ namespace BlackSimPlugin
|
|||||||
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
|
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
|
||||||
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference, const BlackMisc::Aviation::CCallsign &callsign) override;
|
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference, const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||||
|
|
||||||
|
//! Tracing?
|
||||||
|
bool isTracingSendId() const { return m_traceSendId; }
|
||||||
|
|
||||||
|
//! Set tracing on/off
|
||||||
|
void setTractingSendId(bool trace) { m_traceSendId = trace; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! SimConnect Callback
|
//! SimConnect Callback
|
||||||
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
static void CALLBACK SimConnectProc(SIMCONNECT_RECV *pData, DWORD cbData, void *pContext);
|
||||||
|
|||||||
@@ -22,13 +22,15 @@ namespace BlackSimPlugin
|
|||||||
ui(new Ui::CSimulatorFsxConfigWindow)
|
ui(new Ui::CSimulatorFsxConfigWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->tw_Settings->setCurrentIndex(0);
|
||||||
|
ui->comp_Settings->setSimulator(m_simulator);
|
||||||
connect(ui->bb_OkCancel, &QDialogButtonBox::rejected, this, &QWidget::close);
|
connect(ui->bb_OkCancel, &QDialogButtonBox::rejected, this, &QWidget::close);
|
||||||
this->setWindowTitle(m_simulator + " plugin configuration");
|
this->setWindowTitle(m_simulator.toQString(true) + " plugin configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimulatorFsxConfigWindow::~CSimulatorFsxConfigWindow()
|
CSimulatorFsxConfigWindow::~CSimulatorFsxConfigWindow()
|
||||||
{
|
{
|
||||||
// void
|
// void
|
||||||
}
|
}
|
||||||
}
|
} // ns
|
||||||
}
|
} // ns
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define BLACKSIMPLUGIN_FSXCOMMON_SIMULATORFSXCONFIGWINDOW_H
|
#define BLACKSIMPLUGIN_FSXCOMMON_SIMULATORFSXCONFIGWINDOW_H
|
||||||
|
|
||||||
#include "blackgui/pluginconfigwindow.h"
|
#include "blackgui/pluginconfigwindow.h"
|
||||||
|
#include "blackmisc/simulation/simulatorinfo.h"
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
namespace Ui { class CSimulatorFsxConfigWindow; }
|
namespace Ui { class CSimulatorFsxConfigWindow; }
|
||||||
@@ -34,11 +35,14 @@ namespace BlackSimPlugin
|
|||||||
//! Dtor.
|
//! Dtor.
|
||||||
virtual ~CSimulatorFsxConfigWindow();
|
virtual ~CSimulatorFsxConfigWindow();
|
||||||
|
|
||||||
|
//! Related simulator, i.e. "P3D" or "FSX"
|
||||||
|
const BlackMisc::Simulation::CSimulatorInfo &getSimulator() const { return m_simulator; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_simulator { "FSX" };
|
const BlackMisc::Simulation::CSimulatorInfo m_simulator { "FSX" };
|
||||||
QScopedPointer<Ui::CSimulatorFsxConfigWindow> ui;
|
QScopedPointer<Ui::CSimulatorFsxConfigWindow> ui;
|
||||||
};
|
};
|
||||||
}
|
} // ns
|
||||||
}
|
} // ns
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -14,14 +14,67 @@
|
|||||||
<string>FSX/P3D plugin settings</string>
|
<string>FSX/P3D plugin settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vl_FsxConfigWindow">
|
<layout class="QVBoxLayout" name="vl_FsxConfigWindow">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackSimPlugin::FsxCommon::CSimConnectSettingsComponent" name="fr_simConnectSettings">
|
<widget class="QTabWidget" name="tw_Settings">
|
||||||
<property name="frameShape">
|
<property name="currentIndex">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<number>0</number>
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QWidget" name="tb_SimConnectConfig">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>SimConnect config</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="vl_SimConnectSettings">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackSimPlugin::FsxCommon::CSimConnectSettingsComponent" name="comp_SimConnectSettings"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tb_Settings">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Settings</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="vl_Settings">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackSimPlugin::FsxCommon::CFsxSettingsComponent" name="comp_Settings"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -40,6 +93,12 @@
|
|||||||
<header>simconnectsettingscomponent.h</header>
|
<header>simconnectsettingscomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackSimPlugin::FsxCommon::CFsxSettingsComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>fsxsettingscomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
Reference in New Issue
Block a user