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