theme updates to inst page

This commit is contained in:
mrdude2478 2023-09-29 07:11:48 +01:00
parent 6271664c19
commit 04bce9ace4
2 changed files with 78 additions and 51 deletions

View File

@ -3,6 +3,7 @@
#include "ui/instPage.hpp" #include "ui/instPage.hpp"
#include "util/config.hpp" #include "util/config.hpp"
#include "util/lang.hpp" #include "util/lang.hpp"
#include "util/theme.hpp"
#include <sys/statvfs.h> #include <sys/statvfs.h>
FsFileSystem* fs; FsFileSystem* fs;
@ -26,34 +27,66 @@ namespace inst::ui {
extern MainApplication* mainApp; extern MainApplication* mainApp;
instPage::instPage() : Layout::Layout() { instPage::instPage() : Layout::Layout() {
this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#00000080"));
this->SetBackgroundColor(COLOR("#000000FF")); std::string infoRect_colour = "colour.inforect"_theme;
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF")); std::string bg_colour = "colour.background"_theme;
std::string tbar_colour = "colour.topbar"_theme;
std::string install_top = inst::config::appDir + "bg_images.install_top"_theme;
std::string default_background = inst::config::appDir + "bg_images.default_background"_theme;
std::string pageinfo_colour = "colour.pageinfo_text"_theme;
std::string installinfo_colour = "colour.installinfo_text"_theme;
std::string sdinfo_colour = "colour.sdinfo_text"_theme;
std::string nandinfo_colour = "colour.nandinfo_text"_theme;
std::string count_colour = "colour.count_text"_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/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/images/Install.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/theme/images/Install.png")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(install_top)) this->titleImage = Image::New(0, 0, (install_top));
else this->titleImage = Image::New(0, 0, "romfs:/images/Install.png"); else this->titleImage = Image::New(0, 0, "romfs:/images/Install.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, "");
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->installInfoText = TextBlock::New(10, 640, ""); this->installInfoText = TextBlock::New(10, 640, "");
this->installInfoText->SetFont(pu::ui::MakeDefaultFontName(30)); this->installInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->installInfoText->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->installInfoText->SetColor(COLOR(installinfo_colour));
else this->installInfoText->SetColor(COLOR("#FFFFFFFF"));
this->sdInfoText = TextBlock::New(10, 600, ""); this->sdInfoText = TextBlock::New(10, 600, "");
this->sdInfoText->SetFont(pu::ui::MakeDefaultFontName(30)); this->sdInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->sdInfoText->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->sdInfoText->SetColor(COLOR(sdinfo_colour));
else this->sdInfoText->SetColor(COLOR("#FFFFFFFF"));
this->nandInfoText = TextBlock::New(10, 560, ""); this->nandInfoText = TextBlock::New(10, 560, "");
this->nandInfoText->SetFont(pu::ui::MakeDefaultFontName(30)); this->nandInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->nandInfoText->SetColor(COLOR("#FFFFFFFF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->nandInfoText->SetColor(COLOR(nandinfo_colour));
else this->nandInfoText->SetColor(COLOR("#FFFFFFFF"));
this->countText = TextBlock::New(10, 520, ""); this->countText = TextBlock::New(10, 520, "");
this->countText->SetFont(pu::ui::MakeDefaultFontName(30)); this->countText->SetFont(pu::ui::MakeDefaultFontName(30));
this->countText->SetColor(COLOR("#FFFFFFFF")); 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"));
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->SetBackgroundColor(COLOR("#000000FF")); if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) this->installBar->SetBackgroundColor(COLOR(progress_bg_colour));
this->installBar->SetProgressColor(COLOR("#565759FF")); 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->topRect); this->Add(this->topRect);
this->Add(this->infoRect); this->Add(this->infoRect);
this->Add(this->titleImage); this->Add(this->titleImage);

View File

@ -19,27 +19,6 @@ namespace Language {
setMakeLanguage(lcode, &ourLang); setMakeLanguage(lcode, &ourLang);
setExit(); setExit();
int syslang = (int)ourLang; int syslang = (int)ourLang;
/*
0 Japanese
1 AmericanEnglish
2 French
3 German
4 Italian
5 Spanish
6 Chinese
7 Korean
8 Dutch
9 Portuguese
10 Russian
11 Taiwanese
12 BritishEnglish
13 CanadianFrench
14 LatinAmericanSpanish
15 [4.0.0+] SimplifiedChinese
16 [4.0.0+] TraditionalChinese
17 [10.1.0+] BrazilianPortuguese
*/
//Get language int from config file
std::ifstream ifs; std::ifstream ifs;
std::string languagePath; std::string languagePath;
int langInt = inst::config::languageSetting; int langInt = inst::config::languageSetting;
@ -74,45 +53,60 @@ namespace Language {
break; break;
case 0: case 0:
switch (syslang) { switch (syslang) {
case 0: case 0: //Japanese
languagePath = "romfs:/lang/jp.json"; languagePath = "romfs:/lang/jp.json";
break; break;
case 1: case 1: //AmericanEnglish
languagePath = "romfs:/lang/en.json"; languagePath = "romfs:/lang/en.json";
break; break;
case 2: case 2: //French
languagePath = "romfs:/lang/fr.json"; languagePath = "romfs:/lang/fr.json";
break; break;
case 3: case 3: //German
languagePath = "romfs:/lang/de.json"; languagePath = "romfs:/lang/de.json";
break; break;
case 4: case 4: //Italian
languagePath = "romfs:/lang/it.json"; languagePath = "romfs:/lang/it.json";
break; break;
case 5: case 5: //Spanish
languagePath = "romfs:/lang/es.json"; languagePath = "romfs:/lang/es.json";
break; break;
case 6: case 6: //Chinese
languagePath = "romfs:/lang/tw.json"; languagePath = "romfs:/lang/tw.json";
break; break;
case 10: case 7: //Korean
languagePath = "romfs:/lang/ru.json";
break;
case 11:
languagePath = "romfs:/lang/tw.json";
break;
case 12:
languagePath = "romfs:/lang/en.json"; languagePath = "romfs:/lang/en.json";
break; break;
case 13: case 8: //Dutch
languagePath = "romfs:/lang/en.json";
break;
case 9: //Portuguese
languagePath = "romfs:/lang/en.json";
break;
case 10: //Russian
languagePath = "romfs:/lang/ru.json";
break;
case 11: //Taiwanese
languagePath = "romfs:/lang/tw.json";
break;
case 12: //BritishEnglish
languagePath = "romfs:/lang/en.json";
break;
case 13: //CanadianFrench
languagePath = "romfs:/lang/fr.json"; languagePath = "romfs:/lang/fr.json";
break; break;
case 14: case 14: //LatinAmericanSpanish
languagePath = "romfs:/lang/es.json"; languagePath = "romfs:/lang/es.json";
break; break;
case 16: case 15: //SimplifiedChinese
languagePath = "romfs:/lang/tw.json"; languagePath = "romfs:/lang/tw.json";
break; break;
case 16: //TraditionalChinese
languagePath = "romfs:/lang/tw.json";
break;
case 17: //BrazilianPortuguese
languagePath = "romfs:/lang/en.json";
break;
default: default:
languagePath = "romfs:/lang/en.json"; languagePath = "romfs:/lang/en.json";
break; break;