mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2025-01-01 12:16:02 +00:00
cleanup
This commit is contained in:
parent
521cef3a22
commit
cf6b7e2b1f
4 changed files with 13 additions and 15 deletions
|
@ -9,7 +9,7 @@ class NetPage : public brls::AppletFrame
|
||||||
private:
|
private:
|
||||||
brls::List* list;
|
brls::List* list;
|
||||||
brls::Label* label;
|
brls::Label* label;
|
||||||
std::vector<brls::ListItem*> listItems;
|
brls::ListItem* listItem;
|
||||||
brls::ListItem* cancel;
|
brls::ListItem* cancel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -7,7 +7,7 @@ class PayloadPage : public brls::AppletFrame
|
||||||
private:
|
private:
|
||||||
brls::Label* label;
|
brls::Label* label;
|
||||||
brls::List* list;
|
brls::List* list;
|
||||||
std::vector<brls::ListItem*> items;
|
brls::ListItem* listItem;
|
||||||
brls::ListItem* reboot;
|
brls::ListItem* reboot;
|
||||||
brls::ListItem* shutDown;
|
brls::ListItem* shutDown;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@ NetPage::NetPage() : AppletFrame(true, true)
|
||||||
+"\nSubnet Mask: " + ipToString(profile.ip_setting_data.ip_address_setting.subnet_mask.addr)
|
+"\nSubnet Mask: " + ipToString(profile.ip_setting_data.ip_address_setting.subnet_mask.addr)
|
||||||
+"\nGateway: " + ipToString(profile.ip_setting_data.ip_address_setting.gateway.addr);
|
+"\nGateway: " + ipToString(profile.ip_setting_data.ip_address_setting.gateway.addr);
|
||||||
}
|
}
|
||||||
|
struct in_addr addr = {(in_addr_t) gethostid()};
|
||||||
|
labelText += "\n Local IP addr" + std::string(inet_ntoa(addr));
|
||||||
labelText += "\nMTU: " + std::to_string(unsigned(profile.ip_setting_data.mtu));
|
labelText += "\nMTU: " + std::to_string(unsigned(profile.ip_setting_data.mtu));
|
||||||
|
|
||||||
if(profile.ip_setting_data.dns_setting.is_automatic){
|
if(profile.ip_setting_data.dns_setting.is_automatic){
|
||||||
|
@ -113,15 +115,12 @@ NetPage::NetPage() : AppletFrame(true, true)
|
||||||
{"name", "ACNH lan-play"}
|
{"name", "ACNH lan-play"}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
int nbProfiles = profiles.size();
|
|
||||||
listItems.reserve(nbProfiles);
|
|
||||||
|
|
||||||
int iter = 0;
|
int iter = 0;
|
||||||
for (const auto& p : profiles.items()){
|
for (const auto& p : profiles.items()){
|
||||||
json values = p.value();
|
json values = p.value();
|
||||||
if(values.find("name") != values.end()) listItems[iter] = new brls::ListItem(values["name"]);
|
if(values.find("name") != values.end()) listItem = new brls::ListItem(values["name"]);
|
||||||
else listItems[iter] = new brls::ListItem("Unnamed");
|
else listItem = new brls::ListItem("Unnamed");
|
||||||
listItems[iter]->getClickEvent()->subscribe([&, values](brls::View* view){
|
listItem->getClickEvent()->subscribe([&, values](brls::View* view){
|
||||||
brls::Dialog* dialog = new brls::Dialog(values.dump(0).substr(1, values.dump(0).size() - 2));
|
brls::Dialog* dialog = new brls::Dialog(values.dump(0).substr(1, values.dump(0).size() - 2));
|
||||||
brls::GenericEvent::Callback callbackOk = [&, dialog, values](brls::View* view) {
|
brls::GenericEvent::Callback callbackOk = [&, dialog, values](brls::View* view) {
|
||||||
nifmInitialize(NifmServiceType_Admin);
|
nifmInitialize(NifmServiceType_Admin);
|
||||||
|
@ -188,7 +187,7 @@ NetPage::NetPage() : AppletFrame(true, true)
|
||||||
dialog->setCancelable(false);
|
dialog->setCancelable(false);
|
||||||
dialog->open();
|
dialog->open();
|
||||||
});
|
});
|
||||||
list->addView(listItems[iter]);
|
list->addView(listItem);
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,16 +18,15 @@ PayloadPage::PayloadPage() : AppletFrame(true, true)
|
||||||
list->addView(label);
|
list->addView(label);
|
||||||
std::vector<std::string> payloads = fetchPayloads();
|
std::vector<std::string> payloads = fetchPayloads();
|
||||||
int nbPayloads = payloads.size();
|
int nbPayloads = payloads.size();
|
||||||
items.reserve(nbPayloads);
|
|
||||||
for (int i = 0; i < nbPayloads; i++){
|
for (int i = 0; i < nbPayloads; i++){
|
||||||
std::string payload = payloads[i];
|
std::string payload = payloads[i];
|
||||||
items[i] = new brls::ListItem(payload);
|
listItem = new brls::ListItem(payload);
|
||||||
items[i]->getClickEvent()->subscribe([&, payload](brls::View* view) {
|
listItem->getClickEvent()->subscribe([&, payload](brls::View* view) {
|
||||||
reboot_to_payload(payload.c_str());
|
reboot_to_payload(payload.c_str());
|
||||||
brls::Application::popView();
|
brls::Application::popView();
|
||||||
});
|
});
|
||||||
if(running_cfw == ams){
|
if(running_cfw == ams){
|
||||||
items[i]->registerAction("menus/payloads/set_reboot_payload"_i18n, brls::Key::X, [this, payload] {
|
listItem->registerAction("menus/payloads/set_reboot_payload"_i18n, brls::Key::X, [this, payload] {
|
||||||
std::string res1;
|
std::string res1;
|
||||||
if(R_SUCCEEDED(CopyFile(payload.c_str(), REBOOT_PAYLOAD_PATH))){
|
if(R_SUCCEEDED(CopyFile(payload.c_str(), REBOOT_PAYLOAD_PATH))){
|
||||||
res1 += "menus/payloads/copy_success"_i18n + payload + "menus/payloads/to"_i18n + std::string(REBOOT_PAYLOAD_PATH) + "'.";
|
res1 += "menus/payloads/copy_success"_i18n + payload + "menus/payloads/to"_i18n + std::string(REBOOT_PAYLOAD_PATH) + "'.";
|
||||||
|
@ -46,7 +45,7 @@ PayloadPage::PayloadPage() : AppletFrame(true, true)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
items[i]->registerAction("menus/payloads/set_reboot_payload_up"_i18n, brls::Key::Y, [this, payload] {
|
listItem->registerAction("menus/payloads/set_reboot_payload_up"_i18n, brls::Key::Y, [this, payload] {
|
||||||
std::string res2;
|
std::string res2;
|
||||||
if(R_SUCCEEDED(CopyFile(payload.c_str(), UPDATE_BIN_PATH))){
|
if(R_SUCCEEDED(CopyFile(payload.c_str(), UPDATE_BIN_PATH))){
|
||||||
res2 += "menus/payloads/copy_success"_i18n + payload + "menus/payloads/to"_i18n + std::string(UPDATE_BIN_PATH) + "'.";
|
res2 += "menus/payloads/copy_success"_i18n + payload + "menus/payloads/to"_i18n + std::string(UPDATE_BIN_PATH) + "'.";
|
||||||
|
@ -63,7 +62,7 @@ PayloadPage::PayloadPage() : AppletFrame(true, true)
|
||||||
dialog->open();
|
dialog->open();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
list->addView(items[i]);
|
list->addView(listItem);
|
||||||
}
|
}
|
||||||
list->addView(new brls::ListItemGroupSpacing(true));
|
list->addView(new brls::ListItemGroupSpacing(true));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue