clang-format pass
This commit is contained in:
parent
af907cea83
commit
9c87393b28
24 changed files with 86 additions and 97 deletions
|
@ -13,11 +13,11 @@
|
||||||
#include <QQuickStyle>
|
#include <QQuickStyle>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
#include "kdeconnect-version.h"
|
||||||
#include <KAboutData>
|
#include <KAboutData>
|
||||||
#include <KColorSchemeManager>
|
#include <KColorSchemeManager>
|
||||||
#include <KLocalizedContext>
|
#include <KLocalizedContext>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include "kdeconnect-version.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,4 +15,3 @@ DeviceLink::DeviceLink(const QString &deviceId, LinkProvider *parent)
|
||||||
parent->onLinkDestroyed(deviceId, this);
|
parent->onLinkDestroyed(deviceId, this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#else
|
#else
|
||||||
#include <winsock2.h>
|
|
||||||
#include <mstcpip.h>
|
#include <mstcpip.h>
|
||||||
|
#include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QHostInfo>
|
#include <QHostInfo>
|
||||||
|
@ -562,15 +562,9 @@ void LanLinkProvider::configureSocket(QSslSocket *socket)
|
||||||
DWORD nop;
|
DWORD nop;
|
||||||
|
|
||||||
// see https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals
|
// see https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals
|
||||||
struct tcp_keepalive keepalive = {
|
struct tcp_keepalive keepalive = {1 /* true */, maxIdle, interval};
|
||||||
1 /* true */,
|
|
||||||
maxIdle,
|
|
||||||
interval
|
|
||||||
};
|
|
||||||
|
|
||||||
int rv = WSAIoctl(socket->socketDescriptor(), SIO_KEEPALIVE_VALS, &keepalive,
|
int rv = WSAIoctl(socket->socketDescriptor(), SIO_KEEPALIVE_VALS, &keepalive, sizeof(keepalive), nullptr, 0, &nop, nullptr, nullptr);
|
||||||
sizeof(keepalive), nullptr, 0, &nop,
|
|
||||||
nullptr, nullptr);
|
|
||||||
if (!rv) {
|
if (!rv) {
|
||||||
int error = WSAGetLastError();
|
int error = WSAGetLastError();
|
||||||
qCDebug(KDECONNECT_CORE) << "Could not enable TCP Keep-Alive: " << error;
|
qCDebug(KDECONNECT_CORE) << "Could not enable TCP Keep-Alive: " << error;
|
||||||
|
|
|
@ -140,7 +140,8 @@ void PairingHandler::pairingTimeout()
|
||||||
Q_EMIT pairingFailed(i18n("Timed out"));
|
Q_EMIT pairingFailed(i18n("Timed out"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PairingHandler::pairingDone() {
|
void PairingHandler::pairingDone()
|
||||||
|
{
|
||||||
qCDebug(KDECONNECT_CORE) << "Pairing done";
|
qCDebug(KDECONNECT_CORE) << "Pairing done";
|
||||||
m_pairState = PairState::Paired;
|
m_pairState = PairState::Paired;
|
||||||
Q_EMIT pairingSuccessful();
|
Q_EMIT pairingSuccessful();
|
||||||
|
|
|
@ -24,7 +24,10 @@ public:
|
||||||
|
|
||||||
void packetReceived(const NetworkPacket &np);
|
void packetReceived(const NetworkPacket &np);
|
||||||
|
|
||||||
PairState pairState() { return m_pairState; }
|
PairState pairState()
|
||||||
|
{
|
||||||
|
return m_pairState;
|
||||||
|
}
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
bool requestPairing();
|
bool requestPairing();
|
||||||
|
@ -38,7 +41,6 @@ Q_SIGNALS:
|
||||||
void pairingSuccessful();
|
void pairingSuccessful();
|
||||||
void unpaired();
|
void unpaired();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void pairingDone();
|
void pairingDone();
|
||||||
|
|
||||||
|
@ -48,7 +50,6 @@ private:
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void pairingTimeout();
|
void pairingTimeout();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KDECONNECT_PAIRINGHANDLER_H
|
#endif // KDECONNECT_PAIRINGHANDLER_H
|
||||||
|
|
|
@ -108,7 +108,6 @@ void Daemon::removeDevice(Device *device)
|
||||||
Q_EMIT deviceListChanged();
|
Q_EMIT deviceListChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Daemon::forceOnNetworkChange()
|
void Daemon::forceOnNetworkChange()
|
||||||
{
|
{
|
||||||
qCDebug(KDECONNECT_CORE) << "Sending onNetworkChange to" << d->m_linkProviders.size() << "LinkProviders";
|
qCDebug(KDECONNECT_CORE) << "Sending onNetworkChange to" << d->m_linkProviders.size() << "LinkProviders";
|
||||||
|
|
|
@ -387,7 +387,6 @@ bool Device::isPairRequested() const
|
||||||
return d->m_pairingHandler->pairState() == PairState::Requested;
|
return d->m_pairingHandler->pairState() == PairState::Requested;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Device::isPairRequestedByPeer() const
|
bool Device::isPairRequestedByPeer() const
|
||||||
{
|
{
|
||||||
return d->m_pairingHandler->pairState() == PairState::RequestedByPeer;
|
return d->m_pairingHandler->pairState() == PairState::RequestedByPeer;
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <qalgorithms.h>
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
#include <qalgorithms.h>
|
||||||
|
|
||||||
#include <KLocalizedString>
|
|
||||||
#include <KFileUtils>
|
#include <KFileUtils>
|
||||||
|
#include <KLocalizedString>
|
||||||
|
|
||||||
FileTransferJob::FileTransferJob(const NetworkPacket *np, const QUrl &destination)
|
FileTransferJob::FileTransferJob(const NetworkPacket *np, const QUrl &destination)
|
||||||
: KJob()
|
: KJob()
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef PAIR_STATE_H
|
#ifndef PAIR_STATE_H
|
||||||
#define PAIR_STATE_H
|
#define PAIR_STATE_H
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#include <QStaticPlugin>
|
#include <QStaticPlugin>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "kdeconnectconfig.h"
|
|
||||||
#include "core_debug.h"
|
#include "core_debug.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
#include "kdeconnectconfig.h"
|
||||||
#include "kdeconnectplugin.h"
|
#include "kdeconnectplugin.h"
|
||||||
|
|
||||||
// In older Qt released, qAsConst isnt available
|
// 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();
|
QString myDeviceType = KdeConnectConfig::instance().deviceType().toString();
|
||||||
|
|
||||||
for (const KPluginMetaData &service : qAsConst(plugins)) {
|
for (const KPluginMetaData &service : qAsConst(plugins)) {
|
||||||
|
|
||||||
// Check if the plugin support this device type
|
// 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.isEmpty()) {
|
||||||
if (!supportedDeviceTypes.contains(myDeviceType)) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +161,6 @@ QSet<QString> PluginLoader::pluginsForCapabilities(const QSet<QString> &incoming
|
||||||
|
|
||||||
// If we get here, the plugin can be loaded
|
// If we get here, the plugin can be loaded
|
||||||
ret += service.pluginId();
|
ret += service.pluginId();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
#include <KAboutData>
|
#include <KAboutData>
|
||||||
#include <KDBusService>
|
#include <KDBusService>
|
||||||
|
#include <KIO/Global>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
#include <KWindowSystem>
|
#include <KWindowSystem>
|
||||||
#include <KIO/Global>
|
|
||||||
|
|
||||||
#include <dbushelper.h>
|
#include <dbushelper.h>
|
||||||
|
|
||||||
|
|
|
@ -7,16 +7,16 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <tlhelp32.h>
|
#include <tlhelp32.h>
|
||||||
|
|
||||||
#include <winrt/Windows.UI.ViewManagement.h>
|
|
||||||
#include <winrt/Windows.Foundation.Collections.h>
|
#include <winrt/Windows.Foundation.Collections.h>
|
||||||
|
#include <winrt/Windows.UI.ViewManagement.h>
|
||||||
|
|
||||||
#include "indicator_debug.h"
|
#include "indicator_debug.h"
|
||||||
#include "indicatorhelper.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);
|
QSettings registry(QStringLiteral("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"), QSettings::Registry64Format);
|
||||||
bool isLightTheme = registry.value(QStringLiteral("SystemUsesLightTheme")).toBool();
|
bool isLightTheme = registry.value(QStringLiteral("SystemUsesLightTheme")).toBool();
|
||||||
if (isLightTheme) {
|
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 {
|
} 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"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,15 +226,21 @@ ShareDbusInterface::ShareDbusInterface(const QString &deviceId, QObject *parent)
|
||||||
|
|
||||||
ShareDbusInterface::~ShareDbusInterface() = default;
|
ShareDbusInterface::~ShareDbusInterface() = default;
|
||||||
|
|
||||||
PhotoDbusInterface::PhotoDbusInterface(const QString& deviceId, QObject* parent):
|
PhotoDbusInterface::PhotoDbusInterface(const QString &deviceId, QObject *parent)
|
||||||
OrgKdeKdeconnectDevicePhotoInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/photo"), QDBusConnection::sessionBus(), parent)
|
: OrgKdeKdeconnectDevicePhotoInterface(DaemonDbusInterface::activatedService(),
|
||||||
|
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/photo"),
|
||||||
|
QDBusConnection::sessionBus(),
|
||||||
|
parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PhotoDbusInterface::~PhotoDbusInterface() = default;
|
PhotoDbusInterface::~PhotoDbusInterface() = default;
|
||||||
|
|
||||||
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString& deviceId, QObject* parent):
|
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString &deviceId, QObject *parent)
|
||||||
OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"), QDBusConnection::sessionBus(), parent)
|
: OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(),
|
||||||
|
QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"),
|
||||||
|
QDBusConnection::sessionBus(),
|
||||||
|
parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,8 +231,7 @@ public:
|
||||||
~ShareDbusInterface() override;
|
~ShareDbusInterface() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KDECONNECTINTERFACES_EXPORT PhotoDbusInterface
|
class KDECONNECTINTERFACES_EXPORT PhotoDbusInterface : public OrgKdeKdeconnectDevicePhotoInterface
|
||||||
: public OrgKdeKdeconnectDevicePhotoInterface
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -240,8 +239,7 @@ public:
|
||||||
~PhotoDbusInterface() override;
|
~PhotoDbusInterface() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface
|
class KDECONNECTINTERFACES_EXPORT RemoteSystemVolumeDbusInterface : public OrgKdeKdeconnectDeviceRemotesystemvolumeInterface
|
||||||
: public OrgKdeKdeconnectDeviceRemotesystemvolumeInterface
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -278,7 +278,6 @@ void KdeConnectKcm::pairingFailed(const QString &error)
|
||||||
kcmUi->messages->animatedShow();
|
kcmUi->messages->animatedShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KdeConnectKcm::setCurrentDevicePairState(int pairStateAsInt)
|
void KdeConnectKcm::setCurrentDevicePairState(int pairStateAsInt)
|
||||||
{
|
{
|
||||||
PairState state = (PairState)pairStateAsInt; // Hack because qdbus doesn't like enums
|
PairState state = (PairState)pairStateAsInt; // Hack because qdbus doesn't like enums
|
||||||
|
|
|
@ -51,7 +51,6 @@ private Q_SLOTS:
|
||||||
void acceptPairing();
|
void acceptPairing();
|
||||||
void cancelPairing();
|
void cancelPairing();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resetDeviceView();
|
void resetDeviceView();
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
|
|
||||||
#include "kcmplugin/kdeconnectpluginkcm.h"
|
#include "kcmplugin/kdeconnectpluginkcm.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class ClipboardConfigUi;
|
class ClipboardConfigUi;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClipboardConfig
|
class ClipboardConfig : public KdeConnectPluginKcm
|
||||||
: public KdeConnectPluginKcm
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -29,7 +29,6 @@ public Q_SLOTS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ClipboardConfigUi *m_ui;
|
Ui::ClipboardConfigUi *m_ui;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -117,12 +117,7 @@ void RemoteKeyboardPlugin::sendQKeyEvent(const QVariantMap &keyEvent, bool sendA
|
||||||
text = QKeySequence(key).toString().toLower();
|
text = QKeySequence(key).toString().toLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendKeyPress(text,
|
sendKeyPress(text, k, modifiers & Qt::ShiftModifier, modifiers & Qt::ControlModifier, modifiers & Qt::AltModifier, sendAck);
|
||||||
k,
|
|
||||||
modifiers & Qt::ShiftModifier,
|
|
||||||
modifiers & Qt::ControlModifier,
|
|
||||||
modifiers & Qt::AltModifier,
|
|
||||||
sendAck);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int RemoteKeyboardPlugin::translateQtKey(int qtKey) const
|
int RemoteKeyboardPlugin::translateQtKey(int qtKey) const
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
#include "runcommand_config.h"
|
#include "runcommand_config.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QFileDialog>
|
#include <QJsonDocument>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
|
@ -445,7 +445,6 @@ bool SystemvolumePlugin::receivePacket(const NetworkPacket &np)
|
||||||
setDefaultAudioPlaybackDevice(name, np.get<bool>(QStringLiteral("enabled")));
|
setDefaultAudioPlaybackDevice(name, np.get<bool>(QStringLiteral("enabled")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue