18 #ifndef OPLCONSTANTS_H
19 #define OPLCONSTANTS_H
22 #include <QMessageBox>
42 #define OPL_SUBVERSION 1
43 #define OPL_VERSION_STRING QString(QString::number(OPL_VERSION) + "." + QString::number(OPL_SUBVERSION))
45 #if defined(__GNUC__) || defined(__clang__)
46 #define FUNC_IDENT __PRETTY_FUNCTION__
47 #elif defined(_MSC_VER)
48 #define FUNC_IDENT __FUNCSIG__
50 #define FUNC_IDENT __func__
55 #define TODO qCritical() << "TO DO:\t"
57 #define INFO(msg) OPL::ANotificationHandler::info(msg, this)
58 #define WARN(msg) OPL::ANotificationHandler::warn(msg, this)
59 #define CRIT(msg) OPL::ANotificationHandler::crit(msg, this)
68 static inline void info(
const QString msg, QWidget *parent =
nullptr){
71 auto mb = QMessageBox(QMessageBox::Information, QStringLiteral(
"Info"), msg, QMessageBox::StandardButton::Ok, parent);
74 static inline void warn(
const QString msg, QWidget *parent =
nullptr){
76 auto mb = QMessageBox(QMessageBox::Warning, QStringLiteral(
"Warning"), msg, QMessageBox::StandardButton::Ok, parent);
79 static inline void crit(
const QString msg, QWidget *parent =
nullptr){
81 auto mb = QMessageBox(QMessageBox::Critical, QStringLiteral(
"Warning"), msg, QMessageBox::StandardButton::Ok, parent);
86 using RowData_T = QHash<QString, QVariant>;
94 enum class FlightTimeFormat {Default, Decimal};
96 enum class DateTimeFormat {Default, Backup};
112 enum class DbViewName {Default, DefaultWithSim, Easa, EasaWithSim, SimulatorOnly};
122 enum class DbTable {Any, Flights, Simulators, Pilots, Tails, Aircraft, Airports, Currencies, Changelog};
127 enum class CurrencyName {Licence = 1, TypeRating = 2, LineCheck = 3, Medical = 4, Custom1 = 5, Custom2 = 6};
138 void fillLanguageComboBox(QComboBox *combo_box)
const;
139 void fillViewNamesComboBox(QComboBox *combo_box)
const;
140 void loadPilotFunctios(QComboBox *combo_box)
const;
141 void loadSimulatorTypes(QComboBox *combo_box)
const;
142 void loadApproachTypes(QComboBox *combo_box)
const;
144 inline const QStringList &getApproachTypes()
const {
return APPROACH_TYPES;}
145 inline const QString getLanguageFilePath(
Translation language)
const {
return L10N_FilePaths.value(language);}
146 inline const QString getViewIdentifier(
DbViewName view_name)
const {
return DATABASE_VIEWS.value(view_name);}
147 inline const QString getDbTableName(
DbTable table_name)
const {
return DB_TABLES.value(table_name);}
152 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
153 const static inline QHash<Translation, QString> L10N_FilePaths {
154 {Translation::English, QStringLiteral(
"l10n/openpilotlog_en")},
155 {Translation::German, QStringLiteral(
"l10n/openpilotlog_de")},
156 {Translation::Spanish, QStringLiteral(
"l10n/openpilotlog_es")},
158 const static inline QHash<Translation, QString> L10N_DisplayNames {
159 {Translation::English, QStringLiteral(
"English")},
160 {Translation::German, QStringLiteral(
"Deutsch")},
161 {Translation::Spanish, QStringLiteral(
"Español")},
163 const static inline QHash<DbViewName, QString> DATABASE_VIEWS = {
164 {DbViewName::Default, QStringLiteral(
"viewDefault")},
165 {DbViewName::DefaultWithSim, QStringLiteral(
"viewDefaultSim")},
166 {DbViewName::Easa, QStringLiteral(
"viewEasa")},
167 {DbViewName::EasaWithSim, QStringLiteral(
"viewEasaSim")},
168 {DbViewName::SimulatorOnly, QStringLiteral(
"viewSimulators")},
170 const QHash<DbViewName, QString> DATABASE_VIEW_DISPLAY_NAMES = {
171 {DbViewName::Default, tr(
"Default")},
172 {DbViewName::DefaultWithSim, tr(
"Default with Simulator")},
173 {DbViewName::Easa, tr(
"EASA-FCL")},
174 {DbViewName::EasaWithSim, tr(
"EASA-FCL with Simulator")},
175 {DbViewName::SimulatorOnly, tr(
"Simulator Sessions Only")},
177 const static inline QHash<PilotFunction, QString> PILOT_FUNCTIONS = {
178 {PilotFunction::PIC, QStringLiteral(
"PIC")},
179 {PilotFunction::PICUS, QStringLiteral(
"PICUS")},
180 {PilotFunction::SIC, QStringLiteral(
"SIC")},
181 {PilotFunction::DUAL, QStringLiteral(
"DUAL")},
182 {PilotFunction::FI, QStringLiteral(
"FI")},
184 const static inline QHash<SimulatorType, QString> SIMULATOR_TYPES = {
185 {SimulatorType::FNPTI, QStringLiteral(
"FNPT I")},
186 {SimulatorType::FNPTII, QStringLiteral(
"FNPT II")},
187 {SimulatorType::FSTD, QStringLiteral(
"FSTD")},
189 const static inline QHash<DbTable, QString> DB_TABLES = {
191 {DbTable::Flights, QStringLiteral(
"flights")},
192 {DbTable::Simulators, QStringLiteral(
"simulators")},
193 {DbTable::Pilots, QStringLiteral(
"pilots")},
194 {DbTable::Tails, QStringLiteral(
"tails")},
195 {DbTable::Aircraft, QStringLiteral(
"aircraft")},
196 {DbTable::Airports, QStringLiteral(
"airports")},
197 {DbTable::Currencies, QStringLiteral(
"currencies")},
198 {DbTable::Changelog, QStringLiteral(
"changelog")},
201 const static inline QMap<Translation, QString> L10N_FilePaths {
202 {Translation::English, QStringLiteral(
"l10n/openpilotlog_en")},
203 {Translation::German, QStringLiteral(
"l10n/openpilotlog_de")},
204 {Translation::Spanish, QStringLiteral(
"l10n/openpilotlog_es")},
206 const static inline QMap<Translation, QString> L10N_DisplayNames {
207 {Translation::English, QStringLiteral(
"English")},
208 {Translation::German, QStringLiteral(
"Deutsch")},
209 {Translation::Spanish, QStringLiteral(
"Español")},
211 const static inline QMap<DbViewName, QString> DATABASE_VIEWS = {
212 {DbViewName::Default, QStringLiteral(
"viewDefault")},
213 {DbViewName::DefaultWithSim, QStringLiteral(
"viewDefaultSim")},
214 {DbViewName::Easa, QStringLiteral(
"viewEasa")},
215 {DbViewName::EasaWithSim, QStringLiteral(
"viewEasaSim")},
216 {DbViewName::SimulatorOnly, QStringLiteral(
"viewSimulators")},
218 const QMap<DbViewName, QString> DATABASE_VIEW_DISPLAY_NAMES = {
219 {DbViewName::Default, tr(
"Default")},
220 {DbViewName::DefaultWithSim, tr(
"Default with Simulator")},
221 {DbViewName::Easa, tr(
"EASA-FCL")},
222 {DbViewName::EasaWithSim, tr(
"EASA-FCL with Simulator")},
223 {DbViewName::SimulatorOnly, tr(
"Simulator Sessions Only")},
225 const static inline QMap<PilotFunction, QString> PILOT_FUNCTIONS = {
226 {PilotFunction::PIC, QStringLiteral(
"PIC")},
227 {PilotFunction::PICUS, QStringLiteral(
"PICUS")},
228 {PilotFunction::SIC, QStringLiteral(
"SIC")},
229 {PilotFunction::DUAL, QStringLiteral(
"DUAL")},
230 {PilotFunction::FI, QStringLiteral(
"FI")},
232 const static inline QMap<SimulatorType, QString> SIMULATOR_TYPES = {
233 {SimulatorType::FNPTI, QStringLiteral(
"FNPT I")},
234 {SimulatorType::FNPTII, QStringLiteral(
"FNPT II")},
235 {SimulatorType::FSTD, QStringLiteral(
"FSTD")},
237 const static inline QMap<DbTable, QString> DB_TABLES = {
238 {DbTable::Flights, QStringLiteral(
"flights")},
239 {DbTable::Simulators, QStringLiteral(
"simulators")},
240 {DbTable::Pilots, QStringLiteral(
"pilots")},
241 {DbTable::Tails, QStringLiteral(
"tails")},
242 {DbTable::Aircraft, QStringLiteral(
"aircraft")},
243 {DbTable::Airports, QStringLiteral(
"airports")},
244 {DbTable::Currencies, QStringLiteral(
"currencies")},
245 {DbTable::Changelog, QStringLiteral(
"changelog")},
249 const static inline QStringList APPROACH_TYPES = {
250 QStringLiteral(
"VISUAL"),
251 QStringLiteral(
"ILS CAT I"),
252 QStringLiteral(
"ILS CAT II"),
253 QStringLiteral(
"ILS CAT III"),
254 QStringLiteral(
"GLS"),
255 QStringLiteral(
"MLS"),
256 QStringLiteral(
"LOC"),
257 QStringLiteral(
"LOC/DME"),
258 QStringLiteral(
"RNAV"),
259 QStringLiteral(
"RNAV (LNAV)"),
260 QStringLiteral(
"RNAV (LNAV/VNAV)"),
261 QStringLiteral(
"RNAV (LPV)"),
262 QStringLiteral(
"RNAV (RNP)"),
263 QStringLiteral(
"RNAV (RNP-AR)"),
264 QStringLiteral(
"VOR"),
265 QStringLiteral(
"VOR/DME"),
266 QStringLiteral(
"NDB"),
267 QStringLiteral(
"NDB/DME"),
268 QStringLiteral(
"TACAN"),
269 QStringLiteral(
"SRA"),
270 QStringLiteral(
"PAR"),
271 QStringLiteral(
"OTHER")
295 const inline auto TABLE_FLIGHTS = QStringLiteral(
"flights");
296 const inline auto TABLE_PILOTS = QStringLiteral(
"pilots");
297 const inline auto TABLE_TAILS = QStringLiteral(
"tails");
298 const inline auto TABLE_AIRCRAFT = QStringLiteral(
"aircraft");
299 const inline auto TABLE_AIRPORTS = QStringLiteral(
"airports");
300 const inline auto TABLE_CURRENCIES = QStringLiteral(
"currencies");
301 const inline auto TABLE_SIMULATORS = QStringLiteral(
"simulators");
304 const inline auto FLIGHTS_ROWID = QStringLiteral(
"flight_id");
305 const inline auto FLIGHTS_DOFT = QStringLiteral(
"doft");
306 const inline auto FLIGHTS_DEPT = QStringLiteral(
"dept");
307 const inline auto FLIGHTS_DEST = QStringLiteral(
"dest");
308 const inline auto FLIGHTS_TOFB = QStringLiteral(
"tofb");
309 const inline auto FLIGHTS_TONB = QStringLiteral(
"tonb");
310 const inline auto FLIGHTS_PIC = QStringLiteral(
"pic");
311 const inline auto FLIGHTS_ACFT = QStringLiteral(
"acft");
312 const inline auto FLIGHTS_TBLK = QStringLiteral(
"tblk");
313 const inline auto FLIGHTS_TSPSE = QStringLiteral(
"tSPSE");
314 const inline auto FLIGHTS_TSPME = QStringLiteral(
"tSPME");
315 const inline auto FLIGHTS_TMP = QStringLiteral(
"tMP");
316 const inline auto FLIGHTS_TNIGHT = QStringLiteral(
"tNIGHT");
317 const inline auto FLIGHTS_TIFR = QStringLiteral(
"tIFR");
318 const inline auto FLIGHTS_TPIC = QStringLiteral(
"tPIC");
319 const inline auto FLIGHTS_TPICUS = QStringLiteral(
"tPICUS");
320 const inline auto FLIGHTS_TSIC = QStringLiteral(
"tSIC");
321 const inline auto FLIGHTS_TDUAL = QStringLiteral(
"tDUAL");
322 const inline auto FLIGHTS_TFI = QStringLiteral(
"tFI");
323 const inline auto FLIGHTS_TSIM = QStringLiteral(
"tSIM");
324 const inline auto FLIGHTS_PILOTFLYING = QStringLiteral(
"pilotFlying");
325 const inline auto FLIGHTS_TODAY = QStringLiteral(
"toDay");
326 const inline auto FLIGHTS_TONIGHT = QStringLiteral(
"toNight");
327 const inline auto FLIGHTS_LDGDAY = QStringLiteral(
"ldgDay");
328 const inline auto FLIGHTS_LDGNIGHT = QStringLiteral(
"ldgNight");
329 const inline auto FLIGHTS_AUTOLAND = QStringLiteral(
"autoland");
330 const inline auto FLIGHTS_SECONDPILOT = QStringLiteral(
"secondPilot");
331 const inline auto FLIGHTS_THIRDPILOT = QStringLiteral(
"thirdPilot");
332 const inline auto FLIGHTS_APPROACHTYPE = QStringLiteral(
"approachType");
333 const inline auto FLIGHTS_FLIGHTNUMBER = QStringLiteral(
"flightNumber");
334 const inline auto FLIGHTS_REMARKS = QStringLiteral(
"remarks");
338 const inline auto TAILS_ROWID = QStringLiteral(
"tail_id");
339 const inline auto TAILS_REGISTRATION = QStringLiteral(
"registration");
340 const inline auto TAILS_COMPANY = QStringLiteral(
"company");
341 const inline auto TAILS_MAKE = QStringLiteral(
"make");
342 const inline auto TAILS_MODEL = QStringLiteral(
"model");
343 const inline auto TAILS_VARIANT = QStringLiteral(
"variant");
344 const inline auto TAILS_MULTIPILOT = QStringLiteral(
"multipilot");
345 const inline auto TAILS_MULTIENGINE = QStringLiteral(
"multiengine");
346 const inline auto TAILS_ENGINETYPE = QStringLiteral(
"engineType");
347 const inline auto TAILS_WEIGHTCLASS = QStringLiteral(
"weightClass");
351 const inline auto PILOTS_ROWID = QStringLiteral(
"pilot_id");
352 const inline auto PILOTS_LASTNAME = QStringLiteral(
"lastname");
353 const inline auto PILOTS_FIRSTNAME = QStringLiteral(
"firstname");
354 const inline auto PILOTS_ALIAS = QStringLiteral(
"alias");
355 const inline auto PILOTS_COMPANY = QStringLiteral(
"company");
356 const inline auto PILOTS_EMPLOYEEID = QStringLiteral(
"employeeid");
357 const inline auto PILOTS_PHONE = QStringLiteral(
"phone");
358 const inline auto PILOTS_EMAIL = QStringLiteral(
"email");
361 const inline auto CURRENCIES_EXPIRYDATE = QStringLiteral(
"expiryDate");
362 const inline auto CURRENCIES_CURRENCYNAME = QStringLiteral(
"currencyName");
365 const inline auto SIMULATORS_ROWID = QStringLiteral(
"session_id");
366 const inline auto SIMULATORS_DATE = QStringLiteral(
"date");
367 const inline auto SIMULATORS_TIME = QStringLiteral(
"totalTime");
368 const inline auto SIMULATORS_TYPE = QStringLiteral(
"deviceType");
369 const inline auto SIMULATORS_ACFT = QStringLiteral(
"aircraftType");
370 const inline auto SIMULATORS_REG = QStringLiteral(
"registration");
371 const inline auto SIMULATORS_REMARKS = QStringLiteral(
"remarks");
374 const inline auto AIRPORTS_ICAO = QStringLiteral(
"icao");
375 const inline auto AIRPORTS_IATA = QStringLiteral(
"iata");
376 const inline auto AIRPORTS_NAME = QStringLiteral(
"name");
377 const inline auto AIRPORTS_LAT = QStringLiteral(
"lat");
378 const inline auto AIRPORTS_LON = QStringLiteral(
"long");
379 const inline auto AIRPORTS_COUNTRY = QStringLiteral(
"country");
380 const inline auto AIRPORTS_ALTITIDUE = QStringLiteral(
"alt");
381 const inline auto AIRPORTS_UTC_OFFSET = QStringLiteral(
"utcoffset");
382 const inline auto AIRPORTS_TZ_OLSON = QStringLiteral(
"tzolson");
385 const inline auto ROWID = QStringLiteral(
"rowid");
386 const inline auto NULL_TIME_hhmm = QStringLiteral(
"00:00");
392 const inline auto DATABASE_SCHEMA = QStringLiteral(
":/database/database_schema.sql");
393 const inline auto DATABASE_TEMPLATE_AIRCRAFT = QStringLiteral(
":/database/templates/aircraft.json");
394 const inline auto DATABASE_TEMPLATE_AIRPORT = QStringLiteral(
":/database/templates/airports.json");
395 const inline auto DATABASE_TEMPLATE_CHANGELOG = QStringLiteral(
":/database/templates/changelog.json");
396 const inline auto DATABASE_TEMPLATE_CURRENCIES = QStringLiteral(
":/database/templates/currencies.json");
398 const inline auto LOGO = QStringLiteral(
":/icons/opl-icons/logos/logo_text.png");
399 const inline auto ICON_MAIN = QStringLiteral(
":/icons/opl-icons/app/icon_main.png");
400 const inline auto ICON_APPICON_LINUX = QStringLiteral(
":/icons/opl-icons/app/icon_linux.svg");
401 const inline auto ICON_APPICON_IOS = QStringLiteral(
":/icons/opl-icons/app/icon_ios.svg");
402 const inline auto ICON_APPICON_WIN = QStringLiteral(
":/icons/opl-icons/app/icon_windows.ico");
404 const inline auto ICON_TOOLBAR_HOME = QStringLiteral(
":/icons/opl-icons/toolbar/thick/light/icon_home.svg");
405 const inline auto ICON_TOOLBAR_NEW_FLIGHT = QStringLiteral(
":/icons/opl-icons/toolbar/thick/light/icon_new_flight.svg");
406 const inline auto ICON_TOOLBAR_LOGBOOK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/light/icon_logbook.svg");
407 const inline auto ICON_TOOLBAR_AIRCRAFT = QStringLiteral(
":/icons/opl-icons/toolbar/thick/light/icon_airplane.svg");
408 const inline auto ICON_TOOLBAR_PILOT = QStringLiteral(
":/icons/opl-icons/toolbar/thick/light/icon_pilot.svg");
409 const inline auto ICON_TOOLBAR_SETTINGS = QStringLiteral(
":/icons/opl-icons/toolbar/thick/light/icon_settings.svg");
410 const inline auto ICON_TOOLBAR_QUIT = QStringLiteral(
":/icons/opl-icons/toolbar/thick/light/icon_exit.svg");
412 const inline auto ICON_TOOLBAR_BACKUP = QStringLiteral(
":/icons/opl-icons/toolbar/thick/light/icon_backup.svg");
414 const inline auto ICON_TOOLBAR_HOME_DARK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/dark/icon_home_dm.svg");
415 const inline auto ICON_TOOLBAR_NEW_FLIGHT_DARK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/dark/icon_new_flight_dm.svg");
416 const inline auto ICON_TOOLBAR_LOGBOOK_DARK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/dark/icon_logbook_dm.svg");
417 const inline auto ICON_TOOLBAR_AIRCRAFT_DARK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/dark/icon_airplane_dm.svg");
418 const inline auto ICON_TOOLBAR_PILOT_DARK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/dark/icon_pilot_dm.svg");
419 const inline auto ICON_TOOLBAR_SETTINGS_DARK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/dark/icon_settings_dm.svg");
420 const inline auto ICON_TOOLBAR_QUIT_DARK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/dark/icon_exit_dm.svg");
422 const inline auto ICON_TOOLBAR_BACKUP_DARK = QStringLiteral(
":/icons/opl-icons/toolbar/thick/dark/icon_backup_dm.svg");
428 const inline auto RED_BORDER = QStringLiteral(
"border: 1px solid red");
The ANotificationHandler class handles displaying of user-directed messages. It displays information ...
Definition: opl.h:66
The OplGlobals class encapsulates non-POD globals to avoid making them static. It is available as a g...
Definition: opl.h:134
A namespace to collect constants and enums used throughout the application.
Definition: paths.cpp:3
SimulatorType
Enumerates the Simulator Types: Flight and Navigation Procedures Trainer 1/2, Flight Simulation Train...
Definition: opl.h:117
CurrencyName
Enumerates the currency names.
Definition: opl.h:127
PilotFunction
PilotFunction Pilot in Command, Pilot in Command under Supervision, Second in Command (Co-Pilot),...
Definition: opl.h:102
Translation
Enumerates the available translations.
Definition: opl.h:107
DbTable
Enumerates the tables in the database.
Definition: opl.h:122
DbViewName
Enumerates the available SQL views in the database.
Definition: opl.h:112
DateFormat
ADateFormats enumerates the accepted date formats for QDateEdits.
Definition: opl.h:92