openPilotLog
dbsummary.h
1 #ifndef DBSUMMARY_H
2 #define DBSUMMARY_H
3 
4 #include "src/database/database.h"
5 
6 namespace OPL {
7 
11 enum class DbSummaryKey {
12  total_flights,
13  total_tails,
14  total_pilots,
15  last_flight,
16  total_time,
17 };
18 
27 class DbSummary : public QObject
28 {
29 public:
30  DbSummary() = default;
31 
40  static const QMap<DbSummaryKey, QString> databaseSummary(const QString& db_path);
41 
45  static const QString summaryString(const QString& db_path);
46 
47 private:
48  Q_OBJECT
49  inline const static QString SQLITE_DRIVER = QStringLiteral("QSQLITE");
50 
51 };
52 
53 
54 } // namespace OPL
55 
56 #endif // DBSUMMARY_H
The DbSummary class collects summaries of entries and relevant data from the database.
Definition: dbsummary.h:28
static const QString summaryString(const QString &db_path)
returns a short summary string of the database, containing total time and date of last flight.
Definition: dbsummary.cpp:66
static const QMap< DbSummaryKey, QString > databaseSummary(const QString &db_path)
Return a summary of a database.
Definition: dbsummary.cpp:5
A namespace to collect constants and enums used throughout the application.
Definition: database.cpp:25
DbSummaryKey
Enumerates the QHash keys used when summarising a database.
Definition: dbsummary.h:11