1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-09 20:11:48 +00:00

Changed the cheatslips cheatsheet view

This commit is contained in:
flb 2021-02-09 16:27:18 +01:00
parent 314bd06407
commit 6cb74b1876
3 changed files with 16 additions and 14 deletions

View file

@ -21,4 +21,5 @@ class DownloadCheatsPage : public brls::AppletFrame
std::string GetCheatsTitle(nlohmann::json cheat);
void WriteCheats(uint64_t tid, std::string bid, std::string cheatContent);
void DeleteCheats(uint64_t tid, std::string bid);
void ShowCheatsContent(nlohmann::ordered_json titles);
};

View file

@ -69,7 +69,7 @@
"v2_0_1_text": "\uE016 Fixed a bug not letting the user click no when asked if they want to install hekate.n\uE016 Correct a bunch of typos.",
"v2_1_0": "v2.1.0",
"v2_1_0_text": "\uE016 Switched to a better way to get links.",
"v2_1_1_text": "\uE016 Added a friendly reminder to reboot for new sigpatches to apply",
"v2_1_1_text": "\uE016 Added a friendly reminder to reboot for new sigpatches to apply.\n\uE016 Changed the cheatslips cheatsheet view.",
"Ok_button": "Ok",
"cheats_page.cpp":"",
@ -89,7 +89,7 @@
"delete_cheat": "Delete existing cheat file",
"couldnt_dl_cheats": "Could not fetch selected cheat codes/invalid token.",
"quota_cheatslips": "Quota exceeded for today!\nHead on to 'https://www.cheatslips.com/subscriptions' to see how to increase it.",
"cheat_cheat_content": "Cheatsheet content: ",
"cheat_cheat_content": "Cheatsheet content",
"app_cheatslips_label": "Select a game to download cheats for.",
"wrong_cheatslips_id": "Couldn't retrieve token, make sure you enter you login properly",
"see_more": "See more",

View file

@ -26,20 +26,9 @@ DownloadCheatsPage::DownloadCheatsPage(uint64_t tid) : AppletFrame(true, true)
json cheat = p.value();
listItem = new::brls::ToggleListItem(GetCheatsTitle(cheat), 0);
listItem->registerAction("menus/see_more"_i18n , brls::Key::Y, [this, cheat] {
std::string str = "menus/cheat_cheat_content"_i18n + "\n";
if(cheat.find("titles") != cheat.end()) {
for(auto& p : cheat["titles"]){
str += "[" + p.get<std::string>() + "]" + "\n";
}
str.pop_back();
ShowCheatsContent(cheat["titles"]);
}
brls::Dialog* dialog = new brls::Dialog(str);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/Ok_button"_i18n , callback);
dialog->setCancelable(true);
dialog->open();
return true;
});
toggles.push_back(std::make_pair(listItem, cheat["id"]));
@ -198,4 +187,16 @@ void DownloadCheatsPage::DeleteCheats(uint64_t tid, std::string bid) {
break;
}
std::filesystem::remove(path + formatApplicationId(tid) + "/cheats/" + bid + ".txt");
}
void DownloadCheatsPage::ShowCheatsContent(nlohmann::ordered_json titles) {
brls::AppletFrame* appView = new brls::AppletFrame(true, true);
brls::List* list = new brls::List();
brls::ListItem* listItem;
for(auto& p : titles){
listItem = new brls::ListItem(p.get<std::string>());
list->addView(listItem);
}
appView->setContentView(list);
brls::PopupFrame::open("menus/cheat_cheat_content"_i18n, appView, "", "");
}