Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: Use = default instead of {} for default ctors. #81

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci-scripts/build-qtox-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fi
cmake --build "$BUILD_DIR"

if [ ! -z "${TIDY+x}" ]; then
run-clang-tidy -p "$BUILD_DIR" -header-filter=.* src/ audio/src/ audio/include test/src/ \
run-clang-tidy -quiet -fix -format -p "$BUILD_DIR" -header-filter=.* src/ audio/src/ audio/include test/src/ \
test/include util/src/ util/include/
else
ctest -j"$(nproc)" --test-dir "$BUILD_DIR" --output-on-failure
Expand Down
3 changes: 3 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Checks: "-*
, modernize-use-bool-literals
, modernize-use-emplace
, modernize-use-equals-*
, modernize-use-nullptr
, modernize-use-override
, readability-named-parameter
, readability-inconsistent-declaration-parameter-name
"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
path: ".cache/ccache"
key: ${{ github.job }}-ccache
- name: Run build
run: docker compose run --rm fedora .ci-scripts/build-qtox-linux.sh --build-type Release --full --tidy
run: docker compose run --rm fedora .ci-scripts/build-qtox-linux.sh --build-type Release --full --tidy || (git diff --exit-code && false)

################################################################################################
# Build and test jobs (PR)
Expand Down
2 changes: 1 addition & 1 deletion audio/include/audio/iaudiocontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class IAudioControl : public QObject
Q_OBJECT

public:
virtual ~IAudioControl() = default;
~IAudioControl() override = default;
virtual void setOutputVolume(qreal volume) = 0;
virtual qreal maxOutputVolume() const = 0;
virtual qreal minOutputVolume() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion audio/include/audio/iaudiosource.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IAudioSource : public QObject
{
Q_OBJECT
public:
virtual ~IAudioSource() = default;
~IAudioSource() override = default;

virtual operator bool() const = 0;

Expand Down
2 changes: 1 addition & 1 deletion audio/src/backend/alsink.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AlSink : public QObject, public IAudioSink
AlSink& operator=(const AlSink&) = delete;
AlSink(AlSink&& other) = delete;
AlSink& operator=(AlSink&& other) = delete;
~AlSink();
~AlSink() override;

void playAudioBuffer(const int16_t* data, int samples, unsigned channels,
int sampleRate) const override;
Expand Down
4 changes: 2 additions & 2 deletions audio/src/backend/alsource.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class AlSource : public IAudioSource
AlSource& operator=(const AlSource&) = delete;
AlSource(AlSource&& other) = delete;
AlSource& operator=(AlSource&& other) = delete;
~AlSource();
~AlSource() override;

operator bool() const;
operator bool() const override;

void kill();

Expand Down
38 changes: 19 additions & 19 deletions audio/src/backend/openal.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,42 @@ class OpenAL : public IAudioControl

public:
explicit OpenAL(IAudioSettings& _settings);
virtual ~OpenAL();
~OpenAL() override;

qreal maxOutputVolume() const
qreal maxOutputVolume() const override
{
return 1;
}
qreal minOutputVolume() const
qreal minOutputVolume() const override
{
return 0;
}
void setOutputVolume(qreal volume);
void setOutputVolume(qreal volume) override;

qreal minInputGain() const;
qreal maxInputGain() const;
qreal minInputGain() const override;
qreal maxInputGain() const override;

qreal inputGain() const;
void setInputGain(qreal dB);
qreal inputGain() const override;
void setInputGain(qreal dB) override;

qreal minInputThreshold() const;
qreal maxInputThreshold() const;
qreal minInputThreshold() const override;
qreal maxInputThreshold() const override;

qreal getInputThreshold() const;
void setInputThreshold(qreal normalizedThreshold);
qreal getInputThreshold() const override;
void setInputThreshold(qreal normalizedThreshold) override;

void reinitInput(const QString& inDevDesc);
bool reinitOutput(const QString& outDevDesc);
void reinitInput(const QString& inDevDesc) override;
bool reinitOutput(const QString& outDevDesc) override;

bool isOutputReady() const;
bool isOutputReady() const override;

QStringList outDeviceNames();
QStringList inDeviceNames();
QStringList outDeviceNames() override;
QStringList inDeviceNames() override;

std::unique_ptr<IAudioSink> makeSink();
std::unique_ptr<IAudioSink> makeSink() override;
void destroySink(AlSink& sink);

std::unique_ptr<IAudioSource> makeSource();
std::unique_ptr<IAudioSource> makeSource() override;
void destroySource(AlSource& source);

void startLoop(uint sourceId);
Expand Down
2 changes: 1 addition & 1 deletion src/appmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AppManager : public QObject

public:
AppManager(int& argc, char** argv);
~AppManager();
~AppManager() override;
int run();

private:
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/chatline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <QDebug>
#include <QGraphicsScene>

ChatLine::ChatLine() {}
ChatLine::ChatLine() = default;

ChatLine::~ChatLine()
{
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/chatline.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct ColumnFormat
Right,
};

ColumnFormat() {}
ColumnFormat() = default;
ColumnFormat(qreal s, Policy p, Align hAlign_ = Left)
: size(s)
, policy(p)
Expand Down
4 changes: 2 additions & 2 deletions src/chatlog/chatlinecontent.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class ChatLineContent : public QObject, public QGraphicsItem

virtual qreal getAscent() const;

virtual QRectF boundingRect() const = 0;
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) = 0;
QRectF boundingRect() const override = 0;
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) override = 0;

virtual void visibilityChanged(bool visible);
virtual void reloadTheme();
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/chatmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ChatMessage : public ChatLine
};

ChatMessage(DocumentCache& documentCache, Settings& settings, Style& style);
~ChatMessage();
~ChatMessage() override;
ChatMessage(const ChatMessage&) = default;
ChatMessage(ChatMessage&&) = default;

Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/chatwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ChatWidget : public QGraphicsView
ChatWidget(IChatLog& chatLog_, const Core& core_, DocumentCache& documentCache,
SmileyPack& smileyPack, Settings& settings, Style& style,
IMessageBoxManager& messageBoxManager, QWidget* parent = nullptr);
virtual ~ChatWidget();
~ChatWidget() override;

void insertChatlines(std::map<ChatLogIdx, ChatLine::Ptr> chatLines);
void clearSelection();
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/content/filetransferwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FileTransferWidget : public QWidget
public:
FileTransferWidget(QWidget* parent, CoreFile& _coreFile, ToxFile file, Settings& settings,
Style& style, IMessageBoxManager& messageBoxManager);
virtual ~FileTransferWidget();
~FileTransferWidget() override;
bool isActive() const;
void onFileTransferUpdate(ToxFile file);

Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/content/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Text : public ChatLineContent
Text(DocumentCache& documentCache, Settings& settings, Style& style, const QString& txt = "",
const QFont& font = QFont(), bool enableElide = false, const QString& rawText = QString(),
const TextType& type = NORMAL);
virtual ~Text();
~Text() override;

void setText(const QString& txt);
void selectText(const QString& txt, const std::pair<int, int>& point);
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/content/timestamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Timestamp : public Text
QDateTime getTime();

protected:
QSizeF idealSize();
QSizeF idealSize() override;

private:
QDateTime time;
Expand Down
2 changes: 1 addition & 1 deletion src/chatlog/customtextdocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CustomTextDocument : public QTextDocument
CustomTextDocument(SmileyPack& smileyPack, Settings& settings, QObject* parent = nullptr);

protected:
virtual QVariant loadResource(int type, const QUrl& name);
QVariant loadResource(int type, const QUrl& name) override;

private:
QList<std::shared_ptr<QIcon>> emoticonIcons;
Expand Down
5 changes: 3 additions & 2 deletions src/chatlog/pixmapcache.h
Green-Sky marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ class PixmapCache
QPixmap get(const QString& filename, QSize size);
static PixmapCache& getInstance();

protected:
PixmapCache() {}
PixmapCache(PixmapCache&) = delete;
PixmapCache& operator=(const PixmapCache&) = delete;

protected:
PixmapCache() = default;

private:
QHash<QString, QIcon> cache;
};
4 changes: 1 addition & 3 deletions src/core/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
#include "toxpk.h"

#include "src/model/status.h"
#include "util/strongtype.h"
#include <tox/tox.h>

#include <QMutex>
#include <QObject>
#include <QThread>
#include <QTimer>

#include <functional>
#include <memory>

class CoreAV;
Expand Down Expand Up @@ -67,7 +65,7 @@ class Core : public QObject,
Tox* getTox() const;
QRecursiveMutex& getCoreLoopLock() const;

~Core();
~Core() override;

static const QString TOX_EXT;
uint64_t getMaxMessageSize() const;
Expand Down
2 changes: 1 addition & 1 deletion src/core/coreav.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CoreAV : public QObject
void setAudio(IAudioControl& newAudio);
IAudioControl* getAudio();

~CoreAV();
~CoreAV() override;

bool isCallStarted(const Friend* f) const;
bool isCallStarted(const Conference* c) const;
Expand Down
8 changes: 4 additions & 4 deletions src/core/toxcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class ToxCall : public QObject
Q_OBJECT

protected:
ToxCall() = delete;
ToxCall(bool VideoEnabled, CoreAV& av, IAudioControl& audio);
~ToxCall();
~ToxCall() override;

public:
ToxCall() = delete;
ToxCall(const ToxCall& other) = delete;
ToxCall(ToxCall&& other) = delete;

Expand Down Expand Up @@ -82,7 +82,7 @@ class ToxFriendCall : public ToxCall
CameraSource& cameraSource);
ToxFriendCall(ToxFriendCall&& other) = delete;
ToxFriendCall& operator=(ToxFriendCall&& other) = delete;
~ToxFriendCall();
~ToxFriendCall() override;

TOXAV_FRIEND_CALL_STATE getState() const;
void setState(const TOXAV_FRIEND_CALL_STATE& value);
Expand All @@ -109,7 +109,7 @@ class ToxConferenceCall : public ToxCall
ToxConferenceCall() = delete;
ToxConferenceCall(const Conference& conference_, CoreAV& av_, IAudioControl& audio_);
ToxConferenceCall(ToxConferenceCall&& other) = delete;
~ToxConferenceCall();
~ToxConferenceCall() override;

ToxConferenceCall& operator=(ToxConferenceCall&& other) = delete;
void removePeer(ToxPk peerId);
Expand Down
2 changes: 1 addition & 1 deletion src/ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class IPC : public QObject

public:
explicit IPC(uint32_t profileId_);
~IPC();
~IPC() override;

struct IPCEvent
{
Expand Down
2 changes: 1 addition & 1 deletion src/model/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
#include "chat.h"
#include <QVariant>

Chat::~Chat() {}
Chat::~Chat() = default;
2 changes: 1 addition & 1 deletion src/model/chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Chat : public QObject
{
Q_OBJECT
public:
virtual ~Chat() = 0;
~Chat() override;

virtual void setName(const QString& name) = 0;
virtual QString getDisplayedName() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/model/debug/debugobjecttreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ DebugObjectTreeModel::DebugObjectTreeModel(QObject* parent)
reload();
}

DebugObjectTreeModel::~DebugObjectTreeModel() {}
DebugObjectTreeModel::~DebugObjectTreeModel() = default;

void DebugObjectTreeModel::reload()
{
Expand Down
2 changes: 1 addition & 1 deletion src/model/ichatlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class IChatLog : public QObject
{
Q_OBJECT
public:
virtual ~IChatLog() = default;
~IChatLog() override = default;

/**
* @brief Returns reference to item at idx
Expand Down
2 changes: 1 addition & 1 deletion src/model/imessagedispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class IMessageDispatcher : public QObject
{
Q_OBJECT
public:
virtual ~IMessageDispatcher();
~IMessageDispatcher() override;

/**
* @brief Sends message to associated chat
Expand Down
2 changes: 1 addition & 1 deletion src/model/notificationgenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class NotificationGenerator : public QObject
// currently mockable so we allow profile to be nullptr for unit
// testing
Profile* profile_);
virtual ~NotificationGenerator();
~NotificationGenerator() override;
NotificationGenerator(const NotificationGenerator&) = delete;
NotificationGenerator& operator=(const NotificationGenerator&) = delete;
NotificationGenerator(NotificationGenerator&&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion src/model/sessionchatlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SessionChatLog : public IChatLog
SessionChatLog(ChatLogIdx initialIdx, const ICoreIdHandler& coreIdHandler_,
FriendList& friendList, ConferenceList& conferenceList);

~SessionChatLog();
~SessionChatLog() override;
const ChatLogItem& at(ChatLogIdx idx) const override;
SearchResult searchForward(SearchPos startPos, const QString& phrase,
const ParameterSearch& parameter) const override;
Expand Down
2 changes: 1 addition & 1 deletion src/nexus.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Nexus : public QObject
public:
Nexus(Settings& settings, IMessageBoxManager& messageBoxManager, CameraSource& cameraSource,
IPC& ipc, QObject* parent = nullptr);
~Nexus();
~Nexus() override;
void start();
void showMainGUI();
void setParser(QCommandLineParser* parser_);
Expand Down
2 changes: 1 addition & 1 deletion src/persistence/db/rawdatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class RawDatabase : QObject
};

RawDatabase(const QString& path_, const QString& password, const QByteArray& salt);
~RawDatabase();
~RawDatabase() override;
bool isOpen();

bool execNow(const QString& statement);
Expand Down
2 changes: 1 addition & 1 deletion src/persistence/db/upgrades/dbupgrader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct DuplicateAlias
, badAliasRows{badAliasRows_}
{
}
DuplicateAlias() {}
DuplicateAlias() = default;
RowId goodAliasRow{-1};
std::vector<RowId> badAliasRows;
};
Expand Down
Loading
Loading