Read all saved Gateways (for selecting in Systray) (#181)

This commit is contained in:
gmarco
2022-10-07 06:37:51 +02:00
committed by GitHub
parent 75a24c89cd
commit fab25848e1
3 changed files with 16 additions and 2 deletions

View File

@@ -446,8 +446,14 @@ bool GPClient::connected() const
QList<GPGateway> GPClient::allGateways() const
{
const QString gatewaysJson = settings::get(portal() + "_gateways").toString();
return GPGateway::fromJson(gatewaysJson);
QList<GPGateway> gateways;
for (auto g :settings::get_all("_gateways$") ){
gateways.append(GPGateway::fromJson(settings::get(g).toString()));
}
return gateways;
}
void GPClient::setAllGateways(QList<GPGateway> gateways)
@@ -475,6 +481,7 @@ void GPClient::setCurrentGateway(const GPGateway gateway)
LOGI << "Updating the current gateway to " << gateway.name();
settings::save(portal() + "_selectedGateway", gateway.name());
ui->portalInput->setText(gateway.address());
populateGatewayMenu();
}