openPilotLog
astandardpaths.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 ASTANDARDPATHS_H
19 #define ASTANDARDPATHS_H
20 
21 #include <QStandardPaths>
22 #include <QString>
23 #include <QMap>
24 #include <QDir>
25 
31 public:
32  enum Directories {
33  Database,
34  Templates,
35  Backup,
36  Log
37  };
38 private:
39  static QMap<Directories, QDir> directories;
40 
45  static bool scan_directories();
46 
47 public:
51  static bool setup();
52 
57  static const QDir &directory(Directories location);
58 
62  static const QString asChildOfDir(Directories location, const QString& filename);
67  static const QMap<Directories, QDir> &allDirectories();
68 };
69 
70 
71 #endif // ASTANDARDPATHS_H
AStandardPaths::directory
static const QDir & directory(Directories location)
Returns the QDir for the standard directory referenced by the Directories enum 'loc'.
Definition: astandardpaths.cpp:41
AStandardPaths::setup
static bool setup()
Creates and verifies a static map of the standard paths used in the app.
Definition: astandardpaths.cpp:23
AStandardPaths::allDirectories
static const QMap< Directories, QDir > & allDirectories()
returns the static map of all standard directories
Definition: astandardpaths.cpp:51
AStandardPaths::asChildOfDir
static const QString asChildOfDir(Directories location, const QString &filename)
Returns a string of the absolute path to directory location concatenated with filename.
Definition: astandardpaths.cpp:46
AStandardPaths
The AStandardAppPaths class encapsulates a static QMap holding the standard paths of the application.
Definition: astandardpaths.h:30