Hide advanced connection config by default
The configuration page is getting too big otherwise.
This commit is contained in:
parent
4e61f77932
commit
c8b4c1e435
|
@ -165,48 +165,35 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Line" name="line1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="urlLabel">
|
||||
<property name="text">
|
||||
<string>Syncthing URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QtUtilities::ClearLineEdit" name="urlLineEdit">
|
||||
<property name="placeholderText">
|
||||
<string>"http://host:port/…" or "https://host:port/…", e.g. "http://127.0.0.1:8384" for local instance with default settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="authLabel">
|
||||
<property name="text">
|
||||
<string>Authentication</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="authCheckBox">
|
||||
<property name="text">
|
||||
<string>Supply credentials for HTTP authentication (normally the API key is sufficient)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="userNameLabel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -216,14 +203,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QtUtilities::ClearLineEdit" name="userNameLineEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="passwordLabel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -233,7 +220,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QtUtilities::ClearLineEdit" name="passwordLineEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -243,14 +230,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="certificateLabel">
|
||||
<property name="text">
|
||||
<string>HTTPS certificate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="14" column="1">
|
||||
<widget class="QtUtilities::PathSelection" name="certPathSelection" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
|
@ -260,7 +247,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="15" column="1">
|
||||
<layout class="QHBoxLayout" name="insertFromConfigFileLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
|
@ -305,7 +292,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="16" column="1">
|
||||
<widget class="Line" name="line2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
|
@ -318,7 +305,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="pollLabel">
|
||||
<property name="text">
|
||||
<string>Poll interval</string>
|
||||
|
@ -328,7 +315,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<item row="18" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
|
@ -468,7 +455,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<item row="19" column="1">
|
||||
<widget class="QCheckBox" name="autoConnectCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>Whether to connect automatically on startup. This setting might be overruled by systemd and launcher settings.</string>
|
||||
|
@ -478,7 +465,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<item row="20" column="0">
|
||||
<widget class="QLabel" name="overallStatusLabel">
|
||||
<property name="text">
|
||||
<string>Overall status</string>
|
||||
|
@ -488,7 +475,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<item row="20" column="1">
|
||||
<layout class="QVBoxLayout" name="statusComputionFlagsVerticalLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
|
@ -533,21 +520,21 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
<item row="21" column="0">
|
||||
<widget class="QLabel" name="statusTextLabel">
|
||||
<property name="text">
|
||||
<string>Current status</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<item row="21" column="1">
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="text">
|
||||
<string>disconnected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="1">
|
||||
<item row="24" column="1">
|
||||
<widget class="QPushButton" name="connectPushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -564,28 +551,28 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="apiKeyLabel">
|
||||
<property name="text">
|
||||
<string>API key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QtUtilities::ClearLineEdit" name="apiKeyLineEdit">
|
||||
<property name="placeholderText">
|
||||
<string>The API key displayed in Syncthing's settings dialog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="timeoutLabel">
|
||||
<property name="text">
|
||||
<string>Transfer timeout</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<item row="17" column="1">
|
||||
<widget class="QSpinBox" name="timeoutSpinBox">
|
||||
<property name="specialValueText">
|
||||
<string>no timeout</string>
|
||||
|
@ -604,6 +591,29 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="Line" name="line1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="advancedCheckBox">
|
||||
<property name="text">
|
||||
<string>Show advanced configuration</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include <QTextCursor>
|
||||
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
@ -131,9 +132,11 @@ QWidget *ConnectionOptionPage::setupWidget()
|
|||
QObject::connect(ui()->upPushButton, &QPushButton::clicked, bind(&ConnectionOptionPage::moveSelectedConfigUp, this));
|
||||
QObject::connect(ui()->addPushButton, &QPushButton::clicked, bind(&ConnectionOptionPage::addNewConfig, this));
|
||||
QObject::connect(ui()->removePushButton, &QPushButton::clicked, bind(&ConnectionOptionPage::removeSelectedConfig, this));
|
||||
QObject::connect(ui()->advancedCheckBox, &QCheckBox::toggled, bind(&ConnectionOptionPage::toggleAdvancedSettings, this, std::placeholders::_1));
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
|
||||
ui()->timeoutSpinBox->setEnabled(false);
|
||||
#endif
|
||||
toggleAdvancedSettings(false);
|
||||
return widget;
|
||||
}
|
||||
|
||||
|
@ -355,6 +358,19 @@ void ConnectionOptionPage::setCurrentIndex(int currentIndex)
|
|||
ui()->upPushButton->setEnabled(currentIndex > 0 && static_cast<unsigned>(currentIndex) - 1 < m_secondarySettings.size());
|
||||
}
|
||||
|
||||
void ConnectionOptionPage::toggleAdvancedSettings(bool show)
|
||||
{
|
||||
if (!ui()) {
|
||||
return;
|
||||
}
|
||||
for (auto *const widget : std::initializer_list<QWidget *>{ ui()->authLabel, ui()->authCheckBox, ui()->userNameLabel, ui()->userNameLineEdit,
|
||||
ui()->passwordLabel, ui()->passwordLineEdit, ui()->timeoutLabel, ui()->timeoutSpinBox, ui()->pollLabel, ui()->pollDevStatsLabel,
|
||||
ui()->pollDevStatsSpinBox, ui()->pollErrorsLabel, ui()->pollErrorsSpinBox, ui()->pollTrafficLabel, ui()->pollTrafficSpinBox,
|
||||
ui()->reconnectLabel, ui()->reconnectSpinBox }) {
|
||||
widget->setVisible(show);
|
||||
}
|
||||
}
|
||||
|
||||
bool ConnectionOptionPage::apply()
|
||||
{
|
||||
if (!cacheCurrentSettings(true)) {
|
||||
|
@ -1632,8 +1648,8 @@ SettingsDialog::SettingsDialog(Data::SyncthingConnection *connection, QWidget *p
|
|||
category = new OptionCategory(this);
|
||||
translateCategory(category, [] { return tr("Tray"); });
|
||||
category->assignPages({ m_connectionsOptionPage = new ConnectionOptionPage(connection), new NotificationsOptionPage,
|
||||
m_appearanceOptionPage = new AppearanceOptionPage, new IconsOptionPage(IconsOptionPage::Context::UI),
|
||||
new IconsOptionPage(IconsOptionPage::Context::System) });
|
||||
m_appearanceOptionPage = new AppearanceOptionPage, new IconsOptionPage(IconsOptionPage::Context::UI),
|
||||
new IconsOptionPage(IconsOptionPage::Context::System) });
|
||||
category->setIcon(QIcon(QStringLiteral(":/icons/hicolor/scalable/app/syncthingtray.svg")));
|
||||
categories << category;
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ void removeSelectedConfig();
|
|||
void moveSelectedConfigDown();
|
||||
void moveSelectedConfigUp();
|
||||
void setCurrentIndex(int currentIndex);
|
||||
void toggleAdvancedSettings(bool show);
|
||||
Data::SyncthingConnection *m_connection;
|
||||
Data::SyncthingConnectionSettings m_primarySettings;
|
||||
std::vector<Data::SyncthingConnectionSettings> m_secondarySettings;
|
||||
|
|
Loading…
Reference in New Issue