From f786a17014e437f7ba1b7071d8328d695bc7aec5 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 12 Jun 2021 20:53:23 +0200 Subject: [PATCH] Formatting --- src/analyzer/analyzerbase.cpp | 14 +- src/analyzer/analyzerbase.h | 8 +- src/analyzer/analyzercontainer.cpp | 2 +- src/analyzer/analyzercontainer.h | 4 +- src/analyzer/boomanalyzer.cpp | 14 +- src/analyzer/boomanalyzer.h | 4 +- src/analyzer/fht.cpp | 32 ++--- src/analyzer/fht.h | 10 +- src/analyzer/rainbowanalyzer.cpp | 24 ++-- src/analyzer/rainbowanalyzer.h | 8 +- src/collection/collection.cpp | 2 +- src/collection/collectionbackend.cpp | 2 +- src/collection/collectiondirectorymodel.h | 2 +- src/collection/collectionview.cpp | 4 +- src/collection/collectionwatcher.h | 6 +- src/collection/directory.h | 2 +- src/core/application.cpp | 2 +- src/core/commandlineoptions.cpp | 4 +- src/core/mac_delegate.h | 8 +- src/core/mac_startup.mm | 38 +++--- src/core/mac_utilities.h | 2 +- src/core/macfslistener.mm | 17 +-- src/core/macsystemtrayicon.mm | 4 +- src/core/mainwindow.cpp | 2 +- src/core/mainwindow.h | 2 +- src/core/musicstorage.h | 8 +- src/core/scoped_cftyperef.h | 2 +- src/core/scoped_nsobject.h | 10 +- src/core/scopedgobject.h | 16 +-- src/core/scopedtransaction.cpp | 2 +- src/core/settingsprovider.h | 2 +- src/core/simpletreeitem.h | 8 +- src/core/stylesheetloader.h | 2 +- src/covermanager/albumcoverexporter.cpp | 2 +- src/covermanager/albumcoverfetchersearch.h | 2 +- src/covermanager/coversearchstatistics.h | 2 +- .../coversearchstatisticsdialog.cpp | 4 +- .../coversearchstatisticsdialog.h | 2 +- src/device/cddalister.cpp | 12 +- src/device/devicedatabasebackend.cpp | 7 +- src/device/devicedatabasebackend.h | 6 +- src/device/devicemanager.h | 2 +- src/device/gpoddevice.cpp | 2 +- src/device/gpoddevice.h | 4 +- src/device/macosdevicelister.h | 20 +-- src/device/macosdevicelister.mm | 122 +++++++++--------- src/device/mtpdevice.cpp | 11 +- src/device/mtpdevice.h | 20 +-- src/device/mtploader.cpp | 2 +- src/dialogs/about.h | 2 +- src/dialogs/addstreamdialog.cpp | 2 +- src/engine/gstelementdeleter.cpp | 2 +- src/engine/gstenginepipeline.cpp | 2 +- src/engine/gstenginepipeline.h | 2 +- src/engine/macosdevicefinder.cpp | 2 +- src/engine/vlcengine.h | 4 +- src/engine/vlcscopedref.h | 18 +-- src/equalizer/equalizer.cpp | 18 +-- src/equalizer/equalizer.h | 2 +- src/globalshortcuts/globalshortcutgrabber.mm | 10 +- .../globalshortcutsbackend-macos.mm | 31 ++--- .../globalshortcutsbackend-system.cpp | 3 +- src/main.cpp | 2 +- src/main.h | 2 +- src/moodbar/moodbarbuilder.cpp | 4 +- src/moodbar/moodbarproxystyle.cpp | 2 +- src/musicbrainz/acoustidclient.cpp | 6 +- src/musicbrainz/musicbrainzclient.cpp | 4 +- src/musicbrainz/musicbrainzclient.h | 40 +++--- src/osd/osdpretty.cpp | 12 +- src/osd/osdpretty.h | 16 +-- src/playlist/dynamicplaylistcontrols.h | 2 +- src/playlist/playlist.cpp | 2 +- src/playlist/playlist.h | 2 +- src/playlist/playlistmanager.h | 12 +- src/playlist/playlistsaveoptionsdialog.h | 2 +- src/playlist/playlistsequence.h | 8 +- src/playlist/playlistundocommands.cpp | 10 +- src/playlistparsers/xmlparser.h | 2 +- src/queue/queue.cpp | 2 +- src/settings/contextsettingspage.cpp | 8 +- src/settings/moodbarsettingspage.cpp | 2 +- src/settings/moodbarsettingspage.h | 4 +- src/settings/networkproxysettingspage.cpp | 2 +- src/settings/networkproxysettingspage.h | 4 +- src/settings/notificationssettingspage.cpp | 6 +- src/settings/playlistsettingspage.h | 4 +- src/settings/qobuzsettingspage.h | 4 +- src/settings/scrobblersettingspage.h | 2 +- src/settings/subsonicsettingspage.h | 4 +- src/settings/tidalsettingspage.h | 4 +- .../smartplaylistquerywizardplugin.cpp | 2 +- .../smartplaylistsearchpreview.cpp | 2 +- .../smartplaylistsearchtermwidget.cpp | 12 +- .../smartplaylistsearchtermwidget.h | 2 +- src/subsonic/subsonicbaserequest.cpp | 2 +- src/subsonic/subsonicurlhandler.cpp | 2 +- src/tidal/tidalfavoriterequest.cpp | 4 +- src/transcoder/transcoderoptionsaac.cpp | 2 +- src/transcoder/transcoderoptionsmp3.h | 2 +- src/transcoder/transcoderoptionsvorbis.h | 2 +- src/widgets/busyindicator.cpp | 4 +- src/widgets/fileviewlist.cpp | 6 +- src/widgets/freespacebar.cpp | 17 ++- src/widgets/freespacebar.h | 14 +- src/widgets/groupediconview.cpp | 4 +- src/widgets/multiloadingindicator.cpp | 2 +- src/widgets/playingwidget.cpp | 2 +- src/widgets/qocoa_mac.h | 6 +- src/widgets/qsearchfield_mac.mm | 8 +- src/widgets/ratingwidget.cpp | 2 +- src/widgets/stretchheaderview.cpp | 2 +- src/widgets/stretchheaderview.h | 4 +- src/widgets/trackslider.cpp | 2 +- src/widgets/trackslider.h | 2 +- src/widgets/volumeslider.cpp | 2 +- src/widgets/volumeslider.h | 10 +- 117 files changed, 444 insertions(+), 434 deletions(-) diff --git a/src/analyzer/analyzerbase.cpp b/src/analyzer/analyzerbase.cpp index b29ff63d..a390e435 100644 --- a/src/analyzer/analyzerbase.cpp +++ b/src/analyzer/analyzerbase.cpp @@ -56,7 +56,7 @@ template class Analyzer::Base; #endif -Analyzer::Base::Base(QWidget *parent, uint scopeSize) +Analyzer::Base::Base(QWidget *parent, const uint scopeSize) : QWidget(parent), timeout_(40), fht_(new FHT(scopeSize)), @@ -69,7 +69,7 @@ void Analyzer::Base::hideEvent(QHideEvent*) { timer_.stop(); } void Analyzer::Base::showEvent(QShowEvent*) { timer_.start(timeout(), this); } -void Analyzer::Base::transform(Scope& scope) { +void Analyzer::Base::transform(Scope &scope) { QVector aux(fht_->size()); if (static_cast(aux.size()) >= scope.size()) { @@ -93,7 +93,7 @@ void Analyzer::Base::paintEvent(QPaintEvent *e) { switch (engine_->state()) { case Engine::Playing: { - const Engine::Scope& thescope = engine_->scope(timeout_); + const Engine::Scope &thescope = engine_->scope(timeout_); int i = 0; // convert to mono here - our built in analyzers need mono, but the engines provide interleaved pcm @@ -139,7 +139,7 @@ int Analyzer::Base::resizeExponent(int exp) { } -int Analyzer::Base::resizeForBands(int bands) { +int Analyzer::Base::resizeForBands(const int bands) { int exp = 0; if (bands <= 8) @@ -160,7 +160,7 @@ int Analyzer::Base::resizeForBands(int bands) { } -void Analyzer::Base::demo(QPainter& p) { +void Analyzer::Base::demo(QPainter &p) { static int t = 201; // FIXME make static to namespace perhaps @@ -185,7 +185,7 @@ void Analyzer::Base::polishEvent() { init(); } -void Analyzer::interpolate(const Scope& inVec, Scope& outVec) { +void Analyzer::interpolate(const Scope &inVec, Scope &outVec) { double pos = 0.0; const double step = static_cast(inVec.size()) / outVec.size(); @@ -207,7 +207,7 @@ void Analyzer::interpolate(const Scope& inVec, Scope& outVec) { } -void Analyzer::initSin(Scope& v, const uint size) { +void Analyzer::initSin(Scope &v, const uint size) { double step = (M_PI * 2) / size; double radian = 0; diff --git a/src/analyzer/analyzerbase.h b/src/analyzer/analyzerbase.h index 233679fc..82ececee 100644 --- a/src/analyzer/analyzerbase.h +++ b/src/analyzer/analyzerbase.h @@ -72,7 +72,7 @@ class Base : public QWidget { virtual void framerateChanged() {} protected: - explicit Base(QWidget*, uint scopeSize = 7); + explicit Base(QWidget*, const uint scopeSize = 7); void hideEvent(QHideEvent*) override; void showEvent(QShowEvent*) override; @@ -82,11 +82,11 @@ class Base : public QWidget { void polishEvent(); int resizeExponent(int); - int resizeForBands(int); + int resizeForBands(const int); virtual void init() {} virtual void transform(Scope&); - virtual void analyze(QPainter& p, const Scope&, bool new_frame) = 0; - virtual void demo(QPainter& p); + virtual void analyze(QPainter &p, const Scope&, const bool new_frame) = 0; + virtual void demo(QPainter &p); protected: QBasicTimer timer_; diff --git a/src/analyzer/analyzercontainer.cpp b/src/analyzer/analyzercontainer.cpp index f63281e6..f1af1de3 100644 --- a/src/analyzer/analyzercontainer.cpp +++ b/src/analyzer/analyzercontainer.cpp @@ -222,7 +222,7 @@ void AnalyzerContainer::Save() { } -void AnalyzerContainer::AddFramerate(const QString& name, const int framerate) { +void AnalyzerContainer::AddFramerate(const QString &name, const int framerate) { QAction *action = context_menu_framerate_->addAction(name); group_framerate_->addAction(action); diff --git a/src/analyzer/analyzercontainer.h b/src/analyzer/analyzercontainer.h index f45314d1..a5a8ad2d 100644 --- a/src/analyzer/analyzercontainer.h +++ b/src/analyzer/analyzercontainer.h @@ -76,7 +76,7 @@ class AnalyzerContainer : public QWidget { void SaveFramerate(const int framerate); template void AddAnalyzerType(); - void AddFramerate(const QString& name, const int framerate); + void AddFramerate(const QString &name, const int framerate); private: int current_framerate_; // fps @@ -94,7 +94,7 @@ class AnalyzerContainer : public QWidget { QPoint last_click_pos_; bool ignore_next_click_; - Analyzer::Base* current_analyzer_; + Analyzer::Base *current_analyzer_; EngineBase *engine_; }; diff --git a/src/analyzer/boomanalyzer.cpp b/src/analyzer/boomanalyzer.cpp index a6e70b04..d4b2ca62 100644 --- a/src/analyzer/boomanalyzer.cpp +++ b/src/analyzer/boomanalyzer.cpp @@ -43,9 +43,9 @@ const int BoomAnalyzer::kColumnWidth = 4; const int BoomAnalyzer::kMaxBandCount = 256; const int BoomAnalyzer::kMinBandCount = 32; -const char* BoomAnalyzer::kName = QT_TRANSLATE_NOOP("AnalyzerContainer", "Boom analyzer"); +const char *BoomAnalyzer::kName = QT_TRANSLATE_NOOP("AnalyzerContainer", "Boom analyzer"); -BoomAnalyzer::BoomAnalyzer(QWidget* parent) +BoomAnalyzer::BoomAnalyzer(QWidget *parent) : Analyzer::Base(parent, 9), bands_(0), scope_(kMinBandCount), @@ -65,15 +65,15 @@ BoomAnalyzer::BoomAnalyzer(QWidget* parent) } -void BoomAnalyzer::changeK_barHeight(int newValue) { +void BoomAnalyzer::changeK_barHeight(const int newValue) { K_barHeight_ = static_cast(newValue) / 1000; } -void BoomAnalyzer::changeF_peakSpeed(int newValue) { +void BoomAnalyzer::changeF_peakSpeed(const int newValue) { F_peakSpeed_ = static_cast(newValue) / 1000; } -void BoomAnalyzer::resizeEvent(QResizeEvent* e) { +void BoomAnalyzer::resizeEvent(QResizeEvent *e) { QWidget::resizeEvent(e); @@ -101,7 +101,7 @@ void BoomAnalyzer::resizeEvent(QResizeEvent* e) { } -void BoomAnalyzer::transform(Scope& s) { +void BoomAnalyzer::transform(Scope &s) { fht_->spectrum(s.data()); fht_->scale(s.data(), 1.0 / 50); @@ -110,7 +110,7 @@ void BoomAnalyzer::transform(Scope& s) { } -void BoomAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) { +void BoomAnalyzer::analyze(QPainter &p, const Scope &scope, const bool new_frame) { if (!new_frame || engine_->state() == Engine::Paused) { p.drawPixmap(0, 0, canvas_); diff --git a/src/analyzer/boomanalyzer.h b/src/analyzer/boomanalyzer.h index 28fbbaf8..122c880e 100644 --- a/src/analyzer/boomanalyzer.h +++ b/src/analyzer/boomanalyzer.h @@ -42,10 +42,10 @@ class BoomAnalyzer : public Analyzer::Base { public: Q_INVOKABLE explicit BoomAnalyzer(QWidget*); - static const char* kName; + static const char *kName; void transform(Analyzer::Scope &s) override; - void analyze(QPainter &p, const Analyzer::Scope&, bool new_frame) override; + void analyze(QPainter &p, const Analyzer::Scope&, const bool new_frame) override; public slots: void changeK_barHeight(int); diff --git a/src/analyzer/fht.cpp b/src/analyzer/fht.cpp index bf3fafcc..e5135715 100644 --- a/src/analyzer/fht.cpp +++ b/src/analyzer/fht.cpp @@ -40,13 +40,13 @@ FHT::~FHT() {} int FHT::sizeExp() const { return exp2_; } int FHT::size() const { return num_; } -float* FHT::buf_() { return buf_vector_.data(); } -float* FHT::tab_() { return tab_vector_.data(); } -int* FHT::log_() { return log_vector_.data(); } +float *FHT::buf_() { return buf_vector_.data(); } +float *FHT::tab_() { return tab_vector_.data(); } +int *FHT::log_() { return log_vector_.data(); } void FHT::makeCasTable(void) { - float* costab = tab_(); - float* sintab = tab_() + num_ / 2 + 1; + float *costab = tab_(); + float *sintab = tab_() + num_ / 2 + 1; for (int ul = 0; ul < num_; ul++) { float d = M_PI * ul / (num_ / 2); @@ -58,15 +58,15 @@ void FHT::makeCasTable(void) { } } -void FHT::scale(float* p, float d) { +void FHT::scale(float *p, float d) { for (int i = 0; i < (num_ / 2); i++) *p++ *= d; } -void FHT::ewma(float* d, float* s, float w) { +void FHT::ewma(float *d, float *s, float w) { for (int i = 0; i < (num_ / 2); i++, d++, s++) *d = *d * w + *s * (1 - w); } -void FHT::logSpectrum(float* out, float* p) { +void FHT::logSpectrum(float *out, float *p) { int n = num_ / 2, i = 0, j = 0, k = 0, *r = nullptr; if (log_vector_.size() < n) { @@ -93,7 +93,7 @@ void FHT::logSpectrum(float* out, float* p) { } -void FHT::semiLogSpectrum(float* p) { +void FHT::semiLogSpectrum(float *p) { power2(p); for (int i = 0; i < (num_ / 2); i++, p++) { float e = 10.0 * log10(sqrt(*p / 2)); @@ -101,24 +101,24 @@ void FHT::semiLogSpectrum(float* p) { } } -void FHT::spectrum(float* p) { +void FHT::spectrum(float *p) { power2(p); for (int i = 0; i < (num_ / 2); i++, p++) *p = static_cast(sqrt(*p / 2)); } -void FHT::power(float* p) { +void FHT::power(float *p) { power2(p); for (int i = 0; i < (num_ / 2); i++) *p++ /= 2; } -void FHT::power2(float* p) { +void FHT::power2(float *p) { _transform(p, num_, 0); *p = static_cast(2 * pow(*p, 2)); p++; - float* q = p + num_ - 2; + float *q = p + num_ - 2; for (int i = 1; i < (num_ / 2); i++) { *p = static_cast(pow(*p, 2) + pow(*q, 2)); p++; @@ -126,14 +126,14 @@ void FHT::power2(float* p) { } } -void FHT::transform(float* p) { +void FHT::transform(float *p) { if (num_ == 8) transform8(p); else _transform(p, num_, 0); } -void FHT::transform8(float* p) { +void FHT::transform8(float *p) { float a = 0.0, b = 0.0, c = 0.0, d = 0.0, e = 0.0, f = 0.0, g = 0.0, h = 0.0, b_f2 = 0.0, d_h2 = 0.0; float a_c_eg = 0.0, a_ce_g = 0.0, ac_e_g = 0.0, aceg = 0.0, b_df_h = 0.0, bdfh = 0.0; @@ -162,7 +162,7 @@ void FHT::transform8(float* p) { } -void FHT::_transform(float* p, int n, int k) { +void FHT::_transform(float *p, int n, int k) { if (n == 8) { transform8(p + k); diff --git a/src/analyzer/fht.h b/src/analyzer/fht.h index be17430d..12c6f9d1 100644 --- a/src/analyzer/fht.h +++ b/src/analyzer/fht.h @@ -41,9 +41,9 @@ class FHT { QVector tab_vector_; QVector log_vector_; - float* buf_(); - float* tab_(); - int* log_(); + float *buf_(); + float *tab_(); + int *log_(); /** * Create a table of "cas" (cosine and sine) values. @@ -76,7 +76,7 @@ class FHT { * @param s is fresh input. * @param w is the weighting factor. */ - void ewma(float* d, float* s, float w); + void ewma(float *d, float *s, float w); /** * Logarithmic audio spectrum. Maps semi-logarithmic spectrum @@ -85,7 +85,7 @@ class FHT { * @param p is the input array. * @param out is the spectrum. */ - void logSpectrum(float* out, float* p); + void logSpectrum(float *out, float *p); /** * Semi-logarithmic audio spectrum. diff --git a/src/analyzer/rainbowanalyzer.cpp b/src/analyzer/rainbowanalyzer.cpp index 90d912f5..df979775 100644 --- a/src/analyzer/rainbowanalyzer.cpp +++ b/src/analyzer/rainbowanalyzer.cpp @@ -50,13 +50,13 @@ 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"; +const char *Rainbow::NyanCatAnalyzer::kName = "Nyanalyzer Cat"; +const char *Rainbow::RainbowDashAnalyzer::kName = "Rainbow Dash"; const float Rainbow::RainbowAnalyzer::kPixelScale = 0.02f; Rainbow::RainbowAnalyzer::RainbowType Rainbow::RainbowAnalyzer::rainbowtype; -Rainbow::RainbowAnalyzer::RainbowAnalyzer(const RainbowType& rbtype, QWidget* parent) +Rainbow::RainbowAnalyzer::RainbowAnalyzer(const RainbowType &rbtype, QWidget *parent) : Analyzer::Base(parent, 9), timer_id_(startTimer(kFrameIntervalMs)), frame_(0), @@ -82,9 +82,9 @@ Rainbow::RainbowAnalyzer::RainbowAnalyzer(const RainbowType& rbtype, QWidget* pa } -void Rainbow::RainbowAnalyzer::transform(Scope& s) { fht_->spectrum(s.data()); } +void Rainbow::RainbowAnalyzer::transform(Scope &s) { fht_->spectrum(s.data()); } -void Rainbow::RainbowAnalyzer::timerEvent(QTimerEvent* e) { +void Rainbow::RainbowAnalyzer::timerEvent(QTimerEvent *e) { if (e->timerId() == timer_id_) { frame_ = (frame_ + 1) % kFrameCount[rainbowtype]; @@ -95,7 +95,7 @@ void Rainbow::RainbowAnalyzer::timerEvent(QTimerEvent* e) { } -void Rainbow::RainbowAnalyzer::resizeEvent(QResizeEvent* e) { +void Rainbow::RainbowAnalyzer::resizeEvent(QResizeEvent *e) { Q_UNUSED(e); @@ -109,7 +109,7 @@ void Rainbow::RainbowAnalyzer::resizeEvent(QResizeEvent* e) { } -void Rainbow::RainbowAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s, bool new_frame) { +void Rainbow::RainbowAnalyzer::analyze(QPainter &p, const Analyzer::Scope &s, bool new_frame) { // Discard the second half of the transform const int scope_size = static_cast(s.size() / 2); @@ -117,7 +117,7 @@ void Rainbow::RainbowAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s, bo if ((new_frame && is_playing_) || (buffer_[0].isNull() && buffer_[1].isNull())) { // Transform the music into rainbows! for (int band = 0; band < kRainbowBands; ++band) { - float* band_start = history_ + band * kHistorySize; + float *band_start = history_ + band * kHistorySize; // Move the history of each band across by 1 frame. memmove(band_start, band_start + 1, (kHistorySize - 1) * sizeof(float)); @@ -139,8 +139,8 @@ void Rainbow::RainbowAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s, bo // Create polylines for the rainbows. QPointF polyline[kRainbowBands * kHistorySize]; - QPointF* dest = polyline; - float* source = history_; + QPointF *dest = polyline; + float *source = history_; const float top_of = static_cast(height()) / 2 - static_cast(kRainbowHeight[rainbowtype]) / 2; for (int band = 0; band < kRainbowBands; ++band) { @@ -204,8 +204,8 @@ void Rainbow::RainbowAnalyzer::analyze(QPainter& p, const Analyzer::Scope& s, bo } -Rainbow::NyanCatAnalyzer::NyanCatAnalyzer(QWidget* parent) +Rainbow::NyanCatAnalyzer::NyanCatAnalyzer(QWidget *parent) : RainbowAnalyzer(Rainbow::RainbowAnalyzer::Nyancat, parent) {} -Rainbow::RainbowDashAnalyzer::RainbowDashAnalyzer(QWidget* parent) +Rainbow::RainbowDashAnalyzer::RainbowDashAnalyzer(QWidget *parent) : RainbowAnalyzer(Rainbow::RainbowAnalyzer::Dash, parent) {} diff --git a/src/analyzer/rainbowanalyzer.h b/src/analyzer/rainbowanalyzer.h index 14319ecd..c5e9309e 100644 --- a/src/analyzer/rainbowanalyzer.h +++ b/src/analyzer/rainbowanalyzer.h @@ -129,18 +129,18 @@ class NyanCatAnalyzer : public RainbowAnalyzer { Q_OBJECT public: - Q_INVOKABLE explicit NyanCatAnalyzer(QWidget* parent); + Q_INVOKABLE explicit NyanCatAnalyzer(QWidget *parent); - static const char* kName; + static const char *kName; }; class RainbowDashAnalyzer : public RainbowAnalyzer { Q_OBJECT public: - Q_INVOKABLE explicit RainbowDashAnalyzer(QWidget* parent); + Q_INVOKABLE explicit RainbowDashAnalyzer(QWidget *parent); - static const char* kName; + static const char *kName; }; } diff --git a/src/collection/collection.cpp b/src/collection/collection.cpp index f0fd9c29..2bdc7f07 100644 --- a/src/collection/collection.cpp +++ b/src/collection/collection.cpp @@ -78,7 +78,7 @@ SCollection::~SCollection() { } if (watcher_thread_) { watcher_thread_->exit(); - watcher_thread_->wait(5000 /* five seconds */); + watcher_thread_->wait(5000); } backend_->deleteLater(); diff --git a/src/collection/collectionbackend.cpp b/src/collection/collectionbackend.cpp index 139e9225..41983454 100644 --- a/src/collection/collectionbackend.cpp +++ b/src/collection/collectionbackend.cpp @@ -1588,7 +1588,7 @@ void CollectionBackend::UpdateSongRatingAsync(const int id, const double rating) metaObject()->invokeMethod(this, "UpdateSongRating", Qt::QueuedConnection, Q_ARG(int, id), Q_ARG(double, rating)); } -void CollectionBackend::UpdateSongsRatingAsync(const QList& ids, const double rating) { +void CollectionBackend::UpdateSongsRatingAsync(const QList &ids, const double rating) { metaObject()->invokeMethod(this, "UpdateSongsRating", Qt::QueuedConnection, Q_ARG(QList, ids), Q_ARG(double, rating)); } diff --git a/src/collection/collectiondirectorymodel.h b/src/collection/collectiondirectorymodel.h index 55ab6740..158a15e6 100644 --- a/src/collection/collectiondirectorymodel.h +++ b/src/collection/collectiondirectorymodel.h @@ -60,7 +60,7 @@ class CollectionDirectoryModel : public QStandardItemModel { static const int kIdRole = Qt::UserRole + 1; QIcon dir_icon_; - CollectionBackend* backend_; + CollectionBackend *backend_; QList> storage_; }; diff --git a/src/collection/collectionview.cpp b/src/collection/collectionview.cpp index 57bedb9b..2280532b 100644 --- a/src/collection/collectionview.cpp +++ b/src/collection/collectionview.cpp @@ -511,7 +511,7 @@ void CollectionView::AddToPlaylist() { void CollectionView::AddToPlaylistEnqueue() { QMimeData *q_mimedata = model()->mimeData(selectedIndexes()); - if (MimeData* mimedata = qobject_cast(q_mimedata)) { + if (MimeData *mimedata = qobject_cast(q_mimedata)) { mimedata->enqueue_now_ = true; } emit AddToPlaylistSignal(q_mimedata); @@ -531,7 +531,7 @@ void CollectionView::AddToPlaylistEnqueueNext() { void CollectionView::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/collection/collectionwatcher.h b/src/collection/collectionwatcher.h index 2b56657f..bc8b7e4a 100644 --- a/src/collection/collectionwatcher.h +++ b/src/collection/collectionwatcher.h @@ -235,14 +235,14 @@ class CollectionWatcher : public QObject { }; -inline QString CollectionWatcher::NoExtensionPart(const QString& fileName) { +inline QString CollectionWatcher::NoExtensionPart(const QString &fileName) { return fileName.contains('.') ? fileName.section('.', 0, -2) : ""; } // Thanks Amarok -inline QString CollectionWatcher::ExtensionPart(const QString& fileName) { +inline QString CollectionWatcher::ExtensionPart(const QString &fileName) { return fileName.contains( '.' ) ? fileName.mid( fileName.lastIndexOf('.') + 1 ).toLower() : ""; } -inline QString CollectionWatcher::DirectoryPart(const QString& fileName) { +inline QString CollectionWatcher::DirectoryPart(const QString &fileName) { return fileName.section('/', 0, -2); } diff --git a/src/collection/directory.h b/src/collection/directory.h index 6b14b8e9..97252a3e 100644 --- a/src/collection/directory.h +++ b/src/collection/directory.h @@ -31,7 +31,7 @@ struct Directory { Directory() : id(-1) {} - bool operator ==(const Directory& other) const { + bool operator ==(const Directory &other) const { return path == other.path && id == other.id; } diff --git a/src/core/application.cpp b/src/core/application.cpp index 85d6c6e0..381de0f0 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -302,7 +302,7 @@ void Application::ExitReceived() { } -void Application::AddError(const QString& message) { emit ErrorAdded(message); } +void Application::AddError(const QString &message) { emit ErrorAdded(message); } void Application::ReloadSettings() { emit SettingsChanged(); } void Application::OpenSettingsDialogAtPage(SettingsDialog::Page page) { emit SettingsDialogRequested(page); } diff --git a/src/core/commandlineoptions.cpp b/src/core/commandlineoptions.cpp index b6a54103..a2eea256 100644 --- a/src/core/commandlineoptions.cpp +++ b/src/core/commandlineoptions.cpp @@ -365,7 +365,7 @@ QString CommandlineOptions::tr(const char *source_text) { return QObject::tr(source_text); } -QDataStream& operator<<(QDataStream &s, const CommandlineOptions &a) { +QDataStream &operator<<(QDataStream &s, const CommandlineOptions &a) { s << qint32(a.player_action_) << qint32(a.url_list_action_) @@ -385,7 +385,7 @@ QDataStream& operator<<(QDataStream &s, const CommandlineOptions &a) { } -QDataStream& operator>>(QDataStream &s, CommandlineOptions &a) { +QDataStream &operator>>(QDataStream &s, CommandlineOptions &a) { quint32 player_action = 0; quint32 url_list_action = 0; diff --git a/src/core/mac_delegate.h b/src/core/mac_delegate.h index fbc408a9..d1bb72e2 100644 --- a/src/core/mac_delegate.h +++ b/src/core/mac_delegate.h @@ -7,10 +7,10 @@ class PlatformInterface; @class SPMediaKeyTap; @interface AppDelegate : NSObject { - PlatformInterface* application_handler_; - NSMenu* dock_menu_; - GlobalShortcutsBackendMacOS* shortcut_handler_; - SPMediaKeyTap* key_tap_; + PlatformInterface *application_handler_; + NSMenu *dock_menu_; + GlobalShortcutsBackendMacOS *shortcut_handler_; + SPMediaKeyTap *key_tap_; } diff --git a/src/core/mac_startup.mm b/src/core/mac_startup.mm index b33c43f9..d1022ad8 100644 --- a/src/core/mac_startup.mm +++ b/src/core/mac_startup.mm @@ -69,7 +69,7 @@ #include -QDebug operator<<(QDebug dbg, NSObject* object) { +QDebug operator<<(QDebug dbg, NSObject *object) { QString ns_format = [ [NSString stringWithFormat:@"%@", object] UTF8String]; dbg.nospace() << ns_format; @@ -82,10 +82,10 @@ QDebug operator<<(QDebug dbg, NSObject* object) { @interface MacApplication : NSApplication { - PlatformInterface* application_handler_; - AppDelegate* delegate_; + PlatformInterface *application_handler_; + AppDelegate *delegate_; // shortcut_handler_ only used to temporarily save it AppDelegate does all the heavy-shortcut-lifting - GlobalShortcutsBackendMacOS* shortcut_handler_; + GlobalShortcutsBackendMacOS *shortcut_handler_; } @@ -295,11 +295,11 @@ void MacMain() { } -void SetShortcutHandler(GlobalShortcutsBackendMacOS* handler) { +void SetShortcutHandler(GlobalShortcutsBackendMacOS *handler) { [NSApp SetShortcutHandler:handler]; } -void SetApplicationHandler(PlatformInterface* handler) { +void SetApplicationHandler(PlatformInterface *handler) { [NSApp SetApplicationHandler:handler]; } @@ -313,7 +313,7 @@ QString GetBundlePath() { ScopedCFTypeRef app_url(CFBundleCopyBundleURL(CFBundleGetMainBundle())); ScopedCFTypeRef mac_path(CFURLCopyFileSystemPath(app_url.get(), kCFURLPOSIXPathStyle)); - const char* path = CFStringGetCStringPtr(mac_path.get(), CFStringGetSystemEncoding()); + const char *path = CFStringGetCStringPtr(mac_path.get(), CFStringGetSystemEncoding()); QString bundle_path = QString::fromUtf8(path); return bundle_path; @@ -329,10 +329,10 @@ QString GetResourcesPath() { QString GetApplicationSupportPath() { ScopedNSAutoreleasePool pool; - NSArray* paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); QString ret; if ([paths count] > 0) { - NSString* user_path = [paths objectAtIndex:0]; + NSString *user_path = [paths objectAtIndex:0]; ret = QString::fromUtf8([user_path UTF8String]); } else { @@ -345,10 +345,10 @@ QString GetApplicationSupportPath() { QString GetMusicDirectory() { ScopedNSAutoreleasePool pool; - NSArray* paths = NSSearchPathForDirectoriesInDomains(NSMusicDirectory, NSUserDomainMask, YES); + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSMusicDirectory, NSUserDomainMask, YES); QString ret; if ([paths count] > 0) { - NSString* user_path = [paths objectAtIndex:0]; + NSString *user_path = [paths objectAtIndex:0]; ret = QString::fromUtf8([user_path UTF8String]); } else { @@ -418,11 +418,11 @@ static int MapFunctionKey(int keycode) { return 0; } -QKeySequence KeySequenceFromNSEvent(NSEvent* event) { +QKeySequence KeySequenceFromNSEvent(NSEvent *event) { - NSString* str = [event charactersIgnoringModifiers]; - NSString* upper = [str uppercaseString]; - const char* chars = [upper UTF8String]; + NSString *str = [event charactersIgnoringModifiers]; + NSString *upper = [str uppercaseString]; + const char *chars = [upper UTF8String]; NSUInteger modifiers = [event modifierFlags]; int key = 0; unsigned char c = chars[0]; @@ -465,7 +465,7 @@ QKeySequence KeySequenceFromNSEvent(NSEvent* event) { void DumpDictionary(CFDictionaryRef dict) { - NSDictionary* d = (NSDictionary*)dict; + NSDictionary *d = (NSDictionary*)dict; NSLog(@"%@", d); } @@ -473,10 +473,10 @@ void DumpDictionary(CFDictionaryRef dict) { // NSWindowCollectionBehaviorFullScreenPrimary static const NSUInteger kFullScreenPrimary = 1 << 7; -void EnableFullScreen(const QWidget& main_window) { +void EnableFullScreen(const QWidget &main_window) { - NSView* view = reinterpret_cast(main_window.winId()); - NSWindow* window = [view window]; + NSView *view = reinterpret_cast(main_window.winId()); + NSWindow *window = [view window]; [window setCollectionBehavior:kFullScreenPrimary]; } diff --git a/src/core/mac_utilities.h b/src/core/mac_utilities.h index e4bd4ccd..f5253d62 100644 --- a/src/core/mac_utilities.h +++ b/src/core/mac_utilities.h @@ -34,7 +34,7 @@ class NSEvent; namespace mac { -QKeySequence KeySequenceFromNSEvent(NSEvent* event); +QKeySequence KeySequenceFromNSEvent(NSEvent *event); void DumpDictionary(CFDictionaryRef dict); } diff --git a/src/core/macfslistener.mm b/src/core/macfslistener.mm index c7b1d322..2703bd48 100644 --- a/src/core/macfslistener.mm +++ b/src/core/macfslistener.mm @@ -32,7 +32,7 @@ #include "core/logging.h" #include "scoped_nsobject.h" -MacFSListener::MacFSListener(QObject* parent) +MacFSListener::MacFSListener(QObject *parent) : FileSystemWatcherInterface(parent), run_loop_(nullptr), stream_(nullptr), @@ -46,14 +46,14 @@ MacFSListener::MacFSListener(QObject* parent) void MacFSListener::Init() { run_loop_ = CFRunLoopGetCurrent(); } -void MacFSListener::EventStreamCallback(ConstFSEventStreamRef stream, void* user_data, size_t num_events, void* event_paths, const FSEventStreamEventFlags event_flags[], const FSEventStreamEventId event_ids[]) { +void MacFSListener::EventStreamCallback(ConstFSEventStreamRef stream, void *user_data, size_t num_events, void *event_paths, const FSEventStreamEventFlags event_flags[], const FSEventStreamEventId event_ids[]) { Q_UNUSED(stream); Q_UNUSED(event_flags); Q_UNUSED(event_ids); - MacFSListener* me = reinterpret_cast(user_data); - char** paths = reinterpret_cast(event_paths); + MacFSListener *me = reinterpret_cast(user_data); + char **paths = reinterpret_cast(event_paths); for (size_t i = 0; i < num_events; ++i) { QString path = QString::fromUtf8(paths[i]); qLog(Debug) << "Something changed at:" << path; @@ -65,7 +65,7 @@ void MacFSListener::EventStreamCallback(ConstFSEventStreamRef stream, void* user } -void MacFSListener::AddPath(const QString& path) { +void MacFSListener::AddPath(const QString &path) { Q_ASSERT(run_loop_); paths_.insert(path); @@ -73,7 +73,7 @@ void MacFSListener::AddPath(const QString& path) { } -void MacFSListener::RemovePath(const QString& path) { +void MacFSListener::RemovePath(const QString &path) { Q_ASSERT(run_loop_); paths_.remove(path); @@ -93,6 +93,7 @@ void MacFSListener::UpdateStreamAsync() { } void MacFSListener::UpdateStream() { + if (stream_) { FSEventStreamStop(stream_); FSEventStreamInvalidate(stream_); @@ -106,7 +107,7 @@ void MacFSListener::UpdateStream() { scoped_nsobject array([ [NSMutableArray alloc] init]); - for (const QString& path : paths_) { + for (const QString &path : paths_) { scoped_nsobject string([ [NSString alloc] initWithUTF8String:path.toUtf8().constData()]); [array addObject:string.get()]; } @@ -123,5 +124,5 @@ void MacFSListener::UpdateStream() { FSEventStreamScheduleWithRunLoop(stream_, run_loop_, kCFRunLoopDefaultMode); FSEventStreamStart(stream_); -} +} diff --git a/src/core/macsystemtrayicon.mm b/src/core/macsystemtrayicon.mm index 5942da30..b6ceb652 100644 --- a/src/core/macsystemtrayicon.mm +++ b/src/core/macsystemtrayicon.mm @@ -38,7 +38,7 @@ #include "iconloader.h" @interface Target :NSObject { - QAction* action_; + QAction *action_; } - (id) initWithQAction: (QAction*)action; - (void) clicked; @@ -111,7 +111,7 @@ class MacSystemTrayIconPrivate { [dock_menu_ addItem:separator]; } - void ShowNowPlaying(const QString& artist, const QString& title) { + void ShowNowPlaying(const QString &artist, const QString &title) { ClearNowPlaying(); // Makes sure the order is consistent. [now_playing_artist_ setTitle: [[NSString alloc] initWithUTF8String: artist.toUtf8().constData()]]; [now_playing_title_ setTitle: [[NSString alloc] initWithUTF8String: title.toUtf8().constData()]]; diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 29e4d8aa..8b23033e 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -2640,7 +2640,7 @@ void MainWindow::PlaylistQueue() { void MainWindow::PlaylistQueuePlayNext() { QModelIndexList indexes; - for (const QModelIndex& proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) { + for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) { indexes << app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index); } diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index efbfdde2..95b2f9ca 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -359,7 +359,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { #endif QAction *playlist_delete_; QAction *playlist_queue_; - QAction* playlist_queue_play_next_; + QAction *playlist_queue_play_next_; QAction *playlist_skip_; QAction *playlist_add_to_another_; QList playlistitem_actions_; diff --git a/src/core/musicstorage.h b/src/core/musicstorage.h index 161d4d29..5378de54 100644 --- a/src/core/musicstorage.h +++ b/src/core/musicstorage.h @@ -81,14 +81,14 @@ class MusicStorage { virtual TranscodeMode GetTranscodeMode() const { return Transcode_Never; } virtual Song::FileType GetTranscodeFormat() const { return Song::FileType_Unknown; } - virtual bool GetSupportedFiletypes(QList* ret) { Q_UNUSED(ret); return true; } + virtual bool GetSupportedFiletypes(QList *ret) { Q_UNUSED(ret); return true; } - virtual bool StartCopy(QList* supported_types) { Q_UNUSED(supported_types); return true; } - virtual bool CopyToStorage(const CopyJob& job) = 0; + virtual bool StartCopy(QList *supported_types) { Q_UNUSED(supported_types); return true; } + virtual bool CopyToStorage(const CopyJob &job) = 0; virtual void FinishCopy(bool success) { Q_UNUSED(success); } virtual void StartDelete() {} - virtual bool DeleteFromStorage(const DeleteJob& job) = 0; + virtual bool DeleteFromStorage(const DeleteJob &job) = 0; virtual void FinishDelete(bool success) { Q_UNUSED(success); } virtual void Eject() {} diff --git a/src/core/scoped_cftyperef.h b/src/core/scoped_cftyperef.h index a526103c..53714b14 100644 --- a/src/core/scoped_cftyperef.h +++ b/src/core/scoped_cftyperef.h @@ -41,7 +41,7 @@ class ScopedCFTypeRef { CFT get() const { return object_; } - void swap(ScopedCFTypeRef& that) { + void swap(ScopedCFTypeRef &that) { CFT temp = that.object_; that.object_ = object_; object_ = temp; diff --git a/src/core/scoped_nsobject.h b/src/core/scoped_nsobject.h index 0b6f07be..e540c118 100644 --- a/src/core/scoped_nsobject.h +++ b/src/core/scoped_nsobject.h @@ -47,7 +47,7 @@ class scoped_nsobject { NST* get() const { return object_; } - void swap(scoped_nsobject& that) { + void swap(scoped_nsobject &that) { NST* temp = that.object_; that.object_ = object_; object_ = temp; @@ -70,17 +70,17 @@ class scoped_nsobject { // Free functions template -void swap(scoped_nsobject& p1, scoped_nsobject& p2) { +void swap(scoped_nsobject &p1, scoped_nsobject &p2) { p1.swap(p2); } template -bool operator==(C* p1, const scoped_nsobject& p2) { +bool operator==(C* p1, const scoped_nsobject &p2) { return p1 == p2.get(); } template -bool operator!=(C* p1, const scoped_nsobject& p2) { +bool operator!=(C* p1, const scoped_nsobject &p2) { return p1 != p2.get(); } @@ -109,7 +109,7 @@ class scoped_nsobject { id get() const { return object_; } - void swap(scoped_nsobject& that) { + void swap(scoped_nsobject &that) { id temp = that.object_; that.object_ = object_; object_ = temp; diff --git a/src/core/scopedgobject.h b/src/core/scopedgobject.h index 1a291ba4..635afde3 100644 --- a/src/core/scopedgobject.h +++ b/src/core/scopedgobject.h @@ -32,39 +32,39 @@ class ScopedGObject { public: ScopedGObject() : object_(nullptr) {} - ScopedGObject(const ScopedGObject& other) : object_(nullptr) { + ScopedGObject(const ScopedGObject &other) : object_(nullptr) { reset(other.object_); } ~ScopedGObject() { reset(); } - ScopedGObject& operator=(const ScopedGObject& other) { + ScopedGObject &operator=(const ScopedGObject &other) { reset(other.object_); return *this; } - void reset(T* new_object = nullptr) { + void reset(T *new_object = nullptr) { if (new_object) g_object_ref(new_object); reset_without_add(new_object); } - void reset_without_add(T* new_object = nullptr) { + void reset_without_add(T *new_object = nullptr) { if (object_) g_object_unref(object_); object_ = new_object; } - T* get() const { return object_; } + T *get() const { return object_; } operator T*() const { return get(); } - T* operator*() const { return get(); } + T *operator*() const { return get(); } operator bool() const { return get(); } - bool operator==(const ScopedGObject& other) const { + bool operator==(const ScopedGObject &other) const { return object_ == other.object_; } private: - T* object_; + T *object_; }; #endif // SCOPEDGOBJECT_H diff --git a/src/core/scopedtransaction.cpp b/src/core/scopedtransaction.cpp index c031e92a..8c1c61de 100644 --- a/src/core/scopedtransaction.cpp +++ b/src/core/scopedtransaction.cpp @@ -25,7 +25,7 @@ #include "core/logging.h" #include "scopedtransaction.h" -ScopedTransaction::ScopedTransaction(QSqlDatabase* db) +ScopedTransaction::ScopedTransaction(QSqlDatabase *db) : db_(db), pending_(true) { db->transaction(); } diff --git a/src/core/settingsprovider.h b/src/core/settingsprovider.h index fd1322fe..45cec517 100644 --- a/src/core/settingsprovider.h +++ b/src/core/settingsprovider.h @@ -47,7 +47,7 @@ class DefaultSettingsProvider : public SettingsProvider { public: DefaultSettingsProvider(); - void set_group(const char* group) override; + void set_group(const char *group) override; QVariant value(const QString &key, const QVariant &default_value = QVariant()) const override; void setValue(const QString &key, const QVariant &value) override; diff --git a/src/core/simpletreeitem.h b/src/core/simpletreeitem.h index d3e3d543..817fd1be 100644 --- a/src/core/simpletreeitem.h +++ b/src/core/simpletreeitem.h @@ -44,7 +44,7 @@ class SimpleTreeItem { void ChangedNotify(); void Delete(int child_row); - T* ChildByKey(const QString &key) const; + T *ChildByKey(const QString &key) const; QString DisplayText() const { return display_text; } QString SortText() const { return sort_text; } @@ -57,11 +57,11 @@ class SimpleTreeItem { int row; bool lazy_loaded; - T* parent; + T *parent; QList children; - QAbstractItemModel* child_model; + QAbstractItemModel *child_model; - SimpleTreeModel* model; + SimpleTreeModel *model; }; template diff --git a/src/core/stylesheetloader.h b/src/core/stylesheetloader.h index cc7ea59f..b4ad86e4 100644 --- a/src/core/stylesheetloader.h +++ b/src/core/stylesheetloader.h @@ -43,7 +43,7 @@ class StyleSheetLoader : public QObject { // Sets the given stylesheet on the given widget. // If the stylesheet contains strings like %palette-[role], these get replaced with actual palette colours. // The stylesheet is reloaded when the widget's palette changes. - void SetStyleSheet(QWidget *widget, const QString& filename); + void SetStyleSheet(QWidget *widget, const QString &filename); protected: bool eventFilter(QObject *obj, QEvent *event) override; diff --git a/src/covermanager/albumcoverexporter.cpp b/src/covermanager/albumcoverexporter.cpp index 889f9c8c..ea875d37 100644 --- a/src/covermanager/albumcoverexporter.cpp +++ b/src/covermanager/albumcoverexporter.cpp @@ -39,7 +39,7 @@ AlbumCoverExporter::AlbumCoverExporter(QObject *parent) thread_pool_->setMaxThreadCount(kMaxConcurrentRequests); } -void AlbumCoverExporter::SetDialogResult(const AlbumCoverExport::DialogResult& dialog_result) { +void AlbumCoverExporter::SetDialogResult(const AlbumCoverExport::DialogResult &dialog_result) { dialog_result_ = dialog_result; } diff --git a/src/covermanager/albumcoverfetchersearch.h b/src/covermanager/albumcoverfetchersearch.h index 13f2fab3..207a82b9 100644 --- a/src/covermanager/albumcoverfetchersearch.h +++ b/src/covermanager/albumcoverfetchersearch.h @@ -103,7 +103,7 @@ class AlbumCoverFetcherSearch : public QObject { QMap pending_requests_; QMap pending_image_loads_; - NetworkTimeouts* image_load_timeout_; + NetworkTimeouts *image_load_timeout_; // QMap is sorted by key (score). struct CandidateImage { diff --git a/src/covermanager/coversearchstatistics.h b/src/covermanager/coversearchstatistics.h index aef0d2a1..c784c7c1 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/coversearchstatisticsdialog.cpp b/src/covermanager/coversearchstatisticsdialog.cpp index f84fd59e..7b87f192 100644 --- a/src/covermanager/coversearchstatisticsdialog.cpp +++ b/src/covermanager/coversearchstatisticsdialog.cpp @@ -71,7 +71,7 @@ void CoverSearchStatisticsDialog::Show(const CoverSearchStatistics &statistics) .arg(statistics.chosen_images_ + statistics.missing_images_) .arg(statistics.missing_images_)); - for (const QString& provider : providers) { + for (const QString &provider : providers) { AddLine(tr("Covers from %1").arg(provider), QString::number(statistics.chosen_images_by_provider_[provider])); } @@ -97,7 +97,7 @@ void CoverSearchStatisticsDialog::AddLine(const QString &label, const QString &v label1->setProperty("type", "label"); label2->setProperty("type", "value"); - QHBoxLayout* layout = new QHBoxLayout; + QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(label1); layout->addWidget(label2); details_layout_->addLayout(layout); diff --git a/src/covermanager/coversearchstatisticsdialog.h b/src/covermanager/coversearchstatisticsdialog.h index 0e12e323..58f0697c 100644 --- a/src/covermanager/coversearchstatisticsdialog.h +++ b/src/covermanager/coversearchstatisticsdialog.h @@ -40,7 +40,7 @@ class CoverSearchStatisticsDialog : public QDialog { explicit CoverSearchStatisticsDialog(QWidget *parent = nullptr); ~CoverSearchStatisticsDialog() override; - void Show(const CoverSearchStatistics& statistics); + void Show(const CoverSearchStatistics &statistics); private: void AddLine(const QString &label, const QString &value); diff --git a/src/device/cddalister.cpp b/src/device/cddalister.cpp index aec9e898..520da7f4 100644 --- a/src/device/cddalister.cpp +++ b/src/device/cddalister.cpp @@ -48,7 +48,7 @@ QVariantList CddaLister::DeviceIcons(const QString &) { QString CddaLister::DeviceManufacturer(const QString &id) { - CdIo_t* cdio = cdio_open(id.toLocal8Bit().constData(), DRIVER_DEVICE); + CdIo_t *cdio = cdio_open(id.toLocal8Bit().constData(), DRIVER_DEVICE); cdio_hwinfo_t cd_info; if (cdio_get_hwinfo(cdio, &cd_info)) { cdio_destroy(cdio); @@ -61,7 +61,7 @@ QString CddaLister::DeviceManufacturer(const QString &id) { QString CddaLister::DeviceModel(const QString &id) { - CdIo_t* cdio = cdio_open(id.toLocal8Bit().constData(), DRIVER_DEVICE); + CdIo_t *cdio = cdio_open(id.toLocal8Bit().constData(), DRIVER_DEVICE); cdio_hwinfo_t cd_info; if (cdio_get_hwinfo(cdio, &cd_info)) { cdio_destroy(cdio); @@ -72,11 +72,11 @@ QString CddaLister::DeviceModel(const QString &id) { } -quint64 CddaLister::DeviceCapacity(const QString &) { return 0; } +quint64 CddaLister::DeviceCapacity(const QString&) { return 0; } -quint64 CddaLister::DeviceFreeSpace(const QString &) { return 0; } +quint64 CddaLister::DeviceFreeSpace(const QString&) { return 0; } -QVariantMap CddaLister::DeviceHardwareInfo(const QString &) { +QVariantMap CddaLister::DeviceHardwareInfo(const QString&) { return QVariantMap(); } @@ -111,7 +111,7 @@ bool CddaLister::Init() { qLog(Error) << "libcdio was compiled without support for macOS!"; } #endif - char** devices = cdio_get_devices(DRIVER_DEVICE); + char **devices = cdio_get_devices(DRIVER_DEVICE); if (!devices) { qLog(Debug) << "No CD devices found"; return false; diff --git a/src/device/devicedatabasebackend.cpp b/src/device/devicedatabasebackend.cpp index eb965ccc..ae8683c9 100644 --- a/src/device/devicedatabasebackend.cpp +++ b/src/device/devicedatabasebackend.cpp @@ -50,7 +50,7 @@ DeviceDatabaseBackend::DeviceDatabaseBackend(QObject *parent) : } -void DeviceDatabaseBackend::Init(Database* db) { db_ = db; } +void DeviceDatabaseBackend::Init(Database *db) { db_ = db; } void DeviceDatabaseBackend::Close() { @@ -152,7 +152,7 @@ int DeviceDatabaseBackend::AddDevice(const Device &device) { } -void DeviceDatabaseBackend::RemoveDevice(int id) { +void DeviceDatabaseBackend::RemoveDevice(const int id) { QMutexLocker l(db_->Mutex()); QSqlDatabase db(db_->Connect()); @@ -176,7 +176,7 @@ void DeviceDatabaseBackend::RemoveDevice(int id) { } -void DeviceDatabaseBackend::SetDeviceOptions(int id, const QString &friendly_name, const QString &icon_name, MusicStorage::TranscodeMode mode, Song::FileType format) { +void DeviceDatabaseBackend::SetDeviceOptions(const int id, const QString &friendly_name, const QString &icon_name, const MusicStorage::TranscodeMode mode, const Song::FileType format) { QMutexLocker l(db_->Mutex()); QSqlDatabase db(db_->Connect()); @@ -198,4 +198,3 @@ void DeviceDatabaseBackend::SetDeviceOptions(int id, const QString &friendly_nam db_->CheckErrors(q); } - diff --git a/src/device/devicedatabasebackend.h b/src/device/devicedatabasebackend.h index 1389740a..3f928656 100644 --- a/src/device/devicedatabasebackend.h +++ b/src/device/devicedatabasebackend.h @@ -64,10 +64,10 @@ class DeviceDatabaseBackend : public QObject { Database *db() const { return db_; } DeviceList GetAllDevices(); - int AddDevice(const Device& device); - void RemoveDevice(int id); + int AddDevice(const Device &device); + void RemoveDevice(const int id); - void SetDeviceOptions(int id, const QString &friendly_name, const QString &icon_name, MusicStorage::TranscodeMode mode, Song::FileType format); + void SetDeviceOptions(const int id, const QString &friendly_name, const QString &icon_name, const MusicStorage::TranscodeMode mode, const Song::FileType format); private slots: void Exit(); diff --git a/src/device/devicemanager.h b/src/device/devicemanager.h index bcd81651..ce4d2210 100644 --- a/src/device/devicemanager.h +++ b/src/device/devicemanager.h @@ -122,7 +122,7 @@ class DeviceManager : public SimpleTreeModel { void ExitFinished(); void DeviceConnected(QModelIndex idx); void DeviceDisconnected(QModelIndex idx); - void DeviceCreatedFromDB(DeviceInfo* info); + void DeviceCreatedFromDB(DeviceInfo *info); private slots: void PhysicalDeviceAdded(const QString &id); diff --git a/src/device/gpoddevice.cpp b/src/device/gpoddevice.cpp index 5094a7e9..59fc820e 100644 --- a/src/device/gpoddevice.cpp +++ b/src/device/gpoddevice.cpp @@ -107,7 +107,7 @@ void GPodDevice::Close() { } -void GPodDevice::LoadFinished(Itdb_iTunesDB *db, bool success) { +void GPodDevice::LoadFinished(Itdb_iTunesDB *db, const bool success) { QMutexLocker l(&db_mutex_); db_ = db; diff --git a/src/device/gpoddevice.h b/src/device/gpoddevice.h index 0bc9b906..b2c39b4e 100644 --- a/src/device/gpoddevice.h +++ b/src/device/gpoddevice.h @@ -73,8 +73,8 @@ class GPodDevice : public ConnectedDevice, public virtual MusicStorage { void FinishDelete(bool success) override; protected slots: - void LoadFinished(Itdb_iTunesDB *db, bool success); - void LoaderError(const QString& message); + void LoadFinished(Itdb_iTunesDB *db, const bool success); + void LoaderError(const QString &message); protected: Itdb_Track *AddTrackToITunesDb(const Song &metadata); diff --git a/src/device/macosdevicelister.h b/src/device/macosdevicelister.h index 17d52504..940d405c 100644 --- a/src/device/macosdevicelister.h +++ b/src/device/macosdevicelister.h @@ -85,18 +85,18 @@ class MacOsDeviceLister : public DeviceLister { 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 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); - void FoundMTPDevice(const MTPDevice& device, const QString& serial); - void RemovedMTPDevice(const QString& serial); + void FoundMTPDevice(const MTPDevice &device, const QString &serial); + void RemovedMTPDevice(const QString &serial); - quint64 GetFreeSpace(const QUrl& url); - quint64 GetCapacity(const QUrl& url); + quint64 GetFreeSpace(const QUrl &url); + quint64 GetCapacity(const QUrl &url); - bool IsCDDevice(const QString& serial) const; + bool IsCDDevice(const QString &serial) const; DASessionRef loop_session_; CFRunLoopRef run_loop_; @@ -111,11 +111,11 @@ class MacOsDeviceLister : public DeviceLister { }; #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -size_t qHash(const MacOsDeviceLister::MTPDevice& device); +size_t qHash(const MacOsDeviceLister::MTPDevice &device); #else -uint qHash(const MacOsDeviceLister::MTPDevice& device); +uint qHash(const MacOsDeviceLister::MTPDevice &device); #endif -inline bool operator==(const MacOsDeviceLister::MTPDevice& a, const MacOsDeviceLister::MTPDevice& b) { +inline bool operator==(const MacOsDeviceLister::MTPDevice &a, const MacOsDeviceLister::MTPDevice &b) { return (a.vendor_id == b.vendor_id) && (a.product_id == b.product_id); } diff --git a/src/device/macosdevicelister.mm b/src/device/macosdevicelister.mm index 40dcd9bb..ae14256c 100644 --- a/src/device/macosdevicelister.mm +++ b/src/device/macosdevicelister.mm @@ -102,9 +102,9 @@ class ScopedIOObject { QSet MacOsDeviceLister::sMTPDeviceList; #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -size_t qHash(const MacOsDeviceLister::MTPDevice& d) { +size_t qHash(const MacOsDeviceLister::MTPDevice &d) { #else -uint qHash(const MacOsDeviceLister::MTPDevice& d) { +uint qHash(const MacOsDeviceLister::MTPDevice &d) { #endif return qHash(d.vendor_id) ^ qHash(d.product_id); } @@ -119,7 +119,7 @@ bool MacOsDeviceLister::Init() { // Populate MTP Device list. if (sMTPDeviceList.empty()) { - LIBMTP_device_entry_t* devices = nullptr; + LIBMTP_device_entry_t *devices = nullptr; int num = 0; if (LIBMTP_Get_Supported_Devices_List(&devices, &num) != 0) { qLog(Warning) << "Failed to get MTP device list"; @@ -243,7 +243,7 @@ QString GetUSBRegistryEntryString(io_object_t device, CFStringRef key) { return QString(); } -NSObject* GetPropertyForDevice(io_object_t device, CFStringRef key) { +NSObject *GetPropertyForDevice(io_object_t device, CFStringRef key) { CFMutableDictionaryRef properties; kern_return_t ret = IORegistryEntryCreateCFProperties(device, &properties, kCFAllocatorDefault, 0); @@ -253,7 +253,7 @@ NSObject* GetPropertyForDevice(io_object_t device, CFStringRef key) { } scoped_nsobject dict((NSDictionary*)properties); // Takes ownership. - NSObject* prop = [dict objectForKey:(NSString*)key]; + NSObject *prop = [dict objectForKey:(NSString*)key]; if (prop) { // The dictionary goes out of scope so we should retain this object. [prop retain]; @@ -278,7 +278,7 @@ int GetUSBDeviceClass(io_object_t device) { CFSTR(kUSBInterfaceClass), kCFAllocatorDefault, kIORegistryIterateRecursively)); - NSNumber* number = (NSNumber*)interface_class.get(); + NSNumber *number = (NSNumber*)interface_class.get(); if (number) { int ret = [number unsignedShortValue]; return ret; @@ -291,8 +291,8 @@ QString GetIconForDevice(io_object_t device) { scoped_nsobject media_icon((NSDictionary*)GetPropertyForDevice(device, CFSTR("IOMediaIcon"))); if (media_icon) { - NSString* bundle = (NSString*)[media_icon objectForKey:@"CFBundleIdentifier"]; - NSString* file = (NSString*)[media_icon objectForKey:@"IOBundleResourceFile"]; + NSString *bundle = (NSString*)[media_icon objectForKey:@"CFBundleIdentifier"]; + NSString *file = (NSString*)[media_icon objectForKey:@"IOBundleResourceFile"]; scoped_nsobject bundle_url((NSURL*)KextManagerCreateURLForBundleIdentifier(kCFAllocatorDefault, (CFStringRef)bundle)); @@ -323,7 +323,7 @@ QString GetSerialForMTPDevice(io_object_t device) { } -QString FindDeviceProperty(const QString& bsd_name, CFStringRef property) { +QString FindDeviceProperty(const QString &bsd_name, CFStringRef property) { ScopedCFTypeRef session(DASessionCreate(kCFAllocatorDefault)); ScopedCFTypeRef disk(DADiskCreateFromBSDName(kCFAllocatorDefault, session.get(), bsd_name.toLatin1().constData())); @@ -336,7 +336,7 @@ QString FindDeviceProperty(const QString& bsd_name, CFStringRef property) { } // namespace -quint64 MacOsDeviceLister::GetFreeSpace(const QUrl& url) { +quint64 MacOsDeviceLister::GetFreeSpace(const QUrl &url) { QMutexLocker l(&libmtp_mutex_); MtpConnection connection(url); @@ -344,7 +344,7 @@ quint64 MacOsDeviceLister::GetFreeSpace(const QUrl& url) { qLog(Warning) << "Error connecting to MTP device, couldn't get device free space"; return -1; } - LIBMTP_devicestorage_t* storage = connection.device()->storage; + LIBMTP_devicestorage_t *storage = connection.device()->storage; quint64 free_bytes = 0; while (storage) { free_bytes += storage->FreeSpaceInBytes; @@ -354,7 +354,7 @@ quint64 MacOsDeviceLister::GetFreeSpace(const QUrl& url) { } -quint64 MacOsDeviceLister::GetCapacity(const QUrl& url) { +quint64 MacOsDeviceLister::GetCapacity(const QUrl &url) { QMutexLocker l(&libmtp_mutex_); MtpConnection connection(url); @@ -362,7 +362,7 @@ quint64 MacOsDeviceLister::GetCapacity(const QUrl& url) { qLog(Warning) << "Error connecting to MTP device, couldn't get device capacity"; return -1; } - LIBMTP_devicestorage_t* storage = connection.device()->storage; + LIBMTP_devicestorage_t *storage = connection.device()->storage; quint64 capacity_bytes = 0; while (storage) { capacity_bytes += storage->MaxCapacity; @@ -372,13 +372,13 @@ quint64 MacOsDeviceLister::GetCapacity(const QUrl& url) { } -void MacOsDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) { +void MacOsDeviceLister::DiskAddedCallback(DADiskRef disk, void *context) { - MacOsDeviceLister* me = reinterpret_cast(context); + MacOsDeviceLister *me = reinterpret_cast(context); scoped_nsobject properties((NSDictionary*)DADiskCopyDescription(disk)); - NSString* kind = [properties objectForKey:(NSString*)kDADiskDescriptionMediaKindKey]; + NSString *kind = [properties objectForKey:(NSString*)kDADiskDescriptionMediaKindKey]; #ifdef HAVE_AUDIOCD if (kind && strcmp([kind UTF8String], kIOCDMediaClass) == 0) { // CD inserted. @@ -389,7 +389,7 @@ void MacOsDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) { } #endif - NSURL* volume_path = [ [properties objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]; + NSURL *volume_path = [ [properties objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]; if (volume_path) { ScopedIOObject device(DADiskCopyIOMedia(disk)); @@ -416,9 +416,9 @@ void MacOsDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) { } -void MacOsDeviceLister::DiskRemovedCallback(DADiskRef disk, void* context) { +void MacOsDeviceLister::DiskRemovedCallback(DADiskRef disk, void *context) { - MacOsDeviceLister* me = reinterpret_cast(context); + MacOsDeviceLister *me = reinterpret_cast(context); // We cannot access the USB tree when the disk is removed but we still get // the BSD disk name. @@ -438,7 +438,7 @@ void MacOsDeviceLister::DiskRemovedCallback(DADiskRef disk, void* context) { } -bool DeviceRequest(IOUSBDeviceInterface** dev, +bool DeviceRequest(IOUSBDeviceInterface **dev, quint8 direction, quint8 type, quint8 recipient, @@ -446,7 +446,7 @@ bool DeviceRequest(IOUSBDeviceInterface** dev, quint16 value, quint16 index, quint16 length, - QByteArray* data) { + QByteArray *data) { IOUSBDevRequest req; req.bmRequestType = USBmakebmRequestType(direction, type, recipient); @@ -473,9 +473,9 @@ int GetBusNumber(io_object_t o) { return -1; } while ((o = IOIteratorNext(it))) { - NSObject* bus = GetPropertyForDevice(o, CFSTR("USBBusNumber")); + NSObject *bus = GetPropertyForDevice(o, CFSTR("USBBusNumber")); if (bus) { - NSNumber* bus_num = (NSNumber*)bus; + NSNumber *bus_num = (NSNumber*)bus; return [bus_num intValue]; } } @@ -484,9 +484,9 @@ int GetBusNumber(io_object_t o) { } -void MacOsDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { +void MacOsDeviceLister::USBDeviceAddedCallback(void *refcon, io_iterator_t it) { - MacOsDeviceLister* me = reinterpret_cast(refcon); + MacOsDeviceLister *me = reinterpret_cast(refcon); io_object_t object; while ((object = IOIteratorNext(it))) { @@ -497,10 +497,10 @@ void MacOsDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { BOOST_SCOPE_EXIT_END if (CFStringCompare(class_name.get(), CFSTR(kIOUSBDeviceClassName), 0) == kCFCompareEqualTo) { - NSString* vendor = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBVendorString)); - NSString* product = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString)); - NSNumber* vendor_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID)); - NSNumber* product_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID)); + NSString *vendor = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBVendorString)); + NSString *product = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString)); + NSNumber *vendor_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID)); + NSNumber *product_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID)); int interface_class = GetUSBDeviceClass(object); qLog(Debug) << "Interface class:" << interface_class; @@ -546,7 +546,7 @@ void MacOsDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { continue; } - IOCFPlugInInterface** plugin_interface = nullptr; + IOCFPlugInInterface **plugin_interface = nullptr; SInt32 score; kern_return_t err = IOCreatePlugInInterfaceForService( object, @@ -558,7 +558,7 @@ void MacOsDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { continue; } - IOUSBDeviceInterface** dev = nullptr; + IOUSBDeviceInterface **dev = nullptr; HRESULT result = (*plugin_interface)->QueryInterface(plugin_interface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID*)&dev); (*plugin_interface)->Release(plugin_interface); @@ -623,9 +623,9 @@ void MacOsDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) { } -void MacOsDeviceLister::USBDeviceRemovedCallback(void* refcon, io_iterator_t it) { +void MacOsDeviceLister::USBDeviceRemovedCallback(void *refcon, io_iterator_t it) { - MacOsDeviceLister* me = reinterpret_cast(refcon); + MacOsDeviceLister *me = reinterpret_cast(refcon); io_object_t object; while ((object = IOIteratorNext(it))) { ScopedCFTypeRef class_name(IOObjectCopyClass(object)); @@ -633,10 +633,10 @@ void MacOsDeviceLister::USBDeviceRemovedCallback(void* refcon, io_iterator_t it) BOOST_SCOPE_EXIT_END if (CFStringCompare(class_name.get(), CFSTR(kIOUSBDeviceClassName), 0) == kCFCompareEqualTo) { - NSString* vendor = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBVendorString)); - NSString* product = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString)); - NSNumber* vendor_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID)); - NSNumber* product_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID)); + NSString *vendor = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBVendorString)); + NSString *product = (NSString*)GetPropertyForDevice(object, CFSTR(kUSBProductString)); + NSNumber *vendor_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBVendorID)); + NSNumber *product_id = (NSNumber*)GetPropertyForDevice(object, CFSTR(kUSBProductID)); QString serial = GetSerialForMTPDevice(object); MTPDevice device; @@ -651,7 +651,7 @@ void MacOsDeviceLister::USBDeviceRemovedCallback(void* refcon, io_iterator_t it) } -void MacOsDeviceLister::RemovedMTPDevice(const QString& serial) { +void MacOsDeviceLister::RemovedMTPDevice(const QString &serial) { int count = mtp_devices_.remove(serial); if (count) { @@ -661,28 +661,28 @@ void MacOsDeviceLister::RemovedMTPDevice(const QString& serial) { } -void MacOsDeviceLister::FoundMTPDevice(const MTPDevice& device, const QString& serial) { +void MacOsDeviceLister::FoundMTPDevice(const MTPDevice &device, const QString &serial) { qLog(Debug) << "New MTP device detected!" << device.bus << device.address; mtp_devices_[serial] = device; QList urls = MakeDeviceUrls(serial); - MTPDevice* d = &mtp_devices_[serial]; + MTPDevice *d = &mtp_devices_[serial]; d->capacity = GetCapacity(urls[0]); d->free_space = GetFreeSpace(urls[0]); emit DeviceAdded(serial); } -bool IsMTPSerial(const QString& serial) { return serial.startsWith("MTP"); } +bool IsMTPSerial(const QString &serial) { return serial.startsWith("MTP"); } -bool MacOsDeviceLister::IsCDDevice(const QString& serial) const { +bool MacOsDeviceLister::IsCDDevice(const QString &serial) const { return cd_devices_.contains(serial); } -QString MacOsDeviceLister::MakeFriendlyName(const QString& serial) { +QString MacOsDeviceLister::MakeFriendlyName(const QString &serial) { if (IsMTPSerial(serial)) { - const MTPDevice& device = mtp_devices_[serial]; + const MTPDevice &device = mtp_devices_[serial]; if (device.vendor.isEmpty()) { return device.product; } @@ -697,7 +697,7 @@ QString MacOsDeviceLister::MakeFriendlyName(const QString& serial) { if (IsCDDevice(serial)) { scoped_nsobject properties((NSDictionary*)DADiskCopyDescription(disk.get())); - NSString* device_name = (NSString*)[properties.get() objectForKey:(NSString*)kDADiskDescriptionMediaNameKey]; + NSString *device_name = (NSString*)[properties.get() objectForKey:(NSString*)kDADiskDescriptionMediaNameKey]; return QString::fromUtf8([device_name UTF8String]); } @@ -714,10 +714,10 @@ QString MacOsDeviceLister::MakeFriendlyName(const QString& serial) { } -QList MacOsDeviceLister::MakeDeviceUrls(const QString& serial) { +QList MacOsDeviceLister::MakeDeviceUrls(const QString &serial) { if (IsMTPSerial(serial)) { - const MTPDevice& device = mtp_devices_[serial]; + const MTPDevice &device = mtp_devices_[serial]; QString str = QString::asprintf("gphoto2://usb-%d-%d/", device.bus, device.address); QUrlQuery url_query; url_query.addQueryItem("vendor", device.vendor); @@ -752,7 +752,7 @@ QStringList MacOsDeviceLister::DeviceUniqueIDs() { return current_devices_.keys() + mtp_devices_.keys(); } -QVariantList MacOsDeviceLister::DeviceIcons(const QString& serial) { +QVariantList MacOsDeviceLister::DeviceIcons(const QString &serial) { if (IsMTPSerial(serial)) { return QVariantList(); @@ -784,21 +784,21 @@ QVariantList MacOsDeviceLister::DeviceIcons(const QString& serial) { } -QString MacOsDeviceLister::DeviceManufacturer(const QString& serial) { +QString MacOsDeviceLister::DeviceManufacturer(const QString &serial) { if (IsMTPSerial(serial)) { return mtp_devices_[serial].vendor; } return FindDeviceProperty(current_devices_[serial], CFSTR(kUSBVendorString)); } -QString MacOsDeviceLister::DeviceModel(const QString& serial) { +QString MacOsDeviceLister::DeviceModel(const QString &serial) { if (IsMTPSerial(serial)) { return mtp_devices_[serial].product; } return FindDeviceProperty(current_devices_[serial], CFSTR(kUSBProductString)); } -quint64 MacOsDeviceLister::DeviceCapacity(const QString& serial) { +quint64 MacOsDeviceLister::DeviceCapacity(const QString &serial) { if (IsMTPSerial(serial)) { QList urls = MakeDeviceUrls(serial); @@ -810,7 +810,7 @@ quint64 MacOsDeviceLister::DeviceCapacity(const QString& serial) { io_object_t device = DADiskCopyIOMedia(disk); - NSNumber* capacity = (NSNumber*)GetPropertyForDevice(device, CFSTR("Size")); + NSNumber *capacity = (NSNumber*)GetPropertyForDevice(device, CFSTR("Size")); quint64 ret = [capacity unsignedLongLongValue]; @@ -820,7 +820,7 @@ quint64 MacOsDeviceLister::DeviceCapacity(const QString& serial) { } -quint64 MacOsDeviceLister::DeviceFreeSpace(const QString& serial) { +quint64 MacOsDeviceLister::DeviceFreeSpace(const QString &serial) { if (IsMTPSerial(serial)) { QList urls = MakeDeviceUrls(serial); @@ -833,8 +833,8 @@ quint64 MacOsDeviceLister::DeviceFreeSpace(const QString& serial) { scoped_nsobject properties((NSDictionary*)DADiskCopyDescription(disk)); scoped_nsobject volume_path([ [properties objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy]); - NSNumber* value = nil; - NSError* error = nil; + NSNumber *value = nil; + NSError *error = nil; if ([volume_path getResourceValue:&value forKey: NSURLVolumeAvailableCapacityKey error: &error] && value) { return [value unsignedLongLongValue]; } @@ -842,16 +842,16 @@ quint64 MacOsDeviceLister::DeviceFreeSpace(const QString& serial) { } -QVariantMap MacOsDeviceLister::DeviceHardwareInfo(const QString& serial){ +QVariantMap MacOsDeviceLister::DeviceHardwareInfo(const QString &serial){ Q_UNUSED(serial); return QVariantMap(); } -bool MacOsDeviceLister::AskForScan(const QString& serial) const { +bool MacOsDeviceLister::AskForScan(const QString &serial) const { return !IsCDDevice(serial); } -void MacOsDeviceLister::UnmountDevice(const QString& serial) { +void MacOsDeviceLister::UnmountDevice(const QString &serial) { if (IsMTPSerial(serial)) return; @@ -862,7 +862,7 @@ void MacOsDeviceLister::UnmountDevice(const QString& serial) { } -void MacOsDeviceLister::DiskUnmountCallback(DADiskRef disk, DADissenterRef dissenter, void* context) { +void MacOsDeviceLister::DiskUnmountCallback(DADiskRef disk, DADissenterRef dissenter, void *context) { if (dissenter) { qLog(Warning) << "Another app blocked the unmount"; @@ -873,12 +873,12 @@ void MacOsDeviceLister::DiskUnmountCallback(DADiskRef disk, DADissenterRef disse } -void MacOsDeviceLister::UpdateDeviceFreeSpace(const QString& serial) { +void MacOsDeviceLister::UpdateDeviceFreeSpace(const QString &serial) { if (IsMTPSerial(serial)) { if (mtp_devices_.contains(serial)) { QList urls = MakeDeviceUrls(serial); - MTPDevice* d = &mtp_devices_[serial]; + MTPDevice *d = &mtp_devices_[serial]; d->free_space = GetFreeSpace(urls[0]); } } diff --git a/src/device/mtpdevice.cpp b/src/device/mtpdevice.cpp index 28202348..b8c41a58 100644 --- a/src/device/mtpdevice.cpp +++ b/src/device/mtpdevice.cpp @@ -49,7 +49,7 @@ class DeviceManager; bool MtpDevice::sInitializedLibMTP = false; -MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time) +MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time) : ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), loader_(nullptr), loader_thread_(nullptr), @@ -112,7 +112,7 @@ void MtpDevice::Close() { } -void MtpDevice::LoadFinished(bool success, MtpConnection *connection) { +void MtpDevice::LoadFinished(const bool success, MtpConnection *connection) { connection_.reset(connection); @@ -129,7 +129,7 @@ void MtpDevice::LoadFinished(bool success, MtpConnection *connection) { } -void MtpDevice::LoaderError(const QString& message) { +void MtpDevice::LoaderError(const QString &message) { app_->AddError(message); } @@ -190,7 +190,7 @@ bool MtpDevice::CopyToStorage(const CopyJob &job) { } -void MtpDevice::FinishCopy(bool success) { +void MtpDevice::FinishCopy(const bool success) { if (success) { if (!songs_to_add_.isEmpty()) backend_->AddOrUpdateSongs(songs_to_add_); @@ -234,7 +234,7 @@ bool MtpDevice::DeleteFromStorage(const DeleteJob &job) { } -void MtpDevice::FinishDelete(bool success) { FinishCopy(success); } +void MtpDevice::FinishDelete(const bool success) { FinishCopy(success); } bool MtpDevice::GetSupportedFiletypes(QList *ret) { @@ -286,4 +286,3 @@ bool MtpDevice::GetSupportedFiletypes(QList *ret, LIBMTP_mtpdevi return true; } - diff --git a/src/device/mtpdevice.h b/src/device/mtpdevice.h index b6958e9d..d3958124 100644 --- a/src/device/mtpdevice.h +++ b/src/device/mtpdevice.h @@ -48,7 +48,7 @@ class MtpDevice : public ConnectedDevice { Q_OBJECT public: - Q_INVOKABLE MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time); + Q_INVOKABLE MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, const int database_id, const bool first_time); ~MtpDevice() override; static QStringList url_schemes() { return QStringList() << "mtp"; } @@ -58,26 +58,26 @@ class MtpDevice : public ConnectedDevice { void Close() override; bool IsLoading() override { return loader_; } - bool GetSupportedFiletypes(QList* ret) override; + bool GetSupportedFiletypes(QList *ret) override; int GetFreeSpace(); int GetCapacity(); - bool StartCopy(QList* supported_types) override; - bool CopyToStorage(const CopyJob& job) override; - void FinishCopy(bool success) override; + bool StartCopy(QList *supported_types) override; + bool CopyToStorage(const CopyJob &job) override; + void FinishCopy(const bool success) override; void StartDelete() override; - bool DeleteFromStorage(const DeleteJob& job) override; - void FinishDelete(bool success) override; + bool DeleteFromStorage(const DeleteJob &job) override; + void FinishDelete(const bool success) override; private slots: void LoadFinished(bool success, MtpConnection *connection); - void LoaderError(const QString& message); + void LoaderError(const QString &message); private: bool GetSupportedFiletypes(QList *ret, LIBMTP_mtpdevice_struct *device); - int GetFreeSpace(LIBMTP_mtpdevice_struct* device); - int GetCapacity(LIBMTP_mtpdevice_struct* device); + int GetFreeSpace(LIBMTP_mtpdevice_struct *device); + int GetCapacity(LIBMTP_mtpdevice_struct *device); private: static bool sInitializedLibMTP; diff --git a/src/device/mtploader.cpp b/src/device/mtploader.cpp index cc65c730..2ebe30ee 100644 --- a/src/device/mtploader.cpp +++ b/src/device/mtploader.cpp @@ -70,7 +70,7 @@ bool MtpLoader::TryLoad() { // Load the list of songs on the device SongList songs; - LIBMTP_track_t* tracks = LIBMTP_Get_Tracklisting_With_Callback(connection_->device(), nullptr, nullptr); + LIBMTP_track_t *tracks = LIBMTP_Get_Tracklisting_With_Callback(connection_->device(), nullptr, nullptr); while (tracks) { if (abort_) break; diff --git a/src/dialogs/about.h b/src/dialogs/about.h index e99d290e..5ed3ad71 100644 --- a/src/dialogs/about.h +++ b/src/dialogs/about.h @@ -49,7 +49,7 @@ class About : public QDialog { QString MainHtml() const; QString ContributorsHtml() const; - QString PersonToHtml(const Person& person) const; + QString PersonToHtml(const Person &person) const; private: Ui::About ui_; diff --git a/src/dialogs/addstreamdialog.cpp b/src/dialogs/addstreamdialog.cpp index de01b6e8..27b762cd 100644 --- a/src/dialogs/addstreamdialog.cpp +++ b/src/dialogs/addstreamdialog.cpp @@ -28,7 +28,7 @@ #include #include -AddStreamDialog::AddStreamDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_AddStreamDialog) { +AddStreamDialog::AddStreamDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_AddStreamDialog) { ui_->setupUi(this); diff --git a/src/engine/gstelementdeleter.cpp b/src/engine/gstelementdeleter.cpp index 17edb8d8..ebc13564 100644 --- a/src/engine/gstelementdeleter.cpp +++ b/src/engine/gstelementdeleter.cpp @@ -26,7 +26,7 @@ GstElementDeleter::GstElementDeleter(QObject *parent) : QObject(parent) {} -void GstElementDeleter::DeleteElementLater(GstElement* element) { +void GstElementDeleter::DeleteElementLater(GstElement *element) { metaObject()->invokeMethod(this, "DeleteElement", Qt::QueuedConnection, Q_ARG(GstElement*, element)); } diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index 90f9d371..11bca611 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -1163,7 +1163,7 @@ void GstEnginePipeline::UpdateStereoBalance() { } -void GstEnginePipeline::SetEqualizerParams(const int preamp, const QList& band_gains) { +void GstEnginePipeline::SetEqualizerParams(const int preamp, const QList &band_gains) { eq_preamp_ = preamp; eq_band_gains_ = band_gains; diff --git a/src/engine/gstenginepipeline.h b/src/engine/gstenginepipeline.h index 4e54e8f9..db42eb98 100644 --- a/src/engine/gstenginepipeline.h +++ b/src/engine/gstenginepipeline.h @@ -144,7 +144,7 @@ class GstEnginePipeline : public QObject { // Static callbacks. The GstEnginePipeline instance is passed in the last argument. static GstPadProbeReturn EventHandoffCallback(GstPad*, GstPadProbeInfo*, gpointer); - static void SourceSetupCallback(GstPlayBin*, GParamSpec* pspec, gpointer); + static void SourceSetupCallback(GstPlayBin*, GParamSpec *pspec, gpointer); static void NewPadCallback(GstElement*, GstPad*, gpointer); static GstPadProbeReturn PlaybinProbe(GstPad*, GstPadProbeInfo*, gpointer); static GstPadProbeReturn HandoffCallback(GstPad*, GstPadProbeInfo*, gpointer); diff --git a/src/engine/macosdevicefinder.cpp b/src/engine/macosdevicefinder.cpp index f6107749..b5b79296 100644 --- a/src/engine/macosdevicefinder.cpp +++ b/src/engine/macosdevicefinder.cpp @@ -35,7 +35,7 @@ namespace { template -std::unique_ptr GetProperty(const AudioDeviceID& device_id, const AudioObjectPropertyAddress& address, UInt32* size_bytes_out = nullptr) { +std::unique_ptr GetProperty(const AudioDeviceID &device_id, const AudioObjectPropertyAddress &address, UInt32 *size_bytes_out = nullptr) { UInt32 size_bytes = 0; OSStatus status = AudioObjectGetPropertyDataSize(device_id, &address, 0, NULL, &size_bytes); diff --git a/src/engine/vlcengine.h b/src/engine/vlcengine.h index 36a7c9eb..3603ab54 100644 --- a/src/engine/vlcengine.h +++ b/src/engine/vlcengine.h @@ -76,8 +76,8 @@ class VLCEngine : public Engine::Base { uint position() const; uint length() const; bool CanDecode(const QUrl &url); - void AttachCallback(libvlc_event_manager_t* em, libvlc_event_type_t type, libvlc_callback_t callback); - static void StateChangedCallback(const libvlc_event_t* e, void* data); + void AttachCallback(libvlc_event_manager_t *em, libvlc_event_type_t type, libvlc_callback_t callback); + static void StateChangedCallback(const libvlc_event_t *e, void *data); PluginDetailsList GetPluginList() const; void GetDevicesList(const QString &output) const; diff --git a/src/engine/vlcscopedref.h b/src/engine/vlcscopedref.h index 85c0ac52..855575e8 100644 --- a/src/engine/vlcscopedref.h +++ b/src/engine/vlcscopedref.h @@ -28,38 +28,38 @@ template class VlcScopedRef { public: - explicit VlcScopedRef(T* ptr); + explicit VlcScopedRef(T *ptr); ~VlcScopedRef(); - operator T* () const { return ptr_; } + operator T*() const { return ptr_; } operator bool () const { return ptr_; } - T* operator ->() const { return ptr_; } + T *operator->() const { return ptr_; } private: VlcScopedRef(VlcScopedRef&) {} - VlcScopedRef& operator =(const VlcScopedRef&) { return *this; } + VlcScopedRef &operator =(const VlcScopedRef&) { return *this; } - T* ptr_; + T *ptr_; }; #define VLCSCOPEDREF_DEFINE2(type, dtor) \ - template <> void VlcScopedRef_Release(libvlc_##type##_t* ptr) { \ + template <> void VlcScopedRef_Release(libvlc_##type##_t *ptr) { \ dtor(ptr); \ } #define VLCSCOPEDREF_DEFINE(type) VLCSCOPEDREF_DEFINE2(type, libvlc_##type##_release) template -void VlcScopedRef_Release(T* ptr); +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 -VlcScopedRef::VlcScopedRef(T* ptr) +VlcScopedRef::VlcScopedRef(T *ptr) : ptr_(ptr) { } diff --git a/src/equalizer/equalizer.cpp b/src/equalizer/equalizer.cpp index 72b16d1f..578abb98 100644 --- a/src/equalizer/equalizer.cpp +++ b/src/equalizer/equalizer.cpp @@ -156,7 +156,7 @@ void Equalizer::LoadDefaultPresets() { } -void Equalizer::AddPreset(const QString& name, const Params& params) { +void Equalizer::AddPreset(const QString &name, const Params ¶ms) { QString name_displayed = tr(qPrintable(name)); presets_[name] = params; @@ -168,12 +168,12 @@ void Equalizer::AddPreset(const QString& name, const Params& params) { } } -void Equalizer::PresetChanged(int index) { +void Equalizer::PresetChanged(const int index) { PresetChanged(ui_->preset->itemData(index).toString()); } -void Equalizer::PresetChanged(const QString& name) { +void Equalizer::PresetChanged(const QString &name) { if (presets_.contains(last_preset_)) { if (presets_[last_preset_] != current_params()) { @@ -182,7 +182,7 @@ void Equalizer::PresetChanged(const QString& name) { } last_preset_ = name; - Params& p = presets_[name]; + Params &p = presets_[name]; loading_ = true; preamp_->set_value(p.preamp); @@ -292,7 +292,7 @@ void Equalizer::StereoBalancerEnabledChangedSlot(const bool enabled) { } -void Equalizer::StereoBalanceSliderChanged(int) { +void Equalizer::StereoBalanceSliderChanged(const int) { emit StereoBalanceChanged(stereo_balance()); Save(); @@ -369,7 +369,7 @@ Equalizer::Params::Params(int g0, int g1, int g2, int g3, int g4, int g5, int g6 gain[9] = g9; } -bool Equalizer::Params::operator ==(const Equalizer::Params& other) const { +bool Equalizer::Params::operator ==(const Equalizer::Params &other) const { if (preamp != other.preamp) return false; for (int i = 0; i < Equalizer::kBands; ++i) { if (gain[i] != other.gain[i]) return false; @@ -377,17 +377,17 @@ bool Equalizer::Params::operator ==(const Equalizer::Params& other) const { return true; } -bool Equalizer::Params::operator !=(const Equalizer::Params& other) const { +bool Equalizer::Params::operator !=(const Equalizer::Params &other) const { return ! (*this == other); } -QDataStream &operator<<(QDataStream& s, const Equalizer::Params& p) { +QDataStream &operator<<(QDataStream &s, const Equalizer::Params &p) { s << p.preamp; for (int i = 0; i < Equalizer::kBands; ++i) s << p.gain[i]; return s; } -QDataStream &operator>>(QDataStream& s, Equalizer::Params& p) { +QDataStream &operator>>(QDataStream &s, Equalizer::Params &p) { s >> p.preamp; for (int i = 0; i < Equalizer::kBands; ++i) s >> p.gain[i]; return s; diff --git a/src/equalizer/equalizer.h b/src/equalizer/equalizer.h index c3037060..0c3001b3 100644 --- a/src/equalizer/equalizer.h +++ b/src/equalizer/equalizer.h @@ -81,7 +81,7 @@ class Equalizer : public QDialog { void EqualizerEnabledChangedSlot(const bool enabled); void EqualizerParametersChangedSlot(); void PresetChanged(const QString &name); - void PresetChanged(int index); + void PresetChanged(const int index); void SavePreset(); void DelPreset(); void Save(); diff --git a/src/globalshortcuts/globalshortcutgrabber.mm b/src/globalshortcuts/globalshortcutgrabber.mm index 53ca55d0..ee9df649 100644 --- a/src/globalshortcuts/globalshortcutgrabber.mm +++ b/src/globalshortcuts/globalshortcutgrabber.mm @@ -42,7 +42,8 @@ class MacMonitorWrapper { Q_DISABLE_COPY(MacMonitorWrapper); }; -bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) { +bool GlobalShortcutGrabber::HandleMacEvent(NSEvent *event) { + ret_ = mac::KeySequenceFromNSEvent(event); UpdateText(); if ([[event charactersIgnoringModifiers] length] != 0) { @@ -50,13 +51,16 @@ bool GlobalShortcutGrabber::HandleMacEvent(NSEvent* event) { return true; } return ret_ == QKeySequence(Qt::Key_Escape); + } void GlobalShortcutGrabber::SetupMacEventHandler() { - id monitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSEventMaskKeyDown handler:^(NSEvent* event) { - return HandleMacEvent(event) ? event : nil; + + id monitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSEventMaskKeyDown handler:^(NSEvent *event) { + return HandleMacEvent(event) ? event : nil; }]; wrapper_ = new MacMonitorWrapper(monitor); + } void GlobalShortcutGrabber::TeardownMacEventHandler() { delete wrapper_; } diff --git a/src/globalshortcuts/globalshortcutsbackend-macos.mm b/src/globalshortcuts/globalshortcutsbackend-macos.mm index 8519cc70..9ed4070e 100644 --- a/src/globalshortcuts/globalshortcutsbackend-macos.mm +++ b/src/globalshortcuts/globalshortcutsbackend-macos.mm @@ -47,14 +47,14 @@ class GlobalShortcutsBackendMacOSPrivate : boost::noncopyable { public: - explicit GlobalShortcutsBackendMacOSPrivate(GlobalShortcutsBackendMacOS* backend) + explicit GlobalShortcutsBackendMacOSPrivate(GlobalShortcutsBackendMacOS *backend) : global_monitor_(nil), local_monitor_(nil), backend_(backend) {} bool Register() { - global_monitor_ = [NSEvent addGlobalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent* event) { + global_monitor_ = [NSEvent addGlobalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent *event) { HandleKeyEvent(event); } ]; - local_monitor_ = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent* event) { + local_monitor_ = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent *event) { // Filter event if we handle it as a global shortcut. return HandleKeyEvent(event) ? nil : event; } ]; @@ -67,17 +67,17 @@ class GlobalShortcutsBackendMacOSPrivate : boost::noncopyable { } private: - bool HandleKeyEvent(NSEvent* event) { + bool HandleKeyEvent(NSEvent *event) { QKeySequence sequence = mac::KeySequenceFromNSEvent(event); return backend_->KeyPressed(sequence); } id global_monitor_; id local_monitor_; - GlobalShortcutsBackendMacOS* backend_; + GlobalShortcutsBackendMacOS *backend_; }; -GlobalShortcutsBackendMacOS::GlobalShortcutsBackendMacOS(GlobalShortcutsManager* parent) +GlobalShortcutsBackendMacOS::GlobalShortcutsBackendMacOS(GlobalShortcutsManager *parent) : GlobalShortcutsBackend(parent), p_(new GlobalShortcutsBackendMacOSPrivate(this)) {} @@ -88,7 +88,8 @@ bool GlobalShortcutsBackendMacOS::DoRegister() { // Always enable media keys. mac::SetShortcutHandler(this); - for (const GlobalShortcutsManager::Shortcut& shortcut : manager_->shortcuts().values()) { + QList shortcuts = manager_->shortcuts().values(); + for (const GlobalShortcutsManager::Shortcut &shortcut : shortcuts) { shortcuts_[shortcut.action->shortcut()] = shortcut.action; } @@ -119,12 +120,12 @@ void GlobalShortcutsBackendMacOS::MacMediaKeyPressed(int key) { } -bool GlobalShortcutsBackendMacOS::KeyPressed(const QKeySequence& sequence) { +bool GlobalShortcutsBackendMacOS::KeyPressed(const QKeySequence &sequence) { if (sequence.isEmpty()) { return false; } - QAction* action = shortcuts_[sequence]; + QAction *action = shortcuts_[sequence]; if (action) { action->trigger(); return true; @@ -144,12 +145,12 @@ void GlobalShortcutsBackendMacOS::ShowAccessibilityDialog() { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory, NSSystemDomainMask, YES); if ([paths count] == 1) { - SBSystemPreferencesApplication* system_prefs = [SBApplication applicationWithBundleIdentifier:@"com.apple.systempreferences"]; + SBSystemPreferencesApplication *system_prefs = [SBApplication applicationWithBundleIdentifier:@"com.apple.systempreferences"]; [system_prefs activate]; - SBElementArray* panes = [system_prefs panes]; - SBSystemPreferencesPane* security_pane = nil; - for (SBSystemPreferencesPane* pane : panes) { + SBElementArray *panes = [system_prefs panes]; + SBSystemPreferencesPane *security_pane = nil; + for (SBSystemPreferencesPane *pane : panes) { if ([ [pane id] isEqualToString:@"com.apple.preference.security"]) { security_pane = pane; break; @@ -157,8 +158,8 @@ void GlobalShortcutsBackendMacOS::ShowAccessibilityDialog() { } [system_prefs setCurrentPane:security_pane]; - SBElementArray* anchors = [security_pane anchors]; - for (SBSystemPreferencesAnchor* anchor : anchors) { + SBElementArray *anchors = [security_pane anchors]; + for (SBSystemPreferencesAnchor *anchor : anchors) { if ([ [anchor name] isEqualToString:@"Privacy_Accessibility"]) { [anchor reveal]; } diff --git a/src/globalshortcuts/globalshortcutsbackend-system.cpp b/src/globalshortcuts/globalshortcutsbackend-system.cpp index bb0c273c..ca3112e0 100644 --- a/src/globalshortcuts/globalshortcutsbackend-system.cpp +++ b/src/globalshortcuts/globalshortcutsbackend-system.cpp @@ -43,7 +43,8 @@ bool GlobalShortcutsBackendSystem::DoRegister() { if (!gshortcut_init_) gshortcut_init_ = new GlobalShortcut(this); - for (const GlobalShortcutsManager::Shortcut &shortcut : manager_->shortcuts().values()) { + QList shortcuts = manager_->shortcuts().values(); + for (const GlobalShortcutsManager::Shortcut &shortcut : shortcuts) { AddShortcut(shortcut.action); } diff --git a/src/main.cpp b/src/main.cpp index 80aeca95..e230d7b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -111,7 +111,7 @@ # include "osd/osdbase.h" #endif -int main(int argc, char* argv[]) { +int main(int argc, char *argv[]) { #ifdef Q_OS_MACOS // Do Mac specific startup to get media keys working. diff --git a/src/main.h b/src/main.h index 21693054..5a5fc412 100644 --- a/src/main.h +++ b/src/main.h @@ -22,6 +22,6 @@ #include "config.h" -int main(int argc, char* argv[]); +int main(int argc, char *argv[]); #endif // MAIN_H diff --git a/src/moodbar/moodbarbuilder.cpp b/src/moodbar/moodbarbuilder.cpp index 615b94a6..0d50c42e 100644 --- a/src/moodbar/moodbarbuilder.cpp +++ b/src/moodbar/moodbarbuilder.cpp @@ -112,7 +112,7 @@ void MoodbarBuilder::Normalize(QList *vals, double Rgb::*member) { double tb = 0; double avgu = 0; double avgb = 0; - for (const Rgb& rgb : *vals) { + for (const Rgb &rgb : *vals) { const double value = rgb.*member; if (value != mini && value != maxi) { if (value > avg) { @@ -179,7 +179,7 @@ QByteArray MoodbarBuilder::Finish(int width) { const int end = std::max(static_cast((i + 1) * frames_.count() / width), start + 1); for (int j = start; j < end; j++) { - const Rgb& frame = frames_[j]; + const Rgb &frame = frames_[j]; rgb.r += frame.r * 255; rgb.g += frame.g * 255; rgb.b += frame.b * 255; diff --git a/src/moodbar/moodbarproxystyle.cpp b/src/moodbar/moodbarproxystyle.cpp index bbd4df8b..a95cb3f3 100644 --- a/src/moodbar/moodbarproxystyle.cpp +++ b/src/moodbar/moodbarproxystyle.cpp @@ -50,7 +50,7 @@ const int MoodbarProxyStyle::kBorderSize = 1; const int MoodbarProxyStyle::kArrowWidth = 17; const int MoodbarProxyStyle::kArrowHeight = 13; -MoodbarProxyStyle::MoodbarProxyStyle(Application* app, QSlider* slider) +MoodbarProxyStyle::MoodbarProxyStyle(Application *app, QSlider *slider) : QProxyStyle(nullptr), app_(app), slider_(slider), diff --git a/src/musicbrainz/acoustidclient.cpp b/src/musicbrainz/acoustidclient.cpp index f873be52..a981a16c 100644 --- a/src/musicbrainz/acoustidclient.cpp +++ b/src/musicbrainz/acoustidclient.cpp @@ -113,10 +113,10 @@ void AcoustidClient::CancelAll() { namespace { // Struct used when extracting results in RequestFinished struct IdSource { - IdSource(const QString& id, int source) + IdSource(const QString &id, const int source) : id_(id), nb_sources_(source) {} - bool operator<(const IdSource& other) const { + bool operator<(const IdSource &other) const { // We want the items with more sources to be at the beginning of the list return nb_sources_ > other.nb_sources_; } @@ -185,7 +185,7 @@ void AcoustidClient::RequestFinished(QNetworkReply *reply, const int request_id) std::stable_sort(id_source_list.begin(), id_source_list.end()); QList id_list; - for (const IdSource& is : id_source_list) { + for (const IdSource &is : id_source_list) { id_list << is.id_; } diff --git a/src/musicbrainz/musicbrainzclient.cpp b/src/musicbrainz/musicbrainzclient.cpp index cb920e27..6ed8b271 100644 --- a/src/musicbrainz/musicbrainzclient.cpp +++ b/src/musicbrainz/musicbrainzclient.cpp @@ -499,7 +499,7 @@ MusicBrainzClient::Release MusicBrainzClient::ParseRelease(QXmlStreamReader *rea } -MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(const ResultList& results, UniqueResultsSortOption opt) { +MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(const ResultList &results, UniqueResultsSortOption opt) { ResultList ret; if (opt == SortResults) { @@ -513,7 +513,7 @@ MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(const ResultList& else { // KeepOriginalOrder // Qt doesn't provide a ordered set (QSet "stores values in an unspecified order" according to Qt documentation). // We might use std::set instead, but it's probably faster to use ResultList directly to avoid converting from one structure to another. - for (const Result& res : results) { + for (const Result &res : results) { if (!ret.contains(res)) { ret << res; } diff --git a/src/musicbrainz/musicbrainzclient.h b/src/musicbrainz/musicbrainzclient.h index f4b5102b..b7a40810 100644 --- a/src/musicbrainz/musicbrainzclient.h +++ b/src/musicbrainz/musicbrainzclient.h @@ -56,7 +56,7 @@ class MusicBrainzClient : public QObject { struct Result { Result() : duration_msec_(0), track_(0), year_(-1) {} - bool operator<(const Result& other) const { + bool operator<(const Result &other) const { #define cmp(field) \ if ((field) < other.field) return true; \ if ((field) > other.field) return false; @@ -70,7 +70,7 @@ class MusicBrainzClient : public QObject { #undef cmp } - bool operator==(const Result& other) const { + bool operator==(const Result &other) const { return title_ == other.title_ && artist_ == other.artist_ && @@ -108,8 +108,8 @@ class MusicBrainzClient : public QObject { private slots: void FlushRequests(); // id identifies the track, and request_number means it's the 'request_number'th request for this track - void RequestFinished(QNetworkReply* reply, const int id, const int request_number); - void DiscIdRequestFinished(const QString &discid, QNetworkReply* reply); + void RequestFinished(QNetworkReply *reply, const int id, const int request_number); + void DiscIdRequestFinished(const QString &discid, QNetworkReply *reply); private: typedef QPair Param; @@ -141,7 +141,7 @@ class MusicBrainzClient : public QObject { Release() : track_(0), year_(0), status_(Status_Unknown) {} - Result CopyAndMergeInto(const Result& orig) const { + Result CopyAndMergeInto(const Result &orig) const { Result ret(orig); ret.album_ = album_; ret.track_ = track_; @@ -149,7 +149,7 @@ class MusicBrainzClient : public QObject { return ret; } - void SetStatusFromString(const QString& s) { + void SetStatusFromString(const QString &s) { if (s.compare("Official", Qt::CaseInsensitive) == 0) { status_ = Status_Official; } @@ -167,7 +167,7 @@ class MusicBrainzClient : public QObject { } } - bool operator<(const Release& other) const { + bool operator<(const Release &other) const { // Compare status so that "best" status (e.g. Official) will be first when sorting a list of releases. return status_ > other.status_; } @@ -179,9 +179,9 @@ class MusicBrainzClient : public QObject { }; struct PendingResults { - PendingResults(int sort_id, const ResultList& results) : sort_id_(sort_id), results_(results) {} + PendingResults(int sort_id, const ResultList &results) : sort_id_(sort_id), results_(results) {} - bool operator<(const PendingResults& other) const { + bool operator<(const PendingResults &other) const { return sort_id_ < other.sort_id_; } @@ -190,13 +190,13 @@ class MusicBrainzClient : public QObject { }; QByteArray GetReplyData(QNetworkReply *reply, QString &error); - static bool MediumHasDiscid(const QString& discid, QXmlStreamReader* reader); - static ResultList ParseMedium(QXmlStreamReader* reader); - static Result ParseTrackFromDisc(QXmlStreamReader* reader); - static ResultList ParseTrack(QXmlStreamReader* reader); - static void ParseArtist(QXmlStreamReader* reader, QString* artist); - static Release ParseRelease(QXmlStreamReader* reader); - static ResultList UniqueResults(const ResultList& results, UniqueResultsSortOption opt = SortResults); + static bool MediumHasDiscid(const QString &discid, QXmlStreamReader *reader); + static ResultList ParseMedium(QXmlStreamReader *reader); + static Result ParseTrackFromDisc(QXmlStreamReader *reader); + static ResultList ParseTrack(QXmlStreamReader *reader); + static void ParseArtist(QXmlStreamReader *reader, QString *artist); + static Release ParseRelease(QXmlStreamReader *reader); + static ResultList UniqueResults(const ResultList &results, UniqueResultsSortOption opt = SortResults); void Error(const QString &error, QVariant debug = QVariant()); private: @@ -208,8 +208,8 @@ class MusicBrainzClient : public QObject { static const int kDefaultTimeout; static const int kMaxRequestPerTrack; - QNetworkAccessManager* network_; - NetworkTimeouts* timeouts_; + QNetworkAccessManager *network_; + NetworkTimeouts *timeouts_; QMultiMap requests_pending_; QMultiMap requests_; // Results we received so far, kept here until all the replies are finished @@ -219,9 +219,9 @@ class MusicBrainzClient : public QObject { }; #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -inline size_t qHash(const MusicBrainzClient::Result& result) { +inline size_t qHash(const MusicBrainzClient::Result &result) { #else -inline uint qHash(const MusicBrainzClient::Result& result) { +inline uint qHash(const MusicBrainzClient::Result &result) { #endif return qHash(result.album_) ^ qHash(result.artist_) ^ result.duration_msec_ ^ qHash(result.title_) ^ result.track_ ^ result.year_; } diff --git a/src/osd/osdpretty.cpp b/src/osd/osdpretty.cpp index 273eeaf4..93db6a96 100644 --- a/src/osd/osdpretty.cpp +++ b/src/osd/osdpretty.cpp @@ -334,7 +334,7 @@ void OSDPretty::paintEvent(QPaintEvent *) { } -void OSDPretty::SetMessage(const QString &summary, const QString& message, const QImage &image) { +void OSDPretty::SetMessage(const QString &summary, const QString &message, const QImage &image) { if (!image.isNull()) { QImage scaled_image = image.scaled(kMaxIconSize, kMaxIconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation); @@ -557,17 +557,17 @@ QPoint OSDPretty::current_pos() const { } -void OSDPretty::set_background_color(QRgb color) { +void OSDPretty::set_background_color(const QRgb color) { background_color_ = color; if (isVisible()) update(); } -void OSDPretty::set_background_opacity(qreal opacity) { +void OSDPretty::set_background_opacity(const qreal opacity) { background_opacity_ = opacity; if (isVisible()) update(); } -void OSDPretty::set_foreground_color(QRgb color) { +void OSDPretty::set_foreground_color(const QRgb color) { foreground_color_ = QColor(color); @@ -579,11 +579,11 @@ void OSDPretty::set_foreground_color(QRgb color) { } -void OSDPretty::set_popup_duration(int msec) { +void OSDPretty::set_popup_duration(const int msec) { timeout_->setInterval(msec); } -void OSDPretty::set_font(QFont font) { +void OSDPretty::set_font(const QFont font) { font_ = font; diff --git a/src/osd/osdpretty.h b/src/osd/osdpretty.h index 81478299..34e7e3f4 100644 --- a/src/osd/osdpretty.h +++ b/src/osd/osdpretty.h @@ -73,17 +73,17 @@ class OSDPretty : public QWidget { bool IsTransparencyAvailable(); - void SetMessage(const QString &summary, const QString& message, const QImage &image); - void ShowMessage(const QString &summary, const QString& message, const QImage &image); + void SetMessage(const QString &summary, const QString &message, const QImage &image); + void ShowMessage(const QString &summary, const QString &message, const QImage &image); // Popup duration in seconds. Only used in Mode_Popup. - void set_popup_duration(int msec); + void set_popup_duration(const int msec); // These will get overwritten when ReloadSettings() is called - void set_foreground_color(QRgb color); - void set_background_color(QRgb color); - void set_background_opacity(qreal opacity); - void set_font(QFont font); + void set_foreground_color(const QRgb color); + void set_background_color(const QRgb color); + void set_background_opacity(const qreal opacity); + void set_font(const QFont font); QRgb foreground_color() const { return foreground_color_.rgb(); } QRgb background_color() const { return background_color_.rgb(); } @@ -104,7 +104,7 @@ class OSDPretty : public QWidget { void setVisible(bool visible) override; bool toggle_mode() const { return toggle_mode_; } - void set_toggle_mode(bool toggle_mode) { toggle_mode_ = toggle_mode; } + void set_toggle_mode(const bool toggle_mode) { toggle_mode_ = toggle_mode; } signals: void PositionChanged(); diff --git a/src/playlist/dynamicplaylistcontrols.h b/src/playlist/dynamicplaylistcontrols.h index 9f298326..cec8060c 100644 --- a/src/playlist/dynamicplaylistcontrols.h +++ b/src/playlist/dynamicplaylistcontrols.h @@ -35,7 +35,7 @@ class DynamicPlaylistControls : public QWidget { void TurnOff(); private: - Ui_DynamicPlaylistControls* ui_; + Ui_DynamicPlaylistControls *ui_; }; #endif // DYNAMICPLAYLISTCONTROLS_H diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 0b385d22..855ba90f 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -724,7 +724,7 @@ void Playlist::set_current_row(const int i, const AutoScroll autoscroll, const b void Playlist::InsertDynamicItems(const int count) { - PlaylistGeneratorInserter* inserter = new PlaylistGeneratorInserter(task_manager_, collection_, this); + PlaylistGeneratorInserter *inserter = new PlaylistGeneratorInserter(task_manager_, collection_, this); QObject::connect(inserter, &PlaylistGeneratorInserter::Error, this, &Playlist::Error); QObject::connect(inserter, &PlaylistGeneratorInserter::PlayRequested, this, &Playlist::PlayRequested); diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h index da583514..7c6b51d0 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -243,7 +243,7 @@ class Playlist : public QAbstractListModel { void InsertCollectionItems(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void InsertSongs(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void InsertSongsOrCollectionItems(const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); - void InsertInternetItems(InternetService* service, const SongList& songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); + void InsertInternetItems(InternetService *service, const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void InsertSmartPlaylist(PlaylistGeneratorPtr gen, const int pos = -1, const bool play_now = false, const bool enqueue = false, const bool enqueue_next = false); void ReshuffleIndices(); diff --git a/src/playlist/playlistmanager.h b/src/playlist/playlistmanager.h index fda28276..58286fd6 100644 --- a/src/playlist/playlistmanager.h +++ b/src/playlist/playlistmanager.h @@ -81,14 +81,14 @@ class PlaylistManagerInterface : public QObject { virtual void PlaySmartPlaylist(PlaylistGeneratorPtr generator, const bool as_new, const bool clear) = 0; public slots: - virtual void New(const QString &name, const SongList& songs = SongList(), const QString &special_type = QString()) = 0; + virtual void New(const QString &name, const SongList &songs = SongList(), const QString &special_type = QString()) = 0; virtual void Load(const QString &filename) = 0; virtual void Save(const int id, const QString &filename, const Playlist::Path path_type) = 0; virtual void Rename(const int id, const QString &new_name) = 0; virtual void Delete(const int id) = 0; virtual bool Close(const int id) = 0; virtual void Open(const int id) = 0; - virtual void ChangePlaylistOrder(const QList& ids) = 0; + virtual void ChangePlaylistOrder(const QList &ids) = 0; virtual void SongChangeRequestProcessed(const QUrl &url, const bool valid) = 0; @@ -206,12 +206,12 @@ class PlaylistManager : public PlaylistManagerInterface { void RemoveDuplicatesCurrent() override; void RemoveUnavailableCurrent() override; - void SongChangeRequestProcessed(const QUrl& url, const bool valid) override; + void SongChangeRequestProcessed(const QUrl &url, const bool valid) override; void InsertUrls(const int id, const QList &urls, const int pos = -1, const bool play_now = false, const bool enqueue = false); void InsertSongs(const int id, const SongList &songs, const int pos = -1, const bool play_now = false, const bool enqueue = false); // Removes items with given indices from the playlist. This operation is not undoable. - void RemoveItemsWithoutUndo(const int id, const QList& indices); + void RemoveItemsWithoutUndo(const int id, const QList &indices); // Remove the current playing song void RemoveCurrentSong(); @@ -229,8 +229,8 @@ class PlaylistManager : public PlaylistManagerInterface { void OneOfPlaylistsChanged(); void UpdateSummaryText(); - void SongsDiscovered(const SongList& songs); - void ItemsLoadedForSavePlaylist(const SongList &songs, const QString& filename, const Playlist::Path path_type); + void SongsDiscovered(const SongList &songs); + void ItemsLoadedForSavePlaylist(const SongList &songs, const QString &filename, const Playlist::Path path_type); void PlaylistLoaded(); private: diff --git a/src/playlist/playlistsaveoptionsdialog.h b/src/playlist/playlistsaveoptionsdialog.h index 94c9b130..384d8fe9 100644 --- a/src/playlist/playlistsaveoptionsdialog.h +++ b/src/playlist/playlistsaveoptionsdialog.h @@ -48,7 +48,7 @@ class PlaylistSaveOptionsDialog : public QDialog { private: static const char *kSettingsGroup; - Ui::PlaylistSaveOptionsDialog* ui; + Ui::PlaylistSaveOptionsDialog *ui; }; #endif // PLAYLISTSAVEOPTIONSDIALOG_H diff --git a/src/playlist/playlistsequence.h b/src/playlist/playlistsequence.h index d163fb68..20b769e6 100644 --- a/src/playlist/playlistsequence.h +++ b/src/playlist/playlistsequence.h @@ -81,14 +81,14 @@ class PlaylistSequence : public QWidget { void ShuffleModeChanged(PlaylistSequence::ShuffleMode mode); private slots: - void RepeatActionTriggered(QAction *); - void ShuffleActionTriggered(QAction *); + void RepeatActionTriggered(QAction *action); + void ShuffleActionTriggered(QAction *action); private: void Load(); void Save(); - static QIcon AddDesaturatedIcon(const QIcon& icon); - static QPixmap DesaturatedPixmap(const QPixmap& pixmap); + static QIcon AddDesaturatedIcon(const QIcon &icon); + static QPixmap DesaturatedPixmap(const QPixmap &pixmap); private: Ui_PlaylistSequence *ui_; diff --git a/src/playlist/playlistundocommands.cpp b/src/playlist/playlistundocommands.cpp index 6074f43a..b4de22bb 100644 --- a/src/playlist/playlistundocommands.cpp +++ b/src/playlist/playlistundocommands.cpp @@ -34,7 +34,7 @@ namespace PlaylistUndoCommands { -Base::Base(Playlist* playlist) : QUndoCommand(nullptr), playlist_(playlist) {} +Base::Base(Playlist *playlist) : QUndoCommand(nullptr), playlist_(playlist) {} InsertItems::InsertItems(Playlist *playlist, const PlaylistItemList &items, int pos, bool enqueue, bool enqueue_next) : Base(playlist), @@ -84,7 +84,7 @@ void RemoveItems::undo() { } bool RemoveItems::mergeWith(const QUndoCommand *other) { - const RemoveItems* remove_command = static_cast(other); + const RemoveItems *remove_command = static_cast(other); ranges_.append(remove_command->ranges_); int sum = 0; @@ -111,14 +111,14 @@ void MoveItems::undo() { playlist_->MoveItemsWithoutUndo(pos_, source_rows_); } -ReOrderItems::ReOrderItems(Playlist* playlist, const PlaylistItemList &new_items) +ReOrderItems::ReOrderItems(Playlist *playlist, const PlaylistItemList &new_items) : Base(playlist), old_items_(playlist->items_), new_items_(new_items) {} void ReOrderItems::undo() { playlist_->ReOrderWithoutUndo(old_items_); } void ReOrderItems::redo() { playlist_->ReOrderWithoutUndo(new_items_); } -SortItems::SortItems(Playlist* playlist, int column, Qt::SortOrder order, const PlaylistItemList &new_items) +SortItems::SortItems(Playlist *playlist, int column, Qt::SortOrder order, const PlaylistItemList &new_items) : ReOrderItems(playlist, new_items) { Q_UNUSED(column); @@ -129,7 +129,7 @@ SortItems::SortItems(Playlist* playlist, int column, Qt::SortOrder order, const } -ShuffleItems::ShuffleItems(Playlist* playlist, const PlaylistItemList &new_items) +ShuffleItems::ShuffleItems(Playlist *playlist, const PlaylistItemList &new_items) : ReOrderItems(playlist, new_items) { setText(tr("shuffle songs")); diff --git a/src/playlistparsers/xmlparser.h b/src/playlistparsers/xmlparser.h index 2b3f2163..c80ed96d 100644 --- a/src/playlistparsers/xmlparser.h +++ b/src/playlistparsers/xmlparser.h @@ -39,7 +39,7 @@ class XMLParser : public ParserBase { class StreamElement { public: - StreamElement(const QString& name, QXmlStreamWriter *stream) : stream_(stream) { + StreamElement(const QString &name, QXmlStreamWriter *stream) : stream_(stream) { stream->writeStartElement(name); } diff --git a/src/queue/queue.cpp b/src/queue/queue.cpp index a126a715..505c4e12 100644 --- a/src/queue/queue.cpp +++ b/src/queue/queue.cpp @@ -209,7 +209,7 @@ void Queue::InsertFirst(const QModelIndexList &source_indexes) { // Enqueue the tracks at the beginning beginInsertRows(QModelIndex(), 0, rows - 1); int offset = 0; - for (const QModelIndex& source_index : source_indexes) { + for (const QModelIndex &source_index : source_indexes) { source_indexes_.insert(offset, QPersistentModelIndex(source_index)); offset++; } diff --git a/src/settings/contextsettingspage.cpp b/src/settings/contextsettingspage.cpp index a59d9273..c065027a 100644 --- a/src/settings/contextsettingspage.cpp +++ b/src/settings/contextsettingspage.cpp @@ -60,7 +60,7 @@ const char *ContextSettingsPage::kSettingsGroupEnable[ContextSettingsOrder::NELE const qreal ContextSettingsPage::kDefaultFontSizeHeadline = 11; -ContextSettingsPage::ContextSettingsPage(SettingsDialog* dialog) : SettingsPage(dialog), ui_(new Ui_ContextSettingsPage) { +ContextSettingsPage::ContextSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_ContextSettingsPage) { ui_->setupUi(this); setWindowIcon(IconLoader::Load("view-choose")); @@ -184,17 +184,17 @@ void ContextSettingsPage::Save() { } -void ContextSettingsPage::InsertVariableFirstLine(QAction* action) { +void ContextSettingsPage::InsertVariableFirstLine(QAction *action) { // We use action name, therefore those shouldn't be translatable ui_->context_custom_text1->insert(action->text()); } -void ContextSettingsPage::InsertVariableSecondLine(QAction* action) { +void ContextSettingsPage::InsertVariableSecondLine(QAction *action) { // We use action name, therefore those shouldn't be translatable ui_->context_custom_text2->insert(action->text()); } -void ContextSettingsPage::ShowMenuTooltip(QAction* action) { +void ContextSettingsPage::ShowMenuTooltip(QAction *action) { QToolTip::showText(QCursor::pos(), action->toolTip()); } diff --git a/src/settings/moodbarsettingspage.cpp b/src/settings/moodbarsettingspage.cpp index 8aab3f94..94863ede 100644 --- a/src/settings/moodbarsettingspage.cpp +++ b/src/settings/moodbarsettingspage.cpp @@ -49,7 +49,7 @@ const char *MoodbarSettingsPage::kSettingsGroup = "Moodbar"; const int MoodbarSettingsPage::kMoodbarPreviewWidth = 150; const int MoodbarSettingsPage::kMoodbarPreviewHeight = 18; -MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog* dialog) +MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_MoodbarSettingsPage), initialized_(false) diff --git a/src/settings/moodbarsettingspage.h b/src/settings/moodbarsettingspage.h index a8ce3e3b..e1df2065 100644 --- a/src/settings/moodbarsettingspage.h +++ b/src/settings/moodbarsettingspage.h @@ -34,7 +34,7 @@ class MoodbarSettingsPage : public SettingsPage { Q_OBJECT public: - explicit MoodbarSettingsPage(SettingsDialog* dialog); + explicit MoodbarSettingsPage(SettingsDialog *dialog); ~MoodbarSettingsPage() override; static const char *kSettingsGroup; @@ -49,7 +49,7 @@ class MoodbarSettingsPage : public SettingsPage { void InitMoodbarPreviews(); - Ui_MoodbarSettingsPage* ui_; + Ui_MoodbarSettingsPage *ui_; bool initialized_; }; diff --git a/src/settings/networkproxysettingspage.cpp b/src/settings/networkproxysettingspage.cpp index f79fffc7..2dfa32ad 100644 --- a/src/settings/networkproxysettingspage.cpp +++ b/src/settings/networkproxysettingspage.cpp @@ -40,7 +40,7 @@ class SettingsDialog; const char *NetworkProxySettingsPage::kSettingsGroup = "NetworkProxy"; -NetworkProxySettingsPage::NetworkProxySettingsPage(SettingsDialog* dialog) +NetworkProxySettingsPage::NetworkProxySettingsPage(SettingsDialog *dialog) : SettingsPage(dialog), ui_(new Ui_NetworkProxySettingsPage) { ui_->setupUi(this); diff --git a/src/settings/networkproxysettingspage.h b/src/settings/networkproxysettingspage.h index c083abcc..227b188b 100644 --- a/src/settings/networkproxysettingspage.h +++ b/src/settings/networkproxysettingspage.h @@ -36,7 +36,7 @@ class NetworkProxySettingsPage : public SettingsPage { Q_OBJECT public: - explicit NetworkProxySettingsPage(SettingsDialog* dialog); + explicit NetworkProxySettingsPage(SettingsDialog *dialog); ~NetworkProxySettingsPage() override; static const char *kSettingsGroup; @@ -45,7 +45,7 @@ class NetworkProxySettingsPage : public SettingsPage { void Save() override; private: - Ui_NetworkProxySettingsPage* ui_; + Ui_NetworkProxySettingsPage *ui_; }; #endif // NETWORKPROXYSETTINGSPAGE_H diff --git a/src/settings/notificationssettingspage.cpp b/src/settings/notificationssettingspage.cpp index a82fb7e0..c3179d6d 100644 --- a/src/settings/notificationssettingspage.cpp +++ b/src/settings/notificationssettingspage.cpp @@ -346,17 +346,17 @@ void NotificationsSettingsPage::PrepareNotificationPreview() { } -void NotificationsSettingsPage::InsertVariableFirstLine(QAction* action) { +void NotificationsSettingsPage::InsertVariableFirstLine(QAction *action) { // We use action name, therefore those shouldn't be translatable ui_->notifications_custom_text1->insert(action->text()); } -void NotificationsSettingsPage::InsertVariableSecondLine(QAction* action) { +void NotificationsSettingsPage::InsertVariableSecondLine(QAction *action) { // We use action name, therefore those shouldn't be translatable ui_->notifications_custom_text2->insert(action->text()); } -void NotificationsSettingsPage::ShowMenuTooltip(QAction* action) { +void NotificationsSettingsPage::ShowMenuTooltip(QAction *action) { QToolTip::showText(QCursor::pos(), action->toolTip()); } diff --git a/src/settings/playlistsettingspage.h b/src/settings/playlistsettingspage.h index f1560326..22c54789 100644 --- a/src/settings/playlistsettingspage.h +++ b/src/settings/playlistsettingspage.h @@ -36,7 +36,7 @@ class PlaylistSettingsPage : public SettingsPage { Q_OBJECT public: - explicit PlaylistSettingsPage(SettingsDialog* dialog); + explicit PlaylistSettingsPage(SettingsDialog *dialog); ~PlaylistSettingsPage() override; static const char *kSettingsGroup; @@ -44,7 +44,7 @@ class PlaylistSettingsPage : public SettingsPage { void Save() override; private: - Ui_PlaylistSettingsPage* ui_; + Ui_PlaylistSettingsPage *ui_; }; diff --git a/src/settings/qobuzsettingspage.h b/src/settings/qobuzsettingspage.h index ae96ecd9..301be094 100644 --- a/src/settings/qobuzsettingspage.h +++ b/src/settings/qobuzsettingspage.h @@ -34,7 +34,7 @@ class QobuzSettingsPage : public SettingsPage { Q_OBJECT public: - explicit QobuzSettingsPage(SettingsDialog* parent = nullptr); + explicit QobuzSettingsPage(SettingsDialog *parent = nullptr); ~QobuzSettingsPage() override; static const char *kSettingsGroup; @@ -54,7 +54,7 @@ class QobuzSettingsPage : public SettingsPage { void LoginFailure(QString failure_reason); private: - Ui_QobuzSettingsPage* ui_; + Ui_QobuzSettingsPage *ui_; QobuzService *service_; }; diff --git a/src/settings/scrobblersettingspage.h b/src/settings/scrobblersettingspage.h index 3557237a..78c75c11 100644 --- a/src/settings/scrobblersettingspage.h +++ b/src/settings/scrobblersettingspage.h @@ -60,7 +60,7 @@ class ScrobblerSettingsPage : public SettingsPage { LastFMScrobbler *lastfmscrobbler_; LibreFMScrobbler *librefmscrobbler_; ListenBrainzScrobbler *listenbrainzscrobbler_; - Ui_ScrobblerSettingsPage* ui_; + Ui_ScrobblerSettingsPage *ui_; bool lastfm_waiting_for_auth_; bool librefm_waiting_for_auth_; diff --git a/src/settings/subsonicsettingspage.h b/src/settings/subsonicsettingspage.h index ead21ab5..77c510c6 100644 --- a/src/settings/subsonicsettingspage.h +++ b/src/settings/subsonicsettingspage.h @@ -37,7 +37,7 @@ class SubsonicSettingsPage : public SettingsPage { Q_OBJECT public: - explicit SubsonicSettingsPage(SettingsDialog* parent = nullptr); + explicit SubsonicSettingsPage(SettingsDialog *parent = nullptr); ~SubsonicSettingsPage() override; static const char *kSettingsGroup; @@ -56,7 +56,7 @@ class SubsonicSettingsPage : public SettingsPage { void TestFailure(QString failure_reason); private: - Ui_SubsonicSettingsPage* ui_; + Ui_SubsonicSettingsPage *ui_; SubsonicService *service_; }; diff --git a/src/settings/tidalsettingspage.h b/src/settings/tidalsettingspage.h index 923cc68e..c07784da 100644 --- a/src/settings/tidalsettingspage.h +++ b/src/settings/tidalsettingspage.h @@ -36,7 +36,7 @@ class TidalSettingsPage : public SettingsPage { Q_OBJECT public: - explicit TidalSettingsPage(SettingsDialog* parent = nullptr); + explicit TidalSettingsPage(SettingsDialog *parent = nullptr); ~TidalSettingsPage() override; static const char *kSettingsGroup; @@ -64,7 +64,7 @@ class TidalSettingsPage : public SettingsPage { void LoginFailure(const QString &failure_reason); private: - Ui_TidalSettingsPage* ui_; + Ui_TidalSettingsPage *ui_; TidalService *service_; }; diff --git a/src/smartplaylists/smartplaylistquerywizardplugin.cpp b/src/smartplaylists/smartplaylistquerywizardplugin.cpp index feb4a5be..1533fa35 100644 --- a/src/smartplaylists/smartplaylistquerywizardplugin.cpp +++ b/src/smartplaylists/smartplaylistquerywizardplugin.cpp @@ -173,7 +173,7 @@ void SmartPlaylistQueryWizardPlugin::SetGenerator(PlaylistGeneratorPtr g) { qDeleteAll(search_page_->terms_); search_page_->terms_.clear(); - for (const SmartPlaylistSearchTerm& term : search.terms_) { + for (const SmartPlaylistSearchTerm &term : search.terms_) { AddSearchTerm(); search_page_->terms_.last()->SetTerm(term); } diff --git a/src/smartplaylists/smartplaylistsearchpreview.cpp b/src/smartplaylists/smartplaylistsearchpreview.cpp index 7886861b..3cc51451 100644 --- a/src/smartplaylists/smartplaylistsearchpreview.cpp +++ b/src/smartplaylists/smartplaylistsearchpreview.cpp @@ -35,7 +35,7 @@ #include "playlist/playlist.h" #include "playlistquerygenerator.h" -SmartPlaylistSearchPreview::SmartPlaylistSearchPreview(QWidget* parent) +SmartPlaylistSearchPreview::SmartPlaylistSearchPreview(QWidget *parent) : QWidget(parent), ui_(new Ui_SmartPlaylistSearchPreview), model_(nullptr) { diff --git a/src/smartplaylists/smartplaylistsearchtermwidget.cpp b/src/smartplaylists/smartplaylistsearchtermwidget.cpp index 8f9e02d9..4bbcc5c9 100644 --- a/src/smartplaylists/smartplaylistsearchtermwidget.cpp +++ b/src/smartplaylists/smartplaylistsearchtermwidget.cpp @@ -74,7 +74,7 @@ class SmartPlaylistSearchTermWidget::Overlay : public QWidget { const int SmartPlaylistSearchTermWidget::Overlay::kSpacing = 6; const int SmartPlaylistSearchTermWidget::Overlay::kIconSize = 22; -SmartPlaylistSearchTermWidget::SmartPlaylistSearchTermWidget(CollectionBackend* collection, QWidget* parent) +SmartPlaylistSearchTermWidget::SmartPlaylistSearchTermWidget(CollectionBackend *collection, QWidget *parent) : QWidget(parent), ui_(new Ui_SmartPlaylistSearchTermWidget), collection_(collection), @@ -154,7 +154,7 @@ void SmartPlaylistSearchTermWidget::FieldChanged(int index) { } // Show the correct value editor - QWidget* page = nullptr; + QWidget *page = nullptr; SmartPlaylistSearchTerm::Operator op = static_cast( ui_->op->itemData(ui_->op->currentIndex()).toInt() ); @@ -215,7 +215,7 @@ void SmartPlaylistSearchTermWidget::OpChanged(int idx) { // We need to change the page only in the following case if ((ui_->value_stack->currentWidget() == ui_->page_text) || (ui_->value_stack->currentWidget() == ui_->page_empty)) { - QWidget* page = nullptr; + QWidget *page = nullptr; if (op == SmartPlaylistSearchTerm::Op_Empty || op == SmartPlaylistSearchTerm::Op_NotEmpty) { page = ui_->page_empty; } @@ -229,7 +229,7 @@ void SmartPlaylistSearchTermWidget::OpChanged(int idx) { (ui_->value_stack->currentWidget() == ui_->page_date_numeric) || (ui_->value_stack->currentWidget() == ui_->page_date_relative) ) { - QWidget* page = nullptr; + QWidget *page = nullptr; if (op == SmartPlaylistSearchTerm::Op_NumericDate || op == SmartPlaylistSearchTerm::Op_NumericDateNot) { page = ui_->page_date_numeric; } @@ -289,7 +289,7 @@ void SmartPlaylistSearchTermWidget::leaveEvent(QEvent*) { } -void SmartPlaylistSearchTermWidget::resizeEvent(QResizeEvent* e) { +void SmartPlaylistSearchTermWidget::resizeEvent(QResizeEvent *e) { QWidget::resizeEvent(e); if (overlay_ && overlay_->isVisible()) { @@ -298,7 +298,7 @@ void SmartPlaylistSearchTermWidget::resizeEvent(QResizeEvent* e) { } -void SmartPlaylistSearchTermWidget::showEvent(QShowEvent* e) { +void SmartPlaylistSearchTermWidget::showEvent(QShowEvent *e) { QWidget::showEvent(e); if (overlay_) { diff --git a/src/smartplaylists/smartplaylistsearchtermwidget.h b/src/smartplaylists/smartplaylistsearchtermwidget.h index 3bd192fb..63d78a28 100644 --- a/src/smartplaylists/smartplaylistsearchtermwidget.h +++ b/src/smartplaylists/smartplaylistsearchtermwidget.h @@ -51,7 +51,7 @@ class SmartPlaylistSearchTermWidget : public QWidget { float overlay_opacity() const; void set_overlay_opacity(const float opacity); - void SetTerm(const SmartPlaylistSearchTerm& term); + void SetTerm(const SmartPlaylistSearchTerm &term); SmartPlaylistSearchTerm Term() const; signals: diff --git a/src/subsonic/subsonicbaserequest.cpp b/src/subsonic/subsonicbaserequest.cpp index 10370801..8b2b4bc0 100644 --- a/src/subsonic/subsonicbaserequest.cpp +++ b/src/subsonic/subsonicbaserequest.cpp @@ -63,7 +63,7 @@ QUrl SubsonicBaseRequest::CreateUrl(const QString &ressource_name, const QList

setupUi(this); } diff --git a/src/transcoder/transcoderoptionsmp3.h b/src/transcoder/transcoderoptionsmp3.h index 58082a76..a63ec276 100644 --- a/src/transcoder/transcoderoptionsmp3.h +++ b/src/transcoder/transcoderoptionsmp3.h @@ -46,7 +46,7 @@ class TranscoderOptionsMP3 : public TranscoderOptionsInterface { void QualitySpinboxChanged(double value); private: - static const char* kSettingsGroup; + static const char *kSettingsGroup; Ui_TranscoderOptionsMP3 *ui_; }; diff --git a/src/transcoder/transcoderoptionsvorbis.h b/src/transcoder/transcoderoptionsvorbis.h index ebdb8a34..5608185d 100644 --- a/src/transcoder/transcoderoptionsvorbis.h +++ b/src/transcoder/transcoderoptionsvorbis.h @@ -31,7 +31,7 @@ class Ui_TranscoderOptionsVorbis; class TranscoderOptionsVorbis : public TranscoderOptionsInterface { public: - explicit TranscoderOptionsVorbis(QWidget* parent = nullptr); + explicit TranscoderOptionsVorbis(QWidget *parent = nullptr); ~TranscoderOptionsVorbis() override; void Load() override; diff --git a/src/widgets/busyindicator.cpp b/src/widgets/busyindicator.cpp index 8fb7dedc..c4726186 100644 --- a/src/widgets/busyindicator.cpp +++ b/src/widgets/busyindicator.cpp @@ -32,12 +32,12 @@ class QHideEvent; class QShowEvent; -BusyIndicator::BusyIndicator(const QString &text, QWidget* parent) +BusyIndicator::BusyIndicator(const QString &text, QWidget *parent) : QWidget(parent) { Init(text); } -BusyIndicator::BusyIndicator(QWidget* parent) +BusyIndicator::BusyIndicator(QWidget *parent) : QWidget(parent) { Init(QString()); } diff --git a/src/widgets/fileviewlist.cpp b/src/widgets/fileviewlist.cpp index a9ab7c00..67c2e86a 100644 --- a/src/widgets/fileviewlist.cpp +++ b/src/widgets/fileviewlist.cpp @@ -69,7 +69,8 @@ void FileViewList::contextMenuEvent(QContextMenuEvent *e) { QList FileViewList::UrlListFromSelection() const { QList urls; - for (const QModelIndex& index : menu_selection_.indexes()) { + const QModelIndexList indexes = menu_selection_.indexes(); + for (const QModelIndex &index : indexes) { if (index.column() == 0) urls << QUrl::fromLocalFile(qobject_cast(model())->fileInfo(index).canonicalFilePath()); } @@ -119,7 +120,8 @@ MimeData *FileViewList::MimeDataFromSelection() const { QStringList FileViewList::FilenamesFromSelection() const { QStringList filenames; - for (const QModelIndex& index : menu_selection_.indexes()) { + const QModelIndexList indexes = menu_selection_.indexes(); + for (const QModelIndex &index : indexes) { if (index.column() == 0) filenames << qobject_cast(model())->filePath(index); } diff --git a/src/widgets/freespacebar.cpp b/src/widgets/freespacebar.cpp index 340fe755..8b44df06 100644 --- a/src/widgets/freespacebar.cpp +++ b/src/widgets/freespacebar.cpp @@ -59,7 +59,6 @@ const QRgb FreeSpaceBar::kColorBar1 = qRgb(250, 148, 76); const QRgb FreeSpaceBar::kColorBar2 = qRgb(214, 102, 24); const QRgb FreeSpaceBar::kColorBorder = qRgb(174, 168, 162); - FreeSpaceBar::FreeSpaceBar(QWidget *parent) : QWidget(parent), free_(100), @@ -121,7 +120,7 @@ void FreeSpaceBar::paintEvent(QPaintEvent*) { } -void FreeSpaceBar::DrawBar(QPainter* p, const QRect &r) { +void FreeSpaceBar::DrawBar(QPainter *p, const QRect &r) { p->setRenderHint(QPainter::Antialiasing, true); @@ -180,7 +179,7 @@ void FreeSpaceBar::DrawBar(QPainter* p, const QRect &r) { } -void FreeSpaceBar::DrawText(QPainter* p, const QRect &r) { +void FreeSpaceBar::DrawText(QPainter *p, const QRect &r) { QFont small_font(font()); small_font.setPointSize(small_font.pointSize() - 1); @@ -232,17 +231,21 @@ void FreeSpaceBar::DrawText(QPainter* p, const QRect &r) { } -QString FreeSpaceBar::TextForSize(const QString &prefix, qint64 size) const { +QString FreeSpaceBar::TextForSize(const QString &prefix, const qint64 size) const { QString ret; - if (size > 0) + if (size > 0) { ret = Utilities::PrettySize(size); - else if (size < 0) + } + else if (size < 0) { ret = "-" + Utilities::PrettySize(-size); - else + } + else { ret = "0 MB"; + } if (!prefix.isEmpty()) ret.prepend(prefix + " "); + return ret; } diff --git a/src/widgets/freespacebar.h b/src/widgets/freespacebar.h index 84640aa2..47a08f35 100644 --- a/src/widgets/freespacebar.h +++ b/src/widgets/freespacebar.h @@ -56,13 +56,13 @@ class FreeSpaceBar : public QWidget { static const QRgb kColorBar2; static const QRgb kColorBorder; - void set_free_bytes(qint64 bytes) { free_ = bytes; update(); } - void set_additional_bytes(qint64 bytes) { additional_ = bytes; update(); } - void set_total_bytes(qint64 bytes) { total_ = bytes; update(); } + void set_free_bytes(const qint64 bytes) { free_ = bytes; update(); } + void set_additional_bytes(const qint64 bytes) { additional_ = bytes; update(); } + void set_total_bytes(const qint64 bytes) { total_ = bytes; update(); } - void set_free_text(const QString& text) { free_text_ = text; update(); } - void set_additional_text(const QString& text) { additional_text_ = text; update(); } - void set_used_text(const QString& text) { used_text_ = text; update(); } + void set_free_text(const QString &text) { free_text_ = text; update(); } + void set_additional_text(const QString &text) { additional_text_ = text; update(); } + void set_used_text(const QString &text) { used_text_ = text; update(); } QSize sizeHint() const override; @@ -77,7 +77,7 @@ class FreeSpaceBar : public QWidget { QColor color; }; - QString TextForSize(const QString &prefix, qint64 size) const; + QString TextForSize(const QString &prefix, const qint64 size) const; void DrawBar(QPainter *p, const QRect &r); void DrawText(QPainter *p, const QRect &r); diff --git a/src/widgets/groupediconview.cpp b/src/widgets/groupediconview.cpp index 8d48f3ec..f57eb7b5 100644 --- a/src/widgets/groupediconview.cpp +++ b/src/widgets/groupediconview.cpp @@ -134,7 +134,7 @@ void GroupedIconView::rowsInserted(const QModelIndex &parent, int start, int end LayoutItems(); } -void GroupedIconView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &) { +void GroupedIconView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector&) { QListView::dataChanged(topLeft, bottomRight); LayoutItems(); } @@ -298,7 +298,7 @@ void GroupedIconView::paintEvent(QPaintEvent *e) { } // Draw headers - for (const Header& header : headers_) { + for (const Header &header : headers_) { const QRect header_rect = QRect(header_indent_, header.y, viewport()->width() - header_indent_ * 2, header_height()); // Is this header contained in the area we're drawing? diff --git a/src/widgets/multiloadingindicator.cpp b/src/widgets/multiloadingindicator.cpp index 21149544..a50bf591 100644 --- a/src/widgets/multiloadingindicator.cpp +++ b/src/widgets/multiloadingindicator.cpp @@ -76,7 +76,7 @@ void MultiLoadingIndicator::UpdateText() { QList tasks = task_manager_->GetTasks(); QStringList strings; - for (const TaskManager::Task& task : tasks) { + for (const TaskManager::Task &task : tasks) { QString task_text(task.name); task_text[0] = task_text[0].toLower(); diff --git a/src/widgets/playingwidget.cpp b/src/widgets/playingwidget.cpp index 7db7dc8d..a56010ac 100644 --- a/src/widgets/playingwidget.cpp +++ b/src/widgets/playingwidget.cpp @@ -485,7 +485,7 @@ void PlayingWidget::FadePreviousTrack(const qreal value) { } -void PlayingWidget::resizeEvent(QResizeEvent* e) { +void PlayingWidget::resizeEvent(QResizeEvent *e) { //if (visible_ && e->oldSize() != e->size()) { if (e->oldSize() != e->size()) { diff --git a/src/widgets/qocoa_mac.h b/src/widgets/qocoa_mac.h index 263339de..a8678bd9 100644 --- a/src/widgets/qocoa_mac.h +++ b/src/widgets/qocoa_mac.h @@ -27,10 +27,10 @@ THE SOFTWARE. #include #include -static inline NSString* fromQString(const QString &string) { +static inline NSString *fromQString(const QString &string) { const QByteArray utf8 = string.toUtf8(); - const char* cString = utf8.constData(); + const char *cString = utf8.constData(); return [ [NSString alloc] initWithUTF8String:cString]; } @@ -42,7 +42,7 @@ static inline QString toQString(NSString *string) { } -static inline NSImage* fromQPixmap(const QPixmap &pixmap) { +static inline NSImage *fromQPixmap(const QPixmap &pixmap) { QImage image = pixmap.toImage(); CGImageRef cgImage = image.toCGImage(); diff --git a/src/widgets/qsearchfield_mac.mm b/src/widgets/qsearchfield_mac.mm index 3e8b1a71..f2c4f1c7 100644 --- a/src/widgets/qsearchfield_mac.mm +++ b/src/widgets/qsearchfield_mac.mm @@ -53,21 +53,21 @@ public: void returnPressed() { if (qSearchField) { emit qSearchField->returnPressed(); - QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); + QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier); QApplication::postEvent(qSearchField, event); } } void keyDownPressed() { if (qSearchField) { - QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier); + QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier); QApplication::postEvent(qSearchField, event); } } void keyUpPressed() { if (qSearchField) { - QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); + QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); QApplication::postEvent(qSearchField, event); } } @@ -126,7 +126,7 @@ public: -(BOOL)performKeyEquivalent:(NSEvent*)event { // First, check if we have the focus. // If no, it probably means this event isn't for us. - NSResponder* firstResponder = [[NSApp keyWindow] firstResponder]; + NSResponder *firstResponder = [[NSApp keyWindow] firstResponder]; if ([firstResponder isKindOfClass:[NSText class]] && (NSSearchField*)([(NSText*)firstResponder delegate]) == self) { if ([event type] == NSEventTypeKeyDown && [event modifierFlags] & NSEventModifierFlagCommand) { diff --git a/src/widgets/ratingwidget.cpp b/src/widgets/ratingwidget.cpp index 37801e09..fe92c8f7 100644 --- a/src/widgets/ratingwidget.cpp +++ b/src/widgets/ratingwidget.cpp @@ -95,7 +95,7 @@ double RatingPainter::RatingForPos(const QPoint &pos, const QRect &rect) { } -void RatingPainter::Paint(QPainter* painter, const QRect &rect, double rating) const { +void RatingPainter::Paint(QPainter *painter, const QRect &rect, double rating) const { QSize size(qMin(kStarSize * kStarCount, rect.width()), qMin(kStarSize, rect.height())); QPoint pos(rect.center() - QPoint(size.width() / 2, size.height() / 2)); diff --git a/src/widgets/stretchheaderview.cpp b/src/widgets/stretchheaderview.cpp index 6c4beb41..5f7c93d6 100644 --- a/src/widgets/stretchheaderview.cpp +++ b/src/widgets/stretchheaderview.cpp @@ -62,7 +62,7 @@ void StretchHeaderView::setModel(QAbstractItemModel *model) { } -void StretchHeaderView::NormaliseWidths(const QList& sections) { +void StretchHeaderView::NormaliseWidths(const QList §ions) { if (!stretch_enabled_) return; diff --git a/src/widgets/stretchheaderview.h b/src/widgets/stretchheaderview.h index b02ebe04..3350441d 100644 --- a/src/widgets/stretchheaderview.h +++ b/src/widgets/stretchheaderview.h @@ -40,7 +40,7 @@ class StretchHeaderView : public QHeaderView { Q_OBJECT public: - explicit StretchHeaderView(const Qt::Orientation orientation, QWidget* parent = nullptr); + explicit StretchHeaderView(const Qt::Orientation orientation, QWidget *parent = nullptr); typedef double ColumnWidthType; @@ -90,7 +90,7 @@ class StretchHeaderView : public QHeaderView { void NormaliseWidths(const QList §ions = QList()); // Resizes the actual columns to make them match the proportional values in column_widths_. - void UpdateWidths(const QList& sections = QList()); + void UpdateWidths(const QList §ions = QList()); private slots: void SectionResized(const int logical, const int old_size, const int new_size); diff --git a/src/widgets/trackslider.cpp b/src/widgets/trackslider.cpp index 08c42b56..8c9d24ac 100644 --- a/src/widgets/trackslider.cpp +++ b/src/widgets/trackslider.cpp @@ -41,7 +41,7 @@ # include "moodbar/moodbarproxystyle.h" #endif -const char* TrackSlider::kSettingsGroup = "MainWindow"; +const char *TrackSlider::kSettingsGroup = "MainWindow"; TrackSlider::TrackSlider(QWidget *parent) : QWidget(parent), diff --git a/src/widgets/trackslider.h b/src/widgets/trackslider.h index 578d843f..7e78cc6b 100644 --- a/src/widgets/trackslider.h +++ b/src/widgets/trackslider.h @@ -44,7 +44,7 @@ class TrackSlider : public QWidget { explicit TrackSlider(QWidget *parent = nullptr); ~TrackSlider() override; - void SetApplication(Application* app); + void SetApplication(Application *app); // QWidget QSize sizeHint() const override; diff --git a/src/widgets/volumeslider.cpp b/src/widgets/volumeslider.cpp index 110a4479..25147889 100644 --- a/src/widgets/volumeslider.cpp +++ b/src/widgets/volumeslider.cpp @@ -48,7 +48,7 @@ #include #include -SliderSlider::SliderSlider(Qt::Orientation orientation, QWidget* parent, uint max) +SliderSlider::SliderSlider(const Qt::Orientation orientation, QWidget *parent, const uint max) : QSlider(orientation, parent), sliding_(false), outside_(false), diff --git a/src/widgets/volumeslider.h b/src/widgets/volumeslider.h index 44bf0d7d..4969fcc3 100644 --- a/src/widgets/volumeslider.h +++ b/src/widgets/volumeslider.h @@ -44,7 +44,7 @@ class SliderSlider : public QSlider { Q_OBJECT public: - explicit SliderSlider(Qt::Orientation, QWidget*, const uint max = 0); + explicit SliderSlider(const Qt::Orientation, QWidget*, const uint max = 0); virtual void setValue(int); @@ -75,7 +75,7 @@ class SliderSlider : public QSlider { int prev_value_; SliderSlider(const SliderSlider&); // undefined - SliderSlider& operator=(const SliderSlider&); // undefined + SliderSlider &operator=(const SliderSlider&); // undefined }; class PrettySlider : public SliderSlider { @@ -87,7 +87,7 @@ class PrettySlider : public SliderSlider { Pretty } SliderMode; - explicit PrettySlider(const Qt::Orientation orientation, const SliderMode mode, QWidget* parent, const uint max = 0); + explicit PrettySlider(const Qt::Orientation orientation, const SliderMode mode, QWidget *parent, const uint max = 0); protected: void slideEvent(QMouseEvent*) override; @@ -95,7 +95,7 @@ class PrettySlider : public SliderSlider { private: PrettySlider(const PrettySlider&); // undefined - PrettySlider& operator=(const PrettySlider&); // undefined + PrettySlider &operator=(const PrettySlider&); // undefined SliderMode m_mode; }; @@ -119,7 +119,7 @@ class VolumeSlider : public SliderSlider { void slideEvent(QMouseEvent*) override; void mousePressEvent(QMouseEvent*) override; void contextMenuEvent(QContextMenuEvent*) override; - void wheelEvent(QWheelEvent* e) override; + void wheelEvent(QWheelEvent *e) override; private slots: virtual void slotAnimTimer();