qad_locations

This commit is contained in:
2020-05-16 10:02:44 +03:00
parent 30d1faff9a
commit 9db04f5aa0
2 changed files with 8 additions and 8 deletions

View File

@@ -17,21 +17,21 @@
QString QAD::userPath(QAD::LocationType loc, QString name) {
QString dir, ext;
switch (loc) {
case ctConfig: ext = ".conf"; break;
case ctCache : ext = ".cache"; break;
case ltConfig: ext = ".conf"; break;
case ltCache : ext = ".cache"; break;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QStandardPaths::StandardLocation l = QStandardPaths::AppConfigLocation;
switch (loc) {
case ctConfig: l = QStandardPaths::AppConfigLocation; break;
case ctCache : l = QStandardPaths::CacheLocation; break;
case ltConfig: l = QStandardPaths::AppConfigLocation; break;
case ltCache : l = QStandardPaths::CacheLocation; break;
}
dir = QStandardPaths::writableLocation(l);
#else
QDesktopServices::StandardLocation l = QDesktopServices::DataLocation;
switch (loc) {
case ctConfig: l = QDesktopServices::DataLocation; break;
case ctCache : l = QDesktopServices::CacheLocation; break;
case ltConfig: l = QDesktopServices::DataLocation; break;
case ltCache : l = QDesktopServices::CacheLocation; break;
}
dir = QDesktopServices::storageLocation(l);
#endif

View File

@@ -27,8 +27,8 @@
namespace QAD {
enum QAD_EXPORT LocationType {
ctConfig,
ctCache,
ltConfig,
ltCache,
};
//! Create QStandardPaths::writableLocation(<loc>) directory