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 GroupBy_None:
case GroupByCount: case GroupByCount:
// fallthrough break;
;
} }
qLog(Error) << "Unknown GroupBy type" << type << "for divider key" << key; qLog(Error) << "Unknown GroupBy type" << type << "for divider key" << key;
return QString(); 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()) { if (tray_icon_->IsSystemTrayAvailable() && tray_icon_->isVisible()) {
break; break;
} }
// fallthrough [[fallthrough]];
case BehaviourSettingsPage::Startup_Remember: case BehaviourSettingsPage::Startup_Remember:
default: { default: {

View File

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

View File

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

View File

@@ -217,7 +217,7 @@ QUrl AlbumCoverChoiceController::LoadCoverFromFile(Song *song) {
SaveCoverEmbeddedAutomatic(*song, cover_file); SaveCoverEmbeddedAutomatic(*song, cover_file);
return QUrl::fromLocalFile(Song::kEmbeddedCover); return QUrl::fromLocalFile(Song::kEmbeddedCover);
} }
// fallthrough [[fallthrough]];
case CollectionSettingsPage::SaveCoverType_Cache: case CollectionSettingsPage::SaveCoverType_Cache:
case CollectionSettingsPage::SaveCoverType_Album:{ case CollectionSettingsPage::SaveCoverType_Album:{
QUrl cover_url = QUrl::fromLocalFile(cover_file); QUrl cover_url = QUrl::fromLocalFile(cover_file);
@@ -789,7 +789,7 @@ QUrl AlbumCoverChoiceController::SaveCoverAutomatic(Song *song, const AlbumCover
break; break;
} }
} }
// fallthrough [[fallthrough]];
case CollectionSettingsPage::SaveCoverType_Cache: case CollectionSettingsPage::SaveCoverType_Cache:
case CollectionSettingsPage::SaveCoverType_Album:{ case CollectionSettingsPage::SaveCoverType_Album:{
cover_url = SaveCoverToFileAutomatic(song, result); 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(); filename = album_id + "-" + cover_url.fileName();
break; break;
} }
// fallthrough [[fallthrough]];
case Song::Source_Subsonic: case Song::Source_Subsonic:
case Song::Source_Qobuz: case Song::Source_Qobuz:
if (!album_id.isEmpty()) { if (!album_id.isEmpty()) {
filename = album_id; filename = album_id;
break; break;
} }
// fallthrough [[fallthrough]];
case Song::Source_Collection: case Song::Source_Collection:
case Song::Source_LocalFile: case Song::Source_LocalFile:
case Song::Source_CDDA: case Song::Source_CDDA:

View File

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

View File

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

View File

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