diff --git a/3rdparty/macdeployqt/shared.cpp b/3rdparty/macdeployqt/shared.cpp index 556ef979..e0e60d97 100644 --- a/3rdparty/macdeployqt/shared.cpp +++ b/3rdparty/macdeployqt/shared.cpp @@ -293,7 +293,7 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl // Split the line into [Qt-path]/lib/qt[Module].framework/Versions/[Version]/ QStringList parts = trimmed.split("/"); while (part < parts.count()) { - const QString currentPart = parts.at(part).simplified() ; + const QString currentPart = parts.at(part).simplified(); ++part; if (currentPart == "") continue; diff --git a/ext/libstrawberry-common/core/logging.cpp b/ext/libstrawberry-common/core/logging.cpp index 9c19dfd3..0e4e03a5 100644 --- a/ext/libstrawberry-common/core/logging.cpp +++ b/ext/libstrawberry-common/core/logging.cpp @@ -178,7 +178,7 @@ void SetLevels(const QString &levels) { if (!sClassLevels) return; - for (const QString& item : levels.split(',')) { + for (const QString &item : levels.split(',')) { const QStringList class_level = item.split(':'); QString class_name; @@ -224,7 +224,7 @@ static QString ParsePrettyFunction(const char *pretty_function) { const int space = class_name.lastIndexOf(' '); if (space != -1) { - class_name = class_name.mid(space+1); + class_name = class_name.mid(space + 1); } return class_name; @@ -332,9 +332,9 @@ QString DemangleSymbol(const QString &symbol) { void DumpStackTrace() { #ifdef HAVE_BACKTRACE - void* callstack[128]; + void *callstack[128]; int callstack_size = backtrace(reinterpret_cast(&callstack), sizeof(callstack)); - char** symbols = backtrace_symbols(reinterpret_cast(&callstack), callstack_size); + char **symbols = backtrace_symbols(reinterpret_cast(&callstack), callstack_size); // Start from 1 to skip ourself. for (int i = 1; i < callstack_size; ++i) { std::cerr << DemangleSymbol(QString::fromLatin1(symbols[i])).toStdString() << std::endl; @@ -350,9 +350,9 @@ void DumpStackTrace() { // doesn't override any behavior that should be needed after return. #define qCreateLogger(line, pretty_function, category, level) logging::CreateLogger(logging::Level_##level, logging::ParsePrettyFunction(pretty_function), line, category) -QDebug CreateLoggerInfo(int line, const char *pretty_function, const char* category) { return qCreateLogger(line, pretty_function, category, Info); } -QDebug CreateLoggerFatal(int line, const char *pretty_function, const char* category) { return qCreateLogger(line, pretty_function, category, Fatal); } -QDebug CreateLoggerError(int line, const char *pretty_function, const char* category) { return qCreateLogger(line, pretty_function, category, Error); } +QDebug CreateLoggerInfo(int line, const char *pretty_function, const char *category) { return qCreateLogger(line, pretty_function, category, Info); } +QDebug CreateLoggerFatal(int line, const char *pretty_function, const char *category) { return qCreateLogger(line, pretty_function, category, Fatal); } +QDebug CreateLoggerError(int line, const char *pretty_function, const char *category) { return qCreateLogger(line, pretty_function, category, Error); } #ifdef QT_NO_WARNING_OUTPUT QNoDebug CreateLoggerWarning(int, const char*, const char*) { return QNoDebug(); } @@ -371,7 +371,7 @@ QDebug CreateLoggerError(int line, const char *pretty_function, const char* cate namespace { template -QString print_duration(T duration, const std::string& unit) { +QString print_duration(T duration, const std::string &unit) { return QString("%1%2").arg(duration.count()).arg(unit.c_str()); } diff --git a/src/collection/collectionbackend.cpp b/src/collection/collectionbackend.cpp index a082175c..31bb19b7 100644 --- a/src/collection/collectionbackend.cpp +++ b/src/collection/collectionbackend.cpp @@ -52,11 +52,11 @@ #include "collectionquery.h" #include "sqlrow.h" -CollectionBackend::CollectionBackend(QObject *parent) : - CollectionBackendInterface(parent), - db_(nullptr), - source_(Song::Source_Unknown), - original_thread_(nullptr) { +CollectionBackend::CollectionBackend(QObject *parent) + : CollectionBackendInterface(parent), + db_(nullptr), + source_(Song::Source_Unknown), + original_thread_(nullptr) { original_thread_ = thread(); diff --git a/src/collection/collectionbackend.h b/src/collection/collectionbackend.h index ea4b772d..e224fd0b 100644 --- a/src/collection/collectionbackend.h +++ b/src/collection/collectionbackend.h @@ -50,14 +50,14 @@ class CollectionBackendInterface : public QObject { struct Album { Album() {} - Album(const QString &_album_artist, const QString &_album, const QUrl &_art_automatic, const QUrl &_art_manual, const QList &_urls, const Song::FileType _filetype, const QString &_cue_path) : - album_artist(_album_artist), - album(_album), - art_automatic(_art_automatic), - art_manual(_art_manual), - urls(_urls), - filetype(_filetype), - cue_path(_cue_path) {} + Album(const QString &_album_artist, const QString &_album, const QUrl &_art_automatic, const QUrl &_art_manual, const QList &_urls, const Song::FileType _filetype, const QString &_cue_path) + : album_artist(_album_artist), + album(_album), + art_automatic(_art_automatic), + art_manual(_art_manual), + urls(_urls), + filetype(_filetype), + cue_path(_cue_path) {} QString album_artist; QString album; diff --git a/src/collection/collectiondirectorymodel.cpp b/src/collection/collectiondirectorymodel.cpp index 8d954f0e..331a6825 100644 --- a/src/collection/collectiondirectorymodel.cpp +++ b/src/collection/collectiondirectorymodel.cpp @@ -94,13 +94,10 @@ QVariant CollectionDirectoryModel::data(const QModelIndex &idx, int role) const case MusicStorage::Role_Storage: case MusicStorage::Role_StorageForceConnect: return QVariant::fromValue(storage_[idx.row()]); - case MusicStorage::Role_FreeSpace: - return Utilities::FileSystemFreeSpace(data(idx, Qt::DisplayRole).toString()); - + return Utilities::FileSystemFreeSpace(data(idx, Qt::DisplayRole).toString()); case MusicStorage::Role_Capacity: - return Utilities::FileSystemCapacity(data(idx, Qt::DisplayRole).toString()); - + return Utilities::FileSystemCapacity(data(idx, Qt::DisplayRole).toString()); default: return QStandardItemModel::data(idx, role); } diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index cc1c43ae..c0c3d2c8 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -76,8 +76,8 @@ const char *CollectionModel::kPixmapDiskCacheDir = "pixmapcache"; QNetworkDiskCache *CollectionModel::sIconCache = nullptr; -CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, QObject *parent) : - SimpleTreeModel(new CollectionItem(this), parent), +CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, QObject *parent) + : SimpleTreeModel(new CollectionItem(this), parent), backend_(backend), app_(app), dir_model_(new CollectionDirectoryModel(backend, this)), diff --git a/src/collection/collectionmodel.h b/src/collection/collectionmodel.h index 337e0146..94483791 100644 --- a/src/collection/collectionmodel.h +++ b/src/collection/collectionmodel.h @@ -270,7 +270,7 @@ class CollectionModel : public SimpleTreeModel { QVariant AlbumIcon(const QModelIndex &idx); QVariant data(const CollectionItem *item, const int role) const; bool CompareItems(const CollectionItem *a, const CollectionItem *b) const; - static qint64 MaximumCacheSize(QSettings *s, const char *size_id, const char *size_unit_id, const qint64 cache_size_default) ; + static qint64 MaximumCacheSize(QSettings *s, const char *size_id, const char *size_unit_id, const qint64 cache_size_default); private: CollectionBackend *backend_; diff --git a/src/collection/collectionwatcher.cpp b/src/collection/collectionwatcher.cpp index 8c222f40..e9ae756a 100644 --- a/src/collection/collectionwatcher.cpp +++ b/src/collection/collectionwatcher.cpp @@ -63,7 +63,7 @@ // This is defined by one of the windows headers that is included by taglib. #ifdef RemoveDirectory -#undef RemoveDirectory +# undef RemoveDirectory #endif using namespace std::chrono_literals; @@ -580,7 +580,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory } } - else { // Search the DB by fingerprint. + else { // Search the DB by fingerprint. QString fingerprint; #ifdef HAVE_SONGFINGERPRINTING if (song_tracking_) { @@ -681,7 +681,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory t->touched_subdirs << updated_subdir; } - if (updated_subdir.mtime == 0) { // Subdirectory deleted, mark it for removal from the watcher. + if (updated_subdir.mtime == 0) { // Subdirectory deleted, mark it for removal from the watcher. t->deleted_subdirs << updated_subdir; } @@ -1109,7 +1109,7 @@ void CollectionWatcher::RescanTracksNow() { stop_requested_ = false; // Currently we are too stupid to rescan one file at a time, so we'll just scan the full directories - QStringList scanned_dirs; // To avoid double scans + QStringList scanned_dirs; // To avoid double scans while (!song_rescan_queue_.isEmpty()) { if (stop_requested_) break; Song song = song_rescan_queue_.takeFirst(); diff --git a/src/collection/collectionwatcher.h b/src/collection/collectionwatcher.h index 087f397c..c372ed90 100644 --- a/src/collection/collectionwatcher.h +++ b/src/collection/collectionwatcher.h @@ -215,12 +215,12 @@ class CollectionWatcher : public QObject { int expire_unavailable_songs_days_; bool stop_requested_; - bool rescan_in_progress_; // True if RescanTracksNow() has been called and is working. + bool rescan_in_progress_; // True if RescanTracksNow() has been called and is working. QMap watched_dirs_; QTimer *rescan_timer_; QTimer *periodic_scan_timer_; - QMap rescan_queue_; // dir id -> list of subdirs to be scanned + QMap rescan_queue_; // dir id -> list of subdirs to be scanned bool rescan_paused_; int total_watches_; @@ -229,7 +229,7 @@ class CollectionWatcher : public QObject { static QStringList sValidImages; - SongList song_rescan_queue_; // Set by ui thread + SongList song_rescan_queue_; // Set by UI thread qint64 last_scan_time_; diff --git a/src/collection/directory.h b/src/collection/directory.h index 97252a3e..e1e06e5b 100644 --- a/src/collection/directory.h +++ b/src/collection/directory.h @@ -31,7 +31,7 @@ struct Directory { Directory() : id(-1) {} - bool operator ==(const Directory &other) const { + bool operator==(const Directory &other) const { return path == other.path && id == other.id; } @@ -56,5 +56,5 @@ Q_DECLARE_METATYPE(Subdirectory) typedef QList SubdirectoryList; Q_DECLARE_METATYPE(SubdirectoryList) -#endif // DIRECTORY_H +#endif // DIRECTORY_H diff --git a/src/context/contextview.cpp b/src/context/contextview.cpp index 1189fc1a..362482af 100644 --- a/src/context/contextview.cpp +++ b/src/context/contextview.cpp @@ -477,7 +477,7 @@ void ContextView::NoSong() { void ContextView::UpdateFonts() { - for (QLabel *l: labels_play_all_) { + for (QLabel *l : labels_play_all_) { l->setStyleSheet(QString("font: %2pt \"%1\"; font-weight: regular;").arg(font_normal_).arg(font_size_normal_)); } label_play_albums_->setStyleSheet(QString("background-color: #3DADE8; color: rgb(255, 255, 255); font: %1pt \"%2\"; font-weight: regular;").arg(font_size_normal_).arg(font_normal_)); @@ -649,7 +649,7 @@ void ContextView::UpdateSong(const Song &song) { if (action_show_data_->isChecked()) { if (song.filetype() != song_playing_.filetype()) label_filetype_->setText(song.TextForFiletype()); - if (song.length_nanosec() != song_playing_.length_nanosec()){ + if (song.length_nanosec() != song_playing_.length_nanosec()) { if (song.length_nanosec() <= 0) { label_length_title_->hide(); label_length_->hide(); @@ -705,7 +705,7 @@ void ContextView::UpdateSong(const Song &song) { void ContextView::ResetSong() { - for (QLabel *l: labels_play_data_) { + for (QLabel *l : labels_play_data_) { l->clear(); } diff --git a/src/core/database.h b/src/core/database.h index 85e4ae55..c3a9127d 100644 --- a/src/core/database.h +++ b/src/core/database.h @@ -105,7 +105,7 @@ class Database : public QObject { QStringList SongsTables(QSqlDatabase &db, int schema_version) const; bool IntegrityCheck(const QSqlDatabase &db); void BackupFile(const QString &filename); - static bool OpenDatabase(const QString &filename, sqlite3 **connection) ; + static bool OpenDatabase(const QString &filename, sqlite3 **connection); Application *app_; diff --git a/src/core/filesystemmusicstorage.cpp b/src/core/filesystemmusicstorage.cpp index b40cca3f..9e0f963b 100644 --- a/src/core/filesystemmusicstorage.cpp +++ b/src/core/filesystemmusicstorage.cpp @@ -35,8 +35,7 @@ #include "filesystemmusicstorage.h" -FilesystemMusicStorage::FilesystemMusicStorage(const QString &root) - : root_(root) {} +FilesystemMusicStorage::FilesystemMusicStorage(const QString &root) : root_(root) {} bool FilesystemMusicStorage::CopyToStorage(const CopyJob &job) { diff --git a/src/core/filesystemmusicstorage.h b/src/core/filesystemmusicstorage.h index 27cda1a2..2fbc7364 100644 --- a/src/core/filesystemmusicstorage.h +++ b/src/core/filesystemmusicstorage.h @@ -43,4 +43,4 @@ class FilesystemMusicStorage : public virtual MusicStorage { Q_DISABLE_COPY(FilesystemMusicStorage) }; -#endif // FILESYSTEMMUSICSTORAGE_H +#endif // FILESYSTEMMUSICSTORAGE_H diff --git a/src/core/filesystemwatcherinterface.cpp b/src/core/filesystemwatcherinterface.cpp index 3131e518..69939987 100644 --- a/src/core/filesystemwatcherinterface.cpp +++ b/src/core/filesystemwatcherinterface.cpp @@ -26,7 +26,7 @@ #include "qtfslistener.h" #ifdef Q_OS_MACOS -#include "macfslistener.h" +# include "macfslistener.h" #endif FileSystemWatcherInterface::FileSystemWatcherInterface(QObject *parent) diff --git a/src/core/iconloader.cpp b/src/core/iconloader.cpp index d798e3c7..4eebdc02 100644 --- a/src/core/iconloader.cpp +++ b/src/core/iconloader.cpp @@ -62,8 +62,12 @@ QIcon IconLoader::Load(const QString &name, const int fixed_size, const int min_ } QList sizes; - if (fixed_size == 0) { sizes << 22 << 32 << 48 << 64; } - else sizes << fixed_size; + if (fixed_size == 0) { + sizes << 22 << 32 << 48 << 64; + } + else { + sizes << fixed_size; + } if (system_icons_) { IconMapper::IconProperties icon_prop; diff --git a/src/core/iconmapper.h b/src/core/iconmapper.h index b9149306..bd7b7508 100644 --- a/src/core/iconmapper.h +++ b/src/core/iconmapper.h @@ -134,4 +134,4 @@ static const QMap iconmapper_ = { // clazy:exclude=non }; -} // namespace +} // namespace IconMapper diff --git a/src/core/mac_utilities.h b/src/core/mac_utilities.h index f5253d62..1b1f9c6e 100644 --- a/src/core/mac_utilities.h +++ b/src/core/mac_utilities.h @@ -36,7 +36,8 @@ namespace mac { QKeySequence KeySequenceFromNSEvent(NSEvent *event); void DumpDictionary(CFDictionaryRef dict); -} + +} // namespace mac namespace Utilities { qint32 GetMacOsVersion(); diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index cfaa5296..d5cdc430 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -609,8 +609,8 @@ MainWindow::MainWindow(Application *app, std::shared_ptr tray_ic QObject::connect(collection_view_->view(), &CollectionView::Error, this, &MainWindow::ShowErrorDialog); QObject::connect(app_->collection_model(), &CollectionModel::TotalSongCountUpdated, collection_view_->view(), &CollectionView::TotalSongCountUpdated); QObject::connect(app_->collection_model(), &CollectionModel::TotalArtistCountUpdated, collection_view_->view(), &CollectionView::TotalArtistCountUpdated); - QObject::connect(app_->collection_model(), &CollectionModel::TotalAlbumCountUpdated, collection_view_->view(), &CollectionView::TotalAlbumCountUpdated); - QObject::connect(app_->collection_model(), &CollectionModel::modelAboutToBeReset, collection_view_->view(), &CollectionView::SaveFocus); + QObject::connect(app_->collection_model(), &CollectionModel::TotalAlbumCountUpdated, collection_view_->view(), &CollectionView::TotalAlbumCountUpdated); + QObject::connect(app_->collection_model(), &CollectionModel::modelAboutToBeReset, collection_view_->view(), &CollectionView::SaveFocus); QObject::connect(app_->collection_model(), &CollectionModel::modelReset, collection_view_->view(), &CollectionView::RestoreFocus); QObject::connect(app_->task_manager(), &TaskManager::PauseCollectionWatchers, app_->collection(), &SCollection::PauseWatcher); @@ -917,7 +917,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr tray_ic // Reload playlist settings, for BG and glowing ui_->playlist->view()->ReloadSettings(); -#ifdef Q_OS_MACOS // Always show the mainwindow on startup for macOS +#ifdef Q_OS_MACOS // Always show the mainwindow on startup for macOS show(); #else QSettings s; @@ -1198,7 +1198,7 @@ void MainWindow::Exit() { if (tray_icon_->IsSystemTrayAvailable()) { tray_icon_->setVisible(false); } - return; // Don't quit the application now: wait for the fadeout finished signal + return; // Don't quit the application now: wait for the fadeout finished signal } } DoExit(); @@ -1427,7 +1427,7 @@ void MainWindow::LoadPlaybackStatus() { s.endGroup(); s.beginGroup(Player::kSettingsGroup); - Engine::State playback_state = static_cast (s.value("playback_state", Engine::Empty).toInt()); + Engine::State playback_state = static_cast(s.value("playback_state", Engine::Empty).toInt()); s.endGroup(); if (resume_playback && playback_state != Engine::Empty && playback_state != Engine::Idle) { @@ -1444,7 +1444,7 @@ void MainWindow::ResumePlayback() { QSettings s; s.beginGroup(Player::kSettingsGroup); - Engine::State playback_state = static_cast (s.value("playback_state", Engine::Empty).toInt()); + Engine::State playback_state = static_cast(s.value("playback_state", Engine::Empty).toInt()); int playback_playlist = s.value("playback_playlist", -1).toInt(); int playback_position = s.value("playback_position", 0).toInt(); s.endGroup(); @@ -1589,9 +1589,15 @@ void MainWindow::SetHiddenInTray(const bool hidden) { hide(); } else { - if (was_minimized_) { showMinimized(); } - else if (was_maximized_) showMaximized(); - else show(); + if (was_minimized_) { + showMinimized(); + } + else if (was_maximized_) { + showMaximized(); + } + else { + show(); + } } } @@ -1649,7 +1655,7 @@ void MainWindow::UpdateTrackSliderPosition() { void MainWindow::ApplyAddBehaviour(const BehaviourSettingsPage::AddBehaviour b, MimeData *mimedata) { switch (b) { - case BehaviourSettingsPage::AddBehaviour_Append: + case BehaviourSettingsPage::AddBehaviour_Append: mimedata->clear_first_ = false; mimedata->enqueue_now_ = false; break; @@ -1942,7 +1948,7 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex & // Get the new item actions, and add them playlistitem_actions_ = item->actions(); playlistitem_actions_separator_->setVisible(!playlistitem_actions_.isEmpty()); - playlist_menu_->insertActions(playlistitem_actions_separator_,playlistitem_actions_); + playlist_menu_->insertActions(playlistitem_actions_separator_, playlistitem_actions_); } //if it isn't the first time we right click, we need to remove the menu previously created @@ -2094,7 +2100,7 @@ void MainWindow::RenumberTracks() { void MainWindow::SongSaveComplete(TagReaderReply *reply, const QPersistentModelIndex &idx) { if (reply->is_successful() && idx.isValid()) { - app_->playlist_manager()->current()->ReloadItems(QList()<< idx.row()); + app_->playlist_manager()->current()->ReloadItems(QList() << idx.row()); } metaObject()->invokeMethod(reply, "deleteLater", Qt::QueuedConnection); @@ -2247,11 +2253,11 @@ void MainWindow::PlaylistClearCurrent() { messagebox.setTextFormat(Qt::RichText); int result = messagebox.exec(); switch (result) { - case QMessageBox::Ok: - break; - case QMessageBox::Cancel: - default: - return; + case QMessageBox::Ok: + break; + case QMessageBox::Cancel: + default: + return; } } @@ -2818,7 +2824,7 @@ void MainWindow::CheckFullRescanRevisions() { // if we have any... if (!reasons.isEmpty()) { QString message = tr("The version of Strawberry you've just updated to requires a full collection rescan because of the new features listed below:") + "
    "; - for(const QString &reason : reasons) { + for (const QString &reason : reasons) { message += ("
  • " + reason + "
  • "); } message += "
" + tr("Would you like to run a full rescan right now?"); @@ -3082,7 +3088,7 @@ void MainWindow::SetToggleScrobblingIcon(const bool value) { if (app_->playlist_manager()->active() && app_->playlist_manager()->active()->scrobbled()) ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble", 22)); else - ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble", 22)); // TODO: Create a faint version of the icon + ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble", 22)); // TODO: Create a faint version of the icon } else { ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble-disabled", 22)); diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index a4df4f66..9b91e29a 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -280,7 +280,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { void SaveSettings(); - static void ApplyAddBehaviour(const BehaviourSettingsPage::AddBehaviour b, MimeData *mimedata) ; + static void ApplyAddBehaviour(const BehaviourSettingsPage::AddBehaviour b, MimeData *mimedata); void ApplyPlayBehaviour(const BehaviourSettingsPage::PlayBehaviour b, MimeData *mimedata) const; void CheckFullRescanRevisions(); diff --git a/src/core/metatypes.cpp b/src/core/metatypes.cpp index 3290c03c..30f344c0 100644 --- a/src/core/metatypes.cpp +++ b/src/core/metatypes.cpp @@ -84,7 +84,7 @@ void RegisterMetaTypes() { qRegisterMetaType(); qRegisterMetaType("QAbstractSocket::SocketState"); qRegisterMetaType("QNetworkCookie"); - qRegisterMetaType >("QList"); + qRegisterMetaType>("QList"); qRegisterMetaType("QNetworkReply*"); qRegisterMetaType("QNetworkReply**"); qRegisterMetaType("QItemSelection"); @@ -99,7 +99,7 @@ void RegisterMetaTypes() { qRegisterMetaType("Subdirectory"); qRegisterMetaType("SubdirectoryList"); qRegisterMetaType("Song"); - qRegisterMetaType >("QList"); + qRegisterMetaType>("QList"); qRegisterMetaType("SongList"); qRegisterMetaType("EngineType"); qRegisterMetaType("Engine::SimpleMetaBundle"); @@ -113,14 +113,14 @@ void RegisterMetaTypes() { #endif qRegisterMetaType("PlaylistItemList"); qRegisterMetaType("PlaylistItemPtr"); - qRegisterMetaType >("QList"); + qRegisterMetaType>("QList"); qRegisterMetaType("PlaylistSequence::RepeatMode"); qRegisterMetaType("PlaylistSequence::ShuffleMode"); qRegisterMetaType("AlbumCoverLoaderResult"); qRegisterMetaType("AlbumCoverLoaderResult::Type"); qRegisterMetaType("CoverProviderSearchResult"); qRegisterMetaType("CoverSearchStatistics"); - qRegisterMetaType >("QList"); + qRegisterMetaType>("QList"); qRegisterMetaType("CoverProviderSearchResults"); qRegisterMetaType("Equalizer::Params"); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) diff --git a/src/core/mpris2.cpp b/src/core/mpris2.cpp index 085ee170..beffef22 100644 --- a/src/core/mpris2.cpp +++ b/src/core/mpris2.cpp @@ -101,9 +101,9 @@ const char *Mpris2::kServiceName = "org.mpris.MediaPlayer2.strawberry"; const char *Mpris2::kFreedesktopPath = "org.freedesktop.DBus.Properties"; Mpris2::Mpris2(Application *app, QObject *parent) - : QObject(parent), - app_(app), - app_name_(QCoreApplication::applicationName()) { + : QObject(parent), + app_(app), + app_name_(QCoreApplication::applicationName()) { new Mpris2Root(this); new Mpris2TrackList(this); @@ -491,7 +491,7 @@ void Mpris2::SetPosition(const QDBusObjectPath &trackId, qint64 offset) { if (CanSeek() && trackId.path() == current_track_id() && offset >= 0) { offset *= kNsecPerUsec; - if(offset < app_->player()->GetCurrentItem()->Metadata().length_nanosec()) { + if (offset < app_->player()->GetCurrentItem()->Metadata().length_nanosec()) { app_->player()->SeekTo(offset / kNsecPerSec); } } diff --git a/src/core/mpris2.h b/src/core/mpris2.h index 871a941c..7391576d 100644 --- a/src/core/mpris2.h +++ b/src/core/mpris2.h @@ -65,10 +65,10 @@ struct MaybePlaylist { Q_DECLARE_METATYPE(MaybePlaylist) QDBusArgument &operator<<(QDBusArgument &arg, const MprisPlaylist &playlist); -const QDBusArgument &operator>> (const QDBusArgument &arg, MprisPlaylist &playlist); +const QDBusArgument &operator>>(const QDBusArgument &arg, MprisPlaylist &playlist); QDBusArgument &operator<<(QDBusArgument &arg, const MaybePlaylist &playlist); -const QDBusArgument &operator>> (const QDBusArgument &arg, MaybePlaylist &playlist); +const QDBusArgument &operator>>(const QDBusArgument &arg, MaybePlaylist &playlist); namespace mpris { @@ -172,7 +172,7 @@ class Mpris2 : public QObject { static bool CanEditTracks(); // Methods - static TrackMetadata GetTracksMetadata(const Track_Ids &tracks) ; + static TrackMetadata GetTracksMetadata(const Track_Ids &tracks); static void AddTrack(const QString &uri, const QDBusObjectPath &afterTrack, bool setAsCurrent); static void RemoveTrack(const QDBusObjectPath &trackId); static void GoTo(const QDBusObjectPath &trackId); @@ -218,7 +218,7 @@ class Mpris2 : public QObject { static void EmitNotification(const QString &name, const QVariant &val); static void EmitNotification(const QString &name, const QVariant &val, const QString &mprisEntity); - static QString PlaybackStatus(Engine::State state) ; + static QString PlaybackStatus(Engine::State state); QString current_track_id() const; diff --git a/src/core/mpris_common.h b/src/core/mpris_common.h index 2832452a..86a5c03b 100644 --- a/src/core/mpris_common.h +++ b/src/core/mpris_common.h @@ -59,6 +59,6 @@ inline QString AsMPRISDateTimeType(const qint64 time) { return time != -1 ? QDateTime::fromSecsSinceEpoch(time).toString(Qt::ISODate) : ""; } -} // namespace mpris +} // namespace mpris #endif // MPRIS_COMMON_H diff --git a/src/core/multisortfilterproxy.cpp b/src/core/multisortfilterproxy.cpp index 8c28a2d6..732dceef 100644 --- a/src/core/multisortfilterproxy.cpp +++ b/src/core/multisortfilterproxy.cpp @@ -56,7 +56,7 @@ bool MultiSortFilterProxy::lessThan(const QModelIndex &left, const QModelIndex & } -template +template static inline int DoCompare(T left, T right) { if (left < right) return -1; diff --git a/src/core/player.h b/src/core/player.h index 9d0a142a..5c6078b5 100644 --- a/src/core/player.h +++ b/src/core/player.h @@ -140,7 +140,7 @@ class Player : public PlayerInterface { void Init(); EngineBase *engine() const override { return engine_.get(); } - Engine::State GetState() const override{ return last_state_; } + Engine::State GetState() const override { return last_state_; } int GetVolume() const override; PlaylistItemPtr GetCurrentItem() const override { return current_item_; } diff --git a/src/core/song.cpp b/src/core/song.cpp index 017dd260..2042c5ca 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -988,8 +988,8 @@ void Song::InitFromQuery(const SqlRow &q, bool reliable_metadata, int col) { d->directory_id_ = toint(x); } else if (Song::kColumns.value(i) == "url") { - set_url(QUrl::fromEncoded(tostr(x).toUtf8())); - d->basefilename_ = QFileInfo(d->url_.toLocalFile()).fileName(); + set_url(QUrl::fromEncoded(tostr(x).toUtf8())); + d->basefilename_ = QFileInfo(d->url_.toLocalFile()).fileName(); } else if (Song::kColumns.value(i) == "filetype") { d->filetype_ = FileType(q.value(x).toInt()); diff --git a/src/core/song.h b/src/core/song.h index a20b0add..eef8f69d 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -391,7 +391,7 @@ class Song { private: struct Private; - static QString sortable(const QString &v) ; + static QString sortable(const QString &v); QSharedDataPointer d; }; diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index 43418f2e..2cd4569c 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -252,8 +252,7 @@ SongLoader::Result SongLoader::LoadLocal(const QString &filename) { if (song.is_valid()) { songs_ << song; } - } - while (query.Next()); + } while (query.Next()); return Success; } @@ -294,7 +293,7 @@ SongLoader::Result SongLoader::LoadLocalAsync(const QString &filename) { parser = playlist_parser_->ParserForExtension(fileinfo.suffix().toLower()); } - if (parser) { // It's a playlist! + if (parser) { // It's a playlist! qLog(Debug) << "Parsing using" << parser->name(); LoadPlaylist(parser, filename); return Success; diff --git a/src/core/standarditemiconloader.cpp b/src/core/standarditemiconloader.cpp index cfec0a6e..a58cc08e 100644 --- a/src/core/standarditemiconloader.cpp +++ b/src/core/standarditemiconloader.cpp @@ -80,7 +80,7 @@ void StandardItemIconLoader::RowsAboutToBeRemoved(const QModelIndex &parent, int it = pending_covers_.erase(it); // clazy:exclude=strict-iterators } else { - ++ it; + ++it; } } diff --git a/src/core/stylehelper.cpp b/src/core/stylehelper.cpp index 31f42175..5e0b67a3 100644 --- a/src/core/stylehelper.cpp +++ b/src/core/stylehelper.cpp @@ -52,8 +52,8 @@ namespace Utils { QColor StyleHelper::m_baseColor; QColor StyleHelper::m_requestedBaseColor; -QColor StyleHelper::m_IconsBaseColor=0xffdcdcdc; -QColor StyleHelper::m_IconsDisabledColor=0x88a0a0a0; +QColor StyleHelper::m_IconsBaseColor = 0xffdcdcdc; +QColor StyleHelper::m_IconsDisabledColor = 0x88a0a0a0; QColor StyleHelper::m_ProgressBarTitleColor = 0xffffffff; QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int factor) { @@ -168,7 +168,7 @@ void StyleHelper::setBaseColor(const QColor &newcolor) { if (color.isValid() && color != m_baseColor) { m_baseColor = color; - for (QWidget* w : QApplication::topLevelWidgets()) { + for (QWidget *w : QApplication::topLevelWidgets()) { w->update(); } } @@ -324,8 +324,8 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter, pixmap.setDevicePixelRatio(devicePixelRatio); QPixmapCache::insert(pixmapName, pixmap); } - int xOffset = r.x() + (r.width() - size)/2; - int yOffset = r.y() + (r.height() - size)/2; + int xOffset = r.x() + (r.width() - size) / 2; + int yOffset = r.y() + (r.height() - size) / 2; painter->drawPixmap(xOffset, yOffset, pixmap); } @@ -356,7 +356,7 @@ QPixmap StyleHelper::disabledSideBarIcon(const QPixmap &enabledicon) { QImage im = enabledicon.toImage().convertToFormat(QImage::Format_ARGB32); - for (int y=0; y(im.scanLine(y)); for (int x=0; x &urls) { messagebox.setTextFormat(Qt::RichText); int result = messagebox.exec(); switch (result) { - case QMessageBox::Open: - break; - case QMessageBox::Cancel: - default: - return; + case QMessageBox::Open: + break; + case QMessageBox::Cancel: + default: + return; } } @@ -526,7 +526,7 @@ void ConsumeCurrentElement(QXmlStreamReader *reader) { while (level != 0 && !reader->atEnd()) { switch (reader->readNext()) { case QXmlStreamReader::StartElement: ++level; break; - case QXmlStreamReader::EndElement: --level; break; + case QXmlStreamReader::EndElement: --level; break; default: break; } } @@ -735,17 +735,18 @@ QString CryptographicRandomString(const int len) { QString GetRandomString(const int len, const QString &UseCharacters) { - QString randstr; - for(int i = 0 ; i < len ; ++i) { + QString randstr; + for (int i = 0 ; i < len ; ++i) { #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) - const int index = QRandomGenerator::global()->bounded(0, UseCharacters.length()); + const int index = QRandomGenerator::global()->bounded(0, UseCharacters.length()); #else - const int index = qrand() % UseCharacters.length(); + const int index = qrand() % UseCharacters.length(); #endif - QChar nextchar = UseCharacters.at(index); - randstr.append(nextchar); - } - return randstr; + QChar nextchar = UseCharacters.at(index); + randstr.append(nextchar); + } + + return randstr; } @@ -916,7 +917,7 @@ QString ReplaceVariable(const QString &variable, const Song &song, const QString value = song.PrettyRating(); } else if (variable == "%newline%") { - return QString(newline); // No HTML escaping, return immediately. + return QString(newline); // No HTML escaping, return immediately. } if (html_escaped) { diff --git a/src/core/utilities.h b/src/core/utilities.h index a2b439de..a057fff4 100644 --- a/src/core/utilities.h +++ b/src/core/utilities.h @@ -148,7 +148,7 @@ QString MimeTypeFromData(const QByteArray &data); void enableBlurBehindWindow(QWindow *window, const QRegion ®ion); #endif -} // namespace +} // namespace Utilities class ScopedWCharArray { public: diff --git a/src/core/windows7thumbbar.cpp b/src/core/windows7thumbbar.cpp index 5f608520..7c8b2dd0 100644 --- a/src/core/windows7thumbbar.cpp +++ b/src/core/windows7thumbbar.cpp @@ -150,7 +150,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG *msg) { for (int i = 0 ; i < actions_.count() ; ++i) { if (buttons[i].hIcon) { - DestroyIcon (buttons[i].hIcon); + DestroyIcon(buttons[i].hIcon); } } diff --git a/src/covermanager/albumcoverfetchersearch.h b/src/covermanager/albumcoverfetchersearch.h index b9cd1ce5..8d8700fd 100644 --- a/src/covermanager/albumcoverfetchersearch.h +++ b/src/covermanager/albumcoverfetchersearch.h @@ -81,7 +81,7 @@ class AlbumCoverFetcherSearch : public QObject { void AllProvidersFinished(); void FetchMoreImages(); - static float ScoreImage(const QSize size) ; + static float ScoreImage(const QSize size); void SendBestImage(); static bool ProviderCompareOrder(CoverProvider *a, CoverProvider *b); diff --git a/src/covermanager/albumcoverloader.cpp b/src/covermanager/albumcoverloader.cpp index 036afe57..8567c5b1 100644 --- a/src/covermanager/albumcoverloader.cpp +++ b/src/covermanager/albumcoverloader.cpp @@ -516,7 +516,7 @@ void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply *reply, const QUrl &cov QImage image_scaled; QImage image_thumbnail; if (task.options.scale_output_image_) image_scaled = ImageUtils::ScaleAndPad(image, task.options.scale_output_image_, task.options.pad_output_image_, task.options.desired_height_); - if (task.options.create_thumbnail_) image_thumbnail = ImageUtils::CreateThumbnail(image, task.options.pad_thumbnail_image_, task.options.thumbnail_size_); + if (task.options.create_thumbnail_) image_thumbnail = ImageUtils::CreateThumbnail(image, task.options.pad_thumbnail_image_, task.options.thumbnail_size_); emit AlbumCoverLoaded(task.id, AlbumCoverLoaderResult(true, task.type, AlbumCoverImageResult(cover_url, mime_type, (task.options.get_image_data_ ? image_data : QByteArray()), image), image_scaled, image_thumbnail, task.art_updated)); return; } @@ -615,7 +615,7 @@ void AlbumCoverLoader::SaveEmbeddedCover(const qint64 id, const QString &song_fi QFile file(cover_filename); - if (file.size() >= 209715200 || !file.open(QIODevice::ReadOnly)) { // Max 200 MB. + if (file.size() >= 209715200 || !file.open(QIODevice::ReadOnly)) { // Max 200 MB. emit SaveEmbeddedCoverAsyncFinished(id, false, false); return; } @@ -656,7 +656,7 @@ void AlbumCoverLoader::SaveEmbeddedCover(const qint64 id, const QList &url QFile file(cover_filename); - if (file.size() >= 209715200 || !file.open(QIODevice::ReadOnly)) { // Max 200 MB. + if (file.size() >= 209715200 || !file.open(QIODevice::ReadOnly)) { // Max 200 MB. emit SaveEmbeddedCoverAsyncFinished(id, false, false); return; } diff --git a/src/covermanager/albumcoversearcher.h b/src/covermanager/albumcoversearcher.h index 2e78180c..5e8fc82f 100644 --- a/src/covermanager/albumcoversearcher.h +++ b/src/covermanager/albumcoversearcher.h @@ -52,7 +52,7 @@ class Application; class Ui_AlbumCoverSearcher; class SizeOverlayDelegate : public QStyledItemDelegate { - Q_OBJECT + Q_OBJECT public: static const int kMargin; diff --git a/src/covermanager/coverfromurldialog.cpp b/src/covermanager/coverfromurldialog.cpp index 98e3a95c..de0cd49a 100644 --- a/src/covermanager/coverfromurldialog.cpp +++ b/src/covermanager/coverfromurldialog.cpp @@ -53,7 +53,7 @@ CoverFromURLDialog::~CoverFromURLDialog() { AlbumCoverImageResult CoverFromURLDialog::Exec() { // reset state - ui_->url->setText("");; + ui_->url->setText(""); last_album_cover_ = AlbumCoverImageResult(); QClipboard *clipboard = QApplication::clipboard(); diff --git a/src/covermanager/coverprovider.h b/src/covermanager/coverprovider.h index f15afc04..3c421acc 100644 --- a/src/covermanager/coverprovider.h +++ b/src/covermanager/coverprovider.h @@ -85,4 +85,4 @@ class CoverProvider : public QObject { }; -#endif // COVERPROVIDER_H +#endif // COVERPROVIDER_H diff --git a/src/covermanager/coversearchstatistics.h b/src/covermanager/coversearchstatistics.h index c784c7c1..6a1400fd 100644 --- a/src/covermanager/coversearchstatistics.h +++ b/src/covermanager/coversearchstatistics.h @@ -49,4 +49,4 @@ struct CoverSearchStatistics { }; -#endif // COVERSEARCHSTATISTICS_H +#endif // COVERSEARCHSTATISTICS_H diff --git a/src/covermanager/deezercoverprovider.cpp b/src/covermanager/deezercoverprovider.cpp index 710382ee..53c9374a 100644 --- a/src/covermanager/deezercoverprovider.cpp +++ b/src/covermanager/deezercoverprovider.cpp @@ -231,7 +231,7 @@ void DeezerCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) } QJsonObject json_obj = json_value.toObject(); QJsonObject obj_album; - if (json_obj.contains("album") && json_obj["album"].isObject()) { // Song search, so extract the album. + if (json_obj.contains("album") && json_obj["album"].isObject()) { // Song search, so extract the album. obj_album = json_obj["album"].toObject(); } else { diff --git a/src/covermanager/discogscoverprovider.cpp b/src/covermanager/discogscoverprovider.cpp index 4e18c44d..af4ddcfd 100644 --- a/src/covermanager/discogscoverprovider.cpp +++ b/src/covermanager/discogscoverprovider.cpp @@ -334,7 +334,7 @@ void DiscogsCoverProvider::StartReleaseRequest(std::shared_ptr]*>"))) { // Make sure it's not HTML code. + if (content_json.contains(QRegularExpression("<[^>]*>"))) { // Make sure it's not HTML code. emit SearchFinished(id, results); return; } diff --git a/src/device/cddasongloader.cpp b/src/device/cddasongloader.cpp index bcffcc00..957058eb 100644 --- a/src/device/cddasongloader.cpp +++ b/src/device/cddasongloader.cpp @@ -83,7 +83,7 @@ void CddaSongLoader::LoadSongs() { if (!url_.isEmpty()) { g_object_set(cdda_, "device", g_strdup(url_.path().toLocal8Bit().constData()), nullptr); } - if (g_object_class_find_property (G_OBJECT_GET_CLASS (cdda_), "paranoia-mode")) { + if (g_object_class_find_property(G_OBJECT_GET_CLASS(cdda_), "paranoia-mode")) { g_object_set(cdda_, "paranoia-mode", 0, nullptr); } @@ -144,9 +144,9 @@ void CddaSongLoader::LoadSongs() { gst_tag_register_musicbrainz_tags(); GstElement *pipeline = gst_pipeline_new("pipeline"); - GstElement *sink = gst_element_factory_make ("fakesink", nullptr); - gst_bin_add_many (GST_BIN (pipeline), cdda_, sink, nullptr); - gst_element_link (cdda_, sink); + GstElement *sink = gst_element_factory_make("fakesink", nullptr); + gst_bin_add_many(GST_BIN(pipeline), cdda_, sink, nullptr); + gst_element_link(cdda_, sink); gst_element_set_state(pipeline, GST_STATE_READY); gst_element_set_state(pipeline, GST_STATE_PAUSED); @@ -168,7 +168,7 @@ void CddaSongLoader::LoadSongs() { // Handle TOC message: get tracks duration if (msg_toc) { GstToc *toc = nullptr; - gst_message_parse_toc (msg_toc, &toc, nullptr); + gst_message_parse_toc(msg_toc, &toc, nullptr); if (toc) { GList *entries = gst_toc_get_entries(toc); if (entries && static_cast(songs.size()) <= g_list_length(entries)) { @@ -177,7 +177,7 @@ void CddaSongLoader::LoadSongs() { GstTocEntry *entry = static_cast(node->data); quint64 duration = 0; gint64 start = 0, stop = 0; - if (gst_toc_entry_get_start_stop_times (entry, &start, &stop)) duration = stop - start; + if (gst_toc_entry_get_start_stop_times(entry, &start, &stop)) duration = stop - start; songs[i++].set_length_nanosec(duration); } } diff --git a/src/device/devicedatabasebackend.cpp b/src/device/devicedatabasebackend.cpp index 1fbf0dc5..8a0fec70 100644 --- a/src/device/devicedatabasebackend.cpp +++ b/src/device/devicedatabasebackend.cpp @@ -96,7 +96,7 @@ DeviceDatabaseBackend::DeviceList DeviceDatabaseBackend::GetAllDevices() { int schema_version = q.value(5).toInt(); dev.transcode_mode_ = MusicStorage::TranscodeMode(q.value(6).toInt()); dev.transcode_format_ = Song::FileType(q.value(7).toInt()); - if (schema_version < kDeviceSchemaVersion) { // Device is using old schema, drop it. + if (schema_version < kDeviceSchemaVersion) { // Device is using old schema, drop it. old_devices << dev; } else { diff --git a/src/device/deviceinfo.h b/src/device/deviceinfo.h index 9d7f5fe1..0008d685 100644 --- a/src/device/deviceinfo.h +++ b/src/device/deviceinfo.h @@ -84,10 +84,8 @@ class DeviceInfo : public SimpleTreeItem { // Sometimes the same device is discovered more than once. In this case the device will have multiple "backends". struct Backend { explicit Backend(DeviceLister *lister = nullptr, const QString &id = QString()) - : - lister_(lister), - unique_id_(id) - {} + : lister_(lister), + unique_id_(id) {} DeviceLister *lister_; // nullptr if not physically connected QString unique_id_; diff --git a/src/device/devicemanager.cpp b/src/device/devicemanager.cpp index ae36780c..80bdf295 100644 --- a/src/device/devicemanager.cpp +++ b/src/device/devicemanager.cpp @@ -80,7 +80,7 @@ # include "gpoddevice.h" #endif #ifdef HAVE_GIO -# include "giolister.h" // Needs to be last because of #undef signals. +# include "giolister.h" // Needs to be last because of #undef signals. #endif const int DeviceManager::kDeviceIconSize = 32; diff --git a/src/device/devicestatefiltermodel.h b/src/device/devicestatefiltermodel.h index c87d4681..74f54b84 100644 --- a/src/device/devicestatefiltermodel.h +++ b/src/device/devicestatefiltermodel.h @@ -55,4 +55,4 @@ class DeviceStateFilterModel : public QSortFilterProxyModel { DeviceManager::State state_; }; -#endif // DEVICESTATEFILTERMODEL_H +#endif // DEVICESTATEFILTERMODEL_H diff --git a/src/device/filesystemdevice.cpp b/src/device/filesystemdevice.cpp index b9917d1a..46d44ef9 100644 --- a/src/device/filesystemdevice.cpp +++ b/src/device/filesystemdevice.cpp @@ -43,8 +43,9 @@ class DeviceLister; FilesystemDevice::FilesystemDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent) : FilesystemMusicStorage(url.toLocalFile()), - ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time, parent), - watcher_(new CollectionWatcher(Song::Source_Device)), watcher_thread_(new QThread(this)) { + ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time, parent), + watcher_(new CollectionWatcher(Song::Source_Device)), + watcher_thread_(new QThread(this)) { watcher_->moveToThread(watcher_thread_); watcher_thread_->start(QThread::IdlePriority); diff --git a/src/device/filesystemdevice.h b/src/device/filesystemdevice.h index c7fa54f9..4035a414 100644 --- a/src/device/filesystemdevice.h +++ b/src/device/filesystemdevice.h @@ -42,7 +42,7 @@ class DeviceManager; class FilesystemDevice : public ConnectedDevice, public virtual FilesystemMusicStorage { Q_OBJECT -public: + public: Q_INVOKABLE FilesystemDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time, QObject *parent = nullptr); ~FilesystemDevice() override; @@ -55,10 +55,10 @@ public: void Close() override; void ExitFinished(); -private: + private: CollectionWatcher *watcher_; QThread *watcher_thread_; QList wait_for_exit_; }; -#endif // FILESYSTEMDEVICE_H +#endif // FILESYSTEMDEVICE_H diff --git a/src/device/giolister.h b/src/device/giolister.h index 7f53f806..d7169f35 100644 --- a/src/device/giolister.h +++ b/src/device/giolister.h @@ -77,7 +77,7 @@ class GioLister : public DeviceLister { private: struct DeviceInfo { - DeviceInfo() : drive_removable(false), filesystem_size(0),filesystem_free(0), invalid_enclosing_mount(false) {} + DeviceInfo() : drive_removable(false), filesystem_size(0), filesystem_free(0), invalid_enclosing_mount(false) {} QString unique_id() const; bool is_suitable() const; diff --git a/src/device/gpoddevice.h b/src/device/gpoddevice.h index dcb5964d..06a032ae 100644 --- a/src/device/gpoddevice.h +++ b/src/device/gpoddevice.h @@ -101,4 +101,4 @@ class GPodDevice : public ConnectedDevice, public virtual MusicStorage { QList> cover_files_; }; -#endif // GPODDEVICE_H +#endif // GPODDEVICE_H diff --git a/src/dialogs/about.cpp b/src/dialogs/about.cpp index dc10332d..6762838b 100644 --- a/src/dialogs/about.cpp +++ b/src/dialogs/about.cpp @@ -37,7 +37,7 @@ #include "about.h" #include "ui_about.h" -About::About(QWidget *parent): QDialog(parent) { +About::About(QWidget *parent) : QDialog(parent) { ui_.setupUi(this); setWindowFlags(this->windowFlags()|Qt::WindowStaysOnTopHint); diff --git a/src/dialogs/about.h b/src/dialogs/about.h index 40635254..dc7e734a 100644 --- a/src/dialogs/about.h +++ b/src/dialogs/about.h @@ -49,7 +49,7 @@ class About : public QDialog { QString MainHtml() const; QString ContributorsHtml() const; - static QString PersonToHtml(const Person &person) ; + static QString PersonToHtml(const Person &person); private: Ui::About ui_; diff --git a/src/dialogs/addstreamdialog.h b/src/dialogs/addstreamdialog.h index a3c269f7..1a991d8f 100644 --- a/src/dialogs/addstreamdialog.h +++ b/src/dialogs/addstreamdialog.h @@ -35,7 +35,7 @@ class AddStreamDialog : public QDialog { ~AddStreamDialog() override; QUrl url() const { return QUrl(ui_->url->text()); } - void set_url(const QUrl &url) { ui_->url->setText(url.toString());} + void set_url(const QUrl &url) { ui_->url->setText(url.toString()); } protected: void showEvent(QShowEvent *e) override; diff --git a/src/dialogs/edittagdialog.cpp b/src/dialogs/edittagdialog.cpp index de59c2e9..5c6a1173 100644 --- a/src/dialogs/edittagdialog.cpp +++ b/src/dialogs/edittagdialog.cpp @@ -514,7 +514,7 @@ bool EditTagDialog::DoesValueVary(const QModelIndexList &sel, const QString &id) bool EditTagDialog::IsValueModified(const QModelIndexList &sel, const QString &id) const { - return std::any_of(sel.begin(), sel.end(), [this, id](const QModelIndex &i){ return data_[i.row()].original_value(id) != data_[i.row()].current_value(id); }); + return std::any_of(sel.begin(), sel.end(), [this, id](const QModelIndex &i) { return data_[i.row()].original_value(id) != data_[i.row()].current_value(id); }); } @@ -651,7 +651,7 @@ void EditTagDialog::SelectionChanged() { const bool enable_change_art = first_song.is_collection_song(); ui_->tags_art_button->setEnabled(enable_change_art); if ((art_different && first_cover_action != UpdateCoverAction_New) || action_different) { - tags_cover_art_id_ = -1; // Cancels any pending art load. + tags_cover_art_id_ = -1; // Cancels any pending art load. ui_->tags_art->clear(); ui_->tags_art->setText(kArtDifferentHintText); album_cover_choice_controller_->show_cover_action()->setEnabled(false); diff --git a/src/dialogs/trackselectiondialog.h b/src/dialogs/trackselectiondialog.h index 4223fd22..3a4d85d4 100644 --- a/src/dialogs/trackselectiondialog.h +++ b/src/dialogs/trackselectiondialog.h @@ -80,7 +80,7 @@ class TrackSelectionDialog : public QDialog { }; void AddDivider(const QString &text, QTreeWidget *parent) const; - static void AddSong(const Song &song, int result_index, QTreeWidget *parent) ; + static void AddSong(const Song &song, int result_index, QTreeWidget *parent); void SetLoading(const QString &message); static void SaveData(const QList &data); diff --git a/src/engine/alsadevicefinder.cpp b/src/engine/alsadevicefinder.cpp index 0494b190..b3536110 100644 --- a/src/engine/alsadevicefinder.cpp +++ b/src/engine/alsadevicefinder.cpp @@ -34,7 +34,7 @@ #include "devicefinder.h" #include "alsadevicefinder.h" -AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder("alsa", {"alsa","alsasink"}) {} +AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder("alsa", { "alsa","alsasink" }) {} QList AlsaDeviceFinder::ListDevices() { diff --git a/src/engine/alsadevicefinder.h b/src/engine/alsadevicefinder.h index cd3a587d..5a11ac26 100644 --- a/src/engine/alsadevicefinder.h +++ b/src/engine/alsadevicefinder.h @@ -37,4 +37,4 @@ class AlsaDeviceFinder : public DeviceFinder { Q_DISABLE_COPY(AlsaDeviceFinder) }; -#endif // ALSADEVICEFINDER_H +#endif // ALSADEVICEFINDER_H diff --git a/src/engine/alsapcmdevicefinder.cpp b/src/engine/alsapcmdevicefinder.cpp index 63f252ef..f056f457 100644 --- a/src/engine/alsapcmdevicefinder.cpp +++ b/src/engine/alsapcmdevicefinder.cpp @@ -33,7 +33,7 @@ #include "devicefinder.h" #include "alsapcmdevicefinder.h" -AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder("alsa", {"alsa","alsasink"}) {} +AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder("alsa", { "alsa","alsasink" }) {} QList AlsaPCMDeviceFinder::ListDevices() { diff --git a/src/engine/alsapcmdevicefinder.h b/src/engine/alsapcmdevicefinder.h index 04bbf8bb..68b32e29 100644 --- a/src/engine/alsapcmdevicefinder.h +++ b/src/engine/alsapcmdevicefinder.h @@ -37,4 +37,4 @@ class AlsaPCMDeviceFinder : public DeviceFinder { Q_DISABLE_COPY(AlsaPCMDeviceFinder) }; -#endif // ALSAPCMDEVICEFINDER_H +#endif // ALSAPCMDEVICEFINDER_H diff --git a/src/engine/devicefinder.cpp b/src/engine/devicefinder.cpp index 5ada6727..002604c0 100644 --- a/src/engine/devicefinder.cpp +++ b/src/engine/devicefinder.cpp @@ -23,7 +23,7 @@ #include "devicefinder.h" -DeviceFinder::DeviceFinder(const QString &name, const QStringList &outputs): name_(name), outputs_(outputs) {} +DeviceFinder::DeviceFinder(const QString &name, const QStringList &outputs) : name_(name), outputs_(outputs) {} QString DeviceFinder::GuessIconName(const QString &description) { diff --git a/src/engine/devicefinder.h b/src/engine/devicefinder.h index 7743f75d..6da1dde1 100644 --- a/src/engine/devicefinder.h +++ b/src/engine/devicefinder.h @@ -65,4 +65,4 @@ class DeviceFinder { Q_DISABLE_COPY(DeviceFinder) }; -#endif // DEVICEFINDER_H +#endif // DEVICEFINDER_H diff --git a/src/engine/directsounddevicefinder.cpp b/src/engine/directsounddevicefinder.cpp index 08354f4a..2acf14b4 100644 --- a/src/engine/directsounddevicefinder.cpp +++ b/src/engine/directsounddevicefinder.cpp @@ -20,7 +20,7 @@ */ #ifdef INTERFACE -#undef INTERFACE +# undef INTERFACE #endif #include "config.h" diff --git a/src/engine/directsounddevicefinder.h b/src/engine/directsounddevicefinder.h index 287fd1eb..7417c977 100644 --- a/src/engine/directsounddevicefinder.h +++ b/src/engine/directsounddevicefinder.h @@ -46,4 +46,4 @@ class DirectSoundDeviceFinder : public DeviceFinder { LPVOID state_voidptr) __attribute__((stdcall)); }; -#endif // DIRECTSOUNDDEVICEFINDER_H +#endif // DIRECTSOUNDDEVICEFINDER_H diff --git a/src/engine/engine_fwd.h b/src/engine/engine_fwd.h index fee47d98..44710e38 100644 --- a/src/engine/engine_fwd.h +++ b/src/engine/engine_fwd.h @@ -35,7 +35,7 @@ enum TrackChangeType { Q_DECLARE_FLAGS(TrackChangeFlags, TrackChangeType) -} +} // namespace Engine typedef Engine::Base EngineBase; diff --git a/src/engine/enginebase.h b/src/engine/enginebase.h index 4742c58a..3b76e3a3 100644 --- a/src/engine/enginebase.h +++ b/src/engine/enginebase.h @@ -241,7 +241,7 @@ struct SimpleMetaBundle { QString lyrics; }; -} // namespace +} // namespace Engine Q_DECLARE_METATYPE(EngineBase::OutputDetails) diff --git a/src/engine/enginetype.h b/src/engine/enginetype.h index 48f511fb..02d1eed8 100644 --- a/src/engine/enginetype.h +++ b/src/engine/enginetype.h @@ -38,7 +38,8 @@ Engine::EngineType EngineTypeFromName(const QString &enginename); QString EngineName(const Engine::EngineType enginetype); QString EngineDescription(const Engine::EngineType enginetype); -} +} // namespace Engine + Q_DECLARE_METATYPE(Engine::EngineType) #endif // ENGINETYPE_H diff --git a/src/engine/gstbufferconsumer.h b/src/engine/gstbufferconsumer.h index d74d27db..286817d3 100644 --- a/src/engine/gstbufferconsumer.h +++ b/src/engine/gstbufferconsumer.h @@ -42,4 +42,4 @@ class GstBufferConsumer { Q_DISABLE_COPY(GstBufferConsumer) }; -#endif // GSTBUFFERCONSUMER_H +#endif // GSTBUFFERCONSUMER_H diff --git a/src/engine/gstengine.cpp b/src/engine/gstengine.cpp index 0b375875..01d819c5 100644 --- a/src/engine/gstengine.cpp +++ b/src/engine/gstengine.cpp @@ -712,7 +712,7 @@ GstEngine::PluginDetailsList GstEngine::GetPluginList(const QString &classname) GList *p = features; while (p) { GstElementFactory *factory = GST_ELEMENT_FACTORY(p->data); - if (QString(gst_element_factory_get_klass(factory)).contains(classname)) {; + if (QString(gst_element_factory_get_klass(factory)).contains(classname)) { PluginDetails details; details.name = QString::fromUtf8(gst_plugin_feature_get_name(p->data)); details.description = QString::fromUtf8(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_DESCRIPTION)); diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index 68ddf540..9605918f 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -1174,7 +1174,7 @@ void GstEnginePipeline::SetEqualizerParams(const int preamp, const QList &b void GstEnginePipeline::UpdateEqualizer() { - if (!equalizer_ || !equalizer_preamp_) return; + if (!equalizer_ || !equalizer_preamp_) return; // Update band gains for (int i = 0; i < kEqBandCount; ++i) { diff --git a/src/engine/macosdevicefinder.cpp b/src/engine/macosdevicefinder.cpp index f13d394b..6c045977 100644 --- a/src/engine/macosdevicefinder.cpp +++ b/src/engine/macosdevicefinder.cpp @@ -62,7 +62,7 @@ std::unique_ptr GetProperty(const AudioDeviceID &device_id, const AudioObject } // namespace -MacOsDeviceFinder::MacOsDeviceFinder() : DeviceFinder("osxaudio", { "osxaudio", "osx", "osxaudiosink"} ) {} +MacOsDeviceFinder::MacOsDeviceFinder() : DeviceFinder("osxaudio", { "osxaudio", "osx", "osxaudiosink" }) {} QList MacOsDeviceFinder::ListDevices() { diff --git a/src/engine/pulsedevicefinder.cpp b/src/engine/pulsedevicefinder.cpp index 241ec0be..12d27686 100644 --- a/src/engine/pulsedevicefinder.cpp +++ b/src/engine/pulsedevicefinder.cpp @@ -34,7 +34,7 @@ #include "devicefinder.h" #include "pulsedevicefinder.h" -PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulseaudio", {"pulseaudio", "pulse", "pulsesink"} ), mainloop_(nullptr), context_(nullptr) {} +PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder( "pulseaudio", { "pulseaudio", "pulse", "pulsesink" }), mainloop_(nullptr), context_(nullptr) {} bool PulseDeviceFinder::Initialize() { diff --git a/src/engine/vlcengine.cpp b/src/engine/vlcengine.cpp index a7736207..4bd4f6ae 100644 --- a/src/engine/vlcengine.cpp +++ b/src/engine/vlcengine.cpp @@ -313,7 +313,7 @@ void VLCEngine::StateChangedCallback(const libvlc_event_t *e, void *data) { case libvlc_MediaPlayerEndReached: engine->state_ = Engine::Idle; emit engine->TrackEnded(); - return; // Don't emit state changed here + return; // Don't emit state changed here } } diff --git a/src/equalizer/equalizer.cpp b/src/equalizer/equalizer.cpp index 76cb14a0..2b77bc02 100644 --- a/src/equalizer/equalizer.cpp +++ b/src/equalizer/equalizer.cpp @@ -208,7 +208,7 @@ void Equalizer::SavePreset() { QString Equalizer::SaveCurrentPreset() { - QString name = QInputDialog::getText(this, tr("Save preset"), tr("Name"), QLineEdit::Normal, tr(qPrintable(last_preset_)));; + QString name = QInputDialog::getText(this, tr("Save preset"), tr("Name"), QLineEdit::Normal, tr(qPrintable(last_preset_))); if (name.isEmpty()) return QString(); @@ -374,7 +374,7 @@ Equalizer::Params::Params(int g0, int g1, int g2, int g3, int g4, int g5, int g6 gain[9] = g9; } -bool Equalizer::Params::operator ==(const Equalizer::Params &other) const { +bool Equalizer::Params::operator==(const Equalizer::Params &other) const { if (preamp != other.preamp) return false; for (int i = 0; i < Equalizer::kBands; ++i) { if (gain[i] != other.gain[i]) return false; @@ -382,7 +382,7 @@ bool Equalizer::Params::operator ==(const Equalizer::Params &other) const { return true; } -bool Equalizer::Params::operator !=(const Equalizer::Params &other) const { +bool Equalizer::Params::operator!=(const Equalizer::Params &other) const { return ! (*this == other); } diff --git a/src/equalizer/equalizer.h b/src/equalizer/equalizer.h index 9f4b498a..2a9ffd49 100644 --- a/src/equalizer/equalizer.h +++ b/src/equalizer/equalizer.h @@ -52,8 +52,8 @@ class Equalizer : public QDialog { Params(); Params(int g0, int g1, int g2, int g3, int g4, int g5, int g6, int g7, int g8, int g9, int pre = 0); - bool operator ==(const Params &other) const; - bool operator !=(const Params &other) const; + bool operator==(const Params &other) const; + bool operator!=(const Params &other) const; int preamp; int gain[kBands]{}; diff --git a/src/equalizer/equalizerslider.cpp b/src/equalizer/equalizerslider.cpp index bde955e4..5ad8b573 100644 --- a/src/equalizer/equalizerslider.cpp +++ b/src/equalizer/equalizerslider.cpp @@ -31,8 +31,8 @@ #include "ui_equalizerslider.h" EqualizerSlider::EqualizerSlider(const QString &label, QWidget *parent) - : QWidget(parent), - ui_(new Ui_EqualizerSlider) { + : QWidget(parent), + ui_(new Ui_EqualizerSlider) { ui_->setupUi(this); ui_->band->setText(label); diff --git a/src/globalshortcuts/globalshortcutsbackend-gnome.cpp b/src/globalshortcuts/globalshortcutsbackend-gnome.cpp index 02cbb080..addcbe4c 100644 --- a/src/globalshortcuts/globalshortcutsbackend-gnome.cpp +++ b/src/globalshortcuts/globalshortcutsbackend-gnome.cpp @@ -86,7 +86,7 @@ void GlobalShortcutsBackendGnome::RegisterFinished(QDBusPendingCallWatcher *watc watcher->deleteLater(); if (reply.type() == QDBusMessage::ErrorMessage) { - qLog(Warning) << "Failed to grab media keys" << reply.errorName() <deleteLater(); if (reply.type() == QDBusMessage::ErrorMessage) { - qLog(Warning) << "Failed to grab media keys" << reply.errorName() < shortcuts() const { return shortcuts_; } bool IsKdeAvailable() const; - static bool IsX11Available() ; + static bool IsX11Available(); bool IsGnomeAvailable() const; bool IsMateAvailable() const; bool IsMacAccessibilityEnabled() const; diff --git a/src/internet/internetcollectionview.h b/src/internet/internetcollectionview.h index 526f158a..dce44673 100644 --- a/src/internet/internetcollectionview.h +++ b/src/internet/internetcollectionview.h @@ -110,7 +110,7 @@ class InternetCollectionView : public AutoExpandingTreeView { private: Application *app_; CollectionBackend *collection_backend_; - CollectionModel*collection_model_; + CollectionModel *collection_model_; CollectionFilterWidget *filter_; bool favorite_; diff --git a/src/internet/internetplaylistitem.cpp b/src/internet/internetplaylistitem.cpp index 45daf8eb..993167bd 100644 --- a/src/internet/internetplaylistitem.cpp +++ b/src/internet/internetplaylistitem.cpp @@ -62,7 +62,7 @@ bool InternetPlaylistItem::InitFromQuery(const SqlRow &query) { } QVariant InternetPlaylistItem::DatabaseValue(DatabaseColumn column) const { - return PlaylistItem::DatabaseValue(column); + return PlaylistItem::DatabaseValue(column); } void InternetPlaylistItem::InitMetadata() { diff --git a/src/internet/internetsearchview.h b/src/internet/internetsearchview.h index e639a464..eb798fe4 100644 --- a/src/internet/internetsearchview.h +++ b/src/internet/internetsearchview.h @@ -87,7 +87,7 @@ class InternetSearchView : public QWidget { void LazyLoadAlbumCover(const QModelIndex &proxy_index); - protected: + protected: struct PendingState { PendingState() : orig_id_(-1) {} PendingState(int orig_id, const QStringList &tokens) : orig_id_(orig_id), tokens_(tokens) {} diff --git a/src/lyrics/chartlyricsprovider.cpp b/src/lyrics/chartlyricsprovider.cpp index a350087b..45344c5a 100644 --- a/src/lyrics/chartlyricsprovider.cpp +++ b/src/lyrics/chartlyricsprovider.cpp @@ -125,13 +125,13 @@ void ChartLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 } } else if (type == QXmlStreamReader::EndElement) { - if (name == "GetLyricResult") { - if (!result.artist.isEmpty() && !result.title.isEmpty() && !result.lyrics.isEmpty() && (result.artist.toLower() == artist.toLower() || result.title.toLower() == title.toLower())) { - result.lyrics = Utilities::DecodeHtmlEntities(result.lyrics); - results << result; - } - result = LyricsSearchResult(); - } + if (name == "GetLyricResult") { + if (!result.artist.isEmpty() && !result.title.isEmpty() && !result.lyrics.isEmpty() && (result.artist.toLower() == artist.toLower() || result.title.toLower() == title.toLower())) { + result.lyrics = Utilities::DecodeHtmlEntities(result.lyrics); + results << result; + } + result = LyricsSearchResult(); + } } } diff --git a/src/lyrics/geniuslyricsprovider.cpp b/src/lyrics/geniuslyricsprovider.cpp index 240abb97..440be025 100644 --- a/src/lyrics/geniuslyricsprovider.cpp +++ b/src/lyrics/geniuslyricsprovider.cpp @@ -57,7 +57,7 @@ const char *GeniusLyricsProvider::kSettingsGroup = "GeniusLyrics"; const char *GeniusLyricsProvider::kOAuthAuthorizeUrl = "https://api.genius.com/oauth/authorize"; const char *GeniusLyricsProvider::kOAuthAccessTokenUrl = "https://api.genius.com/oauth/token"; -const char *GeniusLyricsProvider::kOAuthRedirectUrl = "http://localhost:63111/"; // Genius does not accept a random port number. This port must match the the URL of the ClientID. +const char *GeniusLyricsProvider::kOAuthRedirectUrl = "http://localhost:63111/"; // Genius does not accept a random port number. This port must match the the URL of the ClientID. const char *GeniusLyricsProvider::kUrlSearch = "https://api.genius.com/search/"; const char *GeniusLyricsProvider::kClientIDB64 = "RUNTNXU4U1VyMU1KUU5hdTZySEZteUxXY2hkanFiY3lfc2JjdXBpNG5WMU9SNUg4dTBZelEtZTZCdFg2dl91SQ=="; const char *GeniusLyricsProvider::kClientSecretB64 = "VE9pMU9vUjNtTXZ3eFR3YVN0QVRyUjVoUlhVWDI1Ylp5X240eEt1M0ZkYlNwRG5JUnd0LXFFbHdGZkZkRWY2VzJ1S011UnQzM3c2Y3hqY0tVZ3NGN2c="; diff --git a/src/lyrics/lololyricsprovider.cpp b/src/lyrics/lololyricsprovider.cpp index 75590ad0..7b7f33a2 100644 --- a/src/lyrics/lololyricsprovider.cpp +++ b/src/lyrics/lololyricsprovider.cpp @@ -136,13 +136,13 @@ void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 i } } else if (type == QXmlStreamReader::EndElement) { - if (name == "result") { - if (!result.lyrics.isEmpty()) { - result.lyrics = Utilities::DecodeHtmlEntities(result.lyrics); - results << result; - } - result = LyricsSearchResult(); - } + if (name == "result") { + if (!result.lyrics.isEmpty()) { + result.lyrics = Utilities::DecodeHtmlEntities(result.lyrics); + results << result; + } + result = LyricsSearchResult(); + } } } } diff --git a/src/lyrics/lyricsfetchersearch.cpp b/src/lyrics/lyricsfetchersearch.cpp index aa65fdf4..e55b4f65 100644 --- a/src/lyrics/lyricsfetchersearch.cpp +++ b/src/lyrics/lyricsfetchersearch.cpp @@ -108,7 +108,7 @@ void LyricsFetcherSearch::ProviderSearchFinished(const quint64 id, const LyricsS std::stable_sort(results_.begin(), results_.end(), LyricsSearchResultCompareScore); if (!pending_requests_.isEmpty()) { - if (!results_.isEmpty() && higest_score >= kHighScore) { // Highest score, no need to wait for other providers. + if (!results_.isEmpty() && higest_score >= kHighScore) { // Highest score, no need to wait for other providers. qLog(Debug) << "Got lyrics with high score from" << results_.last().provider << "for" << request_.artist << request_.title << "score" << results_.last().score << "finishing search."; TerminateSearch(); } diff --git a/src/lyrics/musixmatchlyricsprovider.cpp b/src/lyrics/musixmatchlyricsprovider.cpp index 9e08f11d..8539edc2 100644 --- a/src/lyrics/musixmatchlyricsprovider.cpp +++ b/src/lyrics/musixmatchlyricsprovider.cpp @@ -143,7 +143,7 @@ void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const qui return; } - if (content_json.contains(QRegularExpression("<[^>]*>"))) { // Make sure it's not HTML code. + if (content_json.contains(QRegularExpression("<[^>]*>"))) { // Make sure it's not HTML code. emit SearchFinished(id, results); return; } diff --git a/src/moodbar/moodbarbuilder.cpp b/src/moodbar/moodbarbuilder.cpp index 0d50c42e..b4c97ef2 100644 --- a/src/moodbar/moodbarbuilder.cpp +++ b/src/moodbar/moodbarbuilder.cpp @@ -77,7 +77,7 @@ void MoodbarBuilder::AddFrame(const double *magnitudes, int size) { } // Now divide the bark bands into thirds and compute their total amplitudes. - double rgb[] = {0, 0, 0}; + double rgb[] = { 0, 0, 0 }; for (int i = 0; i < sBarkBandCount; ++i) { rgb[(i * 3) / sBarkBandCount] += bands[i] * bands[i]; } diff --git a/src/moodbar/moodbarcontroller.cpp b/src/moodbar/moodbarcontroller.cpp index c4dd73ce..ec01fab0 100644 --- a/src/moodbar/moodbarcontroller.cpp +++ b/src/moodbar/moodbarcontroller.cpp @@ -95,7 +95,7 @@ void MoodbarController::AsyncLoadComplete(MoodbarPipeline *pipeline, const QUrl return; } // Did we stop the song? - switch(app_->player()->GetState()) { + switch (app_->player()->GetState()) { case Engine::Error: case Engine::Empty: case Engine::Idle: diff --git a/src/musicbrainz/acoustidclient.cpp b/src/musicbrainz/acoustidclient.cpp index 793861a5..ab1d0089 100644 --- a/src/musicbrainz/acoustidclient.cpp +++ b/src/musicbrainz/acoustidclient.cpp @@ -71,11 +71,11 @@ void AcoustidClient::Start(const int id, const QString &fingerprint, int duratio typedef QPair Param; typedef QList ParamList; - const ParamList params = ParamList () << Param("format", "json") - << Param("client", kClientId) - << Param("duration", QString::number(duration_msec / kMsecPerSec)) - << Param("meta", "recordingids+sources") - << Param("fingerprint", fingerprint); + const ParamList params = ParamList() << Param("format", "json") + << Param("client", kClientId) + << Param("duration", QString::number(duration_msec / kMsecPerSec)) + << Param("meta", "recordingids+sources") + << Param("fingerprint", fingerprint); QUrlQuery url_query; url_query.setQueryItems(params); @@ -113,8 +113,7 @@ void AcoustidClient::CancelAll() { namespace { // Struct used when extracting results in RequestFinished struct IdSource { - IdSource(const QString &id, const int source) - : id_(id), nb_sources_(source) {} + IdSource(const QString &id, const int source) : id_(id), nb_sources_(source) {} bool operator<(const IdSource &other) const { // We want the items with more sources to be at the beginning of the list diff --git a/src/musicbrainz/musicbrainzclient.cpp b/src/musicbrainz/musicbrainzclient.cpp index 8184de12..daa841e6 100644 --- a/src/musicbrainz/musicbrainzclient.cpp +++ b/src/musicbrainz/musicbrainzclient.cpp @@ -81,7 +81,7 @@ QByteArray MusicBrainzClient::GetReplyData(QNetworkReply *reply, QString &error) QByteArray data; if (reply->error() == QNetworkReply::NoError && reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200) { - data = reply->readAll(); + data = reply->readAll(); } else { if (reply->error() != QNetworkReply::NoError && reply->error() < 200) { @@ -220,7 +220,7 @@ void MusicBrainzClient::RequestFinished(QNetworkReply *reply, const int id, cons QXmlStreamReader reader(data); ResultList res; while (!reader.atEnd()) { - if (reader.readNext() == QXmlStreamReader::StartElement && reader.name().toString() == "recording") { + if (reader.readNext() == QXmlStreamReader::StartElement && reader.name().toString() == "recording") { ResultList tracks = ParseTrack(&reader); for (const Result &track : tracks) { if (!track.title_.isEmpty()) { diff --git a/src/musicbrainz/tagfetcher.cpp b/src/musicbrainz/tagfetcher.cpp index 394cf3c9..1469a334 100644 --- a/src/musicbrainz/tagfetcher.cpp +++ b/src/musicbrainz/tagfetcher.cpp @@ -58,7 +58,7 @@ void TagFetcher::StartFetch(const SongList &songs) { songs_ = songs; bool have_fingerprints = true; - if (std::any_of(songs.begin(), songs.end(), [](const Song &song){ return song.fingerprint().isEmpty(); })) { + if (std::any_of(songs.begin(), songs.end(), [](const Song &song) { return song.fingerprint().isEmpty(); })) { have_fingerprints = false; } diff --git a/src/organize/organize.cpp b/src/organize/organize.cpp index 184956bd..1e06f201 100644 --- a/src/organize/organize.cpp +++ b/src/organize/organize.cpp @@ -212,7 +212,7 @@ void Organize::ProcessSomeFiles() { qLog(Debug) << "Transcoding to" << task.transcoded_filename_; // Start the transcoding - this will happen in the background and FileTranscoded() will get called when it's done. - // At that point the task will get re-added to the pending queue with the new filename. + // At that point the task will get re-added to the pending queue with the new filename. transcoder_->AddJob(task.song_info_.song_.url().toLocalFile(), preset, task.transcoded_filename_); transcoder_->Start(); continue; diff --git a/src/organize/organize.h b/src/organize/organize.h index fef6a5e0..a371686d 100644 --- a/src/organize/organize.h +++ b/src/organize/organize.h @@ -92,10 +92,9 @@ class Organize : public QObject { private: struct Task { - explicit Task(const NewSongInfo &song_info = NewSongInfo()) : - song_info_(song_info), - transcode_progress_(0.0) - {} + explicit Task(const NewSongInfo &song_info = NewSongInfo()) + : song_info_(song_info), + transcode_progress_(0.0) {} NewSongInfo song_info_; float transcode_progress_; diff --git a/src/organize/organizedialog.cpp b/src/organize/organizedialog.cpp index ddaeba2d..3a5064a7 100644 --- a/src/organize/organizedialog.cpp +++ b/src/organize/organizedialog.cpp @@ -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, [this, tag]() { InsertTag(tag); } ); + QObject::connect(action, &QAction::triggered, this, [this, tag]() { InsertTag(tag); }); } ui_->insert->setMenu(tag_menu); @@ -222,7 +222,7 @@ void OrganizeDialog::LoadGeometry() { } if (parentwindow_) { - // Center the window on the same screen as the parentwindow. + // Center the window on the same screen as the parentwindow. #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) QScreen *screen = parentwindow_->screen(); #else diff --git a/src/organize/organizeerrordialog.h b/src/organize/organizeerrordialog.h index c25ceb0c..2a2e0208 100644 --- a/src/organize/organizeerrordialog.h +++ b/src/organize/organizeerrordialog.h @@ -49,7 +49,7 @@ class OrganizeErrorDialog : public QDialog { void Show(OperationType type, const SongList &songs_with_errors, const QStringList &log = QStringList()); void Show(OperationType type, const QStringList &files_with_errors, const QStringList &log = QStringList()); -private: + private: Ui_OrganizeErrorDialog *ui_; }; diff --git a/src/osd/osdbase.cpp b/src/osd/osdbase.cpp index 9fd0fd0f..bdc1c320 100644 --- a/src/osd/osdbase.cpp +++ b/src/osd/osdbase.cpp @@ -183,8 +183,8 @@ void OSDBase::ShowPlaying(const Song &song, const QUrl &cover_url, const QImage } void OSDBase::SongChanged(const Song &song) { - playing_ = true; - song_playing_ = song; + playing_ = true; + song_playing_ = song; } void OSDBase::Paused() { diff --git a/src/osd/osdpretty.cpp b/src/osd/osdpretty.cpp index 0994240e..dd16df08 100644 --- a/src/osd/osdpretty.cpp +++ b/src/osd/osdpretty.cpp @@ -63,7 +63,7 @@ #include "ui_osdpretty.h" #ifdef Q_OS_WIN -# include +# include #endif #include "core/utilities.h" @@ -216,7 +216,7 @@ bool OSDPretty::IsTransparencyAvailable() { #if defined(HAVE_X11) && defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) if (qApp) { QPlatformNativeInterface *native = qApp->platformNativeInterface(); - QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_; + QScreen *screen = popup_screen_ == nullptr ? QGuiApplication::primaryScreen() : popup_screen_; if (native && screen) { return native->nativeResourceForScreen(QByteArray("compositingEnabled"), screen); } @@ -371,7 +371,7 @@ void OSDPretty::ShowMessage(const QString &summary, const QString &message, cons } else { if (!disable_duration()) - timeout_->start(); // Restart the timer + timeout_->start(); // Restart the timer } } else { diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 563e8dbc..04e9c96c 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -611,7 +611,7 @@ int Playlist::next_row(const bool ignore_repeat_track) const { int Playlist::previous_row(const bool ignore_repeat_track) const { - int prev_virtual_index = PreviousVirtualIndex(current_virtual_index_,ignore_repeat_track); + int prev_virtual_index = PreviousVirtualIndex(current_virtual_index_, ignore_repeat_track); if (prev_virtual_index < 0) { // We've gone off the beginning of the playlist. @@ -624,7 +624,7 @@ int Playlist::previous_row(const bool ignore_repeat_track) const { break; default: - prev_virtual_index = PreviousVirtualIndex(virtual_items_.count(),ignore_repeat_track); + prev_virtual_index = PreviousVirtualIndex(virtual_items_.count(), ignore_repeat_track); break; } } @@ -1736,7 +1736,7 @@ void Playlist::ClearStreamMetadata() { current_item()->ClearTemporaryMetadata(); UpdateScrobblePoint(); - emit 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)); } diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h index 81649ca5..77a7cc06 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -68,7 +68,7 @@ class ReOrderItems; class RemoveItems; class ShuffleItems; class SortItems; -} +} // namespace PlaylistUndoCommands typedef QMap ColumnAlignmentMap; Q_DECLARE_METATYPE(Qt::Alignment) diff --git a/src/playlist/playlistbackend.h b/src/playlist/playlistbackend.h index 1b312456..6dfe48b9 100644 --- a/src/playlist/playlistbackend.h +++ b/src/playlist/playlistbackend.h @@ -92,7 +92,7 @@ class PlaylistBackend : public QObject { void Exit(); void SavePlaylist(int playlist, const PlaylistItemList &items, int last_played, PlaylistGeneratorPtr dynamic); -signals: + signals: void ExitFinished(); private: diff --git a/src/playlist/playlistcontainer.cpp b/src/playlist/playlistcontainer.cpp index 42925fb9..79b24ea2 100644 --- a/src/playlist/playlistcontainer.cpp +++ b/src/playlist/playlistcontainer.cpp @@ -363,7 +363,7 @@ void PlaylistContainer::GoToNextPlaylistTab() { void PlaylistContainer::GoToPreviousPlaylistTab() { // Get the next tab' id - int id_previous = ui_->tab_bar->id_of((ui_->tab_bar->currentIndex()+ui_->tab_bar->count()-1) % ui_->tab_bar->count()); + int id_previous = ui_->tab_bar->id_of((ui_->tab_bar->currentIndex() + ui_->tab_bar->count() - 1) % ui_->tab_bar->count()); // Switch to next tab manager_->SetCurrentPlaylist(id_previous); diff --git a/src/playlist/playlistdelegates.cpp b/src/playlist/playlistdelegates.cpp index 42573d64..89f508ef 100644 --- a/src/playlist/playlistdelegates.cpp +++ b/src/playlist/playlistdelegates.cpp @@ -178,7 +178,7 @@ QString PlaylistDelegateBase::displayText(const QVariant &value, const QLocale&) QString text; #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - switch(value.metaType().id()) { + switch (value.metaType().id()) { #else switch (static_cast(value.type())) { #endif @@ -536,7 +536,7 @@ QString RatingItemDelegate::displayText(const QVariant &value, const QLocale&) c if (value.isNull() || value.toDouble() <= 0) return QString(); // Round to the nearest 0.5 - const double rating = double(int(value.toDouble() * RatingPainter::kStarCount * 2 + 0.5)) / 2; + const double rating = double(int(value.toDouble() * RatingPainter::kStarCount * 2 + 0.5)) / 2; return QString::number(rating, 'f', 1); diff --git a/src/playlist/playlistdelegates.h b/src/playlist/playlistdelegates.h index c3214bf3..626a83ac 100644 --- a/src/playlist/playlistdelegates.h +++ b/src/playlist/playlistdelegates.h @@ -55,13 +55,13 @@ class CollectionBackend; class Player; class QueuedItemDelegate : public QStyledItemDelegate { - Q_OBJECT + Q_OBJECT public: explicit QueuedItemDelegate(QObject *parent, int indicator_column = Playlist::Column_Title); void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const override; - static void DrawBox(QPainter *painter, const QRect line_rect, const QFont &font, const QString &text, int width = -1, const float opacity = 1.0) ; + static void DrawBox(QPainter *painter, const QRect line_rect, const QFont &font, const QString &text, int width = -1, const float opacity = 1.0); int queue_indicator_size(const QModelIndex &idx) const; @@ -124,7 +124,7 @@ class DateItemDelegate : public PlaylistDelegateBase { }; class LastPlayedItemDelegate : public PlaylistDelegateBase { - Q_OBJECT + Q_OBJECT public: explicit LastPlayedItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {} diff --git a/src/playlist/playlistfilterparser.cpp b/src/playlist/playlistfilterparser.cpp index fff2e70a..d2a3aed0 100644 --- a/src/playlist/playlistfilterparser.cpp +++ b/src/playlist/playlistfilterparser.cpp @@ -305,8 +305,8 @@ FilterTree *FilterParser::parseAndGroup() { break; } checkAnd(); // if there's no 'AND', we'll add the term anyway... - } - while (iter_ != end_); + } while (iter_ != end_); + return group; } diff --git a/src/playlist/playlistfilterparser.h b/src/playlist/playlistfilterparser.h index 1cc0141e..75cf9b8f 100644 --- a/src/playlist/playlistfilterparser.h +++ b/src/playlist/playlistfilterparser.h @@ -72,7 +72,7 @@ class NopFilter : public FilterTree { // col ::= "title" | "artist" | ... class FilterParser { public: - explicit FilterParser(const QString &filter, const QMap &columns, const QSet &numerical_cols); + explicit FilterParser(const QString &filter, const QMap &columns, const QSet &numerical_cols); FilterTree *parse(); @@ -88,7 +88,7 @@ class FilterParser { FilterTree *parseSearchTerm(); FilterTree *createSearchTermTreeNode(const QString &col, const QString &prefix, const QString &search) const; - static int parseTime(const QString &time_str) ; + static int parseTime(const QString &time_str); QString::const_iterator iter_; QString::const_iterator end_; diff --git a/src/playlist/playlistheader.cpp b/src/playlist/playlistheader.cpp index 263521f2..c4ed4bb7 100644 --- a/src/playlist/playlistheader.cpp +++ b/src/playlist/playlistheader.cpp @@ -135,7 +135,7 @@ void PlaylistHeader::AddColumnAction(int index) { action->setChecked(!isSectionHidden(index)); show_actions_ << action; - QObject::connect(action, &QAction::triggered, [this, index]() { ToggleVisible(index); } ); + QObject::connect(action, &QAction::triggered, [this, index]() { ToggleVisible(index); }); } diff --git a/src/playlist/playlistlistmodel.cpp b/src/playlist/playlistlistmodel.cpp index 9bb8da1c..100e6847 100644 --- a/src/playlist/playlistlistmodel.cpp +++ b/src/playlist/playlistlistmodel.cpp @@ -35,9 +35,9 @@ PlaylistListModel::PlaylistListModel(QObject *parent) : QStandardItemModel(parent), dropping_rows_(false) { - QObject::connect(this,&PlaylistListModel::dataChanged, this, &PlaylistListModel::RowsChanged); - QObject::connect(this,&PlaylistListModel::rowsAboutToBeRemoved, this, &PlaylistListModel::RowsAboutToBeRemoved); - QObject::connect(this,&PlaylistListModel::rowsInserted, this, &PlaylistListModel::RowsInserted); + QObject::connect(this, &PlaylistListModel::dataChanged, this, &PlaylistListModel::RowsChanged); + QObject::connect(this, &PlaylistListModel::rowsAboutToBeRemoved, this, &PlaylistListModel::RowsAboutToBeRemoved); + QObject::connect(this, &PlaylistListModel::rowsInserted, this, &PlaylistListModel::RowsInserted); } diff --git a/src/playlist/playlistlistmodel.h b/src/playlist/playlistlistmodel.h index c9edd803..02e58ba8 100644 --- a/src/playlist/playlistlistmodel.h +++ b/src/playlist/playlistlistmodel.h @@ -60,7 +60,7 @@ class PlaylistListModel : public QStandardItemModel { // Walks from the given item to the root, returning the / separated path of // all the parent folders. The path includes this item if it is a folder. - static QString ItemPath(const QStandardItem *item) ; + static QString ItemPath(const QStandardItem *item); // Finds the playlist with the given ID, returns 0 if it doesn't exist. QStandardItem *PlaylistById(const int id) const; diff --git a/src/playlist/playlistsequence.cpp b/src/playlist/playlistsequence.cpp index 743ad54c..5946ee10 100644 --- a/src/playlist/playlistsequence.cpp +++ b/src/playlist/playlistsequence.cpp @@ -166,7 +166,7 @@ void PlaylistSequence::SetRepeatMode(const RepeatMode mode) { ui_->repeat->setChecked(mode != Repeat_Off); - switch(mode) { + switch (mode) { case Repeat_Off: ui_->action_repeat_off->setChecked(true); break; case Repeat_Track: ui_->action_repeat_track->setChecked(true); break; case Repeat_Album: ui_->action_repeat_album->setChecked(true); break; diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 13071c24..13518e37 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -668,7 +668,7 @@ void PlaylistView::keyPressEvent(QKeyEvent *event) { emit SeekForward(); event->accept(); } - else if (event->modifiers() == Qt::NoModifier && ((event->key() >= Qt::Key_Exclam && event->key() <= Qt::Key_Z) || event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Escape)) { + else if (event->modifiers() == Qt::NoModifier && ((event->key() >= Qt::Key_Exclam && event->key() <= Qt::Key_Z) || event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Escape)) { emit FocusOnFilterSignal(event); event->accept(); } @@ -974,11 +974,11 @@ void PlaylistView::paintEvent(QPaintEvent *event) { else { if (background_image_stretch_) { if (background_image_keep_aspect_ratio_) { - if (background_image_do_not_cut_){ + if (background_image_do_not_cut_) { cached_scaled_background_image_ = QPixmap::fromImage(background_image_.scaled(pb_width, pb_height, Qt::KeepAspectRatio, Qt::SmoothTransformation)); } else { - if (pb_height >= pb_width){ + if (pb_height >= pb_width) { cached_scaled_background_image_ = QPixmap::fromImage(background_image_.scaledToHeight(pb_height, Qt::SmoothTransformation)); } else { diff --git a/src/playlistparsers/cueparser.cpp b/src/playlistparsers/cueparser.cpp index 23b3d632..03455c04 100644 --- a/src/playlistparsers/cueparser.cpp +++ b/src/playlistparsers/cueparser.cpp @@ -129,10 +129,9 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const break; } // just ignore the rest of possible field types for now... - } - while (!(line = text_stream.readLine()).isNull()); + } while (!(line = text_stream.readLine()).isNull()); - if(line.isNull()) { + if (line.isNull()) { qLog(Warning) << "the .cue file from " << dir_path << " defines no tracks!"; return ret; } @@ -215,8 +214,7 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const } // Just ignore the rest of possible field types for now... - } - while (!(line = text_stream.readLine()).isNull()); + } while (!(line = text_stream.readLine()).isNull()); // We didn't add the last song yet... if (valid_file && !index.isEmpty() && (track_type.isEmpty() || track_type == kAudioTrackType)) { @@ -246,7 +244,7 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const } // The last TRACK for every FILE gets it's 'end' marker from the media file's length - if(i + 1 < entries.size() && entries.at(i).file == entries.at(i + 1).file) { + if (i + 1 < entries.size() && entries.at(i).file == entries.at(i + 1).file) { // incorrect indices? if (!UpdateSong(entry, entries.at(i + 1).index, &song)) { continue; diff --git a/src/playlistparsers/cueparser.h b/src/playlistparsers/cueparser.h index 4012d113..87d245df 100644 --- a/src/playlistparsers/cueparser.h +++ b/src/playlistparsers/cueparser.h @@ -96,8 +96,8 @@ class CueParser : public ParserBase { file(_file), index(_index), title(_title), artist(_artist), album_artist(_album_artist), album(_album), composer(_composer), album_composer(_album_composer), genre(_genre), date(_date), disc(_disc) {} }; - static bool UpdateSong(const CueEntry &entry, const QString &next_index, Song *song) ; - static bool UpdateLastSong(const CueEntry &entry, Song *song) ; + static bool UpdateSong(const CueEntry &entry, const QString &next_index, Song *song); + static bool UpdateLastSong(const CueEntry &entry, Song *song); static QStringList SplitCueLine(const QString &line); static qint64 IndexToMarker(const QString &index); diff --git a/src/playlistparsers/m3uparser.h b/src/playlistparsers/m3uparser.h index f4a2f150..28d9cd73 100644 --- a/src/playlistparsers/m3uparser.h +++ b/src/playlistparsers/m3uparser.h @@ -66,7 +66,7 @@ class M3UParser : public ParserBase { qint64 length; }; - static bool ParseMetadata(const QString &line, Metadata *metadata) ; + static bool ParseMetadata(const QString &line, Metadata *metadata); }; diff --git a/src/playlistparsers/parserbase.h b/src/playlistparsers/parserbase.h index e9c949af..8d41ade2 100644 --- a/src/playlistparsers/parserbase.h +++ b/src/playlistparsers/parserbase.h @@ -67,7 +67,7 @@ class ParserBase : public QObject { // If the URL is a file:// URL then returns its path, absolute or relative to the directory depending on the path_type option. // Otherwise returns the URL as is. This function should always be used when saving a playlist. - static QString URLOrFilename(const QUrl &url, const QDir &dir, Playlist::Path path_type) ; + static QString URLOrFilename(const QUrl &url, const QDir &dir, Playlist::Path path_type); private: CollectionBackendInterface *collection_; diff --git a/src/playlistparsers/playlistparser.h b/src/playlistparsers/playlistparser.h index 477139c9..5e4534b6 100644 --- a/src/playlistparsers/playlistparser.h +++ b/src/playlistparsers/playlistparser.h @@ -61,7 +61,7 @@ class PlaylistParser : public QObject { void Save(const SongList &songs, const QString &filename, const Playlist::Path) const; private: - static QString FilterForParser(const ParserBase *parser, QStringList *all_extensions = nullptr) ; + static QString FilterForParser(const ParserBase *parser, QStringList *all_extensions = nullptr); private: QList parsers_; diff --git a/src/playlistparsers/wplparser.h b/src/playlistparsers/wplparser.h index 66844f37..78509e8e 100644 --- a/src/playlistparsers/wplparser.h +++ b/src/playlistparsers/wplparser.h @@ -39,7 +39,7 @@ class QXmlStreamWriter; class CollectionBackendInterface; class WplParser : public XMLParser { - Q_OBJECT + Q_OBJECT public: explicit WplParser(CollectionBackendInterface *collection, QObject *parent = nullptr); @@ -55,7 +55,7 @@ class WplParser : public XMLParser { private: void ParseSeq(const QDir &dir, QXmlStreamReader *reader, SongList *songs, const bool collection_search = true) const; - static void WriteMeta(const QString &name, const QString &content, QXmlStreamWriter *writer) ; + static void WriteMeta(const QString &name, const QString &content, QXmlStreamWriter *writer); }; #endif // WPLPARSER_H diff --git a/src/qobuz/qobuzfavoriterequest.cpp b/src/qobuz/qobuzfavoriterequest.cpp index 6bfde69d..31dee432 100644 --- a/src/qobuz/qobuzfavoriterequest.cpp +++ b/src/qobuz/qobuzfavoriterequest.cpp @@ -38,8 +38,8 @@ QobuzFavoriteRequest::QobuzFavoriteRequest(QobuzService *service, NetworkAccessManager *network, QObject *parent) : QobuzBaseRequest(service, network, parent), - service_(service), - network_(network) {} + service_(service), + network_(network) {} QobuzFavoriteRequest::~QobuzFavoriteRequest() { @@ -87,10 +87,10 @@ void QobuzFavoriteRequest::AddFavorites(const FavoriteType type, const SongList case FavoriteType_Artists: text = "artist_ids"; break; - case FavoriteType_Albums: + case FavoriteType_Albums: text = "album_ids"; break; - case FavoriteType_Songs: + case FavoriteType_Songs: text = "track_ids"; break; } @@ -103,11 +103,11 @@ void QobuzFavoriteRequest::AddFavorites(const FavoriteType type, const SongList if (song.artist_id().isEmpty()) continue; id = song.artist_id(); break; - case FavoriteType_Albums: + case FavoriteType_Albums: if (song.album_id().isEmpty()) continue; id = song.album_id(); break; - case FavoriteType_Songs: + case FavoriteType_Songs: if (song.song_id().isEmpty()) continue; id = song.song_id(); break; @@ -158,10 +158,10 @@ void QobuzFavoriteRequest::AddFavoritesReply(QNetworkReply *reply, const Favorit case FavoriteType_Artists: emit ArtistsAdded(songs); break; - case FavoriteType_Albums: + case FavoriteType_Albums: emit AlbumsAdded(songs); break; - case FavoriteType_Songs: + case FavoriteType_Songs: emit SongsAdded(songs); break; } @@ -189,10 +189,10 @@ void QobuzFavoriteRequest::RemoveFavorites(const FavoriteType type, const SongLi case FavoriteType_Artists: text = "artist_ids"; break; - case FavoriteType_Albums: + case FavoriteType_Albums: text = "album_ids"; break; - case FavoriteType_Songs: + case FavoriteType_Songs: text = "track_ids"; break; } @@ -205,11 +205,11 @@ void QobuzFavoriteRequest::RemoveFavorites(const FavoriteType type, const SongLi if (song.artist_id().isEmpty()) continue; id = song.artist_id(); break; - case FavoriteType_Albums: + case FavoriteType_Albums: if (song.album_id().isEmpty()) continue; id = song.album_id(); break; - case FavoriteType_Songs: + case FavoriteType_Songs: if (song.song_id().isEmpty()) continue; id = song.song_id(); break; @@ -259,10 +259,10 @@ void QobuzFavoriteRequest::RemoveFavoritesReply(QNetworkReply *reply, const Favo case FavoriteType_Artists: emit ArtistsRemoved(songs); break; - case FavoriteType_Albums: + case FavoriteType_Albums: emit AlbumsRemoved(songs); break; - case FavoriteType_Songs: + case FavoriteType_Songs: emit SongsRemoved(songs); break; } diff --git a/src/qobuz/qobuzrequest.cpp b/src/qobuz/qobuzrequest.cpp index 2f5a9e4e..479cbe22 100644 --- a/src/qobuz/qobuzrequest.cpp +++ b/src/qobuz/qobuzrequest.cpp @@ -1180,9 +1180,9 @@ void QobuzRequest::FlushAlbumCoverRequests() { QNetworkRequest req(request.url); #if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) - req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); + req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); #else - req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); + req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); #endif QNetworkReply *reply = network_->get(req); album_cover_replies_ << reply; diff --git a/src/qobuz/qobuzservice.cpp b/src/qobuz/qobuzservice.cpp index 45c68489..cfba8e27 100644 --- a/src/qobuz/qobuzservice.cpp +++ b/src/qobuz/qobuzservice.cpp @@ -668,7 +668,7 @@ void QobuzService::StartSearch() { search_id_ = pending_search_id_; search_text_ = pending_search_text_; - if (app_id_.isEmpty()) { // App ID is the only thing needed to search. + if (app_id_.isEmpty()) { // App ID is the only thing needed to search. emit SearchResults(search_id_, SongList(), tr("Missing Qobuz app ID.")); return; } diff --git a/src/queue/queueview.cpp b/src/queue/queueview.cpp index 31830d02..197aea60 100644 --- a/src/queue/queueview.cpp +++ b/src/queue/queueview.cpp @@ -143,7 +143,7 @@ void QueueView::MoveDown() { QModelIndexList indexes = ui_->list->selectionModel()->selectedRows(); std::stable_sort(indexes.begin(), indexes.end()); - if (indexes.isEmpty() || indexes.last().row() == current_playlist_->queue()->rowCount()-1) + if (indexes.isEmpty() || indexes.last().row() == current_playlist_->queue()->rowCount() - 1) return; for (int i = static_cast(indexes.count() - 1); i >= 0; --i) { diff --git a/src/radios/radiomodel.cpp b/src/radios/radiomodel.cpp index 2c1d69c2..991263bd 100644 --- a/src/radios/radiomodel.cpp +++ b/src/radios/radiomodel.cpp @@ -91,7 +91,7 @@ QVariant RadioModel::data(const QModelIndex &idx, int role) const { QVariant RadioModel::data(const RadioItem *item, int role) const { - switch(role) { + switch (role) { case Qt::DecorationRole: if (item->type == RadioItem::Type_Service) { return Song::IconForSource(item->source); diff --git a/src/radios/radioplaylistitem.cpp b/src/radios/radioplaylistitem.cpp index 57498369..8c929bd6 100644 --- a/src/radios/radioplaylistitem.cpp +++ b/src/radios/radioplaylistitem.cpp @@ -48,7 +48,7 @@ bool RadioPlaylistItem::InitFromQuery(const SqlRow &query) { } QVariant RadioPlaylistItem::DatabaseValue(DatabaseColumn column) const { - return PlaylistItem::DatabaseValue(column); + return PlaylistItem::DatabaseValue(column); } void RadioPlaylistItem::InitMetadata() { diff --git a/src/settings/appearancesettingspage.cpp b/src/settings/appearancesettingspage.cpp index 0f1381de..6b465900 100644 --- a/src/settings/appearancesettingspage.cpp +++ b/src/settings/appearancesettingspage.cpp @@ -74,7 +74,7 @@ const char *AppearanceSettingsPage::kOpacityLevel = "opacity_level"; const int AppearanceSettingsPage::kDefaultBlurRadius = 0; const int AppearanceSettingsPage::kDefaultOpacityLevel = 40; -const char *AppearanceSettingsPage::kTabBarSystemColor= "tab_system_color"; +const char *AppearanceSettingsPage::kTabBarSystemColor = "tab_system_color"; const char *AppearanceSettingsPage::kTabBarGradient = "tab_gradient"; const char *AppearanceSettingsPage::kTabBarColor = "tab_color"; @@ -164,9 +164,9 @@ void AppearanceSettingsPage::Load() { // Keep in mind originals colors, in case the user clicks on Cancel, to be able to restore colors original_use_a_custom_color_set_ = s.value(kUseCustomColorSet, false).toBool(); - original_foreground_color_ = s.value(kForegroundColor, p.color(QPalette::WindowText)).value(); + original_foreground_color_ = s.value(kForegroundColor, p.color(QPalette::WindowText)).value(); current_foreground_color_ = original_foreground_color_; - original_background_color_ = s.value(kBackgroundColor, p.color(QPalette::Window)).value(); + original_background_color_ = s.value(kBackgroundColor, p.color(QPalette::Window)).value(); current_background_color_ = original_background_color_; InitColorSelectorsColors(); @@ -289,7 +289,7 @@ void AppearanceSettingsPage::Save() { s.setValue(kBackgroundImageType, background_image_type_); if (background_image_type_ == BackgroundImageType_Custom) - s.setValue(kBackgroundImageFilename, background_image_filename_); + s.setValue(kBackgroundImageFilename, background_image_filename_); else s.remove(kBackgroundImageFilename); diff --git a/src/settings/appearancesettingspage.h b/src/settings/appearancesettingspage.h index e9f5d7fb..c6325ca5 100644 --- a/src/settings/appearancesettingspage.h +++ b/src/settings/appearancesettingspage.h @@ -133,4 +133,4 @@ class AppearanceSettingsPage : public SettingsPage { }; -#endif // APPEARANCESETTINGSPAGE_H +#endif // APPEARANCESETTINGSPAGE_H diff --git a/src/settings/backendsettingspage.cpp b/src/settings/backendsettingspage.cpp index bc251f47..24a975c0 100644 --- a/src/settings/backendsettingspage.cpp +++ b/src/settings/backendsettingspage.cpp @@ -294,7 +294,7 @@ void BackendSettingsPage::Load_Output(QString output, QVariant device) { break; } } - if (!found) { // Output is invalid for this engine, reset to default output. + if (!found) { // Output is invalid for this engine, reset to default output. output = engine()->DefaultOutput(); device = (engine()->CustomDeviceSupport(output) ? QString() : QVariant()); for (int i = 0; i < ui_->combobox_output->count(); ++i) { @@ -492,7 +492,7 @@ void BackendSettingsPage::Save() { void BackendSettingsPage::Cancel() { - if (engine() && engine()->type() != enginetype_current_) { // Reset engine back to the original because user cancelled. + if (engine() && engine()->type() != enginetype_current_) { // Reset engine back to the original because user cancelled. dialog()->app()->player()->CreateEngine(enginetype_current_); dialog()->app()->player()->Init(); } diff --git a/src/settings/backendsettingspage.h b/src/settings/backendsettingspage.h index d7006e24..27c33f96 100644 --- a/src/settings/backendsettingspage.h +++ b/src/settings/backendsettingspage.h @@ -40,7 +40,7 @@ class Ui_BackendSettingsPage; class BackendSettingsPage : public SettingsPage { Q_OBJECT -public: + public: explicit BackendSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr); ~BackendSettingsPage() override; diff --git a/src/settings/behavioursettingspage.h b/src/settings/behavioursettingspage.h index ccfc8263..fd60fa99 100644 --- a/src/settings/behavioursettingspage.h +++ b/src/settings/behavioursettingspage.h @@ -36,7 +36,7 @@ class Ui_BehaviourSettingsPage; class BehaviourSettingsPage : public SettingsPage { Q_OBJECT -public: + public: explicit BehaviourSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr); ~BehaviourSettingsPage() override; diff --git a/src/settings/contextsettingspage.h b/src/settings/contextsettingspage.h index 17f5c63b..ca49dbe0 100644 --- a/src/settings/contextsettingspage.h +++ b/src/settings/contextsettingspage.h @@ -38,7 +38,7 @@ class Ui_ContextSettingsPage; class ContextSettingsPage : public SettingsPage { Q_OBJECT -public: + public: explicit ContextSettingsPage(SettingsDialog *dialog, QWidget *parent = nullptr); ~ContextSettingsPage() override; diff --git a/src/settings/notificationssettingspage.cpp b/src/settings/notificationssettingspage.cpp index 587119b6..e9619762 100644 --- a/src/settings/notificationssettingspage.cpp +++ b/src/settings/notificationssettingspage.cpp @@ -153,7 +153,7 @@ void NotificationsSettingsPage::Load() { ui_->notifications_native->setChecked(true); break; } - // Fallthrough + // Fallthrough case OSDBase::Pretty: ui_->notifications_pretty->setChecked(true); @@ -164,7 +164,7 @@ void NotificationsSettingsPage::Load() { ui_->notifications_tray->setChecked(true); break; } - // Fallthrough + // Fallthrough case OSDBase::Disabled: default: diff --git a/src/smartplaylists/smartplaylistquerywizardplugin.cpp b/src/smartplaylists/smartplaylistquerywizardplugin.cpp index c9694b27..e8388953 100644 --- a/src/smartplaylists/smartplaylistquerywizardplugin.cpp +++ b/src/smartplaylists/smartplaylistquerywizardplugin.cpp @@ -57,7 +57,7 @@ class SmartPlaylistQueryWizardPlugin::SearchPage : public QWizardPage { // claz return true; } - if (std::any_of(terms_.begin(), terms_.end(), [](SmartPlaylistSearchTermWidget *widget){ return !widget->Term().is_valid(); })) { + if (std::any_of(terms_.begin(), terms_.end(), [](SmartPlaylistSearchTermWidget *widget) { return !widget->Term().is_valid(); })) { return false; } diff --git a/src/smartplaylists/smartplaylistsearchtermwidget.cpp b/src/smartplaylists/smartplaylistsearchtermwidget.cpp index 616dbd77..14e4066c 100644 --- a/src/smartplaylists/smartplaylistsearchtermwidget.cpp +++ b/src/smartplaylists/smartplaylistsearchtermwidget.cpp @@ -155,9 +155,7 @@ void SmartPlaylistSearchTermWidget::FieldChanged(int index) { // Show the correct value editor QWidget *page = nullptr; - SmartPlaylistSearchTerm::Operator op = static_cast( - ui_->op->itemData(ui_->op->currentIndex()).toInt() - ); + SmartPlaylistSearchTerm::Operator op = static_cast(ui_->op->itemData(ui_->op->currentIndex()).toInt()); switch (type) { case SmartPlaylistSearchTerm::Type_Time: page = ui_->page_time; @@ -210,8 +208,7 @@ void SmartPlaylistSearchTermWidget::OpChanged(int idx) { // Determine the currently selected operator SmartPlaylistSearchTerm::Operator op = static_cast( // This uses the operators’s index in the combobox to get its enum value - ui_->op->itemData(ui_->op->currentIndex()).toInt() - ); + ui_->op->itemData(ui_->op->currentIndex()).toInt()); // We need to change the page only in the following case if ((ui_->value_stack->currentWidget() == ui_->page_text) || (ui_->value_stack->currentWidget() == ui_->page_empty)) { @@ -327,7 +324,8 @@ void SmartPlaylistSearchTermWidget::SetTerm(const SmartPlaylistSearchTerm &term) case SmartPlaylistSearchTerm::Type_Text: if (ui_->value_stack->currentWidget() == ui_->page_empty) { ui_->value_text->setText(""); - } else { + } + else { ui_->value_text->setText(term.value_.toString()); } break; diff --git a/src/smartplaylists/smartplaylistwizard.cpp b/src/smartplaylists/smartplaylistwizard.cpp index b9982c25..86d434e9 100644 --- a/src/smartplaylists/smartplaylistwizard.cpp +++ b/src/smartplaylists/smartplaylistwizard.cpp @@ -139,7 +139,7 @@ void SmartPlaylistWizard::AddPlugin(SmartPlaylistWizardPlugin *plugin) { type_page_->layout()->addWidget(radio_button); type_page_->layout()->addWidget(description); - QObject::connect(radio_button, &QRadioButton::clicked, [this, index]() { TypeChanged(index); } ); + QObject::connect(radio_button, &QRadioButton::clicked, [this, index]() { TypeChanged(index); }); if (index == 0) { radio_button->setChecked(true); diff --git a/src/subsonic/subsonicrequest.cpp b/src/subsonic/subsonicrequest.cpp index 575f409c..8608eca7 100644 --- a/src/subsonic/subsonicrequest.cpp +++ b/src/subsonic/subsonicrequest.cpp @@ -307,9 +307,8 @@ void SubsonicRequest::AlbumsFinishCheck(const int offset, const int albums_recei if (albums_requests_queue_.isEmpty() && albums_requests_active_ <= 0) { // Albums list is finished, get songs for all albums. - QHash ::iterator i; - for (i = album_songs_requests_pending_.begin() ; i != album_songs_requests_pending_.end() ; ++i) { - Request request = i.value(); + for (QHash ::iterator it = album_songs_requests_pending_.begin() ; it != album_songs_requests_pending_.end() ; ++it) { + Request request = it.value(); AddAlbumSongsRequest(request.artist_id, request.album_id, request.album_artist); } album_songs_requests_pending_.clear(); diff --git a/src/tidal/tidalbaserequest.cpp b/src/tidal/tidalbaserequest.cpp index 8a553081..5cd2eb84 100644 --- a/src/tidal/tidalbaserequest.cpp +++ b/src/tidal/tidalbaserequest.cpp @@ -40,8 +40,8 @@ #include "tidalservice.h" #include "tidalbaserequest.h" -TidalBaseRequest::TidalBaseRequest(TidalService *service, NetworkAccessManager *network, QObject *parent) : - QObject(parent), +TidalBaseRequest::TidalBaseRequest(TidalService *service, NetworkAccessManager *network, QObject *parent) + : QObject(parent), service_(service), network_(network) {} @@ -171,7 +171,7 @@ QJsonObject TidalBaseRequest::ExtractJsonObj(const QByteArray &data) { QJsonObject json_obj = json_doc.object(); if (json_obj.isEmpty()) { - Error("Received empty Json object.", json_doc); + Error("Received empty Json object.", json_doc); return QJsonObject(); } diff --git a/src/tidal/tidalfavoriterequest.cpp b/src/tidal/tidalfavoriterequest.cpp index 5b472e78..9c6ee1ef 100644 --- a/src/tidal/tidalfavoriterequest.cpp +++ b/src/tidal/tidalfavoriterequest.cpp @@ -93,10 +93,10 @@ void TidalFavoriteRequest::AddFavorites(const FavoriteType type, const SongList case FavoriteType_Artists: text = "artistIds"; break; - case FavoriteType_Albums: + case FavoriteType_Albums: text = "albumIds"; break; - case FavoriteType_Songs: + case FavoriteType_Songs: text = "trackIds"; break; } @@ -109,11 +109,11 @@ void TidalFavoriteRequest::AddFavorites(const FavoriteType type, const SongList if (song.artist_id().isEmpty()) continue; id = song.artist_id(); break; - case FavoriteType_Albums: + case FavoriteType_Albums: if (song.album_id().isEmpty()) continue; id = song.album_id(); break; - case FavoriteType_Songs: + case FavoriteType_Songs: if (song.song_id().isEmpty()) continue; id = song.song_id(); break; @@ -175,10 +175,10 @@ void TidalFavoriteRequest::AddFavoritesReply(QNetworkReply *reply, const Favorit case FavoriteType_Artists: emit ArtistsAdded(songs); break; - case FavoriteType_Albums: + case FavoriteType_Albums: emit AlbumsAdded(songs); break; - case FavoriteType_Songs: + case FavoriteType_Songs: emit SongsAdded(songs); break; } @@ -210,11 +210,11 @@ void TidalFavoriteRequest::RemoveFavorites(const FavoriteType type, const SongLi if (song.artist_id().isEmpty()) continue; id = song.artist_id(); break; - case FavoriteType_Albums: + case FavoriteType_Albums: if (song.album_id().isEmpty()) continue; id = song.album_id(); break; - case FavoriteType_Songs: + case FavoriteType_Songs: if (song.song_id().isEmpty()) continue; id = song.song_id(); break; @@ -280,10 +280,10 @@ void TidalFavoriteRequest::RemoveFavoritesReply(QNetworkReply *reply, const Favo case FavoriteType_Artists: emit ArtistsRemoved(songs); break; - case FavoriteType_Albums: + case FavoriteType_Albums: emit AlbumsRemoved(songs); break; - case FavoriteType_Songs: + case FavoriteType_Songs: emit SongsRemoved(songs); break; } diff --git a/src/tidal/tidalrequest.cpp b/src/tidal/tidalrequest.cpp index dc86ba12..c82002df 100644 --- a/src/tidal/tidalrequest.cpp +++ b/src/tidal/tidalrequest.cpp @@ -728,9 +728,8 @@ void TidalRequest::AlbumsFinishCheck(const QString &artist_id, const int limit, // Get songs for all the albums. - QHash ::iterator i; - for (i = album_songs_requests_pending_.begin() ; i != album_songs_requests_pending_.end() ; ++i) { - Request request = i.value(); + for (QHash ::iterator it = album_songs_requests_pending_.begin() ; it != album_songs_requests_pending_.end() ; ++it) { + Request request = it.value(); AddAlbumSongsRequest(request.artist_id, request.album_id, request.album_artist, request.album, request.album_explicit); } album_songs_requests_pending_.clear(); @@ -1060,7 +1059,7 @@ QString TidalRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Q } cover = cover.replace("-", "/"); - QUrl cover_url (QString("%1/images/%2/%3.jpg").arg(kResourcesUrl, cover, coversize_)); + QUrl cover_url(QString("%1/images/%2/%3.jpg").arg(kResourcesUrl, cover, coversize_)); title.remove(Song::kTitleRemoveMisc); @@ -1171,7 +1170,7 @@ void TidalRequest::AlbumCoverReceived(QNetworkReply *reply, const QString &album } if (reply->error() != QNetworkReply::NoError) { - Error(QString("%1 (%2)").arg(reply->errorString()).arg(reply->error())); + Error(QString("%1 (%2)").arg(reply->errorString()).arg(reply->error())); album_covers_requests_sent_.remove(album_id); AlbumCoverFinishCheck(); return; diff --git a/src/tidal/tidalservice.cpp b/src/tidal/tidalservice.cpp index 72266602..d0b29aa3 100644 --- a/src/tidal/tidalservice.cpp +++ b/src/tidal/tidalservice.cpp @@ -638,7 +638,7 @@ void TidalService::HandleAuthReply(QNetworkReply *reply) { return; } - if (!json_obj.contains("userId") || !json_obj.contains("sessionId") || !json_obj.contains("countryCode") ) { + if (!json_obj.contains("userId") || !json_obj.contains("sessionId") || !json_obj.contains("countryCode")) { LoginError("Authentication reply from server is missing userId, sessionId or countryCode", json_obj); return; } diff --git a/src/tidal/tidalstreamurlrequest.cpp b/src/tidal/tidalstreamurlrequest.cpp index 05aea183..95e87683 100644 --- a/src/tidal/tidalstreamurlrequest.cpp +++ b/src/tidal/tidalstreamurlrequest.cpp @@ -214,14 +214,15 @@ void TidalStreamURLRequest::StreamURLReceived() { QString filepath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/tidalstreams"; QString filename = "tidal-" + QString::number(song_id_) + ".xml"; if (!QDir().mkpath(filepath)) { - Error(QString("Failed to create directory %1.").arg(filepath), json_obj); + Error(QString("Failed to create directory %1.").arg(filepath), json_obj); emit StreamURLFinished(id_, original_url_, original_url_, Song::FileType_Stream, -1, -1, -1, errors_.first()); return; } QUrl url("file://" + filepath + "/" + filename); QFile file(url.toLocalFile()); - if (file.exists()) - file.remove(); + if (file.exists()) { + file.remove(); + } if (!file.open(QIODevice::WriteOnly)) { Error(QString("Failed to open file %1 for writing.").arg(url.toLocalFile()), json_obj); emit StreamURLFinished(id_, original_url_, original_url_, Song::FileType_Stream, -1, -1, -1, errors_.first()); diff --git a/src/transcoder/transcodedialog.cpp b/src/transcoder/transcodedialog.cpp index e576eb3c..ee5bb109 100644 --- a/src/transcoder/transcodedialog.cpp +++ b/src/transcoder/transcodedialog.cpp @@ -68,7 +68,7 @@ // winspool.h defines this :( #ifdef AddJob -#undef AddJob +# undef AddJob #endif const char *TranscodeDialog::kSettingsGroup = "Transcoder"; diff --git a/src/transcoder/transcodedialog.h b/src/transcoder/transcodedialog.h index 761669a6..0eee9eec 100644 --- a/src/transcoder/transcodedialog.h +++ b/src/transcoder/transcodedialog.h @@ -65,7 +65,7 @@ class TranscodeDialog : public QDialog { void SetWorking(bool working); void UpdateStatusText(); void UpdateProgress(); - static QString TrimPath(const QString &path) ; + static QString TrimPath(const QString &path); QString GetOutputFileName(const QString &input, const TranscoderPreset &preset) const; private slots: diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index 11e6bf91..72299f58 100644 --- a/src/transcoder/transcoder.cpp +++ b/src/transcoder/transcoder.cpp @@ -199,8 +199,8 @@ void Transcoder::JobState::PostFinished(const bool success) { Transcoder::Transcoder(QObject *parent, const QString &settings_postfix) : QObject(parent), - max_threads_(QThread::idealThreadCount()), - settings_postfix_(settings_postfix) { + max_threads_(QThread::idealThreadCount()), + settings_postfix_(settings_postfix) { if (JobFinishedEvent::sEventType == -1) JobFinishedEvent::sEventType = QEvent::registerEventType(); @@ -295,7 +295,7 @@ QString Transcoder::GetFile(const QString &input, const TranscoderPreset &preset QString temp_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/transcoder"; if (!QDir(temp_dir).exists()) QDir().mkpath(temp_dir); QString filename = fileinfo_input.completeBaseName() + "." + preset.extension_; - fileinfo_output.setFile(temp_dir + "/" + filename); + fileinfo_output.setFile(temp_dir + "/" + filename); } // Never overwrite existing files diff --git a/src/transcoder/transcoderoptionsaac.h b/src/transcoder/transcoderoptionsaac.h index f0892a98..e8801661 100644 --- a/src/transcoder/transcoderoptionsaac.h +++ b/src/transcoder/transcoderoptionsaac.h @@ -39,7 +39,7 @@ class TranscoderOptionsAAC : public TranscoderOptionsInterface { void Load() override; void Save() override; -private: + private: static const char *kSettingsGroup; Ui_TranscoderOptionsAAC *ui_; diff --git a/src/transcoder/transcoderoptionsasf.h b/src/transcoder/transcoderoptionsasf.h index fda1e1b1..4e297ba9 100644 --- a/src/transcoder/transcoderoptionsasf.h +++ b/src/transcoder/transcoderoptionsasf.h @@ -39,7 +39,7 @@ class TranscoderOptionsASF : public TranscoderOptionsInterface { void Load() override; void Save() override; -private: + private: static const char *kSettingsGroup; Ui_TranscoderOptionsASF *ui_; diff --git a/src/widgets/fancytabwidget.cpp b/src/widgets/fancytabwidget.cpp index 72d180f4..e37d8ee6 100644 --- a/src/widgets/fancytabwidget.cpp +++ b/src/widgets/fancytabwidget.cpp @@ -70,7 +70,7 @@ const int FancyTabWidget::IconSize_LargeSidebar = 40; const int FancyTabWidget::IconSize_SmallSidebar = 32; const int FancyTabWidget::TabSize_LargeSidebarMinWidth = 70; -class FancyTabBar: public QTabBar { // clazy:exclude=missing-qobject-macro +class FancyTabBar : public QTabBar { // clazy:exclude=missing-qobject-macro private: int mouseHoverTabIndex = -1; @@ -345,13 +345,13 @@ class FancyTabBar: public QTabBar { // clazy:exclude=missing-qobject-macro class TabData : public QObject { // clazy:exclude=missing-qobject-macro public: - TabData(QWidget *widget_view, const QString &name, const QIcon &icon, const QString &label, const int idx, QWidget *parent) : - QObject(parent), - widget_view_(widget_view), - name_(name), icon_(icon), - label_(label), - index_(idx), - page_(new QWidget()) { + TabData(QWidget *widget_view, const QString &name, const QIcon &icon, const QString &label, const int idx, QWidget *parent) + : QObject(parent), + widget_view_(widget_view), + name_(name), icon_(icon), + label_(label), + index_(idx), + page_(new QWidget()) { // In order to achieve the same effect as the "Bottom Widget" of the old Nokia based FancyTabWidget a VBoxLayout is used on each page QVBoxLayout *layout = new QVBoxLayout(page_); layout->setSpacing(0); @@ -646,7 +646,7 @@ void FancyTabWidget::paintEvent(QPaintEvent *pe) { // Shadow effect of the background QColor light(255, 255, 255, 80); p.setPen(light); - p.drawLine(backgroundRect.topRight() - QPoint(1, 0), backgroundRect.bottomRight() - QPoint(1, 0)); + p.drawLine(backgroundRect.topRight() - QPoint(1, 0), backgroundRect.bottomRight() - QPoint(1, 0)); QColor dark(0, 0, 0, 90); p.setPen(dark); p.drawLine(backgroundRect.topLeft(), backgroundRect.bottomLeft()); @@ -672,7 +672,7 @@ void FancyTabWidget::SetMode(FancyTabWidget::Mode mode) { mode_ = mode; - if (mode == FancyTabWidget::Mode_Tabs || mode == FancyTabWidget::Mode_IconOnlyTabs) { + if (mode == FancyTabWidget::Mode_Tabs || mode == FancyTabWidget::Mode_IconOnlyTabs) { setTabPosition(QTabWidget::North); } else { @@ -702,7 +702,7 @@ void FancyTabWidget::addMenuItem(QActionGroup *group, const QString &text, Mode QAction *action = group->addAction(text); action->setCheckable(true); - QObject::connect(action, &QAction::triggered, [this, mode]() { SetMode(mode); } ); + QObject::connect(action, &QAction::triggered, [this, mode]() { SetMode(mode); }); if (mode == mode_) action->setChecked(true); diff --git a/src/widgets/fancytabwidget.h b/src/widgets/fancytabwidget.h index 03b82ffc..4e4e999a 100644 --- a/src/widgets/fancytabwidget.h +++ b/src/widgets/fancytabwidget.h @@ -64,7 +64,7 @@ class FancyTabWidget : public QTabWidget { void SaveSettings(const QString &kSettingsGroup); void ReloadSettings(); - // Values are persisted - only add to the end + // Values are persisted - only add to the end enum Mode { Mode_None = 0, Mode_LargeSidebar, diff --git a/src/widgets/fileview.cpp b/src/widgets/fileview.cpp index 4f91c909..331f2ea1 100644 --- a/src/widgets/fileview.cpp +++ b/src/widgets/fileview.cpp @@ -130,7 +130,7 @@ void FileView::FileUp() { // Is this the same as going back? If so just go back, so we can keep the view scroll position. if (undo_stack_->canUndo()) { - const UndoCommand *last_dir = static_cast(undo_stack_->command(undo_stack_->index()-1)); + const UndoCommand *last_dir = static_cast(undo_stack_->command(undo_stack_->index() - 1)); if (last_dir->undo_path() == dir.path()) { undo_stack_->undo(); return; @@ -195,8 +195,7 @@ void FileView::ItemDoubleClick(const QModelIndex &idx) { } -FileView::UndoCommand::UndoCommand(FileView *view, const QString &new_path) - : view_(view) { +FileView::UndoCommand::UndoCommand(FileView *view, const QString &new_path) : view_(view) { old_state_.path = view->model_->rootPath(); old_state_.scroll_pos = view_->ui_->list->verticalScrollBar()->value(); diff --git a/src/widgets/groupediconview.cpp b/src/widgets/groupediconview.cpp index a1b1f770..130c5de3 100644 --- a/src/widgets/groupediconview.cpp +++ b/src/widgets/groupediconview.cpp @@ -185,7 +185,8 @@ void GroupedIconView::LayoutItems() { QPoint this_position(next_position); if (this_position.x() == 0) { this_position.setX(this_position.x() + item_indent_); - } else { + } + else { this_position.setX(this_position.x() + spacing()); } diff --git a/src/widgets/lineedit.cpp b/src/widgets/lineedit.cpp index 4990bc60..e3ee8ec3 100644 --- a/src/widgets/lineedit.cpp +++ b/src/widgets/lineedit.cpp @@ -140,7 +140,7 @@ void ExtendedEditor::Paint(QPaintDevice *device) { p.setPen(widget_->palette().color(QPalette::Disabled, QPalette::Text)); p.setFont(font); - QRect r(5, kBorder, device->width() - 10, device->height() - kBorder*2); + QRect r(5, kBorder, device->width() - 10, device->height() - kBorder * 2); p.drawText(r, Qt::AlignLeft | Qt::AlignVCenter, m.elidedText(hint_, Qt::ElideRight, r.width())); } } @@ -219,9 +219,10 @@ void TextEdit::resizeEvent(QResizeEvent *e) { SpinBox::SpinBox(QWidget *parent) : QSpinBox(parent), - ExtendedEditor(this, 14, false) -{ + ExtendedEditor(this, 14, false) { + QObject::connect(reset_button_, &QToolButton::clicked, this, &SpinBox::Reset); + } void SpinBox::paintEvent(QPaintEvent *e) { diff --git a/src/widgets/playingwidget.cpp b/src/widgets/playingwidget.cpp index 78b70c3e..b6d7ddc0 100644 --- a/src/widgets/playingwidget.cpp +++ b/src/widgets/playingwidget.cpp @@ -216,7 +216,7 @@ void PlayingWidget::CreateModeAction(const Mode mode, const QString &text, QActi QAction *action = new QAction(text, group); action->setCheckable(true); - QObject::connect(action, &QAction::triggered, [this, mode]() { SetMode(mode); } ); + QObject::connect(action, &QAction::triggered, [this, mode]() { SetMode(mode); }); if (mode == mode_) action->setChecked(true); diff --git a/src/widgets/qsearchfield.h b/src/widgets/qsearchfield.h index 8ff7c9a1..265e76db 100644 --- a/src/widgets/qsearchfield.h +++ b/src/widgets/qsearchfield.h @@ -43,7 +43,7 @@ class QSearchField : public QWidget { private: friend class QSearchFieldPrivate; - QPointer pimpl; + QPointer pimpl; }; -#endif // QSEARCHFIELD_H +#endif // QSEARCHFIELD_H diff --git a/src/widgets/qsearchfield_nonmac.cpp b/src/widgets/qsearchfield_nonmac.cpp index a597a984..6a7d50e0 100644 --- a/src/widgets/qsearchfield_nonmac.cpp +++ b/src/widgets/qsearchfield_nonmac.cpp @@ -180,7 +180,7 @@ void QSearchField::resizeEvent(QResizeEvent *resizeEvent) { QWidget::resizeEvent(resizeEvent); const int x = pimpl->lineEditFrameWidth(); - const int y = (height() - pimpl->clearbutton_->height())/2; + const int y = (height() - pimpl->clearbutton_->height()) / 2; pimpl->clearbutton_->move(x, y); } diff --git a/src/widgets/stretchheaderview.cpp b/src/widgets/stretchheaderview.cpp index 2eb2c199..b1f9c3fd 100644 --- a/src/widgets/stretchheaderview.cpp +++ b/src/widgets/stretchheaderview.cpp @@ -149,7 +149,7 @@ void StretchHeaderView::ShowSection(int logical) { int visible_count = 0; for (int i = 0 ; i < count() ; ++i) { if (!isSectionHidden(i)) - visible_count ++; + ++visible_count; } column_widths_[logical] = visible_count == 0 ? 1.0 : 1.0 / visible_count; diff --git a/src/widgets/trackslider.cpp b/src/widgets/trackslider.cpp index 1a5e8e0f..6bcd89e8 100644 --- a/src/widgets/trackslider.cpp +++ b/src/widgets/trackslider.cpp @@ -120,7 +120,7 @@ QSize TrackSlider::sizeHint() const { void TrackSlider::SetValue(const int elapsed, const int total) { - setting_value_ = true; // This is so we don't emit from QAbstractSlider::valueChanged + setting_value_ = true; // This is so we don't emit from QAbstractSlider::valueChanged ui_->slider->setMaximum(total); if (!ui_->slider->isSliderDown()) { ui_->slider->setValue(elapsed); diff --git a/src/widgets/trackslider.h b/src/widgets/trackslider.h index d532b2d3..9c3947e0 100644 --- a/src/widgets/trackslider.h +++ b/src/widgets/trackslider.h @@ -91,7 +91,7 @@ class TrackSlider : public QWidget { bool setting_value_; bool show_remaining_time_; - int slider_maximum_value_; //we cache it to avoid unnecessary updates + int slider_maximum_value_; // We cache it to avoid unnecessary updates }; #endif // TRACKSLIDER_H diff --git a/src/widgets/tracksliderslider.cpp b/src/widgets/tracksliderslider.cpp index 3ee735cf..d096603f 100644 --- a/src/widgets/tracksliderslider.cpp +++ b/src/widgets/tracksliderslider.cpp @@ -30,7 +30,7 @@ #include #include #include -# include +#include #include "core/timeconstants.h" #include "core/utilities.h"