1 | // Copyright (C) 2020 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QSTANDARDPATHS_H |
5 | #define QSTANDARDPATHS_H |
6 | |
7 | #include <QtCore/qstringlist.h> |
8 | #include <QtCore/qobjectdefs.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | |
13 | #ifndef QT_NO_STANDARDPATHS |
14 | |
15 | class Q_CORE_EXPORT QStandardPaths |
16 | { |
17 | Q_GADGET |
18 | |
19 | public: |
20 | enum StandardLocation { |
21 | DesktopLocation, |
22 | DocumentsLocation, |
23 | FontsLocation, |
24 | ApplicationsLocation, |
25 | MusicLocation, |
26 | MoviesLocation, |
27 | PicturesLocation, |
28 | TempLocation, |
29 | HomeLocation, |
30 | AppLocalDataLocation, |
31 | CacheLocation, |
32 | GenericDataLocation, |
33 | RuntimeLocation, |
34 | ConfigLocation, |
35 | DownloadLocation, |
36 | GenericCacheLocation, |
37 | GenericConfigLocation, |
38 | AppDataLocation, |
39 | AppConfigLocation, |
40 | PublicShareLocation, |
41 | TemplatesLocation |
42 | }; |
43 | Q_ENUM(StandardLocation) |
44 | |
45 | static QString writableLocation(StandardLocation type); |
46 | static QStringList standardLocations(StandardLocation type); |
47 | |
48 | enum LocateOption { |
49 | LocateFile = 0x0, |
50 | LocateDirectory = 0x1 |
51 | }; |
52 | Q_DECLARE_FLAGS(LocateOptions, LocateOption) |
53 | Q_FLAG(LocateOptions) |
54 | |
55 | static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile); |
56 | static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile); |
57 | #ifndef QT_BOOTSTRAPPED |
58 | static QString displayName(StandardLocation type); |
59 | #endif |
60 | |
61 | static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList()); |
62 | |
63 | static void setTestModeEnabled(bool testMode); |
64 | static bool isTestModeEnabled(); |
65 | |
66 | private: |
67 | // prevent construction |
68 | QStandardPaths(); |
69 | ~QStandardPaths(); |
70 | }; |
71 | |
72 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions) |
73 | |
74 | #endif // QT_NO_STANDARDPATHS |
75 | |
76 | QT_END_NAMESPACE |
77 | |
78 | #endif // QSTANDARDPATHS_H |
79 | |