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

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