openPilotLog
dbcompletiondata.h
1 #ifndef DBCOMPLETIONDATA_H
2 #define DBCOMPLETIONDATA_H
3 
4 #include "src/database/database.h"
5 
6 namespace OPL {
7 
12 enum class CompleterTarget
13 {
14  AirportIdentifierICAO,
15  AirportIdentifierIATA,
16  AirportIdentifier,
17  AirportNames,
18  Registrations,
19  Companies,
20  PilotNames,
21  AircraftTypes
22 };
23 
33 {
34 public:
38  void init();
39 
43  void update();
44  void updateTails();
45  void updatePilots();
46 
47 
48  // Maps for input mapping DB key - user input
49  QHash<int, QString> pilotsIdMap;
50  QHash<int, QString> tailsIdMap;
51  QHash<int, QString> airportIcaoIdMap;
52  QHash<int, QString> airportIataIdMap;
53  QHash<int, QString> airportNameIdMap;
54  // Lists for QCompleter
55  QStringList pilotList;
56  QStringList tailsList;
57  QStringList airportList;
58  // User Data State to trigger update if needed
59  UserDataState current_state;
60 
65  static const QStringList getCompletionList(CompleterTarget target);
66 
71  static const QHash<int, QString> getIdMap(CompleterTarget target);
72 };
73 
74 } // namespace OPL
75 
76 #endif // DBCOMPLETIONDATA_H
Provides data for QCompleters and QHashs.
Definition: dbcompletiondata.h:33
void init()
init Retrieves Data and populates Lists and Maps
Definition: dbcompletiondata.cpp:5
static const QHash< int, QString > getIdMap(CompleterTarget target)
returns a QHash of a human-readable database value and its row id. Used in the Dialogs to map user in...
Definition: dbcompletiondata.cpp:101
static const QStringList getCompletionList(CompleterTarget target)
getCompletionList returns a QStringList of values for a QCompleter based on database values
Definition: dbcompletiondata.cpp:58
void update()
updates data from the user modifiable tables
Definition: dbcompletiondata.cpp:33
A namespace to collect constants and enums used throughout the application.
Definition: database.cpp:25
CompleterTarget
The DatabaseTarget enum lists database items that are used by completers, for content matching or nee...
Definition: dbcompletiondata.h:13
The UserDateState struct caches the current number of entries in relevant database tables for fast ac...
Definition: database.h:57