Fix various clazy warnings
This commit is contained in:
parent
20c1c1d4be
commit
78588d8cdf
@ -194,7 +194,8 @@ void AnalyzerContainer::Load() {
|
||||
for (int i = 0; i < framerate_list_.count(); ++i) {
|
||||
if (current_framerate_ == framerate_list_[i]) {
|
||||
ChangeFramerate(current_framerate_);
|
||||
group_framerate_->actions()[i]->setChecked(true);
|
||||
QList<QAction*> actions = group_framerate_->actions();
|
||||
actions[i]->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +303,8 @@ void CollectionFilterWidget::SetCollectionModel(CollectionModel *model) {
|
||||
QObject::disconnect(model_, nullptr, this, nullptr);
|
||||
QObject::disconnect(model_, nullptr, group_by_dialog_.get(), nullptr);
|
||||
QObject::disconnect(group_by_dialog_.get(), nullptr, model_, nullptr);
|
||||
for (QAction *action : filter_ages_.keys()) {
|
||||
QList<QAction*> filter_ages = filter_ages_.keys();
|
||||
for (QAction *action : filter_ages) {
|
||||
QObject::disconnect(action, &QAction::triggered, model_, nullptr);
|
||||
}
|
||||
}
|
||||
@ -315,7 +316,8 @@ void CollectionFilterWidget::SetCollectionModel(CollectionModel *model) {
|
||||
QObject::connect(model_, &CollectionModel::GroupingChanged, this, &CollectionFilterWidget::GroupingChanged);
|
||||
QObject::connect(group_by_dialog_.get(), &GroupByDialog::Accepted, model_, &CollectionModel::SetGroupBy);
|
||||
|
||||
for (QAction *action : filter_ages_.keys()) {
|
||||
QList<QAction*> filter_ages = filter_ages_.keys();
|
||||
for (QAction *action : filter_ages) {
|
||||
int age = filter_ages_[action];
|
||||
QObject::connect(action, &QAction::triggered, [this, age]() { model_->SetFilterAge(age); } );
|
||||
}
|
||||
@ -382,7 +384,9 @@ void CollectionFilterWidget::CheckCurrentGrouping(const CollectionModel::Groupin
|
||||
}
|
||||
|
||||
// Check the advanced action
|
||||
group_by_group_->actions().last()->setChecked(true);
|
||||
QList<QAction*> actions = group_by_group_->actions();
|
||||
QAction *action = actions.last();
|
||||
action->setChecked(true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,8 @@ CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, Q
|
||||
|
||||
QIcon nocover = IconLoader::Load("cdcase");
|
||||
if (!nocover.isNull()) {
|
||||
no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()).scaled(kPrettyCoverSize, kPrettyCoverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QList<QSize> nocover_sizes = nocover.availableSizes();
|
||||
no_cover_icon_ = nocover.pixmap(nocover_sizes.last()).scaled(kPrettyCoverSize, kPrettyCoverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
if (app_ && !sIconCache) {
|
||||
@ -382,10 +383,10 @@ QString CollectionModel::ContainerKey(const GroupBy type, const Song &song) cons
|
||||
}
|
||||
else {
|
||||
if (song.bitdepth() <= 0) {
|
||||
key = QString("%1 (%2)").arg(song.TextForFiletype()).arg(QString::number(song.samplerate() / 1000.0, 'G', 5));
|
||||
key = QString("%1 (%2)").arg(song.TextForFiletype(), QString::number(song.samplerate() / 1000.0, 'G', 5));
|
||||
}
|
||||
else {
|
||||
key = QString("%1 (%2/%3)").arg(song.TextForFiletype()).arg(QString::number(song.samplerate() / 1000.0, 'G', 5)).arg(song.bitdepth());
|
||||
key = QString("%1 (%2/%3)").arg(song.TextForFiletype(), QString::number(song.samplerate() / 1000.0, 'G', 5)).arg(song.bitdepth());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -421,7 +422,8 @@ QString CollectionModel::DividerKey(const GroupBy type, CollectionItem *item) co
|
||||
if (c.isDigit()) return "0";
|
||||
if (c == ' ') return QString();
|
||||
if (c.decompositionTag() != QChar::NoDecomposition) {
|
||||
return QChar(c.decomposition()[0]);
|
||||
QString decomposition = c.decomposition();
|
||||
return QChar(decomposition[0]);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@ -587,12 +589,13 @@ void CollectionModel::SongsDeleted(const SongList &songs) {
|
||||
}
|
||||
|
||||
// Delete empty dividers
|
||||
for (const QString ÷r_key : divider_keys) {
|
||||
for (const QString ÷r_key : qAsConst(divider_keys)) {
|
||||
if (!divider_nodes_.contains(divider_key)) continue;
|
||||
|
||||
// Look to see if there are any other items still under this divider
|
||||
bool found = false;
|
||||
for (CollectionItem *node : container_nodes_[0].values()) {
|
||||
QList<CollectionItem*> container_nodes = container_nodes_[0].values();
|
||||
for (CollectionItem *node : container_nodes) {
|
||||
if (DividerKey(group_by_[0], node) == divider_key) {
|
||||
found = true;
|
||||
break;
|
||||
|
@ -198,15 +198,15 @@ bool CollectionView::RestoreLevelFocus(const QModelIndex &parent) {
|
||||
case CollectionItem::Type_Divider: {
|
||||
QString text = model()->data(current, CollectionModel::Role_SortText).toString();
|
||||
if (!last_selected_container_.isEmpty() && last_selected_container_ == text) {
|
||||
emit expand(current);
|
||||
expand(current);
|
||||
setCurrentIndex(current);
|
||||
return true;
|
||||
}
|
||||
else if (last_selected_path_.contains(text)) {
|
||||
emit expand(current);
|
||||
expand(current);
|
||||
// If a selected container or song were not found, we've got into a wrong subtree (happens with "unknown" all the time)
|
||||
if (!RestoreLevelFocus(current)) {
|
||||
emit collapse(current);
|
||||
collapse(current);
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
@ -463,7 +463,8 @@ void CollectionView::SetShowInVarious(const bool on) {
|
||||
// If we have only one album and we are putting it into Various Artists, check to see
|
||||
// if there are other Artists in this album and prompt the user if they'd like them moved, too
|
||||
if (on && albums.keys().count() == 1) {
|
||||
const QString album = albums.keys().first();
|
||||
const QStringList albums_list = albums.keys();
|
||||
const QString album = albums_list.first();
|
||||
QList<Song> all_of_album = app_->collection_backend()->GetSongsByAlbum(album);
|
||||
QSet<QString> other_artists;
|
||||
for (const Song &s : all_of_album) {
|
||||
@ -481,10 +482,11 @@ void CollectionView::SetShowInVarious(const bool on) {
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
for (const QString &album : QSet<QString>(albums.keyBegin(), albums.keyEnd())) {
|
||||
QSet<QString> albums_set = QSet<QString>(albums.keyBegin(), albums.keyEnd());
|
||||
#else
|
||||
for (const QString &album : QSet<QString>::fromList(albums.keys())) {
|
||||
QSet<QString> albums_set = QSet<QString>::fromList(albums.keys());
|
||||
#endif
|
||||
for (const QString &album : albums_set) {
|
||||
app_->collection_backend()->ForceCompilation(album, albums.values(album), on);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,8 @@ void CollectionWatcher::ReloadSettings() {
|
||||
}
|
||||
else if (monitor_ && !was_monitoring_before) {
|
||||
// Add all directories to all QFileSystemWatchers again
|
||||
for (const Directory &dir : watched_dirs_.values()) {
|
||||
QList<Directory> dirs = watched_dirs_.values();
|
||||
for (const Directory &dir : dirs) {
|
||||
SubdirectoryList subdirs = backend_->SubdirsInDirectory(dir.id);
|
||||
for (const Subdirectory &subdir : subdirs) {
|
||||
AddWatch(dir, subdir.path);
|
||||
@ -349,7 +350,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
||||
// Do not scan symlinked dirs that are already in collection
|
||||
if (path_info.isSymLink()) {
|
||||
QString real_path = path_info.symLinkTarget();
|
||||
for (const Directory &dir : watched_dirs_) {
|
||||
for (const Directory &dir : qAsConst(watched_dirs_)) {
|
||||
if (real_path.startsWith(dir.path)) {
|
||||
t->AddToProgress(1);
|
||||
return;
|
||||
@ -689,7 +690,8 @@ void CollectionWatcher::AddWatch(const Directory &dir, const QString &path) {
|
||||
|
||||
void CollectionWatcher::RemoveWatch(const Directory &dir, const Subdirectory &subdir) {
|
||||
|
||||
for (const QString &subdir_path : subdir_mapping_.keys(dir)) {
|
||||
QStringList subdir_paths = subdir_mapping_.keys(dir);
|
||||
for (const QString &subdir_path : subdir_paths) {
|
||||
if (subdir_path != subdir.path) continue;
|
||||
fs_watcher_->RemovePath(subdir_path);
|
||||
subdir_mapping_.remove(subdir_path);
|
||||
@ -704,7 +706,8 @@ void CollectionWatcher::RemoveDirectory(const Directory &dir) {
|
||||
watched_dirs_.remove(dir.id);
|
||||
|
||||
// Stop watching the directory's subdirectories
|
||||
for (const QString &subdir_path : subdir_mapping_.keys(dir)) {
|
||||
QStringList subdir_paths = subdir_mapping_.keys(dir);
|
||||
for (const QString &subdir_path : subdir_paths) {
|
||||
fs_watcher_->RemovePath(subdir_path);
|
||||
subdir_mapping_.remove(subdir_path);
|
||||
}
|
||||
@ -744,7 +747,8 @@ void CollectionWatcher::DirectoryChanged(const QString &subdir) {
|
||||
|
||||
void CollectionWatcher::RescanPathsNow() {
|
||||
|
||||
for (int dir : rescan_queue_.keys()) {
|
||||
QList<int> dirs = rescan_queue_.keys();
|
||||
for (const int dir : dirs) {
|
||||
if (stop_requested_) break;
|
||||
ScanTransaction transaction(this, dir, false, false, mark_songs_unavailable_);
|
||||
transaction.AddToProgressMax(rescan_queue_[dir].count());
|
||||
@ -900,7 +904,8 @@ void CollectionWatcher::PerformScan(bool incremental, bool ignore_mtimes) {
|
||||
|
||||
stop_requested_ = false;
|
||||
|
||||
for (const Directory &dir : watched_dirs_.values()) {
|
||||
QList<Directory> dirs = watched_dirs_.values();
|
||||
for (const Directory &dir : dirs) {
|
||||
|
||||
if (stop_requested_) break;
|
||||
ScanTransaction transaction(this, dir.id, incremental, ignore_mtimes, mark_songs_unavailable_);
|
||||
|
@ -155,7 +155,7 @@ class CollectionWatcher : public QObject {
|
||||
void FullScanNow();
|
||||
void RescanTracksNow();
|
||||
void RescanPathsNow();
|
||||
void ScanSubdirectory(const QString &path, const Subdirectory &subdir, ScanTransaction *t, bool force_noincremental = false);
|
||||
void ScanSubdirectory(const QString &path, const Subdirectory &subdir, CollectionWatcher::ScanTransaction *t, bool force_noincremental = false);
|
||||
|
||||
private:
|
||||
static bool FindSongByPath(const SongList &list, const QString &path, Song *out);
|
||||
|
@ -75,7 +75,8 @@ ContextAlbumsModel::ContextAlbumsModel(CollectionBackend *backend, Application *
|
||||
QObject::connect(app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &ContextAlbumsModel::AlbumCoverLoaded);
|
||||
|
||||
QIcon nocover = IconLoader::Load("cdcase");
|
||||
no_cover_icon_ = nocover.pixmap(nocover.availableSizes().last()).scaled(kPrettyCoverSize, kPrettyCoverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QList<QSize> nocover_sizes = nocover.availableSizes();
|
||||
no_cover_icon_ = nocover.pixmap(nocover_sizes.last()).scaled(kPrettyCoverSize, kPrettyCoverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,8 @@ QSqlDatabase Database::Connect() {
|
||||
}
|
||||
|
||||
// Attach external databases
|
||||
for (const QString &key : attached_databases_.keys()) {
|
||||
QStringList keys = attached_databases_.keys();
|
||||
for (const QString &key : keys) {
|
||||
QString filename = attached_databases_[key].filename_;
|
||||
|
||||
if (!injected_database_name_.isNull()) filename = injected_database_name_;
|
||||
@ -204,7 +205,8 @@ QSqlDatabase Database::Connect() {
|
||||
}
|
||||
|
||||
// We might have to initialize the schema in some attached databases now, if they were deleted and don't match up with the main schema version.
|
||||
for (const QString &key : attached_databases_.keys()) {
|
||||
keys = attached_databases_.keys();
|
||||
for (const QString &key : keys) {
|
||||
if (attached_databases_[key].is_temporary_ && attached_databases_[key].schema_.isEmpty())
|
||||
continue;
|
||||
// Find out if there are any tables in this database
|
||||
@ -453,7 +455,8 @@ QStringList Database::SongsTables(QSqlDatabase &db, int schema_version) const {
|
||||
}
|
||||
|
||||
// look for the tables in attached dbs
|
||||
for (const QString &key : attached_databases_.keys()) {
|
||||
QStringList keys = attached_databases_.keys();
|
||||
for (const QString &key : keys) {
|
||||
QSqlQuery q(db);
|
||||
q.prepare(QString("SELECT NAME FROM %1.sqlite_master WHERE type='table' AND name='songs' OR name LIKE '%songs'").arg(key));
|
||||
if (q.exec()) {
|
||||
|
@ -75,7 +75,7 @@ QIcon IconLoader::Load(const QString &name, const int fixed_size, const int min_
|
||||
if (icon_prop.allow_system_icon) {
|
||||
ret = QIcon::fromTheme(name);
|
||||
if (ret.isNull()) {
|
||||
for (QString alt_name : icon_prop.names) {
|
||||
for (const QString &alt_name : icon_prop.names) {
|
||||
ret = QIcon::fromTheme(alt_name);
|
||||
if (!ret.isNull()) break;
|
||||
}
|
||||
|
@ -1913,7 +1913,7 @@ void MainWindow::PlaylistRightClick(const QPoint &global_pos, const QModelIndex
|
||||
QString column_value = app_->playlist_manager()->current()->data(source_index).toString();
|
||||
if (column_value.length() > 25) column_value = column_value.left(25) + "...";
|
||||
|
||||
ui_->action_selection_set_value->setText(tr("Set %1 to \"%2\"...").arg(column_name.toLower()).arg(column_value));
|
||||
ui_->action_selection_set_value->setText(tr("Set %1 to \"%2\"...").arg(column_name.toLower(), column_value));
|
||||
ui_->action_edit_value->setText(tr("Edit tag \"%1\"...").arg(column_name));
|
||||
|
||||
// Is it a collection item?
|
||||
|
@ -418,7 +418,8 @@ QStringList MergedProxyModel::mimeTypes() const {
|
||||
QStringList ret;
|
||||
ret << sourceModel()->mimeTypes();
|
||||
|
||||
for (const QAbstractItemModel *model : merge_points_.keys()) {
|
||||
QList<QAbstractItemModel*> models = merge_points_.keys();
|
||||
for (const QAbstractItemModel *model : models) {
|
||||
ret << model->mimeTypes();
|
||||
}
|
||||
|
||||
@ -495,7 +496,8 @@ QAbstractItemModel *MergedProxyModel::GetModel(const QModelIndex &source_index)
|
||||
// This is essentially const_cast<QAbstractItemModel*>(source_index.model()), but without the const_cast
|
||||
const QAbstractItemModel *const_model = source_index.model();
|
||||
if (const_model == sourceModel()) return sourceModel();
|
||||
for (QAbstractItemModel *submodel : merge_points_.keys()) {
|
||||
QList<QAbstractItemModel*> submodels = merge_points_.keys();
|
||||
for (QAbstractItemModel *submodel : submodels) {
|
||||
if (submodel == const_model) return submodel;
|
||||
}
|
||||
return nullptr;
|
||||
@ -509,19 +511,21 @@ void MergedProxyModel::DataChanged(const QModelIndex &top_left, const QModelInde
|
||||
void MergedProxyModel::LayoutAboutToBeChanged() {
|
||||
|
||||
old_merge_points_.clear();
|
||||
for (QAbstractItemModel *key : merge_points_.keys()) {
|
||||
old_merge_points_[key] = merge_points_.value(key);
|
||||
QList<QAbstractItemModel*> models = merge_points_.keys();
|
||||
for (QAbstractItemModel *model : models) {
|
||||
old_merge_points_[model] = merge_points_.value(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MergedProxyModel::LayoutChanged() {
|
||||
|
||||
for (QAbstractItemModel *key : merge_points_.keys()) {
|
||||
if (!old_merge_points_.contains(key)) continue;
|
||||
QList<QAbstractItemModel*> models = merge_points_.keys();
|
||||
for (QAbstractItemModel *model : models) {
|
||||
if (!old_merge_points_.contains(model)) continue;
|
||||
|
||||
const int old_row = old_merge_points_[key].row();
|
||||
const int new_row = merge_points_[key].row();
|
||||
const int old_row = old_merge_points_[model].row();
|
||||
const int new_row = merge_points_[model].row();
|
||||
|
||||
if (old_row != new_row) {
|
||||
beginResetModel();
|
||||
|
@ -61,7 +61,7 @@ QtSystemTrayIcon::QtSystemTrayIcon(QObject *parent)
|
||||
}
|
||||
tray_->setIcon(normal_icon_);
|
||||
tray_->installEventFilter(this);
|
||||
ClearNowPlaying();
|
||||
QtSystemTrayIcon::ClearNowPlaying();
|
||||
|
||||
QObject::connect(tray_, &QSystemTrayIcon::activated, this, &QtSystemTrayIcon::Clicked);
|
||||
|
||||
|
@ -1038,7 +1038,6 @@ void Song::InitFromFilePartial(const QString &filename) {
|
||||
set_url(QUrl::fromLocalFile(filename));
|
||||
QFileInfo info(filename);
|
||||
d->basefilename_ = info.fileName();
|
||||
QString suffix = info.suffix().toLower();
|
||||
|
||||
TagLib::FileRef fileref(filename.toUtf8().constData());
|
||||
if (fileref.file()) {
|
||||
@ -1458,7 +1457,7 @@ QString Song::TitleWithCompilationArtist() const {
|
||||
|
||||
if (title.isEmpty()) title = d->basefilename_;
|
||||
|
||||
if (is_compilation() && !d->artist_.isEmpty() && !d->artist_.toLower().contains("various")) title = d->artist_ + " - " + title;
|
||||
if (is_compilation() && !d->artist_.isEmpty() && !d->artist_.contains("various", Qt::CaseInsensitive)) title = d->artist_ + " - " + title;
|
||||
|
||||
return title;
|
||||
|
||||
|
@ -116,7 +116,8 @@ void TaskManager::SetTaskFinished(const int id) {
|
||||
|
||||
if (tasks_[id].blocks_collection_scans) {
|
||||
resume_collection_watchers = true;
|
||||
for (const Task &task : tasks_.values()) {
|
||||
QList<Task> tasks = tasks_.values();
|
||||
for (const Task &task : tasks) {
|
||||
if (task.id != id && task.blocks_collection_scans) {
|
||||
resume_collection_watchers = false;
|
||||
break;
|
||||
|
@ -48,7 +48,8 @@ AlbumCoverFetcher::AlbumCoverFetcher(CoverProviders *cover_providers, QObject *p
|
||||
|
||||
AlbumCoverFetcher::~AlbumCoverFetcher() {
|
||||
|
||||
for (AlbumCoverFetcherSearch *search : active_requests_.values()) {
|
||||
QList<AlbumCoverFetcherSearch*> searches = active_requests_.values();
|
||||
for (AlbumCoverFetcherSearch *search : searches) {
|
||||
search->disconnect();
|
||||
search->deleteLater();
|
||||
}
|
||||
@ -104,7 +105,8 @@ void AlbumCoverFetcher::Clear() {
|
||||
|
||||
queued_requests_.clear();
|
||||
|
||||
for (AlbumCoverFetcherSearch *search : active_requests_.values()) {
|
||||
QList<AlbumCoverFetcherSearch*> searches = active_requests_.values();
|
||||
for (AlbumCoverFetcherSearch *search : searches) {
|
||||
search->Cancel();
|
||||
search->deleteLater();
|
||||
}
|
||||
|
@ -73,7 +73,8 @@ AlbumCoverFetcherSearch::~AlbumCoverFetcherSearch() {
|
||||
|
||||
void AlbumCoverFetcherSearch::TerminateSearch() {
|
||||
|
||||
for (quint64 id : pending_requests_.keys()) {
|
||||
QList<int> ids = pending_requests_.keys();
|
||||
for (const quint64 id : ids) {
|
||||
pending_requests_.take(id)->CancelSearch(id);
|
||||
}
|
||||
|
||||
@ -352,7 +353,8 @@ void AlbumCoverFetcherSearch::ProviderCoverFetchFinished(QNetworkReply *reply) {
|
||||
float best_score = 0.0;
|
||||
|
||||
if (!candidate_images_.isEmpty()) {
|
||||
best_score = candidate_images_.keys().last();
|
||||
QList<float> scores = candidate_images_.keys();
|
||||
best_score = scores.last();
|
||||
qLog(Debug) << "Best image so far has a score of" << best_score;
|
||||
}
|
||||
|
||||
@ -385,7 +387,8 @@ void AlbumCoverFetcherSearch::SendBestImage() {
|
||||
AlbumCoverImageResult result;
|
||||
|
||||
if (!candidate_images_.isEmpty()) {
|
||||
const CandidateImage best_image = candidate_images_.values().back();
|
||||
QList<CandidateImage> candidate_images = candidate_images_.values();
|
||||
const CandidateImage best_image = candidate_images.back();
|
||||
result = best_image.album_cover;
|
||||
|
||||
qLog(Info) << "Using" << best_image.result.image_url << "from" << best_image.result.provider << "with score" << best_image.result.score();
|
||||
@ -411,7 +414,8 @@ void AlbumCoverFetcherSearch::Cancel() {
|
||||
TerminateSearch();
|
||||
}
|
||||
else if (!pending_image_loads_.isEmpty()) {
|
||||
for (QNetworkReply *reply : pending_image_loads_.keys()) {
|
||||
QList<QNetworkReply*> replies = pending_image_loads_.keys();
|
||||
for (QNetworkReply *reply : replies) {
|
||||
QObject::disconnect(reply, &QNetworkReply::finished, this, nullptr);
|
||||
reply->abort();
|
||||
reply->deleteLater();
|
||||
|
@ -53,7 +53,8 @@ CoverProviders::~CoverProviders() {
|
||||
void CoverProviders::ReloadSettings() {
|
||||
|
||||
QMap<int, QString> all_providers;
|
||||
for (CoverProvider *provider : cover_providers_.keys()) {
|
||||
QList<CoverProvider*> old_providers = cover_providers_.keys();
|
||||
for (CoverProvider *provider : old_providers) {
|
||||
if (!provider->is_enabled()) continue;
|
||||
all_providers.insert(provider->order(), provider->name());
|
||||
}
|
||||
@ -64,18 +65,19 @@ void CoverProviders::ReloadSettings() {
|
||||
s.endGroup();
|
||||
|
||||
int i = 0;
|
||||
QList<CoverProvider*> providers;
|
||||
QList<CoverProvider*> new_providers;
|
||||
for (const QString &name : providers_enabled) {
|
||||
CoverProvider *provider = ProviderByName(name);
|
||||
if (provider) {
|
||||
provider->set_enabled(true);
|
||||
provider->set_order(++i);
|
||||
providers << provider;
|
||||
new_providers << provider;
|
||||
}
|
||||
}
|
||||
|
||||
for (CoverProvider *provider : cover_providers_.keys()) {
|
||||
if (!providers.contains(provider)) {
|
||||
old_providers = cover_providers_.keys();
|
||||
for (CoverProvider *provider : old_providers) {
|
||||
if (!new_providers.contains(provider)) {
|
||||
provider->set_enabled(false);
|
||||
provider->set_order(++i);
|
||||
}
|
||||
@ -85,7 +87,8 @@ void CoverProviders::ReloadSettings() {
|
||||
|
||||
CoverProvider *CoverProviders::ProviderByName(const QString &name) const {
|
||||
|
||||
for (CoverProvider *provider : cover_providers_.keys()) {
|
||||
QList<CoverProvider*> cover_providers = cover_providers_.keys();
|
||||
for (CoverProvider *provider : cover_providers) {
|
||||
if (provider->name() == name) return provider;
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -38,10 +38,12 @@ CoverSearchStatistics &CoverSearchStatistics::operator +=(const CoverSearchStati
|
||||
network_requests_made_ += other.network_requests_made_;
|
||||
bytes_transferred_ += other.bytes_transferred_;
|
||||
|
||||
for (const QString &key : other.chosen_images_by_provider_.keys()) {
|
||||
QStringList keys = other.chosen_images_by_provider_.keys();
|
||||
for (const QString &key : keys) {
|
||||
chosen_images_by_provider_[key] += other.chosen_images_by_provider_[key];
|
||||
}
|
||||
for (const QString &key : other.total_images_by_provider_.keys()) {
|
||||
keys = other.total_images_by_provider_.keys();
|
||||
for (const QString &key : keys) {
|
||||
total_images_by_provider_[key] += other.total_images_by_provider_[key];
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, const int id, cons
|
||||
else if (json_obj.contains("error") && json_obj.contains("message")) {
|
||||
int error = json_obj["error"].toInt();
|
||||
QString message = json_obj["message"].toString();
|
||||
Error(QString("Error: %1: %2").arg(QString::number(error)).arg(message));
|
||||
Error(QString("Error: %1: %2").arg(QString::number(error), message));
|
||||
emit SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ bool MusicbrainzCoverProvider::StartSearch(const QString &artist, const QString
|
||||
|
||||
void MusicbrainzCoverProvider::SendSearchRequest(const SearchRequest &request) {
|
||||
|
||||
QString query = QString("release:\"%1\" AND artist:\"%2\"").arg(request.album.trimmed().replace('"', "\\\"")).arg(request.artist.trimmed().replace('"', "\\\""));
|
||||
QString query = QString("release:\"%1\" AND artist:\"%2\"").arg(request.album.trimmed().replace('"', "\\\""), request.artist.trimmed().replace('"', "\\\""));
|
||||
|
||||
QUrlQuery url_query;
|
||||
url_query.addQueryItem("query", query);
|
||||
|
@ -76,7 +76,7 @@ bool MusixmatchCoverProvider::StartSearch(const QString &artist, const QString &
|
||||
|
||||
if (artist_stripped.isEmpty() || album_stripped.isEmpty()) return false;
|
||||
|
||||
QUrl url(QString("https://www.musixmatch.com/album/%1/%2").arg(artist_stripped).arg(album_stripped));
|
||||
QUrl url(QString("https://www.musixmatch.com/album/%1/%2").arg(artist_stripped, album_stripped));
|
||||
QNetworkRequest req(url);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
|
||||
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||
|
@ -183,7 +183,6 @@ void SpotifyCoverProvider::RedirectArrived() {
|
||||
else if (url_query.hasQueryItem("code") && url_query.hasQueryItem("state")) {
|
||||
qLog(Debug) << "Spotify: Authorization URL Received" << url;
|
||||
QString code = url_query.queryItemValue("code");
|
||||
QString state = url_query.queryItemValue("state");
|
||||
QUrl redirect_url(kOAuthRedirectUrl);
|
||||
redirect_url.setPort(server_->url().port());
|
||||
RequestAccessToken(code, redirect_url);
|
||||
@ -282,7 +281,7 @@ void SpotifyCoverProvider::AccessTokenRequestFinished(QNetworkReply *reply) {
|
||||
if (!json_obj.isEmpty() && json_obj.contains("error") && json_obj.contains("error_description")) {
|
||||
QString error = json_obj["error"].toString();
|
||||
QString error_description = json_obj["error_description"].toString();
|
||||
login_errors_ << QString("Authentication failure: %1 (%2)").arg(error).arg(error_description);
|
||||
login_errors_ << QString("Authentication failure: %1 (%2)").arg(error, error_description);
|
||||
}
|
||||
}
|
||||
if (login_errors_.isEmpty()) {
|
||||
|
@ -271,7 +271,7 @@ void TidalCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
<< qMakePair(QString("750x750"), QSize(750, 750))
|
||||
<< qMakePair(QString("640x640"), QSize(640, 640));
|
||||
for (const QPair<QString, QSize> &cover_size : cover_sizes) {
|
||||
QUrl cover_url(QString("%1/images/%2/%3.jpg").arg(kResourcesUrl).arg(cover).arg(cover_size.first));
|
||||
QUrl cover_url(QString("%1/images/%2/%3.jpg").arg(kResourcesUrl, cover, cover_size.first));
|
||||
cover_result.image_url = cover_url;
|
||||
cover_result.image_size = cover_size.second;
|
||||
results << cover_result;
|
||||
|
@ -80,7 +80,8 @@ ConnectedDevice::~ConnectedDevice() {
|
||||
|
||||
void ConnectedDevice::InitBackendDirectory(const QString &mount_point, const bool first_time, const bool rewrite_path) {
|
||||
|
||||
if (first_time || backend_->GetAllDirectories().isEmpty()) {
|
||||
QList<Directory> directories = backend_->GetAllDirectories();
|
||||
if (first_time || directories.isEmpty()) {
|
||||
backend_->AddDirectory(mount_point);
|
||||
}
|
||||
else {
|
||||
@ -91,7 +92,7 @@ void ConnectedDevice::InitBackendDirectory(const QString &mount_point, const boo
|
||||
// This can be done entirely in sqlite so it's relatively fast...
|
||||
|
||||
// Get the directory it was mounted at last time. Devices only have one directory (the root).
|
||||
Directory dir = backend_->GetAllDirectories()[0];
|
||||
Directory dir = directories[0];
|
||||
if (dir.path != mount_point) {
|
||||
// The directory is different, commence the munging.
|
||||
qLog(Info) << "Changing path from" << dir.path << "to" << mount_point;
|
||||
|
@ -106,7 +106,7 @@ DeviceDatabaseBackend::DeviceList DeviceDatabaseBackend::GetAllDevices() {
|
||||
}
|
||||
}
|
||||
|
||||
for (Device dev : old_devices) {
|
||||
for (const Device &dev : old_devices) {
|
||||
RemoveDevice(dev.id_);
|
||||
}
|
||||
|
||||
|
@ -793,7 +793,7 @@ void DeviceManager::RemoveFromDB(DeviceInfo *info, QModelIndex idx) {
|
||||
|
||||
info->friendly_name_ = info->BestBackend()->lister_->MakeFriendlyName(id);
|
||||
info->LoadIcon(info->BestBackend()->lister_->DeviceIcons(id), info->friendly_name_);
|
||||
dataChanged(idx, idx);
|
||||
emit dataChanged(idx, idx);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -161,7 +161,8 @@ void DeviceProperties::UpdateHardwareInfo() {
|
||||
QVariantMap info = lister->DeviceHardwareInfo(id);
|
||||
|
||||
// Remove empty items
|
||||
for (const QString &key : info.keys()) {
|
||||
QStringList keys = info.keys();
|
||||
for (const QString &key : keys) {
|
||||
if (info[key].isNull() || info[key].toString().isEmpty())
|
||||
info.remove(key);
|
||||
}
|
||||
@ -173,7 +174,8 @@ void DeviceProperties::UpdateHardwareInfo() {
|
||||
int row = 0;
|
||||
AddHardwareInfo(row++, tr("Model"), lister->DeviceModel(id));
|
||||
AddHardwareInfo(row++, tr("Manufacturer"), lister->DeviceManufacturer(id));
|
||||
for (const QString &key : info.keys()) {
|
||||
keys = info.keys();
|
||||
for (const QString &key : keys) {
|
||||
AddHardwareInfo(row++, tr(key.toLatin1()), info[key].toString());
|
||||
}
|
||||
|
||||
@ -202,7 +204,6 @@ void DeviceProperties::UpdateHardwareInfo() {
|
||||
|
||||
void DeviceProperties::UpdateFormats() {
|
||||
|
||||
QString id = index_.data(DeviceManager::Role_UniqueId).toString();
|
||||
DeviceLister *lister = manager_->GetLister(index_);
|
||||
std::shared_ptr<ConnectedDevice> device = manager_->GetConnectedDevice(index_);
|
||||
|
||||
|
@ -408,16 +408,17 @@ void DeviceView::OpenInNewPlaylist() {
|
||||
|
||||
void DeviceView::Delete() {
|
||||
|
||||
if (selectedIndexes().isEmpty()) return;
|
||||
QModelIndexList selected_indexes = selectedIndexes();
|
||||
|
||||
if (selected_indexes.isEmpty()) return;
|
||||
|
||||
// Take the device of the first selected item
|
||||
QModelIndex device_index = FindParentDevice(selectedIndexes()[0]);
|
||||
QModelIndex device_index = FindParentDevice(selected_indexes[0]);
|
||||
if (!device_index.isValid()) return;
|
||||
|
||||
if (QMessageBox::question(this, tr("Delete files"),
|
||||
tr("These files will be deleted from the device, are you sure you want to continue?"),
|
||||
QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes)
|
||||
if (QMessageBox::question(this, tr("Delete files"), tr("These files will be deleted from the device, are you sure you want to continue?"), QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<MusicStorage> storage = device_index.data(MusicStorage::Role_Storage).value<std::shared_ptr<MusicStorage>>();
|
||||
|
||||
|
@ -70,6 +70,9 @@ class DeviceView : public AutoExpandingTreeView {
|
||||
|
||||
void SetApplication(Application *app);
|
||||
|
||||
// AutoExpandingTreeView
|
||||
bool CanRecursivelyExpand(const QModelIndex &idx) const override;
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent*) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *e) override;
|
||||
@ -93,9 +96,6 @@ class DeviceView : public AutoExpandingTreeView {
|
||||
|
||||
void DeleteFinished(const SongList &songs_with_errors);
|
||||
|
||||
// AutoExpandingTreeView
|
||||
bool CanRecursivelyExpand(const QModelIndex &idx) const override;
|
||||
|
||||
private:
|
||||
QModelIndex MapToDevice(const QModelIndex &merged_model_index) const;
|
||||
QModelIndex MapToCollection(const QModelIndex &merged_model_index) const;
|
||||
|
@ -348,7 +348,8 @@ void GioLister::MountAdded(GMount *mount) {
|
||||
QMutexLocker l(&mutex_);
|
||||
|
||||
// The volume might already exist - either mounted or unmounted.
|
||||
for (const QString &id : devices_.keys()) {
|
||||
QStringList ids = devices_.keys();
|
||||
for (const QString &id : ids) {
|
||||
if (devices_[id].volume_ptr == info.volume_ptr) {
|
||||
old_id = id;
|
||||
break;
|
||||
|
@ -166,7 +166,7 @@ void Udisks2Lister::UnmountDevice(const QString &id) {
|
||||
}
|
||||
|
||||
device_data_.remove(id);
|
||||
DeviceRemoved(id);
|
||||
emit DeviceRemoved(id);
|
||||
}
|
||||
|
||||
}
|
||||
@ -190,7 +190,8 @@ bool Udisks2Lister::Init() {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const QDBusObjectPath &path : reply.value().keys()) {
|
||||
QList<QDBusObjectPath> paths = reply.value().keys();
|
||||
for (const QDBusObjectPath &path : paths) {
|
||||
auto partition_data = ReadPartitionData(path);
|
||||
|
||||
if (!partition_data.dbus_path.isEmpty()) {
|
||||
@ -199,7 +200,8 @@ bool Udisks2Lister::Init() {
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &id : device_data_.keys()) {
|
||||
QStringList ids = device_data_.keys();
|
||||
for (const QString &id : ids) {
|
||||
emit DeviceAdded(id);
|
||||
}
|
||||
|
||||
@ -269,7 +271,7 @@ void Udisks2Lister::RemoveDevice(const QDBusObjectPath &device_path) {
|
||||
|
||||
QWriteLocker locker(&device_data_lock_);
|
||||
QString id;
|
||||
for (const auto &data : device_data_) {
|
||||
for (const auto &data : qAsConst(device_data_)) {
|
||||
if (data.dbus_path == device_path.path()) {
|
||||
id = data.unique_id();
|
||||
break;
|
||||
@ -280,7 +282,8 @@ void Udisks2Lister::RemoveDevice(const QDBusObjectPath &device_path) {
|
||||
|
||||
qLog(Debug) << "UDisks2 device removed: " << device_path.path();
|
||||
device_data_.remove(id);
|
||||
DeviceRemoved(id);
|
||||
|
||||
emit DeviceRemoved(id);
|
||||
|
||||
}
|
||||
|
||||
@ -325,7 +328,8 @@ void Udisks2Lister::HandleFinishedMountJob(const Udisks2Lister::PartitionData &p
|
||||
qLog(Debug) << "UDisks2 mount job finished: Drive = " << partition_data.dbus_drive_path << " | Partition = " << partition_data.dbus_path;
|
||||
QWriteLocker locker(&device_data_lock_);
|
||||
device_data_[partition_data.unique_id()] = partition_data;
|
||||
DeviceAdded(partition_data.unique_id());
|
||||
|
||||
emit DeviceAdded(partition_data.unique_id());
|
||||
|
||||
}
|
||||
|
||||
@ -345,7 +349,7 @@ void Udisks2Lister::HandleFinishedUnmountJob(const Udisks2Lister::PartitionData
|
||||
if (!id.isEmpty()) {
|
||||
qLog(Debug) << "Partition " << partition_data.dbus_path << " has no more mount points, removing it from device list";
|
||||
device_data_.remove(id);
|
||||
DeviceRemoved(id);
|
||||
emit DeviceRemoved(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -123,9 +123,10 @@ QString About::MainHtml() const {
|
||||
ret += QString("<p>");
|
||||
ret += tr("If you like Strawberry and can make use of it, consider sponsoring or donating.");
|
||||
ret += QString("<br />");
|
||||
ret += tr("You can sponsor the author on %1. You can also make a one-time payment through %2.")
|
||||
.arg(QString("<a style=\"color:%1;\" href=\"https://github.com/sponsors/jonaski\">GitHub sponsors</a>").arg(palette().text().color().name()))
|
||||
.arg(QString("<a style=\"color:%1;\" href=\"https://paypal.me/jonaskvinge\">paypal.me/jonaskvinge</a>").arg(palette().text().color().name()));
|
||||
ret += tr("You can sponsor the author on %1. You can also make a one-time payment through %2.").arg(
|
||||
QString("<a style=\"color:%1;\" href=\"https://github.com/sponsors/jonaski\">GitHub sponsors</a>").arg(palette().text().color().name()),
|
||||
QString("<a style=\"color:%1;\" href=\"https://paypal.me/jonaskvinge\">paypal.me/jonaskvinge</a>").arg(palette().text().color().name())
|
||||
);
|
||||
|
||||
ret += QString("</p>");
|
||||
|
||||
|
@ -541,7 +541,7 @@ void EditTagDialog::InitFieldValue(const FieldData &field, const QModelIndexList
|
||||
editor->set_value(data_[sel[0].row()].current_value(field.id_));
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (field.editor_) {
|
||||
qLog(Error) << "Missing editor for" << field.editor_->objectName();
|
||||
}
|
||||
|
||||
@ -557,7 +557,7 @@ void EditTagDialog::UpdateFieldValue(const FieldData &field, const QModelIndexLi
|
||||
if (ExtendedEditor *editor = dynamic_cast<ExtendedEditor*>(field.editor_)) {
|
||||
value = editor->value();
|
||||
}
|
||||
else {
|
||||
else if (field.editor_) {
|
||||
qLog(Error) << "Missing editor for" << field.editor_->objectName();
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ void EditTagDialog::UpdateModifiedField(const FieldData &field, const QModelInde
|
||||
QFont new_font(font());
|
||||
new_font.setBold(modified);
|
||||
field.label_->setFont(new_font);
|
||||
field.editor_->setFont(new_font);
|
||||
if (field.editor_) field.editor_->setFont(new_font);
|
||||
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class EditTagDialog : public QDialog {
|
||||
void NextSong();
|
||||
|
||||
void SongSaveTagsComplete(TagReaderReply *reply, const QString &filename, Song song);
|
||||
void SongSaveArtComplete(TagReaderReply *reply, const QString &filename, Song song, const UpdateCoverAction cover_action);
|
||||
void SongSaveArtComplete(TagReaderReply *reply, const QString &filename, Song song, const EditTagDialog::UpdateCoverAction cover_action);
|
||||
|
||||
private:
|
||||
struct FieldData {
|
||||
|
@ -96,7 +96,7 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
||||
}
|
||||
|
||||
Device device;
|
||||
device.description = QString("%1 %2").arg(snd_ctl_card_info_get_name(cardinfo)).arg(snd_pcm_info_get_name(pcminfo));
|
||||
device.description = QString("%1 %2").arg(snd_ctl_card_info_get_name(cardinfo), snd_pcm_info_get_name(pcminfo));
|
||||
device.iconname = GuessIconName(device.description);
|
||||
device.card = card;
|
||||
device.device = dev;
|
||||
|
@ -27,7 +27,7 @@
|
||||
GstElementDeleter::GstElementDeleter(QObject *parent) : QObject(parent) {}
|
||||
|
||||
void GstElementDeleter::DeleteElementLater(GstElement* element) {
|
||||
metaObject()->invokeMethod(this, "DeleteElement", Qt::QueuedConnection, Q_ARG(GstElement *, element));
|
||||
metaObject()->invokeMethod(this, "DeleteElement", Qt::QueuedConnection, Q_ARG(GstElement*, element));
|
||||
}
|
||||
|
||||
void GstElementDeleter::DeleteElement(GstElement *element) {
|
||||
|
@ -101,7 +101,7 @@ GstEngine::GstEngine(TaskManager *task_manager)
|
||||
seek_timer_->setInterval(kSeekDelayNanosec / kNsecPerMsec);
|
||||
QObject::connect(seek_timer_, &QTimer::timeout, this, &GstEngine::SeekNow);
|
||||
|
||||
ReloadSettings();
|
||||
GstEngine::ReloadSettings();
|
||||
|
||||
}
|
||||
|
||||
@ -919,7 +919,7 @@ void GstEngine::StreamDiscovered(GstDiscoverer*, GstDiscovererInfo *info, GError
|
||||
GstDiscovererResult result = gst_discoverer_info_get_result(info);
|
||||
if (result != GST_DISCOVERER_OK) {
|
||||
QString error_message = GSTdiscovererErrorMessage(result);
|
||||
qLog(Error) << QString("Stream discovery for %1 failed: %2").arg(discovered_url).arg(error_message);
|
||||
qLog(Error) << QString("Stream discovery for %1 failed: %2").arg(discovered_url, error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,8 @@ void Equalizer::Save() {
|
||||
// Presets
|
||||
s.beginWriteArray("presets", presets_.count());
|
||||
int i = 0;
|
||||
for (const QString& name : presets_.keys()) {
|
||||
QStringList presets = presets_.keys();
|
||||
for (const QString &name : presets) {
|
||||
s.setArrayIndex(i++);
|
||||
s.setValue("name", name);
|
||||
s.setValue("params", QVariant::fromValue(presets_[name]));
|
||||
|
@ -108,9 +108,12 @@ void GlobalShortcutsBackendGSD::DoUnregister() {
|
||||
|
||||
}
|
||||
|
||||
void GlobalShortcutsBackendGSD::GnomeMediaKeyPressed(const QString&, const QString& key) {
|
||||
if (key == "Play") manager_->shortcuts()["play_pause"].action->trigger();
|
||||
if (key == "Stop") manager_->shortcuts()["stop"].action->trigger();
|
||||
if (key == "Next") manager_->shortcuts()["next_track"].action->trigger();
|
||||
if (key == "Previous") manager_->shortcuts()["prev_track"].action->trigger();
|
||||
void GlobalShortcutsBackendGSD::GnomeMediaKeyPressed(const QString&, const QString &key) {
|
||||
|
||||
auto shortcuts = manager_->shortcuts();
|
||||
if (key == "Play") shortcuts["play_pause"].action->trigger();
|
||||
if (key == "Stop") shortcuts["stop"].action->trigger();
|
||||
if (key == "Next") shortcuts["next_track"].action->trigger();
|
||||
if (key == "Previous") shortcuts["prev_track"].action->trigger();
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ bool GlobalShortcutsBackendKDE::DoRegister() {
|
||||
interface_ = new OrgKdeKGlobalAccelInterface(kKdeService, kKdePath, QDBusConnection::sessionBus(), this);
|
||||
}
|
||||
|
||||
for (const GlobalShortcutsManager::Shortcut &shortcut : manager_->shortcuts().values()) {
|
||||
QList<GlobalShortcutsManager::Shortcut> shortcuts = manager_->shortcuts().values();
|
||||
for (const GlobalShortcutsManager::Shortcut &shortcut : shortcuts) {
|
||||
RegisterShortcut(shortcut);
|
||||
}
|
||||
|
||||
@ -101,7 +102,8 @@ void GlobalShortcutsBackendKDE::DoUnregister() {
|
||||
|
||||
qLog(Debug) << "Unregistering";
|
||||
|
||||
for (const GlobalShortcutsManager::Shortcut &shortcut : manager_->shortcuts()) {
|
||||
QMap<QString, GlobalShortcutsManager::Shortcut> shortcuts = manager_->shortcuts();
|
||||
for (const GlobalShortcutsManager::Shortcut &shortcut : shortcuts) {
|
||||
if (actions_.contains(shortcut.id)) {
|
||||
interface_->unRegister(GetActionId(shortcut.id, shortcut.action));
|
||||
actions_.remove(shortcut.id, shortcut.action);
|
||||
|
@ -195,15 +195,15 @@ bool InternetCollectionView::RestoreLevelFocus(const QModelIndex &parent) {
|
||||
case CollectionItem::Type_Divider: {
|
||||
QString text = model()->data(current, CollectionModel::Role_SortText).toString();
|
||||
if (!last_selected_container_.isEmpty() && last_selected_container_ == text) {
|
||||
emit expand(current);
|
||||
expand(current);
|
||||
setCurrentIndex(current);
|
||||
return true;
|
||||
}
|
||||
else if (last_selected_path_.contains(text)) {
|
||||
emit expand(current);
|
||||
expand(current);
|
||||
// If a selected container or song were not found, we've got into a wrong subtree (happens with "unknown" all the time)
|
||||
if (!RestoreLevelFocus(current)) {
|
||||
emit collapse(current);
|
||||
collapse(current);
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
|
@ -51,7 +51,8 @@ InternetSearchModel::InternetSearchModel(InternetService *service, QObject *pare
|
||||
group_by_[1] = CollectionModel::GroupBy_AlbumDisc;
|
||||
group_by_[2] = CollectionModel::GroupBy_None;
|
||||
|
||||
no_cover_icon_ = album_icon_.pixmap(album_icon_.availableSizes().last()).scaled(CollectionModel::kPrettyCoverSize, CollectionModel::kPrettyCoverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QList<QSize> nocover_sizes = album_icon_.availableSizes();
|
||||
no_cover_icon_ = album_icon_.pixmap(nocover_sizes.last()).scaled(CollectionModel::kPrettyCoverSize, CollectionModel::kPrettyCoverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
}
|
||||
|
||||
@ -222,10 +223,10 @@ QStandardItem *InternetSearchModel::BuildContainers(const Song &s, QStandardItem
|
||||
}
|
||||
else {
|
||||
if (s.bitdepth() <= 0) {
|
||||
display_text = QString("%1 (%2)").arg(s.TextForFiletype()).arg(QString::number(s.samplerate() / 1000.0, 'G', 5));
|
||||
display_text = QString("%1 (%2)").arg(s.TextForFiletype(), QString::number(s.samplerate() / 1000.0, 'G', 5));
|
||||
}
|
||||
else {
|
||||
display_text = QString("%1 (%2/%3)").arg(s.TextForFiletype()).arg(QString::number(s.samplerate() / 1000.0, 'G', 5)).arg(QString::number(s.bitdepth()));
|
||||
display_text = QString("%1 (%2/%3)").arg(s.TextForFiletype(), QString::number(s.samplerate() / 1000.0, 'G', 5), QString::number(s.bitdepth()));
|
||||
}
|
||||
}
|
||||
sort_text = display_text;
|
||||
|
@ -717,7 +717,8 @@ void InternetSearchView::SetGroupBy(const CollectionModel::Grouping &g) {
|
||||
}
|
||||
|
||||
// Check the advanced action
|
||||
group_by_actions_->actions().last()->setChecked(true);
|
||||
QList<QAction*> actions = group_by_actions_->actions();
|
||||
actions.last()->setChecked(true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ class InternetSearchView : public QWidget {
|
||||
void UpdateStatus(const int service_id, const QString &text);
|
||||
void ProgressSetMaximum(const int service_id, const int max);
|
||||
void UpdateProgress(const int service_id, const int progress);
|
||||
void AddResults(const int service_id, const ResultList &results);
|
||||
void AddResults(const int service_id, const InternetSearchView::ResultList &results);
|
||||
|
||||
void FocusOnFilter(QKeyEvent *e);
|
||||
|
||||
|
@ -68,14 +68,18 @@ InternetService *InternetServices::ServiceBySource(const Song::Source &source) {
|
||||
}
|
||||
|
||||
void InternetServices::ReloadSettings() {
|
||||
for (InternetService *service : services_.values()) {
|
||||
|
||||
QList<InternetService*> services = services_.values();
|
||||
for (InternetService *service : services) {
|
||||
service->ReloadSettings();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InternetServices::Exit() {
|
||||
|
||||
for (InternetService *service : services_.values()) {
|
||||
QList<InternetService*> services = services_.values();
|
||||
for (InternetService *service : services) {
|
||||
wait_for_exit_ << service;
|
||||
QObject::connect(service, &InternetService::ExitFinished, this, &InternetServices::ExitReceived);
|
||||
service->Exit();
|
||||
|
@ -164,8 +164,7 @@ QJsonArray AuddLyricsProvider::ExtractResult(QNetworkReply *reply, const QString
|
||||
Error("Json reply is missing error code or message.", json_error);
|
||||
return QJsonArray();
|
||||
}
|
||||
QString error_code(json_error["error_code"].toString());
|
||||
QString error_message(json_error["error_message"].toString());
|
||||
QString error_message = json_error["error_message"].toString();
|
||||
Error(error_message);
|
||||
return QJsonArray();
|
||||
}
|
||||
@ -177,7 +176,7 @@ QJsonArray AuddLyricsProvider::ExtractResult(QNetworkReply *reply, const QString
|
||||
|
||||
QJsonArray json_result = json_obj["result"].toArray();
|
||||
if (json_result.isEmpty()) {
|
||||
Error(QString("No lyrics for %1 %2").arg(artist).arg(title));
|
||||
Error(QString("No lyrics for %1 %2").arg(artist, title));
|
||||
return QJsonArray();
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,8 @@ void LyricsFetcher::Clear() {
|
||||
|
||||
queued_requests_.clear();
|
||||
|
||||
for (LyricsFetcherSearch *search : active_requests_.values()) {
|
||||
QList<LyricsFetcherSearch*> searches = active_requests_.values();
|
||||
for (LyricsFetcherSearch *search : searches) {
|
||||
search->Cancel();
|
||||
search->deleteLater();
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ LyricsFetcherSearch::LyricsFetcherSearch(const LyricsSearchRequest &request, QOb
|
||||
|
||||
void LyricsFetcherSearch::TerminateSearch() {
|
||||
|
||||
for (int id : pending_requests_.keys()) {
|
||||
QList<int> keys = pending_requests_.keys();
|
||||
for (const int id : keys) {
|
||||
pending_requests_.take(id)->CancelSearch(id);
|
||||
}
|
||||
AllProvidersFinished();
|
||||
|
@ -51,7 +51,8 @@ LyricsProviders::~LyricsProviders() {
|
||||
void LyricsProviders::ReloadSettings() {
|
||||
|
||||
QMap<int, QString> all_providers;
|
||||
for (LyricsProvider *provider : lyrics_providers_.keys()) {
|
||||
QList<LyricsProvider*> old_providers = lyrics_providers_.keys();
|
||||
for (LyricsProvider *provider : old_providers) {
|
||||
if (!provider->is_enabled()) continue;
|
||||
all_providers.insert(provider->order(), provider->name());
|
||||
}
|
||||
@ -62,18 +63,19 @@ void LyricsProviders::ReloadSettings() {
|
||||
s.endGroup();
|
||||
|
||||
int i = 0;
|
||||
QList<LyricsProvider*> providers;
|
||||
QList<LyricsProvider*> new_providers;
|
||||
for (const QString &name : providers_enabled) {
|
||||
LyricsProvider *provider = ProviderByName(name);
|
||||
if (provider) {
|
||||
provider->set_enabled(true);
|
||||
provider->set_order(++i);
|
||||
providers << provider;
|
||||
new_providers << provider;
|
||||
}
|
||||
}
|
||||
|
||||
for (LyricsProvider *provider : lyrics_providers_.keys()) {
|
||||
if (!providers.contains(provider)) {
|
||||
old_providers = lyrics_providers_.keys();
|
||||
for (LyricsProvider *provider : old_providers) {
|
||||
if (!new_providers.contains(provider)) {
|
||||
provider->set_enabled(false);
|
||||
provider->set_order(++i);
|
||||
}
|
||||
@ -83,7 +85,8 @@ void LyricsProviders::ReloadSettings() {
|
||||
|
||||
LyricsProvider *LyricsProviders::ProviderByName(const QString &name) const {
|
||||
|
||||
for (LyricsProvider *provider : lyrics_providers_.keys()) {
|
||||
QList<LyricsProvider*> providers = lyrics_providers_.keys();
|
||||
for (LyricsProvider *provider : providers) {
|
||||
if (provider->name() == name) return provider;
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -74,7 +74,7 @@ bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString
|
||||
|
||||
if (artist_stripped.isEmpty() || title_stripped.isEmpty()) return false;
|
||||
|
||||
QUrl url(QString("https://www.musixmatch.com/lyrics/%1/%2").arg(artist_stripped).arg(title_stripped));
|
||||
QUrl url(QString("https://www.musixmatch.com/lyrics/%1/%2").arg(artist_stripped, title_stripped));
|
||||
QNetworkRequest req(url);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
|
||||
req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||
|
@ -165,7 +165,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
// Output the version, so when people attach log output to bug reports they don't have to tell us which version they're using.
|
||||
qLog(Info) << "Strawberry" << STRAWBERRY_VERSION_DISPLAY;
|
||||
qLog(Info) << QString("%1 %2 - (%3 %4) [%5]").arg(QSysInfo::prettyProductName()).arg(QSysInfo::productVersion()).arg(QSysInfo::kernelType()).arg(QSysInfo::kernelVersion()).arg(QSysInfo::currentCpuArchitecture());
|
||||
qLog(Info) << QString("%1 %2 - (%3 %4) [%5]").arg(QSysInfo::prettyProductName(), QSysInfo::productVersion(), QSysInfo::kernelType(), QSysInfo::kernelVersion(), QSysInfo::currentCpuArchitecture());
|
||||
|
||||
// Seed the random number generators.
|
||||
time_t t = time(nullptr);
|
||||
|
@ -163,7 +163,8 @@ void MoodbarItemDelegate::StartLoadingData(const QUrl &url, Data *data) {
|
||||
|
||||
bool MoodbarItemDelegate::RemoveFromCacheIfIndexesInvalid(const QUrl &url, Data *data) {
|
||||
|
||||
for (const QPersistentModelIndex &idx : data->indexes_) {
|
||||
QSet<QPersistentModelIndex> indexes = data->indexes_;
|
||||
for (const QPersistentModelIndex &idx : indexes) {
|
||||
if (idx.isValid()) {
|
||||
return false;
|
||||
}
|
||||
@ -278,7 +279,7 @@ void MoodbarItemDelegate::ImageLoaded(const QUrl &url, const QImage &image) {
|
||||
const QSortFilterProxyModel *filter = playlist->proxy();
|
||||
|
||||
// Update all the indices with the new pixmap.
|
||||
for (const QPersistentModelIndex &idx : data->indexes_) {
|
||||
for (const QPersistentModelIndex &idx : qAsConst(data->indexes_)) {
|
||||
if (idx.isValid() && idx.sibling(idx.row(), Playlist::Column_Filename).data().toUrl() == url) {
|
||||
QModelIndex source_index = idx;
|
||||
if (idx.model() == filter) {
|
||||
|
@ -176,7 +176,8 @@ void MoodbarLoader::RequestFinished(MoodbarPipeline *request, const QUrl &url) {
|
||||
|
||||
// Save the data alongside the original as well if we're configured to.
|
||||
if (save_) {
|
||||
const QString mood_filename(MoodFilenames(url.toLocalFile())[0]);
|
||||
QList<QString> mood_filenames = MoodFilenames(url.toLocalFile());
|
||||
const QString mood_filename(mood_filenames[0]);
|
||||
QFile mood_file(mood_filename);
|
||||
if (mood_file.open(QIODevice::WriteOnly)) {
|
||||
mood_file.write(request->data());
|
||||
|
@ -104,7 +104,8 @@ void AcoustidClient::Cancel(const int id) {
|
||||
|
||||
void AcoustidClient::CancelAll() {
|
||||
|
||||
qDeleteAll(requests_.values());
|
||||
QList<QNetworkReply*> replies = requests_.values();
|
||||
qDeleteAll(replies);
|
||||
requests_.clear();
|
||||
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ OrganizeDialog::OrganizeDialog(TaskManager *task_manager, CollectionBackend *bac
|
||||
for (const QString &title : tag_titles) {
|
||||
QAction *action = tag_menu->addAction(title);
|
||||
QString tag = tags[title];
|
||||
QObject::connect(action, &QAction::triggered, [this, tag]() { InsertTag(tag); } );
|
||||
QObject::connect(action, &QAction::triggered, this, [this, tag]() { InsertTag(tag); } );
|
||||
}
|
||||
|
||||
ui_->insert->setMenu(tag_menu);
|
||||
|
@ -80,7 +80,7 @@ class OSDBase : public QObject {
|
||||
|
||||
void ReshowCurrentSong();
|
||||
|
||||
void ShowPreview(const Behaviour type, const QString &line1, const QString &line2, const Song &song);
|
||||
void ShowPreview(const OSDBase::Behaviour type, const QString &line1, const QString &line2, const Song &song);
|
||||
|
||||
private:
|
||||
enum MessageType {
|
||||
|
@ -866,7 +866,7 @@ void Playlist::MoveItemWithoutUndo(const int source, const int dest) {
|
||||
|
||||
void Playlist::MoveItemsWithoutUndo(const QList<int> &source_rows, int pos) {
|
||||
|
||||
layoutAboutToBeChanged();
|
||||
emit layoutAboutToBeChanged();
|
||||
PlaylistItemList moved_items;
|
||||
|
||||
if (pos < 0) {
|
||||
@ -909,14 +909,14 @@ void Playlist::MoveItemsWithoutUndo(const QList<int> &source_rows, int pos) {
|
||||
}
|
||||
current_virtual_index_ = virtual_items_.indexOf(current_row());
|
||||
|
||||
layoutChanged();
|
||||
emit layoutChanged();
|
||||
Save();
|
||||
|
||||
}
|
||||
|
||||
void Playlist::MoveItemsWithoutUndo(int start, const QList<int> &dest_rows) {
|
||||
|
||||
layoutAboutToBeChanged();
|
||||
emit layoutAboutToBeChanged();
|
||||
PlaylistItemList moved_items;
|
||||
|
||||
int pos = start;
|
||||
@ -959,7 +959,7 @@ void Playlist::MoveItemsWithoutUndo(int start, const QList<int> &dest_rows) {
|
||||
}
|
||||
current_virtual_index_ = virtual_items_.indexOf(current_row());
|
||||
|
||||
layoutChanged();
|
||||
emit layoutChanged();
|
||||
Save();
|
||||
|
||||
}
|
||||
@ -1357,7 +1357,7 @@ void Playlist::sort(int column, Qt::SortOrder order) {
|
||||
|
||||
void Playlist::ReOrderWithoutUndo(const PlaylistItemList &new_items) {
|
||||
|
||||
layoutAboutToBeChanged();
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
PlaylistItemList old_items = items_;
|
||||
items_ = new_items;
|
||||
@ -1372,7 +1372,7 @@ void Playlist::ReOrderWithoutUndo(const PlaylistItemList &new_items) {
|
||||
changePersistentIndex(idx, index(new_rows[item], idx.column(), idx.parent()));
|
||||
}
|
||||
|
||||
layoutChanged();
|
||||
emit layoutChanged();
|
||||
|
||||
emit PlaylistChanged();
|
||||
Save();
|
||||
@ -1392,7 +1392,7 @@ void Playlist::SetCurrentIsPaused(const bool paused) {
|
||||
current_is_paused_ = paused;
|
||||
|
||||
if (current_item_index_.isValid())
|
||||
dataChanged(index(current_item_index_.row(), 0), index(current_item_index_.row(), ColumnCount - 1));
|
||||
emit dataChanged(index(current_item_index_.row(), 0), index(current_item_index_.row(), ColumnCount - 1));
|
||||
}
|
||||
|
||||
void Playlist::Save() const {
|
||||
|
@ -298,7 +298,7 @@ class Playlist : public QAbstractListModel {
|
||||
void set_auto_sort(const bool auto_sort) { auto_sort_ = auto_sort; }
|
||||
|
||||
public slots:
|
||||
void set_current_row(const int i, const AutoScroll autoscroll = AutoScroll_Maybe, const bool is_stopping = false, const bool force_inform = false);
|
||||
void set_current_row(const int i, const Playlist::AutoScroll autoscroll = Playlist::AutoScroll_Maybe, const bool is_stopping = false, const bool force_inform = false);
|
||||
void Paused();
|
||||
void Playing();
|
||||
void Stopped();
|
||||
|
@ -131,7 +131,13 @@ void PlaylistItem::RemoveBackgroundColor(short priority) {
|
||||
background_colors_.remove(priority);
|
||||
}
|
||||
QColor PlaylistItem::GetCurrentBackgroundColor() const {
|
||||
return background_colors_.isEmpty() ? QColor() : background_colors_[background_colors_.keys().last()];
|
||||
|
||||
if (background_colors_.isEmpty()) return QColor();
|
||||
else {
|
||||
QList<short> background_colors_keys = background_colors_.keys();
|
||||
return background_colors_[background_colors_keys.last()];
|
||||
}
|
||||
|
||||
}
|
||||
bool PlaylistItem::HasCurrentBackgroundColor() const {
|
||||
return !background_colors_.isEmpty();
|
||||
@ -147,7 +153,13 @@ void PlaylistItem::RemoveForegroundColor(short priority) {
|
||||
foreground_colors_.remove(priority);
|
||||
}
|
||||
QColor PlaylistItem::GetCurrentForegroundColor() const {
|
||||
return foreground_colors_.isEmpty() ? QColor() : foreground_colors_[foreground_colors_.keys().last()];
|
||||
|
||||
if (foreground_colors_.isEmpty()) return QColor();
|
||||
else {
|
||||
QList<short> foreground_colors_keys = foreground_colors_.keys();
|
||||
return foreground_colors_[foreground_colors_keys.last()];
|
||||
}
|
||||
|
||||
}
|
||||
bool PlaylistItem::HasCurrentForegroundColor() const {
|
||||
return !foreground_colors_.isEmpty();
|
||||
|
@ -432,7 +432,7 @@ void PlaylistListContainer::Delete() {
|
||||
}
|
||||
|
||||
// Unfavorite the playlists
|
||||
for (int id : ids) {
|
||||
for (const int id : qAsConst(ids)) {
|
||||
app_->playlist_manager()->Favorite(id, false);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ void PlaylistListModel::RowsAboutToBeRemoved(const QModelIndex &parent, const in
|
||||
switch (idx.data(Role_Type).toInt()) {
|
||||
case Type_Playlist: {
|
||||
const int id = idx.data(Role_PlaylistId).toInt();
|
||||
QMap<int, QStandardItem*>::Iterator it = playlists_by_id_.find(id);
|
||||
QMap<int, QStandardItem*>::iterator it = playlists_by_id_.find(id);
|
||||
if (it != playlists_by_id_.end() && it.value() == item) {
|
||||
playlists_by_id_.erase(it);
|
||||
}
|
||||
|
@ -84,9 +84,10 @@ PlaylistManager::PlaylistManager(Application *app, QObject *parent)
|
||||
}
|
||||
|
||||
PlaylistManager::~PlaylistManager() {
|
||||
for (const Data &data : playlists_.values()) {
|
||||
delete data.p;
|
||||
}
|
||||
|
||||
QList<Data> datas = playlists_.values();
|
||||
for (const Data &data : datas) delete data.p;
|
||||
|
||||
}
|
||||
|
||||
void PlaylistManager::Init(CollectionBackend *collection_backend, PlaylistBackend *playlist_backend, PlaylistSequence *sequence, PlaylistContainer *playlist_container) {
|
||||
@ -130,7 +131,8 @@ QList<Playlist*> PlaylistManager::GetAllPlaylists() const {
|
||||
|
||||
QList<Playlist*> result;
|
||||
|
||||
for (const Data &data : playlists_.values()) {
|
||||
QList<Data> datas = playlists_.values();
|
||||
for (const Data &data : datas) {
|
||||
result.append(data.p);
|
||||
}
|
||||
|
||||
@ -339,7 +341,8 @@ bool PlaylistManager::Close(const int id) {
|
||||
if (playlists_.count() <= 1 || !playlists_.contains(id)) return false;
|
||||
|
||||
int next_id = -1;
|
||||
for (int possible_next_id : playlists_.keys()) {
|
||||
QList<int> playlist_ids = playlists_.keys();
|
||||
for (const int possible_next_id : playlist_ids) {
|
||||
if (possible_next_id != id) {
|
||||
next_id = possible_next_id;
|
||||
break;
|
||||
@ -491,7 +494,7 @@ void PlaylistManager::SongsDiscovered(const SongList &songs) {
|
||||
// Some songs might've changed in the collection, let's update any playlist items we have that match those songs
|
||||
|
||||
for (const Song &song : songs) {
|
||||
for (const Data &data : playlists_) {
|
||||
for (const Data &data : qAsConst(playlists_)) {
|
||||
PlaylistItemList items = data.p->collection_items_by_id(song.id());
|
||||
for (PlaylistItemPtr item : items) {
|
||||
if (item->Metadata().directory_id() != song.directory_id()) continue;
|
||||
@ -582,11 +585,13 @@ QString PlaylistManager::GetNameForNewPlaylist(const SongList &songs) {
|
||||
result = tr("Various artists");
|
||||
}
|
||||
else {
|
||||
result = artists.values().first();
|
||||
QStringList artist_names = artists.values();
|
||||
result = artist_names.first();
|
||||
}
|
||||
|
||||
if (!various_artists && albums.size() == 1) {
|
||||
result += " - " + albums.values().first();
|
||||
QStringList album_names = albums.values();
|
||||
result += " - " + album_names.first();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -68,7 +68,7 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
// read the first line already
|
||||
QString line = text_stream.readLine();
|
||||
|
||||
QList<CueEntry> entries;
|
||||
QVector<CueEntry> entries;
|
||||
int files = 0;
|
||||
|
||||
// -- whole file
|
||||
|
@ -138,10 +138,7 @@ void M3UParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
|
||||
continue;
|
||||
}
|
||||
if (writeMetadata) {
|
||||
QString meta = QString("#EXTINF:%1,%2 - %3\n")
|
||||
.arg(song.length_nanosec() / kNsecPerSec)
|
||||
.arg(song.artist())
|
||||
.arg(song.title());
|
||||
QString meta = QString("#EXTINF:%1,%2 - %3\n").arg(song.length_nanosec() / kNsecPerSec).arg(song.artist(), song.title());
|
||||
device->write(meta.toUtf8());
|
||||
}
|
||||
device->write(URLOrFilename(song.url(), dir, path_type).toUtf8());
|
||||
|
@ -112,7 +112,8 @@ QString PlaylistParser::FilterForParser(const ParserBase *parser, QStringList *a
|
||||
}
|
||||
|
||||
QString PlaylistParser::default_extension() const {
|
||||
return default_parser_->file_extensions()[0];
|
||||
QStringList file_extensions = default_parser_->file_extensions();
|
||||
return file_extensions[0];
|
||||
}
|
||||
|
||||
QString PlaylistParser::default_filter() const {
|
||||
|
@ -56,8 +56,8 @@ class QobuzFavoriteRequest : public QobuzBaseRequest {
|
||||
void SongsRemoved(SongList);
|
||||
|
||||
private slots:
|
||||
void AddFavoritesReply(QNetworkReply *reply, const FavoriteType type, const SongList &songs);
|
||||
void RemoveFavoritesReply(QNetworkReply *reply, const FavoriteType type, const SongList &songs);
|
||||
void AddFavoritesReply(QNetworkReply *reply, const QobuzFavoriteRequest::FavoriteType type, const SongList &songs);
|
||||
void RemoveFavoritesReply(QNetworkReply *reply, const QobuzFavoriteRequest::FavoriteType type, const SongList &songs);
|
||||
|
||||
public slots:
|
||||
void AddArtists(const SongList &songs);
|
||||
|
@ -1234,7 +1234,7 @@ void QobuzRequest::AlbumCoverReceived(QNetworkReply *reply, const QUrl &cover_ur
|
||||
|
||||
QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString();
|
||||
if (!ImageUtils::SupportedImageMimeTypes().contains(mimetype, Qt::CaseInsensitive) && !ImageUtils::SupportedImageFormats().contains(mimetype, Qt::CaseInsensitive)) {
|
||||
Error(QString("Unsupported mimetype for image reader %1 for %2").arg(mimetype).arg(cover_url.toString()));
|
||||
Error(QString("Unsupported mimetype for image reader %1 for %2").arg(mimetype, cover_url.toString()));
|
||||
if (album_covers_requests_sent_.contains(cover_url)) album_covers_requests_sent_.remove(cover_url);
|
||||
AlbumCoverFinishCheck();
|
||||
return;
|
||||
|
@ -205,7 +205,7 @@ void QobuzStreamURLRequest::StreamURLReceived() {
|
||||
|
||||
Song::FileType filetype(Song::FileType_Unknown);
|
||||
QMimeDatabase mimedb;
|
||||
for (QString suffix : mimedb.mimeTypeForName(mimetype.toUtf8()).suffixes()) {
|
||||
for (const QString &suffix : mimedb.mimeTypeForName(mimetype.toUtf8()).suffixes()) {
|
||||
filetype = Song::FiletypeByExtension(suffix);
|
||||
if (filetype != Song::FileType_Unknown) break;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ void Queue::Clear() {
|
||||
|
||||
void Queue::Move(const QList<int> &proxy_rows, int pos) {
|
||||
|
||||
layoutAboutToBeChanged();
|
||||
emit layoutAboutToBeChanged();
|
||||
QList<QPersistentModelIndex> moved_items;
|
||||
|
||||
// Take the items out of the list first, keeping track of whether the insertion point changes
|
||||
@ -308,7 +308,7 @@ void Queue::Move(const QList<int> &proxy_rows, int pos) {
|
||||
}
|
||||
}
|
||||
|
||||
layoutChanged();
|
||||
emit layoutChanged();
|
||||
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ void Queue::Remove(QList<int> &proxy_rows) {
|
||||
std::stable_sort(proxy_rows.begin(), proxy_rows.end());
|
||||
|
||||
// Reflects immediately changes in the playlist
|
||||
layoutAboutToBeChanged();
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
int removed_rows = 0;
|
||||
for (int row : proxy_rows) {
|
||||
@ -458,6 +458,6 @@ void Queue::Remove(QList<int> &proxy_rows) {
|
||||
removed_rows++;
|
||||
}
|
||||
|
||||
layoutChanged();
|
||||
emit layoutChanged();
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,11 @@
|
||||
|
||||
#include "scrobblerservice.h"
|
||||
|
||||
ScrobblerService::ScrobblerService(const QString &name, Application *app, QObject *parent) : QObject(parent), name_(name) { Q_UNUSED(app); }
|
||||
ScrobblerService::ScrobblerService(const QString &name, Application *app, QObject *parent) : QObject(parent), name_(name) {
|
||||
|
||||
Q_UNUSED(app);
|
||||
|
||||
}
|
||||
|
||||
QJsonObject ScrobblerService::ExtractJsonObj(const QByteArray &data, const bool ignore_empty) {
|
||||
|
||||
|
@ -134,7 +134,7 @@ AppearanceSettingsPage::AppearanceSettingsPage(SettingsDialog *dialog)
|
||||
ui_->checkbox_system_icons->hide();
|
||||
#endif
|
||||
|
||||
Load();
|
||||
AppearanceSettingsPage::Load();
|
||||
|
||||
}
|
||||
|
||||
|
@ -118,27 +118,29 @@ void CoversSettingsPage::CurrentItemChanged(QListWidgetItem *item_current, QList
|
||||
ui_->providers_up->setEnabled(row != 0);
|
||||
ui_->providers_down->setEnabled(row != ui_->providers->count() - 1);
|
||||
CoverProvider *provider = dialog()->app()->cover_providers()->ProviderByName(item_current->text());
|
||||
if (provider && provider->AuthenticationRequired()) {
|
||||
if (provider->name() == "Tidal" && !provider->IsAuthenticated()) {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("Use Tidal settings to authenticate."));
|
||||
}
|
||||
else if (provider->name() == "Qobuz" && !provider->IsAuthenticated()) {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("Use Qobuz settings to authenticate."));
|
||||
if (provider) {
|
||||
if (provider->AuthenticationRequired()) {
|
||||
if (provider->name() == "Tidal" && !provider->IsAuthenticated()) {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("Use Tidal settings to authenticate."));
|
||||
}
|
||||
else if (provider->name() == "Qobuz" && !provider->IsAuthenticated()) {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("Use Qobuz settings to authenticate."));
|
||||
}
|
||||
else {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
ui_->label_auth_info->setText(tr("%1 needs authentication.").arg(provider->name()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
ui_->label_auth_info->setText(tr("%1 needs authentication.").arg(provider->name()));
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("%1 does not need authentication.").arg(provider->name()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(tr("%1 does not need authentication.").arg(provider->name()));
|
||||
}
|
||||
provider_selected_ = true;
|
||||
}
|
||||
else {
|
||||
|
@ -147,7 +147,8 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
}
|
||||
#endif
|
||||
|
||||
for (const GlobalShortcutsManager::Shortcut &i : manager->shortcuts().values()) {
|
||||
QList<GlobalShortcutsManager::Shortcut> shortcuts = manager->shortcuts().values();
|
||||
for (const GlobalShortcutsManager::Shortcut &i : shortcuts) {
|
||||
Shortcut shortcut;
|
||||
shortcut.s = i;
|
||||
shortcut.key = i.action->shortcut();
|
||||
@ -160,7 +161,8 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
ItemClicked(ui_->list->topLevelItem(0));
|
||||
}
|
||||
|
||||
for (const Shortcut &shortcut : shortcuts_.values()) {
|
||||
QList<Shortcut> shortcuts = shortcuts_.values();
|
||||
for (const Shortcut &shortcut : shortcuts) {
|
||||
SetShortcut(shortcut.s.id, shortcut.s.action->shortcut());
|
||||
}
|
||||
|
||||
@ -202,7 +204,8 @@ void GlobalShortcutsSettingsPage::Save() {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
for (const Shortcut &shortcut : shortcuts_.values()) {
|
||||
QList<Shortcut> shortcuts = shortcuts_.values();
|
||||
for (const Shortcut &shortcut : shortcuts) {
|
||||
shortcut.s.action->setShortcut(shortcut.key);
|
||||
shortcut.s.shortcut->setKey(shortcut.key);
|
||||
s.setValue(shortcut.s.id, shortcut.key.toString());
|
||||
@ -299,7 +302,8 @@ void GlobalShortcutsSettingsPage::ChangeClicked() {
|
||||
if (key.isEmpty()) return;
|
||||
|
||||
// Check if this key sequence is used by any other actions
|
||||
for (const QString &id : shortcuts_.keys()) {
|
||||
QStringList ids = shortcuts_.keys();
|
||||
for (const QString &id : ids) {
|
||||
if (shortcuts_[id].key == key) SetShortcut(id, QKeySequence());
|
||||
}
|
||||
|
||||
|
@ -118,18 +118,20 @@ void LyricsSettingsPage::CurrentItemChanged(QListWidgetItem *item_current, QList
|
||||
ui_->providers_up->setEnabled(row != 0);
|
||||
ui_->providers_down->setEnabled(row != ui_->providers->count() - 1);
|
||||
LyricsProvider *provider = dialog()->app()->lyrics_providers()->ProviderByName(item_current->text());
|
||||
if (provider && provider->AuthenticationRequired()) {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
ui_->label_auth_info->setText(QString("%1 needs authentication.").arg(provider->name()));
|
||||
if (provider) {
|
||||
if (provider->AuthenticationRequired()) {
|
||||
ui_->login_state->SetLoggedIn(provider->IsAuthenticated() ? LoginStateWidget::LoggedIn : LoginStateWidget::LoggedOut);
|
||||
ui_->button_authenticate->setEnabled(true);
|
||||
ui_->button_authenticate->show();
|
||||
ui_->login_state->show();
|
||||
ui_->label_auth_info->setText(QString("%1 needs authentication.").arg(provider->name()));
|
||||
}
|
||||
else {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(QString("%1 does not need authentication.").arg(provider->name()));
|
||||
}
|
||||
provider_selected_ = true;
|
||||
}
|
||||
else {
|
||||
DisableAuthentication();
|
||||
ui_->label_auth_info->setText(QString("%1 does not need authentication.").arg(provider->name()));
|
||||
}
|
||||
provider_selected_ = true;
|
||||
}
|
||||
else {
|
||||
DisableAuthentication();
|
||||
|
@ -58,7 +58,7 @@ MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog* dialog)
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("moodbar"));
|
||||
|
||||
Load();
|
||||
MoodbarSettingsPage::Load();
|
||||
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,8 @@ void SettingsDialog::showEvent(QShowEvent *e) {
|
||||
LoadGeometry();
|
||||
// Load settings
|
||||
loading_settings_ = true;
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Load();
|
||||
}
|
||||
loading_settings_ = false;
|
||||
@ -212,7 +213,8 @@ void SettingsDialog::closeEvent(QCloseEvent*) {
|
||||
|
||||
void SettingsDialog::accept() {
|
||||
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Accept();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
@ -226,7 +228,8 @@ void SettingsDialog::accept() {
|
||||
void SettingsDialog::reject() {
|
||||
|
||||
// Notify each page that user clicks on Cancel
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Reject();
|
||||
}
|
||||
SaveGeometry();
|
||||
@ -323,7 +326,8 @@ void SettingsDialog::AddPage(Page id, SettingsPage *page, QTreeWidgetItem *paren
|
||||
|
||||
void SettingsDialog::Save() {
|
||||
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Apply();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
@ -335,7 +339,8 @@ void SettingsDialog::DialogButtonClicked(QAbstractButton *button) {
|
||||
|
||||
// While we only connect Apply at the moment, this might change in the future
|
||||
if (ui_->buttonBox->button(QDialogButtonBox::Apply) == button) {
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
page.page_->Apply();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
@ -364,7 +369,8 @@ void SettingsDialog::CurrentItemChanged(QTreeWidgetItem *item) {
|
||||
ui_->title->setText("<b>" + item->text(0) + "</b>");
|
||||
|
||||
// Display the right page
|
||||
for (const PageData &page : pages_.values()) {
|
||||
QList<PageData> pages = pages_.values();
|
||||
for (const PageData &page : pages) {
|
||||
if (page.item_ == item) {
|
||||
ui_->stacked_widget->setCurrentWidget(page.scroll_area_);
|
||||
break;
|
||||
|
@ -641,7 +641,8 @@ QString SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, cons
|
||||
Song::FileType filetype(Song::FileType_Stream);
|
||||
if (!mimetype.isEmpty()) {
|
||||
QMimeDatabase mimedb;
|
||||
for (QString suffix : mimedb.mimeTypeForName(mimetype.toUtf8()).suffixes()) {
|
||||
QStringList suffixes = mimedb.mimeTypeForName(mimetype.toUtf8()).suffixes();
|
||||
for (const QString &suffix : suffixes) {
|
||||
filetype = Song::FiletypeByExtension(suffix);
|
||||
if (filetype != Song::FileType_Unknown) break;
|
||||
}
|
||||
@ -789,7 +790,7 @@ void SubsonicRequest::AlbumCoverReceived(QNetworkReply *reply, const QUrl url, c
|
||||
|
||||
QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString();
|
||||
if (!ImageUtils::SupportedImageMimeTypes().contains(mimetype, Qt::CaseInsensitive) && !ImageUtils::SupportedImageFormats().contains(mimetype, Qt::CaseInsensitive)) {
|
||||
Error(QString("Unsupported mimetype for image reader %1 for %2").arg(mimetype).arg(url.toString()));
|
||||
Error(QString("Unsupported mimetype for image reader %1 for %2").arg(mimetype, url.toString()));
|
||||
if (album_covers_requests_sent_.contains(url)) album_covers_requests_sent_.remove(url);
|
||||
AlbumCoverFinishCheck();
|
||||
return;
|
||||
|
@ -99,7 +99,7 @@ SubsonicService::SubsonicService(Application *app, QObject *parent)
|
||||
collection_sort_model_->setSortLocaleAware(true);
|
||||
collection_sort_model_->sort(0);
|
||||
|
||||
ReloadSettings();
|
||||
SubsonicService::ReloadSettings();
|
||||
|
||||
}
|
||||
|
||||
|
@ -125,12 +125,12 @@ QByteArray TidalBaseRequest::GetReplyData(QNetworkReply *reply, const bool send_
|
||||
}
|
||||
}
|
||||
if (status == 401 && sub_status == 6001) { // User does not have a valid session
|
||||
emit service_->Logout();
|
||||
service_->Logout();
|
||||
if (!oauth() && send_login && login_attempts() < max_login_attempts() && !api_token().isEmpty() && !username().isEmpty() && !password().isEmpty()) {
|
||||
qLog(Error) << "Tidal:" << error;
|
||||
qLog(Info) << "Tidal:" << "Attempting to login.";
|
||||
NeedLogin();
|
||||
emit service_->Login();
|
||||
service_->Login();
|
||||
}
|
||||
else {
|
||||
Error(error);
|
||||
|
@ -60,8 +60,8 @@ class TidalFavoriteRequest : public TidalBaseRequest {
|
||||
void SongsRemoved(SongList);
|
||||
|
||||
private slots:
|
||||
void AddFavoritesReply(QNetworkReply *reply, const FavoriteType type, const SongList &songs);
|
||||
void RemoveFavoritesReply(QNetworkReply *reply, const FavoriteType type, const SongList &songs);
|
||||
void AddFavoritesReply(QNetworkReply *reply, const TidalFavoriteRequest::FavoriteType type, const SongList &songs);
|
||||
void RemoveFavoritesReply(QNetworkReply *reply, const TidalFavoriteRequest::FavoriteType type, const SongList &songs);
|
||||
|
||||
public slots:
|
||||
void AddArtists(const SongList &songs);
|
||||
|
@ -183,7 +183,7 @@ TidalService::TidalService(Application *app, QObject *parent)
|
||||
QObject::connect(favorite_request_, &TidalFavoriteRequest::AlbumsRemoved, albums_collection_backend_, &CollectionBackend::DeleteSongs);
|
||||
QObject::connect(favorite_request_, &TidalFavoriteRequest::SongsRemoved, songs_collection_backend_, &CollectionBackend::DeleteSongs);
|
||||
|
||||
ReloadSettings();
|
||||
TidalService::ReloadSettings();
|
||||
LoadSession();
|
||||
|
||||
}
|
||||
@ -351,7 +351,6 @@ void TidalService::AuthorizationUrlReceived(const QUrl &url) {
|
||||
else if (url_query.hasQueryItem("code") && url_query.hasQueryItem("state")) {
|
||||
|
||||
QString code = url_query.queryItemValue("code");
|
||||
QString state = url_query.queryItemValue("state");
|
||||
|
||||
RequestAccessToken(code);
|
||||
|
||||
|
@ -249,7 +249,8 @@ void TidalStreamURLRequest::StreamURLReceived() {
|
||||
|
||||
QString mimetype = json_obj["mimeType"].toString();
|
||||
QMimeDatabase mimedb;
|
||||
for (QString suffix : mimedb.mimeTypeForName(mimetype.toUtf8()).suffixes()) {
|
||||
QStringList suffixes = mimedb.mimeTypeForName(mimetype.toUtf8()).suffixes();
|
||||
for (const QString &suffix : suffixes) {
|
||||
filetype = Song::FiletypeByExtension(suffix);
|
||||
if (filetype != Song::FileType_Unknown) break;
|
||||
}
|
||||
|
@ -294,7 +294,8 @@ void TranscodeDialog::UpdateProgress() {
|
||||
int progress = (finished_success_ + finished_failed_) * 100;
|
||||
|
||||
QMap<QString, float> current_jobs = transcoder_->GetProgress();
|
||||
for (float value : current_jobs.values()) {
|
||||
QList<float> values = current_jobs.values();
|
||||
for (const float value : values) {
|
||||
progress += qBound(0, int(value * 100), 99);
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ QString Transcoder::GetFile(const QString &input, const TranscoderPreset &preset
|
||||
QString filename = fileinfo_output.completeBaseName();
|
||||
QString suffix = fileinfo_output.suffix();
|
||||
for (int i = 0;; ++i) {
|
||||
QString new_filename = QString("%1/%2-%3.%4").arg(path).arg(filename).arg(i).arg(suffix);
|
||||
QString new_filename = QString("%1/%2-%3.%4").arg(path, filename).arg(i).arg(suffix);
|
||||
fileinfo_output.setFile(new_filename);
|
||||
if (!fileinfo_output.exists()) {
|
||||
break;
|
||||
|
@ -180,7 +180,8 @@ class FancyTabBar: public QTabBar {
|
||||
|
||||
// if LargeSidebar, restore spacers
|
||||
if (tabWidget->mode() == FancyTabWidget::Mode_LargeSidebar && spacers.count() > 0) {
|
||||
for (int index : spacers.keys()) {
|
||||
QList<int> keys = spacers.keys();
|
||||
for (const int index : keys) {
|
||||
tabWidget->insertTab(index, spacers[index], QIcon(), QString());
|
||||
tabWidget->setTabEnabled(index, false);
|
||||
}
|
||||
@ -472,7 +473,7 @@ void FancyTabWidget::Load(const QString &kSettingsGroup) {
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
QMultiMap <int, TabData*> tabs;
|
||||
for (TabData *tab : tabs_) {
|
||||
for (TabData *tab : qAsConst(tabs_)) {
|
||||
int idx = s.value("tab_" + tab->name(), tab->index()).toInt();
|
||||
while (tabs.contains(idx)) { ++idx; }
|
||||
tabs.insert(idx, tab);
|
||||
@ -500,7 +501,7 @@ void FancyTabWidget::SaveSettings(const QString &kSettingsGroup) {
|
||||
s.setValue("tab_mode", mode_);
|
||||
s.setValue("current_tab", currentIndex());
|
||||
|
||||
for (TabData *tab : tabs_) {
|
||||
for (TabData *tab : qAsConst(tabs_)) {
|
||||
QString k = "tab_" + tab->name();
|
||||
int idx = QTabWidget::indexOf(tab->page());
|
||||
if (idx < 0) {
|
||||
|
@ -88,7 +88,7 @@ class FancyTabWidget : public QTabWidget {
|
||||
|
||||
public slots:
|
||||
void setCurrentIndex(int idx);
|
||||
void SetMode(Mode mode);
|
||||
void SetMode(Core::Internal::FancyTabWidget::Mode mode);
|
||||
// Mapper mapped signal needs this convenience function
|
||||
void SetMode(int mode) { SetMode(Mode(mode)); }
|
||||
|
||||
|
@ -60,6 +60,11 @@ class FileViewList : public QListView {
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *e) override;
|
||||
|
||||
private:
|
||||
QStringList FilenamesFromSelection() const;
|
||||
QList<QUrl> UrlListFromSelection() const;
|
||||
MimeData *MimeDataFromSelection() const;
|
||||
|
||||
private slots:
|
||||
void LoadSlot();
|
||||
void AddToPlaylistSlot();
|
||||
@ -71,10 +76,6 @@ class FileViewList : public QListView {
|
||||
void EditTagsSlot();
|
||||
void ShowInBrowser();
|
||||
|
||||
QStringList FilenamesFromSelection() const;
|
||||
QList<QUrl> UrlListFromSelection() const;
|
||||
MimeData *MimeDataFromSelection() const;
|
||||
|
||||
private:
|
||||
QMenu *menu_;
|
||||
QItemSelection menu_selection_;
|
||||
|
@ -69,7 +69,7 @@ FreeSpaceBar::FreeSpaceBar(QWidget *parent)
|
||||
additional_text_(tr("New songs")),
|
||||
used_text_(tr("Used"))
|
||||
{
|
||||
setMinimumHeight(sizeHint().height());
|
||||
setMinimumHeight(FreeSpaceBar::sizeHint().height());
|
||||
}
|
||||
|
||||
QSize FreeSpaceBar::sizeHint() const {
|
||||
|
@ -32,13 +32,14 @@
|
||||
#include "linetextedit.h"
|
||||
|
||||
LineTextEdit::LineTextEdit(QWidget *parent)
|
||||
: QTextEdit(parent)
|
||||
{
|
||||
: QTextEdit(parent) {
|
||||
|
||||
setWordWrapMode(QTextOption::NoWrap);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setTabChangesFocus(true);
|
||||
sizePolicy().setVerticalPolicy(QSizePolicy::Fixed);
|
||||
setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Fixed);
|
||||
|
||||
}
|
||||
|
||||
QSize LineTextEdit::sizeHint() const {
|
||||
|
@ -54,7 +54,7 @@ class LoginStateWidget : public QWidget {
|
||||
|
||||
public slots:
|
||||
// Changes the "You are logged in/out" label, shows/hides any QGroupBoxes added with AddCredentialGroup.
|
||||
void SetLoggedIn(const State state, const QString &account_name = QString());
|
||||
void SetLoggedIn(const LoginStateWidget::State state, const QString &account_name = QString());
|
||||
|
||||
// Hides the "You are logged in/out" label completely.
|
||||
void HideLoggedInState();
|
||||
|
@ -34,9 +34,11 @@ RatingPainter::RatingPainter() {
|
||||
|
||||
// Load the base pixmaps
|
||||
QIcon star_on(":/pictures/star-on.png");
|
||||
QPixmap on(star_on.pixmap(star_on.availableSizes().last()));
|
||||
QList<QSize> star_on_sizes = star_on.availableSizes();
|
||||
QPixmap on(star_on.pixmap(star_on_sizes.last()));
|
||||
QIcon star_off(":/pictures/star-off.png");
|
||||
QPixmap off(star_off.pixmap(star_off.availableSizes().last()));
|
||||
QList<QSize> star_off_sizes = star_off.availableSizes();
|
||||
QPixmap off(star_off.pixmap(star_off_sizes.last()));
|
||||
|
||||
// Generate the 10 states, better to do it now than on the fly
|
||||
for (int i = 0 ; i < kStarCount * 2 + 1 ; ++i) {
|
||||
|
@ -171,6 +171,7 @@ void PrettySlider::mousePressEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
void PrettySlider::slideEvent(QMouseEvent *e) {
|
||||
|
||||
if (m_mode == Pretty)
|
||||
QSlider::setValue(
|
||||
orientation() == Qt::Horizontal
|
||||
@ -178,6 +179,7 @@ void PrettySlider::slideEvent(QMouseEvent *e) {
|
||||
: QStyle::sliderValueFromPosition(minimum(), maximum(), e->pos().y(), height() - 2));
|
||||
else
|
||||
SliderSlider::slideEvent(e);
|
||||
|
||||
}
|
||||
|
||||
namespace Amarok {
|
||||
|
Loading…
x
Reference in New Issue
Block a user