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"
|
2021-03-16 02:43:48 +00:00
|
|
|
#include <json.hpp>
|
2021-02-10 16:28:47 +00:00
|
|
|
#include <fstream>
|
|
|
|
#include "utils.hpp"
|
2021-03-16 14:56:46 +00:00
|
|
|
#include "fs.hpp"
|
2021-03-10 20:43:00 +00:00
|
|
|
|
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));
|
|
|
|
|
2021-03-16 02:04:21 +00:00
|
|
|
std::string tag = util::getLatestTag(TAGS_INFO);
|
2020-09-29 15:41:43 +01:00
|
|
|
if(!tag.empty() && tag != APP_VERSION)
|
2021-03-10 20:54:17 +00:00
|
|
|
this->setFooterText("v" + std::string(APP_VERSION) + "menus/main/new_update"_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-03-16 14:56:46 +00:00
|
|
|
json hideStatus = fs::parseJsonFile(HIDE_TABS_JSON);
|
2021-02-06 17:24:47 +00:00
|
|
|
|
2021-05-21 17:12:58 +01:00
|
|
|
//bool erista = util::isErista();
|
|
|
|
bool erista = false;
|
2021-02-17 18:00:12 +00:00
|
|
|
|
2021-02-06 17:24:47 +00:00
|
|
|
if(hideStatus.find("about") == hideStatus.end() || !hideStatus["about"])
|
2021-03-01 18:19:17 +00:00
|
|
|
this->addTab("menus/main/about"_i18n, new AboutTab());
|
2021-02-01 16:01:49 +00:00
|
|
|
|
2021-05-21 17:12:58 +01:00
|
|
|
if(hideStatus.find("atmosphere") == hideStatus.end() || !hideStatus["atmosphere"])
|
|
|
|
this->addTab("menus/main/update_ams"_i18n, new AmsTab(erista));
|
2021-02-06 17:24:47 +00:00
|
|
|
|
|
|
|
if(hideStatus.find("cfw") == hideStatus.end() || !hideStatus["cfw"])
|
2021-03-16 02:04:21 +00:00
|
|
|
this->addTab("menus/main/update_cfw"_i18n, new ListDownloadTab(archiveType::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"])
|
2021-03-16 02:04:21 +00:00
|
|
|
this->addTab("menus/main/update_sigpatches"_i18n, new ListDownloadTab(archiveType::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"])
|
2021-03-16 02:04:21 +00:00
|
|
|
this->addTab("menus/main/download_firmware"_i18n, new ListDownloadTab(archiveType::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"])
|
2021-03-16 02:04:21 +00:00
|
|
|
this->addTab("menus/main/download_cheats"_i18n, new ListDownloadTab(archiveType::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"])
|
2021-03-10 20:54:17 +00:00
|
|
|
this->addTab("menus/main/tools"_i18n, new ToolsTab(tag, erista));
|
2020-10-05 23:53:12 +01:00
|
|
|
|
2021-02-15 18:31:06 +00:00
|
|
|
this->registerAction("" , brls::Key::B, [this] { return true; });
|
2020-09-20 01:21:28 +01:00
|
|
|
}
|