Only apply collection directories changes on save
This commit is contained in:
@@ -198,6 +198,7 @@ set(SOURCES
|
|||||||
settings/settingspage.cpp
|
settings/settingspage.cpp
|
||||||
settings/behavioursettingspage.cpp
|
settings/behavioursettingspage.cpp
|
||||||
settings/collectionsettingspage.cpp
|
settings/collectionsettingspage.cpp
|
||||||
|
settings/collectionsettingsdirectorymodel.cpp
|
||||||
settings/backendsettingspage.cpp
|
settings/backendsettingspage.cpp
|
||||||
settings/playlistsettingspage.cpp
|
settings/playlistsettingspage.cpp
|
||||||
settings/scrobblersettingspage.cpp
|
settings/scrobblersettingspage.cpp
|
||||||
@@ -441,6 +442,7 @@ set(HEADERS
|
|||||||
settings/settingspage.h
|
settings/settingspage.h
|
||||||
settings/behavioursettingspage.h
|
settings/behavioursettingspage.h
|
||||||
settings/collectionsettingspage.h
|
settings/collectionsettingspage.h
|
||||||
|
settings/collectionsettingsdirectorymodel.h
|
||||||
settings/backendsettingspage.h
|
settings/backendsettingspage.h
|
||||||
settings/playlistsettingspage.h
|
settings/playlistsettingspage.h
|
||||||
settings/scrobblersettingspage.h
|
settings/scrobblersettingspage.h
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void SCollection::Init() {
|
|||||||
watcher_->set_task_manager(app_->task_manager());
|
watcher_->set_task_manager(app_->task_manager());
|
||||||
|
|
||||||
QObject::connect(&*backend_, &CollectionBackend::Error, this, &SCollection::Error);
|
QObject::connect(&*backend_, &CollectionBackend::Error, this, &SCollection::Error);
|
||||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDiscovered, watcher_, &CollectionWatcher::AddDirectory);
|
QObject::connect(&*backend_, &CollectionBackend::DirectoryAdded, watcher_, &CollectionWatcher::AddDirectory);
|
||||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, watcher_, &CollectionWatcher::RemoveDirectory);
|
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, watcher_, &CollectionWatcher::RemoveDirectory);
|
||||||
QObject::connect(&*backend_, &CollectionBackend::SongsRatingChanged, this, &SCollection::SongsRatingChanged);
|
QObject::connect(&*backend_, &CollectionBackend::SongsRatingChanged, this, &SCollection::SongsRatingChanged);
|
||||||
QObject::connect(&*backend_, &CollectionBackend::SongsStatisticsChanged, this, &SCollection::SongsPlaycountChanged);
|
QObject::connect(&*backend_, &CollectionBackend::SongsStatisticsChanged, this, &SCollection::SongsPlaycountChanged);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
@@ -162,7 +163,7 @@ void CollectionBackend::LoadDirectories() {
|
|||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
for (const CollectionDirectory &dir : dirs) {
|
for (const CollectionDirectory &dir : dirs) {
|
||||||
emit DirectoryDiscovered(dir, SubdirsInDirectory(dir.id, db));
|
emit DirectoryAdded(dir, SubdirsInDirectory(dir.id, db));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -334,38 +335,56 @@ void CollectionBackend::UpdateTotalAlbumCount() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::AddDirectory(const QString &path) {
|
void CollectionBackend::AddDirectoryAsync(const QString &path) {
|
||||||
|
QMetaObject::invokeMethod(this, "AddDirectory", Qt::QueuedConnection, Q_ARG(QString, path));
|
||||||
|
}
|
||||||
|
|
||||||
QString canonical_path = QFileInfo(path).canonicalFilePath();
|
void CollectionBackend::AddDirectory(const QString &path) {
|
||||||
QString db_path = canonical_path;
|
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
|
{
|
||||||
|
SqlQuery q(db);
|
||||||
|
q.prepare(QStringLiteral("SELECT ROWID FROM %1 WHERE path = :path").arg(dirs_table_));
|
||||||
|
q.BindValue(QStringLiteral(":path"), path);
|
||||||
|
if (!q.Exec()) {
|
||||||
|
db_->ReportErrors(q);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (q.next()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SqlQuery q(db);
|
SqlQuery q(db);
|
||||||
q.prepare(QStringLiteral("INSERT INTO %1 (path, subdirs) VALUES (:path, 1)").arg(dirs_table_));
|
q.prepare(QStringLiteral("INSERT INTO %1 (path, subdirs) VALUES (:path, 1)").arg(dirs_table_));
|
||||||
q.BindValue(QStringLiteral(":path"), db_path);
|
q.BindValue(QStringLiteral(":path"), path);
|
||||||
if (!q.Exec()) {
|
if (!q.Exec()) {
|
||||||
db_->ReportErrors(q);
|
db_->ReportErrors(q);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectionDirectory dir;
|
CollectionDirectory dir;
|
||||||
dir.path = canonical_path;
|
dir.path = path;
|
||||||
dir.id = q.lastInsertId().toInt();
|
dir.id = q.lastInsertId().toInt();
|
||||||
|
|
||||||
emit DirectoryDiscovered(dir, CollectionSubdirectoryList());
|
emit DirectoryAdded(dir, CollectionSubdirectoryList());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CollectionBackend::RemoveDirectoryAsync(const CollectionDirectory &dir) {
|
||||||
|
QMetaObject::invokeMethod(this, "RemoveDirectory", Qt::QueuedConnection, Q_ARG(CollectionDirectory, dir));
|
||||||
|
}
|
||||||
|
|
||||||
void CollectionBackend::RemoveDirectory(const CollectionDirectory &dir) {
|
void CollectionBackend::RemoveDirectory(const CollectionDirectory &dir) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
|
||||||
QSqlDatabase db(db_->Connect());
|
|
||||||
|
|
||||||
// Remove songs first
|
// Remove songs first
|
||||||
DeleteSongs(FindSongsInDirectory(dir.id));
|
DeleteSongs(FindSongsInDirectory(dir.id));
|
||||||
|
|
||||||
|
QMutexLocker l(db_->Mutex());
|
||||||
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
ScopedTransaction transaction(&db);
|
ScopedTransaction transaction(&db);
|
||||||
|
|
||||||
// Delete the subdirs that were in this directory
|
// Delete the subdirs that were in this directory
|
||||||
@@ -390,10 +409,10 @@ void CollectionBackend::RemoveDirectory(const CollectionDirectory &dir) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit DirectoryDeleted(dir);
|
|
||||||
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
|
|
||||||
|
emit DirectoryDeleted(dir);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SongList CollectionBackend::FindSongsInDirectory(const int id) {
|
SongList CollectionBackend::FindSongsInDirectory(const int id) {
|
||||||
@@ -470,7 +489,7 @@ void CollectionBackend::SongPathChanged(const Song &song, const QFileInfo &new_f
|
|||||||
// Take a song and update its path
|
// Take a song and update its path
|
||||||
Song updated_song = song;
|
Song updated_song = song;
|
||||||
updated_song.set_source(source_);
|
updated_song.set_source(source_);
|
||||||
updated_song.set_url(QUrl::fromLocalFile(new_file.absoluteFilePath()));
|
updated_song.set_url(QUrl::fromLocalFile(QDir::cleanPath(new_file.filePath())));
|
||||||
updated_song.set_basefilename(new_file.fileName());
|
updated_song.set_basefilename(new_file.fileName());
|
||||||
updated_song.InitArtManual();
|
updated_song.InitArtManual();
|
||||||
if (updated_song.is_collection_song() && new_collection_directory_id) {
|
if (updated_song.is_collection_song() && new_collection_directory_id) {
|
||||||
|
|||||||
@@ -132,8 +132,8 @@ class CollectionBackendInterface : public QObject {
|
|||||||
virtual Song GetSongByUrl(const QUrl &url, const qint64 beginning = 0) = 0;
|
virtual Song GetSongByUrl(const QUrl &url, const qint64 beginning = 0) = 0;
|
||||||
virtual Song GetSongByUrlAndTrack(const QUrl &url, const int track) = 0;
|
virtual Song GetSongByUrlAndTrack(const QUrl &url, const int track) = 0;
|
||||||
|
|
||||||
virtual void AddDirectory(const QString &path) = 0;
|
virtual void AddDirectoryAsync(const QString &path) = 0;
|
||||||
virtual void RemoveDirectory(const CollectionDirectory &dir) = 0;
|
virtual void RemoveDirectoryAsync(const CollectionDirectory &dir) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CollectionBackend : public CollectionBackendInterface {
|
class CollectionBackend : public CollectionBackendInterface {
|
||||||
@@ -206,8 +206,8 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
Song GetSongByUrl(const QUrl &url, qint64 beginning = 0) override;
|
Song GetSongByUrl(const QUrl &url, qint64 beginning = 0) override;
|
||||||
Song GetSongByUrlAndTrack(const QUrl &url, const int track) override;
|
Song GetSongByUrlAndTrack(const QUrl &url, const int track) override;
|
||||||
|
|
||||||
void AddDirectory(const QString &path) override;
|
void AddDirectoryAsync(const QString &path) override;
|
||||||
void RemoveDirectory(const CollectionDirectory &dir) override;
|
void RemoveDirectoryAsync(const CollectionDirectory &dir) override;
|
||||||
|
|
||||||
bool ExecCollectionQuery(CollectionQuery *query, SongList &songs);
|
bool ExecCollectionQuery(CollectionQuery *query, SongList &songs);
|
||||||
bool ExecCollectionQuery(CollectionQuery *query, SongMap &songs);
|
bool ExecCollectionQuery(CollectionQuery *query, SongMap &songs);
|
||||||
@@ -239,6 +239,8 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
void UpdateTotalSongCount();
|
void UpdateTotalSongCount();
|
||||||
void UpdateTotalArtistCount();
|
void UpdateTotalArtistCount();
|
||||||
void UpdateTotalAlbumCount();
|
void UpdateTotalAlbumCount();
|
||||||
|
void AddDirectory(const QString &path);
|
||||||
|
void RemoveDirectory(const CollectionDirectory &dir);
|
||||||
void AddOrUpdateSongs(const SongList &songs);
|
void AddOrUpdateSongs(const SongList &songs);
|
||||||
void UpdateSongsBySongID(const SongMap &new_songs);
|
void UpdateSongsBySongID(const SongMap &new_songs);
|
||||||
void UpdateMTimesOnly(const SongList &songs);
|
void UpdateMTimesOnly(const SongList &songs);
|
||||||
@@ -270,7 +272,7 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
void ExpireSongs(const int directory_id, const int expire_unavailable_songs_days);
|
void ExpireSongs(const int directory_id, const int expire_unavailable_songs_days);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void DirectoryDiscovered(const CollectionDirectory &dir, const CollectionSubdirectoryList &subdir);
|
void DirectoryAdded(const CollectionDirectory &dir, const CollectionSubdirectoryList &subdir);
|
||||||
void DirectoryDeleted(const CollectionDirectory &dir);
|
void DirectoryDeleted(const CollectionDirectory &dir);
|
||||||
|
|
||||||
void SongsDiscovered(const SongList &songs);
|
void SongsDiscovered(const SongList &songs);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* This file was part of Clementine.
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
|
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -44,12 +45,15 @@ CollectionDirectoryModel::CollectionDirectoryModel(SharedPtr<CollectionBackend>
|
|||||||
dir_icon_(IconLoader::Load(QStringLiteral("document-open-folder"))),
|
dir_icon_(IconLoader::Load(QStringLiteral("document-open-folder"))),
|
||||||
backend_(backend) {
|
backend_(backend) {
|
||||||
|
|
||||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDiscovered, this, &CollectionDirectoryModel::DirectoryDiscovered);
|
QObject::connect(&*backend_, &CollectionBackend::DirectoryAdded, this, &CollectionDirectoryModel::AddDirectory);
|
||||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, this, &CollectionDirectoryModel::DirectoryDeleted);
|
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, this, &CollectionDirectoryModel::RemoveDirectory);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionDirectoryModel::DirectoryDiscovered(const CollectionDirectory &dir) {
|
void CollectionDirectoryModel::AddDirectory(const CollectionDirectory &dir) {
|
||||||
|
|
||||||
|
directories_.insert(dir.id, dir);
|
||||||
|
paths_.append(dir.path);
|
||||||
|
|
||||||
QStandardItem *item = new QStandardItem(dir.path);
|
QStandardItem *item = new QStandardItem(dir.path);
|
||||||
item->setData(dir.id, kIdRole);
|
item->setData(dir.id, kIdRole);
|
||||||
@@ -59,7 +63,10 @@ void CollectionDirectoryModel::DirectoryDiscovered(const CollectionDirectory &di
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionDirectoryModel::DirectoryDeleted(const CollectionDirectory &dir) {
|
void CollectionDirectoryModel::RemoveDirectory(const CollectionDirectory &dir) {
|
||||||
|
|
||||||
|
directories_.remove(dir.id);
|
||||||
|
paths_.removeAll(dir.path);
|
||||||
|
|
||||||
for (int i = 0; i < rowCount(); ++i) {
|
for (int i = 0; i < rowCount(); ++i) {
|
||||||
if (item(i, 0)->data(kIdRole).toInt() == dir.id) {
|
if (item(i, 0)->data(kIdRole).toInt() == dir.id) {
|
||||||
@@ -71,26 +78,6 @@ void CollectionDirectoryModel::DirectoryDeleted(const CollectionDirectory &dir)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionDirectoryModel::AddDirectory(const QString &path) {
|
|
||||||
|
|
||||||
if (!backend_) return;
|
|
||||||
|
|
||||||
backend_->AddDirectory(path);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CollectionDirectoryModel::RemoveDirectory(const QModelIndex &idx) {
|
|
||||||
|
|
||||||
if (!backend_ || !idx.isValid()) return;
|
|
||||||
|
|
||||||
CollectionDirectory dir;
|
|
||||||
dir.path = idx.data().toString();
|
|
||||||
dir.id = idx.data(kIdRole).toInt();
|
|
||||||
|
|
||||||
backend_->RemoveDirectory(dir);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant CollectionDirectoryModel::data(const QModelIndex &idx, int role) const {
|
QVariant CollectionDirectoryModel::data(const QModelIndex &idx, int role) const {
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* This file was part of Clementine.
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
|
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,15 +27,17 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QMap>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
#include "core/shared_ptr.h"
|
#include "core/shared_ptr.h"
|
||||||
|
#include "collectiondirectory.h"
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
|
||||||
struct CollectionDirectory;
|
|
||||||
class CollectionBackend;
|
class CollectionBackend;
|
||||||
class MusicStorage;
|
class MusicStorage;
|
||||||
|
|
||||||
@@ -44,22 +47,24 @@ class CollectionDirectoryModel : public QStandardItemModel {
|
|||||||
public:
|
public:
|
||||||
explicit CollectionDirectoryModel(SharedPtr<CollectionBackend> collection_backend, QObject *parent = nullptr);
|
explicit CollectionDirectoryModel(SharedPtr<CollectionBackend> collection_backend, QObject *parent = nullptr);
|
||||||
|
|
||||||
// To be called by GUIs
|
|
||||||
void AddDirectory(const QString &path);
|
|
||||||
void RemoveDirectory(const QModelIndex &idx);
|
|
||||||
|
|
||||||
QVariant data(const QModelIndex &idx, int role) const override;
|
QVariant data(const QModelIndex &idx, int role) const override;
|
||||||
|
|
||||||
|
SharedPtr<CollectionBackend> backend() const { return backend_; }
|
||||||
|
|
||||||
|
QMap<int, CollectionDirectory> directories() const { return directories_; }
|
||||||
|
QStringList paths() const { return paths_; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// To be called by the backend
|
void AddDirectory(const CollectionDirectory &directory);
|
||||||
void DirectoryDiscovered(const CollectionDirectory &directories);
|
void RemoveDirectory(const CollectionDirectory &directory);
|
||||||
void DirectoryDeleted(const CollectionDirectory &directories);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int kIdRole = Qt::UserRole + 1;
|
static const int kIdRole = Qt::UserRole + 1;
|
||||||
|
|
||||||
QIcon dir_icon_;
|
QIcon dir_icon_;
|
||||||
SharedPtr<CollectionBackend> backend_;
|
SharedPtr<CollectionBackend> backend_;
|
||||||
|
QMap<int, CollectionDirectory> directories_;
|
||||||
|
QStringList paths_;
|
||||||
QList<SharedPtr<MusicStorage>> storage_;
|
QList<SharedPtr<MusicStorage>> storage_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ FilesystemDevice::FilesystemDevice(const QUrl &url, DeviceLister *lister, const
|
|||||||
watcher_->set_backend(backend_);
|
watcher_->set_backend(backend_);
|
||||||
watcher_->set_task_manager(app_->task_manager());
|
watcher_->set_task_manager(app_->task_manager());
|
||||||
|
|
||||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDiscovered, watcher_, &CollectionWatcher::AddDirectory);
|
QObject::connect(&*backend_, &CollectionBackend::DirectoryAdded, watcher_, &CollectionWatcher::AddDirectory);
|
||||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, watcher_, &CollectionWatcher::RemoveDirectory);
|
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, watcher_, &CollectionWatcher::RemoveDirectory);
|
||||||
QObject::connect(watcher_, &CollectionWatcher::NewOrUpdatedSongs, &*backend_, &CollectionBackend::AddOrUpdateSongs);
|
QObject::connect(watcher_, &CollectionWatcher::NewOrUpdatedSongs, &*backend_, &CollectionBackend::AddOrUpdateSongs);
|
||||||
QObject::connect(watcher_, &CollectionWatcher::SongsMTimeUpdated, &*backend_, &CollectionBackend::UpdateMTimesOnly);
|
QObject::connect(watcher_, &CollectionWatcher::SongsMTimeUpdated, &*backend_, &CollectionBackend::UpdateMTimesOnly);
|
||||||
|
|||||||
63
src/settings/collectionsettingsdirectorymodel.cpp
Normal file
63
src/settings/collectionsettingsdirectorymodel.cpp
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* Copyright 2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "core/iconloader.h"
|
||||||
|
#include "collectionsettingsdirectorymodel.h"
|
||||||
|
|
||||||
|
CollectionSettingsDirectoryModel::CollectionSettingsDirectoryModel(QObject *parent)
|
||||||
|
: QStandardItemModel(parent),
|
||||||
|
dir_icon_(IconLoader::Load(QStringLiteral("document-open-folder"))) {}
|
||||||
|
|
||||||
|
void CollectionSettingsDirectoryModel::AddDirectory(const QString &path) {
|
||||||
|
|
||||||
|
QStandardItem *item = new QStandardItem(path);
|
||||||
|
item->setIcon(dir_icon_);
|
||||||
|
appendRow(item);
|
||||||
|
|
||||||
|
paths_ << path;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionSettingsDirectoryModel::AddDirectories(const QStringList &paths) {
|
||||||
|
|
||||||
|
for (const QString &path : paths) {
|
||||||
|
AddDirectory(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionSettingsDirectoryModel::RemoveDirectory(const QModelIndex &idx) {
|
||||||
|
|
||||||
|
if (!idx.isValid()) return;
|
||||||
|
|
||||||
|
const QString path = data(idx).toString();
|
||||||
|
|
||||||
|
removeRow(idx.row());
|
||||||
|
|
||||||
|
if (paths_.contains(path)) {
|
||||||
|
paths_.removeAll(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
48
src/settings/collectionsettingsdirectorymodel.h
Normal file
48
src/settings/collectionsettingsdirectorymodel.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* Copyright 2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COLLECTIONSETTINGSDIRECTORYMODEL_H
|
||||||
|
#define COLLECTIONSETTINGSDIRECTORYMODEL_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
|
class CollectionSettingsDirectoryModel : public QStandardItemModel {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CollectionSettingsDirectoryModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
void AddDirectory(const QString &path);
|
||||||
|
void AddDirectories(const QStringList &paths);
|
||||||
|
void RemoveDirectory(const QModelIndex &idx);
|
||||||
|
|
||||||
|
QStringList paths() const { return paths_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QIcon dir_icon_;
|
||||||
|
QStringList paths_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COLLECTIONSETTINGSDIRECTORYMODEL_H
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* This file was part of Clementine.
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <QItemSelectionModel>
|
#include <QItemSelectionModel>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@@ -47,9 +48,12 @@
|
|||||||
#include "utilities/strutils.h"
|
#include "utilities/strutils.h"
|
||||||
#include "utilities/timeutils.h"
|
#include "utilities/timeutils.h"
|
||||||
#include "collection/collection.h"
|
#include "collection/collection.h"
|
||||||
|
#include "collection/collectionbackend.h"
|
||||||
#include "collection/collectionmodel.h"
|
#include "collection/collectionmodel.h"
|
||||||
|
#include "collection/collectiondirectory.h"
|
||||||
#include "collection/collectiondirectorymodel.h"
|
#include "collection/collectiondirectorymodel.h"
|
||||||
#include "collectionsettingspage.h"
|
#include "collectionsettingspage.h"
|
||||||
|
#include "collectionsettingsdirectorymodel.h"
|
||||||
#include "playlist/playlistdelegates.h"
|
#include "playlist/playlistdelegates.h"
|
||||||
#include "settings/settingsdialog.h"
|
#include "settings/settingsdialog.h"
|
||||||
#include "settings/settingspage.h"
|
#include "settings/settingspage.h"
|
||||||
@@ -67,6 +71,9 @@ const int CollectionSettingsPage::kSettingsDiskCacheSizeDefault = 360;
|
|||||||
CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog, QWidget *parent)
|
||||||
: SettingsPage(dialog, parent),
|
: SettingsPage(dialog, parent),
|
||||||
ui_(new Ui_CollectionSettingsPage),
|
ui_(new Ui_CollectionSettingsPage),
|
||||||
|
collection_backend_(dialog->app()->collection_backend()),
|
||||||
|
collectionsettings_directory_model_(new CollectionSettingsDirectoryModel(this)),
|
||||||
|
collection_directory_model_(dialog->collection_directory_model()),
|
||||||
initialized_model_(false) {
|
initialized_model_(false) {
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
@@ -74,7 +81,7 @@ CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog, QWidget *
|
|||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
setWindowIcon(IconLoader::Load(QStringLiteral("library-music"), true, 0, 32));
|
setWindowIcon(IconLoader::Load(QStringLiteral("library-music"), true, 0, 32));
|
||||||
ui_->add->setIcon(IconLoader::Load(QStringLiteral("document-open-folder")));
|
ui_->add_directory->setIcon(IconLoader::Load(QStringLiteral("document-open-folder")));
|
||||||
|
|
||||||
ui_->combobox_cache_size->addItem(QStringLiteral("KB"), static_cast<int>(CacheSizeUnit::KB));
|
ui_->combobox_cache_size->addItem(QStringLiteral("KB"), static_cast<int>(CacheSizeUnit::KB));
|
||||||
ui_->combobox_cache_size->addItem(QStringLiteral("MB"), static_cast<int>(CacheSizeUnit::MB));
|
ui_->combobox_cache_size->addItem(QStringLiteral("MB"), static_cast<int>(CacheSizeUnit::MB));
|
||||||
@@ -83,8 +90,8 @@ CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog, QWidget *
|
|||||||
ui_->combobox_disk_cache_size->addItem(QStringLiteral("MB"), static_cast<int>(CacheSizeUnit::MB));
|
ui_->combobox_disk_cache_size->addItem(QStringLiteral("MB"), static_cast<int>(CacheSizeUnit::MB));
|
||||||
ui_->combobox_disk_cache_size->addItem(QStringLiteral("GB"), static_cast<int>(CacheSizeUnit::GB));
|
ui_->combobox_disk_cache_size->addItem(QStringLiteral("GB"), static_cast<int>(CacheSizeUnit::GB));
|
||||||
|
|
||||||
QObject::connect(ui_->add, &QPushButton::clicked, this, &CollectionSettingsPage::Add);
|
QObject::connect(ui_->add_directory, &QPushButton::clicked, this, &CollectionSettingsPage::AddDirectory);
|
||||||
QObject::connect(ui_->remove, &QPushButton::clicked, this, &CollectionSettingsPage::Remove);
|
QObject::connect(ui_->remove_directory, &QPushButton::clicked, this, &CollectionSettingsPage::RemoveDirectory);
|
||||||
|
|
||||||
#ifdef HAVE_SONGFINGERPRINTING
|
#ifdef HAVE_SONGFINGERPRINTING
|
||||||
QObject::connect(ui_->song_tracking, &QCheckBox::toggled, this, &CollectionSettingsPage::SongTrackingToggled);
|
QObject::connect(ui_->song_tracking, &QCheckBox::toggled, this, &CollectionSettingsPage::SongTrackingToggled);
|
||||||
@@ -111,56 +118,6 @@ CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog, QWidget *
|
|||||||
|
|
||||||
CollectionSettingsPage::~CollectionSettingsPage() { delete ui_; }
|
CollectionSettingsPage::~CollectionSettingsPage() { delete ui_; }
|
||||||
|
|
||||||
void CollectionSettingsPage::Add() {
|
|
||||||
|
|
||||||
Settings s;
|
|
||||||
s.beginGroup(kSettingsGroup);
|
|
||||||
|
|
||||||
QString path(s.value("last_path", QStandardPaths::writableLocation(QStandardPaths::MusicLocation)).toString());
|
|
||||||
path = QFileDialog::getExistingDirectory(this, tr("Add directory..."), path);
|
|
||||||
|
|
||||||
if (!path.isEmpty()) {
|
|
||||||
dialog()->collection_directory_model()->AddDirectory(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
s.setValue("last_path", path);
|
|
||||||
|
|
||||||
set_changed();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CollectionSettingsPage::Remove() {
|
|
||||||
|
|
||||||
dialog()->collection_directory_model()->RemoveDirectory(ui_->list->currentIndex());
|
|
||||||
set_changed();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CollectionSettingsPage::CurrentRowChanged(const QModelIndex &idx) {
|
|
||||||
ui_->remove->setEnabled(idx.isValid());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CollectionSettingsPage::SongTrackingToggled() {
|
|
||||||
|
|
||||||
ui_->mark_songs_unavailable->setEnabled(!ui_->song_tracking->isChecked());
|
|
||||||
if (ui_->song_tracking->isChecked()) {
|
|
||||||
ui_->mark_songs_unavailable->setChecked(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CollectionSettingsPage::DiskCacheEnable(const int state) {
|
|
||||||
|
|
||||||
bool checked = state == Qt::Checked;
|
|
||||||
ui_->label_disk_cache_size->setEnabled(checked);
|
|
||||||
ui_->spinbox_disk_cache_size->setEnabled(checked);
|
|
||||||
ui_->combobox_disk_cache_size->setEnabled(checked);
|
|
||||||
ui_->label_disk_cache_in_use->setEnabled(checked);
|
|
||||||
ui_->disk_cache_in_use->setEnabled(checked);
|
|
||||||
ui_->button_clear_disk_cache->setEnabled(checked);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CollectionSettingsPage::Load() {
|
void CollectionSettingsPage::Load() {
|
||||||
|
|
||||||
if (!initialized_model_) {
|
if (!initialized_model_) {
|
||||||
@@ -168,12 +125,17 @@ void CollectionSettingsPage::Load() {
|
|||||||
QObject::disconnect(ui_->list->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &CollectionSettingsPage::CurrentRowChanged);
|
QObject::disconnect(ui_->list->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &CollectionSettingsPage::CurrentRowChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_->list->setModel(dialog()->collection_directory_model());
|
ui_->list->setModel(collectionsettings_directory_model_);
|
||||||
initialized_model_ = true;
|
initialized_model_ = true;
|
||||||
|
|
||||||
QObject::connect(ui_->list->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &CollectionSettingsPage::CurrentRowChanged);
|
QObject::connect(ui_->list->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &CollectionSettingsPage::CurrentRowChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_->list->model()->removeRows(0, ui_->list->model()->rowCount());
|
||||||
|
for (const QString &path : collection_directory_model_->paths()) {
|
||||||
|
collectionsettings_directory_model_->AddDirectory(path);
|
||||||
|
}
|
||||||
|
|
||||||
Settings s;
|
Settings s;
|
||||||
|
|
||||||
s.beginGroup(kSettingsGroup);
|
s.beginGroup(kSettingsGroup);
|
||||||
@@ -261,6 +223,69 @@ void CollectionSettingsPage::Save() {
|
|||||||
|
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
|
for (const CollectionDirectory &dir : collection_directory_model_->directories()) {
|
||||||
|
if (!collectionsettings_directory_model_->paths().contains(dir.path)) {
|
||||||
|
collection_backend_->RemoveDirectoryAsync(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const QString &path : collectionsettings_directory_model_->paths()) {
|
||||||
|
if (!collection_directory_model_->paths().contains(path)) {
|
||||||
|
collection_backend_->AddDirectoryAsync(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionSettingsPage::AddDirectory() {
|
||||||
|
|
||||||
|
Settings s;
|
||||||
|
s.beginGroup(kSettingsGroup);
|
||||||
|
|
||||||
|
QString path = s.value("last_path", QStandardPaths::writableLocation(QStandardPaths::MusicLocation)).toString();
|
||||||
|
path = QDir::cleanPath(QFileDialog::getExistingDirectory(this, tr("Add directory..."), path));
|
||||||
|
|
||||||
|
if (!path.isEmpty()) {
|
||||||
|
collectionsettings_directory_model_->AddDirectory(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
s.setValue("last_path", path);
|
||||||
|
|
||||||
|
set_changed();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionSettingsPage::RemoveDirectory() {
|
||||||
|
|
||||||
|
collectionsettings_directory_model_->RemoveDirectory(ui_->list->currentIndex());
|
||||||
|
|
||||||
|
set_changed();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionSettingsPage::CurrentRowChanged(const QModelIndex &idx) {
|
||||||
|
ui_->remove_directory->setEnabled(idx.isValid());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionSettingsPage::SongTrackingToggled() {
|
||||||
|
|
||||||
|
ui_->mark_songs_unavailable->setEnabled(!ui_->song_tracking->isChecked());
|
||||||
|
if (ui_->song_tracking->isChecked()) {
|
||||||
|
ui_->mark_songs_unavailable->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionSettingsPage::DiskCacheEnable(const int state) {
|
||||||
|
|
||||||
|
bool checked = state == Qt::Checked;
|
||||||
|
ui_->label_disk_cache_size->setEnabled(checked);
|
||||||
|
ui_->spinbox_disk_cache_size->setEnabled(checked);
|
||||||
|
ui_->combobox_disk_cache_size->setEnabled(checked);
|
||||||
|
ui_->label_disk_cache_in_use->setEnabled(checked);
|
||||||
|
ui_->disk_cache_in_use->setEnabled(checked);
|
||||||
|
ui_->button_clear_disk_cache->setEnabled(checked);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionSettingsPage::ClearPixmapDiskCache() {
|
void CollectionSettingsPage::ClearPixmapDiskCache() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* This file was part of Clementine.
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
* Copyright 2018-2024, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,8 +30,13 @@
|
|||||||
|
|
||||||
#include "settingspage.h"
|
#include "settingspage.h"
|
||||||
|
|
||||||
|
#include "core/shared_ptr.h"
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
class SettingsDialog;
|
class SettingsDialog;
|
||||||
|
class CollectionBackend;
|
||||||
|
class CollectionDirectoryModel;
|
||||||
|
class CollectionSettingsDirectoryModel;
|
||||||
class Ui_CollectionSettingsPage;
|
class Ui_CollectionSettingsPage;
|
||||||
|
|
||||||
class CollectionSettingsPage : public SettingsPage {
|
class CollectionSettingsPage : public SettingsPage {
|
||||||
@@ -61,8 +66,8 @@ class CollectionSettingsPage : public SettingsPage {
|
|||||||
void Save() override;
|
void Save() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Add();
|
void AddDirectory();
|
||||||
void Remove();
|
void RemoveDirectory();
|
||||||
|
|
||||||
void CurrentRowChanged(const QModelIndex &idx);
|
void CurrentRowChanged(const QModelIndex &idx);
|
||||||
void SongTrackingToggled();
|
void SongTrackingToggled();
|
||||||
@@ -74,6 +79,9 @@ class CollectionSettingsPage : public SettingsPage {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_CollectionSettingsPage *ui_;
|
Ui_CollectionSettingsPage *ui_;
|
||||||
|
SharedPtr<CollectionBackend> collection_backend_;
|
||||||
|
CollectionSettingsDirectoryModel *collectionsettings_directory_model_;
|
||||||
|
CollectionDirectoryModel *collection_directory_model_;
|
||||||
bool initialized_model_;
|
bool initialized_model_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>519</width>
|
<width>565</width>
|
||||||
<height>920</height>
|
<height>973</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="layout_collection_folder_buttons">
|
<layout class="QVBoxLayout" name="layout_collection_folder_buttons">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="add">
|
<widget class="QPushButton" name="add_directory">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add new folder...</string>
|
<string>Add new folder...</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="remove">
|
<widget class="QPushButton" name="remove_directory">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove folder</string>
|
<string>Remove folder</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_collection_buttons">
|
<spacer name="spacer_collection_buttons">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_expire_unavailable_songs">
|
<spacer name="spacer_expire_unavailable_songs">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -288,7 +288,7 @@ If there are no matches then it will use the largest image in the directory.</st
|
|||||||
<item row="0" column="4">
|
<item row="0" column="4">
|
||||||
<spacer name="spacer_cache_size">
|
<spacer name="spacer_cache_size">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -312,7 +312,7 @@ If there are no matches then it will use the largest image in the directory.</st
|
|||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_disk_cache">
|
<spacer name="spacer_disk_cache">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -371,7 +371,7 @@ If there are no matches then it will use the largest image in the directory.</st
|
|||||||
<item row="0" column="4">
|
<item row="0" column="4">
|
||||||
<spacer name="spacer_disk_cache_size">
|
<spacer name="spacer_disk_cache_size">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -415,7 +415,7 @@ If there are no matches then it will use the largest image in the directory.</st
|
|||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_disk_cache_in_use">
|
<spacer name="spacer_disk_cache_in_use">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -476,7 +476,7 @@ If there are no matches then it will use the largest image in the directory.</st
|
|||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_save_stats">
|
<spacer name="spacer_save_stats">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
@@ -502,8 +502,8 @@ If there are no matches then it will use the largest image in the directory.</st
|
|||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>list</tabstop>
|
<tabstop>list</tabstop>
|
||||||
<tabstop>add</tabstop>
|
<tabstop>add_directory</tabstop>
|
||||||
<tabstop>remove</tabstop>
|
<tabstop>remove_directory</tabstop>
|
||||||
<tabstop>startup_scan</tabstop>
|
<tabstop>startup_scan</tabstop>
|
||||||
<tabstop>monitor</tabstop>
|
<tabstop>monitor</tabstop>
|
||||||
<tabstop>song_tracking</tabstop>
|
<tabstop>song_tracking</tabstop>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ TEST_F(CollectionBackendTest, EmptyDatabase) {
|
|||||||
|
|
||||||
TEST_F(CollectionBackendTest, AddDirectory) {
|
TEST_F(CollectionBackendTest, AddDirectory) {
|
||||||
|
|
||||||
QSignalSpy spy(&*backend_, &CollectionBackend::DirectoryDiscovered);
|
QSignalSpy spy(&*backend_, &CollectionBackend::DirectoryAdded);
|
||||||
|
|
||||||
backend_->AddDirectory(QStringLiteral("/tmp"));
|
backend_->AddDirectory(QStringLiteral("/tmp"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user