| 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 | StateLocation, |
| 43 | GenericStateLocation, |
| 44 | }; |
| 45 | Q_ENUM(StandardLocation) |
| 46 | |
| 47 | static QString writableLocation(StandardLocation type); |
| 48 | static QStringList standardLocations(StandardLocation type); |
| 49 | |
| 50 | enum LocateOption { |
| 51 | LocateFile = 0x0, |
| 52 | LocateDirectory = 0x1 |
| 53 | }; |
| 54 | Q_DECLARE_FLAGS(LocateOptions, LocateOption) |
| 55 | Q_FLAG(LocateOptions) |
| 56 | |
| 57 | static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile); |
| 58 | static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile); |
| 59 | #ifndef QT_BOOTSTRAPPED |
| 60 | static QString displayName(StandardLocation type); |
| 61 | #endif |
| 62 | |
| 63 | static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList()); |
| 64 | |
| 65 | static void setTestModeEnabled(bool testMode); |
| 66 | static bool isTestModeEnabled(); |
| 67 | |
| 68 | private: |
| 69 | // prevent construction |
| 70 | QStandardPaths(); |
| 71 | ~QStandardPaths(); |
| 72 | }; |
| 73 | |
| 74 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions) |
| 75 | |
| 76 | #endif // QT_NO_STANDARDPATHS |
| 77 | |
| 78 | QT_END_NAMESPACE |
| 79 | |
| 80 | #endif // QSTANDARDPATHS_H |
| 81 | |