clang-format pass

This commit is contained in:
Albert Vaca Cintora 2023-07-16 16:20:34 +02:00
parent af907cea83
commit 9c87393b28
24 changed files with 86 additions and 97 deletions

View file

@ -13,11 +13,11 @@
#include <QQuickStyle>
#include <QStandardPaths>
#include "kdeconnect-version.h"
#include <KAboutData>
#include <KColorSchemeManager>
#include <KLocalizedContext>
#include <KLocalizedString>
#include "kdeconnect-version.h"
int main(int argc, char *argv[])
{

View file

@ -15,4 +15,3 @@ DeviceLink::DeviceLink(const QString &deviceId, LinkProvider *parent)
parent->onLinkDestroyed(deviceId, this);
});
}

View file

@ -13,8 +13,8 @@
#include <netinet/tcp.h>
#include <sys/socket.h>
#else
#include <winsock2.h>
#include <mstcpip.h>
#include <winsock2.h>
#endif
#include <QHostInfo>
@ -562,15 +562,9 @@ void LanLinkProvider::configureSocket(QSslSocket *socket)
DWORD nop;
// see https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals
struct tcp_keepalive keepalive = {
1 /* true */,
maxIdle,
interval
};
struct tcp_keepalive keepalive = {1 /* true */, maxIdle, interval};
int rv = WSAIoctl(socket->socketDescriptor(), SIO_KEEPALIVE_VALS, &keepalive,
sizeof(keepalive), nullptr, 0, &nop,
nullptr, nullptr);
int rv = WSAIoctl(socket->socketDescriptor(), SIO_KEEPALIVE_VALS, &keepalive, sizeof(keepalive), nullptr, 0, &nop, nullptr, nullptr);
if (!rv) {
int error = WSAGetLastError();
qCDebug(KDECONNECT_CORE) << "Could not enable TCP Keep-Alive: " << error;

View file

@ -140,7 +140,8 @@ void PairingHandler::pairingTimeout()
Q_EMIT pairingFailed(i18n("Timed out"));
}
void PairingHandler::pairingDone() {
void PairingHandler::pairingDone()
{
qCDebug(KDECONNECT_CORE) << "Pairing done";
m_pairState = PairState::Paired;
Q_EMIT pairingSuccessful();

View file

@ -24,7 +24,10 @@ public:
void packetReceived(const NetworkPacket &np);
PairState pairState() { return m_pairState; }
PairState pairState()
{
return m_pairState;
}
public Q_SLOTS:
bool requestPairing();
@ -38,7 +41,6 @@ Q_SIGNALS:
void pairingSuccessful();
void unpaired();
private:
void pairingDone();
@ -48,7 +50,6 @@ private:
private Q_SLOTS:
void pairingTimeout();
};
#endif // KDECONNECT_PAIRINGHANDLER_H

View file

@ -108,7 +108,6 @@ void Daemon::removeDevice(Device *device)
Q_EMIT deviceListChanged();
}
void Daemon::forceOnNetworkChange()
{
qCDebug(KDECONNECT_CORE) << "Sending onNetworkChange to" << d->m_linkProviders.size() << "LinkProviders";

View file

@ -50,7 +50,7 @@ public:
QMultiMap<QString, KdeConnectPlugin *> m_pluginsByIncomingCapability;
QSet<QString> m_supportedPlugins;
PairingHandler* m_pairingHandler;
PairingHandler *m_pairingHandler;
};
static void warn(const QString &info)
@ -387,7 +387,6 @@ bool Device::isPairRequested() const
return d->m_pairingHandler->pairState() == PairState::Requested;
}
bool Device::isPairRequestedByPeer() const
{
return d->m_pairingHandler->pairState() == PairState::RequestedByPeer;

View file

@ -11,11 +11,11 @@
#include <QDebug>
#include <QFileInfo>
#include <qalgorithms.h>
#include <QNetworkAccessManager>
#include <qalgorithms.h>
#include <KLocalizedString>
#include <KFileUtils>
#include <KLocalizedString>
FileTransferJob::FileTransferJob(const NetworkPacket *np, const QUrl &destination)
: KJob()

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#ifndef PAIR_STATE_H
#define PAIR_STATE_H

View file

@ -13,9 +13,9 @@
#include <QStaticPlugin>
#include <QVector>
#include "kdeconnectconfig.h"
#include "core_debug.h"
#include "device.h"
#include "kdeconnectconfig.h"
#include "kdeconnectplugin.h"
// In older Qt released, qAsConst isnt available
@ -124,12 +124,13 @@ QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString> &incoming
QString myDeviceType = KdeConnectConfig::instance().deviceType().toString();
for (const KPluginMetaData &service : qAsConst(plugins)) {
// Check if the plugin support this device type
const QSet<QString> supportedDeviceTypes = KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-SupportedDeviceTypes")).toSet();
const QSet<QString> supportedDeviceTypes =
KPluginMetaData::readStringList(service.rawData(), QStringLiteral("X-KdeConnect-SupportedDeviceTypes")).toSet();
if (!supportedDeviceTypes.isEmpty()) {
if (!supportedDeviceTypes.contains(myDeviceType)) {
qCDebug(KDECONNECT_CORE) << "Not loading plugin" << service.pluginId() << "because this device of type" << myDeviceType << "is not supported. Supports:" << supportedDeviceTypes.toList().join(QStringLiteral(", "));
qCDebug(KDECONNECT_CORE) << "Not loading plugin" << service.pluginId() << "because this device of type" << myDeviceType
<< "is not supported. Supports:" << supportedDeviceTypes.toList().join(QStringLiteral(", "));
continue;
}
}
@ -142,15 +143,15 @@ QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString> &incoming
bool capabilitiesEmpty = (pluginIncomingCapabilities.isEmpty() && pluginOutgoingCapabilities.isEmpty());
if (!capabilitiesEmpty) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
bool capabilitiesIntersect = (outgoing.intersects(pluginIncomingCapabilities) || incoming.intersects(pluginOutgoingCapabilities));
#else
#else
QSet<QString> commonIncoming = incoming;
commonIncoming.intersect(pluginOutgoingCapabilities);
QSet<QString> commonOutgoing = outgoing;
commonOutgoing.intersect(pluginIncomingCapabilities);
bool capabilitiesIntersect = (!commonIncoming.isEmpty() || !commonOutgoing.isEmpty());
#endif
#endif
if (!capabilitiesIntersect) {
qCDebug(KDECONNECT_CORE) << "Not loading plugin" << service.pluginId() << "because device doesn't support it";
@ -160,7 +161,6 @@ QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString> &incoming
// If we get here, the plugin can be loaded
ret += service.pluginId();
}
return ret;

View file

@ -20,10 +20,10 @@
#include <KAboutData>
#include <KDBusService>
#include <KIO/Global>
#include <KLocalizedString>
#include <KNotification>
#include <KWindowSystem>
#include <KIO/Global>
#include <dbushelper.h>

View file

@ -7,16 +7,16 @@
#include <QDebug>
#include <QFile>
#include <QIcon>
#include <QStandardPaths>
#include <QSettings>
#include <QStandardPaths>
#include <iostream>
#include <Windows.h>
#include <tlhelp32.h>
#include <winrt/Windows.UI.ViewManagement.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.UI.ViewManagement.h>
#include "indicator_debug.h"
#include "indicatorhelper.h"
@ -70,9 +70,11 @@ void onThemeChanged(QSystemTrayIcon &systray)
QSettings registry(QStringLiteral("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"), QSettings::Registry64Format);
bool isLightTheme = registry.value(QStringLiteral("SystemUsesLightTheme")).toBool();
if (isLightTheme) {
systray.setIcon(QIcon(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("icons/hicolor/scalable/apps/kdeconnectindicator.svg"))));
systray.setIcon(
QIcon(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("icons/hicolor/scalable/apps/kdeconnectindicator.svg"))));
} else {
systray.setIcon(QIcon(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("icons/hicolor/scalable/apps/kdeconnectindicatordark.svg"))));
systray.setIcon(
QIcon(QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("icons/hicolor/scalable/apps/kdeconnectindicatordark.svg"))));
}
}

View file

@ -226,15 +226,21 @@ ShareDbusInterface::ShareDbusInterface(const QString &deviceId, QObject *parent)
ShareDbusInterface::~ShareDbusInterface() = default;
PhotoDbusInterface::PhotoDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDevicePhotoInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/photo"), QDBusConnection::sessionBus(), parent)
PhotoDbusInterface::PhotoDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDevicePhotoInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/photo"),
QDBusConnection::sessionBus(),
parent)
{
}
PhotoDbusInterface::~PhotoDbusInterface() = default;
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"), QDBusConnection::sessionBus(), parent)
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString &deviceId, QObject *parent)
: OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(),
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"),
QDBusConnection::sessionBus(),
parent)
{
}

View file

@ -231,17 +231,15 @@ public:
~ShareDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT PhotoDbusInterface
: public OrgKdeKdeconnectDevicePhotoInterface
class KDECONNECTINTERFACES_EXPORT PhotoDbusInterface : public OrgKdeKdeconnectDevicePhotoInterface
{
Q_OBJECT
public:
explicit PhotoDbusInterface(const QString& deviceId, QObject* parent = nullptr);
explicit PhotoDbusInterface(const QString &deviceId, QObject *parent = nullptr);
~PhotoDbusInterface() override;
};
class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface
: public OrgKdeKdeconnectDeviceRemotesystemvolumeInterface
class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface : public OrgKdeKdeconnectDeviceRemotesystemvolumeInterface
{
Q_OBJECT
public:

View file

@ -278,7 +278,6 @@ void KdeConnectKcm::pairingFailed(const QString &error)
kcmUi->messages->animatedShow();
}
void KdeConnectKcm::setCurrentDevicePairState(int pairStateAsInt)
{
PairState state = (PairState)pairStateAsInt; // Hack because qdbus doesn't like enums

View file

@ -51,7 +51,6 @@ private Q_SLOTS:
void acceptPairing();
void cancelPairing();
private:
void resetDeviceView();

View file

@ -11,7 +11,7 @@
K_PLUGIN_FACTORY(ClipboardConfigFactory, registerPlugin<ClipboardConfig>();)
ClipboardConfig::ClipboardConfig(QWidget* parent, const QVariantList &args)
ClipboardConfig::ClipboardConfig(QWidget *parent, const QVariantList &args)
: KdeConnectPluginKcm(parent, args, QStringLiteral("kdeconnect_clipboard"))
, m_ui(new Ui::ClipboardConfigUi())
{

View file

@ -9,16 +9,16 @@
#include "kcmplugin/kdeconnectpluginkcm.h"
namespace Ui {
class ClipboardConfigUi;
namespace Ui
{
class ClipboardConfigUi;
}
class ClipboardConfig
: public KdeConnectPluginKcm
class ClipboardConfig : public KdeConnectPluginKcm
{
Q_OBJECT
public:
ClipboardConfig(QWidget *parent, const QVariantList&);
ClipboardConfig(QWidget *parent, const QVariantList &);
~ClipboardConfig() override;
public Q_SLOTS:
@ -29,7 +29,6 @@ public Q_SLOTS:
private:
Ui::ClipboardConfigUi *m_ui;
};
#endif

View file

@ -187,12 +187,12 @@ void Notification::reply()
Q_EMIT replyRequested();
}
void Notification::sendReply(const QString& message)
void Notification::sendReply(const QString &message)
{
Q_EMIT replied(message);
}
void Notification::parseNetworkPacket(const NetworkPacket& np)
void Notification::parseNetworkPacket(const NetworkPacket &np)
{
m_internalId = np.get<QString>(QStringLiteral("id"));
m_appName = np.get<QString>(QStringLiteral("appName"));

View file

@ -86,7 +86,7 @@ public:
public Q_SLOTS:
Q_SCRIPTABLE void dismiss();
Q_SCRIPTABLE void reply();
Q_SCRIPTABLE void sendReply(const QString& message);
Q_SCRIPTABLE void sendReply(const QString &message);
Q_SIGNALS:
void dismissRequested(const QString &m_internalId);

View file

@ -117,12 +117,7 @@ void RemoteKeyboardPlugin::sendQKeyEvent(const QVariantMap &keyEvent, bool sendA
text = QKeySequence(key).toString().toLower();
}
sendKeyPress(text,
k,
modifiers & Qt::ShiftModifier,
modifiers & Qt::ControlModifier,
modifiers & Qt::AltModifier,
sendAck);
sendKeyPress(text, k, modifiers & Qt::ShiftModifier, modifiers & Qt::ControlModifier, modifiers & Qt::AltModifier, sendAck);
}
int RemoteKeyboardPlugin::translateQtKey(int qtKey) const

View file

@ -7,11 +7,11 @@
#include "runcommand_config.h"
#include <QDebug>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QJsonDocument>
#include <QJsonArray>
#include <QFileDialog>
#include <QJsonDocument>
#include <QMenu>
#include <QPushButton>
#include <QStandardItemModel>

View file

@ -14,7 +14,7 @@
#include <KLocalizedString>
//#include "modeltest.h"
// #include "modeltest.h"
NotifyingApplicationModel::NotifyingApplicationModel(QObject *parent)
: QAbstractTableModel(parent)

View file

@ -445,7 +445,6 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np)
setDefaultAudioPlaybackDevice(name, np.get<bool>(QStringLiteral("enabled")));
}
}
}
}
return true;