Formatting

This commit is contained in:
Jonas Kvinge 2021-06-12 20:53:23 +02:00
parent 427b9c1ebc
commit f786a17014
117 changed files with 444 additions and 434 deletions

View File

@ -56,7 +56,7 @@
template class Analyzer::Base<QWidget>;
#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<float> aux(fht_->size());
if (static_cast<long unsigned int>(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<double>(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;

View File

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

View File

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

View File

@ -76,7 +76,7 @@ class AnalyzerContainer : public QWidget {
void SaveFramerate(const int framerate);
template <typename T>
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_;
};

View File

@ -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<double>(newValue) / 1000;
}
void BoomAnalyzer::changeF_peakSpeed(int newValue) {
void BoomAnalyzer::changeF_peakSpeed(const int newValue) {
F_peakSpeed_ = static_cast<double>(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_);

View File

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

View File

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

View File

@ -41,9 +41,9 @@ class FHT {
QVector<float> tab_vector_;
QVector<int> 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.

View File

@ -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<int>(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<float>(height()) / 2 - static_cast<float>(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) {}

View File

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

View File

@ -78,7 +78,7 @@ SCollection::~SCollection() {
}
if (watcher_thread_) {
watcher_thread_->exit();
watcher_thread_->wait(5000 /* five seconds */);
watcher_thread_->wait(5000);
}
backend_->deleteLater();

View File

@ -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<int>& ids, const double rating) {
void CollectionBackend::UpdateSongsRatingAsync(const QList<int> &ids, const double rating) {
metaObject()->invokeMethod(this, "UpdateSongsRating", Qt::QueuedConnection, Q_ARG(QList<int>, ids), Q_ARG(double, rating));
}

View File

@ -60,7 +60,7 @@ class CollectionDirectoryModel : public QStandardItemModel {
static const int kIdRole = Qt::UserRole + 1;
QIcon dir_icon_;
CollectionBackend* backend_;
CollectionBackend *backend_;
QList<std::shared_ptr<MusicStorage>> storage_;
};

View File

@ -511,7 +511,7 @@ void CollectionView::AddToPlaylist() {
void CollectionView::AddToPlaylistEnqueue() {
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
if (MimeData* mimedata = qobject_cast<MimeData*>(q_mimedata)) {
if (MimeData *mimedata = qobject_cast<MimeData*>(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<MimeData*>(q_mimedata)) {
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
mimedata->open_in_new_playlist_ = true;
}
emit AddToPlaylistSignal(q_mimedata);

View File

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

View File

@ -31,7 +31,7 @@
struct Directory {
Directory() : id(-1) {}
bool operator ==(const Directory& other) const {
bool operator ==(const Directory &other) const {
return path == other.path && id == other.id;
}

View File

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

View File

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

View File

@ -7,10 +7,10 @@ class PlatformInterface;
@class SPMediaKeyTap;
@interface AppDelegate : NSObject<NSApplicationDelegate, NSUserNotificationCenterDelegate> {
PlatformInterface* application_handler_;
NSMenu* dock_menu_;
GlobalShortcutsBackendMacOS* shortcut_handler_;
SPMediaKeyTap* key_tap_;
PlatformInterface *application_handler_;
NSMenu *dock_menu_;
GlobalShortcutsBackendMacOS *shortcut_handler_;
SPMediaKeyTap *key_tap_;
}

View File

@ -69,7 +69,7 @@
#include <QtDebug>
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<CFURLRef> app_url(CFBundleCopyBundleURL(CFBundleGetMainBundle()));
ScopedCFTypeRef<CFStringRef> 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<NSView*>(main_window.winId());
NSWindow* window = [view window];
NSView *view = reinterpret_cast<NSView*>(main_window.winId());
NSWindow *window = [view window];
[window setCollectionBehavior:kFullScreenPrimary];
}

View File

@ -34,7 +34,7 @@ class NSEvent;
namespace mac {
QKeySequence KeySequenceFromNSEvent(NSEvent* event);
QKeySequence KeySequenceFromNSEvent(NSEvent *event);
void DumpDictionary(CFDictionaryRef dict);
}

View File

@ -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<MacFSListener*>(user_data);
char** paths = reinterpret_cast<char**>(event_paths);
MacFSListener *me = reinterpret_cast<MacFSListener*>(user_data);
char **paths = reinterpret_cast<char**>(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<NSMutableArray> array([ [NSMutableArray alloc] init]);
for (const QString& path : paths_) {
for (const QString &path : paths_) {
scoped_nsobject<NSString> 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_);
}
}

View File

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

View File

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

View File

@ -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<QAction*> playlistitem_actions_;

View File

@ -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<Song::FileType>* ret) { Q_UNUSED(ret); return true; }
virtual bool GetSupportedFiletypes(QList<Song::FileType> *ret) { Q_UNUSED(ret); return true; }
virtual bool StartCopy(QList<Song::FileType>* supported_types) { Q_UNUSED(supported_types); return true; }
virtual bool CopyToStorage(const CopyJob& job) = 0;
virtual bool StartCopy(QList<Song::FileType> *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() {}

View File

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

View File

@ -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 <class C>
void swap(scoped_nsobject<C>& p1, scoped_nsobject<C>& p2) {
void swap(scoped_nsobject<C> &p1, scoped_nsobject<C> &p2) {
p1.swap(p2);
}
template <class C>
bool operator==(C* p1, const scoped_nsobject<C>& p2) {
bool operator==(C* p1, const scoped_nsobject<C> &p2) {
return p1 == p2.get();
}
template <class C>
bool operator!=(C* p1, const scoped_nsobject<C>& p2) {
bool operator!=(C* p1, const scoped_nsobject<C> &p2) {
return p1 != p2.get();
}
@ -109,7 +109,7 @@ class scoped_nsobject<id> {
id get() const { return object_; }
void swap(scoped_nsobject& that) {
void swap(scoped_nsobject &that) {
id temp = that.object_;
that.object_ = object_;
object_ = temp;

View File

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

View File

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

View File

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

View File

@ -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<T*> children;
QAbstractItemModel* child_model;
QAbstractItemModel *child_model;
SimpleTreeModel<T>* model;
SimpleTreeModel<T> *model;
};
template <typename T>

View File

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

View File

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

View File

@ -103,7 +103,7 @@ class AlbumCoverFetcherSearch : public QObject {
QMap<int, CoverProvider*> pending_requests_;
QMap<QNetworkReply*, CoverProviderSearchResult> pending_image_loads_;
NetworkTimeouts* image_load_timeout_;
NetworkTimeouts *image_load_timeout_;
// QMap is sorted by key (score).
struct CandidateImage {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -122,7 +122,7 @@ class DeviceManager : public SimpleTreeModel<DeviceInfo> {
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);

View File

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

View File

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

View File

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

View File

@ -102,9 +102,9 @@ class ScopedIOObject {
QSet<MacOsDeviceLister::MTPDevice> 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<NSDictionary> 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<NSDictionary> 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<NSURL> 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<DASessionRef> session(DASessionCreate(kCFAllocatorDefault));
ScopedCFTypeRef<DADiskRef> 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<MacOsDeviceLister*>(context);
MacOsDeviceLister *me = reinterpret_cast<MacOsDeviceLister*>(context);
scoped_nsobject<NSDictionary> 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<MacOsDeviceLister*>(context);
MacOsDeviceLister *me = reinterpret_cast<MacOsDeviceLister*>(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<MacOsDeviceLister*>(refcon);
MacOsDeviceLister *me = reinterpret_cast<MacOsDeviceLister*>(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<MacOsDeviceLister*>(refcon);
MacOsDeviceLister *me = reinterpret_cast<MacOsDeviceLister*>(refcon);
io_object_t object;
while ((object = IOIteratorNext(it))) {
ScopedCFTypeRef<CFStringRef> 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<QUrl> 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<NSDictionary> 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<QUrl> MacOsDeviceLister::MakeDeviceUrls(const QString& serial) {
QList<QUrl> 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<QUrl> 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<QUrl> urls = MakeDeviceUrls(serial);
@ -833,8 +833,8 @@ quint64 MacOsDeviceLister::DeviceFreeSpace(const QString& serial) {
scoped_nsobject<NSDictionary> properties((NSDictionary*)DADiskCopyDescription(disk));
scoped_nsobject<NSURL> 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<QUrl> urls = MakeDeviceUrls(serial);
MTPDevice* d = &mtp_devices_[serial];
MTPDevice *d = &mtp_devices_[serial];
d->free_space = GetFreeSpace(urls[0]);
}
}

View File

@ -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<Song::FileType> *ret) {
@ -286,4 +286,3 @@ bool MtpDevice::GetSupportedFiletypes(QList<Song::FileType> *ret, LIBMTP_mtpdevi
return true;
}

View File

@ -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<Song::FileType>* ret) override;
bool GetSupportedFiletypes(QList<Song::FileType> *ret) override;
int GetFreeSpace();
int GetCapacity();
bool StartCopy(QList<Song::FileType>* supported_types) override;
bool CopyToStorage(const CopyJob& job) override;
void FinishCopy(bool success) override;
bool StartCopy(QList<Song::FileType> *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<Song::FileType> *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;

View File

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

View File

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

View File

@ -28,7 +28,7 @@
#include <QDialogButtonBox>
#include <QShowEvent>
AddStreamDialog::AddStreamDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_AddStreamDialog) {
AddStreamDialog::AddStreamDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_AddStreamDialog) {
ui_->setupUi(this);

View File

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

View File

@ -1163,7 +1163,7 @@ void GstEnginePipeline::UpdateStereoBalance() {
}
void GstEnginePipeline::SetEqualizerParams(const int preamp, const QList<int>& band_gains) {
void GstEnginePipeline::SetEqualizerParams(const int preamp, const QList<int> &band_gains) {
eq_preamp_ = preamp;
eq_band_gains_ = band_gains;

View File

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

View File

@ -35,7 +35,7 @@
namespace {
template <typename T>
std::unique_ptr<T> GetProperty(const AudioDeviceID& device_id, const AudioObjectPropertyAddress& address, UInt32* size_bytes_out = nullptr) {
std::unique_ptr<T> 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);

View File

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

View File

@ -28,38 +28,38 @@
template <typename T>
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>(libvlc_##type##_t* ptr) { \
template <> void VlcScopedRef_Release<libvlc_##type##_t>(libvlc_##type##_t *ptr) { \
dtor(ptr); \
}
#define VLCSCOPEDREF_DEFINE(type) VLCSCOPEDREF_DEFINE2(type, libvlc_##type##_release)
template <typename T>
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>(char* ptr) { free(ptr); }
template <> void VlcScopedRef_Release<char>(char *ptr) { free(ptr); }
template <typename T>
VlcScopedRef<T>::VlcScopedRef(T* ptr)
VlcScopedRef<T>::VlcScopedRef(T *ptr)
: ptr_(ptr) {
}

View File

@ -156,7 +156,7 @@ void Equalizer::LoadDefaultPresets() {
}
void Equalizer::AddPreset(const QString& name, const Params& params) {
void Equalizer::AddPreset(const QString &name, const Params &params) {
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;

View File

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

View File

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

View File

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

View File

@ -43,7 +43,8 @@ bool GlobalShortcutsBackendSystem::DoRegister() {
if (!gshortcut_init_) gshortcut_init_ = new GlobalShortcut(this);
for (const GlobalShortcutsManager::Shortcut &shortcut : manager_->shortcuts().values()) {
QList<GlobalShortcutsManager::Shortcut> shortcuts = manager_->shortcuts().values();
for (const GlobalShortcutsManager::Shortcut &shortcut : shortcuts) {
AddShortcut(shortcut.action);
}

View File

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

View File

@ -22,6 +22,6 @@
#include "config.h"
int main(int argc, char* argv[]);
int main(int argc, char *argv[]);
#endif // MAIN_H

View File

@ -112,7 +112,7 @@ void MoodbarBuilder::Normalize(QList<Rgb> *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<int>((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;

View File

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

View File

@ -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<QString> id_list;
for (const IdSource& is : id_source_list) {
for (const IdSource &is : id_source_list) {
id_list << is.id_;
}

View File

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

View File

@ -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<QString, QString> 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<int, Request> requests_pending_;
QMultiMap<int, QNetworkReply*> 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_;
}

View File

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

View File

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

View File

@ -35,7 +35,7 @@ class DynamicPlaylistControls : public QWidget {
void TurnOff();
private:
Ui_DynamicPlaylistControls* ui_;
Ui_DynamicPlaylistControls *ui_;
};
#endif // DYNAMICPLAYLISTCONTROLS_H

View File

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

View File

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

View File

@ -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<int>& ids) = 0;
virtual void ChangePlaylistOrder(const QList<int> &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<QUrl> &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<int>& indices);
void RemoveItemsWithoutUndo(const int id, const QList<int> &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:

View File

@ -48,7 +48,7 @@ class PlaylistSaveOptionsDialog : public QDialog {
private:
static const char *kSettingsGroup;
Ui::PlaylistSaveOptionsDialog* ui;
Ui::PlaylistSaveOptionsDialog *ui;
};
#endif // PLAYLISTSAVEOPTIONSDIALOG_H

View File

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

View File

@ -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<const RemoveItems*>(other);
const RemoveItems *remove_command = static_cast<const RemoveItems*>(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"));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<SmartPlaylistSearchTerm::Operator>(
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_) {

View File

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

View File

@ -63,7 +63,7 @@ QUrl SubsonicBaseRequest::CreateUrl(const QString &ressource_name, const QList<P
<< Param("p", QString("enc:" + password().toUtf8().toHex()));
QUrlQuery url_query;
for (const Param& param : params) {
for (const Param &param : params) {
EncodedParam encoded_param(QUrl::toPercentEncoding(param.first), QUrl::toPercentEncoding(param.second));
url_query.addQueryItem(encoded_param.first, encoded_param.second);
}

View File

@ -53,7 +53,7 @@ UrlHandler::LoadResult SubsonicUrlHandler::StartLoading(const QUrl &url) {
<< Param("id", url.path());
QUrlQuery url_query;
for (const Param& param : params) {
for (const Param &param : params) {
EncodedParam encoded_param(QUrl::toPercentEncoding(param.first), QUrl::toPercentEncoding(param.second));
url_query.addQueryItem(encoded_param.first, encoded_param.second);
}

View File

@ -129,7 +129,7 @@ void TidalFavoriteRequest::AddFavorites(const FavoriteType type, const SongList
<< Param(text, id_list.join(','));
QUrlQuery url_query;
for (const Param& param : params) {
for (const Param &param : params) {
url_query.addQueryItem(QUrl::toPercentEncoding(param.first), QUrl::toPercentEncoding(param.second));
}
@ -235,7 +235,7 @@ void TidalFavoriteRequest::RemoveFavorites(const FavoriteType type, const QStrin
ParamList params = ParamList() << Param("countryCode", country_code());
QUrlQuery url_query;
for (const Param& param : params) {
for (const Param &param : params) {
url_query.addQueryItem(QUrl::toPercentEncoding(param.first), QUrl::toPercentEncoding(param.second));
}

View File

@ -34,7 +34,7 @@
const char *TranscoderOptionsAAC::kSettingsGroup = "Transcoder/faac";
TranscoderOptionsAAC::TranscoderOptionsAAC(QWidget* parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsAAC) {
TranscoderOptionsAAC::TranscoderOptionsAAC(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsAAC) {
ui_->setupUi(this);
}

View File

@ -46,7 +46,7 @@ class TranscoderOptionsMP3 : public TranscoderOptionsInterface {
void QualitySpinboxChanged(double value);
private:
static const char* kSettingsGroup;
static const char *kSettingsGroup;
Ui_TranscoderOptionsMP3 *ui_;
};

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