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