2020-09-20 01:21:28 +01:00
|
|
|
#include "main_frame.hpp"
|
2021-02-10 16:28:47 +00:00
|
|
|
#include "about_tab.hpp"
|
|
|
|
#include "list_download_tab.hpp"
|
|
|
|
#include "ams_tab.hpp"
|
|
|
|
#include "tools_tab.hpp"
|
|
|
|
#include "json.hpp"
|
|
|
|
#include <fstream>
|
|
|
|
#include "utils.hpp"
|
2020-10-05 23:53:12 +01:00
|
|
|
|
|
|
|
namespace i18n = brls::i18n;
|
|
|
|
using namespace i18n::literals;
|
2021-02-06 17:24:47 +00:00
|
|
|
using json = nlohmann::json;
|
2020-10-05 23:53:12 +01:00
|
|
|
|
2020-09-20 01:21:28 +01:00
|
|
|
MainFrame::MainFrame() : TabFrame()
|
|
|
|
{
|
2021-02-01 16:01:49 +00:00
|
|
|
this->setIcon("romfs:/gui_icon.png");
|
|
|
|
this->setTitle(std::string(APP_TITLE));
|
|
|
|
|
2020-09-29 15:41:43 +01:00
|
|
|
std::string tag = getLatestTag(TAGS_INFO);
|
|
|
|
if(!tag.empty() && tag != APP_VERSION)
|
2021-02-01 16:01:49 +00:00
|
|
|
this->setFooterText("v" + std::string(APP_VERSION) + "menus/main_app"_i18n );
|
2021-01-29 21:28:37 +00:00
|
|
|
else
|
2021-02-01 16:01:49 +00:00
|
|
|
this->setFooterText("v" + std::string(APP_VERSION));
|
2021-02-10 16:28:47 +00:00
|
|
|
|
2021-02-06 17:24:47 +00:00
|
|
|
json hideStatus;
|
|
|
|
std::ifstream hideFile(HIDE_TABS_JSON);
|
|
|
|
|
|
|
|
std::string fileContent((std::istreambuf_iterator<char>(hideFile) ),
|
|
|
|
(std::istreambuf_iterator<char>() ));
|
|
|
|
|
|
|
|
if(json::accept(fileContent)) hideStatus = json::parse(fileContent);
|
|
|
|
else hideStatus = json::object();
|
|
|
|
|
|
|
|
if(hideStatus.find("about") == hideStatus.end() || !hideStatus["about"])
|
|
|
|
this->addTab("menus/main_about"_i18n, new AboutTab());
|
2021-02-01 16:01:49 +00:00
|
|
|
|
2021-02-06 17:24:47 +00:00
|
|
|
if(hideStatus.find("atmosphere") == hideStatus.end() || !hideStatus["atmosphere"])
|
|
|
|
this->addTab("menus/main_update_ams"_i18n, new AmsTab());
|
|
|
|
|
|
|
|
if(hideStatus.find("cfw") == hideStatus.end() || !hideStatus["cfw"])
|
|
|
|
this->addTab("menus/main_update_cfw"_i18n, new ListDownloadTab(cfw));
|
2020-09-20 01:21:28 +01:00
|
|
|
|
2021-02-06 17:24:47 +00:00
|
|
|
if(hideStatus.find("sigpatches") == hideStatus.end() || !hideStatus["sigpatches"])
|
|
|
|
this->addTab("menus/main_update_si"_i18n, new ListDownloadTab(sigpatches));
|
2020-09-20 01:21:28 +01:00
|
|
|
|
2021-02-06 17:24:47 +00:00
|
|
|
if(hideStatus.find("firmwares") == hideStatus.end() || !hideStatus["firmwares"])
|
|
|
|
this->addTab("menus/main_firmwares"_i18n, new ListDownloadTab(fw));
|
2020-09-20 01:21:28 +01:00
|
|
|
|
2021-02-06 17:24:47 +00:00
|
|
|
if(hideStatus.find("cheats") == hideStatus.end() || !hideStatus["cheats"])
|
|
|
|
this->addTab("menus/main_cheats"_i18n, new ListDownloadTab(cheats));
|
2020-10-05 23:53:12 +01:00
|
|
|
|
2021-02-16 00:46:39 +00:00
|
|
|
if(hideStatus.find("tools") == hideStatus.end() || !hideStatus["tools"])
|
|
|
|
this->addTab("menus/main_tools"_i18n , new ToolsTab(tag));
|
2020-10-05 23:53:12 +01:00
|
|
|
|
2021-02-15 18:31:06 +00:00
|
|
|
this->registerAction("" , brls::Key::B, [this] { return true; });
|
2021-02-15 00:02:34 +00:00
|
|
|
|
2020-09-20 01:21:28 +01:00
|
|
|
}
|