From 6d155d3d630ab530c79c14014719a7c7e0f03eb7 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 3 Apr 2018 00:11:55 +0200 Subject: [PATCH] Make considering launcher for reconnects configurable Similar to the systemd configuration --- widgets/settings/launcheroptionpage.ui | 9 +++ widgets/settings/settings.cpp | 2 + widgets/settings/settingsdialog.cpp | 4 ++ .../translations/syncthingwidgets_de_DE.ts | 55 +++++++++++-------- .../translations/syncthingwidgets_en_US.ts | 53 ++++++++++-------- 5 files changed, 77 insertions(+), 46 deletions(-) diff --git a/widgets/settings/launcheroptionpage.ui b/widgets/settings/launcheroptionpage.ui index 7e472e2..f666b22 100644 --- a/widgets/settings/launcheroptionpage.ui +++ b/widgets/settings/launcheroptionpage.ui @@ -60,6 +60,15 @@ + + + + Consider process status for reconnect attempts to local instance + • Don't reconnect when the process is not running + • Try to reconnect when starting the process + + + diff --git a/widgets/settings/settings.cpp b/widgets/settings/settings.cpp index ac781f4..27559f6 100644 --- a/widgets/settings/settings.cpp +++ b/widgets/settings/settings.cpp @@ -189,6 +189,7 @@ void restore() launcher.enabled = settings.value(QStringLiteral("syncthingAutostart"), launcher.enabled).toBool(); launcher.syncthingPath = settings.value(QStringLiteral("syncthingPath"), launcher.syncthingPath).toString(); launcher.syncthingArgs = settings.value(QStringLiteral("syncthingArgs"), launcher.syncthingArgs).toString(); + launcher.considerForReconnect = settings.value(QStringLiteral("considerLauncherForReconnect"), launcher.considerForReconnect).toBool(); settings.beginGroup(QStringLiteral("tools")); for (const QString &tool : settings.childGroups()) { settings.beginGroup(tool); @@ -274,6 +275,7 @@ void save() settings.setValue(QStringLiteral("syncthingAutostart"), launcher.enabled); settings.setValue(QStringLiteral("syncthingPath"), launcher.syncthingPath); settings.setValue(QStringLiteral("syncthingArgs"), launcher.syncthingArgs); + settings.setValue(QStringLiteral("considerLauncherForReconnect"), launcher.considerForReconnect); settings.beginGroup(QStringLiteral("tools")); for (auto i = launcher.tools.cbegin(), end = launcher.tools.cend(); i != end; ++i) { const ToolParameter &toolParams = i.value(); diff --git a/widgets/settings/settingsdialog.cpp b/widgets/settings/settingsdialog.cpp index 00b4446..6c40ea5 100644 --- a/widgets/settings/settingsdialog.cpp +++ b/widgets/settings/settingsdialog.cpp @@ -636,6 +636,8 @@ QWidget *LauncherOptionPage::setupWidget() ui()->syncthingPathLabel->setText(QCoreApplication::translate("QtGui::LauncherOptionPage", "%1 executable").arg(m_tool)); ui()->logLabel->setText(QCoreApplication::translate("QtGui::LauncherOptionPage", "%1 log (interleaved stdout/stderr)").arg(m_tool)); } + // hide "consider for reconnect" checkbox for tools + ui()->considerForReconnectCheckBox->setVisible(m_tool.isEmpty()); // setup other widgets ui()->syncthingPathSelection->provideCustomFileMode(QFileDialog::ExistingFile); ui()->logTextEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); @@ -659,6 +661,7 @@ bool LauncherOptionPage::apply() settings.enabled = ui()->enabledCheckBox->isChecked(); settings.syncthingPath = ui()->syncthingPathSelection->lineEdit()->text(); settings.syncthingArgs = ui()->argumentsLineEdit->text(); + settings.considerForReconnect = ui()->considerForReconnectCheckBox->isChecked(); } else { ToolParameter ¶ms = settings.tools[m_tool]; params.autostart = ui()->enabledCheckBox->isChecked(); @@ -675,6 +678,7 @@ void LauncherOptionPage::reset() ui()->enabledCheckBox->setChecked(settings.enabled); ui()->syncthingPathSelection->lineEdit()->setText(settings.syncthingPath); ui()->argumentsLineEdit->setText(settings.syncthingArgs); + ui()->considerForReconnectCheckBox->setChecked(settings.considerForReconnect); } else { const ToolParameter params = settings.tools.value(m_tool); ui()->enabledCheckBox->setChecked(params.autostart); diff --git a/widgets/translations/syncthingwidgets_de_DE.ts b/widgets/translations/syncthingwidgets_de_DE.ts index 2b26bb8..f423330 100644 --- a/widgets/translations/syncthingwidgets_de_DE.ts +++ b/widgets/translations/syncthingwidgets_de_DE.ts @@ -370,48 +370,57 @@ QtGui::LauncherOptionPage - + Syncthing launcher Syncthing-Starter - + Launch Syncthing when starting the tray icon Starte Syncthing beim Starten des Tray-Icons - + Syncthing executable Ausführbare Datei von Syncthing - + Arguments Argumente - + + Consider process status for reconnect attempts to local instance + • Don't reconnect when the process is not running + • Try to reconnect when starting the process + Verwende den Status des Starters für Neuverbindungsversuche zur lokalen Instanz + • Nicht versuchen neu zu verbinden, wenn Syncthing nicht läuft + • Automatisch neu verbinden, wenn Syncthing gestartet wird + + + Syncthing log (interleaved stdout/stderr) Syncthing-Log (stdout/stderr) - + Apply and launch now Jetzt starten - - + + Stop launched instance Stoppen - + No log messages available yet Bisher keine Log-Meldungen - + Ensure latest log is visible Log folgen @@ -436,19 +445,19 @@ %1-Log (stdout/stderr) - + %1 exited with exit code %2 %1 wurde mit dem Statuscode %2 beendet - + %1 crashed with exit code %2 %1 ist mit dem Statuscode %2 abgestürzt - + Kill launched instance Töten @@ -552,22 +561,22 @@ QtGui::SettingsDialog - + Tray - + Web view Weboberfläche - + Startup Starten - + Settings Einstellungen @@ -706,8 +715,8 @@ Dieser Dialog schließt sich automatisch, wenn der Prozess beendet wird. - - + + unknown unbekannt @@ -741,12 +750,12 @@ Dieser Dialog schließt sich automatisch, wenn der Prozess beendet wird.Stoppen - + specified unit is either inactive or doesn't exist angegebene Unit ist entweder nicht geladen oder existiert nicht - + since seit @@ -813,7 +822,7 @@ Dieser Dialog schließt sich automatisch, wenn der Prozess beendet wird.QtGui::WebViewOptionPage - + General Allgemein @@ -843,7 +852,7 @@ Dieser Dialog schließt sich automatisch, wenn der Prozess beendet wird.Lasse Weboberfläche im Hintgergrund weiter offen, wenn Fenster nicht offen - + Syncthing Tray has not been built with vieb view support utilizing either Qt WebKit or Qt WebEngine. The Web UI will be opened in the default web browser instead. Syncthing Tray wurde nicht mit Unterstützung für die eingebaute Anzeige der Weboberfläche unter Verwendung von Qt WebKit oder Qt WebEngine gebaut. diff --git a/widgets/translations/syncthingwidgets_en_US.ts b/widgets/translations/syncthingwidgets_en_US.ts index 246b856..102417f 100644 --- a/widgets/translations/syncthingwidgets_en_US.ts +++ b/widgets/translations/syncthingwidgets_en_US.ts @@ -370,48 +370,55 @@ QtGui::LauncherOptionPage - + Syncthing launcher - + Launch Syncthing when starting the tray icon - + Syncthing executable - + Arguments - + + Consider process status for reconnect attempts to local instance + • Don't reconnect when the process is not running + • Try to reconnect when starting the process + + + + Syncthing log (interleaved stdout/stderr) - + Apply and launch now - - + + Stop launched instance - + No log messages available yet - + Ensure latest log is visible @@ -436,19 +443,19 @@ - + %1 exited with exit code %2 - + %1 crashed with exit code %2 - + Kill launched instance @@ -552,22 +559,22 @@ QtGui::SettingsDialog - + Tray - + Web view - + Startup - + Settings @@ -701,8 +708,8 @@ This dialog closes automatically when the process finally terminates. - - + + unknown @@ -737,12 +744,12 @@ This dialog closes automatically when the process finally terminates. - + specified unit is either inactive or doesn't exist - + since @@ -809,7 +816,7 @@ This dialog closes automatically when the process finally terminates. QtGui::WebViewOptionPage - + General @@ -839,7 +846,7 @@ This dialog closes automatically when the process finally terminates. - + Syncthing Tray has not been built with vieb view support utilizing either Qt WebKit or Qt WebEngine. The Web UI will be opened in the default web browser instead.