mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
refs #236, default FSX path by registry
Includes a setter for index map
This commit is contained in:
@@ -43,6 +43,7 @@ namespace BlackMisc
|
|||||||
//! Add a value
|
//! Add a value
|
||||||
void addValue(int index, const QVariant &value);
|
void addValue(int index, const QVariant &value);
|
||||||
|
|
||||||
|
|
||||||
//! Add a value as non QVariant
|
//! Add a value as non QVariant
|
||||||
template<class T> void addValue(int index, const T &value) { this->m_values.insert(index, QVariant::fromValue(value)); }
|
template<class T> void addValue(int index, const T &value) { this->m_values.insert(index, QVariant::fromValue(value)); }
|
||||||
|
|
||||||
@@ -52,6 +53,9 @@ namespace BlackMisc
|
|||||||
//! Value
|
//! Value
|
||||||
QVariant value(int index) const { return this->m_values.value(index); }
|
QVariant value(int index) const { return this->m_values.value(index); }
|
||||||
|
|
||||||
|
//! Set value
|
||||||
|
void value(int index, const QVariant &value) { this->m_values.value(index, value); }
|
||||||
|
|
||||||
//! Indexes
|
//! Indexes
|
||||||
QList<int> indexes() const { return this->m_values.keys(); }
|
QList<int> indexes() const { return this->m_values.keys(); }
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
#include "fsxsimulatorsetup.h"
|
#include "fsxsimulatorsetup.h"
|
||||||
|
|
||||||
|
#include "../../blackmisc/project.h"
|
||||||
#include "../fsx/simconnectutilities.h"
|
#include "../fsx/simconnectutilities.h"
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
|
|
||||||
namespace BlackSim
|
namespace BlackSim
|
||||||
{
|
{
|
||||||
@@ -9,6 +14,20 @@ namespace BlackSim
|
|||||||
{
|
{
|
||||||
CSimulatorSetup::init();
|
CSimulatorSetup::init();
|
||||||
this->m_setup.addValue(SetupSimConnectCfgFile, CSimConnectUtilities::getLocalSimConnectCfgFilename());
|
this->m_setup.addValue(SetupSimConnectCfgFile, CSimConnectUtilities::getLocalSimConnectCfgFilename());
|
||||||
|
|
||||||
|
if (CProject::isCompiledWithFsxSupport())
|
||||||
|
{
|
||||||
|
// set FSX path
|
||||||
|
QSettings fsxRegistry("HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft Games\\Flight Simulator\\10.0", QSettings::NativeFormat);
|
||||||
|
QString fsxPath = fsxRegistry.value("AppPath").toString();
|
||||||
|
if (fsxPath.isEmpty())
|
||||||
|
{
|
||||||
|
// another trial
|
||||||
|
QSettings fsxRegistry("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft Games\\Flight Simulator\\10.0", QSettings::NativeFormat);
|
||||||
|
fsxPath = fsxRegistry.value("SetupPath").toString();
|
||||||
|
}
|
||||||
|
if (!fsxPath.isEmpty()) this->m_setup.value(CSimulatorSetup::SetupSimPath, QVariant(fsxPath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace BlackSim
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SetupSimConnectCfgFile = 1000
|
SetupSimConnectCfgFile = 1000, //!< location of simconnect.cfg file
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user