refactor: add a check box to enable stop on desk switch
This commit is contained in:
committed by
Chris Rizzitello
parent
487030aade
commit
5ad2c9283d
@ -75,7 +75,8 @@ void Settings::cleanSettings()
|
||||
QVariant Settings::defaultValue(const QString &key)
|
||||
{
|
||||
if ((key == Gui::Autohide) || (key == Core::StartedBefore) || (key == Core::PreventSleep) ||
|
||||
(key == Server::ExternalConfig) || (key == Client::InvertScrollDirection) || (key == Log::ToFile)) {
|
||||
(key == Server::ExternalConfig) || (key == Client::InvertScrollDirection) || (key == Log::ToFile) ||
|
||||
(key == Core::StopOnDeskSwitch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ public:
|
||||
inline static const auto PreventSleep = QStringLiteral("core/preventSleep");
|
||||
inline static const auto ProcessMode = QStringLiteral("core/processMode");
|
||||
inline static const auto ScreenName = QStringLiteral("core/screenName");
|
||||
inline static const auto StopOnDeskSwitch = QStringLiteral("core/stopOnDeskSwitch");
|
||||
inline static const auto StartedBefore = QStringLiteral("core/startedBefore");
|
||||
inline static const auto UpdateUrl = QStringLiteral("core/updateUrl");
|
||||
};
|
||||
@ -189,6 +190,7 @@ private:
|
||||
, Settings::Core::ProcessMode
|
||||
, Settings::Core::ScreenName
|
||||
, Settings::Core::StartedBefore
|
||||
, Settings::Core::StopOnDeskSwitch
|
||||
, Settings::Core::UpdateUrl
|
||||
, Settings::Daemon::Command
|
||||
, Settings::Daemon::Elevate
|
||||
|
||||
@ -470,8 +470,7 @@ bool CoreProcess::addGenericArgs(QStringList &args, const ProcessMode processMod
|
||||
// unnecessary restarts when deskflow was started elevated or
|
||||
// when it is not allowed to elevate. In these cases restarting
|
||||
// the server is fruitless.
|
||||
auto elevateMode = Settings::value(Settings::Core::ElevateMode).value<Settings::ElevateMode>();
|
||||
if (elevateMode == Settings::ElevateMode::Automatic) {
|
||||
if (Settings::value(Settings::Core::StopOnDeskSwitch).toBool()) {
|
||||
args << "--stop-on-desk-switch";
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -132,6 +132,7 @@ void SettingsDialog::accept()
|
||||
Settings::setValue(Settings::Log::Level, ui->comboLogLevel->currentIndex());
|
||||
Settings::setValue(Settings::Log::ToFile, ui->cbLogToFile->isChecked());
|
||||
Settings::setValue(Settings::Log::File, ui->lineLogFilename->text());
|
||||
Settings::setValue(Settings::Core::StopOnDeskSwitch, ui->cbStopOnDeskSwitch->isChecked());
|
||||
Settings::setValue(Settings::Core::ElevateMode, ui->comboElevate->currentIndex());
|
||||
Settings::setValue(Settings::Gui::Autohide, ui->cbAutoHide->isChecked());
|
||||
Settings::setValue(Settings::Gui::AutoUpdateCheck, ui->cbAutoUpdate->isChecked());
|
||||
@ -167,6 +168,7 @@ void SettingsDialog::loadFromConfig()
|
||||
ui->cbLanguageSync->setChecked(Settings::value(Settings::Client::LanguageSync).toBool());
|
||||
ui->cbScrollDirection->setChecked(Settings::value(Settings::Client::InvertScrollDirection).toBool());
|
||||
ui->cbCloseToTray->setChecked(Settings::value(Settings::Gui::CloseToTray).toBool());
|
||||
ui->cbStopOnDeskSwitch->setChecked(Settings::value(Settings::Core::StopOnDeskSwitch).toBool());
|
||||
ui->comboElevate->setCurrentIndex(Settings::value(Settings::Core::ElevateMode).toInt());
|
||||
ui->cbAutoUpdate->setChecked(Settings::value(Settings::Gui::AutoUpdateCheck).toBool());
|
||||
|
||||
@ -267,6 +269,7 @@ void SettingsDialog::updateControls()
|
||||
if (Settings::isNativeMode()) {
|
||||
ui->groupService->setEnabled(writable);
|
||||
ui->widgetElevate->setEnabled(writable && serviceChecked);
|
||||
ui->cbStopOnDeskSwitch->setEnabled(writable && serviceChecked);
|
||||
} else if (ui->groupService->isVisibleTo(ui->tabAdvanced)) {
|
||||
ui->groupService->setVisible(false);
|
||||
const int bottomMargin = ui->tabAdvanced->layout()->contentsMargins().bottom() +
|
||||
|
||||
@ -22,9 +22,6 @@
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabRegular">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@ -557,7 +554,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_6">
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QWidget" name="widgetElevate" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
@ -632,6 +629,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cbStopOnDeskSwitch">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Run as system only when at the login screen and UAC prompt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user