Use C++17 fallthrough

This commit is contained in:
Jonas Kvinge 2022-07-26 20:37:06 +02:00
parent 33581fa61d
commit 98682a2da9
10 changed files with 15 additions and 16 deletions

View File

@ -511,8 +511,7 @@ QString CollectionModel::DividerDisplayText(const GroupBy type, const QString &k
case GroupBy_None:
case GroupByCount:
// fallthrough
;
break;
}
qLog(Error) << "Unknown GroupBy type" << type << "for divider key" << key;
return QString();

View File

@ -963,7 +963,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
if (tray_icon_->IsSystemTrayAvailable() && tray_icon_->isVisible()) {
break;
}
// fallthrough
[[fallthrough]];
case BehaviourSettingsPage::Startup_Remember:
default: {

View File

@ -624,7 +624,7 @@ void Player::EngineStateChanged(const Engine::State state) {
break;
case Engine::Error:
emit Error();
// fallthrough
[[fallthrough]];
case Engine::Empty:
case Engine::Idle:
pause_time_ = QDateTime();

View File

@ -646,7 +646,7 @@ void SongLoader::EndOfStreamReached() {
if (state_ == Finished) break;
// It looks like a playlist, so parse it
// fallthrough
[[fallthrough]];
case WaitingForData:
// It's a playlist and we've got all the data - finish and parse it
StopTypefindAsync(true);

View File

@ -217,7 +217,7 @@ QUrl AlbumCoverChoiceController::LoadCoverFromFile(Song *song) {
SaveCoverEmbeddedAutomatic(*song, cover_file);
return QUrl::fromLocalFile(Song::kEmbeddedCover);
}
// fallthrough
[[fallthrough]];
case CollectionSettingsPage::SaveCoverType_Cache:
case CollectionSettingsPage::SaveCoverType_Album:{
QUrl cover_url = QUrl::fromLocalFile(cover_file);
@ -789,7 +789,7 @@ QUrl AlbumCoverChoiceController::SaveCoverAutomatic(Song *song, const AlbumCover
break;
}
}
// fallthrough
[[fallthrough]];
case CollectionSettingsPage::SaveCoverType_Cache:
case CollectionSettingsPage::SaveCoverType_Album:{
cover_url = SaveCoverToFileAutomatic(song, result);

View File

@ -186,14 +186,14 @@ QString AlbumCoverLoader::CoverFilenameFromSource(const Song::Source source, con
filename = album_id + "-" + cover_url.fileName();
break;
}
// fallthrough
[[fallthrough]];
case Song::Source_Subsonic:
case Song::Source_Qobuz:
if (!album_id.isEmpty()) {
filename = album_id;
break;
}
// fallthrough
[[fallthrough]];
case Song::Source_Collection:
case Song::Source_LocalFile:
case Song::Source_CDDA:

View File

@ -306,7 +306,7 @@ void OSDBase::ShowMessage(const QString &summary, const QString &message, const
case Native:
#ifdef Q_OS_WIN32
Q_UNUSED(icon)
// fallthrough
[[fallthrough]];
#else
if (image.isNull()) {
ShowMessageNative(summary, message, icon, QImage());
@ -318,7 +318,7 @@ void OSDBase::ShowMessage(const QString &summary, const QString &message, const
#endif
case TrayPopup:
#ifdef Q_OS_MACOS
// fallthrough
[[fallthrough]];
#else
if (tray_icon_) tray_icon_->ShowPopup(summary, message, timeout_msec_);
break;
@ -326,7 +326,7 @@ void OSDBase::ShowMessage(const QString &summary, const QString &message, const
case Disabled:
if (!force_show_next_) break;
force_show_next_ = false;
// fallthrough
[[fallthrough]];
case Pretty:
pretty_popup_->ShowMessage(summary, message, image);
break;
@ -401,7 +401,7 @@ QString OSDBase::ReplaceMessage(const MessageType type, const QString &message,
}
break;
#elif defined(Q_OS_WIN32)
// fallthrough
[[fallthrough]];
#else
// Other OSes doesn't support native notifications.
qLog(Debug) << "Native notifications are not supported on this OS.";

View File

@ -178,7 +178,7 @@ void ScrobblingAPI20::Authenticate(const bool https) {
messagebox_error.setTextFormat(Qt::RichText);
messagebox_error.exec();
}
// fallthrough
[[fallthrough]];
case QMessageBox::Save:
QApplication::clipboard()->setText(url.toString());
break;

View File

@ -196,7 +196,7 @@ void BehaviourSettingsPage::Load() {
break;
}
;
// fallthrough
[[fallthrough]];
case BehaviourSettingsPage::Startup_Remember:
default:
ui_->radiobutton_remember->setChecked(true);

View File

@ -913,7 +913,7 @@ void TidalRequest::SongsFinishCheck(const QString &artist_id, const QString &alb
AddSongsSearchRequest(offset_next);
break;
}
// fallthrough
[[fallthrough]];
case QueryType_Artists:
case QueryType_SearchArtists:
case QueryType_Albums: