Fix various clazy warnings

This commit is contained in:
Jonas Kvinge
2021-03-21 04:47:11 +01:00
parent 20c1c1d4be
commit 78588d8cdf
92 changed files with 337 additions and 234 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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();