fix: (ui), ServerConfigDialog enable spinboxes and controls that depend on another option being enabled example being the heatbeat spinbox if heatbeat is enabled

This commit is contained in:
sithlord48
2025-06-01 12:43:23 -04:00
committed by Nick Bolton
parent 0096283779
commit 7e4d43f1cc
2 changed files with 102 additions and 87 deletions

View File

@ -67,8 +67,6 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config)
ui->btnBrowseConfigFile->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::DocumentOpen));
ui->lineConfigFile->setText(serverConfig().configFile());
ui->groupExternalConfig->setChecked(serverConfig().useExternalConfig());
ui->rbProtocolSynergy->setChecked(serverConfig().protocol() == ServerProtocol::kSynergy);
ui->rbProtocolBarrier->setChecked(serverConfig().protocol() == ServerProtocol::kBarrier);
connect(ui->rbProtocolBarrier, &QRadioButton::toggled, this, &ServerConfigDialog::toggleProtocol);
@ -76,6 +74,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config)
ui->cbHeartbeat->setChecked(serverConfig().hasHeartbeat());
connect(ui->cbHeartbeat, &QCheckBox::toggled, this, &ServerConfigDialog::toggleHeartbeat);
ui->sbHeartbeat->setEnabled(ui->cbHeartbeat->isChecked());
ui->sbHeartbeat->setValue(serverConfig().heartbeat());
connect(ui->sbHeartbeat, QOverload<int>::of(&QSpinBox::valueChanged), this, &ServerConfigDialog::setHeartbeat);
@ -90,12 +89,14 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config)
ui->cbSwitchDelay->setChecked(serverConfig().hasSwitchDelay());
connect(ui->cbSwitchDelay, &QCheckBox::toggled, this, &ServerConfigDialog::toggleSwitchDelay);
ui->sbSwitchDelay->setEnabled(ui->cbSwitchDelay->isChecked());
ui->sbSwitchDelay->setValue(serverConfig().switchDelay());
connect(ui->sbSwitchDelay, QOverload<int>::of(&QSpinBox::valueChanged), this, &ServerConfigDialog::setSwitchDelay);
ui->cbSwitchDoubleTap->setChecked(serverConfig().hasSwitchDoubleTap());
connect(ui->cbSwitchDoubleTap, &QCheckBox::toggled, this, &ServerConfigDialog::toggleSwitchDoubleTap);
ui->sbSwitchDoubleTap->setEnabled(ui->cbSwitchDoubleTap->isChecked());
ui->sbSwitchDoubleTap->setValue(serverConfig().switchDoubleTap());
connect(
ui->sbSwitchDoubleTap, QOverload<int>::of(&QSpinBox::valueChanged), this, &ServerConfigDialog::setSwitchDoubleTap
@ -104,9 +105,15 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config)
connect(ui->cbRelativeMouseMoves, &QCheckBox::toggled, this, &ServerConfigDialog::toggleRelativeMouseMoves);
connect(ui->cbEnableClipboard, &QCheckBox::toggled, this, &ServerConfigDialog::toggleClipboard);
connect(ui->groupExternalConfig, &QGroupBox::toggled, this, &ServerConfigDialog::toggleExternalConfig);
connect(ui->btnBrowseConfigFile, &QPushButton::clicked, this, &ServerConfigDialog::browseConfigFile);
ui->groupExternalConfig->setChecked(serverConfig().useExternalConfig());
ui->widgetExternalConfigControls->setEnabled(ui->groupExternalConfig->isChecked());
ui->tabWidget->setTabEnabled(0, !ui->groupExternalConfig->isChecked());
ui->tabWidget->setTabEnabled(1, !ui->groupExternalConfig->isChecked());
ui->tabWidget->setTabEnabled(2, !ui->groupExternalConfig->isChecked());
connect(ui->groupExternalConfig, &QGroupBox::toggled, this, &ServerConfigDialog::toggleExternalConfig);
connect(
ui->sbSwitchCornerSize, QOverload<int>::of(&QSpinBox::valueChanged), this,
&ServerConfigDialog::setSwitchCornerSize
@ -445,10 +452,7 @@ void ServerConfigDialog::onScreenRemoved()
void ServerConfigDialog::toggleExternalConfig(bool checked)
{
ui->labelConfigFile->setEnabled(checked);
ui->lineConfigFile->setEnabled(checked);
ui->btnBrowseConfigFile->setEnabled(checked);
ui->widgetExternalConfigControls->setEnabled(checked);
ui->tabWidget->setTabEnabled(0, !checked);
ui->tabWidget->setTabEnabled(1, !checked);
ui->tabWidget->setTabEnabled(2, !checked);

View File

@ -903,88 +903,100 @@ Enabling this setting will disable the server config GUI.</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelConfigFile">
<widget class="QWidget" name="widgetExternalConfigControls" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>96</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Config file path</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="lineConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBrowseConfigFile">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelConfigFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>96</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Config file path</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="lineConfigFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>180</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBrowseConfigFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
@ -1057,7 +1069,6 @@ Enabling this setting will disable the server config GUI.</string>
<tabstop>sbHeartbeat</tabstop>
<tabstop>cbRelativeMouseMoves</tabstop>
<tabstop>sbSwitchCornerSize</tabstop>
<tabstop>lineConfigFile</tabstop>
<tabstop>tabWidget</tabstop>
</tabstops>
<resources/>