1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-12-28 18:36:02 +00:00

remove uncessary listitems

Update README.md

Update README.md

Update README.md
This commit is contained in:
flb 2021-10-08 21:53:38 +02:00
parent 29547e2993
commit 7295942829
9 changed files with 31 additions and 69 deletions

View file

@ -1,6 +1,6 @@
# AIO-switch-updater # AIO-switch-updater
![releases](https://img.shields.io/github/downloads/HamletDuFromage/AIO-switch-updater/total) ![releases](https://img.shields.io/github/downloads/HamletDuFromage/AIO-switch-updater/total)
![hbappstore](https://img.shields.io/endpoint?url=https://runkit.io/homlet/hbappstore-shieldsio/branches/master?url=https://api.brewtools.dev/store/Switch/?package=aioswitchupdater) ![hbappstore](https://img.shields.io/endpoint?url=https://runkit.io/homlet/hbappstore-shieldsio/branches/master?url=https://switchbru.com/appstore/repo.json&name=aioswitchupdater)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/HamletDuFromage/AIO-switch-updater/Build%20AIO-switch-updater) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/HamletDuFromage/AIO-switch-updater/Build%20AIO-switch-updater)
![tag](https://img.shields.io/github/v/release/HamletDuFromage/AIO-switch-updater) ![tag](https://img.shields.io/github/v/release/HamletDuFromage/AIO-switch-updater)
![GitHub](https://img.shields.io/github/license/HamletDuFromage/aio-switch-updater) ![GitHub](https://img.shields.io/github/license/HamletDuFromage/aio-switch-updater)

View file

@ -21,7 +21,6 @@ private:
public: public:
AmsTab(const nlohmann::json& nxlinks, const bool erista = true, const bool hideStandardEntries = false); AmsTab(const nlohmann::json& nxlinks, const bool erista = true, const bool hideStandardEntries = false);
brls::View* getDefaultFocus() override;
}; };
class UnTogglableListItem : public brls::ToggleListItem class UnTogglableListItem : public brls::ToggleListItem

View file

@ -12,6 +12,7 @@ namespace show_cheats {
void ShowCheatSheet(u64 tid, const std::string& bid, const std::string& name); void ShowCheatSheet(u64 tid, const std::string& bid, const std::string& name);
bool CreateCheatList(const std::filesystem::path& path, brls::List** cheatsList); bool CreateCheatList(const std::filesystem::path& path, brls::List** cheatsList);
void NoCheatsFoundPopup(); void NoCheatsFoundPopup();
void DeleteCheats(u64 tid, const std::string& bid);
} // namespace show_cheats } // namespace show_cheats
@ -31,7 +32,6 @@ protected:
void GetVersion(); void GetVersion();
void GetBuildIDFromFile(); void GetBuildIDFromFile();
void WriteCheats(const std::string& cheatContent); void WriteCheats(const std::string& cheatContent);
void DeleteCheats();
typedef struct typedef struct
{ {

View file

@ -24,5 +24,4 @@ private:
public: public:
ListDownloadTab(const contentType type, const nlohmann::ordered_json& nxlinks = nlohmann::ordered_json::object()); ListDownloadTab(const contentType type, const nlohmann::ordered_json& nxlinks = nlohmann::ordered_json::object());
brls::View* getDefaultFocus() override;
}; };

@ -1 +1 @@
Subproject commit 5bbadc951734876bc74490302de561c1bb0231ad Subproject commit 7c6ed9fae4f14f3bf5b31e53d57e2c230bd5fccc

View file

@ -81,7 +81,6 @@ void AmsTab::CreateDownloadItems(const nlohmann::ordered_json& cfw_links, bool h
}); });
this->addView(listItem); this->addView(listItem);
} }
this->size += 1;
} }
else { else {
description = new brls::Label( description = new brls::Label(
@ -214,9 +213,9 @@ void AmsTab::ShowCustomDeepseaBuilder(nlohmann::ordered_json& modules)
request_url += e + ";"; request_url += e + ";";
this->CreateStagedFrames("menus/common/download"_i18n + "Custom DeepSea package" + "menus/common/from"_i18n + request_url, this->CreateStagedFrames("menus/common/download"_i18n + "Custom DeepSea package" + "menus/common/from"_i18n + request_url,
request_url, request_url,
"menus/ams_update/get_custom_deepsea"_i18n, "menus/ams_update/get_custom_deepsea"_i18n,
this->erista); this->erista);
return true; return true;
}); });
appView->registerAction("", brls::Key::PLUS, [this] { return true; }); appView->registerAction("", brls::Key::PLUS, [this] { return true; });
@ -224,14 +223,6 @@ void AmsTab::ShowCustomDeepseaBuilder(nlohmann::ordered_json& modules)
brls::PopupFrame::open("menus/ams_update/deepsea_builder"_i18n, appView, modules.empty() ? "menus/ams_update/cant_fetch_deepsea"_i18n : "menus/ams_update/build_your_deepsea"_i18n, ""); brls::PopupFrame::open("menus/ams_update/deepsea_builder"_i18n, appView, modules.empty() ? "menus/ams_update/cant_fetch_deepsea"_i18n : "menus/ams_update/build_your_deepsea"_i18n, "");
} }
brls::View* AmsTab::getDefaultFocus()
{
if (this->size)
return this->brls::List::getDefaultFocus();
else
return nullptr;
}
bool UnTogglableListItem::onClick() bool UnTogglableListItem::onClick()
{ {
return true; return true;

View file

@ -62,8 +62,6 @@ void AppPage::PopulatePage()
} }
delete[] records; delete[] records;
this->CreateDownloadAllButton();
this->setContentView(list); this->setContentView(list);
} }
@ -255,8 +253,6 @@ void AppPage_Exclude::PopulatePage()
return true; return true;
}); });
this->CreateDownloadAllButton();
this->setContentView(list); this->setContentView(list);
} }
@ -278,7 +274,7 @@ void AppPage_DownloadedCheats::DeclareGameListItem(const std::string& name, u64
auto tid_str = util::formatApplicationId(tid); auto tid_str = util::formatApplicationId(tid);
if (titles.find(tid_str) != titles.end()) { if (titles.find(tid_str) != titles.end()) {
listItem->getClickEvent()->subscribe([tid, name](brls::View* view) { show_cheats::ShowCheatFiles(tid, name); }); listItem->getClickEvent()->subscribe([tid, name](brls::View* view) { show_cheats::ShowCheatFiles(tid, name); });
listItem->registerAction("menus/cheats/delete_cheats"_i18n, brls::Key::Y, [&tid_str] { listItem->registerAction("menus/cheats/delete_cheats"_i18n, brls::Key::Y, [tid_str] {
brls::Dialog* dialog = new brls::Dialog(extract::removeCheatsDirectory(fmt::format("{}{}", util::getContentsPath(), tid_str)) ? "menus/common/all_done"_i18n : fmt::format("menus/cheats/deletion_error"_i18n, tid_str)); brls::Dialog* dialog = new brls::Dialog(extract::removeCheatsDirectory(fmt::format("{}{}", util::getContentsPath(), tid_str)) ? "menus/common/all_done"_i18n : fmt::format("menus/cheats/deletion_error"_i18n, tid_str));
brls::GenericEvent::Callback callback = [dialog](brls::View* view) { brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close(); dialog->close();

View file

@ -23,6 +23,17 @@ namespace show_cheats {
brls::List* cheatsList = new brls::List(); brls::List* cheatsList = new brls::List();
if (std::filesystem::exists(path) && CreateCheatList(path, &cheatsList)) { if (std::filesystem::exists(path) && CreateCheatList(path, &cheatsList)) {
appView->setContentView(cheatsList); appView->setContentView(cheatsList);
appView->registerAction("menus/cheats/delete_file"_i18n, brls::Key::X, [tid, bid] {
DeleteCheats(tid, bid);
brls::Dialog* dialog = new brls::Dialog("menus/common/all_done"_i18n);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/common/ok"_i18n, callback);
dialog->setCancelable(true);
dialog->open();
return true;
});
brls::PopupFrame::open(name, appView, ""); brls::PopupFrame::open(name, appView, "");
} }
else { else {
@ -87,27 +98,33 @@ namespace show_cheats {
} }
return res; return res;
} }
void DeleteCheats(u64 tid, const std::string& bid)
{
std::filesystem::remove(fmt::format("{}{:016X}/cheats/{}.txt", util::getContentsPath(), tid, bid));
}
} // namespace show_cheats } // namespace show_cheats
DownloadCheatsPage::DownloadCheatsPage(uint64_t tid, const std::string& name) : AppletFrame(true, true), tid(tid) DownloadCheatsPage::DownloadCheatsPage(uint64_t tid, const std::string& name) : AppletFrame(true, true), tid(tid)
{ {
list = new brls::List(); this->list = new brls::List();
GetVersion(); this->GetVersion();
GetBuildID(); this->GetBuildID();
this->setTitle(name); this->setTitle(name);
this->setFooterText("v" + std::to_string(this->version / 0x10000)); this->setFooterText("v" + std::to_string(this->version / 0x10000));
this->registerAction("menus/cheats/show_existing"_i18n, brls::Key::X, [this, name] { this->registerAction("menus/cheats/show_existing"_i18n, brls::Key::X, [this, name] { // TODO: figure out why that doesn't show up for empty lists
show_cheats::ShowCheatSheet(this->tid, this->bid, name); show_cheats::ShowCheatSheet(this->tid, this->bid, name);
return true; return true;
}); });
this->rebuildHints();
} }
void DownloadCheatsPage::GetBuildID() void DownloadCheatsPage::GetBuildID()
{ {
if (CurrentCfw::running_cfw == CFW::ams) if (CurrentCfw::running_cfw == CFW::ams)
GetBuildIDFromDmnt(); this->GetBuildIDFromDmnt();
if (this->bid == "") if (this->bid == "")
GetBuildIDFromFile(); this->GetBuildIDFromFile();
} }
void DownloadCheatsPage::GetBuildIDFromDmnt() void DownloadCheatsPage::GetBuildIDFromDmnt()
@ -162,11 +179,6 @@ void DownloadCheatsPage::WriteCheats(const std::string& cheatContent)
<< cheatContent; << cheatContent;
} }
void DownloadCheatsPage::DeleteCheats()
{
std::filesystem::remove(util::getContentsPath() + util::formatApplicationId(this->tid) + "/cheats/" + this->bid + ".txt");
}
DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const std::string& name) : DownloadCheatsPage(tid, name) DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const std::string& name) : DownloadCheatsPage(tid, name)
{ {
label = new brls::Label( label = new brls::Label(
@ -287,18 +299,6 @@ DownloadCheatsPage_CheatSlips::DownloadCheatsPage_CheatSlips(uint64_t tid, const
return true; return true;
}); });
del = new brls::ListItem("menus/cheats/delete_file"_i18n);
del->getClickEvent()->subscribe([this](brls::View* view) {
DeleteCheats();
brls::Dialog* dialog = new brls::Dialog("menus/common/all_done"_i18n);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/common/ok"_i18n, callback);
dialog->setCancelable(true);
dialog->open();
});
list->addView(del);
this->setContentView(list); this->setContentView(list);
} }
@ -369,17 +369,5 @@ DownloadCheatsPage_GbaTemp::DownloadCheatsPage_GbaTemp(uint64_t tid, const std::
list->addView(label); list->addView(label);
} }
del = new brls::ListItem("menus/cheats/delete_file"_i18n);
del->getClickEvent()->subscribe([this](brls::View* view) {
DeleteCheats();
brls::Dialog* dialog = new brls::Dialog("menus/common/all_done"_i18n);
brls::GenericEvent::Callback callback = [dialog](brls::View* view) {
dialog->close();
};
dialog->addButton("menus/common/ok"_i18n, callback);
dialog->setCancelable(true);
dialog->open();
});
list->addView(del);
this->setContentView(list); this->setContentView(list);
} }

View file

@ -51,8 +51,7 @@ void ListDownloadTab::createList(contentType type)
else else
links = download::getLinksFromJson(util::getValueFromKey(this->nxlinks, contentTypeNames[(int)type].data())); links = download::getLinksFromJson(util::getValueFromKey(this->nxlinks, contentTypeNames[(int)type].data()));
this->size = links.size(); if (links.size()) {
if (this->size) {
for (const auto& link : links) { for (const auto& link : links) {
const std::string title = link.first; const std::string title = link.first;
const std::string url = link.second; const std::string url = link.second;
@ -154,7 +153,6 @@ void ListDownloadTab::setDescription()
void ListDownloadTab::createCheatSlipItem() void ListDownloadTab::createCheatSlipItem()
{ {
this->size += 1;
cheatslipsItem = new brls::ListItem("menus/cheats/get_cheatslips"_i18n); cheatslipsItem = new brls::ListItem("menus/cheats/get_cheatslips"_i18n);
cheatslipsItem->setHeight(LISTITEM_HEIGHT); cheatslipsItem->setHeight(LISTITEM_HEIGHT);
cheatslipsItem->getClickEvent()->subscribe([](brls::View* view) { cheatslipsItem->getClickEvent()->subscribe([](brls::View* view) {
@ -198,7 +196,6 @@ void ListDownloadTab::createCheatSlipItem()
void ListDownloadTab::creategbatempItem() void ListDownloadTab::creategbatempItem()
{ {
this->size += 1;
gbatempItem = new brls::ListItem("menus/cheats/get_gbatemp"_i18n); gbatempItem = new brls::ListItem("menus/cheats/get_gbatemp"_i18n);
gbatempItem->setHeight(LISTITEM_HEIGHT); gbatempItem->setHeight(LISTITEM_HEIGHT);
gbatempItem->getClickEvent()->subscribe([](brls::View* view) { gbatempItem->getClickEvent()->subscribe([](brls::View* view) {
@ -206,12 +203,4 @@ void ListDownloadTab::creategbatempItem()
return true; return true;
}); });
this->addView(gbatempItem); this->addView(gbatempItem);
}
brls::View* ListDownloadTab::getDefaultFocus()
{
if (this->size)
return this->brls::List::getDefaultFocus();
else
return nullptr;
} }