Use anonymous namespace for constants
This commit is contained in:
@@ -55,7 +55,9 @@
|
||||
|
||||
using std::make_shared;
|
||||
|
||||
const int PlaylistBackend::kSongTableJoins = 2;
|
||||
namespace {
|
||||
constexpr int kSongTableJoins = 2;
|
||||
}
|
||||
|
||||
PlaylistBackend::PlaylistBackend(Application *app, QObject *parent)
|
||||
: QObject(parent),
|
||||
|
||||
@@ -64,8 +64,6 @@ class PlaylistBackend : public QObject {
|
||||
};
|
||||
using PlaylistList = QList<Playlist>;
|
||||
|
||||
static const int kSongTableJoins;
|
||||
|
||||
void Close();
|
||||
void ExitAsync();
|
||||
|
||||
|
||||
@@ -61,9 +61,11 @@
|
||||
#include "widgets/qsearchfield.h"
|
||||
#include "settings/appearancesettingspage.h"
|
||||
|
||||
const char *PlaylistContainer::kSettingsGroup = "Playlist";
|
||||
const int PlaylistContainer::kFilterDelayMs = 100;
|
||||
const int PlaylistContainer::kFilterDelayPlaylistSizeThreshold = 5000;
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Playlist";
|
||||
constexpr int kFilterDelayMs = 100;
|
||||
constexpr int kFilterDelayPlaylistSizeThreshold = 5000;
|
||||
} // namespace
|
||||
|
||||
PlaylistContainer::PlaylistContainer(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
|
||||
@@ -54,8 +54,6 @@ class PlaylistContainer : public QWidget {
|
||||
explicit PlaylistContainer(QWidget *parent = nullptr);
|
||||
~PlaylistContainer() override;
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
void SetActions(QAction *new_playlist, QAction *load_playlist, QAction *save_playlist, QAction *clear_playlist, QAction *next_playlist, QAction *previous_playlist, QAction *save_all_playlists);
|
||||
void SetManager(SharedPtr<PlaylistManager> manager);
|
||||
void ReloadSettings();
|
||||
@@ -113,9 +111,6 @@ class PlaylistContainer : public QWidget {
|
||||
void RepositionNoMatchesLabel(bool force = false);
|
||||
|
||||
private:
|
||||
static const int kFilterDelayMs;
|
||||
static const int kFilterDelayPlaylistSizeThreshold;
|
||||
|
||||
Ui_PlaylistContainer *ui_;
|
||||
|
||||
SharedPtr<PlaylistManager> manager_;
|
||||
|
||||
@@ -71,13 +71,15 @@
|
||||
#include "playlist/playlist.h"
|
||||
#include "playlistdelegates.h"
|
||||
|
||||
const int QueuedItemDelegate::kQueueBoxBorder = 1;
|
||||
const int QueuedItemDelegate::kQueueBoxCornerRadius = 3;
|
||||
const int QueuedItemDelegate::kQueueBoxLength = 30;
|
||||
const QRgb QueuedItemDelegate::kQueueBoxGradientColor1 = qRgb(102, 150, 227);
|
||||
const QRgb QueuedItemDelegate::kQueueBoxGradientColor2 = qRgb(77, 121, 200);
|
||||
const int QueuedItemDelegate::kQueueOpacitySteps = 10;
|
||||
const float QueuedItemDelegate::kQueueOpacityLowerBound = 0.4F;
|
||||
namespace {
|
||||
constexpr int kQueueBoxBorder = 1;
|
||||
constexpr int kQueueBoxCornerRadius = 3;
|
||||
constexpr int kQueueBoxLength = 30;
|
||||
constexpr QRgb kQueueBoxGradientColor1 = qRgb(102, 150, 227);
|
||||
constexpr QRgb kQueueBoxGradientColor2 = qRgb(77, 121, 200);
|
||||
constexpr int kQueueOpacitySteps = 10;
|
||||
constexpr float kQueueOpacityLowerBound = 0.4F;
|
||||
} // namespace
|
||||
|
||||
const int PlaylistDelegateBase::kMinHeight = 19;
|
||||
|
||||
|
||||
@@ -66,14 +66,6 @@ class QueuedItemDelegate : public QStyledItemDelegate {
|
||||
int queue_indicator_size(const QModelIndex &idx) const;
|
||||
|
||||
private:
|
||||
static const int kQueueBoxBorder;
|
||||
static const int kQueueBoxCornerRadius;
|
||||
static const int kQueueBoxLength;
|
||||
static const QRgb kQueueBoxGradientColor1;
|
||||
static const QRgb kQueueBoxGradientColor2;
|
||||
static const int kQueueOpacitySteps;
|
||||
static const float kQueueOpacityLowerBound;
|
||||
|
||||
int indicator_column_;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
#include "playlistlistview.h"
|
||||
#include "playlist.h"
|
||||
|
||||
namespace {
|
||||
constexpr int kDragHoverTimeout = 500;
|
||||
}
|
||||
|
||||
PlaylistListView::PlaylistListView(QWidget *parent) : AutoExpandingTreeView(parent) {}
|
||||
|
||||
void PlaylistListView::paintEvent(QPaintEvent *event) {
|
||||
|
||||
@@ -62,8 +62,6 @@ class PlaylistListView : public AutoExpandingTreeView {
|
||||
void timerEvent(QTimerEvent *e) override;
|
||||
|
||||
private:
|
||||
static const int kDragHoverTimeout = 500;
|
||||
|
||||
QBasicTimer drag_hover_timer_;
|
||||
};
|
||||
|
||||
|
||||
@@ -54,7 +54,10 @@
|
||||
#include "playlistmanager.h"
|
||||
#include "playlisttabbar.h"
|
||||
|
||||
const char *PlaylistTabBar::kSettingsGroup = "PlaylistTabBar";
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "PlaylistTabBar";
|
||||
constexpr int kDragHoverTimeout = 500;
|
||||
} // namespace
|
||||
|
||||
PlaylistTabBar::PlaylistTabBar(QWidget *parent)
|
||||
: QTabBar(parent),
|
||||
|
||||
@@ -54,9 +54,6 @@ class PlaylistTabBar : public QTabBar {
|
||||
public:
|
||||
explicit PlaylistTabBar(QWidget *parent = nullptr);
|
||||
|
||||
static const int kDragHoverTimeout = 500;
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
void SetActions(QAction *new_playlist, QAction *load_playlist);
|
||||
void SetManager(SharedPtr<PlaylistManager> manager);
|
||||
|
||||
|
||||
@@ -81,10 +81,12 @@
|
||||
# include "moodbar/moodbaritemdelegate.h"
|
||||
#endif
|
||||
|
||||
const int PlaylistView::kGlowIntensitySteps = 24;
|
||||
const int PlaylistView::kAutoscrollGraceTimeout = 30; // seconds
|
||||
const int PlaylistView::kDropIndicatorWidth = 2;
|
||||
const int PlaylistView::kDropIndicatorGradientWidth = 5;
|
||||
namespace {
|
||||
constexpr int kGlowIntensitySteps = 24;
|
||||
constexpr int kAutoscrollGraceTimeout = 30; // seconds
|
||||
constexpr int kDropIndicatorWidth = 2;
|
||||
constexpr int kDropIndicatorGradientWidth = 5;
|
||||
} // namespace
|
||||
|
||||
PlaylistView::PlaylistView(QWidget *parent)
|
||||
: QTreeView(parent),
|
||||
|
||||
@@ -186,11 +186,6 @@ class PlaylistView : public QTreeView {
|
||||
void GlowIntensityChanged();
|
||||
|
||||
private:
|
||||
static const int kGlowIntensitySteps;
|
||||
static const int kAutoscrollGraceTimeout;
|
||||
static const int kDropIndicatorWidth;
|
||||
static const int kDropIndicatorGradientWidth;
|
||||
|
||||
QList<int> GetEditableColumns();
|
||||
QModelIndex NextEditableIndex(const QModelIndex ¤t);
|
||||
QModelIndex PrevEditableIndex(const QModelIndex ¤t);
|
||||
|
||||
Reference in New Issue
Block a user