Apply clang-format
This commit is contained in:
parent
335913c8ca
commit
c521e2f808
|
@ -101,9 +101,10 @@ void SyncthingNotifier::handleSyncthingProcessError(QProcess::ProcessError proce
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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());
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -220,7 +221,7 @@ void TrayIcon::showLauncherError(const QString &errorMessage, const QString &add
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
m_messageClickedAction = TrayIconMessageClickedAction::None;
|
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();
|
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();
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ void TrayWidget::updateOverallStatistics()
|
||||||
|
|
||||||
void TrayWidget::toggleRunning()
|
void TrayWidget::toggleRunning()
|
||||||
{
|
{
|
||||||
switch(m_startStopButtonTarget) {
|
switch (m_startStopButtonTarget) {
|
||||||
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||||
case StartStopButtonTarget::Service:
|
case StartStopButtonTarget::Service:
|
||||||
if (auto *const service = SyncthingService::mainInstance()) {
|
if (auto *const service = SyncthingService::mainInstance()) {
|
||||||
|
@ -566,8 +566,7 @@ void TrayWidget::toggleRunning()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,9 +588,8 @@ 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) {
|
||||||
return launcherStatus;
|
return launcherStatus;
|
||||||
|
@ -626,7 +624,7 @@ Settings::Systemd::ServiceStatus TrayWidget::handleSystemdStatusChanged()
|
||||||
const auto launcherStatus = applyLauncherSettings(false, true, false);
|
const auto launcherStatus = applyLauncherSettings(false, true, false);
|
||||||
m_ui->startStopPushButton->setVisible(launcherStatus.showStartStopButton);
|
m_ui->startStopPushButton->setVisible(launcherStatus.showStartStopButton);
|
||||||
|
|
||||||
return systemdStatus;
|
return systemdStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::Systemd::ServiceStatus TrayWidget::applySystemdSettings(bool reconnectRequired)
|
Settings::Systemd::ServiceStatus TrayWidget::applySystemdSettings(bool reconnectRequired)
|
||||||
|
|
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ inline void DBusStatusNotifier::showInternalError(const InternalError &error)
|
||||||
|
|
||||||
inline void QtGui::DBusStatusNotifier::showLauncherError(const QString &errorMessage, const QString &additionalInfo)
|
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)
|
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);
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -116,15 +117,14 @@ void SyncthingLauncher::handleProcessReadyRead()
|
||||||
|
|
||||||
void SyncthingLauncher::handleProcessStateChanged(QProcess::ProcessState newState)
|
void SyncthingLauncher::handleProcessStateChanged(QProcess::ProcessState newState)
|
||||||
{
|
{
|
||||||
switch(newState) {
|
switch (newState) {
|
||||||
case QProcess::NotRunning:
|
case QProcess::NotRunning:
|
||||||
emit runningChanged(false);
|
emit runningChanged(false);
|
||||||
break;
|
break;
|
||||||
case QProcess::Starting:
|
case QProcess::Starting:
|
||||||
emit runningChanged(true);
|
emit runningChanged(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
@ -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{};
|
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()
|
||||||
|
@ -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{};
|
return ServiceStatus{};
|
||||||
}
|
}
|
||||||
const auto isRelevant = service->isSystemdAvailable() && connection.isLocal();
|
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
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue