1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.core.standardpaths;
15 extern(C++):
16
17 import qt.config;
18 import qt.helpers;
19 static if(!defined!"QT_NO_STANDARDPATHS")
20 {
21 import qt.core.flags;
22 import qt.core.objectdefs;
23 import qt.core.string;
24 import qt.core.stringlist;
25 }
26
27 static if(!defined!"QT_NO_STANDARDPATHS")
28 {
29
30 abstract class /+ Q_CORE_EXPORT +/ QStandardPaths
31 {
32 mixin(Q_GADGET);
33
34 public:
35 // Do not re-order, must match QDesktopServices
36 enum StandardLocation {
37 DesktopLocation,
38 DocumentsLocation,
39 FontsLocation,
40 ApplicationsLocation,
41 MusicLocation,
42 MoviesLocation,
43 PicturesLocation,
44 TempLocation,
45 HomeLocation,
46 DataLocation,
47 CacheLocation,
48 GenericDataLocation,
49 RuntimeLocation,
50 ConfigLocation,
51 DownloadLocation,
52 GenericCacheLocation,
53 GenericConfigLocation,
54 AppDataLocation,
55 AppConfigLocation,
56 AppLocalDataLocation = StandardLocation.DataLocation
57 }
58 /+ Q_ENUM(StandardLocation) +/
59
60 static QString writableLocation(StandardLocation type);
61 static QStringList standardLocations(StandardLocation type);
62
63 enum LocateOption {
64 LocateFile = 0x0,
65 LocateDirectory = 0x1
66 }
67 /+ Q_DECLARE_FLAGS(LocateOptions, LocateOption) +/
68 alias LocateOptions = QFlags!(LocateOption); /+ Q_FLAG(LocateOptions) +/
69
70 static QString locate(StandardLocation type, ref const(QString) fileName, LocateOptions options = LocateOption.LocateFile);
71 static QStringList locateAll(StandardLocation type, ref const(QString) fileName, LocateOptions options = LocateOption.LocateFile);
72 /+ #ifndef QT_BOOTSTRAPPED +/
73 static QString displayName(StandardLocation type);
74 /+ #endif +/
75
76 static QString findExecutable(ref const(QString) executableName, ref const(QStringList) paths = globalInitVar!QStringList);
77
78 /+ #if QT_DEPRECATED_SINCE(5, 2) +/
79 /+ QT_DEPRECATED +/ static void enableTestMode(bool testMode);
80 /+ #endif +/
81 static void setTestModeEnabled(bool testMode);
82 static bool isTestModeEnabled();
83
84 private:
85 // prevent construction
86 @disable this();
87 //@disable ~this();
88 }
89 /+pragma(inline, true) QFlags!(QStandardPaths.LocateOptions.enum_type) operator |(QStandardPaths.LocateOptions.enum_type f1, QStandardPaths.LocateOptions.enum_type f2)/+noexcept+/{return QFlags!(QStandardPaths.LocateOptions.enum_type)(f1)|f2;}+/
90 /+pragma(inline, true) QFlags!(QStandardPaths.LocateOptions.enum_type) operator |(QStandardPaths.LocateOptions.enum_type f1, QFlags!(QStandardPaths.LocateOptions.enum_type) f2)/+noexcept+/{return f2|f1;}+/
91 /+pragma(inline, true) QIncompatibleFlag operator |(QStandardPaths.LocateOptions.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/
92
93 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions) +/
94 }
95