Apply clang-format
This commit is contained in:
parent
335913c8ca
commit
c521e2f808
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<Data::SyncthingLogEntry> m_notifications;
|
||||
enum class StartStopButtonTarget {
|
||||
None, Service, Launcher
|
||||
} m_startStopButtonTarget;
|
||||
enum class StartStopButtonTarget { None, Service, Launcher } m_startStopButtonTarget;
|
||||
static std::vector<TrayWidget *> m_instances;
|
||||
};
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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:;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue