1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-12-28 18:36:02 +00:00
This commit is contained in:
flb 2021-04-15 13:24:11 +02:00
parent 5d436c5b8e
commit 271e2ae78c
5 changed files with 27 additions and 4 deletions

View file

@ -8,6 +8,8 @@ class AmsTab : public brls::List
brls::ListItem* listItem;
brls::Label *notFound;
brls::Label *description;
int size;
public:
AmsTab();
brls::View* getDefaultFocus() override;
};

View file

@ -13,5 +13,5 @@ class ChoicePage: public brls::View
ChoicePage(brls::StagedAppletFrame* frame, std::string text);
void draw(NVGcontext* vg, int x, int y, unsigned width, unsigned height, brls::Style* style, brls::FrameContext* ctx) override;
void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) override;
brls::View* getDefaultFocus() override;
brls::View* getDefaultFocus() override;
};

View file

@ -11,7 +11,9 @@ class ListDownloadTab : public brls::List
brls::Label *notFound;
brls::Label *description;
brls::Label *cheatSlipLabel;
int size;
public:
ListDownloadTab(const archiveType type);
brls::View* getDefaultFocus() override;
};

View file

@ -1,5 +1,4 @@
#include "ams_tab.hpp"
#include <string>
#include "download.hpp"
#include "extract.hpp"
#include "confirm_page.hpp"
@ -7,6 +6,7 @@
#include "worker_page.hpp"
#include "utils.hpp"
#include "current_cfw.hpp"
#include <string>
namespace i18n = brls::i18n;
using namespace i18n::literals;
@ -21,7 +21,8 @@ AmsTab::AmsTab() :
operation += "menus/main/ams"_i18n;
links = download::getLinks(AMS_URL);
if(links.size()){
this->size = links.size();
if(this->size){
auto hekate_link = download::getLinks(HEKATE_URL);
std::string hekate_url = hekate_link[0].second;
std::string text_hekate = "menus/common/download"_i18n + hekate_link[0].first;
@ -71,4 +72,12 @@ AmsTab::AmsTab() :
notFound->setHorizontalAlign(NVG_ALIGN_CENTER);
this->addView(notFound);
}
}
brls::View* AmsTab::getDefaultFocus()
{
if(this->size)
return this->brls::List::getDefaultFocus();
else
return nullptr;
}

View file

@ -78,7 +78,8 @@ ListDownloadTab::ListDownloadTab(const archiveType type) :
this->addView(description);
if(links.size()){
this->size = links.size();
if(this->size){
for (const auto& link : links){
std::string url = link.second;
std::string text("menus/common/download"_i18n + link.first + "menus/common/from"_i18n + url);
@ -126,6 +127,7 @@ ListDownloadTab::ListDownloadTab(const archiveType type) :
true
);
this->addView(cheatSlipLabel);
this->size += 1;
cheatslipsItem = new brls::ListItem("menus/cheats/get_cheatslips"_i18n);
cheatslipsItem->setHeight(LISTITEM_HEIGHT);
cheatslipsItem->getClickEvent()->subscribe([&](brls::View* view) {
@ -181,4 +183,12 @@ ListDownloadTab::ListDownloadTab(const archiveType type) :
});
this->addView(cheatslipsItem);
}
}
brls::View* ListDownloadTab::getDefaultFocus()
{
if(this->size)
return this->brls::List::getDefaultFocus();
else
return nullptr;
}