start code cleanup

This commit is contained in:
mrdude2478 2023-09-28 04:35:57 +01:00
parent 727c69e0d6
commit bf54ce62de
10 changed files with 47 additions and 133 deletions

View File

@ -14,7 +14,6 @@ namespace inst::ui {
TextBlock::Ref sdInfoText;
TextBlock::Ref nandInfoText;
TextBlock::Ref countText;
Image::Ref awooImage;
pu::ui::elm::ProgressBar::Ref installBar;
static void setTopInstInfoText(std::string ourText);
static void setInstInfoText(std::string ourText);
@ -26,6 +25,5 @@ namespace inst::ui {
Rectangle::Ref infoRect;
Rectangle::Ref topRect;
Image::Ref titleImage;
TextBlock::Ref appVersionText;
};
}

View File

@ -15,7 +15,6 @@ namespace inst::ui {
void settingsMenuItem_Click();
void exitMenuItem_Click();
void onInput(u64 Down, u64 Up, const u64 Held, pu::ui::TouchPoint touch_pos);
Image::Ref awooImage;
private:
bool appletFinished;
@ -32,7 +31,6 @@ namespace inst::ui {
pu::ui::elm::MenuItem::Ref HdInstallMenuItem;
pu::ui::elm::MenuItem::Ref settingsMenuItem;
pu::ui::elm::MenuItem::Ref exitMenuItem;
Image::Ref eggImage;
Image::Ref hdd;
};
}

View File

@ -20,22 +20,12 @@ namespace inst::ui {
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme) {
if
(std::filesystem::exists(inst::config::appDir + "/images/Hd.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Hd.png"));
else
this->titleImage = Image::New(0, 0, "romfs:/images/Hd.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Hd.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Hd.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Hd.png");
if
(std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else
this->SetBackgroundImage("romfs:/images/Background.png");
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
else {
this->SetBackgroundImage("romfs:/images/Background.png");
this->titleImage = Image::New(0, 0, "romfs:/images/Hd.png");
}
this->pageInfoText = TextBlock::New(10, 109, "inst.hd.top_info"_lang);
this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));

View File

@ -33,19 +33,12 @@ namespace inst::ui {
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme) {
if (std::filesystem::exists(inst::config::appDir + "/images/Net.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Net.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->appVersionText = TextBlock::New(1210, 680, "");
}
else {
this->SetBackgroundImage("romfs:/images/Background.png");
this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
this->appVersionText = TextBlock::New(1210, 680, "");
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Net.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Net.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->pageInfoText = TextBlock::New(10, 109, "");
this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
@ -59,7 +52,6 @@ namespace inst::ui {
this->Add(this->infoRect);
this->Add(this->botRect);
this->Add(this->titleImage);
this->Add(this->appVersionText);
this->Add(this->butText);
this->Add(this->pageInfoText);
this->Add(this->menu);

View File

@ -30,19 +30,12 @@ namespace inst::ui {
this->SetBackgroundColor(COLOR("#000000FF"));
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
if (inst::config::useTheme) {
if (std::filesystem::exists(inst::config::appDir + "/images/Install.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Install.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Install.png");
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->appVersionText = TextBlock::New(0, 0, "");
}
else {
this->SetBackgroundImage("romfs:/images/Background.png");
this->titleImage = Image::New(0, 0, "romfs:/images/Install.png");
this->appVersionText = TextBlock::New(0, 0, "");
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Install.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Install.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Install.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->pageInfoText = TextBlock::New(10, 109, "");
this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
@ -64,7 +57,6 @@ namespace inst::ui {
this->Add(this->topRect);
this->Add(this->infoRect);
this->Add(this->titleImage);
this->Add(this->appVersionText);
this->Add(this->pageInfoText);
this->Add(this->installInfoText);
this->Add(this->sdInfoText);

View File

@ -154,18 +154,12 @@ namespace inst::ui {
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme) {
if (std::filesystem::exists(inst::config::appDir + "/images/Main.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Main.png"));
else
this->titleImage = Image::New(0, 0, "romfs:/images/Main.png");
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else
this->SetBackgroundImage("romfs:/images/Background.png");
}
else {
this->SetBackgroundImage("romfs:/images/Background.png");
this->titleImage = Image::New(0, 0, "romfs:/images/Main.png");
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Main.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Main.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Main.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->butText = TextBlock::New(10, 678, "main.buttons"_lang);
this->butText->SetColor(COLOR("#FFFFFFFF"));
this->optionMenu = pu::ui::elm::Menu::New(0, 95, 1280, COLOR("#FFFFFF00"), COLOR("#4f4f4d33"), 94, 6);
@ -189,14 +183,6 @@ namespace inst::ui {
this->exitMenuItem = pu::ui::elm::MenuItem::New("main.menu.exit"_lang);
this->exitMenuItem->SetColor(COLOR("#FFFFFFFF"));
this->exitMenuItem->SetIcon("romfs:/images/icons/exit-run.png");
if (inst::config::useTheme) {
if (std::filesystem::exists(inst::config::appDir + "/images/Main.png")) this->awooImage = Image::New(0, 0, inst::config::appDir + "/images/Main.png");
else this->awooImage = Image::New(0, 0, "romfs:/images/Main.png");
}
else {
this->awooImage = Image::New(0, 0, "romfs:/images/Main.png");
}
this->eggImage = Image::New(0, 0, "");
this->Add(this->topRect);
this->Add(this->botRect);
this->Add(this->titleImage);
@ -211,9 +197,6 @@ namespace inst::ui {
this->hdd = Image::New(1156, 669, "romfs:/images/icons/usb-hd-connected.png");
this->Add(this->hdd);
}
this->Add(this->awooImage);
this->Add(this->eggImage);
this->awooImage->SetVisible(!inst::config::useTheme);
this->Add(this->optionMenu);
this->AddRenderCallback(mainMenuThread);
}
@ -307,13 +290,9 @@ namespace inst::ui {
}
if (Down & HidNpadButton_X) {
this->awooImage->SetVisible(false);
this->eggImage->SetVisible(true);
}
if (Up & HidNpadButton_A) {
this->eggImage->SetVisible(false);
if (!inst::config::useTheme) this->awooImage->SetVisible(true);
}
if (Down & HidNpadButton_Y) {

View File

@ -26,19 +26,12 @@ namespace inst::ui {
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme) {
if (std::filesystem::exists(inst::config::appDir + "/images/Net.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Net.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->appVersionText = TextBlock::New(1210, 680, "");
}
else {
this->SetBackgroundImage("romfs:/images/Background.png");
this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
this->appVersionText = TextBlock::New(1210, 680, "");
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Net.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Net.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Net.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->pageInfoText = TextBlock::New(10, 109, "");
this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
@ -52,7 +45,6 @@ namespace inst::ui {
this->Add(this->infoRect);
this->Add(this->botRect);
this->Add(this->titleImage);
this->Add(this->appVersionText);
this->Add(this->butText);
this->Add(this->pageInfoText);
this->Add(this->menu);

View File

@ -27,18 +27,13 @@ namespace inst::ui {
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme) {
if (std::filesystem::exists(inst::config::appDir + "/images/Settings.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Settings.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Settings.png");
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->appVersionText = TextBlock::New(1200, 680, "v" + inst::config::appVersion);
}
else {
this->SetBackgroundImage("romfs:/images/Background.png");
this->titleImage = Image::New(0, 0, "romfs:/images/Settings.png");
this->appVersionText = TextBlock::New(1200, 680, "v" + inst::config::appVersion);
}
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Settings.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Settings.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Settings.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->appVersionText = TextBlock::New(1200, 680, "v" + inst::config::appVersion);
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
this->appVersionText->SetFont(pu::ui::MakeDefaultFontName(20));
this->pageInfoText = TextBlock::New(10, 109, "options.title"_lang);
@ -346,12 +341,6 @@ namespace inst::ui {
inst::config::setConfig();
break;
case 9:
if (inst::config::useTheme) {
mainApp->mainPage->awooImage->SetVisible(true);
}
else {
mainApp->mainPage->awooImage->SetVisible(false);
}
thememessage();
inst::config::setConfig();
this->setMenuText();

View File

@ -22,19 +22,12 @@ namespace inst::ui {
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme) {
if (std::filesystem::exists(inst::config::appDir + "/images/Sd.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Sd.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Sd.png");
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->appVersionText = TextBlock::New(0, 0, "");
}
else {
this->SetBackgroundImage("romfs:/images/Background.png");
this->titleImage = Image::New(0, 0, "romfs:/images/Sd.png");
this->appVersionText = TextBlock::New(0, 0, "");
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Sd.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Sd.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Sd.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->pageInfoText = TextBlock::New(10, 109, "inst.sd.top_info"_lang);
this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
@ -47,7 +40,6 @@ namespace inst::ui {
this->Add(this->infoRect);
this->Add(this->botRect);
this->Add(this->titleImage);
this->Add(this->appVersionText);
this->Add(this->butText);
this->Add(this->pageInfoText);
this->Add(this->menu);

View File

@ -18,19 +18,12 @@ namespace inst::ui {
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#000000FF"));
this->botRect = Rectangle::New(0, 659, 1280, 61, COLOR("#000000FF"));
if (inst::config::useTheme) {
if (std::filesystem::exists(inst::config::appDir + "/images/Usb.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Usb.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Usb.png");
if (std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->appVersionText = TextBlock::New(0, 0, "");
}
else {
this->SetBackgroundImage("romfs:/images/Background.png");
this->titleImage = Image::New(0, 0, "romfs:/images/Usb.png");
this->appVersionText = TextBlock::New(0, 0, "");
}
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Usb.png")) this->titleImage = Image::New(0, 0, (inst::config::appDir + "/images/Usb.png"));
else this->titleImage = Image::New(0, 0, "romfs:/images/Usb.png");
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/images/Background.png")) this->SetBackgroundImage(inst::config::appDir + "/images/Background.png");
else this->SetBackgroundImage("romfs:/images/Background.png");
this->pageInfoText = TextBlock::New(10, 109, "");
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
this->pageInfoText->SetFont(pu::ui::MakeDefaultFontName(30));
@ -44,7 +37,6 @@ namespace inst::ui {
this->Add(this->infoRect);
this->Add(this->botRect);
this->Add(this->titleImage);
this->Add(this->appVersionText);
this->Add(this->butText);
this->Add(this->pageInfoText);
this->Add(this->menu);