mirror of
https://github.com/Huntereb/Awoo-Installer
synced 2024-11-25 13:10:22 +00:00
77 lines
3.3 KiB
C++
Executable file
77 lines
3.3 KiB
C++
Executable file
#include <filesystem>
|
|
#include "ui/MainApplication.hpp"
|
|
#include "ui/instPage.hpp"
|
|
#include "util/config.hpp"
|
|
|
|
#define COLOR(hex) pu::ui::Color::FromHex(hex)
|
|
|
|
namespace inst::ui {
|
|
extern MainApplication *mainApp;
|
|
|
|
instPage::instPage() : Layout::Layout() {
|
|
this->SetBackgroundColor(COLOR("#670000FF"));
|
|
if (std::filesystem::exists(inst::config::appDir + "/background.png")) this->SetBackgroundImage(inst::config::appDir + "/background.png");
|
|
else this->SetBackgroundImage("romfs:/images/background.jpg");
|
|
this->topRect = Rectangle::New(0, 0, 1280, 94, COLOR("#170909FF"));
|
|
this->infoRect = Rectangle::New(0, 95, 1280, 60, COLOR("#17090980"));
|
|
if (inst::config::gayMode) {
|
|
this->titleImage = Image::New(-113, 0, "romfs:/images/logo.png");
|
|
this->appVersionText = TextBlock::New(367, 49, "v" + inst::config::appVersion, 22);
|
|
}
|
|
else {
|
|
this->titleImage = Image::New(0, 0, "romfs:/images/logo.png");
|
|
this->appVersionText = TextBlock::New(480, 49, "v" + inst::config::appVersion, 22);
|
|
}
|
|
this->appVersionText->SetColor(COLOR("#FFFFFFFF"));
|
|
this->pageInfoText = TextBlock::New(10, 109, "", 30);
|
|
this->pageInfoText->SetColor(COLOR("#FFFFFFFF"));
|
|
this->installInfoText = TextBlock::New(15, 568, "", 22);
|
|
this->installInfoText->SetColor(COLOR("#FFFFFFFF"));
|
|
this->installBar = pu::ui::elm::ProgressBar::New(10, 600, 850, 40, 100.0f);
|
|
this->installBar->SetColor(COLOR("#222222FF"));
|
|
if (std::filesystem::exists(inst::config::appDir + "/awoo_inst.png")) this->awooImage = Image::New(410, 190, inst::config::appDir + "/awoo_inst.png");
|
|
else this->awooImage = Image::New(510, 166, "romfs:/images/awoos/7d8a05cddfef6da4901b20d2698d5a71.png");
|
|
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->installBar);
|
|
this->Add(this->awooImage);
|
|
if (inst::config::gayMode) this->awooImage->SetVisible(false);
|
|
}
|
|
|
|
void instPage::setTopInstInfoText(std::string ourText){
|
|
mainApp->instpage->pageInfoText->SetText(ourText);
|
|
mainApp->CallForRender();
|
|
}
|
|
|
|
void instPage::setInstInfoText(std::string ourText){
|
|
mainApp->instpage->installInfoText->SetText(ourText);
|
|
mainApp->CallForRender();
|
|
}
|
|
|
|
void instPage::setInstBarPerc(double ourPercent){
|
|
mainApp->instpage->installBar->SetVisible(true);
|
|
mainApp->instpage->installBar->SetProgress(ourPercent);
|
|
mainApp->CallForRender();
|
|
}
|
|
|
|
void instPage::loadMainMenu(){
|
|
mainApp->LoadLayout(mainApp->mainPage);
|
|
}
|
|
|
|
void instPage::loadInstallScreen(){
|
|
mainApp->instpage->pageInfoText->SetText("");
|
|
mainApp->instpage->installInfoText->SetText("");
|
|
mainApp->instpage->installBar->SetProgress(0);
|
|
mainApp->instpage->installBar->SetVisible(false);
|
|
mainApp->instpage->awooImage->SetVisible(!inst::config::gayMode);
|
|
mainApp->LoadLayout(mainApp->instpage);
|
|
mainApp->CallForRender();
|
|
}
|
|
|
|
void instPage::onInput(u64 Down, u64 Up, u64 Held, pu::ui::Touch Pos) {
|
|
}
|
|
}
|