Apply clang-format
This commit is contained in:
parent
10fd09901b
commit
7edaacc677
|
@ -117,15 +117,14 @@ void SyncthingService::setupSystemdInterface()
|
||||||
|
|
||||||
// ensure the static systemd interface for the current scope is initialized
|
// ensure the static systemd interface for the current scope is initialized
|
||||||
const auto isUserScope = m_scope == SystemdScope::User;
|
const auto isUserScope = m_scope == SystemdScope::User;
|
||||||
OrgFreedesktopSystemd1ManagerInterface *&staticSystemdInterface
|
OrgFreedesktopSystemd1ManagerInterface *&staticSystemdInterface = isUserScope ? s_systemdUserInterface : s_systemdSystemInterface;
|
||||||
= isUserScope ? s_systemdUserInterface : s_systemdSystemInterface;
|
|
||||||
if (!staticSystemdInterface) {
|
if (!staticSystemdInterface) {
|
||||||
// register custom data types
|
// register custom data types
|
||||||
qDBusRegisterMetaType<ManagerDBusUnitFileChange>();
|
qDBusRegisterMetaType<ManagerDBusUnitFileChange>();
|
||||||
qDBusRegisterMetaType<ManagerDBusUnitFileChangeList>();
|
qDBusRegisterMetaType<ManagerDBusUnitFileChangeList>();
|
||||||
|
|
||||||
staticSystemdInterface = new OrgFreedesktopSystemd1ManagerInterface(
|
staticSystemdInterface = new OrgFreedesktopSystemd1ManagerInterface(QStringLiteral("org.freedesktop.systemd1"),
|
||||||
QStringLiteral("org.freedesktop.systemd1"), QStringLiteral("/org/freedesktop/systemd1"), isUserScope ? QDBusConnection::sessionBus() : QDBusConnection::systemBus());
|
QStringLiteral("/org/freedesktop/systemd1"), isUserScope ? QDBusConnection::sessionBus() : QDBusConnection::systemBus());
|
||||||
|
|
||||||
// enable systemd to emit signals
|
// enable systemd to emit signals
|
||||||
staticSystemdInterface->Subscribe();
|
staticSystemdInterface->Subscribe();
|
||||||
|
@ -160,8 +159,7 @@ void SyncthingService::setupFreedesktopLoginInterface()
|
||||||
/*!
|
/*!
|
||||||
* \brief Registers the specified D-Bus \a call to invoke \a handler when it has been concluded.
|
* \brief Registers the specified D-Bus \a call to invoke \a handler when it has been concluded.
|
||||||
*/
|
*/
|
||||||
template<typename HandlerType>
|
template <typename HandlerType> void SyncthingService::makeAsyncCall(const QDBusPendingCall &call, HandlerType &&handler)
|
||||||
void SyncthingService::makeAsyncCall(const QDBusPendingCall &call, HandlerType &&handler)
|
|
||||||
{
|
{
|
||||||
if (m_currentSystemdInterface) {
|
if (m_currentSystemdInterface) {
|
||||||
// disconnect from unit add/removed signals because these seem to be spammed when waiting for permissions
|
// disconnect from unit add/removed signals because these seem to be spammed when waiting for permissions
|
||||||
|
|
|
@ -114,8 +114,7 @@ private Q_SLOTS:
|
||||||
private:
|
private:
|
||||||
void setupSystemdInterface();
|
void setupSystemdInterface();
|
||||||
void setupFreedesktopLoginInterface();
|
void setupFreedesktopLoginInterface();
|
||||||
template<typename HandlerType>
|
template <typename HandlerType> void makeAsyncCall(const QDBusPendingCall &call, HandlerType &&handler);
|
||||||
void makeAsyncCall(const QDBusPendingCall &call, HandlerType &&handler);
|
|
||||||
void registerErrorHandler(const QDBusPendingCall &call, const char *context);
|
void registerErrorHandler(const QDBusPendingCall &call, const char *context);
|
||||||
bool concludeAsyncCall(QDBusPendingCallWatcher *watcher);
|
bool concludeAsyncCall(QDBusPendingCallWatcher *watcher);
|
||||||
void clearSystemdInterface();
|
void clearSystemdInterface();
|
||||||
|
|
|
@ -488,7 +488,8 @@ void ConnectionTests::checkDirectories() const
|
||||||
const auto devNames = QSet(dir1.deviceNames.begin(), dir1.deviceNames.end());
|
const auto devNames = QSet(dir1.deviceNames.begin(), dir1.deviceNames.end());
|
||||||
#endif
|
#endif
|
||||||
CPPUNIT_ASSERT_EQUAL(QSet<QString>({ QStringLiteral("MMGUI6U-WUEZQCP-XZZ6VYB-LCT4TVC-ER2HAVX-QYT6X7D-S6ZSG2B-323KLQ7"),
|
CPPUNIT_ASSERT_EQUAL(QSet<QString>({ QStringLiteral("MMGUI6U-WUEZQCP-XZZ6VYB-LCT4TVC-ER2HAVX-QYT6X7D-S6ZSG2B-323KLQ7"),
|
||||||
QStringLiteral("6EIS2PN-J2IHWGS-AXS3YUL-HC5FT3K-77ZXTLL-AKQLJ4C-7SWVPUS-AZW4RQ4") }), devIds);
|
QStringLiteral("6EIS2PN-J2IHWGS-AXS3YUL-HC5FT3K-77ZXTLL-AKQLJ4C-7SWVPUS-AZW4RQ4") }),
|
||||||
|
devIds);
|
||||||
CPPUNIT_ASSERT_EQUAL(QSet<QString>({ QStringLiteral("Test dev 2"), QStringLiteral("Test dev 1") }), devNames);
|
CPPUNIT_ASSERT_EQUAL(QSet<QString>({ QStringLiteral("Test dev 2"), QStringLiteral("Test dev 1") }), devNames);
|
||||||
const SyncthingDir &dir2 = dirInfo.back();
|
const SyncthingDir &dir2 = dirInfo.back();
|
||||||
CPPUNIT_ASSERT_EQUAL(QStringLiteral("test2"), dir2.id);
|
CPPUNIT_ASSERT_EQUAL(QStringLiteral("test2"), dir2.id);
|
||||||
|
@ -506,8 +507,7 @@ void ConnectionTests::checkDirectories() const
|
||||||
const auto devIds2 = QSet(dir2.deviceIds.begin(), dir2.deviceIds.end());
|
const auto devIds2 = QSet(dir2.deviceIds.begin(), dir2.deviceIds.end());
|
||||||
const auto devNames2 = QSet(dir2.deviceNames.begin(), dir2.deviceNames.end());
|
const auto devNames2 = QSet(dir2.deviceNames.begin(), dir2.deviceNames.end());
|
||||||
#endif
|
#endif
|
||||||
CPPUNIT_ASSERT_EQUAL(
|
CPPUNIT_ASSERT_EQUAL(QSet<QString>({ QStringLiteral("MMGUI6U-WUEZQCP-XZZ6VYB-LCT4TVC-ER2HAVX-QYT6X7D-S6ZSG2B-323KLQ7") }), devIds2);
|
||||||
QSet<QString>({ QStringLiteral("MMGUI6U-WUEZQCP-XZZ6VYB-LCT4TVC-ER2HAVX-QYT6X7D-S6ZSG2B-323KLQ7") }), devIds2);
|
|
||||||
CPPUNIT_ASSERT_EQUAL(QSet<QString>({ QStringLiteral("Test dev 2") }), devNames2);
|
CPPUNIT_ASSERT_EQUAL(QSet<QString>({ QStringLiteral("Test dev 2") }), devNames2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue