Code review comments from r2370.
This commit is contained in:
parent
3a19bb9d46
commit
4c66007e26
|
@ -44,7 +44,7 @@ AlbumCoverLoader::AlbumCoverLoader(QObject* parent)
|
|||
}
|
||||
|
||||
QString AlbumCoverLoader::ImageCacheDir() {
|
||||
return Utilities::GetConfigPath(Utilities::ALBUM_COVERS);
|
||||
return Utilities::GetConfigPath(Utilities::Path_AlbumCovers);
|
||||
}
|
||||
|
||||
void AlbumCoverLoader::Clear() {
|
||||
|
|
|
@ -334,7 +334,7 @@ Database::Database(QObject* parent, const QString& database_name)
|
|||
}
|
||||
|
||||
directory_ = QDir::toNativeSeparators(
|
||||
Utilities::GetConfigPath(Utilities::ROOT));
|
||||
Utilities::GetConfigPath(Utilities::Path_Root));
|
||||
|
||||
attached_databases_["jamendo"] = AttachedDatabase(
|
||||
directory_ + "/jamendo.db", ":/schema/jamendo.sql");
|
||||
|
|
|
@ -232,7 +232,9 @@ bool MigrateLegacyConfigFiles() {
|
|||
if (!QFile::exists(old_config_dir)) {
|
||||
return false;
|
||||
}
|
||||
QString new_config_dir = Utilities::GetConfigPath(Utilities::ROOT);
|
||||
QString new_config_dir = Utilities::GetConfigPath(Utilities::Path_Root);
|
||||
// Create ~/Library/Application Support which should already exist anyway.
|
||||
QDir::root().mkpath(GetApplicationSupportPath());
|
||||
|
||||
qDebug() << "Move from:" << old_config_dir
|
||||
<< "to:" << new_config_dir;
|
||||
|
|
|
@ -201,7 +201,7 @@ QString ColorToRgba(const QColor& c) {
|
|||
|
||||
QString GetConfigPath(ConfigPath config) {
|
||||
switch (config) {
|
||||
case ROOT: {
|
||||
case Path_Root: {
|
||||
#ifdef Q_OS_DARWIN
|
||||
return mac::GetApplicationSupportPath() + "/" + QCoreApplication::organizationName();
|
||||
#else
|
||||
|
@ -210,14 +210,14 @@ QString GetConfigPath(ConfigPath config) {
|
|||
}
|
||||
break;
|
||||
|
||||
case ALBUM_COVERS:
|
||||
return GetConfigPath(ROOT) + "/albumcovers";
|
||||
case Path_AlbumCovers:
|
||||
return GetConfigPath(Path_Root) + "/albumcovers";
|
||||
|
||||
case NETWORK_CACHE:
|
||||
return GetConfigPath(ROOT) + "/networkcache";
|
||||
case Path_NetworkCache:
|
||||
return GetConfigPath(Path_Root) + "/networkcache";
|
||||
|
||||
case GSTREAMER_REGISTRY:
|
||||
return GetConfigPath(ROOT) +
|
||||
case Path_GstreamerRegistry:
|
||||
return GetConfigPath(Path_Root) +
|
||||
QString("/gst-registry-%1-bin").arg(QCoreApplication::applicationVersion());
|
||||
|
||||
default:
|
||||
|
|
|
@ -43,10 +43,10 @@ namespace Utilities {
|
|||
|
||||
|
||||
enum ConfigPath {
|
||||
ROOT,
|
||||
ALBUM_COVERS,
|
||||
NETWORK_CACHE,
|
||||
GSTREAMER_REGISTRY,
|
||||
Path_Root,
|
||||
Path_AlbumCovers,
|
||||
Path_NetworkCache,
|
||||
Path_GstreamerRegistry,
|
||||
};
|
||||
QString GetConfigPath(ConfigPath config);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ bool GstEngine::Init() {
|
|||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
|
||||
registry_filename = Utilities::GetConfigPath(Utilities::GSTREAMER_REGISTRY);
|
||||
registry_filename = Utilities::GetConfigPath(Utilities::Path_GstreamerRegistry);
|
||||
#endif
|
||||
|
||||
if (!scanner_path.isEmpty())
|
||||
|
|
|
@ -112,14 +112,15 @@ int main(int argc, char *argv[]) {
|
|||
if (mac::MigrateLegacyConfigFiles()) {
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
db.setDatabaseName(Utilities::GetConfigPath(
|
||||
Utilities::ROOT) + "/" + Database::kDatabaseFilename);
|
||||
Utilities::Path_Root) + "/" + Database::kDatabaseFilename);
|
||||
db.open();
|
||||
QSqlQuery query(
|
||||
"UPDATE songs SET art_manual = replace("
|
||||
"art_manual, '.config', 'Library/Application Support') "
|
||||
"WHERE art_manual LIKE '%.config%';", db);
|
||||
"WHERE art_manual LIKE '%.config%'", db);
|
||||
query.exec();
|
||||
db.close();
|
||||
QSqlDatabase::removeDatabase(db.connectionName());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue