refs #236, default FSX path by registry

Includes a setter for index map
This commit is contained in:
Klaus Basan
2014-05-13 01:14:48 +02:00
parent 4d57a50fd2
commit a2bfe36f37
3 changed files with 24 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ namespace BlackMisc
//! Add a value
void addValue(int index, const QVariant &value);
//! Add a value as non QVariant
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
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
QList<int> indexes() const { return this->m_values.keys(); }

View File

@@ -1,5 +1,10 @@
#include "fsxsimulatorsetup.h"
#include "../../blackmisc/project.h"
#include "../fsx/simconnectutilities.h"
#include <QSettings>
using namespace BlackMisc;
namespace BlackSim
{
@@ -9,6 +14,20 @@ namespace BlackSim
{
CSimulatorSetup::init();
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));
}
}
}
}

View File

@@ -24,7 +24,7 @@ namespace BlackSim
enum
{
SetupSimConnectCfgFile = 1000
SetupSimConnectCfgFile = 1000, //!< location of simconnect.cfg file
};