mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #911, allow to set model dir relative to simulator directory
* utility functions in simulator info * and fscommonutil * and button in UI to set default
This commit is contained in:
committed by
Mathew Sutcliffe
parent
e8eb652cfd
commit
b0fe4ce930
@@ -90,7 +90,7 @@ namespace BlackMisc
|
||||
{
|
||||
const QString fsxPath = CFsCommonUtil::fsxDirFromRegistry();
|
||||
if (fsxPath.isEmpty()) { return ""; }
|
||||
return QDir(fsxPath).filePath("SimObjects");
|
||||
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(fsxPath);
|
||||
}
|
||||
|
||||
const QString &CFsCommonUtil::fsxSimObjectsDirFromRegistry()
|
||||
@@ -103,7 +103,7 @@ namespace BlackMisc
|
||||
{
|
||||
QString dir(CFsCommonUtil::fsxDir());
|
||||
if (dir.isEmpty()) { return ""; }
|
||||
return QDir(dir).filePath("SimObjects");
|
||||
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(dir);
|
||||
}
|
||||
|
||||
const QString &CFsCommonUtil::fsxSimObjectsDir()
|
||||
@@ -112,6 +112,12 @@ namespace BlackMisc
|
||||
return dir;
|
||||
}
|
||||
|
||||
QString CFsCommonUtil::fsxSimObjectsDirFromSimDir(const QString &simDir)
|
||||
{
|
||||
Q_ASSERT_X(!simDir.isEmpty(), Q_FUNC_INFO, "missing simulator directory");
|
||||
return CFileUtils::appendFilePaths(simDir, "SimObjects");
|
||||
}
|
||||
|
||||
const QStringList &CFsCommonUtil::fsxSimObjectsExcludeDirectoryPatterns()
|
||||
{
|
||||
static const QStringList exclude
|
||||
@@ -175,7 +181,7 @@ namespace BlackMisc
|
||||
{
|
||||
const QString p3dPath = CFsCommonUtil::p3dDirFromRegistry();
|
||||
if (p3dPath.isEmpty()) { return ""; }
|
||||
return QDir(p3dPath).filePath("SimObjects");
|
||||
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(p3dPath);
|
||||
}
|
||||
|
||||
const QString &CFsCommonUtil::p3dSimObjectsDirFromRegistry()
|
||||
@@ -188,7 +194,7 @@ namespace BlackMisc
|
||||
{
|
||||
QString dir(CFsCommonUtil::p3dDir());
|
||||
if (dir.isEmpty()) { return ""; }
|
||||
return QDir(dir).filePath("SimObjects");
|
||||
return CFsCommonUtil::fsxSimObjectsDirFromSimDir(dir);
|
||||
}
|
||||
|
||||
const QString &CFsCommonUtil::p3dSimObjectsDir()
|
||||
@@ -266,21 +272,20 @@ namespace BlackMisc
|
||||
{
|
||||
QString fs9Path = CFsCommonUtil::fs9DirFromRegistry();
|
||||
if (fs9Path.isEmpty()) { return ""; }
|
||||
fs9Path = QDir(fs9Path).filePath("Aircraft");
|
||||
return fs9Path;
|
||||
return CFsCommonUtil::fs9AircraftDirFromSimDir(fs9Path);
|
||||
}
|
||||
|
||||
const QString &CFsCommonUtil::fs9AircraftDirFromRegistry()
|
||||
{
|
||||
static const QString v(fs9AircraftDirFromRegistryImpl());
|
||||
return v;
|
||||
static const QString dir(fs9AircraftDirFromRegistryImpl());
|
||||
return dir;
|
||||
}
|
||||
|
||||
QString fs9AircraftDirImpl()
|
||||
{
|
||||
const QString dir(CFsCommonUtil::fs9Dir());
|
||||
if (dir.isEmpty()) { return ""; }
|
||||
return QDir(dir).filePath("Aircraft");
|
||||
return CFsCommonUtil::fs9AircraftDirFromSimDir(dir);
|
||||
}
|
||||
|
||||
const QString &CFsCommonUtil::fs9AircraftDir()
|
||||
@@ -289,6 +294,12 @@ namespace BlackMisc
|
||||
return dir;
|
||||
}
|
||||
|
||||
QString CFsCommonUtil::fs9AircraftDirFromSimDir(const QString &simDir)
|
||||
{
|
||||
Q_ASSERT_X(!simDir.isEmpty(), Q_FUNC_INFO, "missing simulator directory");
|
||||
return CFileUtils::appendFilePaths(simDir, "Aircraft");
|
||||
}
|
||||
|
||||
const QStringList &CFsCommonUtil::fs9AircraftObjectsExcludeDirectoryPatterns()
|
||||
{
|
||||
static const QStringList exclude;
|
||||
|
||||
@@ -43,6 +43,9 @@ namespace BlackMisc
|
||||
//! FSX's simobject dir, resolved from multiple sources
|
||||
static const QString &fsxSimObjectsDir();
|
||||
|
||||
//! FSX aircraft dir, relative to simulator directory
|
||||
static QString fsxSimObjectsDirFromSimDir(const QString &simDir);
|
||||
|
||||
//! Exclude directories for simObjects
|
||||
static const QStringList &fsxSimObjectsExcludeDirectoryPatterns();
|
||||
|
||||
@@ -73,6 +76,9 @@ namespace BlackMisc
|
||||
//! FS9's aircraft directory
|
||||
static const QString &fs9AircraftDir();
|
||||
|
||||
//! FS9 aircraft dir, relative to simulator directory
|
||||
static QString fs9AircraftDirFromSimDir(const QString &simDir);
|
||||
|
||||
//! Exclude directories for aircraft objects
|
||||
static const QStringList &fs9AircraftObjectsExcludeDirectoryPatterns();
|
||||
};
|
||||
|
||||
@@ -111,6 +111,11 @@ namespace BlackMisc
|
||||
return isMicrosoftSimulator() || p3d();
|
||||
}
|
||||
|
||||
bool CSimulatorInfo::isFsxFamily() const
|
||||
{
|
||||
return fsx() || p3d();
|
||||
}
|
||||
|
||||
int CSimulatorInfo::numberSimulators() const
|
||||
{
|
||||
int c = fs9() ? 1 : 0;
|
||||
|
||||
@@ -114,6 +114,9 @@ namespace BlackMisc
|
||||
//! Microsoft Simulator or P3D?
|
||||
bool isMicrosoftOrPrepare3DSimulator() const;
|
||||
|
||||
//! FSX family, i.e. FSX or P3D?
|
||||
bool isFsxFamily() const;
|
||||
|
||||
//! Number simulators selected
|
||||
int numberSimulators() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user