|
|
@ -98,7 +98,7 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) { |
|
|
|
bool locked = params.getBool((param + "Lock").toStdString()); |
|
|
|
bool locked = params.getBool((param + "Lock").toStdString()); |
|
|
|
toggle->setEnabled(!locked); |
|
|
|
toggle->setEnabled(!locked); |
|
|
|
if (!locked) { |
|
|
|
if (!locked) { |
|
|
|
connect(parent, &SettingsWindow::offroadTransition, toggle, &ParamControl::setEnabled); |
|
|
|
connect(uiState(), &UIState::offroadTransition, toggle, &ParamControl::setEnabled); |
|
|
|
} |
|
|
|
} |
|
|
|
addItem(toggle); |
|
|
|
addItem(toggle); |
|
|
|
} |
|
|
|
} |
|
|
@ -144,7 +144,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) { |
|
|
|
addItem(regulatoryBtn); |
|
|
|
addItem(regulatoryBtn); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QObject::connect(parent, &SettingsWindow::offroadTransition, [=](bool offroad) { |
|
|
|
QObject::connect(uiState(), &UIState::offroadTransition, [=](bool offroad) { |
|
|
|
for (auto btn : findChildren<ButtonControl *>()) { |
|
|
|
for (auto btn : findChildren<ButtonControl *>()) { |
|
|
|
btn->setEnabled(offroad); |
|
|
|
btn->setEnabled(offroad); |
|
|
|
} |
|
|
|
} |
|
|
@ -198,10 +198,10 @@ void DevicePanel::updateCalibDescription() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void DevicePanel::reboot() { |
|
|
|
void DevicePanel::reboot() { |
|
|
|
if (QUIState::ui_state.status == UIStatus::STATUS_DISENGAGED) { |
|
|
|
if (uiState()->status == UIStatus::STATUS_DISENGAGED) { |
|
|
|
if (ConfirmationDialog::confirm("Are you sure you want to reboot?", this)) { |
|
|
|
if (ConfirmationDialog::confirm("Are you sure you want to reboot?", this)) { |
|
|
|
// Check engaged again in case it changed while the dialog was open
|
|
|
|
// Check engaged again in case it changed while the dialog was open
|
|
|
|
if (QUIState::ui_state.status == UIStatus::STATUS_DISENGAGED) { |
|
|
|
if (uiState()->status == UIStatus::STATUS_DISENGAGED) { |
|
|
|
Params().putBool("DoReboot", true); |
|
|
|
Params().putBool("DoReboot", true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -211,10 +211,10 @@ void DevicePanel::reboot() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void DevicePanel::poweroff() { |
|
|
|
void DevicePanel::poweroff() { |
|
|
|
if (QUIState::ui_state.status == UIStatus::STATUS_DISENGAGED) { |
|
|
|
if (uiState()->status == UIStatus::STATUS_DISENGAGED) { |
|
|
|
if (ConfirmationDialog::confirm("Are you sure you want to power off?", this)) { |
|
|
|
if (ConfirmationDialog::confirm("Are you sure you want to power off?", this)) { |
|
|
|
// Check engaged again in case it changed while the dialog was open
|
|
|
|
// Check engaged again in case it changed while the dialog was open
|
|
|
|
if (QUIState::ui_state.status == UIStatus::STATUS_DISENGAGED) { |
|
|
|
if (uiState()->status == UIStatus::STATUS_DISENGAGED) { |
|
|
|
Params().putBool("DoShutdown", true); |
|
|
|
Params().putBool("DoShutdown", true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -247,7 +247,7 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) { |
|
|
|
params.putBool("DoUninstall", true); |
|
|
|
params.putBool("DoUninstall", true); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
connect(parent, SIGNAL(offroadTransition(bool)), uninstallBtn, SLOT(setEnabled(bool))); |
|
|
|
connect(uiState(), &UIState::offroadTransition, uninstallBtn, &QPushButton::setEnabled); |
|
|
|
|
|
|
|
|
|
|
|
QWidget *widgets[] = {versionLbl, lastUpdateLbl, updateBtn, gitBranchLbl, gitCommitLbl, osVersionLbl, uninstallBtn}; |
|
|
|
QWidget *widgets[] = {versionLbl, lastUpdateLbl, updateBtn, gitBranchLbl, gitCommitLbl, osVersionLbl, uninstallBtn}; |
|
|
|
for (QWidget* w : widgets) { |
|
|
|
for (QWidget* w : widgets) { |
|
|
|