Add default args for Syncthing launcher
This commit is contained in:
parent
5b45f02fb5
commit
3d5869f8e1
|
@ -0,0 +1,13 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||||
|
<defs id="defs3051">
|
||||||
|
<style type="text/css" id="current-color-scheme">
|
||||||
|
.ColorScheme-Text {
|
||||||
|
color:#232629;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<path style="fill:currentColor;fill-opacity:1;stroke:none"
|
||||||
|
d="M 6.5 2 L 3.21875 5.28125 L 3 5.5 L 3.21875 5.71875 L 6.5 9 L 7.21875 8.28125 L 4.90625 6 L 6 6 L 7.1875 6 L 8 6 L 8.5 6 C 10.432998 6 12 7.5669984 12 9.5 C 12 11.433002 10.432998 13 8.5 13 L 8 13 L 7 13 L 7 14 L 8 14 L 8.5 14 C 10.985283 14 13 11.985252 13 9.5 C 13 7.0147479 10.985283 5 8.5 5 L 8 5 L 7.1875 5 L 6 5 L 4.90625 5 L 7.21875 2.71875 L 6.5 2 z "
|
||||||
|
class="ColorScheme-Text"
|
||||||
|
/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 694 B |
|
@ -12,5 +12,6 @@
|
||||||
<file>icons/hicolor/scalable/actions/globe.svg</file>
|
<file>icons/hicolor/scalable/actions/globe.svg</file>
|
||||||
<file>icons/hicolor/scalable/places/user-home.svg</file>
|
<file>icons/hicolor/scalable/places/user-home.svg</file>
|
||||||
<file>icons/hicolor/scalable/emblems/emblem-important-old.svg</file>
|
<file>icons/hicolor/scalable/emblems/emblem-important-old.svg</file>
|
||||||
|
<file>icons/hicolor/scalable/actions/edit-undo.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -67,7 +67,7 @@ struct SYNCTHINGWIDGETS_EXPORT Launcher {
|
||||||
#else
|
#else
|
||||||
QStringLiteral("syncthing");
|
QStringLiteral("syncthing");
|
||||||
#endif
|
#endif
|
||||||
QString syncthingArgs;
|
QString syncthingArgs = QStringLiteral("-no-browser -no-restart -logflags=3");
|
||||||
QHash<QString, ToolParameter> tools;
|
QHash<QString, ToolParameter> tools;
|
||||||
bool considerForReconnect = false;
|
bool considerForReconnect = false;
|
||||||
static Data::SyncthingProcess &toolProcess(const QString &tool);
|
static Data::SyncthingProcess &toolProcess(const QString &tool);
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <qtutilities/settingsdialog/optioncategory.h>
|
#include <qtutilities/settingsdialog/optioncategory.h>
|
||||||
#include <qtutilities/settingsdialog/optioncategorymodel.h>
|
#include <qtutilities/settingsdialog/optioncategorymodel.h>
|
||||||
#include <qtutilities/settingsdialog/qtsettings.h>
|
#include <qtutilities/settingsdialog/qtsettings.h>
|
||||||
|
#include <qtutilities/widgets/iconbutton.h>
|
||||||
#ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS
|
#ifdef QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS
|
||||||
#include <qtutilities/misc/dbusnotification.h>
|
#include <qtutilities/misc/dbusnotification.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -738,6 +739,7 @@ LauncherOptionPage::LauncherOptionPage(const QString &tool, QWidget *parentWidge
|
||||||
: LauncherOptionPageBase(parentWidget)
|
: LauncherOptionPageBase(parentWidget)
|
||||||
, m_process(&Launcher::toolProcess(tool))
|
, m_process(&Launcher::toolProcess(tool))
|
||||||
, m_launcher(nullptr)
|
, m_launcher(nullptr)
|
||||||
|
, m_restoreArgsButton(nullptr)
|
||||||
, m_kill(false)
|
, m_kill(false)
|
||||||
, m_tool(tool)
|
, m_tool(tool)
|
||||||
{
|
{
|
||||||
|
@ -753,6 +755,7 @@ LauncherOptionPage::~LauncherOptionPage()
|
||||||
QWidget *LauncherOptionPage::setupWidget()
|
QWidget *LauncherOptionPage::setupWidget()
|
||||||
{
|
{
|
||||||
auto *const widget = LauncherOptionPageBase::setupWidget();
|
auto *const widget = LauncherOptionPageBase::setupWidget();
|
||||||
|
|
||||||
// adjust labels to use name of additional tool instead of "Syncthing"
|
// adjust labels to use name of additional tool instead of "Syncthing"
|
||||||
if (!m_tool.isEmpty()) {
|
if (!m_tool.isEmpty()) {
|
||||||
widget->setWindowTitle(QCoreApplication::translate("QtGui::LauncherOptionPage", "%1-launcher").arg(m_tool));
|
widget->setWindowTitle(QCoreApplication::translate("QtGui::LauncherOptionPage", "%1-launcher").arg(m_tool));
|
||||||
|
@ -760,8 +763,20 @@ QWidget *LauncherOptionPage::setupWidget()
|
||||||
ui()->syncthingPathLabel->setText(QCoreApplication::translate("QtGui::LauncherOptionPage", "%1 executable").arg(m_tool));
|
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));
|
ui()->logLabel->setText(QCoreApplication::translate("QtGui::LauncherOptionPage", "%1 log (interleaved stdout/stderr)").arg(m_tool));
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide "consider for reconnect" checkbox for tools
|
// hide "consider for reconnect" checkbox for tools
|
||||||
ui()->considerForReconnectCheckBox->setVisible(m_tool.isEmpty());
|
ui()->considerForReconnectCheckBox->setVisible(m_tool.isEmpty());
|
||||||
|
|
||||||
|
// add "restore to defaults" action for arguments
|
||||||
|
if (m_tool.isEmpty()) {
|
||||||
|
m_restoreArgsButton = new IconButton(ui()->argumentsLineEdit);
|
||||||
|
m_restoreArgsButton->setPixmap(
|
||||||
|
QIcon::fromTheme(QStringLiteral("edit-undo"), QIcon(QStringLiteral(":/icons/hicolor/scalable/actions/edit-paste.svg"))).pixmap(16));
|
||||||
|
m_restoreArgsButton->setToolTip(QCoreApplication::translate("QtGui::LauncherOptionPage", "Restore default"));
|
||||||
|
QObject::connect(m_restoreArgsButton, &IconButton::clicked, bind(&LauncherOptionPage::restoreDefaultArguments, this));
|
||||||
|
ui()->argumentsLineEdit->insertCustomButton(0, m_restoreArgsButton);
|
||||||
|
}
|
||||||
|
|
||||||
// setup other widgets
|
// setup other widgets
|
||||||
ui()->syncthingPathSelection->provideCustomFileMode(QFileDialog::ExistingFile);
|
ui()->syncthingPathSelection->provideCustomFileMode(QFileDialog::ExistingFile);
|
||||||
ui()->logTextEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
ui()->logTextEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
|
@ -769,6 +784,7 @@ QWidget *LauncherOptionPage::setupWidget()
|
||||||
ui()->launchNowPushButton->setHidden(running);
|
ui()->launchNowPushButton->setHidden(running);
|
||||||
ui()->stopPushButton->setHidden(!running);
|
ui()->stopPushButton->setHidden(!running);
|
||||||
ui()->useBuiltInVersionCheckBox->setHidden(!SyncthingLauncher::isLibSyncthingAvailable());
|
ui()->useBuiltInVersionCheckBox->setHidden(!SyncthingLauncher::isLibSyncthingAvailable());
|
||||||
|
|
||||||
// connect signals & slots
|
// connect signals & slots
|
||||||
if (m_process) {
|
if (m_process) {
|
||||||
m_connections << QObject::connect(m_process, &SyncthingProcess::readyRead, bind(&LauncherOptionPage::handleSyncthingReadyRead, this));
|
m_connections << QObject::connect(m_process, &SyncthingProcess::readyRead, bind(&LauncherOptionPage::handleSyncthingReadyRead, this));
|
||||||
|
@ -782,6 +798,7 @@ QWidget *LauncherOptionPage::setupWidget()
|
||||||
}
|
}
|
||||||
QObject::connect(ui()->launchNowPushButton, &QPushButton::clicked, bind(&LauncherOptionPage::launch, this));
|
QObject::connect(ui()->launchNowPushButton, &QPushButton::clicked, bind(&LauncherOptionPage::launch, this));
|
||||||
QObject::connect(ui()->stopPushButton, &QPushButton::clicked, bind(&LauncherOptionPage::stop, this));
|
QObject::connect(ui()->stopPushButton, &QPushButton::clicked, bind(&LauncherOptionPage::stop, this));
|
||||||
|
|
||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,6 +931,12 @@ void LauncherOptionPage::stop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LauncherOptionPage::restoreDefaultArguments()
|
||||||
|
{
|
||||||
|
static const ::Settings::Launcher defaults;
|
||||||
|
ui()->argumentsLineEdit->setText(defaults.syncthingArgs);
|
||||||
|
}
|
||||||
|
|
||||||
// SystemdOptionPage
|
// SystemdOptionPage
|
||||||
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||||
SystemdOptionPage::SystemdOptionPage(QWidget *parentWidget)
|
SystemdOptionPage::SystemdOptionPage(QWidget *parentWidget)
|
||||||
|
|
|
@ -22,7 +22,8 @@ class DateTime;
|
||||||
|
|
||||||
namespace QtUtilities {
|
namespace QtUtilities {
|
||||||
class ColorButton;
|
class ColorButton;
|
||||||
}
|
class IconButton;
|
||||||
|
} // namespace QtUtilities
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
class SyncthingConnection;
|
class SyncthingConnection;
|
||||||
|
@ -106,8 +107,10 @@ void handleSyncthingExited(int exitCode, QProcess::ExitStatus exitStatus);
|
||||||
bool isRunning() const;
|
bool isRunning() const;
|
||||||
void launch();
|
void launch();
|
||||||
void stop();
|
void stop();
|
||||||
|
void restoreDefaultArguments();
|
||||||
Data::SyncthingProcess *const m_process;
|
Data::SyncthingProcess *const m_process;
|
||||||
Data::SyncthingLauncher *const m_launcher;
|
Data::SyncthingLauncher *const m_launcher;
|
||||||
|
QtUtilities::IconButton *m_restoreArgsButton;
|
||||||
QList<QMetaObject::Connection> m_connections;
|
QList<QMetaObject::Connection> m_connections;
|
||||||
bool m_kill;
|
bool m_kill;
|
||||||
QString m_tool;
|
QString m_tool;
|
||||||
|
|
Loading…
Reference in New Issue