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

@@ -32,12 +32,12 @@
class QHideEvent;
class QShowEvent;
BusyIndicator::BusyIndicator(const QString &text, QWidget* parent)
BusyIndicator::BusyIndicator(const QString &text, QWidget *parent)
: QWidget(parent) {
Init(text);
}
BusyIndicator::BusyIndicator(QWidget* parent)
BusyIndicator::BusyIndicator(QWidget *parent)
: QWidget(parent) {
Init(QString());
}

View File

@@ -69,7 +69,8 @@ void FileViewList::contextMenuEvent(QContextMenuEvent *e) {
QList<QUrl> FileViewList::UrlListFromSelection() const {
QList<QUrl> urls;
for (const QModelIndex& index : menu_selection_.indexes()) {
const QModelIndexList indexes = menu_selection_.indexes();
for (const QModelIndex &index : indexes) {
if (index.column() == 0)
urls << QUrl::fromLocalFile(qobject_cast<QFileSystemModel*>(model())->fileInfo(index).canonicalFilePath());
}
@@ -119,7 +120,8 @@ MimeData *FileViewList::MimeDataFromSelection() const {
QStringList FileViewList::FilenamesFromSelection() const {
QStringList filenames;
for (const QModelIndex& index : menu_selection_.indexes()) {
const QModelIndexList indexes = menu_selection_.indexes();
for (const QModelIndex &index : indexes) {
if (index.column() == 0)
filenames << qobject_cast<QFileSystemModel*>(model())->filePath(index);
}

View File

@@ -59,7 +59,6 @@ const QRgb FreeSpaceBar::kColorBar1 = qRgb(250, 148, 76);
const QRgb FreeSpaceBar::kColorBar2 = qRgb(214, 102, 24);
const QRgb FreeSpaceBar::kColorBorder = qRgb(174, 168, 162);
FreeSpaceBar::FreeSpaceBar(QWidget *parent)
: QWidget(parent),
free_(100),
@@ -121,7 +120,7 @@ void FreeSpaceBar::paintEvent(QPaintEvent*) {
}
void FreeSpaceBar::DrawBar(QPainter* p, const QRect &r) {
void FreeSpaceBar::DrawBar(QPainter *p, const QRect &r) {
p->setRenderHint(QPainter::Antialiasing, true);
@@ -180,7 +179,7 @@ void FreeSpaceBar::DrawBar(QPainter* p, const QRect &r) {
}
void FreeSpaceBar::DrawText(QPainter* p, const QRect &r) {
void FreeSpaceBar::DrawText(QPainter *p, const QRect &r) {
QFont small_font(font());
small_font.setPointSize(small_font.pointSize() - 1);
@@ -232,17 +231,21 @@ void FreeSpaceBar::DrawText(QPainter* p, const QRect &r) {
}
QString FreeSpaceBar::TextForSize(const QString &prefix, qint64 size) const {
QString FreeSpaceBar::TextForSize(const QString &prefix, const qint64 size) const {
QString ret;
if (size > 0)
if (size > 0) {
ret = Utilities::PrettySize(size);
else if (size < 0)
}
else if (size < 0) {
ret = "-" + Utilities::PrettySize(-size);
else
}
else {
ret = "0 MB";
}
if (!prefix.isEmpty()) ret.prepend(prefix + " ");
return ret;
}

View File

@@ -56,13 +56,13 @@ class FreeSpaceBar : public QWidget {
static const QRgb kColorBar2;
static const QRgb kColorBorder;
void set_free_bytes(qint64 bytes) { free_ = bytes; update(); }
void set_additional_bytes(qint64 bytes) { additional_ = bytes; update(); }
void set_total_bytes(qint64 bytes) { total_ = bytes; update(); }
void set_free_bytes(const qint64 bytes) { free_ = bytes; update(); }
void set_additional_bytes(const qint64 bytes) { additional_ = bytes; update(); }
void set_total_bytes(const qint64 bytes) { total_ = bytes; update(); }
void set_free_text(const QString& text) { free_text_ = text; update(); }
void set_additional_text(const QString& text) { additional_text_ = text; update(); }
void set_used_text(const QString& text) { used_text_ = text; update(); }
void set_free_text(const QString &text) { free_text_ = text; update(); }
void set_additional_text(const QString &text) { additional_text_ = text; update(); }
void set_used_text(const QString &text) { used_text_ = text; update(); }
QSize sizeHint() const override;
@@ -77,7 +77,7 @@ class FreeSpaceBar : public QWidget {
QColor color;
};
QString TextForSize(const QString &prefix, qint64 size) const;
QString TextForSize(const QString &prefix, const qint64 size) const;
void DrawBar(QPainter *p, const QRect &r);
void DrawText(QPainter *p, const QRect &r);

View File

@@ -134,7 +134,7 @@ void GroupedIconView::rowsInserted(const QModelIndex &parent, int start, int end
LayoutItems();
}
void GroupedIconView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &) {
void GroupedIconView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int>&) {
QListView::dataChanged(topLeft, bottomRight);
LayoutItems();
}
@@ -298,7 +298,7 @@ void GroupedIconView::paintEvent(QPaintEvent *e) {
}
// Draw headers
for (const Header& header : headers_) {
for (const Header &header : headers_) {
const QRect header_rect = QRect(header_indent_, header.y, viewport()->width() - header_indent_ * 2, header_height());
// Is this header contained in the area we're drawing?

View File

@@ -76,7 +76,7 @@ void MultiLoadingIndicator::UpdateText() {
QList<TaskManager::Task> tasks = task_manager_->GetTasks();
QStringList strings;
for (const TaskManager::Task& task : tasks) {
for (const TaskManager::Task &task : tasks) {
QString task_text(task.name);
task_text[0] = task_text[0].toLower();

View File

@@ -485,7 +485,7 @@ void PlayingWidget::FadePreviousTrack(const qreal value) {
}
void PlayingWidget::resizeEvent(QResizeEvent* e) {
void PlayingWidget::resizeEvent(QResizeEvent *e) {
//if (visible_ && e->oldSize() != e->size()) {
if (e->oldSize() != e->size()) {

View File

@@ -27,10 +27,10 @@ THE SOFTWARE.
#include <QImage>
#include <QPixmap>
static inline NSString* fromQString(const QString &string) {
static inline NSString *fromQString(const QString &string) {
const QByteArray utf8 = string.toUtf8();
const char* cString = utf8.constData();
const char *cString = utf8.constData();
return [ [NSString alloc] initWithUTF8String:cString];
}
@@ -42,7 +42,7 @@ static inline QString toQString(NSString *string) {
}
static inline NSImage* fromQPixmap(const QPixmap &pixmap) {
static inline NSImage *fromQPixmap(const QPixmap &pixmap) {
QImage image = pixmap.toImage();
CGImageRef cgImage = image.toCGImage();

View File

@@ -53,21 +53,21 @@ public:
void returnPressed() {
if (qSearchField) {
emit qSearchField->returnPressed();
QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
QApplication::postEvent(qSearchField, event);
}
}
void keyDownPressed() {
if (qSearchField) {
QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier);
QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier);
QApplication::postEvent(qSearchField, event);
}
}
void keyUpPressed() {
if (qSearchField) {
QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier);
QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier);
QApplication::postEvent(qSearchField, event);
}
}
@@ -126,7 +126,7 @@ public:
-(BOOL)performKeyEquivalent:(NSEvent*)event {
// First, check if we have the focus.
// If no, it probably means this event isn't for us.
NSResponder* firstResponder = [[NSApp keyWindow] firstResponder];
NSResponder *firstResponder = [[NSApp keyWindow] firstResponder];
if ([firstResponder isKindOfClass:[NSText class]] && (NSSearchField*)([(NSText*)firstResponder delegate]) == self) {
if ([event type] == NSEventTypeKeyDown && [event modifierFlags] & NSEventModifierFlagCommand) {

View File

@@ -95,7 +95,7 @@ double RatingPainter::RatingForPos(const QPoint &pos, const QRect &rect) {
}
void RatingPainter::Paint(QPainter* painter, const QRect &rect, double rating) const {
void RatingPainter::Paint(QPainter *painter, const QRect &rect, double rating) const {
QSize size(qMin(kStarSize * kStarCount, rect.width()), qMin(kStarSize, rect.height()));
QPoint pos(rect.center() - QPoint(size.width() / 2, size.height() / 2));

View File

@@ -62,7 +62,7 @@ void StretchHeaderView::setModel(QAbstractItemModel *model) {
}
void StretchHeaderView::NormaliseWidths(const QList<int>& sections) {
void StretchHeaderView::NormaliseWidths(const QList<int> &sections) {
if (!stretch_enabled_) return;

View File

@@ -40,7 +40,7 @@ class StretchHeaderView : public QHeaderView {
Q_OBJECT
public:
explicit StretchHeaderView(const Qt::Orientation orientation, QWidget* parent = nullptr);
explicit StretchHeaderView(const Qt::Orientation orientation, QWidget *parent = nullptr);
typedef double ColumnWidthType;
@@ -90,7 +90,7 @@ class StretchHeaderView : public QHeaderView {
void NormaliseWidths(const QList<int> &sections = QList<int>());
// Resizes the actual columns to make them match the proportional values in column_widths_.
void UpdateWidths(const QList<int>& sections = QList<int>());
void UpdateWidths(const QList<int> &sections = QList<int>());
private slots:
void SectionResized(const int logical, const int old_size, const int new_size);

View File

@@ -41,7 +41,7 @@
# include "moodbar/moodbarproxystyle.h"
#endif
const char* TrackSlider::kSettingsGroup = "MainWindow";
const char *TrackSlider::kSettingsGroup = "MainWindow";
TrackSlider::TrackSlider(QWidget *parent)
: QWidget(parent),

View File

@@ -44,7 +44,7 @@ class TrackSlider : public QWidget {
explicit TrackSlider(QWidget *parent = nullptr);
~TrackSlider() override;
void SetApplication(Application* app);
void SetApplication(Application *app);
// QWidget
QSize sizeHint() const override;

View File

@@ -48,7 +48,7 @@
#include <QFlags>
#include <QtEvents>
SliderSlider::SliderSlider(Qt::Orientation orientation, QWidget* parent, uint max)
SliderSlider::SliderSlider(const Qt::Orientation orientation, QWidget *parent, const uint max)
: QSlider(orientation, parent),
sliding_(false),
outside_(false),

View File

@@ -44,7 +44,7 @@ class SliderSlider : public QSlider {
Q_OBJECT
public:
explicit SliderSlider(Qt::Orientation, QWidget*, const uint max = 0);
explicit SliderSlider(const Qt::Orientation, QWidget*, const uint max = 0);
virtual void setValue(int);
@@ -75,7 +75,7 @@ class SliderSlider : public QSlider {
int prev_value_;
SliderSlider(const SliderSlider&); // undefined
SliderSlider& operator=(const SliderSlider&); // undefined
SliderSlider &operator=(const SliderSlider&); // undefined
};
class PrettySlider : public SliderSlider {
@@ -87,7 +87,7 @@ class PrettySlider : public SliderSlider {
Pretty
} SliderMode;
explicit PrettySlider(const Qt::Orientation orientation, const SliderMode mode, QWidget* parent, const uint max = 0);
explicit PrettySlider(const Qt::Orientation orientation, const SliderMode mode, QWidget *parent, const uint max = 0);
protected:
void slideEvent(QMouseEvent*) override;
@@ -95,7 +95,7 @@ class PrettySlider : public SliderSlider {
private:
PrettySlider(const PrettySlider&); // undefined
PrettySlider& operator=(const PrettySlider&); // undefined
PrettySlider &operator=(const PrettySlider&); // undefined
SliderMode m_mode;
};
@@ -119,7 +119,7 @@ class VolumeSlider : public SliderSlider {
void slideEvent(QMouseEvent*) override;
void mousePressEvent(QMouseEvent*) override;
void contextMenuEvent(QContextMenuEvent*) override;
void wheelEvent(QWheelEvent* e) override;
void wheelEvent(QWheelEvent *e) override;
private slots:
virtual void slotAnimTimer();