Formatting and remove unused icons
This commit is contained in:
@@ -109,12 +109,14 @@ void CollectionBackend::ChangeDirPath(int id, const QString &old_path, const QSt
|
||||
ScopedTransaction t(&db);
|
||||
|
||||
// Do the dirs table
|
||||
QSqlQuery q(db);
|
||||
q.prepare(QString("UPDATE %1 SET path=:path WHERE ROWID=:id").arg(dirs_table_));
|
||||
q.bindValue(":path", new_path);
|
||||
q.bindValue(":id", id);
|
||||
q.exec();
|
||||
if (db_->CheckErrors(q)) return;
|
||||
{
|
||||
QSqlQuery q(db);
|
||||
q.prepare(QString("UPDATE %1 SET path=:path WHERE ROWID=:id").arg(dirs_table_));
|
||||
q.bindValue(":path", new_path);
|
||||
q.bindValue(":id", id);
|
||||
q.exec();
|
||||
if (db_->CheckErrors(q)) return;
|
||||
}
|
||||
|
||||
const QByteArray old_url = QUrl::fromLocalFile(old_path).toEncoded();
|
||||
const QByteArray new_url = QUrl::fromLocalFile(new_path).toEncoded();
|
||||
@@ -122,20 +124,24 @@ void CollectionBackend::ChangeDirPath(int id, const QString &old_path, const QSt
|
||||
const int path_len = old_url.length();
|
||||
|
||||
// Do the subdirs table
|
||||
q = QSqlQuery(db);
|
||||
q.prepare(QString("UPDATE %1 SET path=:path || substr(path, %2) WHERE directory=:id").arg(subdirs_table_).arg(path_len));
|
||||
q.bindValue(":path", new_url);
|
||||
q.bindValue(":id", id);
|
||||
q.exec();
|
||||
if (db_->CheckErrors(q)) return;
|
||||
{
|
||||
QSqlQuery q(db);
|
||||
q.prepare(QString("UPDATE %1 SET path=:path || substr(path, %2) WHERE directory=:id").arg(subdirs_table_).arg(path_len));
|
||||
q.bindValue(":path", new_url);
|
||||
q.bindValue(":id", id);
|
||||
q.exec();
|
||||
if (db_->CheckErrors(q)) return;
|
||||
}
|
||||
|
||||
// Do the songs table
|
||||
q = QSqlQuery(db);
|
||||
q.prepare(QString("UPDATE %1 SET filename=:path || substr(filename, %2) WHERE directory=:id").arg(songs_table_).arg(path_len));
|
||||
q.bindValue(":path", new_url);
|
||||
q.bindValue(":id", id);
|
||||
q.exec();
|
||||
if (db_->CheckErrors(q)) return;
|
||||
{
|
||||
QSqlQuery q(db);
|
||||
q.prepare(QString("UPDATE %1 SET filename=:path || substr(filename, %2) WHERE directory=:id").arg(songs_table_).arg(path_len));
|
||||
q.bindValue(":path", new_url);
|
||||
q.bindValue(":id", id);
|
||||
q.exec();
|
||||
if (db_->CheckErrors(q)) return;
|
||||
}
|
||||
|
||||
t.Commit();
|
||||
|
||||
|
||||
@@ -182,6 +182,7 @@ void CollectionModel::Init(bool async) {
|
||||
void CollectionModel::SongsDiscovered(const SongList &songs) {
|
||||
|
||||
for (const Song &song : songs) {
|
||||
|
||||
// Sanity check to make sure we don't add songs that are outside the user's filter
|
||||
if (!query_options_.Matches(song)) continue;
|
||||
|
||||
@@ -256,7 +257,6 @@ void CollectionModel::SongsDiscovered(const SongList &songs) {
|
||||
// If we just created the damn thing then we don't need to continue into it any further because it'll get lazy-loaded properly later.
|
||||
if (!container->lazy_loaded) break;
|
||||
}
|
||||
|
||||
if (!container->lazy_loaded) continue;
|
||||
|
||||
// We've gone all the way down to the deepest level and everything was already lazy loaded, so now we have to create the song in the container.
|
||||
@@ -1148,6 +1148,7 @@ CollectionItem *CollectionModel::ItemFromSong(GroupBy type, bool signal, bool cr
|
||||
|
||||
FinishItem(type, signal, create_divider, parent, item);
|
||||
if (s.url().scheme() == "cdda") item->lazy_loaded = true;
|
||||
|
||||
return item;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user