mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
Added FG in config component, follow up of T430
This commit is contained in:
committed by
Mat Sutcliffe
parent
a5835f963c
commit
4925bb46bd
@@ -7,9 +7,10 @@
|
||||
*/
|
||||
|
||||
#include "configsimulatorcomponent.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
#include "ui_configsimulatorcomponent.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -64,21 +65,40 @@ namespace BlackGui
|
||||
const bool fsx = (sims.isFSX() || !CFsCommonUtil::fsxDir().isEmpty()) && CBuildConfig::isCompiledWithFsxSupport();
|
||||
const bool fs9 = (sims.isFS9() || !CFsCommonUtil::fs9Dir().isEmpty()) && CBuildConfig::isCompiledWithFs9Support();
|
||||
const bool xp = sims.isXPlane() && CBuildConfig::isCompiledWithXPlaneSupport();
|
||||
const bool fg = sims.isFG() && CBuildConfig::isCompiledWithFGSupport();
|
||||
|
||||
ui->cb_P3D->setChecked(p3d);
|
||||
ui->cb_FSX->setChecked(fsx);
|
||||
ui->cb_FS9->setChecked(fs9);
|
||||
ui->cb_XP->setChecked(xp);
|
||||
ui->cb_FG->setChecked(fg);
|
||||
|
||||
ui->cb_P3D->setEnabled(CBuildConfig::isCompiledWithP3DSupport());
|
||||
ui->cb_FSX->setEnabled(CBuildConfig::isCompiledWithFsxSupport());
|
||||
ui->cb_FS9->setEnabled(CBuildConfig::isCompiledWithFs9Support());
|
||||
ui->cb_XP->setEnabled(CBuildConfig::isCompiledWithXPlaneSupport());
|
||||
ui->cb_FG->setEnabled(CBuildConfig::isCompiledWithFGSupport());
|
||||
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_P3D, !CBuildConfig::isCompiledWithP3DSupport());
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_FSX, !CBuildConfig::isCompiledWithFsxSupport());
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_FS9, !CBuildConfig::isCompiledWithFs9Support());
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_XP, !CBuildConfig::isCompiledWithXPlaneSupport());
|
||||
CGuiUtility::checkBoxReadOnly(ui->cb_FG, !CBuildConfig::isCompiledWithFGSupport());
|
||||
|
||||
/** does NOT work
|
||||
const qreal fadeOut = 0.25;
|
||||
ui->lbl_P3D->setWindowOpacity(CBuildConfig::isCompiledWithP3DSupport() ? 1.0 : fadeOut);
|
||||
ui->lbl_FSX->setWindowOpacity(CBuildConfig::isCompiledWithFsxSupport() ? 1.0 : fadeOut);
|
||||
ui->lbl_FS9->setWindowOpacity(CBuildConfig::isCompiledWithFs9Support() ? 1.0 : fadeOut);
|
||||
ui->lbl_XP->setWindowOpacity(CBuildConfig::isCompiledWithXPlaneSupport() ? 1.0 : fadeOut);
|
||||
ui->lbl_FG->setWindowOpacity(CBuildConfig::isCompiledWithFGSupport() ? 1.0 : fadeOut);
|
||||
**/
|
||||
|
||||
if (p3d) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::P3D)); }
|
||||
else if (fsx) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::FSX)); }
|
||||
else if (fs9) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::FS9)); }
|
||||
else if (xp) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::XPLANE)); }
|
||||
else if (fg) { ui->comp_SettingsSimulator->setSimulator(CSimulatorInfo(CSimulatorInfo::FG)); }
|
||||
}
|
||||
|
||||
QStringList CConfigSimulatorComponent::selectedSimsToPluginIds()
|
||||
@@ -90,6 +110,7 @@ namespace BlackGui
|
||||
if (ui->cb_FSX->isChecked()) { ids << CSimulatorPluginInfo::fsxPluginIdentifier(); }
|
||||
if (ui->cb_P3D->isChecked()) { ids << CSimulatorPluginInfo::p3dPluginIdentifier(); }
|
||||
if (ui->cb_XP->isChecked()) { ids << CSimulatorPluginInfo::xplanePluginIdentifier(); }
|
||||
if (ui->cb_FG->isChecked()) { ids << CSimulatorPluginInfo::fgPluginIdentifier(); }
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
@@ -44,13 +44,10 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="0" column="1" alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="lbl_FSX">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: "lightgrey"</string>
|
||||
</property>
|
||||
<item row="1" column="3" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_XP">
|
||||
<property name="text">
|
||||
<string><img width="100" src=":/simulators/icons/simulators/FSX.png"/></string>
|
||||
<string>XPlane (32,64-bit)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -64,6 +61,43 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_P3D">
|
||||
<property name="text">
|
||||
<string>P3D (64-bit)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_FSX">
|
||||
<property name="text">
|
||||
<string>FSX (32-bit)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="lbl_FSX">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: "lightgrey"</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><img width="100" src=":/simulators/icons/simulators/FSX.png"/></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_FS9">
|
||||
<property name="text">
|
||||
<string>FS9 (32-bit)</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="lbl_XP">
|
||||
<property name="styleSheet">
|
||||
@@ -74,40 +108,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_FSX">
|
||||
<property name="text">
|
||||
<string>FSX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_XP">
|
||||
<property name="text">
|
||||
<string>XPlane</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_FS9">
|
||||
<property name="text">
|
||||
<string>FS9</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_P3D">
|
||||
<property name="text">
|
||||
<string>P3D</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_P3D">
|
||||
<property name="styleSheet">
|
||||
@@ -118,6 +118,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4" alignment="Qt::AlignHCenter">
|
||||
<widget class="QLabel" name="lbl_FG">
|
||||
<property name="text">
|
||||
<string><img width="50" src=":/simulators/icons/simulators/FG.png"/></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="cb_FG">
|
||||
<property name="text">
|
||||
<string>FlightGear (64-bit)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -185,6 +199,13 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cb_P3D</tabstop>
|
||||
<tabstop>cb_FSX</tabstop>
|
||||
<tabstop>cb_FS9</tabstop>
|
||||
<tabstop>cb_XP</tabstop>
|
||||
<tabstop>cb_FG</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -142,6 +142,15 @@ namespace BlackGui
|
||||
s.setModelExcludeDirectories(relativeDirs);
|
||||
const CStatusMessage m = m_settings.setAndSaveSettings(s, simulator);
|
||||
if (!m.isEmpty()) { CLogMessage::preformatted(m); }
|
||||
if (m.isSuccess())
|
||||
{
|
||||
this->showOverlayHTMLMessage("Saved settings", 5000);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->showOverlayMessage(m);
|
||||
}
|
||||
|
||||
m_unsavedChanges = m_unsavedChanges && !m.isSuccess(); // reset if success, but only if there were changes
|
||||
|
||||
// display as saved
|
||||
|
||||
@@ -491,16 +491,17 @@ namespace BlackMisc
|
||||
return dir.exists();
|
||||
}
|
||||
const QString machine(CFileUtils::windowsUncMachine(path));
|
||||
if (!CFileUtils::canPingUncMachine(machine)) { return false; }
|
||||
if (!CFileUtils::canPingUncMachine(machine)) { return false; } // avoid long "hanging" if machine is switched off
|
||||
|
||||
const QDir dir(path);
|
||||
return dir.exists();
|
||||
const bool e = dir.exists();
|
||||
return e;
|
||||
}
|
||||
|
||||
bool CDirectoryUtils::isDirExisting(const QDir &dir)
|
||||
{
|
||||
if (!CFileUtils::isWindowsUncPath(dir.absolutePath())) { return dir.exists(); }
|
||||
return CDirectoryUtils::isDirExisting(dir.absolutePath());
|
||||
return CDirectoryUtils::isDirExisting(dir.absolutePath()); // check for UNC
|
||||
}
|
||||
|
||||
bool CDirectoryUtils::isSameExistingDirectory(const QString &dir1, const QString &dir2)
|
||||
|
||||
Reference in New Issue
Block a user