Apply clang-format

This commit is contained in:
Martchus 2019-07-13 13:21:25 +02:00
parent 335913c8ca
commit c521e2f808
9 changed files with 33 additions and 32 deletions

View File

@ -103,7 +103,8 @@ void SyncthingNotifier::handleSyncthingProcessError(QProcess::ProcessError proce
switch (processError) { switch (processError) {
case QProcess::FailedToStart: 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; break;
case QProcess::Crashed: case QProcess::Crashed:
emit syncthingProcessError(tr("Syncthing crashed with exit code %1").arg(m_process->exitCode()), QString()); emit syncthingProcessError(tr("Syncthing crashed with exit code %1").arg(m_process->exitCode()), QString());

View File

@ -192,7 +192,8 @@ void TrayIcon::handleErrorsCleared()
m_errorsAction->setVisible(false); 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)) { if (!InternalError::isRelevant(m_trayMenu.widget().connection(), category, networkError)) {
return; return;

View File

@ -32,8 +32,8 @@ public:
TrayMenu &trayMenu(); TrayMenu &trayMenu();
public slots: public slots:
void showInternalError( void showInternalError(const QString &errorMessage, Data::SyncthingErrorCategory category, int networkError, const QNetworkRequest &request,
const QString &errorMessage, Data::SyncthingErrorCategory category, int networkError, const QNetworkRequest &request, const QByteArray &response); const QByteArray &response);
void showLauncherError(const QString &errorMessage, const QString &additionalInfo); void showLauncherError(const QString &errorMessage, const QString &additionalInfo);
void showSyncthingNotification(CppUtilities::DateTime when, const QString &message); void showSyncthingNotification(CppUtilities::DateTime when, const QString &message);
void showInternalErrorsDialog(); void showInternalErrorsDialog();

View File

@ -3,8 +3,8 @@
#include "./traymenu.h" #include "./traymenu.h"
#include "../../widgets/misc/otherdialogs.h" #include "../../widgets/misc/otherdialogs.h"
#include "../../widgets/misc/textviewdialog.h"
#include "../../widgets/misc/syncthinglauncher.h" #include "../../widgets/misc/syncthinglauncher.h"
#include "../../widgets/misc/textviewdialog.h"
#include "../../widgets/settings/settingsdialog.h" #include "../../widgets/settings/settingsdialog.h"
#include "../../widgets/webview/webviewdialog.h" #include "../../widgets/webview/webviewdialog.h"
@ -566,8 +566,7 @@ void TrayWidget::toggleRunning()
} }
} }
break; break;
default: default:;
;
} }
} }
@ -589,8 +588,7 @@ Settings::Launcher::LauncherStatus TrayWidget::applyLauncherSettings(bool reconn
{ {
// update connection // update connection
const auto &launcherSettings = Settings::values().launcher; const auto &launcherSettings = Settings::values().launcher;
const auto launcherStatus = skipApplyingToConnection const auto launcherStatus = skipApplyingToConnection ? launcherSettings.status(m_connection)
? launcherSettings.status(m_connection)
: launcherSettings.apply(m_connection, m_selectedConnection, reconnectRequired); : launcherSettings.apply(m_connection, m_selectedConnection, reconnectRequired);
if (skipStartStopButton || !launcherStatus.showStartStopButton) { if (skipStartStopButton || !launcherStatus.showStartStopButton) {

View File

@ -78,7 +78,8 @@ private slots:
void updateOverallStatistics(); void updateOverallStatistics();
void toggleRunning(); void toggleRunning();
Settings::Launcher::LauncherStatus handleLauncherStatusChanged(); 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 #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
Settings::Systemd::ServiceStatus handleSystemdStatusChanged(); Settings::Systemd::ServiceStatus handleSystemdStatusChanged();
Settings::Systemd::ServiceStatus applySystemdSettings(bool reconnectRequired = false); Settings::Systemd::ServiceStatus applySystemdSettings(bool reconnectRequired = false);
@ -109,9 +110,7 @@ private:
Data::SyncthingConnectionSettings *m_selectedConnection; Data::SyncthingConnectionSettings *m_selectedConnection;
QMenu *m_notificationsMenu; QMenu *m_notificationsMenu;
std::vector<Data::SyncthingLogEntry> m_notifications; std::vector<Data::SyncthingLogEntry> m_notifications;
enum class StartStopButtonTarget { enum class StartStopButtonTarget { None, Service, Launcher } m_startStopButtonTarget;
None, Service, Launcher
} m_startStopButtonTarget;
static std::vector<TrayWidget *> m_instances; static std::vector<TrayWidget *> m_instances;
}; };

View File

@ -66,7 +66,8 @@ void SyncthingLauncher::launch(const Settings::Launcher &launcherSettings)
emit errorOccurred(QProcess::FailedToStart); emit errorOccurred(QProcess::FailedToStart);
return; return;
} }
launch(launcherSettings.useLibSyncthing ? QString() : launcherSettings.syncthingPath, SyncthingProcess::splitArguments(launcherSettings.syncthingArgs)); launch(launcherSettings.useLibSyncthing ? QString() : launcherSettings.syncthingPath,
SyncthingProcess::splitArguments(launcherSettings.syncthingArgs));
} }
/*! /*!
@ -123,8 +124,7 @@ void SyncthingLauncher::handleProcessStateChanged(QProcess::ProcessState newStat
case QProcess::Starting: case QProcess::Starting:
emit runningChanged(true); emit runningChanged(true);
break; break;
default: default:;
;
} }
} }

View File

@ -3,9 +3,9 @@
#include "../misc/syncthingkiller.h" #include "../misc/syncthingkiller.h"
#include "../misc/syncthinglauncher.h" #include "../misc/syncthinglauncher.h"
#include "../../connector/syncthingconnection.h"
#include "../../connector/syncthingnotifier.h" #include "../../connector/syncthingnotifier.h"
#include "../../connector/syncthingprocess.h" #include "../../connector/syncthingprocess.h"
#include "../../connector/syncthingconnection.h"
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
#include "../../connector/syncthingservice.h" #include "../../connector/syncthingservice.h"
#endif #endif
@ -145,9 +145,7 @@ Launcher::LauncherStatus Launcher::status(SyncthingConnection &connection) const
return LauncherStatus{}; return LauncherStatus{};
} }
const auto isRelevant = connection.isLocal(); const auto isRelevant = connection.isLocal();
return LauncherStatus{ return LauncherStatus{ isRelevant, launcher->isRunning(), considerForReconnect && isRelevant, showButton && isRelevant };
isRelevant, launcher->isRunning(), considerForReconnect && isRelevant, showButton && isRelevant
};
} }
Settings &values() Settings &values()

View File

@ -1039,11 +1039,15 @@ bool SystemdOptionPage::apply()
systemdSettings.considerForReconnect = ui()->considerForReconnectCheckBox->isChecked(); systemdSettings.considerForReconnect = ui()->considerForReconnectCheckBox->isChecked();
auto result = true; auto result = true;
if (systemdSettings.showButton && launcherSettings.showButton) { 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; result = false;
} }
if (systemdSettings.considerForReconnect && launcherSettings.considerForReconnect) { 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; result = false;
} }
return result; return result;