WIP: Add Glossary and some cleanup.

This commit is contained in:
StackZ
2020-03-08 17:03:21 +01:00
parent 9998748baa
commit 1a20cc50f3
12 changed files with 1346 additions and 1039 deletions
+38
View File
@@ -0,0 +1,38 @@
/*
* This file is part of Universal-Updater
* Copyright (C) 2019-2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#ifndef ANIMATION_HPP
#define ANIMATION_HPP
#include <3ds.h>
#include <string>
namespace Animation {
// Draw Progressbar.
void DrawProgressBar(float currentProgress, float totalProgress, int mode);
}
#endif
+15 -3
View File
@@ -39,14 +39,26 @@ public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
ScriptBrowse();
private:
std::vector<DirEntry> dirContents;
// Selection.
mutable int screenPos = 0;
mutable int screenPosList = 0;
mutable int selection = 0;
mutable int Selection = 0;
int mode = 0;
// Draws.
void DrawBrowse(void) const;
void DrawGlossary(void) const;
nlohmann::json infoJson;
int maxScripts;
// Browse stuff.
int keyRepeatDelay = 0;
int fastMode = false;
std::vector<DirEntry> dirContents;
// Button | Icon struct.
std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down.
+32 -9
View File
@@ -29,6 +29,7 @@
#include "common.hpp"
#include "fileBrowse.hpp"
#include "scriptHelper.hpp"
#include "structs.hpp"
#include <vector>
@@ -38,32 +39,55 @@ class ScriptList : public Screen
public:
void Draw(void) const override;
void Logic(u32 hDown, u32 hHeld, touchPosition touch) override;
ScriptList();
ScriptList(); // In case of "Autoboot", have a Constructor which handles stuff.
private:
// Screen Mode.
int mode = 0;
int lastMode = 1;
// Helper functions.
void deleteScript(int selectedScript);
void refreshList();
nlohmann::json openScriptFile();
void checkForValidate(void);
void loadDesc(void);
void runFunctions(nlohmann::json &json);
// Draw Functions.
void DrawSubMenu(void) const;
void DrawList(void) const;
void DrawSingleObject(void) const;
void DrawGlossary(void) const;
// Logic Functions.
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
void ListSelection(u32 hDown, u32 hHeld, touchPosition touch);
void SelectFunction(u32 hDown, u32 hHeld, touchPosition touch);
int mode = 0;
int SubSelection = 0;
std::vector<DirEntry> dirContents;
// This is for the Script Creator, so no one can access it for now, until it is stable or so.
bool isTesting = false;
// Other includes which get destructed automatically.
std::string choice;
std::string currentFile;
std::string selectedTitle;
std::string Desc = "";
nlohmann::json jsonFile;
std::vector<ScriptInfo> fileInfo;
std::vector<std::string> fileInfo2;
std::vector<std::string> lines;
mutable int screenPos = 0;
mutable int screenPosList = 0;
mutable int selection = 0;
mutable int screenPos2 = 0;
mutable int screenPosList2 = 0;
mutable int selection2 = 0;
mutable int Selection = 0;
// Browse stuff.
int keyRepeatDelay = 0;
std::vector<DirEntry> dirContents;
int fastMode = false;
// Button | Icon structs.
std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down.
@@ -71,7 +95,6 @@ private:
{5, 0, 25, 25}, // viewMode Change
{45, 0, 25, 25}, // Search.
};
std::vector<Structs::ButtonPos> subPos = {
{10, 70, 140, 40}, // Script list.
{170, 70, 140, 40}, // Get Scripts.
+19 -12
View File
@@ -29,6 +29,7 @@
#include "common.hpp"
#include "fileBrowse.hpp"
#include "scriptHelper.hpp"
#include "structs.hpp"
#include <vector>
@@ -41,13 +42,17 @@ public:
UniStore();
private:
void refreshList();
nlohmann::json openStoreFile();
void loadStoreDesc(void);
void loadStoreSheet(int pos);
void DrawSubMenu(void) const;
void DrawStoreList(void) const;
void DrawStore(void) const;
void DrawSearch(void) const;
void DrawFullURLScreen(void) const;
void DrawGitHubScreen(void) const;
void DrawGlossary(void) const;
void SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch);
void StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch);
@@ -63,7 +68,7 @@ private:
void deleteStore(int selectedStore);
bool handleIfDisplayText();
int mode = 0;
int selectedOptionAppStore = 0;
int lastMode = 1;
mutable bool displayInformations = true;
// Stuff for the GitHub Store Search function and Full URL.
@@ -71,20 +76,25 @@ private:
std::string fileName = "";
std::string FullURL = "";
mutable int selection = 0;
mutable int selection2 = 0;
// Selections.
mutable int Selection = 0;
int screenPos = 0;
int screenPos2 = 0;
mutable int screenPosList = 0;
mutable int screenPosList2 = 0;
int searchSelection = 0;
int subSelection = 0;
// Browse stuff.
int keyRepeatDelay = 0;
int fastMode = false;
std::vector<DirEntry> dirContents;
// Other stuff.
std::vector<StoreInfo> storeInfo; // Store Selection.
std::vector<std::string> appStoreList; // Actual store. ;P
std::vector<std::string> descLines;
std::string storeDesc = "";
nlohmann::json appStoreJson;
std::string currentStoreFile;
// Icon | Button Structs.
std::vector<Structs::ButtonPos> arrowPos = {
{295, 0, 25, 25}, // Arrow Up.
{295, 215, 25, 25}, // Arrow Down.
@@ -93,20 +103,17 @@ private:
{45, 0, 25, 25}, // Search.
{85, 0, 25, 25}, // Update.
};
std::vector<Structs::ButtonPos> URLBtn = {
{10, 70, 140, 40}, // FULL URL.
{170, 70, 140, 40}, // Github.
{10, 145, 140, 40}, // TinyDB.
{170, 145, 140, 40}, // QR Code?
};
std::vector<Structs::ButtonPos> GitHubPos = {
{30, 50, 260, 30}, // Owner & Repo.
{30, 130, 260, 30}, // Filename.
{135, 180, 50, 30}, // OK.
};
std::vector<Structs::ButtonPos> subPos = {
{90, 40, 140, 35}, // StoreList.
{90, 100, 140, 35}, // storeSearch.
+3 -1
View File
@@ -42,6 +42,7 @@ extern "C" {
#ifdef __cplusplus
}
#include "animation.hpp"
#include "config.hpp"
#include "gfx.hpp"
#include "gui.hpp"
@@ -70,4 +71,5 @@ extern char * arg0;
#define SCRIPT_VERSION 3
#define STORE_PATH "sdmc:/3ds/Universal-Updater/stores/" // Default Store path.
#define ENTRIES_PER_SCREEN 3
#define ENTRIES_PER_LIST 7
#define ENTRIES_PER_LIST 7
#define metaFile "sdmc:/3ds/Universal-Updater/ScriptInfo.json"
+18
View File
@@ -29,6 +29,24 @@
#include <string>
// Information like Title and Author.
struct ScriptInfo {
std::string title;
std::string author;
std::string shortDesc;
};
// Store Information.
struct StoreInfo {
std::string title;
std::string author;
std::string description;
std::string url;
std::string file;
std::string storeSheet;
std::string sheetURL;
};
namespace ScriptHelper {
// Get stuff from a JSON.
std::string getString(nlohmann::json json, const std::string &key, const std::string &key2);