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

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