Formatting

This commit is contained in:
Jonas Kvinge
2021-07-11 07:40:57 +02:00
parent 87b9a8c4c8
commit a6742d401c
149 changed files with 595 additions and 565 deletions

View File

@@ -19,7 +19,8 @@
#include "ui_dynamicplaylistcontrols.h"
DynamicPlaylistControls::DynamicPlaylistControls(QWidget *parent)
: QWidget(parent), ui_(new Ui_DynamicPlaylistControls) {
: QWidget(parent),
ui_(new Ui_DynamicPlaylistControls) {
ui_->setupUi(this);

View File

@@ -144,8 +144,7 @@ Playlist::Playlist(PlaylistBackend *backend, TaskManager *task_manager, Collecti
editing_(-1),
auto_sort_(false),
sort_column_(Column_Title),
sort_order_(Qt::AscendingOrder)
{
sort_order_(Qt::AscendingOrder) {
undo_stack_->setUndoLimit(kUndoStackSize);

View File

@@ -60,7 +60,10 @@
const int PlaylistBackend::kSongTableJoins = 2;
PlaylistBackend::PlaylistBackend(Application *app, QObject *parent)
: QObject(parent), app_(app), db_(app_->database()), original_thread_(nullptr) {
: QObject(parent),
app_(app),
db_(app_->database()),
original_thread_(nullptr) {
original_thread_ = thread();

View File

@@ -85,7 +85,8 @@ const float QueuedItemDelegate::kQueueOpacityLowerBound = 0.4;
const int PlaylistDelegateBase::kMinHeight = 19;
QueuedItemDelegate::QueuedItemDelegate(QObject *parent, int indicator_column)
: QStyledItemDelegate(parent), indicator_column_(indicator_column) {}
: QStyledItemDelegate(parent),
indicator_column_(indicator_column) {}
void QueuedItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &idx) const {

View File

@@ -51,8 +51,7 @@ PlaylistHeader::PlaylistHeader(Qt::Orientation orientation, PlaylistView *view,
action_rating_lock_(nullptr),
action_align_left_(nullptr),
action_align_center_(nullptr),
action_align_right_(nullptr)
{
action_align_right_(nullptr) {
action_hide_ = menu_->addAction(tr("&Hide..."), this, &PlaylistHeader::HideCurrent);
action_stretch_ = menu_->addAction(tr("&Stretch columns to fit window"), this, &PlaylistHeader::ToggleStretchEnabled);

View File

@@ -77,8 +77,7 @@ PlaylistListContainer::PlaylistListContainer(QWidget *parent)
model_(new PlaylistListModel(this)),
proxy_(new PlaylistListSortFilterModel(this)),
loaded_icons_(false),
active_playlist_id_(-1)
{
active_playlist_id_(-1) {
ui_->setupUi(this);
ui_->tree->setAttribute(Qt::WA_MacShowFocusRect, false);

View File

@@ -32,8 +32,7 @@
#include "playlistlistview.h"
PlaylistListView::PlaylistListView(QWidget *parent)
: AutoExpandingTreeView(parent) {}
PlaylistListView::PlaylistListView(QWidget *parent) : AutoExpandingTreeView(parent) {}
void PlaylistListView::paintEvent(QPaintEvent *event) {

View File

@@ -49,8 +49,7 @@ PlaylistSequence::PlaylistSequence(QWidget *parent, SettingsProvider *settings)
loading_(false),
repeat_mode_(Repeat_Off),
shuffle_mode_(Shuffle_Off),
dynamic_(false)
{
dynamic_(false) {
ui_->setupUi(this);

View File

@@ -37,13 +37,14 @@ namespace PlaylistUndoCommands {
Base::Base(Playlist *playlist) : QUndoCommand(nullptr), playlist_(playlist) {}
InsertItems::InsertItems(Playlist *playlist, const PlaylistItemList &items, int pos, bool enqueue, bool enqueue_next)
: Base(playlist),
items_(items),
pos_(pos),
enqueue_(enqueue),
enqueue_next_(enqueue_next)
{
: Base(playlist),
items_(items),
pos_(pos),
enqueue_(enqueue),
enqueue_next_(enqueue_next) {
setText(tr("add %n songs", "", items_.count()));
}
void InsertItems::redo() {
@@ -96,11 +97,12 @@ bool RemoveItems::mergeWith(const QUndoCommand *other) {
MoveItems::MoveItems(Playlist *playlist, const QList<int> &source_rows, int pos)
: Base(playlist),
source_rows_(source_rows),
pos_(pos)
{
: Base(playlist),
source_rows_(source_rows),
pos_(pos) {
setText(tr("move %n songs", "", source_rows.count()));
}
void MoveItems::redo() {
@@ -119,7 +121,7 @@ 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)
: ReOrderItems(playlist, new_items) {
: ReOrderItems(playlist, new_items) {
Q_UNUSED(column);
Q_UNUSED(order);
@@ -130,9 +132,10 @@ SortItems::SortItems(Playlist *playlist, int column, Qt::SortOrder order, const
ShuffleItems::ShuffleItems(Playlist *playlist, const PlaylistItemList &new_items)
: ReOrderItems(playlist, new_items)
{
: ReOrderItems(playlist, new_items) {
setText(tr("shuffle songs"));
}
} // namespace PlaylistUndoCommands

View File

@@ -114,19 +114,23 @@ void PlaylistProxyStyle::drawControl(ControlElement element, const QStyleOption
}
}
if (element == CE_ItemViewItem)
if (element == CE_ItemViewItem) {
common_style_->drawControl(element, option, painter, widget);
else
}
else {
QProxyStyle::drawControl(element, option, painter, widget);
}
}
void PlaylistProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const {
if (element == QStyle::PE_PanelItemViewRow || element == QStyle::PE_PanelItemViewItem)
if (element == QStyle::PE_PanelItemViewRow || element == QStyle::PE_PanelItemViewItem) {
common_style_->drawPrimitive(element, option, painter, widget);
else
}
else {
QProxyStyle::drawPrimitive(element, option, painter, widget);
}
}