openPilotLog
paths.h
1 #ifndef PATHS_H
2 #define PATHS_H
3 
4 #include <QCoreApplication>
5 #include <QDir>
6 #include <QHash>
7 
8 
9 namespace OPL {
10 
11 
12 class Paths
13 {
14 public:
15  enum Directories {
16  Database,
17  Templates,
18  Backup,
19  Log,
20  Export,
21  };
22 
23  const static inline QHash<Directories, QLatin1String> directories = {
24  {Database, QLatin1String("/database")},
25  {Templates, QLatin1String("/templates")},
26  {Backup, QLatin1String("/backup")},
27  {Log, QLatin1String("/log")},
28  {Export, QLatin1String("/export")},
29  };
30 
31  Paths();
32 
33  static const bool setup();
34 
39  static const QDir directory(Directories location);
40 
41  static const QString path(Directories location);
42 
43  static const QString appDir() {return QCoreApplication::applicationDirPath();}
44 
45  static const QString filePath(Directories location, const QString &filename);
46 
50  static const QFileInfo databaseFileInfo();
51 };
52 
53 
54 } // namespace OPL
55 #endif // PATHS_H
The DB class encapsulates the SQL database by providing fast access to hot database data.
Definition: database.h:57
Definition: paths.h:13
static const QFileInfo databaseFileInfo()
returns a QFileInfo for the default database file.
Definition: paths.cpp:39
static const QDir directory(Directories location)
Returns the QDir for the standard directory referenced by the Directories enum 'loc'.
Definition: paths.cpp:23
A namespace to collect constants and enums used throughout the application.
Definition: paths.cpp:3