dbcompletiondata.h
/*
*openPilotLog - A FOSS Pilot Logbook Application
*Copyright (C) 2020-2022 Felix Turowsky
*
*This program is free software: you can redistribute it and/or modify
*it under the terms of the GNU General Public License as published by
*the Free Software Foundation, either version 3 of the License, or
*(at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*GNU General Public License for more details.
*
*You should have received a copy of the GNU General Public License
*along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef DBCOMPLETIONDATA_H
#define DBCOMPLETIONDATA_H
namespace OPL {
enum class CompleterTarget
{
AirportIdentifierICAO,
AirportIdentifierIATA,
AirportIdentifier,
AirportNames,
Registrations,
Companies,
PilotNames,
AircraftTypes
};
class DbCompletionData
{
public:
void init();
void update();
void updateTails();
void updatePilots();
void updateAirports();
// Maps for input mapping DB key - user input
QHash<int, QString> pilotsIdMap;
QHash<int, QString> tailsIdMap;
QHash<int, QString> airportIcaoIdMap;
QHash<int, QString> airportIataIdMap;
QHash<int, QString> airportNameIdMap;
// Lists for QCompleter
QStringList pilotList;
QStringList tailsList;
QStringList airportList;
static const QStringList getCompletionList(CompleterTarget target);
static const QHash<int, QString> getIdMap(CompleterTarget target);
};
} // namespace OPL
#endif // DBCOMPLETIONDATA_H
OPL::DbCompletionData
Provides data for QCompleters and QHashs.
Definition: dbcompletiondata.h:48
OPL::DbCompletionData::init
void init()
init Retrieves Data and populates Lists and Maps
Definition: dbcompletiondata.cpp:24
OPL::DbCompletionData::getIdMap
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:124
OPL::DbCompletionData::getCompletionList
static const QStringList getCompletionList(CompleterTarget target)
getCompletionList returns a QStringList of values for a QCompleter based on database values
Definition: dbcompletiondata.cpp:81
OPL::DbCompletionData::update
void update()
updates data from the user modifiable tables
Definition: dbcompletiondata.cpp:50
OPL
A namespace to collect constants and enums used throughout the application.
Definition: paths.cpp:3
OPL::CompleterTarget
CompleterTarget
The DatabaseTarget enum lists database items that are used by completers, for content matching or nee...
Definition: dbcompletiondata.h:28