Use anonymous namespace for constants
This commit is contained in:
@@ -29,7 +29,9 @@
|
||||
#include "autoexpandingtreeview.h"
|
||||
#include "core/mimedata.h"
|
||||
|
||||
const int AutoExpandingTreeView::kRowsToShow = 50;
|
||||
namespace {
|
||||
constexpr int kRowsToShow = 50;
|
||||
}
|
||||
|
||||
AutoExpandingTreeView::AutoExpandingTreeView(QWidget *parent)
|
||||
: QTreeView(parent),
|
||||
|
||||
@@ -39,8 +39,6 @@ class AutoExpandingTreeView : public QTreeView {
|
||||
public:
|
||||
explicit AutoExpandingTreeView(QWidget *parent = nullptr);
|
||||
|
||||
static const int kRowsToShow;
|
||||
|
||||
void SetAutoOpen(bool v) { auto_open_ = v; }
|
||||
void SetExpandOnReset(bool v) { expand_on_reset_ = v; }
|
||||
void SetAddOnDoubleClick(bool v) { add_on_double_click_ = v; }
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
|
||||
#include "favoritewidget.h"
|
||||
|
||||
const int FavoriteWidget::kStarSize = 15;
|
||||
namespace {
|
||||
constexpr int kStarSize = 15;
|
||||
}
|
||||
|
||||
FavoriteWidget::FavoriteWidget(const int tab_index, const bool favorite, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
|
||||
@@ -51,8 +51,6 @@ class FavoriteWidget : public QWidget {
|
||||
void mouseDoubleClickEvent(QMouseEvent*) override;
|
||||
|
||||
private:
|
||||
static const int kStarSize;
|
||||
|
||||
// The playlist's id this widget belongs to
|
||||
int tab_index_;
|
||||
bool favorite_;
|
||||
|
||||
@@ -44,20 +44,23 @@
|
||||
|
||||
class QPaintEvent;
|
||||
|
||||
const int FreeSpaceBar::kBarHeight = 20;
|
||||
const int FreeSpaceBar::kBarBorderRadius = 8;
|
||||
const int FreeSpaceBar::kMarkerSpacing = 32;
|
||||
const int FreeSpaceBar::kLabelBoxSize = 12;
|
||||
const int FreeSpaceBar::kLabelBoxPadding = 4;
|
||||
const int FreeSpaceBar::kLabelSpacing = 16;
|
||||
namespace {
|
||||
constexpr int kBarHeight = 20;
|
||||
constexpr int kBarBorderRadius = 8;
|
||||
constexpr int kMarkerSpacing = 32;
|
||||
constexpr int kLabelBoxSize = 12;
|
||||
constexpr int kLabelBoxPadding = 4;
|
||||
constexpr int kLabelSpacing = 16;
|
||||
|
||||
const QRgb FreeSpaceBar::kColorBg1 = qRgb(214, 207, 200);
|
||||
const QRgb FreeSpaceBar::kColorBg2 = qRgb(234, 226, 218);
|
||||
const QRgb FreeSpaceBar::kColorAdd1 = qRgb(136, 180, 229);
|
||||
const QRgb FreeSpaceBar::kColorAdd2 = qRgb(72, 146, 229);
|
||||
const QRgb FreeSpaceBar::kColorBar1 = qRgb(250, 148, 76);
|
||||
const QRgb FreeSpaceBar::kColorBar2 = qRgb(214, 102, 24);
|
||||
const QRgb FreeSpaceBar::kColorBorder = qRgb(174, 168, 162);
|
||||
constexpr QRgb kColorBg1 = qRgb(214, 207, 200);
|
||||
constexpr QRgb kColorBg2 = qRgb(234, 226, 218);
|
||||
constexpr QRgb kColorAdd1 = qRgb(136, 180, 229);
|
||||
constexpr QRgb kColorAdd2 = qRgb(72, 146, 229);
|
||||
constexpr QRgb kColorBar1 = qRgb(250, 148, 76);
|
||||
constexpr QRgb kColorBar2 = qRgb(214, 102, 24);
|
||||
constexpr QRgb kColorBorder = qRgb(174, 168, 162);
|
||||
|
||||
} // namespace
|
||||
|
||||
FreeSpaceBar::FreeSpaceBar(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
|
||||
@@ -39,21 +39,6 @@ class FreeSpaceBar : public QWidget {
|
||||
public:
|
||||
explicit FreeSpaceBar(QWidget *parent = nullptr);
|
||||
|
||||
static const int kBarHeight;
|
||||
static const int kBarBorderRadius;
|
||||
static const int kMarkerSpacing;
|
||||
static const int kLabelBoxSize;
|
||||
static const int kLabelBoxPadding;
|
||||
static const int kLabelSpacing;
|
||||
|
||||
static const QRgb kColorBg1;
|
||||
static const QRgb kColorBg2;
|
||||
static const QRgb kColorAdd1;
|
||||
static const QRgb kColorAdd2;
|
||||
static const QRgb kColorBar1;
|
||||
static const QRgb kColorBar2;
|
||||
static const QRgb kColorBorder;
|
||||
|
||||
void set_free_bytes(const quint64 bytes) { free_ = bytes; update(); }
|
||||
void set_additional_bytes(const quint64 bytes) { additional_ = bytes; update(); }
|
||||
void set_total_bytes(const quint64 bytes) { total_ = bytes; update(); }
|
||||
|
||||
@@ -47,8 +47,10 @@
|
||||
#include "core/multisortfilterproxy.h"
|
||||
#include "groupediconview.h"
|
||||
|
||||
const int GroupedIconView::kBarThickness = 2;
|
||||
const int GroupedIconView::kBarMarginTop = 3;
|
||||
namespace {
|
||||
constexpr int kBarThickness = 2;
|
||||
constexpr int kBarMarginTop = 3;
|
||||
} // namespace
|
||||
|
||||
GroupedIconView::GroupedIconView(QWidget *parent)
|
||||
: QListView(parent),
|
||||
|
||||
@@ -100,9 +100,6 @@ class GroupedIconView : public QListView {
|
||||
void LayoutItems();
|
||||
|
||||
private:
|
||||
static const int kBarThickness;
|
||||
static const int kBarMarginTop;
|
||||
|
||||
struct Header {
|
||||
int y;
|
||||
int first_row;
|
||||
|
||||
@@ -34,9 +34,11 @@
|
||||
#include "multiloadingindicator.h"
|
||||
#include "widgets/busyindicator.h"
|
||||
|
||||
const int MultiLoadingIndicator::kVerticalPadding = 4;
|
||||
const int MultiLoadingIndicator::kHorizontalPadding = 6;
|
||||
const int MultiLoadingIndicator::kSpacing = 6;
|
||||
namespace {
|
||||
constexpr int kVerticalPadding = 4;
|
||||
constexpr int kHorizontalPadding = 6;
|
||||
constexpr int kSpacing = 6;
|
||||
}
|
||||
|
||||
MultiLoadingIndicator::MultiLoadingIndicator(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
|
||||
@@ -39,10 +39,6 @@ class MultiLoadingIndicator : public QWidget {
|
||||
public:
|
||||
explicit MultiLoadingIndicator(QWidget *parent = nullptr);
|
||||
|
||||
static const int kVerticalPadding;
|
||||
static const int kHorizontalPadding;
|
||||
static const int kSpacing;
|
||||
|
||||
void SetTaskManager(SharedPtr<TaskManager> task_manager);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
|
||||
@@ -47,21 +47,25 @@
|
||||
|
||||
using std::make_unique;
|
||||
|
||||
const char *PlayingWidget::kSettingsGroup = "PlayingWidget";
|
||||
namespace {
|
||||
|
||||
constexpr char kSettingsGroup[] = "PlayingWidget";
|
||||
|
||||
// Space between the cover and the details in small mode
|
||||
const int PlayingWidget::kPadding = 2;
|
||||
constexpr int kPadding = 2;
|
||||
|
||||
// Width of the transparent to black gradient above and below the text in large mode
|
||||
const int PlayingWidget::kGradientHead = 40;
|
||||
const int PlayingWidget::kGradientTail = 20;
|
||||
constexpr int kGradientHead = 40;
|
||||
constexpr int kGradientTail = 20;
|
||||
|
||||
// Maximum height of the cover in large mode, and offset between the bottom of the cover and bottom of the widget
|
||||
const int PlayingWidget::kMaxCoverSize = 260;
|
||||
const int PlayingWidget::kBottomOffset = 0;
|
||||
constexpr int kMaxCoverSize = 260;
|
||||
constexpr int kBottomOffset = 0;
|
||||
|
||||
// Border for large mode
|
||||
const int PlayingWidget::kTopBorder = 4;
|
||||
constexpr int kTopBorder = 4;
|
||||
|
||||
} // namespace
|
||||
|
||||
PlayingWidget::PlayingWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
|
||||
@@ -102,14 +102,6 @@ class PlayingWidget : public QWidget {
|
||||
void FadePreviousTrack(const qreal value);
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
static const int kPadding;
|
||||
static const int kGradientHead;
|
||||
static const int kGradientTail;
|
||||
static const int kMaxCoverSize;
|
||||
static const int kBottomOffset;
|
||||
static const int kTopBorder;
|
||||
|
||||
Application *app_;
|
||||
AlbumCoverChoiceController *album_cover_choice_controller_;
|
||||
Mode mode_;
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
# include "moodbar/moodbarproxystyle.h"
|
||||
#endif
|
||||
|
||||
const char *TrackSlider::kSettingsGroup = "MainWindow";
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "MainWindow";
|
||||
}
|
||||
|
||||
TrackSlider::TrackSlider(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
|
||||
@@ -56,8 +56,6 @@ class TrackSlider : public QWidget {
|
||||
MoodbarProxyStyle *moodbar_style() const { return moodbar_style_; }
|
||||
#endif
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
public slots:
|
||||
void SetValue(const int elapsed, const int total);
|
||||
void SetStopped();
|
||||
|
||||
@@ -36,11 +36,13 @@
|
||||
#include "core/qt_blurimage.h"
|
||||
#include "tracksliderpopup.h"
|
||||
|
||||
const int TrackSliderPopup::kTextMargin = 4;
|
||||
const int TrackSliderPopup::kPointLength = 16;
|
||||
const int TrackSliderPopup::kPointWidth = 4;
|
||||
const int TrackSliderPopup::kBorderRadius = 4;
|
||||
const qreal TrackSliderPopup::kBlurRadius = 20.0;
|
||||
namespace {
|
||||
constexpr int kTextMargin = 4;
|
||||
constexpr int kPointLength = 16;
|
||||
constexpr int kPointWidth = 4;
|
||||
constexpr int kBorderRadius = 4;
|
||||
constexpr qreal kBlurRadius = 20.0;
|
||||
} // namespace
|
||||
|
||||
TrackSliderPopup::TrackSliderPopup(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
|
||||
@@ -48,12 +48,6 @@ class TrackSliderPopup : public QWidget {
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
|
||||
private:
|
||||
static const int kTextMargin;
|
||||
static const int kPointLength;
|
||||
static const int kPointWidth;
|
||||
static const int kBorderRadius;
|
||||
static const qreal kBlurRadius;
|
||||
|
||||
void UpdatePixmap();
|
||||
void UpdatePosition();
|
||||
void SendMouseEventToParent(QMouseEvent *e);
|
||||
|
||||
Reference in New Issue
Block a user