Change some explicit usage

This commit is contained in:
Jonas Kvinge
2020-06-26 22:41:38 +02:00
parent 740f9581e6
commit dc36aee7ff
28 changed files with 38 additions and 38 deletions

View File

@@ -41,7 +41,7 @@ class BlockAnalyzer : public Analyzer::Base {
Q_OBJECT
public:
Q_INVOKABLE BlockAnalyzer(QWidget*);
Q_INVOKABLE explicit BlockAnalyzer(QWidget*);
static const uint kHeight;
static const uint kWidth;

View File

@@ -40,7 +40,7 @@ class BoomAnalyzer : public Analyzer::Base {
Q_OBJECT
public:
Q_INVOKABLE BoomAnalyzer(QWidget*);
Q_INVOKABLE explicit BoomAnalyzer(QWidget*);
static const char* kName;

View File

@@ -63,7 +63,7 @@ class FHT {
* should be at least 3. Values of more than 3 need a trigonometry table.
* @see makeCasTable()
*/
FHT(int);
explicit FHT(int);
~FHT();
int sizeExp() const;

View File

@@ -129,7 +129,7 @@ class NyanCatAnalyzer : public RainbowAnalyzer {
Q_OBJECT
public:
Q_INVOKABLE NyanCatAnalyzer(QWidget* parent);
Q_INVOKABLE explicit NyanCatAnalyzer(QWidget* parent);
static const char* kName;
};
@@ -138,7 +138,7 @@ class RainbowDashAnalyzer : public RainbowAnalyzer {
Q_OBJECT
public:
Q_INVOKABLE RainbowDashAnalyzer(QWidget* parent);
Q_INVOKABLE explicit RainbowDashAnalyzer(QWidget* parent);
static const char* kName;
};

View File

@@ -107,7 +107,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
};
struct Grouping {
Grouping(GroupBy f = GroupBy_None, GroupBy s = GroupBy_None, GroupBy t = GroupBy_None)
explicit Grouping(GroupBy f = GroupBy_None, GroupBy s = GroupBy_None, GroupBy t = GroupBy_None)
: first(f), second(s), third(t) {}
GroupBy first;

View File

@@ -64,7 +64,7 @@ class ContextAlbumsView : public AutoExpandingTreeView {
Q_OBJECT
public:
ContextAlbumsView(QWidget *parent = nullptr);
explicit ContextAlbumsView(QWidget *parent = nullptr);
~ContextAlbumsView() override;
// Returns Songs currently selected in the collection view.

View File

@@ -129,7 +129,7 @@ class Database : public QObject {
class MemoryDatabase : public Database {
public:
MemoryDatabase(Application *app, QObject *parent = nullptr)
explicit MemoryDatabase(Application *app, QObject *parent = nullptr)
: Database(app, parent, ":memory:") {}
~MemoryDatabase() override {
// Make sure Qt doesn't reuse the same database

View File

@@ -31,7 +31,7 @@ class MimeData : public QMimeData {
Q_OBJECT
public:
MimeData(bool clear = false, bool play_now = false, bool enqueue = false, bool enqueue_next_now = false, bool open_in_new_playlist = false)
explicit MimeData(bool clear = false, bool play_now = false, bool enqueue = false, bool enqueue_next_now = false, bool open_in_new_playlist = false)
: override_user_settings_(false),
clear_first_(clear),
play_now_(play_now),

View File

@@ -43,7 +43,7 @@ class QtSystemTrayIcon : public SystemTrayIcon {
Q_OBJECT
public:
QtSystemTrayIcon(QObject *parent = nullptr);
explicit QtSystemTrayIcon(QObject *parent = nullptr);
~QtSystemTrayIcon() override;
void SetupMenu(QAction *previous, QAction *play, QAction *stop, QAction *stop_after, QAction *next, QAction *mute, QAction *love, QAction *quit) override;

View File

@@ -32,7 +32,7 @@ class ScopedGObject {
public:
ScopedGObject() : object_(nullptr) {}
explicit ScopedGObject(const ScopedGObject& other) : object_(nullptr) {
ScopedGObject(const ScopedGObject& other) : object_(nullptr) {
reset(other.object_);
}

View File

@@ -57,7 +57,7 @@ class UrlHandler : public QObject {
Error,
};
LoadResult(const QUrl &original_url = QUrl(), const Type type = NoMoreTracks, const QUrl &stream_url = QUrl(), const Song::FileType filetype = Song::FileType_Stream, const int samplerate = -1, const int bit_depth = -1, const qint64 length_nanosec = -1, const QString error = QString());
explicit LoadResult(const QUrl &original_url = QUrl(), const Type type = NoMoreTracks, const QUrl &stream_url = QUrl(), const Song::FileType filetype = Song::FileType_Stream, const int samplerate = -1, const int bit_depth = -1, const qint64 length_nanosec = -1, const QString error = QString());
// The url that the playlist item has in Url().
// Might be something unplayable like lastfm://...

View File

@@ -174,7 +174,7 @@ class ScopedWCharArray {
QString ToString() const { return QString::fromWCharArray(data_.get()); }
wchar_t *get() const { return data_.get(); }
operator wchar_t*() const { return get(); }
explicit operator wchar_t*() const { return get(); }
int characters() const { return chars_; }
int bytes() const { return (chars_ + 1) *sizeof(wchar_t); }

View File

@@ -38,7 +38,7 @@ class DeviceDatabaseBackend : public QObject {
Q_OBJECT
public:
Q_INVOKABLE DeviceDatabaseBackend(QObject *parent = nullptr);
Q_INVOKABLE explicit DeviceDatabaseBackend(QObject *parent = nullptr);
struct Device {
Device() : id_(-1) {}

View File

@@ -41,7 +41,7 @@ class About : public QDialog {
private:
struct Person {
Person(const QString &n, const QString &e = QString()) : name(n), email(e) {}
explicit Person(const QString &n, const QString &e = QString()) : name(n), email(e) {}
bool operator<(const Person &other) const { return name < other.name; }
QString name;
QString email;

View File

@@ -31,7 +31,7 @@ class AddStreamDialog : public QDialog {
Q_OBJECT
public:
AddStreamDialog(QWidget *parent = nullptr);
explicit AddStreamDialog(QWidget *parent = nullptr);
~AddStreamDialog() override;
QUrl url() const { return QUrl(ui_->url->text()); }

View File

@@ -83,7 +83,7 @@ class EditTagDialog : public QDialog {
private:
struct Data {
Data(const Song &song = Song()) : original_(song), current_(song) {}
explicit Data(const Song &song = Song()) : original_(song), current_(song) {}
static QVariant value(const Song &song, const QString &id);
QVariant original_value(const QString &id) const {
@@ -127,7 +127,7 @@ class EditTagDialog : public QDialog {
private:
struct FieldData {
FieldData(QLabel *label = nullptr, QWidget *editor = nullptr, const QString &id = QString())
explicit FieldData(QLabel *label = nullptr, QWidget *editor = nullptr, const QString &id = QString())
: label_(label), editor_(editor), id_(id) {}
QLabel *label_;

View File

@@ -36,7 +36,7 @@ class VlcScopedRef {
T* operator ->() const { return ptr_; }
private:
explicit VlcScopedRef(VlcScopedRef&) {}
VlcScopedRef(VlcScopedRef&) {}
VlcScopedRef& operator =(const VlcScopedRef&) { return *this; }
T* ptr_;

View File

@@ -57,7 +57,7 @@ class Player;
class QueuedItemDelegate : public QStyledItemDelegate {
public:
QueuedItemDelegate(QObject *parent, int indicator_column = Playlist::Column_Title);
explicit QueuedItemDelegate(QObject *parent, int indicator_column = Playlist::Column_Title);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void DrawBox(QPainter *painter, const QRect &line_rect, const QFont &font, const QString &text, int width = -1) const;
@@ -118,13 +118,13 @@ class DateItemDelegate : public PlaylistDelegateBase {
class LastPlayedItemDelegate : public PlaylistDelegateBase {
public:
LastPlayedItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
explicit LastPlayedItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString displayText(const QVariant &value, const QLocale &locale) const override;
};
class FileTypeItemDelegate : public PlaylistDelegateBase {
public:
FileTypeItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
explicit FileTypeItemDelegate(QObject *parent) : PlaylistDelegateBase(parent) {}
QString displayText(const QVariant &value, const QLocale &locale) const override;
};

View File

@@ -75,7 +75,7 @@ GstElement *Transcoder::CreateElement(const QString &factory_name, GstElement *b
struct SuitableElement {
SuitableElement(const QString &name = QString(), int rank = 0) : name_(name), rank_(rank) {}
explicit SuitableElement(const QString &name = QString(), int rank = 0) : name_(name), rank_(rank) {}
bool operator<(const SuitableElement &other) const {
return rank_ < other.rank_;