1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: Comply with Wunused-parameter

Explicitly ignore unused parameters.

Also replace Q_UNUSED with std::ignore for consistency and to favour std
over Qt when equivalent.
This commit is contained in:
Anthony Bilinski 2022-03-10 23:53:13 -08:00
parent 288f44ba5a
commit 48ad6cc17a
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
36 changed files with 108 additions and 52 deletions

View File

@ -71,7 +71,7 @@ QString ChatLineContent::getSelectedText() const
void ChatLineContent::fontChanged(const QFont& font) void ChatLineContent::fontChanged(const QFont& font)
{ {
Q_UNUSED(font) std::ignore = font;
} }
qreal ChatLineContent::getAscent() const qreal ChatLineContent::getAscent() const

View File

@ -1304,6 +1304,7 @@ void ChatWidget::showEvent(QShowEvent*)
void ChatWidget::hideEvent(QHideEvent* event) void ChatWidget::hideEvent(QHideEvent* event)
{ {
std::ignore = event;
// Purge accumulated lines from the chatlog. We do not purge messages while // Purge accumulated lines from the chatlog. We do not purge messages while
// the chatlog is open because it causes flickers. When a user leaves the // the chatlog is open because it causes flickers. When a user leaves the
// chat we take the opportunity to remove old messages. If a user only has // chat we take the opportunity to remove old messages. If a user only has

View File

@ -40,14 +40,14 @@ void Broken::paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
painter->setRenderHint(QPainter::SmoothPixmapTransform); painter->setRenderHint(QPainter::SmoothPixmapTransform);
painter->drawPixmap(0, 0, pmap); painter->drawPixmap(0, 0, pmap);
Q_UNUSED(option) std::ignore = option;
Q_UNUSED(widget) std::ignore = widget;
} }
void Broken::setWidth(qreal width) void Broken::setWidth(qreal width)
{ {
Q_UNUSED(width) std::ignore = width;
} }
qreal Broken::getAscent() const qreal Broken::getAscent() const

View File

@ -46,11 +46,11 @@ void Image::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWi
painter->translate(-size.width() / 2.0, -size.height() / 2.0); painter->translate(-size.width() / 2.0, -size.height() / 2.0);
painter->drawPixmap(0, 0, pmap); painter->drawPixmap(0, 0, pmap);
Q_UNUSED(option) std::ignore = option;
Q_UNUSED(widget) std::ignore = widget;
} }
void Image::setWidth(qreal width) void Image::setWidth(qreal width)
{ {
Q_UNUSED(width) std::ignore = width;
} }

View File

@ -57,13 +57,13 @@ void NotificationIcon::paint(QPainter* painter, const QStyleOptionGraphicsItem*
updateTimer.start(); updateTimer.start();
} }
Q_UNUSED(option) std::ignore = option;
Q_UNUSED(widget) std::ignore = widget;
} }
void NotificationIcon::setWidth(qreal width) void NotificationIcon::setWidth(qreal width)
{ {
Q_UNUSED(width) std::ignore = width;
} }
qreal NotificationIcon::getAscent() const qreal NotificationIcon::getAscent() const

View File

@ -71,13 +71,13 @@ void Spinner::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, Q
timer.start(); // update bounding rectangle for next frame timer.start(); // update bounding rectangle for next frame
} }
Q_UNUSED(option) std::ignore = option;
Q_UNUSED(widget) std::ignore = widget;
} }
void Spinner::setWidth(qreal width) void Spinner::setWidth(qreal width)
{ {
Q_UNUSED(width) std::ignore = width;
} }
qreal Spinner::getAscent() const qreal Spinner::getAscent() const

View File

@ -210,8 +210,8 @@ QRectF Text::boundingRect() const
void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) void Text::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{ {
Q_UNUSED(option) std::ignore = option;
Q_UNUSED(widget) std::ignore = widget;
if (!doc) if (!doc)
return; return;

View File

@ -955,6 +955,7 @@ void Core::onConnectionStatusChanged(Tox*, uint32_t friendId, Tox_Connection sta
void Core::onGroupInvite(Tox* tox, uint32_t friendId, Tox_Conference_Type type, void Core::onGroupInvite(Tox* tox, uint32_t friendId, Tox_Conference_Type type,
const uint8_t* cookie, size_t length, void* vCore) const uint8_t* cookie, size_t length, void* vCore)
{ {
std::ignore = tox;
Core* core = static_cast<Core*>(vCore); Core* core = static_cast<Core*>(vCore);
const QByteArray data(reinterpret_cast<const char*>(cookie), length); const QByteArray data(reinterpret_cast<const char*>(cookie), length);
const GroupInvite inviteInfo(friendId, type, data); const GroupInvite inviteInfo(friendId, type, data);

View File

@ -475,7 +475,7 @@ void CoreAV::groupCallCallback(void* tox, uint32_t group, uint32_t peer, const i
* See https://github.com/TokTok/c-toxcore/issues/1364 for details. * See https://github.com/TokTok/c-toxcore/issues/1364 for details.
*/ */
Q_UNUSED(tox) std::ignore = tox;
Core* c = static_cast<Core*>(core); Core* c = static_cast<Core*>(core);
CoreAV* cav = c->getAv(); CoreAV* cav = c->getAv();
@ -751,7 +751,7 @@ void CoreAV::callCallback(ToxAV* toxav, uint32_t friendNum, bool audio, bool vid
void CoreAV::stateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t state, void* vSelf) void CoreAV::stateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t state, void* vSelf)
{ {
Q_UNUSED(toxav) std::ignore = toxav;
CoreAV* self = static_cast<CoreAV*>(vSelf); CoreAV* self = static_cast<CoreAV*>(vSelf);
// we must unlock this lock before emitting any signals // we must unlock this lock before emitting any signals
@ -812,8 +812,8 @@ void CoreAV::bitrateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t arate, u
void* vSelf) void* vSelf)
{ {
CoreAV* self = static_cast<CoreAV*>(vSelf); CoreAV* self = static_cast<CoreAV*>(vSelf);
Q_UNUSED(self) std::ignore = self;
Q_UNUSED(toxav) std::ignore = toxav;
qDebug() << "Recommended bitrate with" << friendNum << " is now " << arate << "/" << vrate qDebug() << "Recommended bitrate with" << friendNum << " is now " << arate << "/" << vrate
<< ", ignoring it"; << ", ignoring it";
@ -823,8 +823,8 @@ void CoreAV::bitrateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t arate, u
void CoreAV::audioBitrateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t rate, void* vSelf) void CoreAV::audioBitrateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t rate, void* vSelf)
{ {
CoreAV* self = static_cast<CoreAV*>(vSelf); CoreAV* self = static_cast<CoreAV*>(vSelf);
Q_UNUSED(self) std::ignore = self;
Q_UNUSED(toxav) std::ignore = toxav;
qDebug() << "Recommended audio bitrate with" << friendNum << " is now " << rate << ", ignoring it"; qDebug() << "Recommended audio bitrate with" << friendNum << " is now " << rate << ", ignoring it";
} }
@ -833,8 +833,8 @@ void CoreAV::audioBitrateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t rat
void CoreAV::videoBitrateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t rate, void* vSelf) void CoreAV::videoBitrateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t rate, void* vSelf)
{ {
CoreAV* self = static_cast<CoreAV*>(vSelf); CoreAV* self = static_cast<CoreAV*>(vSelf);
Q_UNUSED(self) std::ignore = self;
Q_UNUSED(toxav) std::ignore = toxav;
qDebug() << "Recommended video bitrate with" << friendNum << " is now " << rate << ", ignoring it"; qDebug() << "Recommended video bitrate with" << friendNum << " is now " << rate << ", ignoring it";
} }

View File

@ -47,6 +47,8 @@ QByteArray cleanPath(const char *file)
void onLogMessage(Tox *tox, Tox_Log_Level level, const char *file, uint32_t line, void onLogMessage(Tox *tox, Tox_Log_Level level, const char *file, uint32_t line,
const char *func, const char *message, void *user_data) const char *func, const char *message, void *user_data)
{ {
std::ignore = tox;
std::ignore = user_data;
const QByteArray cleanedPath = cleanPath(file); const QByteArray cleanedPath = cleanPath(file);
switch (level) { switch (level) {

View File

@ -29,16 +29,20 @@ AboutFriend::AboutFriend(const Friend* f_, IFriendSettings* const settings_)
, settings{settings_} , settings{settings_}
{ {
settings->connectTo_contactNoteChanged(this, [=](const ToxPk& pk, const QString& note) { settings->connectTo_contactNoteChanged(this, [=](const ToxPk& pk, const QString& note) {
std::ignore = pk;
emit noteChanged(note); emit noteChanged(note);
}); });
settings->connectTo_autoAcceptCallChanged(this, settings->connectTo_autoAcceptCallChanged(this,
[=](const ToxPk& pk, IFriendSettings::AutoAcceptCallFlags flag) { [=](const ToxPk& pk, IFriendSettings::AutoAcceptCallFlags flag) {
std::ignore = pk;
emit autoAcceptCallChanged(flag); emit autoAcceptCallChanged(flag);
}); });
settings->connectTo_autoAcceptDirChanged(this, [=](const ToxPk& pk, const QString& dir) { settings->connectTo_autoAcceptDirChanged(this, [=](const ToxPk& pk, const QString& dir) {
std::ignore = pk;
emit autoAcceptDirChanged(dir); emit autoAcceptDirChanged(dir);
}); });
settings->connectTo_autoGroupInviteChanged(this, [=](const ToxPk& pk, bool enable) { settings->connectTo_autoGroupInviteChanged(this, [=](const ToxPk& pk, bool enable) {
std::ignore = pk;
emit autoGroupInviteChanged(enable); emit autoGroupInviteChanged(enable);
}); });
} }

View File

@ -68,6 +68,7 @@ GroupMessageDispatcher::sendMessage(bool isAction, QString const& content)
std::pair<DispatchedMessageId, DispatchedMessageId> std::pair<DispatchedMessageId, DispatchedMessageId>
GroupMessageDispatcher::sendExtendedMessage(const QString& content, ExtensionSet extensions) GroupMessageDispatcher::sendExtendedMessage(const QString& content, ExtensionSet extensions)
{ {
std::ignore = extensions;
// Stub this api to immediately fail // Stub this api to immediately fail
auto messageId = nextMessageId++; auto messageId = nextMessageId++;
auto messages = processor.processOutgoingMessage(false, content, ExtensionSet()); auto messages = processor.processOutgoingMessage(false, content, ExtensionSet());

View File

@ -933,6 +933,7 @@ void RawDatabase::regexpSensitive(sqlite3_context* ctx, int argc, sqlite3_value*
void RawDatabase::regexp(sqlite3_context* ctx, int argc, sqlite3_value** argv, const QRegularExpression::PatternOptions cs) void RawDatabase::regexp(sqlite3_context* ctx, int argc, sqlite3_value** argv, const QRegularExpression::PatternOptions cs)
{ {
std::ignore = argc;
QRegularExpression regex; QRegularExpression regex;
const QString str1(reinterpret_cast<const char*>(sqlite3_value_text(argv[0]))); const QString str1(reinterpret_cast<const char*>(sqlite3_value_text(argv[0])));
const QString str2(reinterpret_cast<const char*>(sqlite3_value_text(argv[1]))); const QString str2(reinterpret_cast<const char*>(sqlite3_value_text(argv[1])));

View File

@ -958,7 +958,7 @@ void Settings::setAutorun(bool newValue)
emit autorunChanged(autorun); emit autorunChanged(autorun);
} }
#else #else
Q_UNUSED(newValue) std::ignore = newValue;
#endif #endif
} }
@ -1970,7 +1970,7 @@ void Settings::setFriendActivity(const ToxPk& id, const QDateTime& activity)
void Settings::saveFriendSettings(const ToxPk& id) void Settings::saveFriendSettings(const ToxPk& id)
{ {
Q_UNUSED(id) std::ignore = id;
savePersonal(); savePersonal();
} }

View File

@ -232,7 +232,7 @@ CameraDevice* CameraDevice::open(QString devName, VideoMode mode)
#endif #endif
else if (mode) { else if (mode) {
qWarning().nospace() << "No known options for " << iformat->name << ", using defaults."; qWarning().nospace() << "No known options for " << iformat->name << ", using defaults.";
Q_UNUSED(mode) std::ignore = mode;
} }
CameraDevice* dev = open(devName, &options); CameraDevice* dev = open(devName, &options);
@ -450,7 +450,7 @@ QVector<VideoMode> CameraDevice::getScreenModes()
*/ */
QVector<VideoMode> CameraDevice::getVideoModes(QString devName) QVector<VideoMode> CameraDevice::getVideoModes(QString devName)
{ {
Q_UNUSED(devName) std::ignore = devName;
if (!iformat) if (!iformat)
; ;
@ -484,6 +484,7 @@ QString CameraDevice::getPixelFormatString(uint32_t pixel_format)
#if USING_V4L #if USING_V4L
return v4l2::getPixelFormatString(pixel_format); return v4l2::getPixelFormatString(pixel_format);
#else #else
std::ignore = pixel_format;
return QString("unknown"); return QString("unknown");
#endif #endif
} }
@ -500,6 +501,8 @@ bool CameraDevice::betterPixelFormat(uint32_t a, uint32_t b)
#if USING_V4L #if USING_V4L
return v4l2::betterPixelFormat(a, b); return v4l2::betterPixelFormat(a, b);
#else #else
std::ignore = a;
std::ignore = b;
return false; return false;
#endif #endif
} }

View File

@ -197,7 +197,7 @@ void NetCamView::setTitle(const QString& title)
void NetCamView::showEvent(QShowEvent* event) void NetCamView::showEvent(QShowEvent* event)
{ {
Q_UNUSED(event) std::ignore = event;
selfFrame->resetBoundary(videoSurface->getBoundingRect()); selfFrame->resetBoundary(videoSurface->getBoundingRect());
} }

View File

@ -201,7 +201,7 @@ void VideoSurface::resizeEvent(QResizeEvent* event)
void VideoSurface::showEvent(QShowEvent* e) void VideoSurface::showEvent(QShowEvent* e)
{ {
Q_UNUSED(e) std::ignore = e;
// emit ratioChanged(); // emit ratioChanged();
} }

View File

@ -251,7 +251,7 @@ void CategoryWidget::onCompactChanged(bool _compact)
topLayout->setSpacing(0); topLayout->setSpacing(0);
topLayout->setMargin(0); topLayout->setMargin(0);
Q_UNUSED(_compact) std::ignore = _compact;
setCompact(true); setCompact(true);
nameLabel->minimizeMaximumWidth(); nameLabel->minimizeMaximumWidth();

View File

@ -642,6 +642,7 @@ void ContentDialog::setStatusMessage(const ToxPk& friendPk, const QString& messa
*/ */
void ContentDialog::updateFriendWidget(const ToxPk& friendPk, QString alias) void ContentDialog::updateFriendWidget(const ToxPk& friendPk, QString alias)
{ {
std::ignore = alias;
Friend* f = FriendList::findFriend(friendPk); Friend* f = FriendList::findFriend(friendPk);
FriendWidget* friendWidget = qobject_cast<FriendWidget*>(contactWidgets[friendPk]); FriendWidget* friendWidget = qobject_cast<FriendWidget*>(contactWidgets[friendPk]);

View File

@ -192,6 +192,6 @@ void EmoticonsWidget::PageButtonsUpdate()
void EmoticonsWidget::keyPressEvent(QKeyEvent* e) void EmoticonsWidget::keyPressEvent(QKeyEvent* e)
{ {
Q_UNUSED(e) std::ignore = e;
hide(); hide();
} }

View File

@ -456,6 +456,7 @@ void ChatForm::onFriendStatusChanged(const ToxPk& friendPk, Status::Status statu
{ {
// Disable call buttons if friend is offline // Disable call buttons if friend is offline
assert(friendPk == f->getPublicKey()); assert(friendPk == f->getPublicKey());
std::ignore = friendPk;
if (!Status::isOnline(f->getStatus())) { if (!Status::isOnline(f->getStatus())) {
// Hide the "is typing" message when a friend goes offline // Hide the "is typing" message when a friend goes offline

View File

@ -234,11 +234,13 @@ namespace FileTransferList
int Model::rowCount(const QModelIndex& parent) const int Model::rowCount(const QModelIndex& parent) const
{ {
std::ignore = parent;
return files.size(); return files.size();
} }
int Model::columnCount(const QModelIndex& parent) const int Model::columnCount(const QModelIndex& parent) const
{ {
std::ignore = parent;
return static_cast<int>(Column::invalid); return static_cast<int>(Column::invalid);
} }
@ -293,6 +295,7 @@ namespace FileTransferList
bool Model::setData(const QModelIndex &index, const QVariant &value, int role) bool Model::setData(const QModelIndex &index, const QVariant &value, int role)
{ {
std::ignore = role;
const auto column = toFileTransferListColumn(index.column()); const auto column = toFileTransferListColumn(index.column());
if (column != Column::control) { if (column != Column::control) {

View File

@ -238,6 +238,7 @@ void GroupChatForm::updateUserNames()
void GroupChatForm::onUserJoined(const ToxPk& user, const QString& name) void GroupChatForm::onUserJoined(const ToxPk& user, const QString& name)
{ {
std::ignore = user;
if (settings.getShowGroupJoinLeaveMessages()) { if (settings.getShowGroupJoinLeaveMessages()) {
addSystemInfoMessage(QDateTime::currentDateTime(), SystemMessageType::userJoinedGroup, {name}); addSystemInfoMessage(QDateTime::currentDateTime(), SystemMessageType::userJoinedGroup, {name});
} }
@ -246,6 +247,7 @@ void GroupChatForm::onUserJoined(const ToxPk& user, const QString& name)
void GroupChatForm::onUserLeft(const ToxPk& user, const QString& name) void GroupChatForm::onUserLeft(const ToxPk& user, const QString& name)
{ {
std::ignore = user;
if (settings.getShowGroupJoinLeaveMessages()) { if (settings.getShowGroupJoinLeaveMessages()) {
addSystemInfoMessage(QDateTime::currentDateTime(), SystemMessageType::userLeftGroup, {name}); addSystemInfoMessage(QDateTime::currentDateTime(), SystemMessageType::userLeftGroup, {name});
} }
@ -254,6 +256,7 @@ void GroupChatForm::onUserLeft(const ToxPk& user, const QString& name)
void GroupChatForm::onPeerNameChanged(const ToxPk& peer, const QString& oldName, const QString& newName) void GroupChatForm::onPeerNameChanged(const ToxPk& peer, const QString& oldName, const QString& newName)
{ {
std::ignore = peer;
addSystemInfoMessage(QDateTime::currentDateTime(), SystemMessageType::peerNameChanged, addSystemInfoMessage(QDateTime::currentDateTime(), SystemMessageType::peerNameChanged,
{oldName, newName}); {oldName, newName});
updateUserNames(); updateUserNames();

View File

@ -141,7 +141,7 @@ void SearchSettingsForm::onStartSearchSelected(const int index)
void SearchSettingsForm::onRegisterClicked(const bool checked) void SearchSettingsForm::onRegisterClicked(const bool checked)
{ {
Q_UNUSED(checked) std::ignore = checked;
setUpdate(true); setUpdate(true);
} }

View File

@ -174,6 +174,7 @@ void AboutForm::replaceVersions()
void AboutForm::onUpdateAvailable(QString latestVersion, QUrl link) void AboutForm::onUpdateAvailable(QString latestVersion, QUrl link)
{ {
std::ignore = latestVersion;
QObject::disconnect(linkConnection); QObject::disconnect(linkConnection);
linkConnection = connect(bodyUI->updateAvailableButton, &QPushButton::clicked, linkConnection = connect(bodyUI->updateAvailableButton, &QPushButton::clicked,
[link]() { QDesktopServices::openUrl(link); }); [link]() { QDesktopServices::openUrl(link); });

View File

@ -462,6 +462,7 @@ void AVForm::on_videoDevCombobox_currentIndexChanged(int index)
void AVForm::on_audioQualityComboBox_currentIndexChanged(int index) void AVForm::on_audioQualityComboBox_currentIndexChanged(int index)
{ {
std::ignore = index;
audioSettings->setAudioBitrate(audioQualityComboBox->currentData().toInt()); audioSettings->setAudioBitrate(audioQualityComboBox->currentData().toInt());
} }

View File

@ -349,7 +349,7 @@ void FriendListWidget::addGroupWidget(GroupWidget* widget)
{ {
Group* g = widget->getGroup(); Group* g = widget->getGroup();
connect(g, &Group::titleChanged, [=](const QString& author, const QString& name) { connect(g, &Group::titleChanged, [=](const QString& author, const QString& name) {
Q_UNUSED(author) std::ignore = author;
renameGroupWidget(widget, name); renameGroupWidget(widget, name);
}); });
@ -414,6 +414,8 @@ void FriendListWidget::searchChatrooms(const QString& searchString, bool hideOnl
void FriendListWidget::renameGroupWidget(GroupWidget* groupWidget, const QString& newName) void FriendListWidget::renameGroupWidget(GroupWidget* groupWidget, const QString& newName)
{ {
std::ignore = groupWidget;
std::ignore = newName;
itemsChanged(); itemsChanged();
} }

View File

@ -69,7 +69,7 @@ GroupWidget::~GroupWidget()
void GroupWidget::updateTitle(const QString& author, const QString& newName) void GroupWidget::updateTitle(const QString& author, const QString& newName)
{ {
Q_UNUSED(author) std::ignore = author;
nameLabel->setText(newName); nameLabel->setText(newName);
} }

View File

@ -91,6 +91,7 @@ void ChatTextEdit::sendKeyEvent(QKeyEvent* event)
bool ChatTextEdit::pasteIfImage(QKeyEvent* event) bool ChatTextEdit::pasteIfImage(QKeyEvent* event)
{ {
std::ignore = event;
const QClipboard* const clipboard = QApplication::clipboard(); const QClipboard* const clipboard = QApplication::clipboard();
if (!clipboard) { if (!clipboard) {
return false; return false;

View File

@ -177,14 +177,14 @@ void ScreenGrabberChooserRectItem::mouseRelease(QGraphicsSceneMouseEvent* event)
void ScreenGrabberChooserRectItem::mouseDoubleClick(QGraphicsSceneMouseEvent* event) void ScreenGrabberChooserRectItem::mouseDoubleClick(QGraphicsSceneMouseEvent* event)
{ {
Q_UNUSED(event) std::ignore = event;
emit doubleClicked(); emit doubleClicked();
} }
void ScreenGrabberChooserRectItem::mousePressHandle(int x, int y, QGraphicsSceneMouseEvent* event) void ScreenGrabberChooserRectItem::mousePressHandle(int x, int y, QGraphicsSceneMouseEvent* event)
{ {
Q_UNUSED(x) std::ignore = x;
Q_UNUSED(y) std::ignore = y;
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
state = HandleResizing; state = HandleResizing;
@ -223,8 +223,8 @@ void ScreenGrabberChooserRectItem::mouseMoveHandle(int x, int y, QGraphicsSceneM
void ScreenGrabberChooserRectItem::mouseReleaseHandle(int x, int y, QGraphicsSceneMouseEvent* event) void ScreenGrabberChooserRectItem::mouseReleaseHandle(int x, int y, QGraphicsSceneMouseEvent* event)
{ {
Q_UNUSED(x) std::ignore = x;
Q_UNUSED(y) std::ignore = y;
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
state = None; state = None;

View File

@ -1204,6 +1204,7 @@ void Widget::addFriend(uint32_t friendId, const ToxPk& friendPk)
auto notifyReceivedCallback = [this, friendPk](const ToxPk& author, const Message& message) { auto notifyReceivedCallback = [this, friendPk](const ToxPk& author, const Message& message) {
std::ignore = author;
newFriendMessageAlert(friendPk, message.content); newFriendMessageAlert(friendPk, message.content);
}; };
@ -1498,11 +1499,11 @@ void Widget::addFriendDialog(const Friend* frnd, ContentDialog* dialog)
[=](QContextMenuEvent* event) { emit widget->contextMenuCalled(event); }); [=](QContextMenuEvent* event) { emit widget->contextMenuCalled(event); });
connect(friendWidget, &FriendWidget::chatroomWidgetClicked, [=](GenericChatroomWidget* w) { connect(friendWidget, &FriendWidget::chatroomWidgetClicked, [=](GenericChatroomWidget* w) {
Q_UNUSED(w) std::ignore = w;
emit widget->chatroomWidgetClicked(widget); emit widget->chatroomWidgetClicked(widget);
}); });
connect(friendWidget, &FriendWidget::newWindowOpened, [=](GenericChatroomWidget* w) { connect(friendWidget, &FriendWidget::newWindowOpened, [=](GenericChatroomWidget* w) {
Q_UNUSED(w) std::ignore = w;
emit widget->newWindowOpened(widget); emit widget->newWindowOpened(widget);
}); });
// FIXME: emit should be removed // FIXME: emit should be removed
@ -1549,12 +1550,12 @@ void Widget::addGroupDialog(const Group* group, ContentDialog* dialog)
// ContentDialog) to the `widget` (which shown in main widget) // ContentDialog) to the `widget` (which shown in main widget)
// FIXME: emit should be removed // FIXME: emit should be removed
connect(groupWidget, &GroupWidget::chatroomWidgetClicked, [=](GenericChatroomWidget* w) { connect(groupWidget, &GroupWidget::chatroomWidgetClicked, [=](GenericChatroomWidget* w) {
Q_UNUSED(w) std::ignore = w;
emit widget->chatroomWidgetClicked(widget); emit widget->chatroomWidgetClicked(widget);
}); });
connect(groupWidget, &GroupWidget::newWindowOpened, [=](GenericChatroomWidget* w) { connect(groupWidget, &GroupWidget::newWindowOpened, [=](GenericChatroomWidget* w) {
Q_UNUSED(w) std::ignore = w;
emit widget->newWindowOpened(widget); emit widget->newWindowOpened(widget);
}); });
@ -1602,6 +1603,10 @@ bool Widget::newFriendMessageAlert(const ToxPk& friendId, const QString& text, b
auto notificationData = filename.isEmpty() ? notificationGenerator->friendMessageNotification(f, text) auto notificationData = filename.isEmpty() ? notificationGenerator->friendMessageNotification(f, text)
: notificationGenerator->fileTransferNotification(f, filename, filesize); : notificationGenerator->fileTransferNotification(f, filename, filesize);
notifier.notifyMessage(notificationData); notifier.notifyMessage(notificationData);
#else
std::ignore = text;
std::ignore = filename;
std::ignore = filesize;
#endif #endif
if (contentDialog == nullptr) { if (contentDialog == nullptr) {
@ -1644,6 +1649,9 @@ bool Widget::newGroupMessageAlert(const GroupId& groupId, const ToxPk& authorPk,
#if DESKTOP_NOTIFICATIONS #if DESKTOP_NOTIFICATIONS
auto notificationData = notificationGenerator->groupMessageNotification(g, authorPk, message); auto notificationData = notificationGenerator->groupMessageNotification(g, authorPk, message);
notifier.notifyMessage(notificationData); notifier.notifyMessage(notificationData);
#else
std::ignore = authorPk;
std::ignore = message;
#endif #endif
if (contentDialog == nullptr) { if (contentDialog == nullptr) {
@ -2399,8 +2407,8 @@ void Widget::saveSplitterGeometry()
void Widget::onSplitterMoved(int pos, int index) void Widget::onSplitterMoved(int pos, int index)
{ {
Q_UNUSED(pos) std::ignore = pos;
Q_UNUSED(index) std::ignore = index;
saveSplitterGeometry(); saveSplitterGeometry();
} }
@ -2502,6 +2510,9 @@ inline QIcon Widget::prepareIcon(QString path, int w, int h)
return QIcon(pm); return QIcon(pm);
} }
} }
#else
std::ignore = w;
std::ignore = h;
#endif #endif
return QIcon(path); return QIcon(path);
} }

View File

@ -38,11 +38,13 @@ public:
GroupId getGroupPersistentId(uint32_t groupNumber) const override GroupId getGroupPersistentId(uint32_t groupNumber) const override
{ {
std::ignore = groupNumber;
return GroupId(0); return GroupId(0);
} }
uint32_t getGroupNumberPeers(int groupId) const override uint32_t getGroupNumberPeers(int groupId) const override
{ {
std::ignore = groupId;
if (emptyGroup) { if (emptyGroup) {
return 1; return 1;
} }
@ -52,17 +54,20 @@ public:
QString getGroupPeerName(int groupId, int peerId) const override QString getGroupPeerName(int groupId, int peerId) const override
{ {
std::ignore = groupId;
return QString("peer") + peerId; return QString("peer") + peerId;
} }
ToxPk getGroupPeerPk(int groupId, int peerId) const override ToxPk getGroupPeerPk(int groupId, int peerId) const override
{ {
std::ignore = groupId;
uint8_t id[TOX_PUBLIC_KEY_SIZE] = {static_cast<uint8_t>(peerId)}; uint8_t id[TOX_PUBLIC_KEY_SIZE] = {static_cast<uint8_t>(peerId)};
return ToxPk(id); return ToxPk(id);
} }
QStringList getGroupPeerNames(int groupId) const override QStringList getGroupPeerNames(int groupId) const override
{ {
std::ignore = groupId;
if (emptyGroup) { if (emptyGroup) {
return QStringList({QString("me")}); return QStringList({QString("me")});
} }
@ -71,6 +76,7 @@ public:
bool getGroupAvEnabled(int groupId) const override bool getGroupAvEnabled(int groupId) const override
{ {
std::ignore = groupId;
return false; return false;
} }

View File

@ -73,6 +73,7 @@ public:
std::unique_ptr<ICoreExtPacket> MockCoreExtPacketAllocator::getPacket(uint32_t friendId) std::unique_ptr<ICoreExtPacket> MockCoreExtPacketAllocator::getPacket(uint32_t friendId)
{ {
std::ignore = friendId;
return std::unique_ptr<MockCoreExtPacket>(new MockCoreExtPacket(numSentMessages, currentReceiptId)); return std::unique_ptr<MockCoreExtPacket>(new MockCoreExtPacket(numSentMessages, currentReceiptId));
} }
@ -91,6 +92,8 @@ public:
bool MockFriendMessageSender::sendAction(uint32_t friendId, const QString& action, ReceiptNum& receipt) bool MockFriendMessageSender::sendAction(uint32_t friendId, const QString& action, ReceiptNum& receipt)
{ {
std::ignore = friendId;
std::ignore = action;
if (canSend) { if (canSend) {
numSentActions++; numSentActions++;
receipt = receiptNum; receipt = receiptNum;
@ -101,6 +104,8 @@ bool MockFriendMessageSender::sendAction(uint32_t friendId, const QString& actio
bool MockFriendMessageSender::sendMessage(uint32_t friendId, const QString& message, ReceiptNum& receipt) bool MockFriendMessageSender::sendMessage(uint32_t friendId, const QString& message, ReceiptNum& receipt)
{ {
std::ignore = friendId;
std::ignore = message;
if (canSend) { if (canSend) {
numSentMessages++; numSentMessages++;
receipt = receiptNum; receipt = receiptNum;
@ -144,6 +149,7 @@ private slots:
void onMessageReceived(const ToxPk& sender, Message message) void onMessageReceived(const ToxPk& sender, Message message)
{ {
std::ignore = sender;
receivedMessages.push_back(std::move(message)); receivedMessages.push_back(std::move(message));
} }

View File

@ -48,11 +48,15 @@ public:
void MockGroupMessageSender::sendGroupAction(int groupId, const QString& action) void MockGroupMessageSender::sendGroupAction(int groupId, const QString& action)
{ {
std::ignore = groupId;
std::ignore = action;
numSentActions++; numSentActions++;
} }
void MockGroupMessageSender::sendGroupMessage(int groupId, const QString& message) void MockGroupMessageSender::sendGroupMessage(int groupId, const QString& message)
{ {
std::ignore = groupId;
std::ignore = message;
numSentMessages++; numSentMessages++;
} }
@ -66,7 +70,7 @@ public:
SIGNAL_IMPL(MockGroupSettings, blackListChanged, QStringList const& blist) SIGNAL_IMPL(MockGroupSettings, blackListChanged, QStringList const& blist)
bool getShowGroupJoinLeaveMessages() const override { return true; }; bool getShowGroupJoinLeaveMessages() const override { return true; };
void setShowGroupJoinLeaveMessages(bool newValue) override {}; void setShowGroupJoinLeaveMessages(bool newValue) override { std::ignore = newValue; };
SIGNAL_IMPL(MockGroupSettings, showGroupJoinLeaveMessagesChanged, bool show) SIGNAL_IMPL(MockGroupSettings, showGroupJoinLeaveMessagesChanged, bool show)
private: private:
@ -115,6 +119,7 @@ private slots:
void onMessageReceived(const ToxPk& sender, Message message) void onMessageReceived(const ToxPk& sender, Message message)
{ {
std::ignore = sender;
receivedMessages.push_back(std::move(message)); receivedMessages.push_back(std::move(message));
} }

View File

@ -32,25 +32,25 @@ namespace
{ {
virtual bool getNotify() const override { return true; } virtual bool getNotify() const override { return true; }
virtual void setNotify(bool newValue) override {} virtual void setNotify(bool newValue) override { std::ignore = newValue; }
virtual bool getShowWindow() const override { return true; } virtual bool getShowWindow() const override { return true; }
virtual void setShowWindow(bool newValue) override {} virtual void setShowWindow(bool newValue) override { std::ignore = newValue; }
virtual bool getDesktopNotify() const override { return true; } virtual bool getDesktopNotify() const override { return true; }
virtual void setDesktopNotify(bool enabled) override {} virtual void setDesktopNotify(bool enabled) override { std::ignore = enabled; }
virtual bool getNotifySound() const override { return true; } virtual bool getNotifySound() const override { return true; }
virtual void setNotifySound(bool newValue) override {} virtual void setNotifySound(bool newValue) override { std::ignore = newValue; }
virtual bool getNotifyHide() const override { return notifyHide; } virtual bool getNotifyHide() const override { return notifyHide; }
virtual void setNotifyHide(bool newValue) override { notifyHide = newValue; }; virtual void setNotifyHide(bool newValue) override { notifyHide = newValue; };
virtual bool getBusySound() const override { return true; } virtual bool getBusySound() const override { return true; }
virtual void setBusySound(bool newValue) override {} virtual void setBusySound(bool newValue) override { std::ignore = newValue; }
virtual bool getGroupAlwaysNotify() const override { return true; } virtual bool getGroupAlwaysNotify() const override { return true; }
virtual void setGroupAlwaysNotify(bool newValue) override {} virtual void setGroupAlwaysNotify(bool newValue) override { std::ignore = newValue; }
private: private:
bool notifyHide = false; bool notifyHide = false;
}; };

View File

@ -166,10 +166,12 @@ void TestFileTransferList::testControl()
bool pauseCalled = false; bool pauseCalled = false;
QObject::connect(&model, &Model::cancel, [&] (ToxFile file) { QObject::connect(&model, &Model::cancel, [&] (ToxFile file) {
std::ignore = file;
cancelCalled = true; cancelCalled = true;
}); });
QObject::connect(&model, &Model::togglePause, [&] (ToxFile file) { QObject::connect(&model, &Model::togglePause, [&] (ToxFile file) {
std::ignore = file;
pauseCalled = true; pauseCalled = true;
}); });