diff --git a/connector/syncthingnotifier.cpp b/connector/syncthingnotifier.cpp index 596de35..a90e274 100644 --- a/connector/syncthingnotifier.cpp +++ b/connector/syncthingnotifier.cpp @@ -101,9 +101,10 @@ void SyncthingNotifier::handleSyncthingProcessError(QProcess::ProcessError proce return; } - switch(processError) { + switch (processError) { case QProcess::FailedToStart: - emit syncthingProcessError(tr("Failed to start Syncthing"), tr("Maybe the configured binary path is wrong or the binary is not marked as executable.")); + emit syncthingProcessError( + tr("Failed to start Syncthing"), tr("Maybe the configured binary path is wrong or the binary is not marked as executable.")); break; case QProcess::Crashed: emit syncthingProcessError(tr("Syncthing crashed with exit code %1").arg(m_process->exitCode()), QString()); diff --git a/tray/gui/trayicon.cpp b/tray/gui/trayicon.cpp index 7480252..b84b282 100644 --- a/tray/gui/trayicon.cpp +++ b/tray/gui/trayicon.cpp @@ -192,7 +192,8 @@ void TrayIcon::handleErrorsCleared() m_errorsAction->setVisible(false); } -void TrayIcon::showInternalError(const QString &errorMessage, SyncthingErrorCategory category, int networkError, const QNetworkRequest &request, const QByteArray &response) +void TrayIcon::showInternalError( + const QString &errorMessage, SyncthingErrorCategory category, int networkError, const QNetworkRequest &request, const QByteArray &response) { if (!InternalError::isRelevant(m_trayMenu.widget().connection(), category, networkError)) { return; @@ -220,7 +221,7 @@ void TrayIcon::showLauncherError(const QString &errorMessage, const QString &add #endif { m_messageClickedAction = TrayIconMessageClickedAction::None; - showMessage(tr("Launcher error"), QStringList({errorMessage, additionalInfo}).join(QChar('\n')), QSystemTrayIcon::Critical); + showMessage(tr("Launcher error"), QStringList({ errorMessage, additionalInfo }).join(QChar('\n')), QSystemTrayIcon::Critical); } } diff --git a/tray/gui/trayicon.h b/tray/gui/trayicon.h index 3e2b3d8..1891905 100644 --- a/tray/gui/trayicon.h +++ b/tray/gui/trayicon.h @@ -32,8 +32,8 @@ public: TrayMenu &trayMenu(); public slots: - void showInternalError( - const QString &errorMessage, Data::SyncthingErrorCategory category, int networkError, const QNetworkRequest &request, const QByteArray &response); + void showInternalError(const QString &errorMessage, Data::SyncthingErrorCategory category, int networkError, const QNetworkRequest &request, + const QByteArray &response); void showLauncherError(const QString &errorMessage, const QString &additionalInfo); void showSyncthingNotification(CppUtilities::DateTime when, const QString &message); void showInternalErrorsDialog(); diff --git a/tray/gui/traywidget.cpp b/tray/gui/traywidget.cpp index 6cf5eca..8639890 100644 --- a/tray/gui/traywidget.cpp +++ b/tray/gui/traywidget.cpp @@ -3,8 +3,8 @@ #include "./traymenu.h" #include "../../widgets/misc/otherdialogs.h" -#include "../../widgets/misc/textviewdialog.h" #include "../../widgets/misc/syncthinglauncher.h" +#include "../../widgets/misc/textviewdialog.h" #include "../../widgets/settings/settingsdialog.h" #include "../../widgets/webview/webviewdialog.h" @@ -549,7 +549,7 @@ void TrayWidget::updateOverallStatistics() void TrayWidget::toggleRunning() { - switch(m_startStopButtonTarget) { + switch (m_startStopButtonTarget) { #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD case StartStopButtonTarget::Service: if (auto *const service = SyncthingService::mainInstance()) { @@ -566,8 +566,7 @@ void TrayWidget::toggleRunning() } } break; - default: - ; + default:; } } @@ -589,9 +588,8 @@ Settings::Launcher::LauncherStatus TrayWidget::applyLauncherSettings(bool reconn { // update connection const auto &launcherSettings = Settings::values().launcher; - const auto launcherStatus = skipApplyingToConnection - ? launcherSettings.status(m_connection) - : launcherSettings.apply(m_connection, m_selectedConnection, reconnectRequired); + const auto launcherStatus = skipApplyingToConnection ? launcherSettings.status(m_connection) + : launcherSettings.apply(m_connection, m_selectedConnection, reconnectRequired); if (skipStartStopButton || !launcherStatus.showStartStopButton) { return launcherStatus; @@ -626,7 +624,7 @@ Settings::Systemd::ServiceStatus TrayWidget::handleSystemdStatusChanged() const auto launcherStatus = applyLauncherSettings(false, true, false); m_ui->startStopPushButton->setVisible(launcherStatus.showStartStopButton); - return systemdStatus; + return systemdStatus; } Settings::Systemd::ServiceStatus TrayWidget::applySystemdSettings(bool reconnectRequired) diff --git a/tray/gui/traywidget.h b/tray/gui/traywidget.h index 1079ec6..fc651f9 100644 --- a/tray/gui/traywidget.h +++ b/tray/gui/traywidget.h @@ -78,7 +78,8 @@ private slots: void updateOverallStatistics(); void toggleRunning(); Settings::Launcher::LauncherStatus handleLauncherStatusChanged(); - Settings::Launcher::LauncherStatus applyLauncherSettings(bool reconnectRequired = false, bool skipApplyingToConnection = false, bool skipStartStopButton = false); + Settings::Launcher::LauncherStatus applyLauncherSettings( + bool reconnectRequired = false, bool skipApplyingToConnection = false, bool skipStartStopButton = false); #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD Settings::Systemd::ServiceStatus handleSystemdStatusChanged(); Settings::Systemd::ServiceStatus applySystemdSettings(bool reconnectRequired = false); @@ -109,9 +110,7 @@ private: Data::SyncthingConnectionSettings *m_selectedConnection; QMenu *m_notificationsMenu; std::vector m_notifications; - enum class StartStopButtonTarget { - None, Service, Launcher - } m_startStopButtonTarget; + enum class StartStopButtonTarget { None, Service, Launcher } m_startStopButtonTarget; static std::vector m_instances; }; diff --git a/widgets/misc/dbusstatusnotifier.h b/widgets/misc/dbusstatusnotifier.h index 81e301b..aa0e332 100644 --- a/widgets/misc/dbusstatusnotifier.h +++ b/widgets/misc/dbusstatusnotifier.h @@ -71,7 +71,7 @@ inline void DBusStatusNotifier::showInternalError(const InternalError &error) inline void QtGui::DBusStatusNotifier::showLauncherError(const QString &errorMessage, const QString &additionalInfo) { - m_launcherErrorNotification.update(QStringList({errorMessage, additionalInfo}).join(QStringLiteral("\n "))); + m_launcherErrorNotification.update(QStringList({ errorMessage, additionalInfo }).join(QStringLiteral("\n "))); } inline void DBusStatusNotifier::showSyncthingNotification(CppUtilities::DateTime when, const QString &message) diff --git a/widgets/misc/syncthinglauncher.cpp b/widgets/misc/syncthinglauncher.cpp index 39a1dc7..dab41df 100644 --- a/widgets/misc/syncthinglauncher.cpp +++ b/widgets/misc/syncthinglauncher.cpp @@ -66,7 +66,8 @@ void SyncthingLauncher::launch(const Settings::Launcher &launcherSettings) emit errorOccurred(QProcess::FailedToStart); return; } - launch(launcherSettings.useLibSyncthing ? QString() : launcherSettings.syncthingPath, SyncthingProcess::splitArguments(launcherSettings.syncthingArgs)); + launch(launcherSettings.useLibSyncthing ? QString() : launcherSettings.syncthingPath, + SyncthingProcess::splitArguments(launcherSettings.syncthingArgs)); } /*! @@ -116,15 +117,14 @@ void SyncthingLauncher::handleProcessReadyRead() void SyncthingLauncher::handleProcessStateChanged(QProcess::ProcessState newState) { - switch(newState) { + switch (newState) { case QProcess::NotRunning: emit runningChanged(false); break; case QProcess::Starting: emit runningChanged(true); break; - default: - ; + default:; } } diff --git a/widgets/settings/settings.cpp b/widgets/settings/settings.cpp index dc7bf4b..5406f84 100644 --- a/widgets/settings/settings.cpp +++ b/widgets/settings/settings.cpp @@ -3,9 +3,9 @@ #include "../misc/syncthingkiller.h" #include "../misc/syncthinglauncher.h" +#include "../../connector/syncthingconnection.h" #include "../../connector/syncthingnotifier.h" #include "../../connector/syncthingprocess.h" -#include "../../connector/syncthingconnection.h" #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD #include "../../connector/syncthingservice.h" #endif @@ -132,7 +132,7 @@ Launcher::LauncherStatus Launcher::apply( } } - return LauncherStatus{isRelevant, isRunning, consideredForReconnect, showButton && isRelevant}; + return LauncherStatus{ isRelevant, isRunning, consideredForReconnect, showButton && isRelevant }; } /*! @@ -145,9 +145,7 @@ Launcher::LauncherStatus Launcher::status(SyncthingConnection &connection) const return LauncherStatus{}; } const auto isRelevant = connection.isLocal(); - return LauncherStatus{ - isRelevant, launcher->isRunning(), considerForReconnect && isRelevant, showButton && isRelevant - }; + return LauncherStatus{ isRelevant, launcher->isRunning(), considerForReconnect && isRelevant, showButton && isRelevant }; } Settings &values() @@ -439,7 +437,7 @@ Systemd::ServiceStatus Systemd::apply( } } - return ServiceStatus{isRelevant, isRunning, consideredForReconnect, showButton && isRelevant}; + return ServiceStatus{ isRelevant, isRunning, consideredForReconnect, showButton && isRelevant }; } /*! @@ -452,7 +450,7 @@ Systemd::ServiceStatus Systemd::status(SyncthingConnection &connection) const return ServiceStatus{}; } const auto isRelevant = service->isSystemdAvailable() && connection.isLocal(); - return ServiceStatus{isRelevant, service->isRunning(), considerForReconnect && isRelevant, showButton && isRelevant}; + return ServiceStatus{ isRelevant, service->isRunning(), considerForReconnect && isRelevant, showButton && isRelevant }; } #endif diff --git a/widgets/settings/settingsdialog.cpp b/widgets/settings/settingsdialog.cpp index 8938462..6c0d2c9 100644 --- a/widgets/settings/settingsdialog.cpp +++ b/widgets/settings/settingsdialog.cpp @@ -1039,11 +1039,15 @@ bool SystemdOptionPage::apply() systemdSettings.considerForReconnect = ui()->considerForReconnectCheckBox->isChecked(); auto result = true; if (systemdSettings.showButton && launcherSettings.showButton) { - errors().append(QCoreApplication::translate("QtGui::SystemdOptionPage", "It is not possible to show the start/stop button for the systemd service and the internal launcher at the same time. The systemd service precedes.")); + errors().append(QCoreApplication::translate("QtGui::SystemdOptionPage", + "It is not possible to show the start/stop button for the systemd service and the internal launcher at the same time. The systemd " + "service precedes.")); result = false; } if (systemdSettings.considerForReconnect && launcherSettings.considerForReconnect) { - errors().append(QCoreApplication::translate("QtGui::SystemdOptionPage", "It is not possible to consider the systemd service and the internal launcher for reconnects at the same time. The systemd service precedes.")); + errors().append(QCoreApplication::translate("QtGui::SystemdOptionPage", + "It is not possible to consider the systemd service and the internal launcher for reconnects at the same time. The systemd service " + "precedes.")); result = false; } return result;