add theme stuff to theme inst page

This commit is contained in:
mrdude2478 2023-10-03 05:17:45 +01:00
parent 170b09621e
commit 32b41f5605
8 changed files with 227 additions and 101 deletions

View File

@ -6,6 +6,7 @@
#include "util/util.hpp" #include "util/util.hpp"
#include "util/config.hpp" #include "util/config.hpp"
#include "util/lang.hpp" #include "util/lang.hpp"
#include "util/theme.hpp"
#define COLOR(hex) pu::ui::Color::FromHex(hex) #define COLOR(hex) pu::ui::Color::FromHex(hex)
@ -15,25 +16,55 @@ namespace inst::ui {
bool show_file_ext; bool show_file_ext;
HDInstPage::HDInstPage() : Layout::Layout() { HDInstPage::HDInstPage() : Layout::Layout() {
this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#00000080")); std::string infoRect_colour = "colour.inforect"_theme;
this->SetBackgroundColor(COLOR("#000000FF")); std::string bg_colour = "colour.background"_theme;
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF")); std::string tbar_colour = "colour.topbar"_theme;
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF")); std::string bbar_colour = "colour.bottombar"_theme;
std::string hd_top = inst::config::appDir + "bg_images.hd_top"_theme;
std::string default_background = inst::config::appDir + "bg_images.default_background"_theme;
std::string pageinfo_colour = "colour.pageinfo_text"_theme;
std::string bottombar_text = "colour.bottombar_text"_theme;
std::string background_overlay1 = "colour.background_overlay1"_theme;
std::string background_overlay2 = "colour.background_overlay2"_theme;
std::string focus = "colour.focus"_theme;
std::string scrollbar = "colour.scrollbar"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/images/Hd.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/theme/images/Hd.png")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR(infoRect_colour));
else this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#00000080"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->SetBackgroundColor(COLOR(bg_colour));
else this->SetBackgroundColor(COLOR("#000000FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR(tbar_colour));
else this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR(bbar_colour));
else this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(hd_top)) this->titleImage = Image::New(0, 0, (hd_top));
else this->titleImage = Image::New(0, 0, "romfs:/images/Hd.png"); else this->titleImage = Image::New(0, 0, "romfs:/images/Hd.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/theme/images/Background.png"); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(default_background)) this->SetBackgroundImage(default_background);
else this->SetBackgroundImage("romfs:/images/Background.png"); else this->SetBackgroundImage("romfs:/images/Background.png");
this->pageInfoText = TextBlock::New(10, 109, "inst.hd.top_info"_lang); this->pageInfoText = TextBlock::New(10, 109, "inst.hd.top_info"_lang);
this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30)); this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->pageInfoText->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->pageInfoText->SetColor(COLOR(pageinfo_colour));
else this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->butText = TextBlock::New(10, 678, "inst.hd.buttons"_lang); this->butText = TextBlock::New(10, 678, "inst.hd.buttons"_lang);
this->butText->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->butText->SetColor(COLOR(bottombar_text));
this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR("#FFFFFF00"), COLOR("#4f4f4d33"), 84, 6); else this->butText->SetColor(COLOR("#FFFFFFFF"));
this->menu->SetItemsFocusColor(COLOR("#4f4f4dAA"));
this->menu->SetScrollbarColor(COLOR("#1A1919FF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR(background_overlay1), COLOR(background_overlay2), 84, (506 / 84));
else this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR("#FFFFFF00"), COLOR("#4f4f4d33"), 84, (506 / 84));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->menu->SetItemsFocusColor(COLOR(focus));
else this->menu->SetItemsFocusColor(COLOR("#4f4f4dAA"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->menu->SetScrollbarColor(COLOR(scrollbar));
else this->menu->SetScrollbarColor(COLOR("#1A1919FF"));
this->Add(this->topRect); this->Add(this->topRect);
this->Add(this->infoRect); this->Add(this->infoRect);
this->Add(this->botRect); this->Add(this->botRect);
@ -46,6 +77,7 @@ namespace inst::ui {
void HDInstPage::drawMenuItems(bool clearItems, std::filesystem::path ourPath) { void HDInstPage::drawMenuItems(bool clearItems, std::filesystem::path ourPath) {
int myindex = this->menu->GetSelectedIndex(); //store index so when page redraws we can get the last item we checked. int myindex = this->menu->GetSelectedIndex(); //store index so when page redraws we can get the last item we checked.
if (clearItems) this->selectedTitles = {}; if (clearItems) this->selectedTitles = {};
std::string text_colour = "colour.main_text"_theme;
this->currentDir = ourPath; this->currentDir = ourPath;
auto pathStr = this->currentDir.string(); auto pathStr = this->currentDir.string();
@ -69,16 +101,29 @@ namespace inst::ui {
std::string itm = ".."; std::string itm = "..";
auto ourEntry = pu::ui::elm::MenuItem::New(itm); auto ourEntry = pu::ui::elm::MenuItem::New(itm);
ourEntry->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
ourEntry->SetIcon("romfs:/images/icons/folder-upload.png"); else ourEntry->SetColor(COLOR("#FFFFFFFF"));
std::string folder_up = "romfs:/images/icons/folder-upload.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.folder_up"_theme)) {
folder_up = inst::config::appDir + "icons_others.folder_up"_theme;
}
ourEntry->SetIcon(folder_up);
this->menu->AddItem(ourEntry); this->menu->AddItem(ourEntry);
for (auto& file : this->ourDirectories) { for (auto& file : this->ourDirectories) {
if (file == "..") break; if (file == "..") break;
std::string itm = file.filename().string(); std::string itm = file.filename().string();
auto ourEntry = pu::ui::elm::MenuItem::New(itm); auto ourEntry = pu::ui::elm::MenuItem::New(itm);
ourEntry->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
ourEntry->SetIcon("romfs:/images/icons/folder.png"); else ourEntry->SetColor(COLOR("#FFFFFFFF"));
std::string folder_up = "romfs:/images/icons/folder-upload.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.folder_up"_theme)) {
folder_up = inst::config::appDir + "icons_others.folder_up"_theme;
}
ourEntry->SetIcon(folder_up);
this->menu->AddItem(ourEntry); this->menu->AddItem(ourEntry);
} }
for (auto& file : this->ourFiles) { for (auto& file : this->ourFiles) {
@ -90,7 +135,8 @@ namespace inst::ui {
itm = file.filename().string(); itm = file.filename().string();
} }
auto ourEntry = pu::ui::elm::MenuItem::New(itm); auto ourEntry = pu::ui::elm::MenuItem::New(itm);
ourEntry->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png"); ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) { for (long unsigned int i = 0; i < this->selectedTitles.size(); i++) {
if (this->selectedTitles[i] == file) { if (this->selectedTitles[i] == file) {
@ -139,10 +185,14 @@ namespace inst::ui {
void HDInstPage::startInstall() { void HDInstPage::startInstall() {
int dialogResult = -1; int dialogResult = -1;
if (this->selectedTitles.size() == 1) { std::string install = "romfs:/images/icons/install.png";
dialogResult = mainApp->CreateShowDialog("inst.target.desc0"_lang + ":\n\n" + inst::util::shortenString(std::filesystem::path(this->selectedTitles[0]).filename().string(), 32, true) + "\n\n" + "inst.target.desc1"_lang, "\n\n\n\n\n\n\n" + "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false, "romfs:/images/icons/install.png"); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.install"_theme)) {
install = inst::config::appDir + "icons_others.install"_theme;
} }
else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedTitles.size()) + "inst.target.desc01"_lang, "\n" + "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false, "romfs:/images/icons/install.png"); if (this->selectedTitles.size() == 1) {
dialogResult = mainApp->CreateShowDialog("inst.target.desc0"_lang + ":\n\n" + inst::util::shortenString(std::filesystem::path(this->selectedTitles[0]).filename().string(), 32, true) + "\n\n" + "inst.target.desc1"_lang, "\n\n\n\n\n\n\n" + "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false, install);
}
else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedTitles.size()) + "inst.target.desc01"_lang, "\n" + "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false, install);
if (dialogResult == -1) return; if (dialogResult == -1) return;
nspInstStuff_B::installNspFromFile(this->selectedTitles, dialogResult); nspInstStuff_B::installNspFromFile(this->selectedTitles, dialogResult);
} }
@ -184,7 +234,11 @@ namespace inst::ui {
} }
if ((Down & HidNpadButton_X)) { if ((Down & HidNpadButton_X)) {
inst::ui::mainApp->CreateShowDialog("inst.hd.help.title"_lang, "inst.hd.help.desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png"); std::string information = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
information = inst::config::appDir + "icons_others.information"_theme;
}
inst::ui::mainApp->CreateShowDialog("inst.hd.help.title"_lang, "inst.hd.help.desc"_lang, { "common.ok"_lang }, true, information);
} }
if (Down & HidNpadButton_Plus) { if (Down & HidNpadButton_Plus) {

View File

@ -10,6 +10,7 @@
#include "ThemeInstall.hpp" #include "ThemeInstall.hpp"
#include "util/unzip.hpp" #include "util/unzip.hpp"
#include "ui/instPage.hpp" #include "ui/instPage.hpp"
#include "util/theme.hpp"
#include <sstream> #include <sstream>
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
@ -28,26 +29,62 @@ namespace inst::ui {
std::string ourPath = inst::config::appDir + "/temp_download.zip"; std::string ourPath = inst::config::appDir + "/temp_download.zip";
ThemeInstPage::ThemeInstPage() : Layout::Layout() { ThemeInstPage::ThemeInstPage() : Layout::Layout() {
this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#00000080")); std::string default_background = inst::config::appDir + "bg_images.default_background"_theme;
this->SetBackgroundColor(COLOR("#000000FF")); std::string theme_top = inst::config::appDir + "bg_images.theme_top"_theme;
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF")); std::string bg_colour = "colour.background"_theme;
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF")); std::string tbar_colour = "colour.topbar"_theme;
std::string bbar_colour = "colour.bottombar"_theme;
std::string infoRect_colour = "colour.inforect"_theme;
std::string pageinfo_colour = "colour.pageinfo_text"_theme;
std::string bottombar_text = "colour.bottombar_text"_theme;
std::string background_overlay1 = "colour.background_overlay1"_theme;
std::string background_overlay2 = "colour.background_overlay2"_theme;
std::string focus = "colour.focus"_theme;
std::string scrollbar = "colour.scrollbar"_theme;
std::string waiting = inst::config::appDir + "icons_others.waiting_lan"_theme;
std::string progress_bg_colour = "colour.progress_bg"_theme;
std::string progress_fg_colour = "colour.progress_fg"_theme;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/images/Net.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/theme/images/Net.png")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR(infoRect_colour));
else this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#00000080"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->SetBackgroundColor(COLOR(bg_colour));
else this->SetBackgroundColor(COLOR("#000000FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR(tbar_colour));
else this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR(bbar_colour));
else this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(theme_top)) this->titleImage = Image::New(0, 0, (theme_top));
else this->titleImage = Image::New(0, 0, "romfs:/images/Net.png"); else this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/theme/images/Background.png"); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(default_background)) this->SetBackgroundImage(default_background);
else this->SetBackgroundImage("romfs:/images/Background.png"); else this->SetBackgroundImage("romfs:/images/Background.png");
this->pageInfoText = TextBlock::New(10, 109, ""); this->pageInfoText = TextBlock::New(10, 109, "inst.hd.top_info"_lang);
this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30)); this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->butText = TextBlock::New(10, 678, ""); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->pageInfoText->SetColor(COLOR(pageinfo_colour));
this->butText->SetColor(COLOR("#FFFFFFFF")); else this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR("#FFFFFF00"), COLOR("#4f4f4d33"), 84, (506 / 84));
this->menu->SetItemsFocusColor(COLOR("#4f4f4dAA")); this->butText = TextBlock::New(10, 678, "inst.hd.buttons"_lang);
this->menu->SetScrollbarColor(COLOR("#1A1919FF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->butText->SetColor(COLOR(bottombar_text));
this->infoImage = Image::New(453, 292, "romfs:/images/icons/lan-connection-waiting.png"); else this->butText->SetColor(COLOR("#FFFFFFFF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR(background_overlay1), COLOR(background_overlay2), 84, (506 / 84));
else this->menu = pu::ui::elm::Menu::New(0, 156, 1280, COLOR("#FFFFFF00"), COLOR("#4f4f4d33"), 84, (506 / 84));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->menu->SetItemsFocusColor(COLOR(focus));
else this->menu->SetItemsFocusColor(COLOR("#4f4f4dAA"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->menu->SetScrollbarColor(COLOR(scrollbar));
else this->menu->SetScrollbarColor(COLOR("#1A1919FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(waiting)) this->infoImage = Image::New(453, 292, waiting);
else this->infoImage = Image::New(453, 292, "romfs:/images/icons/lan-connection-waiting.png");
this->Add(this->topRect); this->Add(this->topRect);
this->Add(this->infoRect); this->Add(this->infoRect);
this->Add(this->botRect); this->Add(this->botRect);
@ -56,9 +93,14 @@ namespace inst::ui {
this->Add(this->pageInfoText); this->Add(this->pageInfoText);
this->Add(this->menu); this->Add(this->menu);
this->Add(this->infoImage); this->Add(this->infoImage);
this->installBar = pu::ui::elm::ProgressBar::New(10, 675, 1260, 35, 100.0f); this->installBar = pu::ui::elm::ProgressBar::New(10, 675, 1260, 35, 100.0f);
this->installBar->SetBackgroundColor(COLOR("#000000FF"));
this->installBar->SetProgressColor(COLOR("#00FF00FF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->installBar->SetBackgroundColor(COLOR(progress_bg_colour));
else this->installBar->SetBackgroundColor(COLOR("#000000FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->installBar->SetProgressColor(COLOR(progress_fg_colour));
else this->installBar->SetProgressColor(COLOR("#565759FF"));
this->Add(this->installBar); this->Add(this->installBar);
} }
@ -69,12 +111,14 @@ namespace inst::ui {
mainApp->ThemeinstPage->installBar->SetProgress(0); mainApp->ThemeinstPage->installBar->SetProgress(0);
mainApp->ThemeinstPage->installBar->SetVisible(false); mainApp->ThemeinstPage->installBar->SetVisible(false);
std::string itm; std::string itm;
std::string text_colour = "colour.main_text"_theme;
this->menu->ClearItems(); this->menu->ClearItems();
for (auto& urls : this->ourUrls) { for (auto& urls : this->ourUrls) {
itm = inst::util::shortenString(inst::util::formatUrlString(urls), 56, true); itm = inst::util::shortenString(inst::util::formatUrlString(urls), 56, true);
auto ourEntry = pu::ui::elm::MenuItem::New(itm); auto ourEntry = pu::ui::elm::MenuItem::New(itm);
ourEntry->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png"); ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
long unsigned int i; long unsigned int i;
for (i = 0; i < this->selectedUrls.size(); i++) { for (i = 0; i < this->selectedUrls.size(); i++) {
@ -92,6 +136,7 @@ namespace inst::ui {
if (clearItems) this->selectedUrls = {}; if (clearItems) this->selectedUrls = {};
if (clearItems) this->alternativeNames = {}; if (clearItems) this->alternativeNames = {};
std::string itm; std::string itm;
std::string text_colour = "colour.main_text"_theme;
mainApp->ThemeinstPage->installBar->SetProgress(0); mainApp->ThemeinstPage->installBar->SetProgress(0);
mainApp->ThemeinstPage->installBar->SetVisible(false); mainApp->ThemeinstPage->installBar->SetVisible(false);
@ -104,8 +149,10 @@ namespace inst::ui {
itm = inst::util::shortenString(inst::util::formatUrlString(file_without_extension), 56, true); itm = inst::util::shortenString(inst::util::formatUrlString(file_without_extension), 56, true);
//itm = inst::util::shortenString(inst::util::formatUrlString(urls), 56, true); //itm = inst::util::shortenString(inst::util::formatUrlString(urls), 56, true);
auto ourEntry = pu::ui::elm::MenuItem::New(itm); auto ourEntry = pu::ui::elm::MenuItem::New(itm);
ourEntry->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png"); ourEntry->SetIcon("romfs:/images/icons/checkbox-blank-outline.png");
long unsigned int i; long unsigned int i;
for (i = 0; i < this->selectedUrls.size(); i++) { for (i = 0; i < this->selectedUrls.size(); i++) {
if (this->selectedUrls[i] == urls) { if (this->selectedUrls[i] == urls) {
@ -192,13 +239,22 @@ namespace inst::ui {
installing = 0; installing = 0;
inst::ui::mainApp->ThemeinstPage->setInstBarPerc(0); inst::ui::mainApp->ThemeinstPage->setInstBarPerc(0);
mainApp->ThemeinstPage->installBar->SetVisible(false); mainApp->ThemeinstPage->installBar->SetVisible(false);
inst::ui::mainApp->CreateShowDialog("theme.theme_error"_lang, "theme.theme_error_info"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/fail.png");
std::string fail = "romfs:/images/icons/fail.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
fail = inst::config::appDir + "icons_others.fail"_theme;
}
inst::ui::mainApp->CreateShowDialog("theme.theme_error"_lang, "theme.theme_error_info"_lang, { "common.ok"_lang }, true, fail);
return; return;
} }
std::filesystem::remove(ourPath); std::filesystem::remove(ourPath);
if (didExtract) { if (didExtract) {
inst::ui::mainApp->ThemeinstPage->pageInfoText->SetText("theme.extracted"_lang); inst::ui::mainApp->ThemeinstPage->pageInfoText->SetText("theme.extracted"_lang);
int close = inst::ui::mainApp->CreateShowDialog("theme.installed"_lang, "theme.restart"_lang, { "sig.later"_lang, "sig.restart"_lang }, false, "romfs:/images/icons/good.png"); std::string good = "romfs:/images/icons/good.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.good"_theme)) {
good = inst::config::appDir + "icons_others.good"_theme;
}
int close = inst::ui::mainApp->CreateShowDialog("theme.installed"_lang, "theme.restart"_lang, { "sig.later"_lang, "sig.restart"_lang }, false, good);
inst::ui::mainApp->ThemeinstPage->setInstBarPerc(0); inst::ui::mainApp->ThemeinstPage->setInstBarPerc(0);
mainApp->ThemeinstPage->installBar->SetVisible(false); mainApp->ThemeinstPage->installBar->SetVisible(false);
if (close != 0) { if (close != 0) {
@ -221,7 +277,11 @@ namespace inst::ui {
} }
} }
else { else {
inst::ui::mainApp->CreateShowDialog("theme.wait"_lang, "theme.trying"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png"); std::string information = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
information = inst::config::appDir + "icons_others.good"_theme;
}
inst::ui::mainApp->CreateShowDialog("theme.wait"_lang, "theme.trying"_lang, { "common.ok"_lang }, true, information);
} }
installing = 0; installing = 0;
} }
@ -233,7 +293,11 @@ namespace inst::ui {
mainApp->LoadLayout(mainApp->optionspage); mainApp->LoadLayout(mainApp->optionspage);
} }
else { else {
inst::ui::mainApp->CreateShowDialog("theme.wait"_lang, "theme.trying"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png"); std::string information = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
information = inst::config::appDir + "icons_others.good"_theme;
}
inst::ui::mainApp->CreateShowDialog("theme.wait"_lang, "theme.trying"_lang, { "common.ok"_lang }, true, information);
} }
} }

View File

@ -81,7 +81,8 @@ namespace inst::ui {
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->countText->SetColor(COLOR(count_colour)); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->countText->SetColor(COLOR(count_colour));
else this->countText->SetColor(COLOR("#FFFFFFFF")); else this->countText->SetColor(COLOR("#FFFFFFFF"));
this->installBar = pu::ui::elm::ProgressBar::New(10, 680, 1260, 30, 100.0f); //this->installBar = pu::ui::elm::ProgressBar::New(10, 680, 1260, 30, 100.0f);
this->installBar = pu::ui::elm::ProgressBar::New(10, 675, 1260, 35, 100.0f);
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->installBar->SetBackgroundColor(COLOR(progress_bg_colour)); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->installBar->SetBackgroundColor(COLOR(progress_bg_colour));
else this->installBar->SetBackgroundColor(COLOR("#000000FF")); else this->installBar->SetBackgroundColor(COLOR("#000000FF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->installBar->SetProgressColor(COLOR(progress_fg_colour)); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->installBar->SetProgressColor(COLOR(progress_fg_colour));

View File

@ -128,7 +128,7 @@ namespace inst::ui {
std::string Info = ("usage.system_size"_lang + sdsize2 + "usage.gb"_lang + "usage.freespace"_lang + freespace2 + "usage.gb"_lang + "usage.percent_used"_lang + percent2 + "usage.percent"_lang + "usage.sd_size"_lang + sdsize + "usage.gb"_lang + "usage.sd_space"_lang + freespace + "usage.gb"_lang + "usage.sd_used"_lang + percent + "usage.percent_symbol"_lang); std::string Info = ("usage.system_size"_lang + sdsize2 + "usage.gb"_lang + "usage.freespace"_lang + freespace2 + "usage.gb"_lang + "usage.percent_used"_lang + percent2 + "usage.percent"_lang + "usage.sd_size"_lang + sdsize + "usage.gb"_lang + "usage.sd_space"_lang + freespace + "usage.gb"_lang + "usage.sd_used"_lang + percent + "usage.percent_symbol"_lang);
std::string drive = "romfs:/images/icons/drive.png"; std::string drive = "romfs:/images/icons/drive.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.drive"_theme)){ if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.drive"_theme)) {
drive = inst::config::appDir + "icons_others.drive"_theme; drive = inst::config::appDir + "icons_others.drive"_theme;
} }
inst::ui::mainApp->CreateShowDialog("usage.space_info"_lang, Info, { "common.ok"_lang }, true, "romfs:/images/icons/drive.png"); inst::ui::mainApp->CreateShowDialog("usage.space_info"_lang, Info, { "common.ok"_lang }, true, "romfs:/images/icons/drive.png");
@ -141,7 +141,7 @@ namespace inst::ui {
if (menuLoaded) { if (menuLoaded) {
inst::ui::appletFinished = true; inst::ui::appletFinished = true;
std::string information = "romfs:/images/icons/information.png"; std::string information = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)){ if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
information = inst::config::appDir + "icons_others.information"_theme; information = inst::config::appDir + "icons_others.information"_theme;
} }
mainApp->CreateShowDialog("main.applet.title"_lang, "main.applet.desc"_lang, { "common.ok"_lang }, true, information); mainApp->CreateShowDialog("main.applet.title"_lang, "main.applet.desc"_lang, { "common.ok"_lang }, true, information);

View File

@ -194,7 +194,7 @@ namespace inst::ui {
else if (this->ourUrls[0] == "supplyUrl") { else if (this->ourUrls[0] == "supplyUrl") {
std::string keyboardResult; std::string keyboardResult;
std::string update = "romfs:/images/icons/update.png"; std::string update = "romfs:/images/icons/update.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.update"_theme)){ if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.update"_theme)) {
update = inst::config::appDir + "icons_others.update"_theme; update = inst::config::appDir + "icons_others.update"_theme;
} }
switch (mainApp->CreateShowDialog("inst.net.src.title"_lang, "common.cancel_desc"_lang, { "inst.net.src.opt0"_lang, "inst.net.src.opt1"_lang }, false, update)) { switch (mainApp->CreateShowDialog("inst.net.src.title"_lang, "common.cancel_desc"_lang, { "inst.net.src.opt0"_lang, "inst.net.src.opt1"_lang }, false, update)) {
@ -213,7 +213,7 @@ namespace inst::ui {
if (inst::util::formatUrlString(keyboardResult) == "" || keyboardResult == "https://" || keyboardResult == "http://") { if (inst::util::formatUrlString(keyboardResult) == "" || keyboardResult == "https://" || keyboardResult == "http://") {
std::string fail = "romfs:/images/icons/fail.png"; std::string fail = "romfs:/images/icons/fail.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)){ if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.fail"_theme)) {
fail = inst::config::appDir + "icons_others.fail"_theme; fail = inst::config::appDir + "icons_others.fail"_theme;
} }
mainApp->CreateShowDialog("inst.net.url.invalid"_lang, "", { "common.ok"_lang }, false, fail); mainApp->CreateShowDialog("inst.net.url.invalid"_lang, "", { "common.ok"_lang }, false, fail);
@ -260,7 +260,7 @@ namespace inst::ui {
void netInstPage::startInstall(bool urlMode) { void netInstPage::startInstall(bool urlMode) {
int dialogResult = -1; int dialogResult = -1;
std::string install = "romfs:/images/icons/install.png"; std::string install = "romfs:/images/icons/install.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.install"_theme)){ if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.install"_theme)) {
install = inst::config::appDir + "icons_others.install"_theme; install = inst::config::appDir + "icons_others.install"_theme;
} }

View File

@ -192,10 +192,14 @@ namespace inst::ui {
void sdInstPage::startInstall() { void sdInstPage::startInstall() {
int dialogResult = -1; int dialogResult = -1;
if (this->selectedTitles.size() == 1) { std::string install = "romfs:/images/icons/install.png";
dialogResult = mainApp->CreateShowDialog("inst.target.desc0"_lang + ":\n\n" + inst::util::shortenString(std::filesystem::path(this->selectedTitles[0]).filename().string(), 32, true) + "\n\n" + "inst.target.desc1"_lang, "\n\n\n\n\n\n\n" + "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false, "romfs:/images/icons/install.png"); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.install"_theme)) {
install = inst::config::appDir + "icons_others.install"_theme;
} }
else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedTitles.size()) + "inst.target.desc01"_lang, "\n" + "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false, "romfs:/images/icons/install.png"); if (this->selectedTitles.size() == 1) {
dialogResult = mainApp->CreateShowDialog("inst.target.desc0"_lang + ":\n\n" + inst::util::shortenString(std::filesystem::path(this->selectedTitles[0]).filename().string(), 32, true) + "\n\n" + "inst.target.desc1"_lang, "\n\n\n\n\n\n\n" + "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false, install);
}
else dialogResult = mainApp->CreateShowDialog("inst.target.desc00"_lang + std::to_string(this->selectedTitles.size()) + "inst.target.desc01"_lang, "\n" + "common.cancel_desc"_lang, { "inst.target.opt0"_lang, "inst.target.opt1"_lang }, false, install);
if (dialogResult == -1) return; if (dialogResult == -1) return;
nspInstStuff::installNspFromFile(this->selectedTitles, dialogResult); nspInstStuff::installNspFromFile(this->selectedTitles, dialogResult);
} }
@ -243,7 +247,11 @@ namespace inst::ui {
} }
if ((Down & HidNpadButton_X)) { if ((Down & HidNpadButton_X)) {
inst::ui::mainApp->CreateShowDialog("inst.sd.help.title"_lang, "inst.sd.help.desc"_lang, { "common.ok"_lang }, true, "romfs:/images/icons/information.png"); std::string information = "romfs:/images/icons/information.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.information"_theme)) {
information = inst::config::appDir + "icons_others.information"_theme;
}
inst::ui::mainApp->CreateShowDialog("inst.sd.help.title"_lang, "inst.sd.help.desc"_lang, { "common.ok"_lang }, true, information);
} }
if (Down & HidNpadButton_Plus) { if (Down & HidNpadButton_Plus) {

View File

@ -172,7 +172,7 @@ namespace inst::ui {
int dialogResult = -1; int dialogResult = -1;
std::string install = "romfs:/images/icons/install.png"; std::string install = "romfs:/images/icons/install.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.install"_theme)){ if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.install"_theme)) {
install = inst::config::appDir + "icons_others.install"_theme; install = inst::config::appDir + "icons_others.install"_theme;
} }

View File

@ -8,7 +8,6 @@
#include "util/config.hpp" #include "util/config.hpp"
#include "util/error.hpp" #include "util/error.hpp"
#include "ui/instPage.hpp" #include "ui/instPage.hpp"
//
#include "ui/ThemeinstPage.hpp" #include "ui/ThemeinstPage.hpp"
static size_t writeDataFile(void* ptr, size_t size, size_t nmemb, void* stream) { static size_t writeDataFile(void* ptr, size_t size, size_t nmemb, void* stream) {
@ -103,7 +102,7 @@ namespace inst::curl {
curl_handle = curl_easy_init(); curl_handle = curl_easy_init();
curl_easy_setopt(curl_handle, CURLOPT_BUFFERSIZE, 240000L); curl_easy_setopt(curl_handle, CURLOPT_BUFFERSIZE, 240000L);
curl_easy_setopt(curl_handle, CURLOPT_ENCODING, "" ); curl_easy_setopt(curl_handle, CURLOPT_ENCODING, "");
curl_easy_setopt(curl_handle, CURLOPT_TCP_FASTOPEN, 1L); curl_easy_setopt(curl_handle, CURLOPT_TCP_FASTOPEN, 1L);
curl_easy_setopt(curl_handle, CURLOPT_STREAM_WEIGHT, 256L); curl_easy_setopt(curl_handle, CURLOPT_STREAM_WEIGHT, 256L);
curl_easy_setopt(curl_handle, CURLOPT_TCP_KEEPALIVE, 1L); curl_easy_setopt(curl_handle, CURLOPT_TCP_KEEPALIVE, 1L);