StandardPaths: Remove inheritance
This commit is contained in:
@@ -78,7 +78,7 @@ Database::Database(SharedPtr<TaskManager> task_manager, QObject *parent, const Q
|
||||
connection_id_ = sNextConnectionId++;
|
||||
}
|
||||
|
||||
directory_ = QDir::toNativeSeparators(StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation)).replace(u"Strawberry"_s, u"strawberry"_s);
|
||||
directory_ = QDir::toNativeSeparators(StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation)).replace(u"Strawberry"_s, u"strawberry"_s);
|
||||
|
||||
QMutexLocker l(&mutex_);
|
||||
Connect();
|
||||
|
||||
@@ -51,7 +51,7 @@ void IconLoader::Init() {
|
||||
#endif
|
||||
|
||||
QDir dir;
|
||||
if (dir.exists(StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/icons"_s)) {
|
||||
if (dir.exists(StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/icons"_s)) {
|
||||
custom_icons_ = true;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ QIcon IconLoader::Load(const QString &name, const bool system_icon, const int fi
|
||||
}
|
||||
|
||||
if (custom_icons_) {
|
||||
QString custom_icon_path = StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/icons/%1x%2/%3.png"_s;
|
||||
QString custom_icon_path = StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/icons/%1x%2/%3.png"_s;
|
||||
for (int s : std::as_const(sizes)) {
|
||||
QString filename(custom_icon_path.arg(s).arg(s).arg(name));
|
||||
if (QFile::exists(filename)) ret.addFile(filename, QSize(s, s));
|
||||
|
||||
@@ -1335,24 +1335,24 @@ QString Song::ImageCacheDir(const Source source) {
|
||||
|
||||
switch (source) {
|
||||
case Source::Collection:
|
||||
return StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/collectionalbumcovers"_s;
|
||||
return StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/collectionalbumcovers"_s;
|
||||
case Source::Subsonic:
|
||||
return StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/subsonicalbumcovers"_s;
|
||||
return StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/subsonicalbumcovers"_s;
|
||||
case Source::Tidal:
|
||||
return StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/tidalalbumcovers"_s;
|
||||
return StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/tidalalbumcovers"_s;
|
||||
case Source::Spotify:
|
||||
return StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/spotifyalbumcovers"_s;
|
||||
return StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/spotifyalbumcovers"_s;
|
||||
case Source::Qobuz:
|
||||
return StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/qobuzalbumcovers"_s;
|
||||
return StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/qobuzalbumcovers"_s;
|
||||
case Source::Device:
|
||||
return StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/devicealbumcovers"_s;
|
||||
return StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/devicealbumcovers"_s;
|
||||
case Source::LocalFile:
|
||||
case Source::CDDA:
|
||||
case Source::Stream:
|
||||
case Source::SomaFM:
|
||||
case Source::RadioParadise:
|
||||
case Source::Unknown:
|
||||
return StandardPaths::WritableLocation(StandardPaths::AppLocalDataLocation) + u"/albumcovers"_s;
|
||||
return StandardPaths::WritableLocation(StandardPaths::StandardLocation::AppLocalDataLocation) + u"/albumcovers"_s;
|
||||
}
|
||||
|
||||
return QString();
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
|
||||
#include <QStandardPaths>
|
||||
|
||||
class StandardPaths : public QStandardPaths {
|
||||
class StandardPaths {
|
||||
Q_GADGET
|
||||
|
||||
public:
|
||||
using StandardLocation = QStandardPaths::StandardLocation;
|
||||
static QString WritableLocation(const StandardLocation type);
|
||||
static QString writableLocation(const StandardLocation type) = delete;
|
||||
|
||||
private:
|
||||
static void AppendOrganizationAndApplication(QString &path);
|
||||
|
||||
@@ -48,9 +48,9 @@ ThreadSafeNetworkDiskCache::ThreadSafeNetworkDiskCache(QObject *parent) : QAbstr
|
||||
if (!sCache) {
|
||||
sCache = new QNetworkDiskCache;
|
||||
#ifdef Q_OS_WIN32
|
||||
sCache->setCacheDirectory(StandardPaths::WritableLocation(StandardPaths::TempLocation) + u"/strawberry/networkcache"_s);
|
||||
sCache->setCacheDirectory(StandardPaths::WritableLocation(StandardPaths::StandardLocation::TempLocation) + u"/strawberry/networkcache"_s);
|
||||
#else
|
||||
sCache->setCacheDirectory(StandardPaths::WritableLocation(StandardPaths::CacheLocation) + u"/networkcache"_s);
|
||||
sCache->setCacheDirectory(StandardPaths::WritableLocation(StandardPaths::StandardLocation::CacheLocation) + u"/networkcache"_s);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user