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

@ -74,7 +74,7 @@ class SingleApplicationPrivate : public QObject {
};
Q_DECLARE_PUBLIC(SingleApplication)
SingleApplicationPrivate(SingleApplication *_q_ptr);
explicit SingleApplicationPrivate(SingleApplication *_q_ptr);
~SingleApplicationPrivate();
void genBlockServerName();

View File

@ -74,7 +74,7 @@ class SingleCoreApplicationPrivate : public QObject {
};
Q_DECLARE_PUBLIC(SingleCoreApplication)
SingleCoreApplicationPrivate(SingleCoreApplication *_q_ptr);
explicit SingleCoreApplicationPrivate(SingleCoreApplication *_q_ptr);
~SingleCoreApplicationPrivate();
void genBlockServerName();

View File

@ -65,7 +65,7 @@ class ThreadFunctorBase : public QFutureInterface<ReturnType>, public QRunnable
template <typename ReturnType, typename... Args>
class ThreadFunctor : public ThreadFunctorBase<ReturnType> {
public:
ThreadFunctor(std::function<ReturnType (Args...)> function, Args... args)
explicit ThreadFunctor(std::function<ReturnType (Args...)> function, Args... args)
: function_(std::bind(function, args...)) {
}
@ -82,7 +82,7 @@ class ThreadFunctor : public ThreadFunctorBase<ReturnType> {
template <typename... Args>
class ThreadFunctor <void, Args...> : public ThreadFunctorBase<void> {
public:
ThreadFunctor(std::function<void (Args...)> function, Args... args)
explicit ThreadFunctor(std::function<void (Args...)> function, Args... args)
: function_(std::bind(function, args...)) {
}

View File

@ -89,7 +89,7 @@ template <class T>
class DebugBase : public QDebug {
public:
DebugBase() : QDebug(sNullDevice) {}
DebugBase(QtMsgType t) : QDebug(t) {}
explicit DebugBase(QtMsgType t) : QDebug(t) {}
T& space() { return static_cast<T&>(QDebug::space()); }
T& noSpace() { return static_cast<T&>(QDebug::nospace()); }
};
@ -98,7 +98,7 @@ class DebugBase : public QDebug {
class BufferedDebug : public DebugBase<BufferedDebug> {
public:
BufferedDebug() {}
BufferedDebug(QtMsgType) : buf_(new QBuffer, later_deleter) {
explicit BufferedDebug(QtMsgType) : buf_(new QBuffer, later_deleter) {
buf_->open(QIODevice::WriteOnly);
// QDebug doesn't have a method to set a new io device, but swap() allows the devices to be swapped between two instances.
@ -117,7 +117,7 @@ class BufferedDebug : public DebugBase<BufferedDebug> {
class LoggedDebug : public DebugBase<LoggedDebug> {
public:
LoggedDebug() {}
LoggedDebug(QtMsgType t) : DebugBase(t) { nospace() << kMessageHandlerMagic; }
explicit LoggedDebug(QtMsgType t) : DebugBase(t) { nospace() << kMessageHandlerMagic; }
};
static void MessageHandler(QtMsgType type, const QMessageLogContext&, const QString &message) {

View File

@ -31,7 +31,7 @@ class _MessageReplyBase : public QObject {
Q_OBJECT
public:
_MessageReplyBase(QObject *parent = nullptr);
explicit _MessageReplyBase(QObject *parent = nullptr);
virtual int id() const = 0;
bool is_finished() const { return finished_; }
@ -57,7 +57,7 @@ class _MessageReplyBase : public QObject {
template <typename MessageType>
class MessageReply : public _MessageReplyBase {
public:
MessageReply(const MessageType& request_message, QObject *parent = nullptr);
explicit MessageReply(const MessageType& request_message, QObject *parent = nullptr);
int id() const { return request_message_.id(); }
const MessageType& request_message() const { return request_message_; }

View File

@ -46,7 +46,7 @@ class _WorkerPoolBase : public QObject {
Q_OBJECT
public:
_WorkerPoolBase(QObject *parent = nullptr);
explicit _WorkerPoolBase(QObject *parent = nullptr);
signals:
// Emitted when a worker failed to start. This usually happens when the worker wasn't found, or couldn't be executed.
@ -67,7 +67,7 @@ protected slots:
template <typename HandlerType>
class WorkerPool : public _WorkerPoolBase {
public:
WorkerPool(QObject *parent = nullptr);
explicit WorkerPool(QObject *parent = nullptr);
~WorkerPool();
typedef typename HandlerType::MessageType MessageType;

View File

@ -30,7 +30,7 @@ class QIODevice;
class TagReaderWorker : public AbstractMessageHandler<pb::tagreader::Message> {
public:
TagReaderWorker(QIODevice *socket, QObject *parent = nullptr);
explicit TagReaderWorker(QIODevice *socket, QObject *parent = nullptr);
protected:
void MessageArrived(const pb::tagreader::Message &message);

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

View File

@ -40,7 +40,7 @@ class MockNetworkReply : public QNetworkReply {
Q_OBJECT
public:
MockNetworkReply();
MockNetworkReply(const QByteArray& data);
explicit explicit MockNetworkReply(const QByteArray& data);
// Use these to set expectations.
void SetData(const QByteArray& data);

View File

@ -62,13 +62,13 @@ Q_DECLARE_METATYPE(QModelIndex)
class TemporaryResource : public QTemporaryFile {
public:
TemporaryResource(const QString& filename);
explicit explicit TemporaryResource(const QString& filename);
};
class TestQObject : public QObject {
Q_OBJECT
public:
TestQObject(QObject* parent = nullptr);
explicit explicit TestQObject(QObject* parent = nullptr);
void Emit();