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