swift
globalsetup.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_CORE_DATA_GLOBALSETUP_H
7 #define SWIFT_CORE_DATA_GLOBALSETUP_H
8 
9 #include <QMetaType>
10 #include <QString>
11 
12 #include "core/swiftcoreexport.h"
13 #include "misc/datacache.h"
14 #include "misc/identifiable.h"
15 #include "misc/metaclass.h"
17 #include "misc/network/url.h"
18 #include "misc/propertyindex.h"
19 #include "misc/valueobject.h"
20 #include "misc/variant.h"
21 
23 
24 namespace swift::core::data
25 {
29  public swift::misc::CValueObject<CGlobalSetup>,
31  {
32  public:
35  {
36  IndexDbRootDirectory = swift::misc::CPropertyIndexRef::GlobalIndexCGlobalSetup,
37  IndexDbHttpsPort,
38  IndexDbLoginService,
39  IndexVatsimStatus,
40  IndexVatsimMetars,
41  IndexVatsimData,
42  IndexVatsimServer,
43  IndexVatsimHttpFsd,
44  IndexOnlineHelpUrl,
45  IndexSharedUrl,
46  IndexMappingMinimumVersion,
47  IndexPredefinedServers,
48  IndexAfvApiServerUrl,
49  IndexAfvMapUrl
50  };
51 
53  CGlobalSetup();
54 
56  int getDbHttpsPort() const { return m_dbHttpsPort; }
57 
59  bool dbDebugFlag() const;
60 
62  void setServerDebugFlag(bool debug);
63 
65  const swift::misc::network::CUrl &getDbRootDirectoryUrl() const { return m_dbRootDirectoryUrl; }
66 
69  swift::misc::network::CUrl getDbIcaoReaderUrl() const;
70 
73  swift::misc::network::CUrl getDbModelReaderUrl() const;
74 
77  swift::misc::network::CUrl getDbAirportReaderUrl() const;
78 
81  swift::misc::network::CUrl getDbInfoReaderUrl() const;
82 
85  swift::misc::network::CUrl getDbHomePageUrl() const;
86 
89  swift::misc::network::CUrl getLegalDirectoryUrl() const;
90 
93  swift::misc::network::CUrl getDbLoginServiceUrl() const;
94 
96  const swift::misc::network::CUrl &getSwiftSharedUrl() const;
97 
99  const swift::misc::network::CUrl &getVatsimMetarsUrl() const { return m_vatsimMetarsUrl; }
100 
102  const swift::misc::network::CUrl &getVatsimStatusFileUrl() const { return m_vatsimStatusFileUrl; }
103 
105  const swift::misc::network::CUrl &getVatsimDataFileUrl() const { return m_vatsimDataFileUrl; }
106 
108  swift::misc::network::CUrl getVatsimServerFileUrl() const { return m_vatsimServerFileUrl; }
109 
111  swift::misc::network::CUrl getVatsimFsdHttpUrl() const { return m_vatsimFsdHttpUrl; }
112 
114  swift::misc::network::CUrl getHelpPageUrl(const QString &context = {}) const;
115 
117  const swift::misc::network::CServerList &getPredefinedServers() const { return m_predefinedServers; }
118 
120  swift::misc::network::CServerList getPredefinedServersPlusHardcodedServers() const;
121 
124  const QString &getMappingMinimumVersionString() const { return m_mappingMinimumVersion; }
125 
128  bool isSwiftVersionMinimumMappingVersion() const;
129 
131  swift::misc::network::CUrl getComNavEquipmentHelpUrl() const { return m_comNavEquipmentHelpUrl; }
132 
134  swift::misc::network::CUrl getSsrEquipmentHelpUrl() const { return m_ssrEquipmentHelpUrl; }
135 
137  swift::misc::network::CUrl getAfvApiServerUrl() const { return m_afvApiServerUrl; }
138 
140  swift::misc::network::CUrl getAfvMapUrl() const { return m_afvMapUrl; }
141 
143  swift::misc::network::CUrl getVatsimAuthUrl() const { return m_vatsimAuthUrl; }
144 
146  QString convertToQString(bool i18n = false) const;
147 
149  QString convertToQString(const QString &separator, bool i18n = false) const;
150 
152  swift::misc::network::CUrl getSharedDbDataDirectoryUrl();
153 
155  QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
156 
158  void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
159 
161  static const QString &schemaVersionString();
162 
163  private:
164  int m_dbHttpsPort = 443;
165  QString m_mappingMinimumVersion;
166  swift::misc::network::CUrl m_dbRootDirectoryUrl;
167  swift::misc::network::CUrl m_vatsimMetarsUrl;
168  swift::misc::network::CUrl m_vatsimStatusFileUrl;
171  m_vatsimDataFileUrl;
172  swift::misc::network::CUrl m_vatsimServerFileUrl;
174  m_vatsimFsdHttpUrl;
175  swift::misc::network::CUrl m_sharedUrl;
176  swift::misc::network::CUrl m_onlineHelpUrl;
177  swift::misc::network::CServerList m_predefinedServers;
178  swift::misc::network::CUrl m_comNavEquipmentHelpUrl;
179  swift::misc::network::CUrl m_ssrEquipmentHelpUrl;
180  swift::misc::network::CUrl m_afvApiServerUrl;
181  swift::misc::network::CUrl m_afvMapUrl;
182  swift::misc::network::CUrl m_vatsimAuthUrl;
183  bool m_dbDebugFlag = false;
185 
187  CGlobalSetup,
188  SWIFT_METAMEMBER(dbRootDirectoryUrl, 0, RequiredForJson),
189  SWIFT_METAMEMBER(dbHttpsPort, 0, RequiredForJson),
190  SWIFT_METAMEMBER(vatsimStatusFileUrl, 0, RequiredForJson),
191  SWIFT_METAMEMBER(vatsimDataFileUrl, 0, RequiredForJson),
192  SWIFT_METAMEMBER(vatsimServerFileUrl, 0, RequiredForJson),
193  SWIFT_METAMEMBER(vatsimFsdHttpUrl, 0, RequiredForJson),
194  SWIFT_METAMEMBER(vatsimMetarsUrl, 0, RequiredForJson),
195  SWIFT_METAMEMBER(sharedUrl, 0, RequiredForJson),
196  SWIFT_METAMEMBER(onlineHelpUrl, 0, RequiredForJson),
197  SWIFT_METAMEMBER(predefinedServers, 0, RequiredForJson),
198  SWIFT_METAMEMBER(mappingMinimumVersion, 0, RequiredForJson),
199  SWIFT_METAMEMBER(comNavEquipmentHelpUrl, 0, RequiredForJson),
200  SWIFT_METAMEMBER(ssrEquipmentHelpUrl, 0, RequiredForJson),
201  SWIFT_METAMEMBER(dbDebugFlag, 0, RequiredForJson),
202  SWIFT_METAMEMBER(afvApiServerUrl, 0, RequiredForJson),
203  SWIFT_METAMEMBER(afvMapUrl, 0, RequiredForJson),
204  SWIFT_METAMEMBER(vatsimAuthUrl, 0, RequiredForJson));
205  };
206 } // namespace swift::core::data
207 
208 Q_DECLARE_METATYPE(swift::core::data::CGlobalSetup)
209 
210 #endif // SWIFT_CORE_DATA_GLOBALSETUP_H
Global settings for readers, debug flags, etc.
Definition: globalsetup.h:31
swift::misc::network::CUrl getVatsimServerFileUrl() const
VATSIM server file URL.
Definition: globalsetup.h:108
const QString & getMappingMinimumVersionString() const
Creating mappings requires at least this version or higher.
Definition: globalsetup.h:124
ColumnIndex
Properties by index.
Definition: globalsetup.h:35
swift::misc::network::CUrl getVatsimAuthUrl() const
VATSIM auth URL.
Definition: globalsetup.h:143
const swift::misc::network::CUrl & getDbRootDirectoryUrl() const
Root directory of DB.
Definition: globalsetup.h:65
const swift::misc::network::CUrl & getVatsimStatusFileUrl() const
VATSIM status file URL.
Definition: globalsetup.h:102
const swift::misc::network::CUrl & getVatsimDataFileUrl() const
VATSIM data file URL.
Definition: globalsetup.h:105
swift::misc::network::CUrl getSsrEquipmentHelpUrl() const
SSR equipment code help URL.
Definition: globalsetup.h:134
const swift::misc::network::CUrl & getVatsimMetarsUrl() const
VATSIM METAR URL.
Definition: globalsetup.h:99
swift::misc::network::CUrl getAfvMapUrl() const
AFV map URL.
Definition: globalsetup.h:140
const swift::misc::network::CServerList & getPredefinedServers() const
Predefined servers.
Definition: globalsetup.h:117
swift::misc::network::CUrl getVatsimFsdHttpUrl() const
VATSIM server file URL.
Definition: globalsetup.h:111
swift::misc::network::CUrl getAfvApiServerUrl() const
AFV voice server URL.
Definition: globalsetup.h:137
int getDbHttpsPort() const
Https port.
Definition: globalsetup.h:56
swift::misc::network::CUrl getComNavEquipmentHelpUrl() const
COM/NAV equipment code help URL.
Definition: globalsetup.h:131
Base class with a member CIdentifier to be inherited by a class which has an identity in the environm...
Definition: identifiable.h:24
Non-owning reference to a CPropertyIndex with a subset of its features.
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
Value object encapsulating a list of servers.
Definition: serverlist.h:23
Value object encapsulating information of a location, kind of simplified CValueObject compliant versi...
Definition: url.h:27
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition: metaclass.h:73
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition: metaclass.h:53
@ RequiredForJson
Element is required when parsing from JSON.
Definition: metaclass.h:209
Core data traits (aka cached values) and classes.
#define SWIFT_CORE_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition: valueobject.h:65