From f6b70fda7170b69a8b229af3b45398da910ad3d7 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 22 Mar 2022 21:09:05 +0100 Subject: [PATCH] Formatting --- ext/libstrawberry-common/core/logging.cpp | 13 ++- .../core/messagehandler.h | 8 +- ext/libstrawberry-common/core/messagereply.h | 2 +- ext/libstrawberry-common/core/workerpool.h | 53 +++++------ .../tagreadertaglib.cpp | 27 +++--- ext/libstrawberry-tagreader/tagreadertaglib.h | 4 +- .../tagreadertagparser.cpp | 4 +- ext/macdeploycheck/macdeploycheck.cpp | 6 +- ext/strawberry-tagreader/main.cpp | 2 +- ext/strawberry-tagreader/tagreaderworker.cpp | 2 +- src/analyzer/analyzerbase.cpp | 2 +- src/analyzer/analyzercontainer.h | 5 +- src/analyzer/blockanalyzer.cpp | 5 +- src/analyzer/blockanalyzer.h | 8 +- src/analyzer/rainbowanalyzer.cpp | 12 +-- src/analyzer/rainbowanalyzer.h | 6 +- src/collection/collectionbackend.cpp | 12 +-- src/collection/collectionfilterwidget.cpp | 42 ++++---- src/collection/collectionitemdelegate.cpp | 2 +- src/collection/collectionmodel.cpp | 2 +- src/collection/collectionquery.cpp | 6 +- src/collection/collectionquery.h | 2 +- src/context/contextview.cpp | 22 ++--- src/core/arraysize.h | 4 +- src/core/filesystemmusicstorage.cpp | 12 +-- src/core/lazy.h | 2 +- src/core/mainwindow.cpp | 26 +++-- src/core/mainwindow.h | 6 +- src/core/metatypes.cpp | 2 +- src/core/player.cpp | 18 ++-- src/core/scoped_cftyperef.h | 2 +- src/core/scopedgobject.h | 2 +- src/core/simpletreeitem.h | 24 ++--- src/core/simpletreemodel.h | 31 +++--- src/core/song.cpp | 4 +- src/core/stylehelper.cpp | 30 +++--- src/core/stylehelper.h | 95 +++++++++---------- src/core/tagreaderclient.h | 6 +- src/core/utilities.cpp | 22 ++--- src/core/utilities.h | 14 +-- src/core/windows7thumbbar.cpp | 14 ++- .../albumcoverchoicecontroller.cpp | 2 +- src/covermanager/albumcoverloader.cpp | 2 +- src/covermanager/coversearchstatistics.cpp | 2 +- src/covermanager/coversearchstatistics.h | 2 +- src/covermanager/discogscoverprovider.cpp | 2 +- src/covermanager/spotifycoverprovider.cpp | 5 +- src/covermanager/tidalcoverprovider.h | 4 +- src/device/cddasongloader.cpp | 2 +- src/device/devicemanager.h | 4 +- src/device/filesystemdevice.cpp | 8 +- src/device/giolister.cpp | 3 +- src/device/giolister.h | 4 +- src/device/macosdevicelister.h | 6 +- src/dialogs/console.cpp | 2 +- src/engine/alsadevicefinder.cpp | 2 +- src/engine/alsapcmdevicefinder.cpp | 2 +- src/engine/enginebase.cpp | 4 +- src/engine/gstengine.cpp | 2 +- src/engine/gstenginepipeline.cpp | 8 +- src/engine/gststartup.cpp | 12 +-- src/engine/macosdevicefinder.cpp | 2 +- src/engine/pulsedevicefinder.cpp | 24 ++--- src/engine/vlcscopedref.h | 18 ++-- src/equalizer/equalizer.cpp | 3 +- src/equalizer/equalizer.h | 4 +- src/globalshortcuts/globalshortcut-x11.cpp | 12 +-- .../globalshortcutsbackend.cpp | 2 +- .../globalshortcutsmanager.cpp | 6 +- src/internet/internetcollectionview.cpp | 2 +- src/main.cpp | 20 ++-- src/organize/organize.h | 4 +- src/organize/organizedialog.cpp | 2 +- src/organize/organizeformat.cpp | 2 +- src/osd/osdbase.cpp | 8 +- src/osd/osdpretty.cpp | 14 +-- src/playlist/playlist.cpp | 7 +- src/playlist/playlist.h | 2 +- src/playlist/playlistlistsortfiltermodel.h | 2 +- src/playlist/playlisttabbar.cpp | 2 +- src/playlistparsers/wplparser.h | 2 +- src/qobuz/qobuzrequest.cpp | 2 +- src/qobuz/qobuzservice.cpp | 4 +- src/radios/radioservices.h | 2 +- src/scrobbler/audioscrobbler.h | 2 +- src/scrobbler/scrobblerservices.h | 2 +- src/scrobbler/scrobblingapi20.cpp | 41 ++++---- src/settings/collectionsettingspage.cpp | 8 +- src/settings/contextsettingspage.h | 2 +- src/settings/globalshortcutssettingspage.cpp | 2 +- src/settings/notificationssettingspage.cpp | 4 +- src/settings/subsonicsettingspage.cpp | 2 +- .../smartplaylistsviewcontainer.cpp | 4 +- src/subsonic/subsonicrequest.h | 2 +- src/transcoder/transcodedialog.cpp | 2 +- src/widgets/busyindicator.cpp | 8 +- src/widgets/clickablelabel.cpp | 2 +- src/widgets/fancytabwidget.cpp | 19 ++-- src/widgets/fancytabwidget.h | 2 +- src/widgets/freespacebar.cpp | 2 +- src/widgets/groupediconview.h | 2 +- src/widgets/lineedit.cpp | 21 ++-- src/widgets/playingwidget.cpp | 4 +- src/widgets/ratingwidget.cpp | 3 +- src/widgets/tracksliderpopup.cpp | 4 +- src/widgets/volumeslider.cpp | 2 +- 106 files changed, 446 insertions(+), 479 deletions(-) diff --git a/ext/libstrawberry-common/core/logging.cpp b/ext/libstrawberry-common/core/logging.cpp index 9c427e78..a8f4440b 100644 --- a/ext/libstrawberry-common/core/logging.cpp +++ b/ext/libstrawberry-common/core/logging.cpp @@ -61,7 +61,7 @@ static const char *kMessageHandlerMagic = "__logging_message__"; static const size_t kMessageHandlerMagicLength = strlen(kMessageHandlerMagic); static QtMessageHandler sOriginalMessageHandler = nullptr; -template +template static T CreateLogger(Level level, const QString &class_name, int line, const char *category); void GLog(const char *domain, int level, const char *message, void*) { @@ -85,10 +85,9 @@ void GLog(const char *domain, int level, const char *message, void*) { qLogCat(Debug, domain) << message; break; } - } -template +template class DebugBase : public QDebug { public: DebugBase() : QDebug(sNullDevice) {} @@ -314,11 +313,11 @@ QString LinuxDemangle(const QString &symbol) { QString DarwinDemangle(const QString &symbol); QString DarwinDemangle(const QString &symbol) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +# if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QStringList split = symbol.split(' ', Qt::SkipEmptyParts); -#else +# else QStringList split = symbol.split(' ', QString::SkipEmptyParts); -#endif +# endif QString mangled_function = split[3]; return CXXDemangle(mangled_function); @@ -379,7 +378,7 @@ QDebug CreateLoggerError(int line, const char *pretty_function, const char *cate namespace { -template +template QString print_duration(T duration, const std::string &unit) { return QString("%1%2").arg(duration.count()).arg(unit.c_str()); } diff --git a/ext/libstrawberry-common/core/messagehandler.h b/ext/libstrawberry-common/core/messagehandler.h index 87e5402e..5bb6c050 100644 --- a/ext/libstrawberry-common/core/messagehandler.h +++ b/ext/libstrawberry-common/core/messagehandler.h @@ -79,7 +79,7 @@ class _MessageHandlerBase : public QObject { // Reads and writes uint32 length encoded MessageType messages to a socket. // You should subclass this and implement the MessageArrived(MessageType) method. -template +template class AbstractMessageHandler : public _MessageHandlerBase { public: AbstractMessageHandler(QIODevice *device, QObject *parent); @@ -115,11 +115,11 @@ class AbstractMessageHandler : public _MessageHandlerBase { QMap pending_replies_; }; -template +template AbstractMessageHandler::AbstractMessageHandler(QIODevice *device, QObject *parent) : _MessageHandlerBase(device, parent) {} -template +template void AbstractMessageHandler::SendMessage(const MessageType &message) { Q_ASSERT(QThread::currentThread() == thread()); @@ -127,7 +127,7 @@ void AbstractMessageHandler::SendMessage(const MessageType &message) { WriteMessage(QByteArray(data.data(), data.size())); } -template +template void AbstractMessageHandler::SendMessageAsync(const MessageType &message) { std::string data = message.SerializeAsString(); QMetaObject::invokeMethod(this, "WriteMessage", Qt::QueuedConnection, Q_ARG(QByteArray, QByteArray(data.data(), data.size()))); diff --git a/ext/libstrawberry-common/core/messagereply.h b/ext/libstrawberry-common/core/messagereply.h index e23d0c06..2f272f7d 100644 --- a/ext/libstrawberry-common/core/messagereply.h +++ b/ext/libstrawberry-common/core/messagereply.h @@ -56,7 +56,7 @@ class _MessageReplyBase : public QObject { }; // A reply future class that is returned immediately for requests that will occur in the background. Similar to QNetworkReply. -template +template class MessageReply : public _MessageReplyBase { public: explicit MessageReply(const MessageType &request_message, QObject *parent = nullptr); diff --git a/ext/libstrawberry-common/core/workerpool.h b/ext/libstrawberry-common/core/workerpool.h index 7fceb07b..c2b5488b 100644 --- a/ext/libstrawberry-common/core/workerpool.h +++ b/ext/libstrawberry-common/core/workerpool.h @@ -70,7 +70,7 @@ class _WorkerPoolBase : public QObject { // A local socket server is started for each process, and the address is passed to the process as argv[1]. // The process is expected to connect back to the socket server, and when it does a HandlerType is created for it. // Instances of HandlerType are created in the WorkerPool's thread. -template +template class WorkerPool : public _WorkerPoolBase { public: explicit WorkerPool(QObject *parent = nullptr); @@ -121,9 +121,9 @@ class WorkerPool : public _WorkerPoolBase { // Must only ever be called on my thread. void StartOneWorker(Worker *worker); - template + template Worker *FindWorker(T Worker::*member, T value) { - for (typename QList::iterator it = workers_.begin() ; it != workers_.end() ; ++it) { + for (typename QList::iterator it = workers_.begin(); it != workers_.end(); ++it) { if ((*it).*member == value) { return &(*it); } @@ -131,7 +131,7 @@ class WorkerPool : public _WorkerPoolBase { return nullptr; } - template + template void DeleteQObjectPointerLater(T **p) { if (*p) { (*p)->deleteLater(); @@ -158,15 +158,15 @@ class WorkerPool : public _WorkerPoolBase { QAtomicInt next_id_; QMutex message_queue_mutex_; - QQueue message_queue_; + QQueue message_queue_; }; -template +template WorkerPool::WorkerPool(QObject *parent) - : _WorkerPoolBase(parent), - next_worker_(0), - next_id_(0) { + : _WorkerPoolBase(parent), + next_worker_(0), + next_id_(0) { worker_count_ = qBound(1, QThread::idealThreadCount() / 2, 4); local_server_name_ = qApp->applicationName().toLower(); @@ -174,10 +174,9 @@ WorkerPool::WorkerPool(QObject *parent) if (local_server_name_.isEmpty()) { local_server_name_ = "workerpool"; } - } -template +template WorkerPool::~WorkerPool() { for (const Worker &worker : workers_) { @@ -205,33 +204,32 @@ WorkerPool::~WorkerPool() { for (ReplyType *reply : message_queue_) { reply->Abort(); } - } -template +template void WorkerPool::SetWorkerCount(const int count) { Q_ASSERT(workers_.isEmpty()); worker_count_ = count; } -template +template void WorkerPool::SetLocalServerName(const QString &local_server_name) { Q_ASSERT(workers_.isEmpty()); local_server_name_ = local_server_name; } -template +template void WorkerPool::SetExecutableName(const QString &executable_name) { Q_ASSERT(workers_.isEmpty()); executable_name_ = executable_name; } -template +template void WorkerPool::Start() { QMetaObject::invokeMethod(this, "DoStart"); } -template +template void WorkerPool::DoStart() { Q_ASSERT(workers_.isEmpty()); @@ -267,10 +265,9 @@ void WorkerPool::DoStart() { workers_ << worker; } - } -template +template void WorkerPool::StartOneWorker(Worker *worker) { Q_ASSERT(QThread::currentThread() == thread()); @@ -311,10 +308,9 @@ void WorkerPool::StartOneWorker(Worker *worker) { #endif worker->process_->start(executable_path_, QStringList() << worker->local_server_->fullServerName()); - } -template +template void WorkerPool::NewConnection() { Q_ASSERT(QThread::currentThread() == thread()); @@ -339,10 +335,9 @@ void WorkerPool::NewConnection() { worker->handler_ = new HandlerType(worker->local_socket_, this); SendQueuedMessages(); - } -template +template void WorkerPool::ProcessError(QProcess::ProcessError error) { Q_ASSERT(QThread::currentThread() == thread()); @@ -367,10 +362,9 @@ void WorkerPool::ProcessError(QProcess::ProcessError error) { StartOneWorker(worker); break; } - } -template +template void WorkerPool::ProcessReadyReadStandardOutput() { Q_ASSERT(QThread::currentThread() == thread()); @@ -380,10 +374,9 @@ void WorkerPool::ProcessReadyReadStandardOutput() { fprintf(stdout, "%s", data.data()); fflush(stdout); - } -template +template void WorkerPool::ProcessReadyReadStandardError() { Q_ASSERT(QThread::currentThread() == thread()); @@ -423,10 +416,9 @@ WorkerPool::SendMessageWithReply(MessageType *message) { QMetaObject::invokeMethod(this, "SendQueuedMessages", Qt::QueuedConnection); return reply; - } -template +template void WorkerPool::SendQueuedMessages() { QMutexLocker l(&message_queue_mutex_); @@ -445,10 +437,9 @@ void WorkerPool::SendQueuedMessages() { handler->SendRequest(reply); } - } -template +template HandlerType *WorkerPool::NextHandler() const { for (int i = 0; i < workers_.count(); ++i) { diff --git a/ext/libstrawberry-tagreader/tagreadertaglib.cpp b/ext/libstrawberry-tagreader/tagreadertaglib.cpp index ec2d2c4f..b0253404 100644 --- a/ext/libstrawberry-tagreader/tagreadertaglib.cpp +++ b/ext/libstrawberry-tagreader/tagreadertaglib.cpp @@ -113,6 +113,7 @@ class TagLibFileRefFactory : public FileRefFactory { return new TagLib::FileRef(QFile::encodeName(filename).constData()); #endif } + private: Q_DISABLE_COPY(TagLibFileRefFactory) }; @@ -130,11 +131,11 @@ TagLib::String QStringToTaglibString(const QString &s) { } // namespace namespace { -const char *kMP4_OriginalYear_ID = "----:com.apple.iTunes:ORIGINAL YEAR"; +const char *kMP4_OriginalYear_ID = "----:com.apple.iTunes:ORIGINAL YEAR"; const char *kMP4_FMPS_Playcount_ID = "----:com.apple.iTunes:FMPS_Playcount"; -const char *kMP4_FMPS_Rating_ID = "----:com.apple.iTunes:FMPS_Rating"; -const char *kASF_OriginalDate_ID = "WM/OriginalReleaseTime"; -const char *kASF_OriginalYear_ID = "WM/OriginalReleaseYear"; +const char *kMP4_FMPS_Rating_ID = "----:com.apple.iTunes:FMPS_Rating"; +const char *kASF_OriginalDate_ID = "WM/OriginalReleaseTime"; +const char *kASF_OriginalYear_ID = "WM/OriginalReleaseYear"; } // namespace @@ -265,7 +266,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta if (tag) Decode(tag->comment(), song->mutable_comment()); } - else if (TagLib::WavPack::File *file_wavpack = dynamic_cast(fileref->file())) { + else if (TagLib::WavPack::File *file_wavpack = dynamic_cast(fileref->file())) { song->set_bitdepth(file_wavpack->audioProperties()->bitsPerSample()); if (file_wavpack->APETag()) { ParseAPETag(file_wavpack->APETag()->itemListMap(), &disc, &compilation, song); @@ -306,7 +307,9 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta if (!map["TCMP"].isEmpty()) compilation = TStringToQString(map["TCMP"].front()->toString()).trimmed(); - if (!map["TDOR"].isEmpty()) { song->set_originalyear(map["TDOR"].front()->toString().substr(0, 4).toInt()); } + if (!map["TDOR"].isEmpty()) { + song->set_originalyear(map["TDOR"].front()->toString().substr(0, 4).toInt()); + } else if (!map["TORY"].isEmpty()) { song->set_originalyear(map["TORY"].front()->toString().substr(0, 4).toInt()); } @@ -321,7 +324,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta if (!map["APIC"].isEmpty()) song->set_art_automatic(kEmbeddedCover); // Find a suitable comment tag. For now we ignore iTunNORM comments. - for (uint i = 0 ; i < map["COMM"].size() ; ++i) { + for (uint i = 0; i < map["COMM"].size(); ++i) { const TagLib::ID3v2::CommentsFrame *frame = dynamic_cast(map["COMM"][i]); if (frame && TStringToQString(frame->description()) != "iTunNORM") { @@ -450,7 +453,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta } if (attributes_map.contains("FMPS/Rating")) { - const TagLib::ASF::AttributeList& attributes = attributes_map["FMPS/Rating"]; + const TagLib::ASF::AttributeList &attributes = attributes_map["FMPS/Rating"]; if (!attributes.isEmpty()) { float rating = TStringToQString(attributes.front().toString()).toFloat(); if (song->rating() <= 0 && rating > 0) { @@ -679,7 +682,7 @@ bool TagReaderTagLib::SaveFile(const QString &filename, const spb::tagreader::So else if (TagLib::MP4::File *file_mp4 = dynamic_cast(fileref->file())) { TagLib::MP4::Tag *tag = file_mp4->tag(); if (!tag) return false; - tag->setItem("disk", TagLib::MP4::Item(song.disc() <= 0 -1 ? 0 : song.disc(), 0)); + tag->setItem("disk", TagLib::MP4::Item(song.disc() <= 0 - 1 ? 0 : song.disc(), 0)); tag->setItem("\251wrt", TagLib::StringList(TagLib::String(song.composer(), TagLib::String::UTF8))); tag->setItem("\251grp", TagLib::StringList(TagLib::String(song.grouping(), TagLib::String::UTF8))); tag->setItem("\251lyr", TagLib::StringList(TagLib::String(song.lyrics(), TagLib::String::UTF8))); @@ -743,7 +746,7 @@ void TagReaderTagLib::SetTextFrame(const char *id, const std::string &value, Tag } // Update and add the frames - for (int i = 0 ; i < frames_buffer.size() ; ++i) { + for (int i = 0; i < frames_buffer.size(); ++i) { TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame(frames_buffer.at(i)); if (i == 0) { frame->setText(StdStringToTaglibString(value)); @@ -799,7 +802,7 @@ void TagReaderTagLib::SetUnsyncLyricsFrame(const std::string &value, TagLib::ID3 } // Update and add the frames - for (int i = 0 ; i < frames_buffer.size() ; ++i) { + for (int i = 0; i < frames_buffer.size(); ++i) { TagLib::ID3v2::UnsynchronizedLyricsFrame *frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame(frames_buffer.at(i)); if (i == 0) { frame->setText(StdStringToTaglibString(value)); @@ -983,7 +986,7 @@ bool TagReaderTagLib::SaveEmbeddedArt(const QString &filename, const QByteArray // Remove existing covers TagLib::ID3v2::FrameList apiclist = tag->frameListMap()["APIC"]; - for (TagLib::ID3v2::FrameList::ConstIterator it = apiclist.begin() ; it != apiclist.end() ; ++it ) { + for (TagLib::ID3v2::FrameList::ConstIterator it = apiclist.begin(); it != apiclist.end(); ++it) { TagLib::ID3v2::AttachedPictureFrame *frame = dynamic_cast(*it); tag->removeFrame(frame, false); } diff --git a/ext/libstrawberry-tagreader/tagreadertaglib.h b/ext/libstrawberry-tagreader/tagreadertaglib.h index 3f922683..c5323cb9 100644 --- a/ext/libstrawberry-tagreader/tagreadertaglib.h +++ b/ext/libstrawberry-tagreader/tagreadertaglib.h @@ -75,13 +75,13 @@ class TagReaderTagLib : public TagReaderBase { void SetTextFrame(const char *id, const std::string &value, TagLib::ID3v2::Tag *tag) const; void SetUserTextFrame(const QString &description, const QString &value, TagLib::ID3v2::Tag *tag) const; void SetUserTextFrame(const std::string &description, const std::string &value, TagLib::ID3v2::Tag *tag) const; - void SetUnsyncLyricsFrame(const std::string& value, TagLib::ID3v2::Tag* tag) const; + void SetUnsyncLyricsFrame(const std::string &value, TagLib::ID3v2::Tag *tag) const; QByteArray LoadEmbeddedAPEArt(const TagLib::APE::ItemListMap &map) const; static float ConvertPOPMRating(const int POPM_rating); static int ConvertToPOPMRating(const float rating); - static TagLib::ID3v2::PopularimeterFrame *GetPOPMFrameFromTag(TagLib::ID3v2::Tag* tag); + static TagLib::ID3v2::PopularimeterFrame *GetPOPMFrameFromTag(TagLib::ID3v2::Tag *tag); private: FileRefFactory *factory_; diff --git a/ext/libstrawberry-tagreader/tagreadertagparser.cpp b/ext/libstrawberry-tagreader/tagreadertagparser.cpp index 74ae2f86..4b8428a6 100644 --- a/ext/libstrawberry-tagreader/tagreadertagparser.cpp +++ b/ext/libstrawberry-tagreader/tagreadertagparser.cpp @@ -151,7 +151,7 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM const auto tracks = taginfo.tracks(); for (const auto track : tracks) { - switch(track->format().general) { + switch (track->format().general) { case TagParser::GeneralMediaFormat::Flac: song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_FLAC); break; @@ -174,7 +174,7 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_OGGSPEEX); break; case TagParser::GeneralMediaFormat::Mpeg1Audio: - switch(track->format().sub) { + switch (track->format().sub) { case TagParser::SubFormats::Mpeg1Layer3: song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_MPEG); break; diff --git a/ext/macdeploycheck/macdeploycheck.cpp b/ext/macdeploycheck/macdeploycheck.cpp index 38e4491a..f151bc86 100644 --- a/ext/macdeploycheck/macdeploycheck.cpp +++ b/ext/macdeploycheck/macdeploycheck.cpp @@ -99,7 +99,7 @@ int main(int argc, char **argv) { QRegularExpressionMatch match = regexp.match(output_line); if (match.hasMatch()) { QString library = match.captured(1); - if (QFileInfo(library).fileName() == QFileInfo(filepath).fileName()) { // It's this. + if (QFileInfo(library).fileName() == QFileInfo(filepath).fileName()) { // It's this. continue; } else if (library.startsWith("@executable_path")) { @@ -113,7 +113,7 @@ int main(int argc, char **argv) { else if (library.startsWith("@rpath")) { QString real_path = library; real_path = real_path.replace("@rpath", bundle_path + "/Contents/Frameworks"); - if (!QFile(real_path).exists() && !real_path.endsWith("QtSvg")) { // FIXME: Ignore broken svg image plugin. + if (!QFile(real_path).exists() && !real_path.endsWith("QtSvg")) { // FIXME: Ignore broken svg image plugin. qLog(Error) << real_path << "does not exist for" << filepath; success = false; } @@ -127,7 +127,7 @@ int main(int argc, char **argv) { success = false; } } - else if (library.startsWith("/System/Library/") || library.startsWith("/usr/lib/")) { // System library + else if (library.startsWith("/System/Library/") || library.startsWith("/usr/lib/")) { // System library continue; } else if (library.endsWith("libgcc_s.1.dylib")) { // fftw points to it for some reason. diff --git a/ext/strawberry-tagreader/main.cpp b/ext/strawberry-tagreader/main.cpp index 82f760fb..c697ef43 100644 --- a/ext/strawberry-tagreader/main.cpp +++ b/ext/strawberry-tagreader/main.cpp @@ -21,7 +21,7 @@ #include #if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) -#include +# include #endif #include diff --git a/ext/strawberry-tagreader/tagreaderworker.cpp b/ext/strawberry-tagreader/tagreaderworker.cpp index 2b12a710..1c59aa1d 100644 --- a/ext/strawberry-tagreader/tagreaderworker.cpp +++ b/ext/strawberry-tagreader/tagreaderworker.cpp @@ -28,7 +28,7 @@ #include "tagreaderworker.h" TagReaderWorker::TagReaderWorker(QIODevice *socket, QObject *parent) - : AbstractMessageHandler(socket, parent) {} + : AbstractMessageHandler(socket, parent) {} void TagReaderWorker::MessageArrived(const spb::tagreader::Message &message) { diff --git a/src/analyzer/analyzerbase.cpp b/src/analyzer/analyzerbase.cpp index fa2d1623..18192926 100644 --- a/src/analyzer/analyzerbase.cpp +++ b/src/analyzer/analyzerbase.cpp @@ -154,7 +154,7 @@ int Analyzer::Base::resizeForBands(const int bands) { } else { exp = 9; -} + } resizeExponent(exp); return fht_->size() / 2; diff --git a/src/analyzer/analyzercontainer.h b/src/analyzer/analyzercontainer.h index a5a8ad2d..7e72ace7 100644 --- a/src/analyzer/analyzercontainer.h +++ b/src/analyzer/analyzercontainer.h @@ -74,7 +74,7 @@ class AnalyzerContainer : public QWidget { void Load(); void Save(); void SaveFramerate(const int framerate); - template + template void AddAnalyzerType(); void AddFramerate(const QString &name, const int framerate); @@ -96,10 +96,9 @@ class AnalyzerContainer : public QWidget { Analyzer::Base *current_analyzer_; EngineBase *engine_; - }; -template +template void AnalyzerContainer::AddAnalyzerType() { int id = analyzer_types_.count(); diff --git a/src/analyzer/blockanalyzer.cpp b/src/analyzer/blockanalyzer.cpp index 3be12523..0ddbb9aa 100644 --- a/src/analyzer/blockanalyzer.cpp +++ b/src/analyzer/blockanalyzer.cpp @@ -63,8 +63,7 @@ BlockAnalyzer::BlockAnalyzer(QWidget *parent) setMaximumWidth(kMaxColumns * (kWidth + 1) - 1); // mxcl says null pixmaps cause crashes, so let's play it safe - std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(1, 1)); - + std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(1, 1)); } void BlockAnalyzer::resizeEvent(QResizeEvent *e) { @@ -89,7 +88,7 @@ void BlockAnalyzer::resizeEvent(QResizeEvent *e) { if (rows_ != oldRows) { barpixmap_ = QPixmap(kWidth, rows_ * (kHeight + 1)); - std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(kWidth, rows_ * (kHeight + 1))); + std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(kWidth, rows_ * (kHeight + 1))); yscale_.resize(rows_ + 1); diff --git a/src/analyzer/blockanalyzer.h b/src/analyzer/blockanalyzer.h index 301bc9b4..a7c09d8b 100644 --- a/src/analyzer/blockanalyzer.h +++ b/src/analyzer/blockanalyzer.h @@ -65,14 +65,14 @@ class BlockAnalyzer : public Analyzer::Base { private: QPixmap *bar() { return &barpixmap_; } - int columns_, rows_; // number of rows and columns of blocks - int y_; // y-offset from top of widget + int columns_, rows_; // number of rows and columns of blocks + int y_; // y-offset from top of widget QPixmap barpixmap_; QPixmap topbarpixmap_; QPixmap background_; QPixmap canvas_; - Analyzer::Scope scope_; // so we don't create a vector every frame - QVector store_; // current bar heights + Analyzer::Scope scope_; // so we don't create a vector every frame + QVector store_; // current bar heights QVector yscale_; QVector fade_bars_; diff --git a/src/analyzer/rainbowanalyzer.cpp b/src/analyzer/rainbowanalyzer.cpp index d24a28cf..2be0604a 100644 --- a/src/analyzer/rainbowanalyzer.cpp +++ b/src/analyzer/rainbowanalyzer.cpp @@ -43,12 +43,12 @@ using Analyzer::Scope; -const int Rainbow::RainbowAnalyzer::kHeight[] = {21, 33}; -const int Rainbow::RainbowAnalyzer::kWidth[] = {34, 53}; -const int Rainbow::RainbowAnalyzer::kFrameCount[] = {6, 16}; -const int Rainbow::RainbowAnalyzer::kRainbowHeight[] = {21, 16}; -const int Rainbow::RainbowAnalyzer::kRainbowOverlap[] = {13, 15}; -const int Rainbow::RainbowAnalyzer::kSleepingHeight[] = {24, 33}; +const int Rainbow::RainbowAnalyzer::kHeight[] = { 21, 33 }; +const int Rainbow::RainbowAnalyzer::kWidth[] = { 34, 53 }; +const int Rainbow::RainbowAnalyzer::kFrameCount[] = { 6, 16 }; +const int Rainbow::RainbowAnalyzer::kRainbowHeight[] = { 21, 16 }; +const int Rainbow::RainbowAnalyzer::kRainbowOverlap[] = { 13, 15 }; +const int Rainbow::RainbowAnalyzer::kSleepingHeight[] = { 24, 33 }; const char *Rainbow::NyanCatAnalyzer::kName = "Nyanalyzer Cat"; const char *Rainbow::RainbowDashAnalyzer::kName = "Rainbow Dash"; diff --git a/src/analyzer/rainbowanalyzer.h b/src/analyzer/rainbowanalyzer.h index f4f7d9cd..c9fbdfe0 100644 --- a/src/analyzer/rainbowanalyzer.h +++ b/src/analyzer/rainbowanalyzer.h @@ -93,7 +93,7 @@ class RainbowAnalyzer : public Analyzer::Base { private: // "constants" that get initialized in the constructor - float band_scale_[kRainbowBands]{}; + float band_scale_[kRainbowBands] {}; QPen colors_[kRainbowBands]; // Rainbow Nyancat & Dash @@ -104,7 +104,7 @@ class RainbowAnalyzer : public Analyzer::Base { int frame_; // The y positions of each point on the rainbow. - float history_[kHistorySize * kRainbowBands]{}; + float history_[kHistorySize * kRainbowBands] {}; // A cache of the last frame's rainbow, // so it can be used in the next frame. @@ -142,6 +142,6 @@ class RainbowDashAnalyzer : public RainbowAnalyzer { static const char *kName; }; -} +} // namespace Rainbow #endif // RAINBOWANALYZER_H diff --git a/src/collection/collectionbackend.cpp b/src/collection/collectionbackend.cpp index 03a4355f..54c50f57 100644 --- a/src/collection/collectionbackend.cpp +++ b/src/collection/collectionbackend.cpp @@ -335,8 +335,8 @@ void CollectionBackend::AddDirectory(const QString &path) { q.prepare(QString("INSERT INTO %1 (path, subdirs) VALUES (:path, 1)").arg(dirs_table_)); q.BindValue(":path", db_path); if (!q.Exec()) { - db_->ReportErrors(q); - return; + db_->ReportErrors(q); + return; } Directory dir; @@ -634,15 +634,13 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) { added_songs << new_song; continue; - } - } // Create new song int id = -1; - { // Insert the row and create a new ID + { // Insert the row and create a new ID SqlQuery q(db); q.prepare(QString("INSERT INTO %1 (" + Song::kColumnSpec + ") VALUES (" + Song::kBindSpec + ")").arg(songs_table_)); song.BindToQuery(&q); @@ -656,7 +654,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) { if (id == -1) return; - { // Add to the FTS index + { // Add to the FTS index SqlQuery q(db); q.prepare(QString("INSERT INTO %1 (ROWID, " + Song::kFtsColumnSpec + ") VALUES (:id, " + Song::kFtsBindSpec + ")").arg(fts_table_)); q.BindValue(":id", id); @@ -1345,7 +1343,7 @@ void CollectionBackend::CompilationsNeedUpdating() { if (album.isEmpty()) continue; // Find the directory the song is in - QString directory = url.toString(QUrl::PreferLocalFile|QUrl::RemoveFilename); + QString directory = url.toString(QUrl::PreferLocalFile | QUrl::RemoveFilename); CompilationInfo &info = compilation_info[directory + album]; info.urls << url; diff --git a/src/collection/collectionfilterwidget.cpp b/src/collection/collectionfilterwidget.cpp index 5ef41bc0..807ed74e 100644 --- a/src/collection/collectionfilterwidget.cpp +++ b/src/collection/collectionfilterwidget.cpp @@ -68,24 +68,23 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent) QString available_fields = Song::kFtsColumns.join(", ").replace(QRegularExpression("\\bfts"), ""); ui_->search_field->setToolTip( - QString("

") + - tr("Prefix a word with a field name to limit the search to that field, e.g.:") + - QString(" ") + - QString("") + - tr("artist") + - QString(":") + - QString("Strawbs") + - QString(" ") + - tr("searches the collection for all artists that contain the word") + - QString(" Strawbs.") + - QString("

") + - tr("Available fields") + - QString(": ") + - "" + - available_fields + - QString(".") + - QString("

") - ); + QString("

") + + tr("Prefix a word with a field name to limit the search to that field, e.g.:") + + QString(" ") + + QString("") + + tr("artist") + + QString(":") + + QString("Strawbs") + + QString(" ") + + tr("searches the collection for all artists that contain the word") + + QString(" Strawbs.") + + QString("

") + + tr("Available fields") + + QString(": ") + + "" + + available_fields + + QString(".") + + QString("

")); QObject::connect(ui_->search_field, &QSearchField::returnPressed, this, &CollectionFilterWidget::ReturnPressed); QObject::connect(filter_delay_, &QTimer::timeout, this, &CollectionFilterWidget::FilterDelayTimeout); @@ -177,16 +176,15 @@ void CollectionFilterWidget::Init(CollectionModel *model) { if (s.contains(group_by_version())) version = s.value(group_by_version(), 0).toInt(); if (version == 1) { model_->SetGroupBy(CollectionModel::Grouping( - CollectionModel::GroupBy(s.value(group_by(1), static_cast(CollectionModel::GroupBy_AlbumArtist)).toInt()), - CollectionModel::GroupBy(s.value(group_by(2), static_cast(CollectionModel::GroupBy_AlbumDisc)).toInt()), - CollectionModel::GroupBy(s.value(group_by(3), static_cast(CollectionModel::GroupBy_None)).toInt()))); + CollectionModel::GroupBy(s.value(group_by(1), static_cast(CollectionModel::GroupBy_AlbumArtist)).toInt()), + CollectionModel::GroupBy(s.value(group_by(2), static_cast(CollectionModel::GroupBy_AlbumDisc)).toInt()), + CollectionModel::GroupBy(s.value(group_by(3), static_cast(CollectionModel::GroupBy_None)).toInt()))); } else { model_->SetGroupBy(CollectionModel::Grouping(CollectionModel::GroupBy_AlbumArtist, CollectionModel::GroupBy_AlbumDisc, CollectionModel::GroupBy_None)); } s.endGroup(); } - } void CollectionFilterWidget::ReloadSettings() { diff --git a/src/collection/collectionitemdelegate.cpp b/src/collection/collectionitemdelegate.cpp index e3d9a8a4..188a7c61 100644 --- a/src/collection/collectionitemdelegate.cpp +++ b/src/collection/collectionitemdelegate.cpp @@ -100,7 +100,7 @@ void CollectionItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem // Draw the line under the item QColor line_color = opt.palette.color(QPalette::Text); QLinearGradient grad_color(opt.rect.bottomLeft(), opt.rect.bottomRight()); - const double fade_start_end = (opt.rect.width()/3.0)/opt.rect.width(); + const double fade_start_end = (opt.rect.width() / 3.0) / opt.rect.width(); line_color.setAlphaF(0.0); grad_color.setColorAt(0, line_color); line_color.setAlphaF(0.5); diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index df2335ad..4622879a 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -476,7 +476,7 @@ QString CollectionModel::DividerDisplayText(const GroupBy type, const QString &k case GroupBy_Genre: case GroupBy_FileType: case GroupBy_Format: - if (key == "0") return "0-9"; + if (key == "0") return "0-9"; return key.toUpper(); case GroupBy_YearAlbum: diff --git a/src/collection/collectionquery.cpp b/src/collection/collectionquery.cpp index 711eded2..15d58907 100644 --- a/src/collection/collectionquery.cpp +++ b/src/collection/collectionquery.cpp @@ -155,11 +155,11 @@ void CollectionQuery::AddWhere(const QString &column, const QVariant &value, con } else if ( #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - value.metaType().id() == QMetaType::QString + value.metaType().id() == QMetaType::QString #else - value.type() == QVariant::String + value.type() == QVariant::String #endif - && value.toString().isNull()) { + && value.toString().isNull()) { where_clauses_ << QString("%1 %2 ?").arg(column, op); bound_values_ << QString(""); } diff --git a/src/collection/collectionquery.h b/src/collection/collectionquery.h index 97122f22..20c4c198 100644 --- a/src/collection/collectionquery.h +++ b/src/collection/collectionquery.h @@ -125,4 +125,4 @@ class CollectionQuery : public QSqlQuery { int limit_; }; -#endif // COLLECTIONQUERY_H +#endif // COLLECTIONQUERY_H diff --git a/src/context/contextview.cpp b/src/context/contextview.cpp index 089c0217..9310c29c 100644 --- a/src/context/contextview.cpp +++ b/src/context/contextview.cpp @@ -148,7 +148,7 @@ ContextView::ContextView(QWidget *parent) widget_scrollarea_->setLayout(layout_scrollarea_); widget_scrollarea_->setContentsMargins(0, 0, 0, 0); - label_top_->setAlignment(Qt::AlignTop|Qt::AlignLeft); + label_top_->setAlignment(Qt::AlignTop | Qt::AlignLeft); label_top_->setWordWrap(true); label_top_->setMinimumHeight(50); label_top_->setContentsMargins(0, 0, 32, 0); @@ -262,15 +262,15 @@ ContextView::ContextView(QWidget *parent) layout_play_->addWidget(label_play_lyrics_); layout_play_->addSpacerItem(spacer_play_bottom_); - labels_play_ << label_engine_title_ - << label_device_title_ - << label_filetype_title_ - << label_length_title_ - << label_samplerate_title_ - << label_bitdepth_title_ - << label_bitrate_title_ - << label_play_albums_ - << label_play_lyrics_; + labels_play_ << label_engine_title_ + << label_device_title_ + << label_filetype_title_ + << label_length_title_ + << label_samplerate_title_ + << label_bitdepth_title_ + << label_bitrate_title_ + << label_play_albums_ + << label_play_lyrics_; labels_play_data_ << label_engine_icon_ << label_engine_ @@ -379,7 +379,7 @@ void ContextView::ReloadSettings() { action_search_lyrics_->setChecked(s.value(ContextSettingsPage::kSettingsGroupEnable[ContextSettingsPage::ContextSettingsOrder::SEARCH_LYRICS], true).toBool()); font_headline_ = s.value("font_headline", font().family()).toString(); font_normal_ = s.value("font_normal", font().family()).toString(); - font_size_headline_ = s.value("font_size_headline", ContextSettingsPage::kDefaultFontSizeHeadline).toReal(); + font_size_headline_ = s.value("font_size_headline", ContextSettingsPage::kDefaultFontSizeHeadline).toReal(); font_size_normal_ = s.value("font_size_normal", font().pointSizeF()).toReal(); s.endGroup(); diff --git a/src/core/arraysize.h b/src/core/arraysize.h index f66402ce..87e64b92 100644 --- a/src/core/arraysize.h +++ b/src/core/arraysize.h @@ -20,14 +20,14 @@ // This template function declaration is used in defining arraysize. // Note that the function doesn't need an implementation, as we only // use its type. -template +template char (&ArraySizeHelper(T (&array)[N]))[N]; // That gcc wants both of these prototypes seems mysterious. VC, for // its part, can't decide which to use (another mystery). Matching of // template overloads: the final frontier. #ifndef _MSC_VER -template +template char (&ArraySizeHelper(const T (&array)[N]))[N]; #endif diff --git a/src/core/filesystemmusicstorage.cpp b/src/core/filesystemmusicstorage.cpp index f1731dee..e2d0d3e9 100644 --- a/src/core/filesystemmusicstorage.cpp +++ b/src/core/filesystemmusicstorage.cpp @@ -109,12 +109,12 @@ bool FilesystemMusicStorage::DeleteFromStorage(const DeleteJob &job) { if (job.use_trash_) { #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - if (fileInfo.isDir()) { - return Utilities::MoveToTrashRecursive(path); - } - else { - return QFile::moveToTrash(path); - } + if (fileInfo.isDir()) { + return Utilities::MoveToTrashRecursive(path); + } + else { + return QFile::moveToTrash(path); + } #else return false; #endif diff --git a/src/core/lazy.h b/src/core/lazy.h index 2f0e7163..b45cc125 100644 --- a/src/core/lazy.h +++ b/src/core/lazy.h @@ -25,7 +25,7 @@ // Usage: // Lazy my_lazy_object([]() { return new Foo; }); -template +template class Lazy { public: explicit Lazy(std::function init) : init_(init) {} diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 280b02f6..dcc37617 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -476,9 +476,9 @@ MainWindow::MainWindow(Application *app, std::shared_ptr tray_ic QObject::connect(file_view_, &FileView::CopyToCollection, this, &MainWindow::CopyFilesToCollection); QObject::connect(file_view_, &FileView::MoveToCollection, this, &MainWindow::MoveFilesToCollection); QObject::connect(file_view_, &FileView::EditTags, this, &MainWindow::EditFileTags); -#ifndef Q_OS_WIN +# ifndef Q_OS_WIN QObject::connect(file_view_, &FileView::CopyToDevice, this, &MainWindow::CopyFilesToDevice); -#endif +# endif #endif file_view_->SetTaskManager(app_->task_manager()); @@ -536,8 +536,8 @@ MainWindow::MainWindow(Application *app, std::shared_ptr tray_ic QObject::connect(app_->scrobbler(), &AudioScrobbler::ErrorMessage, this, &MainWindow::ShowErrorDialog); // Playlist view actions - ui_->action_next_playlist->setShortcuts(QList() << QKeySequence::fromString("Ctrl+Tab")<< QKeySequence::fromString("Ctrl+PgDown")); - ui_->action_previous_playlist->setShortcuts(QList() << QKeySequence::fromString("Ctrl+Shift+Tab")<< QKeySequence::fromString("Ctrl+PgUp")); + ui_->action_next_playlist->setShortcuts(QList() << QKeySequence::fromString("Ctrl+Tab") << QKeySequence::fromString("Ctrl+PgDown")); + ui_->action_previous_playlist->setShortcuts(QList() << QKeySequence::fromString("Ctrl+Shift+Tab") << QKeySequence::fromString("Ctrl+PgUp")); // Actions for switching tabs will be global to the entire window, so adding them here addAction(ui_->action_next_playlist); @@ -680,7 +680,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr tray_ic QObject::connect(tidal_view_->albums_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(tidal_view_->songs_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist); QObject::connect(tidal_view_->search_view(), &InternetSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist); - if (TidalService *tidalservice = qobject_cast (app_->internet_services()->ServiceBySource(Song::Source_Tidal))) { + if (TidalService *tidalservice = qobject_cast(app_->internet_services()->ServiceBySource(Song::Source_Tidal))) { QObject::connect(this, &MainWindow::AuthorizationUrlReceived, tidalservice, &TidalService::AuthorizationUrlReceived); } #endif @@ -1001,11 +1001,11 @@ MainWindow::MainWindow(Application *app, std::shared_ptr tray_ic #ifdef HAVE_QTSPARKLE QUrl sparkle_url; -#if defined(Q_OS_MACOS) +# if defined(Q_OS_MACOS) sparkle_url.setUrl("https://www.strawberrymusicplayer.org/sparkle-macos"); -#elif defined(Q_OS_WIN) +# elif defined(Q_OS_WIN) sparkle_url.setUrl("https://www.strawberrymusicplayer.org/sparkle-windows"); -#endif +# endif if (!sparkle_url.isEmpty()) { qLog(Debug) << "Creating Qt Sparkle updater"; qtsparkle::Updater *updater = new qtsparkle::Updater(sparkle_url, this); @@ -2274,7 +2274,7 @@ void MainWindow::PlaylistRemoveCurrent() { void MainWindow::PlaylistClearCurrent() { if (app_->playlist_manager()->current()->rowCount() > Playlist::kUndoItemLimit) { - QMessageBox messagebox(QMessageBox::Warning, tr("Clear playlist"), tr("Playlist has %1 songs, too large to undo, are you sure you want to clear the playlist?").arg(app_->playlist_manager()->current()->rowCount()), QMessageBox::Ok|QMessageBox::Cancel); + QMessageBox messagebox(QMessageBox::Warning, tr("Clear playlist"), tr("Playlist has %1 songs, too large to undo, are you sure you want to clear the playlist?").arg(app_->playlist_manager()->current()->rowCount()), QMessageBox::Ok | QMessageBox::Cancel); messagebox.setTextFormat(Qt::RichText); int result = messagebox.exec(); switch (result) { @@ -2874,22 +2874,20 @@ void MainWindow::Raise() { show(); activateWindow(); hidden_ = false; - } #ifdef Q_OS_WIN -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) { -#else +# else bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) { -#endif +# endif if (exit_count_ == 0 && message) { MSG *msg = static_cast(message); thumbbar_->HandleWinEvent(msg); } return QMainWindow::nativeEvent(eventType, message, result); - } #endif // Q_OS_WIN diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index 3456e45f..5e3a0088 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -120,11 +120,11 @@ class MainWindow : public QMainWindow, public PlatformInterface { void closeEvent(QCloseEvent *e) override; void keyPressEvent(QKeyEvent *e) override; #ifdef Q_OS_WIN -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override; -#else +# else bool nativeEvent(const QByteArray &eventType, void *message, long *result) override; -#endif +# endif #endif // PlatformInterface diff --git a/src/core/metatypes.cpp b/src/core/metatypes.cpp index 36ff68fc..02d1aa66 100644 --- a/src/core/metatypes.cpp +++ b/src/core/metatypes.cpp @@ -75,7 +75,7 @@ #include "radios/radiochannel.h" #ifdef HAVE_LIBMTP - #include "device/mtpconnection.h" +# include "device/mtpconnection.h" #endif void RegisterMetaTypes() { diff --git a/src/core/player.cpp b/src/core/player.cpp index edad4e9e..02b6adbe 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -113,7 +113,7 @@ Engine::EngineType Player::CreateEngine(Engine::EngineType enginetype) { Engine::EngineType use_enginetype(Engine::None); for (int i = 0; use_enginetype == Engine::None; i++) { - switch(enginetype) { + switch (enginetype) { case Engine::None: #ifdef HAVE_GSTREAMER case Engine::GStreamer:{ @@ -126,18 +126,20 @@ Engine::EngineType Player::CreateEngine(Engine::EngineType enginetype) { #endif #ifdef HAVE_VLC case Engine::VLC: - use_enginetype=Engine::VLC; + use_enginetype = Engine::VLC; engine_ = std::make_shared(app_->task_manager()); break; #endif default: - if (i > 0) { qFatal("No engine available!"); } + if (i > 0) { + qFatal("No engine available!"); + } enginetype = Engine::None; break; } } - if (use_enginetype != enginetype) { // Engine was set to something else. Reset output and device. + if (use_enginetype != enginetype) { // Engine was set to something else. Reset output and device. QSettings s; s.beginGroup(BackendSettingsPage::kSettingsGroup); s.setValue("engine", EngineName(use_enginetype)); @@ -167,7 +169,9 @@ void Player::Init() { CreateEngine(enginetype); } - if (!engine_->Init()) { qFatal("Error initializing audio engine"); } + if (!engine_->Init()) { + qFatal("Error initializing audio engine"); + } analyzer_->SetEngine(engine_.get()); @@ -426,7 +430,7 @@ void Player::PlayPlaylistInternal(const Engine::TrackChangeFlags change, const P if (playlist == nullptr) { qLog(Warning) << "Playlist '" << playlist_name << "' not found."; return; - } + } app_->playlist_manager()->SetActivePlaylist(playlist->id()); app_->playlist_manager()->SetCurrentPlaylist(playlist->id()); @@ -515,7 +519,7 @@ void Player::UnPause() { const Song &song = current_item_->Metadata(); if (url_handlers_.contains(song.url().scheme()) && song.stream_url_can_expire()) { const quint64 time = QDateTime::currentDateTime().toSecsSinceEpoch() - pause_time_.toSecsSinceEpoch(); - if (time >= 30) { // Stream URL might be expired. + if (time >= 30) { // Stream URL might be expired. qLog(Debug) << "Re-requesting stream URL for" << song.url(); play_offset_nanosec_ = engine_->position_nanosec(); HandleLoadResult(url_handlers_[song.url().scheme()]->StartLoading(song.url())); diff --git a/src/core/scoped_cftyperef.h b/src/core/scoped_cftyperef.h index 53714b14..4f207ae2 100644 --- a/src/core/scoped_cftyperef.h +++ b/src/core/scoped_cftyperef.h @@ -17,7 +17,7 @@ // caller must own the object it gives to ScopedCFTypeRef<>, and relinquishes // an ownership claim to that object. ScopedCFTypeRef<> does not call // CFRetain(). -template +template class ScopedCFTypeRef { public: typedef CFT element_type; diff --git a/src/core/scopedgobject.h b/src/core/scopedgobject.h index 635afde3..e63e088d 100644 --- a/src/core/scopedgobject.h +++ b/src/core/scopedgobject.h @@ -27,7 +27,7 @@ #include -template +template class ScopedGObject { public: ScopedGObject() : object_(nullptr) {} diff --git a/src/core/simpletreeitem.h b/src/core/simpletreeitem.h index 817fd1be..3173476c 100644 --- a/src/core/simpletreeitem.h +++ b/src/core/simpletreeitem.h @@ -30,7 +30,7 @@ #include "simpletreemodel.h" -template +template class SimpleTreeItem { public: explicit SimpleTreeItem(int _type, SimpleTreeModel *_model); // For the root item @@ -58,13 +58,13 @@ class SimpleTreeItem { bool lazy_loaded; T *parent; - QList children; + QList children; QAbstractItemModel *child_model; SimpleTreeModel *model; }; -template +template SimpleTreeItem::SimpleTreeItem(int _type, SimpleTreeModel *_model) : type(_type), row(0), @@ -73,7 +73,7 @@ SimpleTreeItem::SimpleTreeItem(int _type, SimpleTreeModel *_model) child_model(nullptr), model(_model) {} -template +template SimpleTreeItem::SimpleTreeItem(int _type, const QString &_key, T *_parent) : type(_type), key(_key), @@ -87,7 +87,7 @@ SimpleTreeItem::SimpleTreeItem(int _type, const QString &_key, T *_parent) } } -template +template SimpleTreeItem::SimpleTreeItem(int _type, T *_parent) : type(_type), lazy_loaded(false), @@ -100,7 +100,7 @@ SimpleTreeItem::SimpleTreeItem(int _type, T *_parent) } } -template +template void SimpleTreeItem::InsertNotify(T *_parent) { parent = _parent; model = parent->model; @@ -111,7 +111,7 @@ void SimpleTreeItem::InsertNotify(T *_parent) { model->EndInsert(); } -template +template void SimpleTreeItem::DeleteNotify(int child_row) { model->BeginDelete(static_cast(this), child_row); delete children.takeAt(child_row); @@ -121,7 +121,7 @@ void SimpleTreeItem::DeleteNotify(int child_row) { model->EndDelete(); } -template +template void SimpleTreeItem::ClearNotify() { if (children.count()) { model->BeginDelete(static_cast(this), 0, children.count() - 1); @@ -133,17 +133,17 @@ void SimpleTreeItem::ClearNotify() { } } -template +template void SimpleTreeItem::ChangedNotify() { model->EmitDataChanged(static_cast(this)); } -template +template SimpleTreeItem::~SimpleTreeItem() { qDeleteAll(children); } -template +template void SimpleTreeItem::Delete(int child_row) { delete children.takeAt(child_row); @@ -151,7 +151,7 @@ void SimpleTreeItem::Delete(int child_row) { for (int i = child_row; i < children.count(); ++i) children[i]->row--; } -template +template T *SimpleTreeItem::ChildByKey(const QString &_key) const { for (T *child : children) { if (child->key == _key) return child; diff --git a/src/core/simpletreemodel.h b/src/core/simpletreemodel.h index bf1ed24b..2a56c033 100644 --- a/src/core/simpletreemodel.h +++ b/src/core/simpletreemodel.h @@ -27,7 +27,7 @@ #include #include -template +template class SimpleTreeModel : public QAbstractItemModel { public: explicit SimpleTreeModel(T *root = nullptr, QObject *parent = nullptr); @@ -59,17 +59,17 @@ class SimpleTreeModel : public QAbstractItemModel { T *root_; }; -template +template SimpleTreeModel::SimpleTreeModel(T *root, QObject *parent) : QAbstractItemModel(parent), root_(root) {} -template +template T *SimpleTreeModel::IndexToItem(const QModelIndex &idx) const { if (!idx.isValid()) return root_; return reinterpret_cast(idx.internalPointer()); } -template +template QModelIndex SimpleTreeModel::ItemToIndex(T *item) const { if (!item || !item->parent) return QModelIndex(); return createIndex(item->row, 0, item); @@ -80,7 +80,7 @@ int SimpleTreeModel::columnCount(const QModelIndex&) const { return 1; } -template +template QModelIndex SimpleTreeModel::index(int row, int, const QModelIndex &parent) const { T *parent_item = IndexToItem(parent); @@ -88,21 +88,20 @@ QModelIndex SimpleTreeModel::index(int row, int, const QModelIndex &parent) c return QModelIndex(); return ItemToIndex(parent_item->children[row]); - } -template +template QModelIndex SimpleTreeModel::parent(const QModelIndex &idx) const { return ItemToIndex(IndexToItem(idx)->parent); } -template +template int SimpleTreeModel::rowCount(const QModelIndex &parent) const { T *item = IndexToItem(parent); return item->children.count(); } -template +template bool SimpleTreeModel::hasChildren(const QModelIndex &parent) const { T *item = IndexToItem(parent); if (item->lazy_loaded) @@ -111,13 +110,13 @@ bool SimpleTreeModel::hasChildren(const QModelIndex &parent) const { return true; } -template +template bool SimpleTreeModel::canFetchMore(const QModelIndex &parent) const { T *item = IndexToItem(parent); return !item->lazy_loaded; } -template +template void SimpleTreeModel::fetchMore(const QModelIndex &parent) { T *item = IndexToItem(parent); if (!item->lazy_loaded) { @@ -125,29 +124,29 @@ void SimpleTreeModel::fetchMore(const QModelIndex &parent) { } } -template +template void SimpleTreeModel::BeginInsert(T *parent, int start, int end) { if (end == -1) end = start; beginInsertRows(ItemToIndex(parent), start, end); } -template +template void SimpleTreeModel::EndInsert() { endInsertRows(); } -template +template void SimpleTreeModel::BeginDelete(T *parent, int start, int end) { if (end == -1) end = start; beginRemoveRows(ItemToIndex(parent), start, end); } -template +template void SimpleTreeModel::EndDelete() { endRemoveRows(); } -template +template void SimpleTreeModel::EmitDataChanged(T *item) { QModelIndex index(ItemToIndex(item)); emit dataChanged(index, index); diff --git a/src/core/song.cpp b/src/core/song.cpp index a9023d66..2962b42c 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -178,7 +178,7 @@ struct Song::Private : public QSharedData { int year_; int originalyear_; QString genre_; - bool compilation_; // From the file tag + bool compilation_; // From the file tag QString composer_; QString performer_; QString grouping_; @@ -1117,7 +1117,7 @@ void Song::ToItdb(Itdb_Track *track) const { track->type1 = (d->filetype_ == FileType_MPEG ? 1 : 0); track->type2 = (d->filetype_ == FileType_MPEG ? 1 : 0); - track->mediatype = 1; // Audio + track->mediatype = 1; // Audio track->size = static_cast(d->filesize_); track->time_modified = d->mtime_; track->time_added = d->ctime_; diff --git a/src/core/stylehelper.cpp b/src/core/stylehelper.cpp index 977edb86..f0374c4a 100644 --- a/src/core/stylehelper.cpp +++ b/src/core/stylehelper.cpp @@ -367,7 +367,7 @@ QPixmap StyleHelper::disabledSideBarIcon(const QPixmap &enabledicon) { for (int y = 0; y < im.height(); ++y) { auto scanLine = reinterpret_cast(im.scanLine(y)); - for (int x=0; x(qGray(pixel)); *scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel)); @@ -390,34 +390,33 @@ void StyleHelper::drawCornerImage(const QImage &img, QPainter *painter, const QR const qreal bottomDIP = bottom * imagePixelRatio; const QSize size = img.size(); - if (top > 0) { //top - painter->drawImage(QRectF(rect.left() + left, rect.top(), rect.width() -right - left, top), img, QRectF(leftDIP, 0, size.width() - rightDIP - leftDIP, topDIP)); - if (left > 0) { //top-left + if (top > 0) { //top + painter->drawImage(QRectF(rect.left() + left, rect.top(), rect.width() - right - left, top), img, QRectF(leftDIP, 0, size.width() - rightDIP - leftDIP, topDIP)); + if (left > 0) { //top-left painter->drawImage(QRectF(rect.left(), rect.top(), left, top), img, QRectF(0, 0, leftDIP, topDIP)); } - if (right > 0) { //top-right + if (right > 0) { //top-right painter->drawImage(QRectF(rect.left() + rect.width() - right, rect.top(), right, top), img, QRectF(size.width() - rightDIP, 0, rightDIP, topDIP)); } } //left if (left > 0) { - painter->drawImage(QRectF(rect.left(), rect.top()+top, left, rect.height() - top - bottom), img, QRectF(0, topDIP, leftDIP, size.height() - bottomDIP - topDIP)); + painter->drawImage(QRectF(rect.left(), rect.top() + top, left, rect.height() - top - bottom), img, QRectF(0, topDIP, leftDIP, size.height() - bottomDIP - topDIP)); } //center - painter->drawImage(QRectF(rect.left() + left, rect.top()+top, rect.width() -right - left, rect.height() - bottom - top), img, QRectF(leftDIP, topDIP, size.width() - rightDIP - leftDIP, size.height() - bottomDIP - topDIP)); - if (right > 0) { //right - painter->drawImage(QRectF(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), img, QRectF(size.width() - rightDIP, topDIP, rightDIP, size.height() - bottomDIP - topDIP)); + painter->drawImage(QRectF(rect.left() + left, rect.top() + top, rect.width() - right - left, rect.height() - bottom - top), img, QRectF(leftDIP, topDIP, size.width() - rightDIP - leftDIP, size.height() - bottomDIP - topDIP)); + if (right > 0) { //right + painter->drawImage(QRectF(rect.left() + rect.width() - right, rect.top() + top, right, rect.height() - top - bottom), img, QRectF(size.width() - rightDIP, topDIP, rightDIP, size.height() - bottomDIP - topDIP)); } - if (bottom > 0) { //bottom - painter->drawImage(QRectF(rect.left() +left, rect.top() + rect.height() - bottom, rect.width() - right - left, bottom), img, QRectF(leftDIP, size.height() - bottomDIP, size.width() - rightDIP - leftDIP, bottomDIP)); - if (left > 0) { //bottom-left + if (bottom > 0) { //bottom + painter->drawImage(QRectF(rect.left() + left, rect.top() + rect.height() - bottom, rect.width() - right - left, bottom), img, QRectF(leftDIP, size.height() - bottomDIP, size.width() - rightDIP - leftDIP, bottomDIP)); + if (left > 0) { //bottom-left painter->drawImage(QRectF(rect.left(), rect.top() + rect.height() - bottom, left, bottom), img, QRectF(0, size.height() - bottomDIP, leftDIP, bottomDIP)); } - if (right > 0) { //bottom-right + if (right > 0) { //bottom-right painter->drawImage(QRectF(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), img, QRectF(size.width() - rightDIP, size.height() - bottomDIP, rightDIP, bottomDIP)); } } - } // Tints an image with tintColor, while preserving alpha and lightness @@ -485,7 +484,6 @@ QList StyleHelper::availableImageResolutions(const QString &fileName) { } } return result; - } -} // namespace Utils +} // namespace Utils diff --git a/src/core/stylehelper.h b/src/core/stylehelper.h index 8bfc85fd..12fc774b 100644 --- a/src/core/stylehelper.h +++ b/src/core/stylehelper.h @@ -41,67 +41,66 @@ QT_END_NAMESPACE // Helper class holding all custom color values namespace Utils { -class StyleHelper -{ -public: - static const unsigned int DEFAULT_BASE_COLOR = 0x666666; - static const int progressFadeAnimationDuration = 600; +class StyleHelper { + public: + static const unsigned int DEFAULT_BASE_COLOR = 0x666666; + static const int progressFadeAnimationDuration = 600; - // Height of the project explorer navigation bar - static int navigationWidgetHeight() { return 24; } - static qreal sidebarFontSize(); - static QPalette sidebarFontPalette(const QPalette &original); + // Height of the project explorer navigation bar + static int navigationWidgetHeight() { return 24; } + static qreal sidebarFontSize(); + static QPalette sidebarFontPalette(const QPalette &original); - // This is our color table, all colors derive from baseColor - static QColor requestedBaseColor() { return m_requestedBaseColor; } - static QColor baseColor(bool lightColored = false); - static QColor panelTextColor(bool lightColored = false); - static QColor highlightColor(bool lightColored = false); - static QColor shadowColor(bool lightColored = false); - static QColor borderColor(bool lightColored = false); - static QColor toolBarBorderColor(); - static QColor buttonTextColor() { return QColor(0x4c4c4c); } - static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50); - static QColor alphaBlendedColors(const QColor &colorA, const QColor &colorB); + // This is our color table, all colors derive from baseColor + static QColor requestedBaseColor() { return m_requestedBaseColor; } + static QColor baseColor(bool lightColored = false); + static QColor panelTextColor(bool lightColored = false); + static QColor highlightColor(bool lightColored = false); + static QColor shadowColor(bool lightColored = false); + static QColor borderColor(bool lightColored = false); + static QColor toolBarBorderColor(); + static QColor buttonTextColor() { return QColor(0x4c4c4c); } + static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50); + static QColor alphaBlendedColors(const QColor &colorA, const QColor &colorB); - static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); } - static QColor sidebarShadow() { return QColor(0, 0, 0, 40); } + static QColor sidebarHighlight() { return QColor(255, 255, 255, 40); } + static QColor sidebarShadow() { return QColor(0, 0, 0, 40); } - static QColor toolBarDropShadowColor() { return QColor(0, 0, 0, 70); } + static QColor toolBarDropShadowColor() { return QColor(0, 0, 0, 70); } - static QColor notTooBrightHighlightColor(); + static QColor notTooBrightHighlightColor(); - // Sets the base color and makes sure all top level widgets are updated - static void setBaseColor(const QColor &color); + // Sets the base color and makes sure all top level widgets are updated + static void setBaseColor(const QColor &color); - // Draws a shaded anti-aliased arrow - static void drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option); + // Draws a shaded anti-aliased arrow + static void drawArrow(QStyle::PrimitiveElement element, QPainter *painter, const QStyleOption *option); - // Gradients used for panels - static void horizontalGradient(QPainter *painter, const QRect spanRect, const QRect clipRect, bool lightColored = false); - static void verticalGradient(QPainter *painter, const QRect spanRect, const QRect clipRect, bool lightColored = false); - static void menuGradient(QPainter *painter, const QRect spanRect, const QRect clipRect); - static bool usePixmapCache() { return true; } + // Gradients used for panels + static void horizontalGradient(QPainter *painter, const QRect spanRect, const QRect clipRect, bool lightColored = false); + static void verticalGradient(QPainter *painter, const QRect spanRect, const QRect clipRect, bool lightColored = false); + static void menuGradient(QPainter *painter, const QRect spanRect, const QRect clipRect); + static bool usePixmapCache() { return true; } - static QPixmap disabledSideBarIcon(const QPixmap &enabledicon); - static void drawCornerImage(const QImage &img, QPainter *painter, const QRect rect, int left = 0, int top = 0, int right = 0, int bottom = 0); + static QPixmap disabledSideBarIcon(const QPixmap &enabledicon); + static void drawCornerImage(const QImage &img, QPainter *painter, const QRect rect, int left = 0, int top = 0, int right = 0, int bottom = 0); - static void tintImage(QImage &img, const QColor &tintColor); - static QLinearGradient statusBarGradient(const QRect statusBarRect); + static void tintImage(QImage &img, const QColor &tintColor); + static QLinearGradient statusBarGradient(const QRect statusBarRect); - static QString dpiSpecificImageFile(const QString &fileName); - static QString imageFileWithResolution(const QString &fileName, int dpr); - static QList availableImageResolutions(const QString &fileName); + static QString dpiSpecificImageFile(const QString &fileName); + static QString imageFileWithResolution(const QString &fileName, int dpr); + static QList availableImageResolutions(const QString &fileName); -private: - static QColor m_baseColor; - static QColor m_requestedBaseColor; - static QColor m_IconsBaseColor; - static QColor m_IconsDisabledColor; - static QColor m_ProgressBarTitleColor; + private: + static QColor m_baseColor; + static QColor m_requestedBaseColor; + static QColor m_IconsBaseColor; + static QColor m_IconsDisabledColor; + static QColor m_ProgressBarTitleColor; }; -} // namespace Utils +} // namespace Utils using Utils::StyleHelper; -#endif // STYLEHELPER_H +#endif // STYLEHELPER_H diff --git a/src/core/tagreaderclient.h b/src/core/tagreaderclient.h index 61cf8a5f..36ae4dba 100644 --- a/src/core/tagreaderclient.h +++ b/src/core/tagreaderclient.h @@ -37,7 +37,7 @@ class QThread; class Song; -template class WorkerPool; +template class WorkerPool; class TagReaderClient : public QObject { Q_OBJECT @@ -58,8 +58,8 @@ class TagReaderClient : public QObject { ReplyType *IsMediaFile(const QString &filename); ReplyType *LoadEmbeddedArt(const QString &filename); ReplyType *SaveEmbeddedArt(const QString &filename, const QByteArray &data); - ReplyType* UpdateSongPlaycount(const Song &metadata); - ReplyType* UpdateSongRating(const Song &metadata); + ReplyType *UpdateSongPlaycount(const Song &metadata); + ReplyType *UpdateSongRating(const Song &metadata); // Convenience functions that call the above functions and wait for a response. // These block the calling thread with a semaphore, and must NOT be called from the TagReaderClient's thread. diff --git a/src/core/utilities.cpp b/src/core/utilities.cpp index e71e782a..51bb14bc 100644 --- a/src/core/utilities.cpp +++ b/src/core/utilities.cpp @@ -376,11 +376,11 @@ void OpenInFileManager(const QString &path, const QUrl &url) { QString cmd = setting.value("Exec").toString(); if (cmd.isEmpty()) break; cmd = cmd.remove(QRegularExpression("[%][a-zA-Z]*( |$)", QRegularExpression::CaseInsensitiveOption)); -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +# if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) command_params = cmd.split(' ', Qt::SkipEmptyParts); -#else +# else command_params = cmd.split(' ', QString::SkipEmptyParts); -#endif +# endif command = command_params.first(); command_params.removeFirst(); } @@ -800,9 +800,9 @@ QString UnicodeToAscii(QString unicode) { #else -#ifdef LC_ALL +# ifdef LC_ALL setlocale(LC_ALL, ""); -#endif +# endif iconv_t conv = iconv_open("ASCII//TRANSLIT", "UTF-8"); if (conv == reinterpret_cast(-1)) return unicode; @@ -830,8 +830,7 @@ QString UnicodeToAscii(QString unicode) { return ret; -#endif // _MSC_VER - +#endif // _MSC_VER } QString MacAddress() { @@ -988,9 +987,9 @@ HRGN qt_RectToHRGN(const QRect &rc) { HRGN toHRGN(const QRegion ®ion); HRGN toHRGN(const QRegion ®ion) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) return region.toHRGN(); -#else +# else const int rect_count = region.rectCount(); if (rect_count == 0) { @@ -1009,13 +1008,12 @@ HRGN toHRGN(const QRegion ®ion) { return resultRgn; -#endif // Qt 6 - +# endif // Qt 6 } void enableBlurBehindWindow(QWindow *window, const QRegion ®ion) { - DWM_BLURBEHIND dwmbb = {0, 0, nullptr, 0}; + DWM_BLURBEHIND dwmbb = { 0, 0, nullptr, 0 }; dwmbb.dwFlags = DWM_BB_ENABLE; dwmbb.fEnable = TRUE; HRGN rgn = nullptr; diff --git a/src/core/utilities.h b/src/core/utilities.h index a6fac205..595c10dd 100644 --- a/src/core/utilities.h +++ b/src/core/utilities.h @@ -115,11 +115,11 @@ enum IoPriority { IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE, }; - enum { - IOPRIO_WHO_PROCESS = 1, - IOPRIO_WHO_PGRP, - IOPRIO_WHO_USER, - }; +enum { + IOPRIO_WHO_PROCESS = 1, + IOPRIO_WHO_PGRP, + IOPRIO_WHO_USER, +}; static const int IOPRIO_CLASS_SHIFT = 13; long SetThreadIOPriority(const IoPriority priority); @@ -157,10 +157,10 @@ class ScopedWCharArray { QString ToString() const { return QString::fromWCharArray(data_.get()); } wchar_t *get() const { return data_.get(); } - explicit operator wchar_t*() const { return get(); } + explicit operator wchar_t *() const { return get(); } qint64 characters() const { return chars_; } - qint64 bytes() const { return (chars_ + 1) *sizeof(wchar_t); } + qint64 bytes() const { return (chars_ + 1) * sizeof(wchar_t); } private: Q_DISABLE_COPY(ScopedWCharArray) diff --git a/src/core/windows7thumbbar.cpp b/src/core/windows7thumbbar.cpp index 7187c082..26b6a4d8 100644 --- a/src/core/windows7thumbbar.cpp +++ b/src/core/windows7thumbbar.cpp @@ -30,7 +30,7 @@ #include #ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0600 +# define _WIN32_WINNT 0x0600 #endif #include @@ -77,24 +77,23 @@ ITaskbarList3 *Windows7ThumbBar::CreateTaskbarList() { ITaskbarList3 *taskbar_list = nullptr; // Copied from win7 SDK shobjidl.h - static const GUID CLSID_ITaskbarList = { 0x56FDF344,0xFD6D,0x11d0,{0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90}}; + static const GUID CLSID_ITaskbarList = { 0x56FDF344, 0xFD6D, 0x11d0, { 0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90 } }; // Create the taskbar list HRESULT hr = CoCreateInstance(CLSID_ITaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, reinterpret_cast(&taskbar_list)); if (hr != S_OK) { - qLog(Warning) << "Error creating the ITaskbarList3 interface" << Qt::hex << DWORD (hr); + qLog(Warning) << "Error creating the ITaskbarList3 interface" << Qt::hex << DWORD(hr); return nullptr; } hr = taskbar_list->HrInit(); if (hr != S_OK) { - qLog(Warning) << "Error initializing taskbar list" << Qt::hex << DWORD (hr); + qLog(Warning) << "Error initializing taskbar list" << Qt::hex << DWORD(hr); taskbar_list->Release(); return nullptr; } return taskbar_list; - } void Windows7ThumbBar::SetupButton(const QAction *action, THUMBBUTTON *button) { @@ -145,7 +144,7 @@ void Windows7ThumbBar::HandleWinEvent(MSG *msg) { qLog(Debug) << "Adding" << actions_.count() << "buttons"; HRESULT hr = taskbar_list->ThumbBarAddButtons(reinterpret_cast(widget_->winId()), actions_.count(), buttons); if (hr != S_OK) { - qLog(Debug) << "Failed to add buttons" << Qt::hex << DWORD (hr); + qLog(Debug) << "Failed to add buttons" << Qt::hex << DWORD(hr); } for (int i = 0; i < actions_.count(); ++i) { @@ -188,12 +187,11 @@ void Windows7ThumbBar::ActionChanged() { button->iId = i; SetupButton(action, button); - } HRESULT hr = taskbar_list->ThumbBarUpdateButtons(reinterpret_cast(widget_->winId()), actions_.count(), buttons); if (hr != S_OK) { - qLog(Debug) << "Failed to update buttons" << Qt::hex << DWORD (hr); + qLog(Debug) << "Failed to update buttons" << Qt::hex << DWORD(hr); } for (int i = 0; i < actions_.count(); ++i) { diff --git a/src/covermanager/albumcoverchoicecontroller.cpp b/src/covermanager/albumcoverchoicecontroller.cpp index d8004e6c..fb95535f 100644 --- a/src/covermanager/albumcoverchoicecontroller.cpp +++ b/src/covermanager/albumcoverchoicecontroller.cpp @@ -211,7 +211,7 @@ QUrl AlbumCoverChoiceController::LoadCoverFromFile(Song *song) { if (QImage(cover_file).isNull()) return QUrl(); - switch(get_save_album_cover_type()) { + switch (get_save_album_cover_type()) { case CollectionSettingsPage::SaveCoverType_Embedded: if (song->save_embedded_cover_supported()) { SaveCoverEmbeddedAutomatic(*song, cover_file); diff --git a/src/covermanager/albumcoverloader.cpp b/src/covermanager/albumcoverloader.cpp index 9d285003..12397302 100644 --- a/src/covermanager/albumcoverloader.cpp +++ b/src/covermanager/albumcoverloader.cpp @@ -673,7 +673,7 @@ void AlbumCoverLoader::SaveEmbeddedCover(const quint64 id, const QList &ur } if (!file.open(QIODevice::ReadOnly)) { - qLog(Error) << "Failed to open cover file" << cover_filename << "for reading:" << file.errorString(); + qLog(Error) << "Failed to open cover file" << cover_filename << "for reading:" << file.errorString(); emit SaveEmbeddedCoverAsyncFinished(id, false, false); return; } diff --git a/src/covermanager/coversearchstatistics.cpp b/src/covermanager/coversearchstatistics.cpp index 982c6f8e..824a7371 100644 --- a/src/covermanager/coversearchstatistics.cpp +++ b/src/covermanager/coversearchstatistics.cpp @@ -33,7 +33,7 @@ CoverSearchStatistics::CoverSearchStatistics() chosen_width_(0), chosen_height_(0) {} -CoverSearchStatistics &CoverSearchStatistics::operator +=(const CoverSearchStatistics &other) { +CoverSearchStatistics &CoverSearchStatistics::operator+=(const CoverSearchStatistics &other) { network_requests_made_ += other.network_requests_made_; bytes_transferred_ += other.bytes_transferred_; diff --git a/src/covermanager/coversearchstatistics.h b/src/covermanager/coversearchstatistics.h index 6a1400fd..0fa0875b 100644 --- a/src/covermanager/coversearchstatistics.h +++ b/src/covermanager/coversearchstatistics.h @@ -32,7 +32,7 @@ struct CoverSearchStatistics { explicit CoverSearchStatistics(); - CoverSearchStatistics &operator +=(const CoverSearchStatistics &other); + CoverSearchStatistics &operator+=(const CoverSearchStatistics &other); quint64 network_requests_made_; quint64 bytes_transferred_; diff --git a/src/covermanager/discogscoverprovider.cpp b/src/covermanager/discogscoverprovider.cpp index 83326ec5..f40b46da 100644 --- a/src/covermanager/discogscoverprovider.cpp +++ b/src/covermanager/discogscoverprovider.cpp @@ -383,7 +383,7 @@ void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int se continue; } QJsonObject obj_artist = value_artist.toObject(); - if (!obj_artist.contains("name") ) { + if (!obj_artist.contains("name")) { Error("Invalid Json reply, artists array value object is missing name.", obj_artist); continue; } diff --git a/src/covermanager/spotifycoverprovider.cpp b/src/covermanager/spotifycoverprovider.cpp index 100130ec..9aed35ed 100644 --- a/src/covermanager/spotifycoverprovider.cpp +++ b/src/covermanager/spotifycoverprovider.cpp @@ -111,7 +111,10 @@ void SpotifyCoverProvider::Authenticate() { bool success = false; forever { server_->set_port(port); - if (server_->Listen()) { success = true; break; } + if (server_->Listen()) { + success = true; + break; + } ++port; if (port > port_max) break; } diff --git a/src/covermanager/tidalcoverprovider.h b/src/covermanager/tidalcoverprovider.h index 0f62c9bd..3fda6d40 100644 --- a/src/covermanager/tidalcoverprovider.h +++ b/src/covermanager/tidalcoverprovider.h @@ -50,7 +50,9 @@ class TidalCoverProvider : public JsonCoverProvider { void CancelSearch(const int id) override; bool IsAuthenticated() const override { return service_ && service_->authenticated(); } - void Deauthenticate() override { if (service_) service_->Logout(); } + void Deauthenticate() override { + if (service_) service_->Logout(); + } private slots: void HandleSearchReply(QNetworkReply *reply, const int id); diff --git a/src/device/cddasongloader.cpp b/src/device/cddasongloader.cpp index ebfb3504..88879eba 100644 --- a/src/device/cddasongloader.cpp +++ b/src/device/cddasongloader.cpp @@ -156,7 +156,7 @@ void CddaSongLoader::LoadSongs() { GstMessage *msg_tag = nullptr; while ((msg = gst_bus_timed_pop_filtered(GST_ELEMENT_BUS(pipeline), GST_SECOND, static_cast(GST_MESSAGE_TOC | GST_MESSAGE_TAG)))) { if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_TOC) { - if (msg_toc) gst_message_unref(msg_toc); // Shouldn't happen, but just in case + if (msg_toc) gst_message_unref(msg_toc); // Shouldn't happen, but just in case msg_toc = msg; } else if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_TAG) { diff --git a/src/device/devicemanager.h b/src/device/devicemanager.h index c06e2606..2dc131ae 100644 --- a/src/device/devicemanager.h +++ b/src/device/devicemanager.h @@ -141,7 +141,7 @@ class DeviceManager : public SimpleTreeModel { private: void AddLister(DeviceLister *lister); - template void AddDeviceClass(); + template void AddDeviceClass(); DeviceDatabaseBackend::Device InfoToDatabaseDevice(const DeviceInfo &info) const; @@ -173,7 +173,7 @@ class DeviceManager : public SimpleTreeModel { }; -template +template void DeviceManager::AddDeviceClass() { QStringList schemes = T::url_schemes(); QMetaObject obj = T::staticMetaObject; diff --git a/src/device/filesystemdevice.cpp b/src/device/filesystemdevice.cpp index dcbd39ea..7bb49ce2 100644 --- a/src/device/filesystemdevice.cpp +++ b/src/device/filesystemdevice.cpp @@ -40,10 +40,10 @@ 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)) { + : 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)) { watcher_->moveToThread(watcher_thread_); watcher_thread_->start(QThread::IdlePriority); diff --git a/src/device/giolister.cpp b/src/device/giolister.cpp index 576f4eda..ab742c8d 100644 --- a/src/device/giolister.cpp +++ b/src/device/giolister.cpp @@ -70,10 +70,9 @@ bool GioLister::DeviceInfo::is_suitable() const { if (filesystem_type.isEmpty()) return true; return filesystem_type != "udf" && filesystem_type != "smb" && filesystem_type != "cifs" && filesystem_type != "ssh" && filesystem_type != "isofs"; - } -template +template void OperationFinished(F f, GObject *object, GAsyncResult *result) { T *obj = reinterpret_cast(object); diff --git a/src/device/giolister.h b/src/device/giolister.h index 9c0e8ee0..47af888a 100644 --- a/src/device/giolister.h +++ b/src/device/giolister.h @@ -137,7 +137,7 @@ class GioLister : public DeviceLister { QString FindUniqueIdByMount(GMount *mount) const; QString FindUniqueIdByVolume(GVolume *volume) const; - template + template T LockAndGetDeviceInfo(const QString &id, T DeviceInfo::*field); private: @@ -148,7 +148,7 @@ class GioLister : public DeviceLister { QMap devices_; }; -template +template T GioLister::LockAndGetDeviceInfo(const QString &id, T DeviceInfo::*field) { QMutexLocker l(&mutex_); if (!devices_.contains(id)) return T(); diff --git a/src/device/macosdevicelister.h b/src/device/macosdevicelister.h index 534b5d16..eca2e68f 100644 --- a/src/device/macosdevicelister.h +++ b/src/device/macosdevicelister.h @@ -84,12 +84,12 @@ class MacOsDeviceLister : public DeviceLister { private: bool Init(); - static void DiskAddedCallback(DADiskRef disk, void* context); - static void DiskRemovedCallback(DADiskRef disk, void* context); + static void DiskAddedCallback(DADiskRef disk, void *context); + static void DiskRemovedCallback(DADiskRef disk, void *context); static void USBDeviceAddedCallback(void *refcon, io_iterator_t it); static void USBDeviceRemovedCallback(void *refcon, io_iterator_t it); - static void DiskUnmountCallback(DADiskRef disk, DADissenterRef dissenter, void* context); + static void DiskUnmountCallback(DADiskRef disk, DADissenterRef dissenter, void *context); void FoundMTPDevice(const MTPDevice &device, const QString &serial); void RemovedMTPDevice(const QString &serial); diff --git a/src/dialogs/console.cpp b/src/dialogs/console.cpp index 6ea3506a..002c6471 100644 --- a/src/dialogs/console.cpp +++ b/src/dialogs/console.cpp @@ -44,7 +44,7 @@ Console::Console(Application *app, QWidget *parent) : QDialog(parent), ui_{}, ap ui_.setupUi(this); - setWindowFlags(windowFlags()|Qt::WindowMaximizeButtonHint); + setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); QObject::connect(ui_.run, &QPushButton::clicked, this, &Console::RunQuery); diff --git a/src/engine/alsadevicefinder.cpp b/src/engine/alsadevicefinder.cpp index b3536110..ca9337ce 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/alsapcmdevicefinder.cpp b/src/engine/alsapcmdevicefinder.cpp index 0341db5a..a2491a08 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/enginebase.cpp b/src/engine/enginebase.cpp index 19042f96..a06a957b 100644 --- a/src/engine/enginebase.cpp +++ b/src/engine/enginebase.cpp @@ -94,19 +94,17 @@ bool Engine::Base::Play(const QUrl &stream_url, const QUrl &original_url, const } return Play(offset_nanosec); - } void Engine::Base::SetVolume(const uint value) { volume_ = value; SetVolumeSW(MakeVolumeLogarithmic(value)); - } uint Engine::Base::MakeVolumeLogarithmic(const uint volume) { // We're using a logarithmic function to make the volume ramp more natural. - return static_cast( 100 - 100.0 * std::log10( ( 100 - volume ) * 0.09 + 1.0 ) ); + return static_cast(100 - 100.0 * std::log10((100 - volume) * 0.09 + 1.0)); } void Engine::Base::ReloadSettings() { diff --git a/src/engine/gstengine.cpp b/src/engine/gstengine.cpp index a79e8e1e..d2daca17 100644 --- a/src/engine/gstengine.cpp +++ b/src/engine/gstengine.cpp @@ -865,7 +865,7 @@ void GstEngine::UpdateScope(const int chunk_length) { // Make sure we don't go beyond the end of the buffer if (scope_chunk_ == scope_chunks_ - 1) { - bytes = qMin(static_cast(map.size - (chunk_size * scope_chunk_)), scope_.size() * sizeof(sample_type)); + bytes = qMin(static_cast(map.size - (chunk_size * scope_chunk_)), scope_.size() * sizeof(sample_type)); } else { bytes = qMin(static_cast(chunk_size), scope_.size() * sizeof(sample_type)); diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index 38099e98..9138f7aa 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -564,7 +564,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { // Link all elements - GstElement *next = audioqueue_; // The next element to link from. + GstElement *next = audioqueue_; // The next element to link from. // Link replaygain elements if enabled. if (rg_enabled_ && rgvolume && rglimiter && rgconverter) { @@ -645,7 +645,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { gst_caps_unref(caps); } - { // Add probes and handlers. + { // Add probes and handlers. GstPad *pad = gst_element_get_static_pad(audioqueue_, "src"); if (pad) { gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, HandoffCallback, this, nullptr); @@ -894,7 +894,7 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf int16_t *s16 = static_cast(g_malloc(buf16_size)); memset(s16, 0, buf16_size); for (int i = 0; i < (samples * channels); ++i) { - s16[i] = *(reinterpret_cast(s24+1)); + s16[i] = *(reinterpret_cast(s24 + 1)); s24 += 3; if (s24 >= s24e) break; } @@ -919,7 +919,7 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf memset(s16, 0, buf16_size); for (int i = 0; i < (samples * channels); ++i) { char *s24 = reinterpret_cast(s32p); - s16[i] = *(reinterpret_cast(s24+1)); + s16[i] = *(reinterpret_cast(s24 + 1)); ++s32p; if (s32p > s32e) break; } diff --git a/src/engine/gststartup.cpp b/src/engine/gststartup.cpp index 0a6e458a..d491a167 100644 --- a/src/engine/gststartup.cpp +++ b/src/engine/gststartup.cpp @@ -120,17 +120,17 @@ void GstStartup::SetEnvironment() { QString gst_registry_filename; #ifdef USE_BUNDLE -#if defined(Q_OS_WIN32) || defined(Q_OS_MACOS) +# if defined(Q_OS_WIN32) || defined(Q_OS_MACOS) gio_module_path = bundle_path + "/gio-modules"; -#endif -#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) +# endif +# if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) gst_plugin_scanner = bundle_path + "/gst-plugin-scanner"; gst_plugin_path = bundle_path + "/gstreamer"; -#endif -#if defined(Q_OS_WIN32) +# endif +# if defined(Q_OS_WIN32) //gst_plugin_scanner = bundle_path + "/gst-plugin-scanner.exe"; gst_plugin_path = bundle_path + "/gstreamer-plugins"; -#endif +# endif #endif #if defined(Q_OS_WIN32) || defined(Q_OS_MACOS) diff --git a/src/engine/macosdevicefinder.cpp b/src/engine/macosdevicefinder.cpp index 6c045977..5931da7b 100644 --- a/src/engine/macosdevicefinder.cpp +++ b/src/engine/macosdevicefinder.cpp @@ -34,7 +34,7 @@ namespace { -template +template std::unique_ptr GetProperty(const AudioDeviceID &device_id, const AudioObjectPropertyAddress &address, UInt32 *size_bytes_out = nullptr) { UInt32 size_bytes = 0; diff --git a/src/engine/pulsedevicefinder.cpp b/src/engine/pulsedevicefinder.cpp index 12d27686..7a12dfaf 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() { @@ -97,17 +97,17 @@ retry: } switch (pa_context_get_state(context_)) { - case PA_CONTEXT_READY: - break; - case PA_CONTEXT_FAILED: - case PA_CONTEXT_TERMINATED: - // Maybe pulseaudio died. Try reconnecting. - if (Reconnect()) { - goto retry; - } - return state.devices; - default: - return state.devices; + case PA_CONTEXT_READY: + break; + case PA_CONTEXT_FAILED: + case PA_CONTEXT_TERMINATED: + // Maybe pulseaudio died. Try reconnecting. + if (Reconnect()) { + goto retry; + } + return state.devices; + default: + return state.devices; } pa_mainloop_iterate(mainloop_, true, nullptr); diff --git a/src/engine/vlcscopedref.h b/src/engine/vlcscopedref.h index 855575e8..a91c4ef3 100644 --- a/src/engine/vlcscopedref.h +++ b/src/engine/vlcscopedref.h @@ -25,14 +25,14 @@ #include -template +template class VlcScopedRef { public: explicit VlcScopedRef(T *ptr); ~VlcScopedRef(); - operator T*() const { return ptr_; } - operator bool () const { return ptr_; } + operator T *() const { return ptr_; } + operator bool() const { return ptr_; } T *operator->() const { return ptr_; } private: @@ -49,23 +49,23 @@ class VlcScopedRef { } #define VLCSCOPEDREF_DEFINE(type) VLCSCOPEDREF_DEFINE2(type, libvlc_##type##_release) -template +template void VlcScopedRef_Release(T *ptr); VLCSCOPEDREF_DEFINE2(instance, libvlc_release) VLCSCOPEDREF_DEFINE(media_player) VLCSCOPEDREF_DEFINE(media) -template <> void VlcScopedRef_Release(char *ptr) { free(ptr); } +template<> void VlcScopedRef_Release(char *ptr) { free(ptr); } -template +template VlcScopedRef::VlcScopedRef(T *ptr) - : ptr_(ptr) { + : ptr_(ptr) { } -template +template VlcScopedRef::~VlcScopedRef() { VlcScopedRef_Release(ptr_); } -#endif // VLCSCOPEDREF_H +#endif // VLCSCOPEDREF_H diff --git a/src/equalizer/equalizer.cpp b/src/equalizer/equalizer.cpp index 0b65f2ad..939bff9b 100644 --- a/src/equalizer/equalizer.cpp +++ b/src/equalizer/equalizer.cpp @@ -384,11 +384,10 @@ bool Equalizer::Params::operator==(const Equalizer::Params &other) const { if (gain[i] != other.gain[i]) return false; } return true; - } bool Equalizer::Params::operator!=(const Equalizer::Params &other) const { - return ! (*this == other); + return !(*this == other); } QDataStream &operator<<(QDataStream &s, const Equalizer::Params &p) { diff --git a/src/equalizer/equalizer.h b/src/equalizer/equalizer.h index 2a9ffd49..1e132d83 100644 --- a/src/equalizer/equalizer.h +++ b/src/equalizer/equalizer.h @@ -56,7 +56,7 @@ class Equalizer : public QDialog { bool operator!=(const Params &other) const; int preamp; - int gain[kBands]{}; + int gain[kBands] {}; }; bool is_equalizer_enabled() const; @@ -100,7 +100,7 @@ class Equalizer : public QDialog { QString last_preset_; EqualizerSlider *preamp_; - EqualizerSlider *gain_[kBands]{}; + EqualizerSlider *gain_[kBands] {}; QMap presets_; }; diff --git a/src/globalshortcuts/globalshortcut-x11.cpp b/src/globalshortcuts/globalshortcut-x11.cpp index 5ec70d40..eeff36fd 100644 --- a/src/globalshortcuts/globalshortcut-x11.cpp +++ b/src/globalshortcuts/globalshortcut-x11.cpp @@ -39,11 +39,11 @@ #include #if QT_VERSION < QT_VERSION_CHECK(6, 2, 0) -#if defined(HAVE_X11EXTRAS) -# include -#elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) -# include -#endif +# if defined(HAVE_X11EXTRAS) +# include +# elif defined(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H) +# include +# endif #endif const QVector GlobalShortcut::mask_modifiers_ = QVector() << 0 << Mod2Mask << LockMask << (Mod2Mask | LockMask); @@ -57,7 +57,7 @@ Display *X11Display() { if (!qApp) return nullptr; if (QNativeInterface::QX11Application *x11_app = qApp->nativeInterface()) { - return x11_app->display(); + return x11_app->display(); } return nullptr; diff --git a/src/globalshortcuts/globalshortcutsbackend.cpp b/src/globalshortcuts/globalshortcutsbackend.cpp index 6ef1165f..e476b4a9 100644 --- a/src/globalshortcuts/globalshortcutsbackend.cpp +++ b/src/globalshortcuts/globalshortcutsbackend.cpp @@ -33,7 +33,7 @@ GlobalShortcutsBackend::GlobalShortcutsBackend(GlobalShortcutsManager *manager, QString GlobalShortcutsBackend::name() const { - switch(type_) { + switch (type_) { case Type_None: return "None"; case Type_KDE: diff --git a/src/globalshortcuts/globalshortcutsmanager.cpp b/src/globalshortcuts/globalshortcutsmanager.cpp index 35efd53b..6fe9491e 100644 --- a/src/globalshortcuts/globalshortcutsmanager.cpp +++ b/src/globalshortcuts/globalshortcutsmanager.cpp @@ -170,29 +170,25 @@ GlobalShortcutsManager::Shortcut GlobalShortcutsManager::AddShortcut(const QStri bool GlobalShortcutsManager::IsKdeAvailable() { return GlobalShortcutsBackendKDE::IsKDEAvailable(); - } bool GlobalShortcutsManager::IsGnomeAvailable() { return GlobalShortcutsBackendGnome::IsGnomeAvailable(); - } bool GlobalShortcutsManager::IsMateAvailable() { return GlobalShortcutsBackendMate::IsMateAvailable(); - } -# endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS) +#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS) #ifdef HAVE_X11_GLOBALSHORTCUTS bool GlobalShortcutsManager::IsX11Available() { return GlobalShortcutsBackendX11::IsX11Available(); - } #endif // HAVE_X11_GLOBALSHORTCUTS diff --git a/src/internet/internetcollectionview.cpp b/src/internet/internetcollectionview.cpp index 82bd36fd..2ae024a5 100644 --- a/src/internet/internetcollectionview.cpp +++ b/src/internet/internetcollectionview.cpp @@ -390,7 +390,7 @@ void InternetCollectionView::AddToPlaylistEnqueueNext() { void InternetCollectionView::OpenInNewPlaylist() { QMimeData *q_mimedata = model()->mimeData(selectedIndexes()); - if (MimeData* mimedata = qobject_cast(q_mimedata)) { + if (MimeData *mimedata = qobject_cast(q_mimedata)) { mimedata->open_in_new_playlist_ = true; } emit AddToPlaylistSignal(q_mimedata); diff --git a/src/main.cpp b/src/main.cpp index 749f1bee..3dfd3784 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,11 +39,11 @@ #endif #ifdef Q_OS_WIN32 - #ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0600 - #endif - #include - #include +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0600 +# endif +# include +# include #endif // Q_OS_WIN32 #include @@ -265,19 +265,19 @@ int main(int argc, char *argv[]) { std::unique_ptr translations(new Translations); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) translations->LoadTranslation("qt", QLibraryInfo::path(QLibraryInfo::TranslationsPath), language); -#else +# else translations->LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language); -#endif +# endif translations->LoadTranslation("strawberry", ":/translations", language); translations->LoadTranslation("strawberry", TRANSLATIONS_DIR, language); translations->LoadTranslation("strawberry", QCoreApplication::applicationDirPath(), language); translations->LoadTranslation("strawberry", QDir::currentPath(), language); -#ifdef HAVE_QTSPARKLE +# ifdef HAVE_QTSPARKLE //qtsparkle::LoadTranslations(language); -#endif +# endif #endif diff --git a/src/organize/organize.h b/src/organize/organize.h index 8b8a16de..6b54a131 100644 --- a/src/organize/organize.h +++ b/src/organize/organize.h @@ -94,8 +94,8 @@ class Organize : public QObject { private: struct Task { explicit Task(const NewSongInfo &song_info = NewSongInfo()) - : song_info_(song_info), - transcode_progress_(0.0) {} + : 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 865856e2..aa44db3b 100644 --- a/src/organize/organizedialog.cpp +++ b/src/organize/organizedialog.cpp @@ -88,7 +88,7 @@ OrganizeDialog::OrganizeDialog(TaskManager *task_manager, CollectionBackend *bac ui_->setupUi(this); - setWindowFlags(windowFlags()|Qt::WindowMaximizeButtonHint); + setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); QPushButton *button_save = ui_->button_box->addButton("Save settings", QDialogButtonBox::ApplyRole); QObject::connect(button_save, &QPushButton::clicked, this, &OrganizeDialog::SaveSettings); diff --git a/src/organize/organizeformat.cpp b/src/organize/organizeformat.cpp index dd7ce0ba..4f90f40c 100644 --- a/src/organize/organizeformat.cpp +++ b/src/organize/organizeformat.cpp @@ -196,7 +196,7 @@ QString OrganizeFormat::ParseBlock(QString block, const Song &song, bool *any_em // Find any blocks first qint64 pos = 0; QRegularExpressionMatch re_match; - for (re_match = block_regexp.match(block, pos); re_match.hasMatch(); re_match = block_regexp.match(block, pos)) { + for (re_match = block_regexp.match(block, pos); re_match.hasMatch(); re_match = block_regexp.match(block, pos)) { pos = re_match.capturedStart(); // Recursively parse the block bool empty = false; diff --git a/src/osd/osdbase.cpp b/src/osd/osdbase.cpp index db324d52..7ece11f2 100644 --- a/src/osd/osdbase.cpp +++ b/src/osd/osdbase.cpp @@ -305,8 +305,8 @@ void OSDBase::ShowMessage(const QString &summary, const QString &message, const switch (behaviour_) { case Native: #ifdef Q_OS_WIN32 - Q_UNUSED(icon) - // fallthrough + Q_UNUSED(icon) + // fallthrough #else if (image.isNull()) { ShowMessageNative(summary, message, icon, QImage()); @@ -318,7 +318,7 @@ void OSDBase::ShowMessage(const QString &summary, const QString &message, const #endif case TrayPopup: #ifdef Q_OS_MACOS - // fallthrough + // fallthrough #else if (tray_icon_) tray_icon_->ShowPopup(summary, message, timeout_msec_); break; @@ -401,7 +401,7 @@ QString OSDBase::ReplaceMessage(const MessageType type, const QString &message, } break; #elif defined(Q_OS_WIN32) - // fallthrough + // fallthrough #else // Other OSes doesn't support native notifications. qLog(Debug) << "Native notifications are not supported on this OS."; diff --git a/src/osd/osdpretty.cpp b/src/osd/osdpretty.cpp index 94f05ce7..493c686b 100644 --- a/src/osd/osdpretty.cpp +++ b/src/osd/osdpretty.cpp @@ -108,9 +108,9 @@ OSDPretty::OSDPretty(Mode mode, QWidget *parent) #ifdef Q_OS_WIN // Don't show the window in the taskbar. Qt::ToolTip does this too, but it adds an extra ugly shadow. - int ex_style = GetWindowLong((HWND) winId(), GWL_EXSTYLE); + int ex_style = GetWindowLong((HWND)winId(), GWL_EXSTYLE); ex_style |= WS_EX_NOACTIVATE; - SetWindowLong((HWND) winId(), GWL_EXSTYLE, ex_style); + SetWindowLong((HWND)winId(), GWL_EXSTYLE, ex_style); #endif // Mode settings @@ -166,7 +166,7 @@ OSDPretty::~OSDPretty() { void OSDPretty::showEvent(QShowEvent *e) { screens_.clear(); - for(QScreen *screen : QGuiApplication::screens()) { + for (QScreen *screen : QGuiApplication::screens()) { screens_.insert(screen->name(), screen); } @@ -310,10 +310,10 @@ void OSDPretty::paintEvent(QPaintEvent*) { p.drawPixmap(0, height() - kShadowCornerSize, shadow_corner_[3]); // Shadow edges - p.drawTiledPixmap(kShadowCornerSize, 0, width() - kShadowCornerSize*2, kDropShadowSize, shadow_edge_[0]); - p.drawTiledPixmap(width() - kDropShadowSize, kShadowCornerSize, kDropShadowSize, height() - kShadowCornerSize*2, shadow_edge_[1]); - p.drawTiledPixmap(kShadowCornerSize, height() - kDropShadowSize, width() - kShadowCornerSize*2, kDropShadowSize, shadow_edge_[2]); - p.drawTiledPixmap(0, kShadowCornerSize, kDropShadowSize, height() - kShadowCornerSize*2, shadow_edge_[3]); + p.drawTiledPixmap(kShadowCornerSize, 0, width() - kShadowCornerSize * 2, kDropShadowSize, shadow_edge_[0]); + p.drawTiledPixmap(width() - kDropShadowSize, kShadowCornerSize, kDropShadowSize, height() - kShadowCornerSize * 2, shadow_edge_[1]); + p.drawTiledPixmap(kShadowCornerSize, height() - kDropShadowSize, width() - kShadowCornerSize * 2, kDropShadowSize, shadow_edge_[2]); + p.drawTiledPixmap(0, kShadowCornerSize, kDropShadowSize, height() - kShadowCornerSize * 2, shadow_edge_[3]); // Box background p.setBrush(background_color_); diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 882b4528..0c6bc9ea 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -177,7 +177,7 @@ Playlist::~Playlist() { collection_items_by_id_.clear(); } -template +template void Playlist::InsertSongItems(const SongList &songs, const int pos, const bool play_now, const bool enqueue, const bool enqueue_next) { PlaylistItemList items; @@ -1189,7 +1189,7 @@ void Playlist::UpdateItems(SongList songs) { // then we remove song from our list because we will not need to check it again. // And we also update undo actions. - for (int i = 0; i < items_.size(); i++) { + for (int i = 0; i < items_.size(); i++) { // Update current items list QMutableListIterator it(songs); while (it.hasNext()) { @@ -2168,13 +2168,12 @@ void Playlist::RemoveDeletedSongs() { } removeRows(rows_to_remove); - } namespace { struct SongSimilarHash { - size_t operator() (const Song &song) const { + size_t operator()(const Song &song) const { return HashSimilar(song); } }; diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h index a550b126..68bc15d5 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -357,7 +357,7 @@ class Playlist : public QAbstractListModel { int PreviousVirtualIndex(int i, const bool ignore_repeat_track) const; bool FilterContainsVirtualIndex(const int i) const; - template + template void InsertSongItems(const SongList &songs, const int pos, const bool play_now, const bool enqueue, const bool enqueue_next = false); // Modify the playlist without changing the undo stack. These are used by our friends in PlaylistUndoCommands diff --git a/src/playlist/playlistlistsortfiltermodel.h b/src/playlist/playlistlistsortfiltermodel.h index 4ac087c9..ea07a3e2 100644 --- a/src/playlist/playlistlistsortfiltermodel.h +++ b/src/playlist/playlistlistsortfiltermodel.h @@ -26,7 +26,7 @@ class PlaylistListSortFilterModel : public QSortFilterProxyModel { public: explicit PlaylistListSortFilterModel(QObject *parent) - : QSortFilterProxyModel(parent) {} + : QSortFilterProxyModel(parent) {} bool lessThan(const QModelIndex &left, const QModelIndex &right) const override { // Compare the display text first. diff --git a/src/playlist/playlisttabbar.cpp b/src/playlist/playlisttabbar.cpp index ead18694..94de4e2d 100644 --- a/src/playlist/playlisttabbar.cpp +++ b/src/playlist/playlisttabbar.cpp @@ -428,7 +428,7 @@ void PlaylistTabBar::dropEvent(QDropEvent *e) { if (drag_hover_tab_ == -1) { const MimeData *mime_data = qobject_cast(e->mimeData()); - if(mime_data && !mime_data->name_for_new_playlist_.isEmpty()) { + if (mime_data && !mime_data->name_for_new_playlist_.isEmpty()) { manager_->New(mime_data->name_for_new_playlist_); } else { diff --git a/src/playlistparsers/wplparser.h b/src/playlistparsers/wplparser.h index 78509e8e..d42db40e 100644 --- a/src/playlistparsers/wplparser.h +++ b/src/playlistparsers/wplparser.h @@ -53,7 +53,7 @@ class WplParser : public XMLParser { SongList Load(QIODevice *device, const QString &playlist_path, const QDir &dir, const bool collection_search = true) const override; void Save(const SongList &songs, QIODevice *device, const QDir &dir, Playlist::Path path_type = Playlist::Path_Automatic) const override; -private: + 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); }; diff --git a/src/qobuz/qobuzrequest.cpp b/src/qobuz/qobuzrequest.cpp index 9b72351d..d3f94be1 100644 --- a/src/qobuz/qobuzrequest.cpp +++ b/src/qobuz/qobuzrequest.cpp @@ -707,7 +707,7 @@ void QobuzRequest::AlbumsFinishCheck(const QString &artist_id, const int limit, // Get songs for all the albums. - QHash ::iterator it; + QHash::iterator it; for (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); diff --git a/src/qobuz/qobuzservice.cpp b/src/qobuz/qobuzservice.cpp index e43f2409..f469e91b 100644 --- a/src/qobuz/qobuzservice.cpp +++ b/src/qobuz/qobuzservice.cpp @@ -716,19 +716,17 @@ void QobuzService::SendSearch() { search_request_->Search(search_id_, search_text_); search_request_->Process(); - } void QobuzService::SearchResultsReceived(const int id, const SongMap &songs, const QString &error) { search_request_.reset(); emit SearchResults(id, songs, error); - } uint QobuzService::GetStreamURL(const QUrl &url, QString &error) { - if (app_id().isEmpty() || app_secret().isEmpty()) { // Don't check for login here, because we allow automatic login. + if (app_id().isEmpty() || app_secret().isEmpty()) { // Don't check for login here, because we allow automatic login. error = tr("Missing Qobuz app ID or secret."); return 0; } diff --git a/src/radios/radioservices.h b/src/radios/radioservices.h index 5a689886..9189607f 100644 --- a/src/radios/radioservices.h +++ b/src/radios/radioservices.h @@ -46,7 +46,7 @@ class RadioServices : public QObject { RadioService *ServiceBySource(const Song::Source source) const; - template + template T *Service() { return static_cast(ServiceBySource(T::source)); } diff --git a/src/scrobbler/audioscrobbler.h b/src/scrobbler/audioscrobbler.h index 6e83e323..95f5d0c2 100644 --- a/src/scrobbler/audioscrobbler.h +++ b/src/scrobbler/audioscrobbler.h @@ -57,7 +57,7 @@ class AudioScrobbler : public QObject { ScrobblerService *ServiceByName(const QString &name) const { return scrobbler_services_->ServiceByName(name); } - template + template T *Service() { return qobject_cast(ServiceByName(T::kName)); } diff --git a/src/scrobbler/scrobblerservices.h b/src/scrobbler/scrobblerservices.h index bd0aefd3..cb5d927d 100644 --- a/src/scrobbler/scrobblerservices.h +++ b/src/scrobbler/scrobblerservices.h @@ -46,7 +46,7 @@ class ScrobblerServices : public QObject { int NextId(); ScrobblerService *ServiceByName(const QString &name); - template + template T *Service() { return qobject_cast(ServiceByName(T::kName)); } diff --git a/src/scrobbler/scrobblingapi20.cpp b/src/scrobbler/scrobblingapi20.cpp index 2366f839..77920d2e 100644 --- a/src/scrobbler/scrobblingapi20.cpp +++ b/src/scrobbler/scrobblingapi20.cpp @@ -169,7 +169,7 @@ void ScrobblingAPI20::Authenticate(const bool https) { messagebox.setTextFormat(Qt::RichText); int result = messagebox.exec(); switch (result) { - case QMessageBox::Open:{ + case QMessageBox::Open: { bool openurl_result = QDesktopServices::openUrl(url); if (openurl_result) { break; @@ -178,22 +178,21 @@ void ScrobblingAPI20::Authenticate(const bool https) { messagebox_error.setTextFormat(Qt::RichText); messagebox_error.exec(); } - // fallthrough - case QMessageBox::Save: - QApplication::clipboard()->setText(url.toString()); - break; - case QMessageBox::Cancel: - if (server_) { - server_->close(); - server_->deleteLater(); - server_ = nullptr; - } - emit AuthenticationComplete(false); - break; - default: - break; + // fallthrough + case QMessageBox::Save: + QApplication::clipboard()->setText(url.toString()); + break; + case QMessageBox::Cancel: + if (server_) { + server_->close(); + server_->deleteLater(); + server_ = nullptr; + } + emit AuthenticationComplete(false); + break; + default: + break; } - } void ScrobblingAPI20::RedirectArrived() { @@ -533,12 +532,13 @@ void ScrobblingAPI20::Scrobble(const Song &song) { if (app_->scrobbler()->IsOffline()) return; if (!IsAuthenticated()) { - if (app_->scrobbler()->ShowErrorDialog()) { emit ErrorMessage(tr("Scrobbler %1 is not authenticated!").arg(name_)); } + if (app_->scrobbler()->ShowErrorDialog()) { + emit ErrorMessage(tr("Scrobbler %1 is not authenticated!").arg(name_)); + } return; } StartSubmit(true); - } void ScrobblingAPI20::StartSubmit(const bool initial) { @@ -1016,8 +1016,9 @@ void ScrobblingAPI20::Error(const QString &error, const QVariant &debug) { qLog(Error) << name_ << error; if (debug.isValid()) qLog(Debug) << debug; - if (app_->scrobbler()->ShowErrorDialog()) { emit ErrorMessage(tr("Scrobbler %1 error: %2").arg(name_, error)); } - + if (app_->scrobbler()->ShowErrorDialog()) { + emit ErrorMessage(tr("Scrobbler %1 error: %2").arg(name_, error)); + } } QString ScrobblingAPI20::ErrorString(const ScrobbleErrorCode error) { diff --git a/src/settings/collectionsettingspage.cpp b/src/settings/collectionsettingspage.cpp index b7090570..774e6af8 100644 --- a/src/settings/collectionsettingspage.cpp +++ b/src/settings/collectionsettingspage.cpp @@ -76,11 +76,11 @@ CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog, QWidget * setWindowIcon(IconLoader::Load("library-music")); ui_->add->setIcon(IconLoader::Load("document-open-folder")); - ui_->combobox_cache_size->addItems({"KB", "MB"}); - ui_->combobox_disk_cache_size->addItems({"KB", "MB", "GB"}); + ui_->combobox_cache_size->addItems({ "KB", "MB" }); + ui_->combobox_disk_cache_size->addItems({ "KB", "MB", "GB" }); - ui_->combobox_iopriority->addItems({"Auto", "Realtime", "Best effort", "Idle"}); - ui_->combobox_threadpriority->addItems({"Idle", "Lowest", "Low", "Normal"}); + ui_->combobox_iopriority->addItems({ "Auto", "Realtime", "Best effort", "Idle" }); + ui_->combobox_threadpriority->addItems({ "Idle", "Lowest", "Low", "Normal" }); QObject::connect(ui_->add, &QPushButton::clicked, this, &CollectionSettingsPage::Add); QObject::connect(ui_->remove, &QPushButton::clicked, this, &CollectionSettingsPage::Remove); diff --git a/src/settings/contextsettingspage.h b/src/settings/contextsettingspage.h index ca49dbe0..d1504c0c 100644 --- a/src/settings/contextsettingspage.h +++ b/src/settings/contextsettingspage.h @@ -71,7 +71,7 @@ class ContextSettingsPage : public SettingsPage { private: Ui_ContextSettingsPage *ui_; - QCheckBox *checkboxes_[ContextSettingsOrder::NELEMS]{}; + QCheckBox *checkboxes_[ContextSettingsOrder::NELEMS] {}; }; #endif // CONTEXTSETTINGSPAGE_H diff --git a/src/settings/globalshortcutssettingspage.cpp b/src/settings/globalshortcutssettingspage.cpp index 00e46674..19190bf3 100644 --- a/src/settings/globalshortcutssettingspage.cpp +++ b/src/settings/globalshortcutssettingspage.cpp @@ -186,7 +186,7 @@ void GlobalShortcutsSettingsPage::Load() { ui_->checkbox_mate->setChecked(s.value("use_mate", true).toBool()); } -#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS) +#endif // defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && defined(HAVE_DBUS) #ifdef HAVE_X11_GLOBALSHORTCUTS if (ui_->widget_x11->isVisibleTo(this)) { diff --git a/src/settings/notificationssettingspage.cpp b/src/settings/notificationssettingspage.cpp index 8f2f841d..e21d4e2f 100644 --- a/src/settings/notificationssettingspage.cpp +++ b/src/settings/notificationssettingspage.cpp @@ -185,8 +185,8 @@ void NotificationsSettingsPage::Load() { break; } ui_->notifications_duration->setValue(s.value("Timeout", 5000).toInt() / 1000); - ui_->notifications_volume->setChecked( s.value("ShowOnVolumeChange", false).toBool()); - ui_->notifications_play_mode->setChecked( s.value("ShowOnPlayModeChange", true).toBool()); + ui_->notifications_volume->setChecked(s.value("ShowOnVolumeChange", false).toBool()); + ui_->notifications_play_mode->setChecked(s.value("ShowOnPlayModeChange", true).toBool()); ui_->notifications_pause->setChecked(s.value("ShowOnPausePlayback", true).toBool()); ui_->notifications_resume->setChecked(s.value("ShowOnResumePlayback", false).toBool()); ui_->notifications_art->setChecked(s.value("ShowArt", true).toBool()); diff --git a/src/settings/subsonicsettingspage.cpp b/src/settings/subsonicsettingspage.cpp index 122d2a1b..a4cbbddd 100644 --- a/src/settings/subsonicsettingspage.cpp +++ b/src/settings/subsonicsettingspage.cpp @@ -85,7 +85,7 @@ void SubsonicSettingsPage::Load() { ui_->checkbox_server_scrobbling->setChecked(s.value("serversidescrobbling", false).toBool()); AuthMethod auth_method = static_cast(s.value("authmethod", AuthMethod_MD5).toInt()); - switch(auth_method) { + switch (auth_method) { case AuthMethod_Hex: ui_->auth_method_hex->setChecked(true); break; diff --git a/src/smartplaylists/smartplaylistsviewcontainer.cpp b/src/smartplaylists/smartplaylistsviewcontainer.cpp index 2d716040..b0d41519 100644 --- a/src/smartplaylists/smartplaylistsviewcontainer.cpp +++ b/src/smartplaylists/smartplaylistsviewcontainer.cpp @@ -247,16 +247,14 @@ void SmartPlaylistsViewContainer::DeleteSmartPlaylistFromButton() { if (ui_->view->selectionModel()->selectedIndexes().count() == 0) return; DeleteSmartPlaylist(ui_->view->selectionModel()->selectedIndexes().first()); - } void SmartPlaylistsViewContainer::NewSmartPlaylistFinished() { SmartPlaylistWizard *wizard = qobject_cast(sender()); if (!wizard) return; - QObject::disconnect(wizard, &SmartPlaylistWizard::accepted, this, &SmartPlaylistsViewContainer::NewSmartPlaylistFinished); + QObject::disconnect(wizard, &SmartPlaylistWizard::accepted, this, &SmartPlaylistsViewContainer::NewSmartPlaylistFinished); model_->AddGenerator(wizard->CreateGenerator()); - } void SmartPlaylistsViewContainer::EditSmartPlaylistFinished() { diff --git a/src/subsonic/subsonicrequest.h b/src/subsonic/subsonicrequest.h index 9c2de6e9..80854e7c 100644 --- a/src/subsonic/subsonicrequest.h +++ b/src/subsonic/subsonicrequest.h @@ -59,7 +59,7 @@ class SubsonicRequest : public SubsonicBaseRequest { void GetAlbums(); void Reset(); - private: + private: struct Request { explicit Request() : offset(0), size(0) {} QString artist_id; diff --git a/src/transcoder/transcodedialog.cpp b/src/transcoder/transcodedialog.cpp index 77b2b9e9..6dfa9a2a 100644 --- a/src/transcoder/transcodedialog.cpp +++ b/src/transcoder/transcodedialog.cpp @@ -92,7 +92,7 @@ TranscodeDialog::TranscodeDialog(QMainWindow *mainwindow, QWidget *parent) ui_->setupUi(this); - setWindowFlags(windowFlags()|Qt::WindowMaximizeButtonHint); + setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); ui_->files->header()->setSectionResizeMode(QHeaderView::ResizeToContents); diff --git a/src/widgets/busyindicator.cpp b/src/widgets/busyindicator.cpp index 85463d8c..613b5ea0 100644 --- a/src/widgets/busyindicator.cpp +++ b/src/widgets/busyindicator.cpp @@ -38,16 +38,14 @@ BusyIndicator::BusyIndicator(const QString &text, QWidget *parent) label_(nullptr) { Init(text); - } BusyIndicator::BusyIndicator(QWidget *parent) - : QWidget(parent), - movie_(nullptr), - label_(nullptr) { + : QWidget(parent), + movie_(nullptr), + label_(nullptr) { Init(QString()); - } void BusyIndicator::Init(const QString &text) { diff --git a/src/widgets/clickablelabel.cpp b/src/widgets/clickablelabel.cpp index b8387127..026fbcb9 100644 --- a/src/widgets/clickablelabel.cpp +++ b/src/widgets/clickablelabel.cpp @@ -22,7 +22,7 @@ #include #include -ClickableLabel::ClickableLabel(QWidget *parent) : QLabel(parent){} +ClickableLabel::ClickableLabel(QWidget *parent) : QLabel(parent) {} void ClickableLabel::mousePressEvent(QMouseEvent *event) { emit Clicked(); diff --git a/src/widgets/fancytabwidget.cpp b/src/widgets/fancytabwidget.cpp index 017430b6..a4cdf3d5 100644 --- a/src/widgets/fancytabwidget.cpp +++ b/src/widgets/fancytabwidget.cpp @@ -219,7 +219,7 @@ class FancyTabBar : public QTabBar { // clazy:exclude=missing-qobject-macro if (tabWidget->mode() != FancyTabWidget::Mode_LargeSidebar && tabWidget->mode() != FancyTabWidget::Mode_SmallSidebar) { // Cache and hide label text for IconOnlyTabs mode if (tabWidget->mode() == FancyTabWidget::Mode_IconOnlyTabs && labelCache.count() == 0) { - for(int i = 0; i < count(); ++i) { + for (int i = 0; i < count(); ++i) { labelCache[tabWidget->widget(i)] = tabText(i); setTabToolTip(i, tabText(i)); setTabText(i, ""); @@ -315,7 +315,7 @@ class FancyTabBar : public QTabBar { // clazy:exclude=missing-qobject-macro p.setFont(boldFont); // Text drop shadow color - p.setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110) ); + p.setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110)); p.translate(0, 3); p.drawText(tabrectText, textFlags, tabText(index)); @@ -338,7 +338,7 @@ class FancyTabBar : public QTabBar { // clazy:exclude=missing-qobject-macro tabrectIcon = tabrectLabel; tabrectIcon.setSize(QSize(tabWidget->iconsize_largesidebar(), tabWidget->iconsize_largesidebar())); // Center the icon - const int moveRight = (QTabBar::width() - tabWidget->iconsize_largesidebar() -1) / 2; + const int moveRight = (QTabBar::width() - tabWidget->iconsize_largesidebar() - 1) / 2; tabrectIcon.translate(moveRight, 5); } tabIcon(index).paint(&p, tabrectIcon, iconFlags); @@ -346,18 +346,17 @@ 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()) { + : 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); diff --git a/src/widgets/fancytabwidget.h b/src/widgets/fancytabwidget.h index cbacf051..82697e27 100644 --- a/src/widgets/fancytabwidget.h +++ b/src/widgets/fancytabwidget.h @@ -72,7 +72,7 @@ class FancyTabWidget : public QTabWidget { Mode_Tabs, Mode_IconOnlyTabs, Mode_PlainSidebar, - }; + }; static const int TabSize_LargeSidebarMinWidth; static const int IconSize_LargeSidebar; diff --git a/src/widgets/freespacebar.cpp b/src/widgets/freespacebar.cpp index dfe23c8b..c91352b7 100644 --- a/src/widgets/freespacebar.cpp +++ b/src/widgets/freespacebar.cpp @@ -212,7 +212,7 @@ void FreeSpaceBar::DrawText(QPainter *p, const QRect r) { for (const Label &label : labels) { const bool light = palette().color(QPalette::Base).value() > 128; - QRect box(x, r.top() + (r.height() - kLabelBoxSize)/2, kLabelBoxSize, kLabelBoxSize); + QRect box(x, r.top() + (r.height() - kLabelBoxSize) / 2, kLabelBoxSize, kLabelBoxSize); p->setPen(label.color.darker()); p->setBrush(label.color); p->drawRect(box); diff --git a/src/widgets/groupediconview.h b/src/widgets/groupediconview.h index e51a15a4..4558c887 100644 --- a/src/widgets/groupediconview.h +++ b/src/widgets/groupediconview.h @@ -70,7 +70,7 @@ class GroupedIconView : public QListView { int header_spacing() const { return header_spacing_; } int header_indent() const { return header_indent_; } int item_indent() const { return item_indent_; } - const QString &header_text() const { return header_text_;} + const QString &header_text() const { return header_text_; } void set_header_spacing(const int value) { header_spacing_ = value; } void set_header_indent(const int value) { header_indent_ = value; } diff --git a/src/widgets/lineedit.cpp b/src/widgets/lineedit.cpp index 05e0c76d..6682bd2a 100644 --- a/src/widgets/lineedit.cpp +++ b/src/widgets/lineedit.cpp @@ -198,12 +198,11 @@ void LineEdit::resizeEvent(QResizeEvent *e) { TextEdit::TextEdit(QWidget *parent) - : QPlainTextEdit(parent), - ExtendedEditor(this) { + : QPlainTextEdit(parent), + ExtendedEditor(this) { QObject::connect(reset_button_, &QToolButton::clicked, this, &TextEdit::Reset); - QObject::connect(this, &TextEdit::textChanged, [this]() { viewport()->update(); }); // To clear the hint - + QObject::connect(this, &TextEdit::textChanged, [this]() { viewport()->update(); }); // To clear the hint } void TextEdit::paintEvent(QPaintEvent *e) { @@ -218,11 +217,10 @@ void TextEdit::resizeEvent(QResizeEvent *e) { SpinBox::SpinBox(QWidget *parent) - : QSpinBox(parent), - ExtendedEditor(this, 14, false) { + : QSpinBox(parent), + ExtendedEditor(this, 14, false) { QObject::connect(reset_button_, &QToolButton::clicked, this, &SpinBox::Reset); - } void SpinBox::paintEvent(QPaintEvent *e) { @@ -236,10 +234,9 @@ void SpinBox::resizeEvent(QResizeEvent *e) { } CheckBox::CheckBox(QWidget *parent) - : QCheckBox(parent), ExtendedEditor(this, 14, false) { + : QCheckBox(parent), ExtendedEditor(this, 14, false) { QObject::connect(reset_button_, &QToolButton::clicked, this, &CheckBox::Reset); - } void CheckBox::paintEvent(QPaintEvent *e) { @@ -258,14 +255,12 @@ QString SpinBox::textFromValue(int val) const { return "-"; } return QSpinBox::textFromValue(val); - } RatingBox::RatingBox(QWidget *parent) - : RatingWidget(parent), - ExtendedEditor(this) { + : RatingWidget(parent), + ExtendedEditor(this) { clear_button_->hide(); reset_button_->hide(); - } diff --git a/src/widgets/playingwidget.cpp b/src/widgets/playingwidget.cpp index 7c7ae2f1..149a6301 100644 --- a/src/widgets/playingwidget.cpp +++ b/src/widgets/playingwidget.cpp @@ -318,7 +318,9 @@ void PlayingWidget::SetImage(const QImage &image) { DrawContents(&p); p.end(); } - else { pixmap_previous_track_ = QPixmap(); } + else { + pixmap_previous_track_ = QPixmap(); + } image_original_ = image; UpdateDetailsText(); diff --git a/src/widgets/ratingwidget.cpp b/src/widgets/ratingwidget.cpp index 61344500..14ac86d2 100644 --- a/src/widgets/ratingwidget.cpp +++ b/src/widgets/ratingwidget.cpp @@ -80,10 +80,9 @@ QRect RatingPainter::Contents(const QRect rect) { const int x = rect.x() + (rect.width() - width) / 2; return QRect(x, rect.y(), width, rect.height()); - } - float RatingPainter::RatingForPos(const QPoint pos, const QRect rect) { +float RatingPainter::RatingForPos(const QPoint pos, const QRect rect) { const QRect contents = Contents(rect); const float raw = static_cast(pos.x() - contents.left()) / static_cast(contents.width()); diff --git a/src/widgets/tracksliderpopup.cpp b/src/widgets/tracksliderpopup.cpp index af7b0014..7aaaa015 100644 --- a/src/widgets/tracksliderpopup.cpp +++ b/src/widgets/tracksliderpopup.cpp @@ -88,8 +88,8 @@ void TrackSliderPopup::UpdatePixmap() { #else const int text_width = qMax(font_metrics_.width(text_), small_font_metrics_.width(small_text_)); #endif - const QRect text_rect1(static_cast(kBlurRadius) + kTextMargin, static_cast(kBlurRadius) + kTextMargin, text_width + 2, font_metrics_.height()); - const QRect text_rect2(static_cast(kBlurRadius) + kTextMargin, text_rect1.bottom(), text_width, small_font_metrics_.height()); + const QRect text_rect1(static_cast(kBlurRadius) + kTextMargin, static_cast(kBlurRadius) + kTextMargin, text_width + 2, font_metrics_.height()); + const QRect text_rect2(static_cast(kBlurRadius) + kTextMargin, text_rect1.bottom(), text_width, small_font_metrics_.height()); const int bubble_bottom = text_rect2.bottom() + kTextMargin; const QRect total_rect(0, 0, text_rect1.right() + static_cast(kBlurRadius) + kTextMargin, static_cast(kBlurRadius) + bubble_bottom + kPointLength); diff --git a/src/widgets/volumeslider.cpp b/src/widgets/volumeslider.cpp index fcff9069..16a1ad78 100644 --- a/src/widgets/volumeslider.cpp +++ b/src/widgets/volumeslider.cpp @@ -380,7 +380,7 @@ void VolumeSlider::paletteChange(const QPalette&) { generateGradient(); } -QPixmap VolumeSlider::drawVolumePixmap () const { +QPixmap VolumeSlider::drawVolumePixmap() const { QPixmap pixmap(112, 36); pixmap.fill(Qt::transparent);