MCPcopy Create free account
hub / github.com/Martchus/syncthingtray / handleSelectionChanged

Method handleSelectionChanged

syncthingwidgets/settings/wizard.cpp:842–882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842void MainConfigWizardPage::handleSelectionChanged()
843{
844 auto *const wizard = qobject_cast<Wizard *>(this->wizard());
845 if (!wizard) {
846 return;
847 }
848
849 // enable/disable option for Systemd integration
850#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
851 const auto &detection = wizard->setupDetection();
852 if (!m_ui->cfgCurrentlyRunningRadioButton->isHidden()) {
853 const auto &systemdSettings = Settings::values().systemd;
854 m_ui->enableSystemdIntegrationCheckBox->setChecked(systemdSettings.showButton || systemdSettings.considerForReconnect
855 || detection.userService.isRunning() || detection.systemService.isRunning());
856 } else {
857 if ((!m_ui->cfgSystemdUserUnitRadioButton->isHidden() && m_ui->cfgSystemdUserUnitRadioButton->isChecked())
858 || ((!m_ui->cfgSystemdSystemUnitRadioButton->isHidden() && m_ui->cfgSystemdSystemUnitRadioButton->isChecked()))) {
859 m_ui->enableSystemdIntegrationCheckBox->setChecked(true);
860 m_ui->enableSystemdIntegrationCheckBox->setEnabled(true);
861 } else {
862 m_ui->enableSystemdIntegrationCheckBox->setChecked(false);
863 m_ui->enableSystemdIntegrationCheckBox->setEnabled(true);
864 }
865 }
866#endif
867
868 // set completed state according to selection
869 auto configSelected = false;
870 for (auto *const option : std::initializer_list<QRadioButton *>{ m_ui->cfgCurrentlyRunningRadioButton, m_ui->cfgLauncherExternalRadioButton,
871 m_ui->cfgLauncherBuiltInRadioButton, m_ui->cfgSystemdUserUnitRadioButton, m_ui->cfgSystemdSystemUnitRadioButton,
872 m_ui->cfgNoneRadioButton }) {
873 if ((configSelected = !option->isHidden() && option->isChecked())) {
874 break;
875 }
876 }
877 configSelected = configSelected || (m_ui->enableSystemdIntegrationCheckBox->isEnabled() && m_ui->enableSystemdIntegrationCheckBox->isChecked());
878 if (configSelected != m_configSelected) {
879 m_configSelected = configSelected;
880 emit completeChanged();
881 }
882}
883
884AutostartWizardPage::AutostartWizardPage(QWidget *parent)
885 : QWizardPage(parent)

Callers

nothing calls this directly

Calls 3

setEnabledMethod · 0.80
isEnabledMethod · 0.80
isRunningMethod · 0.45

Tested by

no test coverage detected