Retain tethering status between reboots
This commit is contained in:
@@ -130,6 +130,10 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
|
||||
tetheringToggle = new ToggleControl(tr("Enable Tethering"), "", "", wifi->isTetheringEnabled());
|
||||
list->addItem(tetheringToggle);
|
||||
QObject::connect(tetheringToggle, &ToggleControl::toggleFlipped, this, &AdvancedNetworking::toggleTethering);
|
||||
if (params.getBool("TetheringEnabled")) {
|
||||
tetheringToggle->setVisualOn();
|
||||
uiState()->scene.tethering_enabled = true;
|
||||
}
|
||||
|
||||
// Change tethering password
|
||||
ButtonControl *editPasswordButton = new ButtonControl(tr("Tethering Password"), tr("EDIT"));
|
||||
@@ -232,6 +236,8 @@ void AdvancedNetworking::refresh() {
|
||||
void AdvancedNetworking::toggleTethering(bool enabled) {
|
||||
wifi->setTetheringEnabled(enabled);
|
||||
tetheringToggle->setEnabled(false);
|
||||
params.putBool("TetheringEnabled", enabled);
|
||||
uiState()->scene.tethering_enabled = enabled;
|
||||
}
|
||||
|
||||
// WifiUI functions
|
||||
|
||||
@@ -127,6 +127,10 @@ public:
|
||||
QObject::connect(&toggle, &Toggle::stateChanged, this, &ToggleControl::toggleFlipped);
|
||||
}
|
||||
|
||||
void setVisualOn() {
|
||||
toggle.togglePosition();
|
||||
}
|
||||
|
||||
void setEnabled(bool enabled) {
|
||||
toggle.setEnabled(enabled);
|
||||
toggle.update();
|
||||
|
||||
Reference in New Issue
Block a user