Ehh.. do the same for Full URL, because otherwise it looks weird.

This commit is contained in:
StackZ
2020-01-02 08:04:34 +01:00
parent 250499ce37
commit 82c15755b4
2 changed files with 59 additions and 13 deletions
+4 -1
View File
@@ -43,12 +43,14 @@ private:
void DrawStoreList(void) const;
void DrawStore(void) const;
void DrawSearch(void) const;
void DrawFullURLScreen(void) const;
void DrawGitHubScreen(void) const;
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
void StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch);
void StoreLogic(u32 hDown, u32 hHeld, touchPosition touch);
void SearchLogic(u32 hDown, u32 hHeld, touchPosition touch);
void FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch);
void GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch);
@@ -57,9 +59,10 @@ private:
int mode = 0;
std::string selectedOptionAppStore;
// Stuff for the GitHub Store Search function.
// Stuff for the GitHub Store Search function and Full URL.
std::string OwnerAndRepo = "";
std::string fileName = "";
std::string FullURL = "";
mutable int selection = 0;
mutable int selection2 = 0;
+55 -12
View File
@@ -323,6 +323,8 @@ void UniStore::Draw(void) const {
} else if (mode == 3) {
DrawSearch();
} else if (mode == 4) {
DrawFullURLScreen();
} else if (mode == 5) {
DrawGitHubScreen();
}
}
@@ -661,6 +663,8 @@ void UniStore::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
} else if (mode == 3) {
SearchLogic(hDown, hHeld, touch);
} else if (mode == 4) {
FullURLLogic(hDown, hHeld, touch);
} else if (mode == 5) {
GitHubLogic(hDown, hHeld, touch);
}
@@ -812,22 +816,16 @@ void UniStore::SearchLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_A) {
if (searchSelection == 0) {
std::string fullURL = Input::getString(Lang::get("ENTER_FULL_URL"));
gspWaitForVBlank();
std::string FILE = Input::getString(Lang::get("ENTER_FILENAME"));
ScriptHelper::downloadFile(fullURL, Config::StorePath + FILE, Lang::get("DOWNLOADING") + FILE);
} else if (searchSelection == 1) {
mode = 4;
} else if (searchSelection == 1) {
mode = 5;
}
}
if (hDown & KEY_TOUCH && touching(touch, URLBtn[0])) {
std::string fullURL = Input::getString(Lang::get("ENTER_FULL_URL"));
gspWaitForVBlank();
std::string FILE = Input::getString(Lang::get("ENTER_FILENAME"));
ScriptHelper::downloadFile(fullURL, Config::StorePath + FILE, Lang::get("DOWNLOADING") + FILE);
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[1])) {
mode = 4;
} else if (hDown & KEY_TOUCH && touching(touch, URLBtn[1])) {
mode = 5;
}
}
@@ -851,8 +849,8 @@ void UniStore::DrawGitHubScreen(void) const {
Gui::Draw_Rect(GitHubPos[2].x, GitHubPos[2].y, GitHubPos[2].w, GitHubPos[2].h, Config::Color1);
Gui::DrawStringCentered(0, 185, 0.7f, Config::TxtColor, Lang::get("OK"), 250);
Gui::DrawString(35, 57, 0.50f, Config::TxtColor, OwnerAndRepo, 260);
Gui::DrawString(35, 137, 0.50f, Config::TxtColor, fileName, 260);
Gui::DrawString(35, 57, 0.45f, Config::TxtColor, OwnerAndRepo, 250);
Gui::DrawString(35, 137, 0.45f, Config::TxtColor, fileName, 250);
}
void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
@@ -878,4 +876,49 @@ void UniStore::GitHubLogic(u32 hDown, u32 hHeld, touchPosition touch) {
fileName = "";
mode = 3;
}
}
void UniStore::DrawFullURLScreen(void) const {
Gui::DrawTop();
if (Config::UseBars == true) {
Gui::DrawStringCentered(0, 0, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 400);
} else {
Gui::DrawStringCentered(0, 2, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 400);
}
Gui::sprite(sprites_uniStore_HD_idx, 140, 50, 0.2, 0.2);
Gui::DrawBottom();
Gui::DrawArrow(0, 218, 0, 1);
Gui::DrawStringCentered(0, 28, 0.7f, Config::TxtColor, Lang::get("FULL_URL"), 320);
Gui::DrawStringCentered(0, 108, 0.7f, Config::TxtColor, Lang::get("FILENAME"), 320);
Gui::Draw_Rect(GitHubPos[0].x, GitHubPos[0].y, GitHubPos[0].w, GitHubPos[0].h, Config::Color1);
Gui::Draw_Rect(GitHubPos[1].x, GitHubPos[1].y, GitHubPos[1].w, GitHubPos[1].h, Config::Color1);
Gui::Draw_Rect(GitHubPos[2].x, GitHubPos[2].y, GitHubPos[2].w, GitHubPos[2].h, Config::Color1);
Gui::DrawStringCentered(0, 185, 0.7f, Config::TxtColor, Lang::get("OK"), 250);
Gui::DrawString(35, 57, 0.45f, Config::TxtColor, FullURL, 250);
Gui::DrawString(35, 137, 0.45f, Config::TxtColor, fileName, 250);
}
void UniStore::FullURLLogic(u32 hDown, u32 hHeld, touchPosition touch) {
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[0])) {
FullURL = Input::getString(Lang::get("ENTER_FULL_URL"));
}
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[1])) {
fileName = Input::getString(Lang::get("ENTER_FILENAME"));
}
if (hDown & KEY_TOUCH && touching(touch, GitHubPos[2])) {
ScriptHelper::downloadFile(FullURL, Config::StorePath + fileName, Lang::get("DOWNLOADING") + fileName);
}
if ((hDown & KEY_B) || (hDown & KEY_TOUCH && touching(touch, arrowPos[2]))) {
// Reset everything.
FullURL = "";
fileName = "";
mode = 3;
}
}