Use anonymous namespace for constants

This commit is contained in:
Jonas Kvinge 2024-08-07 00:52:58 +02:00
parent c69777ca39
commit 819463a865
67 changed files with 186 additions and 240 deletions

View File

@ -36,12 +36,14 @@
#include "analyzerbase.h"
#include "fht.h"
const int BlockAnalyzer::kHeight = 2;
const int BlockAnalyzer::kWidth = 4;
const int BlockAnalyzer::kMinRows = 3; // arbitrary
const int BlockAnalyzer::kMinColumns = 32; // arbitrary
const int BlockAnalyzer::kMaxColumns = 256; // must be 2**n
const int BlockAnalyzer::kFadeSize = 90;
namespace {
constexpr int kHeight = 2;
constexpr int kWidth = 4;
constexpr int kMinRows = 3; // arbitrary
constexpr int kMinColumns = 32; // arbitrary
constexpr int kMaxColumns = 256; // must be 2**n
constexpr int kFadeSize = 90;
} // namespace
const char *BlockAnalyzer::kName = QT_TRANSLATE_NOOP("AnalyzerContainer", "Block analyzer");

View File

@ -43,13 +43,6 @@ class BlockAnalyzer : public AnalyzerBase {
public:
Q_INVOKABLE explicit BlockAnalyzer(QWidget*);
static const int kHeight;
static const int kWidth;
static const int kMinRows;
static const int kMinColumns;
static const int kMaxColumns;
static const int kFadeSize;
static const char *kName;
protected:

View File

@ -61,6 +61,10 @@
#include "settings/collectionsettingspage.h"
#include "settings/appearancesettingspage.h"
namespace {
constexpr int kFilterDelay = 500; // msec
}
CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
: QWidget(parent),
ui_(new Ui_CollectionFilterWidget),

View File

@ -51,8 +51,6 @@ class CollectionFilterWidget : public QWidget {
explicit CollectionFilterWidget(QWidget *parent = nullptr);
~CollectionFilterWidget() override;
static const int kFilterDelay = 500; // msec
enum class DelayBehaviour {
AlwaysInstant,
DelayedOnLargeLibraries,

View File

@ -65,7 +65,9 @@
#include "contextview.h"
#include "contextalbum.h"
const int ContextView::kWidgetSpacing = 50;
namespace {
constexpr int kWidgetSpacing = 50;
}
ContextView::ContextView(QWidget *parent)
: QWidget(parent),

View File

@ -101,8 +101,6 @@ class ContextView : public QWidget {
void AlbumCoverLoaded(const Song &song, const QImage &image);
private:
static const int kWidgetSpacing;
Application *app_;
CollectionView *collectionview_;
AlbumCoverChoiceController *album_cover_choice_controller_;

View File

@ -46,7 +46,9 @@
#include <getopt.h>
const char *CommandlineOptions::kHelpText =
namespace {
constexpr char kHelpText[] =
"%1: strawberry [%2] [%3]\n"
"\n"
"%4:\n"
@ -83,7 +85,9 @@ const char *CommandlineOptions::kHelpText =
" --log-levels <levels> %33\n"
" --version %34\n";
const char *CommandlineOptions::kVersionText = "Strawberry %1";
constexpr char kVersionText[] = "Strawberry %1";
} // namespace
CommandlineOptions::CommandlineOptions(int argc, char **argv)
: argc_(argc),

View File

@ -41,9 +41,6 @@ class CommandlineOptions {
public:
explicit CommandlineOptions(int argc = 0, char **argv = nullptr);
static const char *kHelpText;
static const char *kVersionText;
// Don't change the values or order, these get serialised and sent to
// possibly a different version of Strawberry
enum class UrlListAction {

View File

@ -34,7 +34,9 @@
#include "deletefiles.h"
#include "musicstorage.h"
const int DeleteFiles::kBatchSize = 50;
namespace {
constexpr int kBatchSize = 50;
}
DeleteFiles::DeleteFiles(SharedPtr<TaskManager> task_manager, SharedPtr<MusicStorage> storage, const bool use_trash, QObject *parent)
: QObject(parent),

View File

@ -41,8 +41,6 @@ class DeleteFiles : public QObject {
explicit DeleteFiles(SharedPtr<TaskManager> task_manager, SharedPtr<MusicStorage> storage, const bool use_trash, QObject *parent = nullptr);
~DeleteFiles() override;
static const int kBatchSize;
void Start(const SongList &songs);
void Start(const QStringList &filenames);

View File

@ -62,8 +62,11 @@
# include "device/cddasongloader.h"
#endif
namespace {
constexpr int kDefaultTimeout = 5000;
}
QSet<QString> SongLoader::sRawUriSchemes;
const int SongLoader::kDefaultTimeout = 5000;
SongLoader::SongLoader(SharedPtr<CollectionBackendInterface> collection_backend, const SharedPtr<Player> player, QObject *parent)
: QObject(parent),

View File

@ -68,8 +68,6 @@ class SongLoader : public QObject {
BlockingLoadRequired
};
static const int kDefaultTimeout;
const QUrl &url() const { return url_; }
const SongList &songs() const { return songs_; }

View File

@ -37,8 +37,10 @@ extern HICON qt_pixmapToWinHICON(const QPixmap &p);
#include "core/logging.h"
#include "windows7thumbbar.h"
const int Windows7ThumbBar::kIconSize = 16;
const int Windows7ThumbBar::kMaxButtonCount = 7;
namespace {
constexpr int kIconSize = 16;
constexpr int kMaxButtonCount = 7;
} // namespace
Windows7ThumbBar::Windows7ThumbBar(QWidget *widget)
: QObject(widget),

View File

@ -39,9 +39,6 @@ class Windows7ThumbBar : public QObject {
// Creates a list of buttons in the taskbar icon for this window.
explicit Windows7ThumbBar(QWidget *widget = nullptr);
static const int kIconSize;
static const int kMaxButtonCount;
// You must call this in the parent widget's constructor before returning to the event loop. If an action is nullptr it becomes a spacer.
void SetActions(const QList<QAction*> &actions);

View File

@ -46,6 +46,10 @@
using std::make_shared;
namespace {
constexpr int kMaxRedirects = 3;
}
AlbumCoverLoader::AlbumCoverLoader(QObject *parent)
: QObject(parent),
network_(new NetworkAccessManager(this)),

View File

@ -123,7 +123,6 @@ class AlbumCoverLoader : public QObject {
void LoadRemoteImageFinished(QNetworkReply *reply, AlbumCoverLoader::TaskPtr task, const AlbumCoverLoaderResult::Type result_type, const QUrl &cover_url);
private:
static const int kMaxRedirects = 3;
SharedPtr<NetworkAccessManager> network_;
bool stop_requested_;
QMutex mutex_load_image_async_;

View File

@ -38,7 +38,9 @@
#include "core/scopedtransaction.h"
#include "devicedatabasebackend.h"
const int DeviceDatabaseBackend::kDeviceSchemaVersion = 5;
namespace {
constexpr int kDeviceSchemaVersion = 5;
}
DeviceDatabaseBackend::DeviceDatabaseBackend(QObject *parent)
: QObject(parent),

View File

@ -56,8 +56,6 @@ class DeviceDatabaseBackend : public QObject {
};
using DeviceList = QList<Device>;
static const int kDeviceSchemaVersion;
void Init(SharedPtr<Database> db);
void Close();
void ExitAsync();

View File

@ -43,10 +43,12 @@
using u_int32_t = unsigned int;
#endif
static const int kDecodeRate = 11025;
static const int kDecodeChannels = 1;
static const int kPlayLengthSecs = 30;
static const int kTimeoutSecs = 10;
namespace {
constexpr int kDecodeRate = 11025;
constexpr int kDecodeChannels = 1;
constexpr int kPlayLengthSecs = 30;
constexpr int kTimeoutSecs = 10;
} // namespace
Chromaprinter::Chromaprinter(const QString &filename)
: filename_(filename),

View File

@ -47,10 +47,10 @@
using std::unique_ptr;
static const int kTimeoutSecs = 60;
namespace {
constexpr int kTimeoutSecs = 60;
struct ebur128_state_deleter {
void operator()(ebur128_state *p) const { ebur128_destroy(&p); };
};

View File

@ -64,21 +64,24 @@ using std::make_shared;
const char *GstEngine::kAutoSink = "autoaudiosink";
const char *GstEngine::kALSASink = "alsasink";
const char *GstEngine::kOpenALSASink = "openalsink";
const char *GstEngine::kOSSSink = "osssink";
const char *GstEngine::kOSS4Sink = "oss4sink";
const char *GstEngine::kJackAudioSink = "jackaudiosink";
const char *GstEngine::kPulseSink = "pulsesink";
const char *GstEngine::kA2DPSink = "a2dpsink";
const char *GstEngine::kAVDTPSink = "avdtpsink";
const char *GstEngine::InterAudiosink = "interaudiosink";
const char *GstEngine::kDirectSoundSink = "directsoundsink";
const char *GstEngine::kOSXAudioSink = "osxaudiosink";
const char *GstEngine::kWASAPISink = "wasapisink";
const int GstEngine::kDiscoveryTimeoutS = 10;
const qint64 GstEngine::kTimerIntervalNanosec = 1000 * kNsecPerMsec; // 1s
const qint64 GstEngine::kPreloadGapNanosec = 8000 * kNsecPerMsec; // 8s
const qint64 GstEngine::kSeekDelayNanosec = 100 * kNsecPerMsec; // 100msec
namespace {
constexpr char kOpenALSASink[] = "openalsink";
constexpr char kOSSSink[] = "osssink";
constexpr char kOSS4Sink[] = "oss4sink";
constexpr char kJackAudioSink[] = "jackaudiosink";
constexpr char kPulseSink[] = "pulsesink";
constexpr char kA2DPSink[] = "a2dpsink";
constexpr char kAVDTPSink[] = "avdtpsink";
constexpr char InterAudiosink[] = "interaudiosink";
constexpr char kDirectSoundSink[] = "directsoundsink";
constexpr char kOSXAudioSink[] = "osxaudiosink";
constexpr char kWASAPISink[] = "wasapisink";
constexpr int kDiscoveryTimeoutS = 10;
constexpr qint64 kTimerIntervalNanosec = 1000 * kNsecPerMsec; // 1s
constexpr qint64 kPreloadGapNanosec = 8000 * kNsecPerMsec; // 8s
constexpr qint64 kSeekDelayNanosec = 100 * kNsecPerMsec; // 100msec
} // namespace
GstEngine::GstEngine(SharedPtr<TaskManager> task_manager, QObject *parent)
: EngineBase(parent),

View File

@ -56,6 +56,7 @@ class GstEngine : public EngineBase, public GstBufferConsumer {
~GstEngine() override;
static const char *kAutoSink;
static const char *kALSASink;
Type type() const override { return Type::GStreamer; }
bool Init() override;
@ -142,23 +143,6 @@ class GstEngine : public EngineBase, public GstBufferConsumer {
static QString GSTdiscovererErrorMessage(GstDiscovererResult result);
private:
static const char *kALSASink;
static const char *kOpenALSASink;
static const char *kOSSSink;
static const char *kOSS4Sink;
static const char *kJackAudioSink;
static const char *kPulseSink;
static const char *kA2DPSink;
static const char *kAVDTPSink;
static const char *InterAudiosink;
static const char *kDirectSoundSink;
static const char *kOSXAudioSink;
static const char *kWASAPISink;
static const int kDiscoveryTimeoutS;
static const qint64 kTimerIntervalNanosec;
static const qint64 kPreloadGapNanosec;
static const qint64 kSeekDelayNanosec;
SharedPtr<TaskManager> task_manager_;
GstStartup *gst_startup_;
GstDiscoverer *discoverer_;

View File

@ -62,11 +62,15 @@
#include "gstenginepipeline.h"
#include "gstbufferconsumer.h"
constexpr int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000;
constexpr int GstEnginePipeline::kFaderFudgeMsec = 2000;
namespace {
constexpr int GstEnginePipeline::kEqBandCount = 10;
constexpr int GstEnginePipeline::kEqBandFrequencies[] = { 60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000 };
constexpr int kGstStateTimeoutNanosecs = 10000000;
constexpr int kFaderFudgeMsec = 2000;
constexpr int kEqBandCount = 10;
constexpr int kEqBandFrequencies[] = { 60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000 };
} // namespace
int GstEnginePipeline::sId = 1;

View File

@ -193,11 +193,6 @@ class GstEnginePipeline : public QObject {
void FaderTimelineFinished();
private:
static const int kGstStateTimeoutNanosecs;
static const int kFaderFudgeMsec;
static const int kEqBandCount;
static const int kEqBandFrequencies[];
// Using == to compare two pipelines is a bad idea, because new ones often get created in the same address as old ones. This ID will be unique for each pipeline.
// Threading warning: access to the static ID field isn't protected by a mutex because all pipeline creation is currently done in the main thread.
static int sId;

View File

@ -49,9 +49,10 @@
#include "equalizerslider.h"
#include "ui_equalizer.h"
const char *Equalizer::kGainText[] = { "60", "170", "310", "600", "1k", "3k", "6k", "12k", "14k", "16k" };
const char *Equalizer::kSettingsGroup = "Equalizer";
namespace {
constexpr char kSettingsGroup[] = "Equalizer";
const char *kGainText[] = { "60", "170", "310", "600", "1k", "3k", "6k", "12k", "14k", "16k" };
} // namespace
Equalizer::Equalizer(QWidget *parent)
: QDialog(parent),

View File

@ -44,9 +44,7 @@ class Equalizer : public QDialog {
explicit Equalizer(QWidget *parent = nullptr);
~Equalizer() override;
static const int kBands = 10;
static const char *kGainText[kBands];
static const char *kSettingsGroup;
static constexpr int kBands = 10;
struct Params {
Params();

View File

@ -35,7 +35,9 @@
using namespace std::chrono_literals;
const int LyricsFetcher::kMaxConcurrentRequests = 5;
namespace {
constexpr int kMaxConcurrentRequests = 5;
}
LyricsFetcher::LyricsFetcher(SharedPtr<LyricsProviders> lyrics_providers, QObject *parent)
: QObject(parent),

View File

@ -69,8 +69,6 @@ class LyricsFetcher : public QObject {
void StartRequests();
private:
static const int kMaxConcurrentRequests;
SharedPtr<LyricsProviders> lyrics_providers_;
quint64 next_id_;

View File

@ -34,9 +34,11 @@
#include "lyricsprovider.h"
#include "lyricsproviders.h"
const int LyricsFetcherSearch::kSearchTimeoutMs = 3000;
const int LyricsFetcherSearch::kGoodLyricsLength = 60;
const float LyricsFetcherSearch::kHighScore = 2.5;
namespace {
constexpr int kSearchTimeoutMs = 3000;
constexpr int kGoodLyricsLength = 60;
constexpr float kHighScore = 2.5;
} // namespace
LyricsFetcherSearch::LyricsFetcherSearch(const quint64 id, const LyricsSearchRequest &request, QObject *parent)
: QObject(parent),

View File

@ -57,10 +57,6 @@ class LyricsFetcherSearch : public QObject {
static bool LyricsSearchResultCompareScore(const LyricsSearchResult &a, const LyricsSearchResult &b);
private:
static const int kSearchTimeoutMs;
static const int kGoodLyricsLength;
static const float kHighScore;
quint64 id_;
LyricsSearchRequest request_;
LyricsSearchResults results_;

View File

@ -41,7 +41,9 @@
using std::make_unique;
const int MoodbarPipeline::kBands = 128;
namespace {
constexpr int kBands = 128;
}
MoodbarPipeline::MoodbarPipeline(const QUrl &url, QObject *parent)
: QObject(parent),

View File

@ -63,8 +63,6 @@ class MoodbarPipeline : public QObject {
static GstBusSyncReply BusCallbackSync(GstBus*, GstMessage *msg, gpointer data);
private:
static const int kBands;
QUrl url_;
GstElement *pipeline_;
GstElement *convert_element_;

View File

@ -51,10 +51,10 @@ using namespace std::chrono_literals;
class OrganizeFormat;
const int Organize::kBatchSize = 10;
#ifdef HAVE_GSTREAMER
const int Organize::kTranscodeProgressInterval = 500;
#endif
namespace {
constexpr int kBatchSize = 10;
constexpr int kTranscodeProgressInterval = 500;
} // namespace
Organize::Organize(SharedPtr<TaskManager> task_manager, SharedPtr<MusicStorage> destination, const OrganizeFormat &format, const bool copy, const bool overwrite, const bool albumcover, const NewSongInfoList &songs_info, const bool eject_after, const QString &playlist, QObject *parent)
: QObject(parent),

View File

@ -66,11 +66,6 @@ class Organize : public QObject {
explicit Organize(SharedPtr<TaskManager> task_manager, SharedPtr<MusicStorage> destination, const OrganizeFormat &format, const bool copy, const bool overwrite, const bool albumcover, const NewSongInfoList &songs, const bool eject_after, const QString &playlist = QString(), QObject *parent = nullptr);
~Organize() override;
static const int kBatchSize;
#ifdef HAVE_GSTREAMER
static const int kTranscodeProgressInterval;
#endif
void Start();
signals:

View File

@ -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),

View File

@ -64,8 +64,6 @@ class PlaylistBackend : public QObject {
};
using PlaylistList = QList<Playlist>;
static const int kSongTableJoins;
void Close();
void ExitAsync();

View File

@ -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),

View File

@ -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_;

View File

@ -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;

View File

@ -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_;
};

View File

@ -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) {

View File

@ -62,8 +62,6 @@ class PlaylistListView : public AutoExpandingTreeView {
void timerEvent(QTimerEvent *e) override;
private:
static const int kDragHoverTimeout = 500;
QBasicTimer drag_hover_timer_;
};

View File

@ -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),

View File

@ -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);

View File

@ -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),

View File

@ -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 &current);
QModelIndex PrevEditableIndex(const QModelIndex &current);

View File

@ -72,7 +72,7 @@ class QobuzService : public StreamingService {
int Search(const QString &text, StreamingSearchView::SearchType type) override;
void CancelSearch() override;
int max_login_attempts() { return kLoginAttempts; }
int max_login_attempts() const { return kLoginAttempts; }
Application *app() const { return app_; }
QString app_id() const { return app_id_; }

View File

@ -39,7 +39,9 @@
#include "radiomimedata.h"
#include "radiochannel.h"
const int RadioModel::kTreeIconSize = 22;
namespace {
constexpr int kTreeIconSize = 22;
}
RadioModel::RadioModel(Application *app, QObject *parent)
: SimpleTreeModel<RadioItem>(new RadioItem(this), parent),

View File

@ -86,7 +86,6 @@ class RadioModel : public SimpleTreeModel<RadioItem> {
void AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult &result);
private:
static const int kTreeIconSize;
using ItemAndCacheKey = QPair<RadioItem*, QString>;
Application *app_;

View File

@ -86,9 +86,11 @@
using std::make_unique;
const int StreamingSearchView::kSwapModelsTimeoutMsec = 250;
const int StreamingSearchView::kDelayedSearchTimeoutMs = 200;
const int StreamingSearchView::kArtHeight = 32;
namespace {
constexpr int kSwapModelsTimeoutMsec = 250;
constexpr int kDelayedSearchTimeoutMs = 200;
constexpr int kArtHeight = 32;
} // namespace
StreamingSearchView::StreamingSearchView(QWidget *parent)
: QWidget(parent),

View File

@ -176,11 +176,6 @@ class StreamingSearchView : public QWidget {
public slots:
void ReloadSettings();
private:
static const int kSwapModelsTimeoutMsec;
static const int kDelayedSearchTimeoutMs;
static const int kArtHeight;
private:
Application *app_;
SharedPtr<StreamingService> service_;

View File

@ -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),

View File

@ -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; }

View File

@ -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),

View File

@ -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_;

View File

@ -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),

View File

@ -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(); }

View File

@ -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),

View File

@ -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;

View File

@ -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),

View File

@ -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;

View File

@ -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),

View File

@ -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_;

View File

@ -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),

View File

@ -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();

View File

@ -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),

View File

@ -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);