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