7 #include <QStringBuilder>
13 using namespace swift::config;
20 : m_app(app), m_wordSize(
CBuildConfig::buildWordSize()), m_exePath(QCoreApplication::applicationDirPath()),
24 if (app == CApplicationInfo::Unknown) { m_app = guessApplication(); }
29 static const QString unknown(
"unknown");
30 static const QString launcher(
"launcher");
31 static const QString core(
"core");
32 static const QString gui(
"gui");
33 static const QString mapping(
"mapping tool");
34 static const QString unitTest(
"unit test");
35 static const QString sample(
"sample");
39 case Launcher:
return launcher;
40 case PilotClientCore:
return core;
41 case PilotClientGui:
return gui;
42 case MappingTool:
return mapping;
43 case UnitTest:
return unitTest;
44 case Sample:
return sample;
60 return a == CApplicationInfo::Sample || a == CApplicationInfo::UnitTest;
66 return a == CApplicationInfo::UnitTest;
79 return QStringLiteral(
"{ %1, %2, %3, %4 }")
87 case Launcher:
return CIcons::SwiftLauncher16;
88 case PilotClientCore:
return CIcons::SwiftCore16;
89 case PilotClientGui:
return CIcons::Swift16;
90 case MappingTool:
return CIcons::SwiftDatabase16;
93 return CIcons::StandardIconUnknown16;
98 if (index.
isMyself()) {
return QVariant::fromValue(*
this); }
102 case IndexApplication:
return QVariant::fromValue(m_app);
105 case IndexCompileInfo:
return QVariant::fromValue(this->
getCompileInfo());
108 case IndexPlatformInfo:
return QVariant::fromValue(this->
getPlatform());
110 case IndexVersionString:
return QVariant::fromValue(this->
getVersionString());
111 case IndexWordSize:
return QVariant::fromValue(this->
getWordSize());
128 case IndexApplicationAsString:
break;
130 case IndexCompileInfo: this->
setCompileInfo(variant.toString());
break;
132 case IndexExecutablePathExisting:
break;
133 case IndexPlatformInfo: this->
setPlatformInfo(variant.toString());
break;
136 case IndexWordSize: this->
setWordSize(variant.toInt());
break;
148 case IndexApplicationDataPath:
152 case IndexExecutablePathExisting:
155 case IndexProcessInfo:
159 case IndexApplication:
160 case IndexApplicationAsString:
return Compare::compare(m_app, compareValue.m_app);
167 static const QString s(
"swift pilot client GUI");
173 static const QString s(
"swift launcher");
179 static const QString s(
"swift mapping tool");
185 static const QString s(
"swift core");
197 static const QString fn(
"appinfo.json");
209 const QString a(QCoreApplication::instance()->
applicationName().toLower());
210 if (a.contains(
"test")) {
return CApplicationInfo::UnitTest; }
211 if (a.contains(
"sample")) {
return CApplicationInfo::Sample; }
212 if (a.contains(
"core")) {
return CApplicationInfo::PilotClientCore; }
213 if (a.contains(
"launcher")) {
return CApplicationInfo::Launcher; }
214 if (a.contains(
"gui")) {
return CApplicationInfo::PilotClientGui; }
215 if (a.contains(
"data") || a.contains(
"mapping")) {
return CApplicationInfo::MappingTool; }
216 return CApplicationInfo::Unknown;
Build configuration, also used to secure VATSIM key.
Description of a swift application.
int comparePropertyByIndex(CPropertyIndexRef index, const CApplicationInfo &compareValue) const
Compare for index.
CIcons::IconIndex toIcon() const
As icon, not implemented by all classes.
Application getApplication() const
Get application.
static const QString & swiftCore()
Name of swift core.
void setVersionString(const QString &version)
Set version string.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
static const CApplicationInfo & autoInfo()
Info automatically initialized.
static const QString & fileName()
File name of the application info file.
const QString & getExecutablePath() const
Get executable path.
Application
Enumeration of application roles.
ColumnIndex
Properties by index.
bool isExecutablePathExisting() const
Is the executable path existing?
const QString & getPlatform() const
Get platform.
const QString & getApplicationAsString() const
get application as string
static const CApplicationInfo & null()
NULL info.
bool isUnitTest() const
Unit test.
int getWordSize() const
Word size.
void setExecutablePath(const QString &exePath)
Set executable path.
const QString & getApplicationDataDirectory() const
Set application data dir.
const QString & getVersionString() const
Get version string.
QString asOtherSwiftVersionString(const QString &separator=" | ") const
Formatted info.
void setCompileInfo(const QString &info)
Compile info.
QString convertToQString(bool i18n=false) const
Cast as QString.
bool isSampleOrUnitTest() const
Sample or unit test.
const CProcessInfo & getProcessInfo() const
Get process info.
void setWordSize(int size)
Word size.
static const QString & swiftPilotClientGui()
Name of pilot client GUI.
void setApplication(Application app)
Set application.
static const QString & swiftMappingTool()
Name of swift mapping tool.
void setApplicationDataDirectory(const QString &appDataDir)
Set application data dir.
static const QString & swiftLauncher()
Name of swift launcher.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
const QString & getCompileInfo() const
Compile info.
bool isNull() const
Null object.
void setPlatformInfo(const QString &platform)
Set platform.
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
Value class identifying a process, with a PID and a name.
QString convertToQString(bool i18n=false) const
Cast as QString.
const QString & processName() const
Get the process name.
Non-owning reference to a CPropertyIndex with a subset of its features.
Q_REQUIRED_RESULT CPropertyIndexRef copyFrontRemoved() const
Copy with first element removed.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
int comparePropertyByIndex(CPropertyIndexRef index, const Derived &compareValue) const
Compare for index.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
Free functions in swift::misc.
QString applicationName()
Get application name.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.