mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
refactor: Clean up simconnect settings
This commit is contained in:
@@ -23,83 +23,6 @@ namespace swift::misc::simulation::fsx
|
||||
{
|
||||
CSimConnectUtilities::CSimConnectUtilities() {}
|
||||
|
||||
const QString &CSimConnectUtilities::simConnectFilename()
|
||||
{
|
||||
static const QString fn("SimConnect.cfg");
|
||||
return fn;
|
||||
}
|
||||
|
||||
const QString &CSimConnectUtilities::getSwiftLocalSimConnectCfgFilename()
|
||||
{
|
||||
static const QString n =
|
||||
CFileUtils::appendFilePaths(QCoreApplication::applicationDirPath(), simConnectFilename());
|
||||
return n;
|
||||
}
|
||||
|
||||
const QString &CSimConnectUtilities::getUserSimConnectCfgFilename()
|
||||
{
|
||||
static const QString n = CFileUtils::appendFilePaths(
|
||||
QStandardPaths::locate(QStandardPaths::DocumentsLocation, "", QStandardPaths::LocateDirectory),
|
||||
simConnectFilename());
|
||||
return n;
|
||||
}
|
||||
|
||||
bool CSimConnectUtilities::hasSwiftLocalSimConnectCfgFile()
|
||||
{
|
||||
const QFile f(getSwiftLocalSimConnectCfgFilename());
|
||||
return f.exists();
|
||||
}
|
||||
|
||||
bool CSimConnectUtilities::hasUserSimConnectCfgFile()
|
||||
{
|
||||
const QFile f(getUserSimConnectCfgFilename());
|
||||
return f.exists();
|
||||
}
|
||||
|
||||
QSharedPointer<QSettings> CSimConnectUtilities::simConnectFileAsSettings(const QString &fileName)
|
||||
{
|
||||
QSharedPointer<QSettings> sp;
|
||||
const QFile file(fileName);
|
||||
if (!file.exists()) { return sp; }
|
||||
sp.reset(new QSettings(fileName, QSettings::IniFormat));
|
||||
return sp;
|
||||
}
|
||||
|
||||
QString CSimConnectUtilities::ipAddress(const QSettings *simConnectSettings)
|
||||
{
|
||||
if (!simConnectSettings) { return {}; }
|
||||
return simConnectSettings->value("SimConnect/Address").toString();
|
||||
}
|
||||
|
||||
int CSimConnectUtilities::ipPort(const QSettings *simConnectSettings)
|
||||
{
|
||||
if (!simConnectSettings) { return -1; }
|
||||
return simConnectSettings->value("SimConnect/Port", QVariant::fromValue(-1)).toInt();
|
||||
}
|
||||
|
||||
bool CSimConnectUtilities::writeSimConnectCfg(const QString &fileName, const QString &ip, int port)
|
||||
{
|
||||
const QString sc = CSimConnectUtilities::simConnectCfg(ip, port);
|
||||
QFile file(fileName);
|
||||
bool success = false;
|
||||
if ((success = file.open(QIODevice::WriteOnly | QIODevice::Text)))
|
||||
{
|
||||
QTextStream out(&file);
|
||||
out << sc;
|
||||
file.close();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
QString CSimConnectUtilities::simConnectCfg(const QString &ip, int port)
|
||||
{
|
||||
const QString sc = QStringLiteral("[SimConnect]\nProtocol=Ipv4\nAddress=%1\nPort=%2\n"
|
||||
"MaxReceiveSize=4096\nDisableNagle=0")
|
||||
.arg(ip)
|
||||
.arg(port);
|
||||
return sc;
|
||||
}
|
||||
|
||||
QString CSimConnectUtilities::resolveEnumToString(const DWORD id, const char *enumName)
|
||||
{
|
||||
const int i = CSimConnectUtilities::staticMetaObject.indexOfEnumerator(enumName);
|
||||
@@ -109,12 +32,6 @@ namespace swift::misc::simulation::fsx
|
||||
return (k) ? QLatin1String(k) : QStringLiteral("Id '%1' not found for %2").arg(id).arg(enumName);
|
||||
}
|
||||
|
||||
const QString &CSimConnectUtilities::simConnectIniFilename()
|
||||
{
|
||||
static const QString n("SimConnect.ini");
|
||||
return n;
|
||||
}
|
||||
|
||||
QString CSimConnectUtilities::simConnectExceptionToString(const DWORD id)
|
||||
{
|
||||
return CSimConnectUtilities::resolveEnumToString(id, "SIMCONNECT_EXCEPTION");
|
||||
@@ -126,67 +43,6 @@ namespace swift::misc::simulation::fsx
|
||||
return beautify ? sf.replace('_', ' ') : sf;
|
||||
}
|
||||
|
||||
QStringList CSimConnectUtilities::getSimConnectIniFileDirectories()
|
||||
{
|
||||
const QString docDir =
|
||||
QStandardPaths::locate(QStandardPaths::DocumentsLocation, "", QStandardPaths::LocateDirectory);
|
||||
if (docDir.isEmpty()) return QStringList();
|
||||
|
||||
QDir directory(docDir);
|
||||
directory.setFilter(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
||||
const QStringList dirList = directory.entryList();
|
||||
QStringList simDirs;
|
||||
for (const QString &dir : dirList)
|
||||
{
|
||||
if (dir.contains("Flight Simulator", Qt::CaseInsensitive) || dir.contains("Prepar3D", Qt::CaseInsensitive))
|
||||
{
|
||||
simDirs.push_back(CFileUtils::appendFilePaths(docDir, dir));
|
||||
}
|
||||
}
|
||||
|
||||
// gets the latest P3D as first
|
||||
simDirs.sort();
|
||||
std::reverse(std::begin(simDirs), std::end(simDirs));
|
||||
return simDirs;
|
||||
}
|
||||
|
||||
QStringList CSimConnectUtilities::getSimConnectIniFiles()
|
||||
{
|
||||
QStringList files;
|
||||
for (const QString &dir : getSimConnectIniFileDirectories())
|
||||
{
|
||||
const QFileInfo f(CFileUtils::appendFilePaths(dir, simConnectIniFilename()));
|
||||
if (f.exists()) { files.push_back(f.absoluteFilePath()); }
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
QString CSimConnectUtilities::getSimConnectIniFileDirectory(CSimulatorInfo &simulator)
|
||||
{
|
||||
static const QString docDir =
|
||||
QStandardPaths::locate(QStandardPaths::DocumentsLocation, "", QStandardPaths::LocateDirectory);
|
||||
if (docDir.isEmpty()) { return {}; }
|
||||
if (!simulator.isSingleSimulator() || !simulator.isFsxP3DFamily()) return {};
|
||||
|
||||
const QString iniDir =
|
||||
CFileUtils::appendFilePaths(docDir, simulator.isP3D() ? "Prepar3D v4 Files" : "Flight Simulator X Files");
|
||||
if (getSimConnectIniFileDirectories().isEmpty()) { return iniDir; }
|
||||
|
||||
for (const QString &dir : getSimConnectIniFileDirectories())
|
||||
{
|
||||
if (simulator.isP3D())
|
||||
{
|
||||
if (dir.contains("Prepar3D", Qt::CaseInsensitive)) { return dir; }
|
||||
}
|
||||
else if (simulator.isFSX())
|
||||
{
|
||||
if (dir.contains("Flight Simulator", Qt::CaseInsensitive)) { return dir; }
|
||||
}
|
||||
}
|
||||
|
||||
return iniDir;
|
||||
}
|
||||
|
||||
QString CSimConnectUtilities::simConnectReceiveIdToString(DWORD type)
|
||||
{
|
||||
const QString ri = CSimConnectUtilities::resolveEnumToString(type, "SIMCONNECT_RECV_ID");
|
||||
|
||||
@@ -38,44 +38,6 @@ namespace swift::misc::simulation::fsx
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Filename of the file
|
||||
static const QString &simConnectFilename();
|
||||
|
||||
//! Path to swift local config file (generated by us, in swift dir)
|
||||
static const QString &getSwiftLocalSimConnectCfgFilename();
|
||||
|
||||
//! Path to user's config file
|
||||
static const QString &getUserSimConnectCfgFilename();
|
||||
|
||||
//! Has a swift local config file
|
||||
static bool hasSwiftLocalSimConnectCfgFile();
|
||||
|
||||
//! Has a user config file
|
||||
static bool hasUserSimConnectCfgFile();
|
||||
|
||||
//! The simconnect.cfg as settings (or nullptr settings if no such file)
|
||||
static QSharedPointer<QSettings>
|
||||
simConnectFileAsSettings(const QString &fileName = getSwiftLocalSimConnectCfgFilename());
|
||||
|
||||
//! IP address from settings (of simconnect.cfg), "" if not available
|
||||
static QString ipAddress(const QSettings *simConnectSettings);
|
||||
|
||||
//! IP port from settings (of simconnect.cfg), -1 if not available
|
||||
static int ipPort(const QSettings *simConnectSettings);
|
||||
|
||||
//! Content for FSX simconnect.cfg file
|
||||
//! \param ip IP address of FSX
|
||||
//! \param port Port of FSX (e.g. 500)
|
||||
//! \return content for simconnect.cfg
|
||||
static QString simConnectCfg(const QString &ip, int port = 500);
|
||||
|
||||
//! Create a FSX simconnect.cfg file
|
||||
//! \param fileName and path
|
||||
//! \param ip IP address of FSX
|
||||
//! \param port Port of FSX (e.g. 500)
|
||||
//! \return success
|
||||
static bool writeSimConnectCfg(const QString &fileName, const QString &ip, int port = 500);
|
||||
|
||||
//! Resolve SimConnect exception (based on Qt metadata).
|
||||
//! \param id enum element
|
||||
//! \return enum element's name
|
||||
@@ -86,16 +48,6 @@ namespace swift::misc::simulation::fsx
|
||||
//! \param beautify remove "_"
|
||||
static QString simConnectSurfaceTypeToString(const DWORD type, bool beautify = true);
|
||||
|
||||
//! For all P3D and FSX simulators
|
||||
//! \remark reevaluating directories every time
|
||||
static QStringList getSimConnectIniFileDirectories();
|
||||
|
||||
//! For all P3D and FSX simulators
|
||||
static QStringList getSimConnectIniFiles();
|
||||
|
||||
//! Directory where SimConnect.ini is located
|
||||
static QString getSimConnectIniFileDirectory(simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! SimConnect surfaces.
|
||||
//! \sa http://msdn.microsoft.com/en-us/library/cc526981.aspx#AircraftFlightInstrumentationData
|
||||
enum SIMCONNECT_SURFACE
|
||||
@@ -230,9 +182,6 @@ namespace swift::misc::simulation::fsx
|
||||
//! Get info about SimConnect DLL
|
||||
static swift::misc::CWinDllUtils::DLLInfo simConnectDllInfo();
|
||||
|
||||
//! SimConnect.ini file name
|
||||
static const QString &simConnectIniFilename();
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
|
||||
|
||||
@@ -34,20 +34,6 @@ namespace swift::simplugin::fsxcommon
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->pb_OpenSwiftSimConnectCfg, &QPushButton::clicked, this,
|
||||
&CSimConnectSettingsComponent::openSwiftSimConnectCfgFile);
|
||||
connect(ui->pb_DeleteSwiftSimConnectCfg, &QPushButton::clicked, this,
|
||||
&CSimConnectSettingsComponent::deleteSwiftSimConnectCfgFile);
|
||||
connect(ui->pb_ExistsSimConnectCfg, &QPushButton::clicked, this,
|
||||
&CSimConnectSettingsComponent::checkSwiftSimConnectCfgFile);
|
||||
connect(ui->pb_SaveSwiftSimConnectCfg, &QPushButton::clicked, this,
|
||||
&CSimConnectSettingsComponent::saveSimConnectCfgFile);
|
||||
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)
|
||||
@@ -62,161 +48,6 @@ namespace swift::simplugin::fsxcommon
|
||||
// void
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::openSwiftSimConnectCfgFile()
|
||||
{
|
||||
if (!CSimConnectUtilities::hasSwiftLocalSimConnectCfgFile()) { return; }
|
||||
const QFileInfo info(CSimConnectUtilities::getSwiftLocalSimConnectCfgFilename());
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(info.absoluteFilePath()));
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::openUserSimConnectCfgFile()
|
||||
{
|
||||
if (!CSimConnectUtilities::hasUserSimConnectCfgFile()) { return; }
|
||||
const QFileInfo info(CSimConnectUtilities::getUserSimConnectCfgFilename());
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(info.absoluteFilePath()));
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::deleteSwiftSimConnectCfgFile()
|
||||
{
|
||||
const QString fileName = CSimConnectUtilities::getSwiftLocalSimConnectCfgFilename();
|
||||
QFile file(fileName);
|
||||
const bool result = file.exists() && file.remove();
|
||||
if (result)
|
||||
{
|
||||
QMessageBox::information(qApp->activeWindow(), tr("File deleted"),
|
||||
tr("File %1 deleted successfully.").arg(fileName));
|
||||
}
|
||||
this->checkSwiftSimConnectCfgFile();
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::checkSwiftSimConnectCfgFile()
|
||||
{
|
||||
// this works for local files only
|
||||
const QString fileName = CSimConnectUtilities::getSwiftLocalSimConnectCfgFilename();
|
||||
const QFile file(fileName);
|
||||
ui->le_ExistsSimConnectCfg->setText(file.exists() ? fileName : "no file");
|
||||
|
||||
// only works for local file (which the SimConnect file normally is)
|
||||
if (!CSimConnectUtilities::hasSwiftLocalSimConnectCfgFile()) { return; }
|
||||
const QSharedPointer<QSettings> settings = CSimConnectUtilities::simConnectFileAsSettings();
|
||||
if (!settings) { return; }
|
||||
const QString address = CSimConnectUtilities::ipAddress(settings.data());
|
||||
const int port = CSimConnectUtilities::ipPort(settings.data());
|
||||
if (!address.isEmpty()) { ui->le_Address->setText(address); }
|
||||
if (port > 0) { ui->le_Port->setText(QString::number(port)); }
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::testSwiftSimConnectConnection()
|
||||
{
|
||||
const QString address = ui->le_Address->text().trimmed();
|
||||
const QString port = ui->le_Port->text().trimmed();
|
||||
|
||||
if (address.isEmpty() || port.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Connection invalid"),
|
||||
tr("Address and/or port not specified!"));
|
||||
return;
|
||||
}
|
||||
if (!CNetworkUtils::isValidIPv4Address(address))
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Connection invalid"), tr("Wrong IPv4 address!"));
|
||||
return;
|
||||
}
|
||||
if (!CNetworkUtils::isValidPort(port))
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Connection invalid"), tr("Invalid port!"));
|
||||
return;
|
||||
}
|
||||
const int p = port.toInt();
|
||||
QString msg;
|
||||
if (!CNetworkUtils::canConnect(address, p, msg))
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Connection invalid"), msg);
|
||||
return;
|
||||
}
|
||||
|
||||
QMessageBox::information(qApp->activeWindow(), tr("Connection successful"),
|
||||
tr("Connected to '%1:%2'.").arg(address, port));
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::saveSimConnectCfgFile()
|
||||
{
|
||||
const QString address = ui->le_Address->text().trimmed();
|
||||
const QString port = ui->le_Port->text().trimmed();
|
||||
|
||||
if (address.isEmpty() || port.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Connection invalid"),
|
||||
tr("Address and/or port not specified!"));
|
||||
return;
|
||||
}
|
||||
if (!CNetworkUtils::isValidIPv4Address(address))
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Connection invalid"), tr("Wrong IPv4 address!"));
|
||||
return;
|
||||
}
|
||||
if (!CNetworkUtils::isValidPort(port))
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Connection invalid"), tr("Invalid port!"));
|
||||
return;
|
||||
}
|
||||
|
||||
const int p = port.toInt();
|
||||
QString fileName;
|
||||
|
||||
if (sGui->getIContextSimulator())
|
||||
{
|
||||
const swift::misc::simulation::CSimulatorInternals internals(
|
||||
sGui->getIContextSimulator()->getSimulatorInternals());
|
||||
fileName = internals.getStringValue("fsx/SimConnectCfgFilename");
|
||||
}
|
||||
|
||||
if (fileName.isEmpty()) { fileName = CSimConnectUtilities::getSwiftLocalSimConnectCfgFilename(); }
|
||||
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Failed writing SimConnect.cfg"),
|
||||
tr("No file name specified!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (CFileUtils::writeStringToFile(CSimConnectUtilities::simConnectCfg(address, p), fileName))
|
||||
{
|
||||
QMessageBox::information(qApp->activeWindow(), tr("File saved"), tr("File '%1' saved.").arg(fileName));
|
||||
this->checkSwiftSimConnectCfgFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(qApp->activeWindow(), tr("Failed writing SimConnect.cfg"),
|
||||
tr("Failed writing '%1'!").arg(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::saveSimConnectIniFileDialog()
|
||||
{
|
||||
const QString iniFile = ui->pte_SimConnectIni->toPlainText();
|
||||
const QString dir = CSimConnectUtilities::getSimConnectIniFileDirectory(m_simulator);
|
||||
bool madeDir = false;
|
||||
QDir d(dir);
|
||||
if (!d.exists())
|
||||
{
|
||||
d.mkdir(dir);
|
||||
madeDir = true;
|
||||
}
|
||||
|
||||
const QString defaultFileName = CFileUtils::appendFilePaths(dir, CSimConnectUtilities::simConnectIniFilename());
|
||||
const QString fileName = QFileDialog::getSaveFileName(this, tr("Save SimConnect.ini"), defaultFileName,
|
||||
tr("FSX/P3D ini files (*.ini)"));
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
const bool written = CFileUtils::writeStringToFile(iniFile, fileName);
|
||||
if (!written && madeDir) { d.removeRecursively(); } // clean up own created dir
|
||||
if (written) { CLogMessage(this).info(u"Written '%1'") << fileName; }
|
||||
}
|
||||
// always refresh info, as the dialog can also be used to delete the file
|
||||
this->setSimConnectInfo();
|
||||
}
|
||||
|
||||
void CSimConnectSettingsComponent::setSimConnectInfo()
|
||||
{
|
||||
if (CBuildConfig::isCompiledWithP3DSupport() && CBuildConfig::buildWordSize() == 64)
|
||||
@@ -238,13 +69,6 @@ namespace swift::simplugin::fsxcommon
|
||||
|
||||
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)
|
||||
|
||||
@@ -35,27 +35,6 @@ namespace swift::simplugin::fsxcommon
|
||||
virtual ~CSimConnectSettingsComponent();
|
||||
|
||||
private:
|
||||
//! Open simConnect.cfg using default application
|
||||
void openSwiftSimConnectCfgFile();
|
||||
|
||||
//! Open simConnect.cfg using default application
|
||||
void openUserSimConnectCfgFile();
|
||||
|
||||
//! Delete simConnect.cfg file
|
||||
void deleteSwiftSimConnectCfgFile();
|
||||
|
||||
//! Check whether the simConnect.cfg file exists
|
||||
void checkSwiftSimConnectCfgFile();
|
||||
|
||||
//! Test the SimConnect connectivity
|
||||
void testSwiftSimConnectConnection();
|
||||
|
||||
//! Save a SimConnect.cfg file for FSX/P3D
|
||||
void saveSimConnectCfgFile();
|
||||
|
||||
//! Save dialog for a SimConnect.ini file
|
||||
void saveSimConnectIniFileDialog();
|
||||
|
||||
//! Set the simconnect info
|
||||
void setSimConnectInfo();
|
||||
|
||||
|
||||
@@ -31,104 +31,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPlainTextEdit" name="pte_SimConnectIniFiles">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPlainTextEdit" name="pte_SimConnectIni">
|
||||
<property name="plainText">
|
||||
<string>[SimConnect]
|
||||
level=verbose
|
||||
console=1
|
||||
;RedirectStdOutToConsole=1
|
||||
;OutputDebugString=1
|
||||
;file=c:\simconnect%03u.log
|
||||
;file_next_index=0
|
||||
;file_max_index=9
|
||||
</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>all SimConnect.ini files found</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QWidget" name="wi_SimConnectIniSaveAs" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QLabel" name="lbl_SimConnectIniSaveHint">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Hint: <span style=" font-style:italic;">SimConnect.ini</span> must be saved on FSX/P3D machine</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pb_SaveAsSimConnectIni">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>save as</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPlainTextEdit" name="pte_SimConnectInfo">
|
||||
<property name="maximumSize">
|
||||
@@ -210,295 +112,11 @@ console=1
|
||||
</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="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="hs_SimConnectCfgButtons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>cb_P3DVersion</tabstop>
|
||||
<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/>
|
||||
<connections/>
|
||||
|
||||
@@ -2704,8 +2704,6 @@ namespace swift::simplugin::fsxcommon
|
||||
void CSimulatorFsxCommon::initSimulatorInternals()
|
||||
{
|
||||
CSimulatorFsCommon::initSimulatorInternals();
|
||||
m_simulatorInternals.setValue("fsx/simConnectCfgFilename",
|
||||
CSimConnectUtilities::getSwiftLocalSimConnectCfgFilename());
|
||||
m_simulatorInternals.setValue("fsx/simConnectVersion", m_simConnectVersion);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user