refactor: SettingsDialog, Hide the service if its not able to be enabled
This commit is contained in:
parent
8354a81706
commit
b3fb8959a3
3 changed files with 14 additions and 12 deletions
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
Windows will save to the install dir if settings are loaded from there. If not, it saves any other config files in: `C:\ProgramData\Deskflow\`
|
Windows will save to the install dir if settings are loaded from there. If not, it saves any other config files in: `C:\ProgramData\Deskflow\`
|
||||||
|
|
||||||
When using settings from the install dir its not recommend to have elevation enabled.
|
When using settings from the install dir, the service mode will not be available.
|
||||||
|
|
||||||
# Server Config Examples
|
# Server Config Examples
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -248,15 +248,6 @@ void SettingsDialog::updateKeyLengthOnFile(const QString &path)
|
||||||
|
|
||||||
void SettingsDialog::updateControls()
|
void SettingsDialog::updateControls()
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
const auto serviceAvailable = true;
|
|
||||||
#else
|
|
||||||
// service not supported on unix yet, so always disable.
|
|
||||||
const auto serviceAvailable = false;
|
|
||||||
ui->groupService->setTitle("Service (Windows only)");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const bool writable = Settings::isWritable();
|
const bool writable = Settings::isWritable();
|
||||||
const bool serviceChecked = ui->cbServiceEnabled->isChecked();
|
const bool serviceChecked = ui->cbServiceEnabled->isChecked();
|
||||||
const bool logToFile = ui->cbLogToFile->isChecked();
|
const bool logToFile = ui->cbLogToFile->isChecked();
|
||||||
|
|
@ -272,8 +263,16 @@ void SettingsDialog::updateControls()
|
||||||
ui->comboTlsKeyLength->setEnabled(writable);
|
ui->comboTlsKeyLength->setEnabled(writable);
|
||||||
ui->cbCloseToTray->setEnabled(writable);
|
ui->cbCloseToTray->setEnabled(writable);
|
||||||
|
|
||||||
ui->cbServiceEnabled->setEnabled(writable && serviceAvailable);
|
// Handle enable and disable of service items
|
||||||
ui->widgetElevate->setEnabled(writable && serviceChecked && serviceAvailable);
|
if (Settings::isNativeMode()) {
|
||||||
|
ui->cbServiceEnabled->setEnabled(writable);
|
||||||
|
ui->widgetElevate->setEnabled(writable && serviceChecked);
|
||||||
|
} else if (ui->groupService->isVisibleTo(ui->tabAdvanced)) {
|
||||||
|
ui->groupService->setVisible(false);
|
||||||
|
const int bottomMargin = ui->tabAdvanced->layout()->contentsMargins().bottom() +
|
||||||
|
(ui->tabAdvanced->layout()->spacing() * 2) + ui->groupService->height();
|
||||||
|
ui->tabAdvanced->layout()->setContentsMargins(9, 9, 9, bottomMargin);
|
||||||
|
}
|
||||||
|
|
||||||
ui->cbLanguageSync->setEnabled(writable && isClientMode());
|
ui->cbLanguageSync->setEnabled(writable && isClientMode());
|
||||||
ui->cbScrollDirection->setEnabled(writable && isClientMode());
|
ui->cbScrollDirection->setEnabled(writable && isClientMode());
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="tabRegular">
|
<widget class="QWidget" name="tabRegular">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue