Discard unused params more elegantly
By commenting out the parameter name, we get compile-time checks Also, we can omit them for slots and Qt will not forward the parameters. In case we had TODOs next to the code, I kept the Q_UNUSED statements for now.
This commit is contained in:
parent
46feeda0cb
commit
405f61bf85
19 changed files with 30 additions and 76 deletions
|
@ -146,10 +146,8 @@ void CompositeUploadJob::socketDisconnected()
|
||||||
m_socket->close();
|
m_socket->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompositeUploadJob::socketError(QAbstractSocket::SocketError error)
|
void CompositeUploadJob::socketError()
|
||||||
{
|
{
|
||||||
Q_UNUSED(error);
|
|
||||||
|
|
||||||
// Do not close the socket because when android closes the socket (share is cancelled) closing the socket leads to a cyclic socketError and eventually a
|
// Do not close the socket because when android closes the socket (share is cancelled) closing the socket leads to a cyclic socketError and eventually a
|
||||||
// segv
|
// segv
|
||||||
setError(SocketError);
|
setError(SocketError);
|
||||||
|
@ -158,10 +156,8 @@ void CompositeUploadJob::socketError(QAbstractSocket::SocketError error)
|
||||||
m_running = false;
|
m_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompositeUploadJob::sslError(const QList<QSslError> &errors)
|
void CompositeUploadJob::sslError()
|
||||||
{
|
{
|
||||||
Q_UNUSED(errors);
|
|
||||||
|
|
||||||
m_socket->close();
|
m_socket->close();
|
||||||
setError(SslError);
|
setError(SslError);
|
||||||
emitResult();
|
emitResult();
|
||||||
|
@ -240,10 +236,8 @@ bool CompositeUploadJob::doKill()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompositeUploadJob::slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
|
void CompositeUploadJob::slotProcessedAmount(KJob * /*job*/, KJob::Unit unit, qulonglong amount)
|
||||||
{
|
{
|
||||||
Q_UNUSED(job);
|
|
||||||
|
|
||||||
m_currentJobSendPayloadSize = amount;
|
m_currentJobSendPayloadSize = amount;
|
||||||
quint64 uploaded = m_totalSendPayloadSize + m_currentJobSendPayloadSize;
|
quint64 uploaded = m_totalSendPayloadSize + m_currentJobSendPayloadSize;
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ private:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void newConnection();
|
void newConnection();
|
||||||
void socketDisconnected();
|
void socketDisconnected();
|
||||||
void socketError(QAbstractSocket::SocketError socketError);
|
void socketError();
|
||||||
void sslError(const QList<QSslError> &errors);
|
void sslError();
|
||||||
void encrypted();
|
void encrypted();
|
||||||
void slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount);
|
void slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount);
|
||||||
void slotResult(KJob *job) override;
|
void slotResult(KJob *job) override;
|
||||||
|
|
|
@ -64,10 +64,8 @@ void UploadJob::uploadNextPacket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UploadJob::encryptedBytesWritten(qint64 bytes)
|
void UploadJob::encryptedBytesWritten(qint64 /*bytes*/)
|
||||||
{
|
{
|
||||||
Q_UNUSED(bytes);
|
|
||||||
|
|
||||||
if (m_socket->encryptedBytesToWrite() == 0) {
|
if (m_socket->encryptedBytesToWrite() == 0) {
|
||||||
bytesUploaded += bytesUploading;
|
bytesUploaded += bytesUploading;
|
||||||
setProcessedAmount(Bytes, bytesUploaded);
|
setProcessedAmount(Bytes, bytesUploaded);
|
||||||
|
|
|
@ -86,10 +86,8 @@ bool CompositeFileTransferJob::doKill()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompositeFileTransferJob::slotProcessedAmount(KJob *job, KJob::Unit unit, qulonglong amount)
|
void CompositeFileTransferJob::slotProcessedAmount(KJob * /*job*/, KJob::Unit unit, qulonglong amount)
|
||||||
{
|
{
|
||||||
Q_UNUSED(job);
|
|
||||||
|
|
||||||
m_currentJobSentPayloadSize = amount;
|
m_currentJobSentPayloadSize = amount;
|
||||||
const auto totalSent = m_totalSentPayloadSize + m_currentJobSentPayloadSize;
|
const auto totalSent = m_totalSentPayloadSize + m_currentJobSentPayloadSize;
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,8 @@ void IndicatorHelper::iconPathHook()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int IndicatorHelper::daemonHook(QProcess &kdeconnectd)
|
int IndicatorHelper::daemonHook(QProcess & /*kdeconnectd*/)
|
||||||
{
|
{
|
||||||
Q_UNUSED(kdeconnectd);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,8 @@ void DevicesModel::deviceRemoved(const QString &id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicesModel::deviceUpdated(const QString &id, bool isVisible)
|
void DevicesModel::deviceUpdated(const QString &id)
|
||||||
{
|
{
|
||||||
Q_UNUSED(isVisible);
|
|
||||||
int row = rowForDevice(id);
|
int row = rowForDevice(id);
|
||||||
|
|
||||||
if (row < 0) {
|
if (row < 0) {
|
||||||
|
@ -179,17 +178,10 @@ void DevicesModel::receivedDeviceList(QDBusPendingCallWatcher *watcher)
|
||||||
void DevicesModel::appendDevice(DeviceDbusInterface *dev)
|
void DevicesModel::appendDevice(DeviceDbusInterface *dev)
|
||||||
{
|
{
|
||||||
m_deviceList.append(dev);
|
m_deviceList.append(dev);
|
||||||
connect(dev, &OrgKdeKdeconnectDeviceInterface::nameChanged, this, &DevicesModel::nameChanged);
|
connect(dev, &OrgKdeKdeconnectDeviceInterface::nameChanged, this, [this, dev]() {
|
||||||
}
|
Q_ASSERT(rowForDevice(dev->id()) >= 0);
|
||||||
|
deviceUpdated(dev->id());
|
||||||
void DevicesModel::nameChanged(const QString &newName)
|
});
|
||||||
{
|
|
||||||
Q_UNUSED(newName);
|
|
||||||
DeviceDbusInterface *device = static_cast<DeviceDbusInterface *>(sender());
|
|
||||||
|
|
||||||
Q_ASSERT(rowForDevice(device->id()) >= 0);
|
|
||||||
|
|
||||||
deviceUpdated(device->id(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicesModel::clearDevices()
|
void DevicesModel::clearDevices()
|
||||||
|
|
|
@ -61,10 +61,9 @@ public:
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void deviceAdded(const QString &id);
|
void deviceAdded(const QString &id);
|
||||||
void deviceRemoved(const QString &id);
|
void deviceRemoved(const QString &id);
|
||||||
void deviceUpdated(const QString &id, bool isVisible);
|
void deviceUpdated(const QString &id);
|
||||||
void refreshDeviceList();
|
void refreshDeviceList();
|
||||||
void receivedDeviceList(QDBusPendingCallWatcher *watcher);
|
void receivedDeviceList(QDBusPendingCallWatcher *watcher);
|
||||||
void nameChanged(const QString &newName);
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void rowsChanged();
|
void rowsChanged();
|
||||||
|
|
|
@ -31,10 +31,8 @@ FindThisDevicePlugin::FindThisDevicePlugin(QObject *parent, const QVariantList &
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindThisDevicePlugin::receivePacket(const NetworkPacket &np)
|
void FindThisDevicePlugin::receivePacket(const NetworkPacket & /*np*/)
|
||||||
{
|
{
|
||||||
Q_UNUSED(np);
|
|
||||||
|
|
||||||
const QString soundFile = config()->getString(QStringLiteral("ringtone"), defaultSound());
|
const QString soundFile = config()->getString(QStringLiteral("ringtone"), defaultSound());
|
||||||
const QUrl soundURL = QUrl::fromLocalFile(soundFile);
|
const QUrl soundURL = QUrl::fromLocalFile(soundFile);
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,7 @@ LockDevicePlugin::LockDevicePlugin(QObject *parent, const QVariantList &args)
|
||||||
connect(&m_propertiesInterface,
|
connect(&m_propertiesInterface,
|
||||||
&OrgFreedesktopDBusPropertiesInterface::PropertiesChanged,
|
&OrgFreedesktopDBusPropertiesInterface::PropertiesChanged,
|
||||||
this,
|
this,
|
||||||
[this](const QString &interface, const QVariantMap &properties, QStringList invalidatedProperties) {
|
[this](const QString &interface, const QVariantMap &properties) {
|
||||||
Q_UNUSED(invalidatedProperties);
|
|
||||||
|
|
||||||
if (interface != QLatin1String("org.freedesktop.login1.Session")) {
|
if (interface != QLatin1String("org.freedesktop.login1.Session")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,17 +52,12 @@ void MMTelephonyPlugin::onModemAdded(const QString &path)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMTelephonyPlugin::onModemRemoved(const QString &path)
|
|
||||||
{
|
|
||||||
Q_UNUSED(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MMTelephonyPlugin::onCallAdded(ModemManager::Call::Ptr call)
|
void MMTelephonyPlugin::onCallAdded(ModemManager::Call::Ptr call)
|
||||||
{
|
{
|
||||||
qCDebug(KDECONNECT_PLUGIN_MMTELEPHONY) << "Call added" << call->number();
|
qCDebug(KDECONNECT_PLUGIN_MMTELEPHONY) << "Call added" << call->number();
|
||||||
|
|
||||||
connect(call.get(), &ModemManager::Call::stateChanged, this, [=](MMCallState newState, MMCallState oldState, MMCallStateReason reason) {
|
connect(call.get(), &ModemManager::Call::stateChanged, this, [=](MMCallState newState, MMCallState oldState) {
|
||||||
onCallStateChanged(call.get(), newState, oldState, reason);
|
onCallStateChanged(call.get(), newState, oldState);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,9 +86,8 @@ QString MMTelephonyPlugin::stateName(MMCallState state)
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMTelephonyPlugin::onCallStateChanged(ModemManager::Call *call, MMCallState newState, MMCallState oldState, MMCallStateReason reason)
|
void MMTelephonyPlugin::onCallStateChanged(ModemManager::Call *call, MMCallState newState, MMCallState oldState)
|
||||||
{
|
{
|
||||||
Q_UNUSED(reason);
|
|
||||||
auto event = stateName(newState);
|
auto event = stateName(newState);
|
||||||
|
|
||||||
qCDebug(KDECONNECT_PLUGIN_MMTELEPHONY) << "Call state changed" << call->uni() << event;
|
qCDebug(KDECONNECT_PLUGIN_MMTELEPHONY) << "Call state changed" << call->uni() << event;
|
||||||
|
|
|
@ -42,8 +42,7 @@ private:
|
||||||
void onCallAdded(ModemManager::Call::Ptr call);
|
void onCallAdded(ModemManager::Call::Ptr call);
|
||||||
void onCallRemoved(ModemManager::Call::Ptr call);
|
void onCallRemoved(ModemManager::Call::Ptr call);
|
||||||
void onModemAdded(const QString &path);
|
void onModemAdded(const QString &path);
|
||||||
void onModemRemoved(const QString &path);
|
void onCallStateChanged(ModemManager::Call *call, MMCallState newState, MMCallState oldState);
|
||||||
void onCallStateChanged(ModemManager::Call *call, MMCallState newState, MMCallState oldState, MMCallStateReason reason);
|
|
||||||
void sendMMTelephonyPacket(ModemManager::Call *call, const QString &state);
|
void sendMMTelephonyPacket(ModemManager::Call *call, const QString &state);
|
||||||
void sendCancelMMTelephonyPacket(ModemManager::Call *call, const QString &lastState);
|
void sendCancelMMTelephonyPacket(ModemManager::Call *call, const QString &lastState);
|
||||||
static QString stateName(MMCallState state);
|
static QString stateName(MMCallState state);
|
||||||
|
|
|
@ -119,10 +119,8 @@ void MprisControlPlugin::seeked(qlonglong position)
|
||||||
sendPacket(np);
|
sendPacket(np);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MprisControlPlugin::propertiesChanged(const QString &propertyInterface, const QVariantMap &properties)
|
void MprisControlPlugin::propertiesChanged(const QString & /*propertyInterface*/, const QVariantMap &properties)
|
||||||
{
|
{
|
||||||
Q_UNUSED(propertyInterface);
|
|
||||||
|
|
||||||
OrgFreedesktopDBusPropertiesInterface *propertiesInterface = (OrgFreedesktopDBusPropertiesInterface *)sender();
|
OrgFreedesktopDBusPropertiesInterface *propertiesInterface = (OrgFreedesktopDBusPropertiesInterface *)sender();
|
||||||
const auto end = playerList.constEnd();
|
const auto end = playerList.constEnd();
|
||||||
const auto it = std::find_if(playerList.constBegin(), end, [propertiesInterface](const MprisPlayer &player) {
|
const auto it = std::find_if(playerList.constBegin(), end, [propertiesInterface](const MprisPlayer &player) {
|
||||||
|
|
|
@ -159,17 +159,14 @@ void MprisRemotePlayerMediaPlayer2Player::Seek(qlonglong Offset)
|
||||||
m_plugin->seek(Offset);
|
m_plugin->seek(Offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MprisRemotePlayerMediaPlayer2Player::SetPosition(QDBusObjectPath TrackId, qlonglong Position)
|
void MprisRemotePlayerMediaPlayer2Player::SetPosition(QDBusObjectPath /*TrackId*/, qlonglong Position)
|
||||||
{
|
{
|
||||||
Q_UNUSED(TrackId)
|
|
||||||
|
|
||||||
m_plugin->setPlayer(m_parent->identity());
|
m_plugin->setPlayer(m_parent->identity());
|
||||||
m_plugin->setPosition(Position / 1000);
|
m_plugin->setPosition(Position / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MprisRemotePlayerMediaPlayer2Player::OpenUri(QString Uri)
|
void MprisRemotePlayerMediaPlayer2Player::OpenUri(QString /*Uri*/)
|
||||||
{
|
{
|
||||||
Q_UNUSED(Uri)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MprisRemotePlayerMediaPlayer2Player::controlsChanged()
|
void MprisRemotePlayerMediaPlayer2Player::controlsChanged()
|
||||||
|
|
|
@ -241,10 +241,9 @@ void RunCommandConfig::insertRow(int i, const QString &name, const QString &comm
|
||||||
m_entriesModel->insertRow(i, QList<QStandardItem *>() << newName << newCommand);
|
m_entriesModel->insertRow(i, QList<QStandardItem *>() << newName << newCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunCommandConfig::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
void RunCommandConfig::onDataChanged(const QModelIndex & /*topLeft*/, const QModelIndex &bottomRight)
|
||||||
{
|
{
|
||||||
markAsChanged();
|
markAsChanged();
|
||||||
Q_UNUSED(topLeft);
|
|
||||||
if (bottomRight.row() == m_entriesModel->rowCount() - 1) {
|
if (bottomRight.row() == m_entriesModel->rowCount() - 1) {
|
||||||
// TODO check both entries are still empty
|
// TODO check both entries are still empty
|
||||||
insertEmptyRow();
|
insertEmptyRow();
|
||||||
|
|
|
@ -73,7 +73,6 @@ void NotifyingApplicationModel::clearApplications()
|
||||||
|
|
||||||
QVariant NotifyingApplicationModel::data(const QModelIndex &index, int role) const
|
QVariant NotifyingApplicationModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(role);
|
|
||||||
if (!index.isValid() || index.row() < 0 || index.row() >= m_apps.size() || index.column() > 3) {
|
if (!index.isValid() || index.row() < 0 || index.row() >= m_apps.size() || index.column() > 3) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ void ConversationModel::setDeviceId(const QString &deviceId)
|
||||||
<< "of" << this;
|
<< "of" << this;
|
||||||
if (m_conversationsInterface) {
|
if (m_conversationsInterface) {
|
||||||
disconnect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdate(QDBusVariant)));
|
disconnect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdate(QDBusVariant)));
|
||||||
disconnect(m_conversationsInterface, SIGNAL(conversationLoaded(qint64, quint64)), this, SLOT(handleConversationLoaded(qint64, quint64)));
|
disconnect(m_conversationsInterface, SIGNAL(conversationLoaded(qint64, quint64)), this, SLOT(handleConversationLoaded(qint64)));
|
||||||
disconnect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleConversationCreated(QDBusVariant)));
|
disconnect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleConversationCreated(QDBusVariant)));
|
||||||
delete m_conversationsInterface;
|
delete m_conversationsInterface;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ void ConversationModel::setDeviceId(const QString &deviceId)
|
||||||
|
|
||||||
m_conversationsInterface = new DeviceConversationsDbusInterface(deviceId, this);
|
m_conversationsInterface = new DeviceConversationsDbusInterface(deviceId, this);
|
||||||
connect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdate(QDBusVariant)));
|
connect(m_conversationsInterface, SIGNAL(conversationUpdated(QDBusVariant)), this, SLOT(handleConversationUpdate(QDBusVariant)));
|
||||||
connect(m_conversationsInterface, SIGNAL(conversationLoaded(qint64, quint64)), this, SLOT(handleConversationLoaded(qint64, quint64)));
|
connect(m_conversationsInterface, SIGNAL(conversationLoaded(qint64, quint64)), this, SLOT(handleConversationLoaded(qint64)));
|
||||||
connect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleConversationCreated(QDBusVariant)));
|
connect(m_conversationsInterface, SIGNAL(conversationCreated(QDBusVariant)), this, SLOT(handleConversationCreated(QDBusVariant)));
|
||||||
|
|
||||||
connect(m_conversationsInterface, SIGNAL(attachmentReceived(QString, QString)), this, SIGNAL(filePathReceived(QString, QString)));
|
connect(m_conversationsInterface, SIGNAL(attachmentReceived(QString, QString)), this, SIGNAL(filePathReceived(QString, QString)));
|
||||||
|
@ -205,9 +205,8 @@ void ConversationModel::handleConversationCreated(const QDBusVariant &msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConversationModel::handleConversationLoaded(qint64 threadID, quint64 numMessages)
|
void ConversationModel::handleConversationLoaded(qint64 threadID)
|
||||||
{
|
{
|
||||||
Q_UNUSED(numMessages)
|
|
||||||
if (threadID != m_threadId) {
|
if (threadID != m_threadId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void handleConversationUpdate(const QDBusVariant &message);
|
void handleConversationUpdate(const QDBusVariant &message);
|
||||||
void handleConversationLoaded(qint64 threadID, quint64 numMessages);
|
void handleConversationLoaded(qint64 threadID);
|
||||||
void handleConversationCreated(const QDBusVariant &message);
|
void handleConversationCreated(const QDBusVariant &message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -26,11 +26,8 @@
|
||||||
#include "smsapp/gsmasciimap.h"
|
#include "smsapp/gsmasciimap.h"
|
||||||
#include "smshelper_debug.h"
|
#include "smshelper_debug.h"
|
||||||
|
|
||||||
QObject *SmsHelper::singletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
QObject *SmsHelper::singletonProvider(QQmlEngine * /*engine*/, QJSEngine * /*scriptEngine*/)
|
||||||
{
|
{
|
||||||
Q_UNUSED(engine);
|
|
||||||
Q_UNUSED(scriptEngine);
|
|
||||||
|
|
||||||
return new SmsHelper();
|
return new SmsHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,8 @@ ThumbnailsProvider::ThumbnailsProvider()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage ThumbnailsProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
|
QImage ThumbnailsProvider::requestImage(const QString &id, QSize * /*size*/, const QSize & /*requestedSize*/)
|
||||||
{
|
{
|
||||||
Q_UNUSED(size)
|
|
||||||
Q_UNUSED(requestedSize)
|
|
||||||
|
|
||||||
if (m_thumbnails.contains(id)) {
|
if (m_thumbnails.contains(id)) {
|
||||||
return m_thumbnails.value(id);
|
return m_thumbnails.value(id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue