Add explicit

This commit is contained in:
Jonas Kvinge
2020-04-07 16:49:15 +02:00
parent 3efc496c41
commit 21b2193cd0
199 changed files with 337 additions and 342 deletions

View File

@@ -38,7 +38,7 @@ class AutoExpandingTreeView : public QTreeView {
Q_OBJECT
public:
AutoExpandingTreeView(QWidget *parent = nullptr);
explicit AutoExpandingTreeView(QWidget *parent = nullptr);
static const int kRowsToShow;

View File

@@ -31,12 +31,12 @@ class ClickableLabel : public QLabel {
Q_OBJECT
public:
ClickableLabel(QWidget *parent = nullptr);
explicit ClickableLabel(QWidget *parent = nullptr);
signals:
signals:
void Clicked();
protected:
protected:
void mousePressEvent(QMouseEvent *event);
};

View File

@@ -48,7 +48,7 @@ class FancyTabWidget : public QTabWidget {
~FancyTabWidget();
public:
FancyTabWidget(QWidget* parent = 0);
explicit FancyTabWidget(QWidget *parent = nullptr);
void AddTab(QWidget *widget_view, const QString &name, const QIcon &icon, const QString &label);
bool EnableTab(QWidget *widget_view);
bool DisableTab(QWidget *widget_view);

View File

@@ -34,14 +34,14 @@ class FavoriteWidget : public QWidget {
Q_OBJECT
public:
FavoriteWidget(int tab_id, bool favorite = false, QWidget *parent = nullptr);
explicit FavoriteWidget(int tab_id, bool favorite = false, QWidget *parent = nullptr);
// Change the value if different from the current one and then update display and emit FavoriteStateChanged signal
void SetFavorite(bool favorite);
QSize sizeHint() const;
signals:
signals:
void FavoriteStateChanged(int, bool);
protected:

View File

@@ -50,7 +50,7 @@ class FileView : public QWidget {
Q_OBJECT
public:
FileView(QWidget *parent = nullptr);
explicit FileView(QWidget *parent = nullptr);
~FileView();
static const char *kFileFilter;

View File

@@ -43,7 +43,7 @@ class FileViewList : public QListView {
Q_OBJECT
public:
FileViewList(QWidget *parent = nullptr);
explicit FileViewList(QWidget *parent = nullptr);
void mousePressEvent(QMouseEvent *e);

View File

@@ -32,12 +32,12 @@ class QEvent;
// This helper class forces the mode back to ScrollPerPixel.
class ForceScrollPerPixel : public QObject {
public:
ForceScrollPerPixel(QAbstractItemView *item_view, QObject *parent = nullptr);
explicit ForceScrollPerPixel(QAbstractItemView *item_view, QObject *parent = nullptr);
protected:
protected:
bool eventFilter(QObject *object, QEvent *event);
private:
private:
QAbstractItemView *item_view_;
};

View File

@@ -39,7 +39,7 @@ class FreeSpaceBar : public QWidget {
Q_OBJECT
public:
FreeSpaceBar(QWidget *parent = nullptr);
explicit FreeSpaceBar(QWidget *parent = nullptr);
static const int kBarHeight;
static const int kBarBorderRadius;
@@ -66,12 +66,12 @@ class FreeSpaceBar : public QWidget {
QSize sizeHint() const;
protected:
protected:
void paintEvent(QPaintEvent*);
private:
private:
struct Label {
Label(const QString &t, const QColor &c) : text(t), color(c) {}
explicit Label(const QString &t, const QColor &c) : text(t), color(c) {}
QString text;
QColor color;
@@ -82,7 +82,7 @@ private:
void DrawBar(QPainter *p, const QRect &r);
void DrawText(QPainter *p, const QRect &r);
private:
private:
qint64 free_;
qint64 additional_;
qint64 total_;

View File

@@ -59,7 +59,7 @@ class GroupedIconView : public QListView {
Q_PROPERTY(QString header_text READ header_text WRITE set_header_text)
public:
GroupedIconView(QWidget *parent = nullptr);
explicit GroupedIconView(QWidget *parent = nullptr);
enum Role {
Role_Group = 1158300,
@@ -83,7 +83,7 @@ class GroupedIconView : public QListView {
static void DrawHeader(QPainter *painter, const QRect &rect, const QFont &font, const QPalette &palette, const QString &text);
protected:
protected:
virtual int header_height() const;
// QWidget
@@ -98,10 +98,10 @@ protected:
QRect visualRect(const QModelIndex &index) const;
QRegion visualRegionForSelection(const QItemSelection &selection) const;
private slots:
private slots:
void LayoutItems();
private:
private:
static const int kBarThickness;
static const int kBarMarginTop;

View File

@@ -38,7 +38,7 @@ class QResizeEvent;
class LineEditInterface {
public:
LineEditInterface(QWidget *widget) : widget_(widget) {}
explicit LineEditInterface(QWidget *widget) : widget_(widget) {}
QWidget *widget() const { return widget_; }
@@ -55,13 +55,13 @@ class LineEditInterface {
virtual void set_enabled(bool enabled) = 0;
protected:
protected:
QWidget *widget_;
};
class ExtendedEditor : public LineEditInterface {
public:
ExtendedEditor(QWidget *widget, int extra_right_padding = 0, bool draw_hint = true);
explicit ExtendedEditor(QWidget *widget, int extra_right_padding = 0, bool draw_hint = true);
virtual ~ExtendedEditor() {}
virtual bool is_empty() const { return text().isEmpty(); }
@@ -108,7 +108,7 @@ class LineEdit : public QLineEdit, public ExtendedEditor {
Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE set_reset_button)
public:
LineEdit(QWidget *parent = nullptr);
explicit LineEdit(QWidget *parent = nullptr);
// ExtendedEditor
void set_focus() { QLineEdit::setFocus(); }
@@ -138,7 +138,7 @@ class TextEdit : public QPlainTextEdit, public ExtendedEditor {
Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE set_reset_button)
public:
TextEdit(QWidget *parent = nullptr);
explicit TextEdit(QWidget *parent = nullptr);
// ExtendedEditor
void set_focus() { QPlainTextEdit::setFocus(); }
@@ -161,7 +161,7 @@ class SpinBox : public QSpinBox, public ExtendedEditor {
Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE set_reset_button)
public:
SpinBox(QWidget *parent = nullptr);
explicit SpinBox(QWidget *parent = nullptr);
// QSpinBox
QString textFromValue(int val) const;

View File

@@ -35,12 +35,12 @@ class LineTextEdit : public QTextEdit {
Q_OBJECT
public:
LineTextEdit(QWidget *parent = nullptr);
explicit LineTextEdit(QWidget *parent = nullptr);
QSize sizeHint() const;
QSize minimumSizeHint() const;
protected:
protected:
void keyPressEvent(QKeyEvent *e);
};

View File

@@ -36,7 +36,7 @@ class LoginStateWidget : public QWidget {
Q_OBJECT
public:
LoginStateWidget(QWidget *parent = nullptr);
explicit LoginStateWidget(QWidget *parent = nullptr);
~LoginStateWidget();
enum State { LoggedIn, LoginInProgress, LoggedOut };
@@ -63,7 +63,7 @@ class LoginStateWidget : public QWidget {
void SetExpires(const QDate &expires);
signals:
signals:
void LogoutClicked();
void LoginClicked();

View File

@@ -37,7 +37,7 @@ class MultiLoadingIndicator : public QWidget {
Q_OBJECT
public:
MultiLoadingIndicator(QWidget *parent = nullptr);
explicit MultiLoadingIndicator(QWidget *parent = nullptr);
static const int kVerticalPadding;
static const int kHorizontalPadding;
@@ -47,16 +47,16 @@ class MultiLoadingIndicator : public QWidget {
QSize sizeHint() const;
signals:
signals:
void TaskCountChange(int tasks);
protected:
protected:
void paintEvent(QPaintEvent *);
private slots:
private slots:
void UpdateText();
private:
private:
TaskManager *task_manager_;
BusyIndicator *spinner_;

View File

@@ -55,7 +55,7 @@ class OSD : public QObject {
Q_OBJECT
public:
OSD(SystemTrayIcon *tray_icon, Application *app, QObject *parent = nullptr);
explicit OSD(SystemTrayIcon *tray_icon, Application *app, QObject *parent = nullptr);
~OSD();
static const char *kSettingsGroup;

View File

@@ -56,7 +56,7 @@ class OSDPretty : public QWidget {
Mode_Draggable,
};
OSDPretty(Mode mode, QWidget *parent = nullptr);
explicit OSDPretty(Mode mode, QWidget *parent = nullptr);
~OSDPretty();
static const char *kSettingsGroup;

View File

@@ -61,7 +61,7 @@ class PlayingWidget : public QWidget {
Q_OBJECT
public:
PlayingWidget(QWidget *parent = nullptr);
explicit PlayingWidget(QWidget *parent = nullptr);
~PlayingWidget();
void Init(Application *app, AlbumCoverChoiceController *album_cover_choice_controller);

View File

@@ -35,14 +35,14 @@ class RenameTabLineEdit : public QLineEdit {
Q_OBJECT
public:
RenameTabLineEdit(QWidget* parent = nullptr);
explicit RenameTabLineEdit(QWidget* parent = nullptr);
signals:
signals:
void EditingCanceled();
public slots:
public slots:
protected:
protected:
void focusOutEvent(QFocusEvent* e);
void keyPressEvent(QKeyEvent* e);
};

View File

@@ -36,7 +36,7 @@ class StickySlider : public QSlider {
Q_PROPERTY(int sticky_threshold READ sticky_threshold WRITE set_sticky_threshold)
public:
StickySlider(QWidget* parent = nullptr);
explicit StickySlider(QWidget* parent = nullptr);
int sticky_center() const { return sticky_center_; }
int sticky_threshold() const { return sticky_threshold_; }

View File

@@ -39,7 +39,7 @@ class StretchHeaderView : public QHeaderView {
Q_OBJECT
public:
StretchHeaderView(Qt::Orientation orientation, QWidget* parent = nullptr);
explicit StretchHeaderView(Qt::Orientation orientation, QWidget* parent = nullptr);
typedef double ColumnWidthType;
@@ -68,17 +68,17 @@ class StretchHeaderView : public QHeaderView {
bool is_stretch_enabled() const { return stretch_enabled_; }
public slots:
public slots:
// Changes the stretch mode. Enabling stretch mode will initialise the
// proportional column widths from the current state of the header.
void ToggleStretchEnabled();
void SetStretchEnabled(bool enabled);
signals:
signals:
// Emitted when the stretch mode is changed.
void StretchEnabledChanged(bool enabled);
protected:
protected:
// QWidget
void mouseMoveEvent(QMouseEvent* e);
void resizeEvent(QResizeEvent* event);
@@ -90,10 +90,10 @@ protected:
// Resizes the actual columns to make them match the proportional values in column_widths_.
void UpdateWidths(const QList<int>& sections = QList<int>());
private slots:
private slots:
void SectionResized(int logical, int old_size, int new_size);
private:
private:
bool stretch_enabled_;
QVector<ColumnWidthType> column_widths_;

View File

@@ -41,7 +41,7 @@ class TrackSlider : public QWidget {
Q_OBJECT
public:
TrackSlider(QWidget* parent = nullptr);
explicit TrackSlider(QWidget* parent = nullptr);
~TrackSlider();
void SetApplication(Application* app);

View File

@@ -39,17 +39,17 @@ class TrackSliderPopup : public QWidget {
Q_OBJECT
public:
TrackSliderPopup(QWidget* parent);
explicit TrackSliderPopup(QWidget *parent);
public slots:
public slots:
void SetText(const QString& text);
void SetSmallText(const QString& small_text);
void SetPopupPosition(const QPoint& pos);
protected:
protected:
void paintEvent(QPaintEvent*);
private:
private:
static const int kTextMargin;
static const int kPointLength;
static const int kPointWidth;
@@ -60,7 +60,7 @@ private:
void UpdatePosition();
void SendMouseEventToParent(QMouseEvent* e);
private:
private:
QString text_;
QString small_text_;
QPoint pos_;

View File

@@ -41,7 +41,7 @@ class TrackSliderSlider : public QSlider {
Q_OBJECT
public:
TrackSliderSlider(QWidget* parent = nullptr);
explicit TrackSliderSlider(QWidget* parent = nullptr);
signals:
void SeekForward();

View File

@@ -43,7 +43,7 @@ class SliderSlider : public QSlider {
Q_OBJECT
public:
SliderSlider(Qt::Orientation, QWidget*, uint max = 0);
explicit SliderSlider(Qt::Orientation, QWidget*, uint max = 0);
virtual void setValue(int);
@@ -86,7 +86,7 @@ class PrettySlider : public SliderSlider {
Pretty
} SliderMode;
PrettySlider(Qt::Orientation orientation, SliderMode mode, QWidget* parent, uint max = 0);
explicit PrettySlider(Qt::Orientation orientation, SliderMode mode, QWidget* parent, uint max = 0);
protected:
virtual void slideEvent(QMouseEvent*);
@@ -103,7 +103,7 @@ class VolumeSlider : public SliderSlider {
Q_OBJECT
public:
VolumeSlider(QWidget* parent, uint max = 0);
explicit VolumeSlider(QWidget *parent, uint max = 0);
void SetEnabled(const bool enabled);
protected: