Formatting

This commit is contained in:
Jonas Kvinge 2021-07-11 09:49:38 +02:00
parent a6742d401c
commit e48b7d83a3
161 changed files with 370 additions and 369 deletions

View File

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

View File

@ -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<void**>(&callstack), sizeof(callstack));
char** symbols = backtrace_symbols(reinterpret_cast<void**>(&callstack), callstack_size);
char **symbols = backtrace_symbols(reinterpret_cast<void**>(&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<LoggedDebug>(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 <typename T>
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());
}

View File

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

View File

@ -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<QUrl> &_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<QUrl> &_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;

View File

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

View File

@ -76,8 +76,8 @@ const char *CollectionModel::kPixmapDiskCacheDir = "pixmapcache";
QNetworkDiskCache *CollectionModel::sIconCache = nullptr;
CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, QObject *parent) :
SimpleTreeModel<CollectionItem>(new CollectionItem(this), parent),
CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, QObject *parent)
: SimpleTreeModel<CollectionItem>(new CollectionItem(this), parent),
backend_(backend),
app_(app),
dir_model_(new CollectionDirectoryModel(backend, this)),

View File

@ -270,7 +270,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
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_;

View File

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

View File

@ -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<int, Directory> watched_dirs_;
QTimer *rescan_timer_;
QTimer *periodic_scan_timer_;
QMap<int, QStringList> rescan_queue_; // dir id -> list of subdirs to be scanned
QMap<int, QStringList> 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_;

View File

@ -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<Subdirectory> SubdirectoryList;
Q_DECLARE_METATYPE(SubdirectoryList)
#endif // DIRECTORY_H
#endif // DIRECTORY_H

View File

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

View File

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

View File

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

View File

@ -43,4 +43,4 @@ class FilesystemMusicStorage : public virtual MusicStorage {
Q_DISABLE_COPY(FilesystemMusicStorage)
};
#endif // FILESYSTEMMUSICSTORAGE_H
#endif // FILESYSTEMMUSICSTORAGE_H

View File

@ -26,7 +26,7 @@
#include "qtfslistener.h"
#ifdef Q_OS_MACOS
#include "macfslistener.h"
# include "macfslistener.h"
#endif
FileSystemWatcherInterface::FileSystemWatcherInterface(QObject *parent)

View File

@ -62,8 +62,12 @@ QIcon IconLoader::Load(const QString &name, const int fixed_size, const int min_
}
QList<int> 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;

View File

@ -134,4 +134,4 @@ static const QMap<QString, IconProperties> iconmapper_ = { // clazy:exclude=non
};
} // namespace
} // namespace IconMapper

View File

@ -36,7 +36,8 @@ namespace mac {
QKeySequence KeySequenceFromNSEvent(NSEvent *event);
void DumpDictionary(CFDictionaryRef dict);
}
} // namespace mac
namespace Utilities {
qint32 GetMacOsVersion();

View File

@ -609,8 +609,8 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> 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<SystemTrayIcon> 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<Engine::State> (s.value("playback_state", Engine::Empty).toInt());
Engine::State playback_state = static_cast<Engine::State>(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<Engine::State> (s.value("playback_state", Engine::Empty).toInt());
Engine::State playback_state = static_cast<Engine::State>(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<int>()<< idx.row());
app_->playlist_manager()->current()->ReloadItems(QList<int>() << 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:") + "<ul>";
for(const QString &reason : reasons) {
for (const QString &reason : reasons) {
message += ("<li>" + reason + "</li>");
}
message += "</ul>" + 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));

View File

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

View File

@ -84,7 +84,7 @@ void RegisterMetaTypes() {
qRegisterMetaType<QAbstractSocket::SocketState>();
qRegisterMetaType<QAbstractSocket::SocketState>("QAbstractSocket::SocketState");
qRegisterMetaType<QNetworkCookie>("QNetworkCookie");
qRegisterMetaType<QList<QNetworkCookie> >("QList<QNetworkCookie>");
qRegisterMetaType<QList<QNetworkCookie>>("QList<QNetworkCookie>");
qRegisterMetaType<QNetworkReply*>("QNetworkReply*");
qRegisterMetaType<QNetworkReply**>("QNetworkReply**");
qRegisterMetaType<QItemSelection>("QItemSelection");
@ -99,7 +99,7 @@ void RegisterMetaTypes() {
qRegisterMetaType<Subdirectory>("Subdirectory");
qRegisterMetaType<SubdirectoryList>("SubdirectoryList");
qRegisterMetaType<Song>("Song");
qRegisterMetaType<QList<Song> >("QList<Song>");
qRegisterMetaType<QList<Song>>("QList<Song>");
qRegisterMetaType<SongList>("SongList");
qRegisterMetaType<Engine::EngineType>("EngineType");
qRegisterMetaType<Engine::SimpleMetaBundle>("Engine::SimpleMetaBundle");
@ -113,14 +113,14 @@ void RegisterMetaTypes() {
#endif
qRegisterMetaType<PlaylistItemList>("PlaylistItemList");
qRegisterMetaType<PlaylistItemPtr>("PlaylistItemPtr");
qRegisterMetaType<QList<PlaylistItemPtr> >("QList<PlaylistItemPtr>");
qRegisterMetaType<QList<PlaylistItemPtr>>("QList<PlaylistItemPtr>");
qRegisterMetaType<PlaylistSequence::RepeatMode>("PlaylistSequence::RepeatMode");
qRegisterMetaType<PlaylistSequence::ShuffleMode>("PlaylistSequence::ShuffleMode");
qRegisterMetaType<AlbumCoverLoaderResult>("AlbumCoverLoaderResult");
qRegisterMetaType<AlbumCoverLoaderResult::Type>("AlbumCoverLoaderResult::Type");
qRegisterMetaType<CoverProviderSearchResult>("CoverProviderSearchResult");
qRegisterMetaType<CoverSearchStatistics>("CoverSearchStatistics");
qRegisterMetaType<QList<CoverProviderSearchResult> >("QList<CoverProviderSearchResult>");
qRegisterMetaType<QList<CoverProviderSearchResult>>("QList<CoverProviderSearchResult>");
qRegisterMetaType<CoverProviderSearchResults>("CoverProviderSearchResults");
qRegisterMetaType<Equalizer::Params>("Equalizer::Params");
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

View File

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

View File

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

View File

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

View File

@ -56,7 +56,7 @@ bool MultiSortFilterProxy::lessThan(const QModelIndex &left, const QModelIndex &
}
template <typename T>
template<typename T>
static inline int DoCompare(T left, T right) {
if (left < right) return -1;

View File

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

View File

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

View File

@ -391,7 +391,7 @@ class Song {
private:
struct Private;
static QString sortable(const QString &v) ;
static QString sortable(const QString &v);
QSharedDataPointer<Private> d;
};

View File

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

View File

@ -80,7 +80,7 @@ void StandardItemIconLoader::RowsAboutToBeRemoved(const QModelIndex &parent, int
it = pending_covers_.erase(it); // clazy:exclude=strict-iterators
}
else {
++ it;
++it;
}
}

View File

@ -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.height(); ++y) {
for (int y = 0; y < im.height(); ++y) {
auto scanLine = reinterpret_cast<QRgb*>(im.scanLine(y));
for (int x=0; x<im.width(); ++x) {
QRgb pixel = *scanLine;

View File

@ -35,7 +35,7 @@ class QTimer;
class QEvent;
class StyleSheetLoader : public QObject {
Q_OBJECT
Q_OBJECT
public:
explicit StyleSheetLoader(QObject *parent = nullptr);

View File

@ -35,7 +35,7 @@ class QIODevice;
class QNetworkDiskCache;
class ThreadSafeNetworkDiskCache : public QAbstractNetworkCache {
Q_OBJECT
Q_OBJECT
public:
explicit ThreadSafeNetworkDiskCache(QObject *parent);

View File

@ -220,7 +220,7 @@ quint64 FileSystemCapacity(const QString &path) {
quint64 FileSystemFreeSpace(const QString &path) {
#if defined(Q_OS_UNIX)
struct statvfs fs_info{};
struct statvfs fs_info {};
if (statvfs(path.toLocal8Bit().constData(), &fs_info) == 0)
return quint64(fs_info.f_bavail) * quint64(fs_info.f_bsize);
#elif defined(Q_OS_WIN32)
@ -447,11 +447,11 @@ void OpenInFileBrowser(const QList<QUrl> &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) {

View File

@ -148,7 +148,7 @@ QString MimeTypeFromData(const QByteArray &data);
void enableBlurBehindWindow(QWindow *window, const QRegion &region);
#endif
} // namespace
} // namespace Utilities
class ScopedWCharArray {
public:

View File

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

View File

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

View File

@ -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<QUrl> &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;
}

View File

@ -52,7 +52,7 @@ class Application;
class Ui_AlbumCoverSearcher;
class SizeOverlayDelegate : public QStyledItemDelegate {
Q_OBJECT
Q_OBJECT
public:
static const int kMargin;

View File

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

View File

@ -85,4 +85,4 @@ class CoverProvider : public QObject {
};
#endif // COVERPROVIDER_H
#endif // COVERPROVIDER_H

View File

@ -49,4 +49,4 @@ struct CoverSearchStatistics {
};
#endif // COVERSEARCHSTATISTICS_H
#endif // COVERSEARCHSTATISTICS_H

View File

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

View File

@ -334,7 +334,7 @@ void DiscogsCoverProvider::StartReleaseRequest(std::shared_ptr<DiscogsCoverSearc
void DiscogsCoverProvider::SendReleaseRequest(const DiscogsCoverReleaseContext &release) {
QNetworkReply *reply = CreateRequest(release.url);
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, release]() { HandleReleaseReply(reply, release.search_id, release.id); } );
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, release]() { HandleReleaseReply(reply, release.search_id, release.id); });
}
@ -431,7 +431,7 @@ void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int se
continue;
}
QJsonObject obj_image = value_image.toObject();
if (!obj_image.contains("type") || !obj_image.contains("resource_url") || !obj_image.contains("width") || !obj_image.contains("height") ) {
if (!obj_image.contains("type") || !obj_image.contains("resource_url") || !obj_image.contains("width") || !obj_image.contains("height")) {
Error("Invalid Json reply, images array value object is missing type, resource_url, width or height.", obj_image);
continue;
}

View File

@ -177,7 +177,7 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
continue;
}
QJsonObject obj_release = value_release.toObject();
if (!obj_release.contains("id") || !obj_release.contains("artist-credit") || !obj_release.contains("title")) {
if (!obj_release.contains("id") || !obj_release.contains("artist-credit") || !obj_release.contains("title")) {
Error("Invalid Json reply, releases array object is missing id, artist-credit or title.", obj_release);
continue;
}
@ -197,7 +197,7 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
}
QJsonObject obj_artist = value_artist.toObject();
if (!obj_artist.contains("artist") ) {
if (!obj_artist.contains("artist")) {
Error("Invalid Json reply, artist is missing.", obj_artist);
continue;
}
@ -208,7 +208,7 @@ void MusicbrainzCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
}
QJsonObject obj_artist2 = value_artist2.toObject();
if (!obj_artist2.contains("name") ) {
if (!obj_artist2.contains("name")) {
Error("Invalid Json reply, artist is missing name.", value_artist2);
continue;
}

View File

@ -144,7 +144,7 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
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;
}

View File

@ -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<guint>(songs.size()) <= g_list_length(entries)) {
@ -177,7 +177,7 @@ void CddaSongLoader::LoadSongs() {
GstTocEntry *entry = static_cast<GstTocEntry*>(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);
}
}

View File

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

View File

@ -84,10 +84,8 @@ class DeviceInfo : public SimpleTreeItem<DeviceInfo> {
// 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_;

View File

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

View File

@ -55,4 +55,4 @@ class DeviceStateFilterModel : public QSortFilterProxyModel {
DeviceManager::State state_;
};
#endif // DEVICESTATEFILTERMODEL_H
#endif // DEVICESTATEFILTERMODEL_H

View File

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

View File

@ -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<QObject*> wait_for_exit_;
};
#endif // FILESYSTEMDEVICE_H
#endif // FILESYSTEMDEVICE_H

View File

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

View File

@ -101,4 +101,4 @@ class GPodDevice : public ConnectedDevice, public virtual MusicStorage {
QList<std::shared_ptr<QTemporaryFile>> cover_files_;
};
#endif // GPODDEVICE_H
#endif // GPODDEVICE_H

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@
#include "devicefinder.h"
#include "alsadevicefinder.h"
AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder("alsa", {"alsa","alsasink"}) {}
AlsaDeviceFinder::AlsaDeviceFinder() : DeviceFinder("alsa", { "alsa","alsasink" }) {}
QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {

View File

@ -37,4 +37,4 @@ class AlsaDeviceFinder : public DeviceFinder {
Q_DISABLE_COPY(AlsaDeviceFinder)
};
#endif // ALSADEVICEFINDER_H
#endif // ALSADEVICEFINDER_H

View File

@ -33,7 +33,7 @@
#include "devicefinder.h"
#include "alsapcmdevicefinder.h"
AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder("alsa", {"alsa","alsasink"}) {}
AlsaPCMDeviceFinder::AlsaPCMDeviceFinder() : DeviceFinder("alsa", { "alsa","alsasink" }) {}
QList<DeviceFinder::Device> AlsaPCMDeviceFinder::ListDevices() {

View File

@ -37,4 +37,4 @@ class AlsaPCMDeviceFinder : public DeviceFinder {
Q_DISABLE_COPY(AlsaPCMDeviceFinder)
};
#endif // ALSAPCMDEVICEFINDER_H
#endif // ALSAPCMDEVICEFINDER_H

View File

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

View File

@ -65,4 +65,4 @@ class DeviceFinder {
Q_DISABLE_COPY(DeviceFinder)
};
#endif // DEVICEFINDER_H
#endif // DEVICEFINDER_H

View File

@ -20,7 +20,7 @@
*/
#ifdef INTERFACE
#undef INTERFACE
# undef INTERFACE
#endif
#include "config.h"

View File

@ -46,4 +46,4 @@ class DirectSoundDeviceFinder : public DeviceFinder {
LPVOID state_voidptr) __attribute__((stdcall));
};
#endif // DIRECTSOUNDDEVICEFINDER_H
#endif // DIRECTSOUNDDEVICEFINDER_H

View File

@ -35,7 +35,7 @@ enum TrackChangeType {
Q_DECLARE_FLAGS(TrackChangeFlags, TrackChangeType)
}
} // namespace Engine
typedef Engine::Base EngineBase;

View File

@ -241,7 +241,7 @@ struct SimpleMetaBundle {
QString lyrics;
};
} // namespace
} // namespace Engine
Q_DECLARE_METATYPE(EngineBase::OutputDetails)

View File

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

View File

@ -42,4 +42,4 @@ class GstBufferConsumer {
Q_DISABLE_COPY(GstBufferConsumer)
};
#endif // GSTBUFFERCONSUMER_H
#endif // GSTBUFFERCONSUMER_H

View File

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

View File

@ -1174,7 +1174,7 @@ void GstEnginePipeline::SetEqualizerParams(const int preamp, const QList<int> &b
void GstEnginePipeline::UpdateEqualizer() {
if (!equalizer_ || !equalizer_preamp_) return;
if (!equalizer_ || !equalizer_preamp_) return;
// Update band gains
for (int i = 0; i < kEqBandCount; ++i) {

View File

@ -62,7 +62,7 @@ std::unique_ptr<T> GetProperty(const AudioDeviceID &device_id, const AudioObject
} // namespace
MacOsDeviceFinder::MacOsDeviceFinder() : DeviceFinder("osxaudio", { "osxaudio", "osx", "osxaudiosink"} ) {}
MacOsDeviceFinder::MacOsDeviceFinder() : DeviceFinder("osxaudio", { "osxaudio", "osx", "osxaudiosink" }) {}
QList<DeviceFinder::Device> MacOsDeviceFinder::ListDevices() {

View File

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

View File

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

View File

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

View File

@ -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]{};

View File

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

View File

@ -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() <<reply.errorMessage();
qLog(Warning) << "Failed to grab media keys" << reply.errorName() << reply.errorMessage();
return;
}

View File

@ -84,7 +84,7 @@ void GlobalShortcutsBackendMate::RegisterFinished(QDBusPendingCallWatcher *watch
watcher->deleteLater();
if (reply.type() == QDBusMessage::ErrorMessage) {
qLog(Warning) << "Failed to grab media keys" << reply.errorName() <<reply.errorMessage();
qLog(Warning) << "Failed to grab media keys" << reply.errorName() << reply.errorMessage();
return;
}

View File

@ -79,7 +79,7 @@ GlobalShortcutsManager::GlobalShortcutsManager(QWidget *parent)
AddShortcut("seek_backward", "Seek backward", std::bind(&GlobalShortcutsManager::SeekBackward, this));
AddShortcut("show_hide", "Show/Hide", std::bind(&GlobalShortcutsManager::ShowHide, this));
AddShortcut("show_osd", "Show OSD", std::bind(&GlobalShortcutsManager::ShowOSD, this));
AddShortcut("toggle_pretty_osd", "Toggle Pretty OSD", std::bind(&GlobalShortcutsManager::TogglePrettyOSD, this)); // Toggling possible only for pretty OSD
AddShortcut("toggle_pretty_osd", "Toggle Pretty OSD", std::bind(&GlobalShortcutsManager::TogglePrettyOSD, this)); // Toggling possible only for pretty OSD
AddShortcut("shuffle_mode", "Change shuffle mode", std::bind(&GlobalShortcutsManager::CycleShuffleMode, this));
AddShortcut("repeat_mode", "Change repeat mode", std::bind(&GlobalShortcutsManager::CycleRepeatMode, this));
AddShortcut("toggle_scrobbling", "Enable/disable scrobbling", std::bind(&GlobalShortcutsManager::ToggleScrobbling, this));

View File

@ -52,7 +52,7 @@ class GlobalShortcutsManager : public QWidget {
QMap<QString, Shortcut> shortcuts() const { return shortcuts_; }
bool IsKdeAvailable() const;
static bool IsX11Available() ;
static bool IsX11Available();
bool IsGnomeAvailable() const;
bool IsMateAvailable() const;
bool IsMacAccessibilityEnabled() const;

View File

@ -110,7 +110,7 @@ class InternetCollectionView : public AutoExpandingTreeView {
private:
Application *app_;
CollectionBackend *collection_backend_;
CollectionModel*collection_model_;
CollectionModel *collection_model_;
CollectionFilterWidget *filter_;
bool favorite_;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -71,11 +71,11 @@ void AcoustidClient::Start(const int id, const QString &fingerprint, int duratio
typedef QPair<QString, QString> Param;
typedef QList<Param> 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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More