openPilotLog
oplconstants.h
1 /*
2  *openPilotLog - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020-2021 Felix Turowsky
4  *
5  *This program is free software: you can redistribute it and/or modify
6  *it under the terms of the GNU General Public License as published by
7  *the Free Software Foundation, either version 3 of the License, or
8  *(at your option) any later version.
9  *
10  *This program is distributed in the hope that it will be useful,
11  *but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *GNU General Public License for more details.
14  *
15  *You should have received a copy of the GNU General Public License
16  *along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 #ifndef OPLCONSTANTS_H
19 #define OPLCONSTANTS_H
20 
21 #include <QtCore>
22 #include "src/database/adatabasetypes.h"
23 
38 namespace Opl {
39 
40 #if defined(__GNUC__) || defined(__clang__)
41  #define FUNC_IDENT __PRETTY_FUNCTION__
42 #elif defined(_MSC_VER)
43  #define FUNC_IDENT __FUNCSIG__
44 #else
45  #define FUNC_IDENT __func__
46 #endif
47 
48 #define DEB qDebug() << FUNC_IDENT << "\n\t" // Use for debugging
49 #define LOG qInfo() // Use for logging milestones (silently, will be written to log file and console out only)
50 #define INFO qInfo() // Use for messages of interest to the user (will be displayed in GUI)
51 #define WARN qWarning() // Use for warnings (will be displayed in GUI)
52 #define CRIT qCritical() // Use for critical warnings (will be displayed in GUI)
53 #define TODO qCritical() << "!\n\tTo Do:\t"
54 
55 static const auto ApproachTypes = QStringList{
56  QLatin1String("VISUAL"),
57  QLatin1String("ILS CAT I"),
58  QLatin1String("ILS CAT II"),
59  QLatin1String("ILS CAT III"),
60  QLatin1String("GLS"),
61  QLatin1String("MLS"),
62  QLatin1String("LOC"),
63  QLatin1String("LOC/DME"),
64  QLatin1String("RNAV"),
65  QLatin1String("RNAV (LNAV)"),
66  QLatin1String("RNAV (LNAV/VNAV)"),
67  QLatin1String("RNAV (LPV)"),
68  QLatin1String("RNAV (RNP)"),
69  QLatin1String("RNAV (RNP-AR)"),
70  QLatin1String("VOR"),
71  QLatin1String("VOR/DME"),
72  QLatin1String("NDB"),
73  QLatin1String("NDB/DME"),
74  QLatin1String("TACAN"),
75  QLatin1String("SRA"),
76  QLatin1String("PAR"),
77  QLatin1String("OTHER")
78 };
79 
80 namespace Date {
81 
82 enum DateFormat {Default, Text};
83 
84 } // namespace opl::date
85 
86 namespace Time {
87 
88 enum FlightTimeFormat {Default, Decimal};
89 
90 } // namespace opl::time
91 
92 namespace Datetime {
93 
94 enum DateTimeFormat {Default, Backup};
95 
96 } // namespace opl::datetime
97 
113 namespace Db {
114 
115 
116 // Table names
117 static const auto TABLE_FLIGHTS = QLatin1String("flights");
118 static const auto TABLE_PILOTS = QLatin1String("pilots");
119 static const auto TABLE_TAILS = QLatin1String("tails");
120 static const auto TABLE_AIRCRAFT = QLatin1String("aircraft");
121 static const auto TABLE_AIRPORTS = QLatin1String("airports");
122 static const auto TABLE_CURRENCIES = QLatin1String("currencies");
123 
124 // Flights table columns
125 static const auto FLIGHTS_DOFT = QLatin1String("doft");
126 static const auto FLIGHTS_DEPT = QLatin1String("dept");
127 static const auto FLIGHTS_DEST = QLatin1String("dest");
128 static const auto FLIGHTS_TOFB = QLatin1String("tofb");
129 static const auto FLIGHTS_TONB = QLatin1String("tonb");
130 static const auto FLIGHTS_PIC = QLatin1String("pic");
131 static const auto FLIGHTS_ACFT = QLatin1String("acft");
132 static const auto FLIGHTS_TBLK = QLatin1String("tblk");
133 static const auto FLIGHTS_TSPSE = QLatin1String("tSPSE");
134 static const auto FLIGHTS_TSPME = QLatin1String("tSPME");
135 static const auto FLIGHTS_TMP = QLatin1String("tMP");
136 static const auto FLIGHTS_TNIGHT = QLatin1String("tNIGHT");
137 static const auto FLIGHTS_TIFR = QLatin1String("tIFR");
138 static const auto FLIGHTS_TPIC = QLatin1String("tPIC");
139 static const auto FLIGHTS_TPICUS = QLatin1String("tPICUS");
140 static const auto FLIGHTS_TSIC = QLatin1String("tSIC");
141 static const auto FLIGHTS_TDUAL = QLatin1String("tDUAL");
142 static const auto FLIGHTS_TFI = QLatin1String("tFI");
143 static const auto FLIGHTS_TSIM = QLatin1String("tSIM");
144 static const auto FLIGHTS_PILOTFLYING = QLatin1String("pilotFlying");
145 static const auto FLIGHTS_TODAY = QLatin1String("toDay");
146 static const auto FLIGHTS_TONIGHT = QLatin1String("toNight");
147 static const auto FLIGHTS_LDGDAY = QLatin1String("ldgDay");
148 static const auto FLIGHTS_LDGNIGHT = QLatin1String("ldgNight");
149 static const auto FLIGHTS_AUTOLAND = QLatin1String("autoland");
150 static const auto FLIGHTS_SECONDPILOT = QLatin1String("secondPilot");
151 static const auto FLIGHTS_THIRDPILOT = QLatin1String("thirdPilot");
152 static const auto FLIGHTS_APPROACHTYPE = QLatin1String("approachType");
153 static const auto FLIGHTS_FLIGHTNUMBER = QLatin1String("flightNumber");
154 static const auto FLIGHTS_REMARKS = QLatin1String("remarks");
155 
156 // tails table
157 
158 static const auto TAILS_REGISTRATION = QLatin1String("registration");
159 static const auto TAILS_COMPANY = QLatin1String("company");
160 static const auto TAILS_MAKE = QLatin1String("make");
161 static const auto TAILS_MODEL = QLatin1String("model");
162 static const auto TAILS_VARIANT = QLatin1String("variant");
163 static const auto TAILS_MULTIPILOT = QLatin1String("multipilot");
164 static const auto TAILS_MULTIENGINE = QLatin1String("multiengine");
165 static const auto TAILS_ENGINETYPE = QLatin1String("engineType");
166 static const auto TAILS_WEIGHTCLASS = QLatin1String("weightClass");
167 
168 // pilots table
169 
170 static const auto PILOTS_LASTNAME = QLatin1String("lastname");
171 static const auto PILOTS_FIRSTNAME = QLatin1String("firstname");
172 static const auto PILOTS_ALIAS = QLatin1String("alias");
173 static const auto PILOTS_COMPANY = QLatin1String("company");
174 static const auto PILOTS_EMPLOYEEID = QLatin1String("employeeid");
175 static const auto PILOTS_PHONE = QLatin1String("phone");
176 static const auto PILOTS_EMAIL = QLatin1String("email");
177 
178 // Currencies table
179 static const auto CURRENCIES_EXPIRYDATE = QLatin1String("expiryDate");
180 
181 // all tables
182 static const auto ROWID = QLatin1String("ROWID");
183 static const auto NULL_TIME_hhmm = QLatin1String("00:00");
184 
185 static const auto DEFAULT_FLIGHT_POSITION = DataPosition(TABLE_FLIGHTS, 0);
186 static const auto DEFAULT_PILOT_POSITION = DataPosition(TABLE_PILOTS, 0);
187 static const auto DEFAULT_TAIL_POSITION = DataPosition(TABLE_TAILS, 0);
188 static const auto DEFAULT_AIRCRAFT_POSITION = DataPosition(TABLE_AIRCRAFT, 0);
189 
190 } // namespace opl::db
191 
192 namespace Assets {
193 
194 static const auto LOGO = QLatin1String(":/icons/opl-icons/logos/logo_text.png");
195 static const auto ICON_MAIN = QLatin1String(":/icons/opl-icons/app/icon_main.png");
196 static const auto ICON_APPICON_LINUX = QLatin1String(":/icons/opl-icons/app/icon_linux.svg");
197 static const auto ICON_APPICON_IOS = QLatin1String(":/icons/opl-icons/app/icon_ios.svg");
198 static const auto ICON_APPICON_WIN = QLatin1String(":/icons/opl-icons/app/icon_windows.ico");
199 
200 static const auto ICON_TOOLBAR_HOME = QLatin1String(":/icons/opl-icons/toolbar/thick/light/icon_home.svg");
201 static const auto ICON_TOOLBAR_NEW_FLIGHT = QLatin1String(":/icons/opl-icons/toolbar/thick/light/icon_new_flight.svg");
202 static const auto ICON_TOOLBAR_LOGBOOK = QLatin1String(":/icons/opl-icons/toolbar/thick/light/icon_logbook.svg");
203 static const auto ICON_TOOLBAR_AIRCRAFT = QLatin1String(":/icons/opl-icons/toolbar/thick/light/icon_airplane.svg");
204 static const auto ICON_TOOLBAR_PILOT = QLatin1String(":/icons/opl-icons/toolbar/thick/light/icon_pilot.svg");
205 static const auto ICON_TOOLBAR_SETTINGS = QLatin1String(":/icons/opl-icons/toolbar/thick/light/icon_settings.svg");
206 static const auto ICON_TOOLBAR_QUIT = QLatin1String(":/icons/opl-icons/toolbar/thick/light/icon_exit.svg");
207 
208 static const auto ICON_TOOLBAR_BACKUP = QLatin1String(":/icons/opl-icons/toolbar/thick/light/icon_backup.svg");
209 
210 static const auto ICON_TOOLBAR_HOME_DARK = QLatin1String(":/icons/opl-icons/toolbar/thick/dark/icon_home_dm.svg");
211 static const auto ICON_TOOLBAR_NEW_FLIGHT_DARK = QLatin1String(":/icons/opl-icons/toolbar/thick/dark/icon_new_flight_dm.svg");
212 static const auto ICON_TOOLBAR_LOGBOOK_DARK = QLatin1String(":/icons/opl-icons/toolbar/thick/dark/icon_logbook_dm.svg");
213 static const auto ICON_TOOLBAR_AIRCRAFT_DARK = QLatin1String(":/icons/opl-icons/toolbar/thick/dark/icon_airplane_dm.svg");
214 static const auto ICON_TOOLBAR_PILOT_DARK = QLatin1String(":/icons/opl-icons/toolbar/thick/dark/icon_pilot_dm.svg");
215 static const auto ICON_TOOLBAR_SETTINGS_DARK = QLatin1String(":/icons/opl-icons/toolbar/thick/dark/icon_settings_dm.svg");
216 static const auto ICON_TOOLBAR_QUIT_DARK = QLatin1String(":/icons/opl-icons/toolbar/thick/dark/icon_exit_dm.svg");
217 
218 static const auto ICON_TOOLBAR_BACKUP_DARK = QLatin1String(":/icons/opl-icons/toolbar/thick/dark/icon_backup_dm.svg");
219 
220 }
221 
222 } // namespace opl
223 
224 #endif // OPLCONSTANTS_H
Opl
A namespace to collect constants and enums used throughout the application.
Definition: opl.h:39
DataPosition
Definition: adatabasetypes.h:44