mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-07 00:39:30 +00:00
[THEME]: Add Description and show it on the Theme Selector.
This commit is contained in:
@@ -36,7 +36,7 @@ public:
|
|||||||
Theme(const std::string &ThemeJSON = "sdmc:/3ds/Universal-Updater/Themes.json");
|
Theme(const std::string &ThemeJSON = "sdmc:/3ds/Universal-Updater/Themes.json");
|
||||||
nlohmann::json InitWithDefaultColors(const std::string &ThemePath = "sdmc:/3ds/Universal-Updater/Themes.json");
|
nlohmann::json InitWithDefaultColors(const std::string &ThemePath = "sdmc:/3ds/Universal-Updater/Themes.json");
|
||||||
void LoadTheme(const std::string &ThemeName);
|
void LoadTheme(const std::string &ThemeName);
|
||||||
std::vector<std::string> ThemeNames();
|
std::vector<std::pair<std::string, std::string>> ThemeNames();
|
||||||
uint32_t GetThemeColor(const std::string &ThemeName, const std::string &Key, const uint32_t DefaultColor);
|
uint32_t GetThemeColor(const std::string &ThemeName, const std::string &Key, const uint32_t DefaultColor);
|
||||||
|
|
||||||
uint32_t BarColor() const { return this->vBarColor; };
|
uint32_t BarColor() const { return this->vBarColor; };
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"BoxInside": "#1C213A",
|
"BoxInside": "#1C213A",
|
||||||
"BoxSelected": "#6C829B",
|
"BoxSelected": "#6C829B",
|
||||||
"BoxUnselected": "#000000",
|
"BoxUnselected": "#000000",
|
||||||
|
"Description": "Universal-Updater's default Theme.\n\nBy: Universal-Team",
|
||||||
"DownListPrev": "#1C213A",
|
"DownListPrev": "#1C213A",
|
||||||
"EntryBar": "#324962",
|
"EntryBar": "#324962",
|
||||||
"EntryOutline": "#191E35",
|
"EntryOutline": "#191E35",
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ u32 old_time_limit;
|
|||||||
std::unique_ptr<Theme> UIThemes = nullptr;
|
std::unique_ptr<Theme> UIThemes = nullptr;
|
||||||
std::unique_ptr<Sound> Music = nullptr;
|
std::unique_ptr<Sound> Music = nullptr;
|
||||||
bool dspfirmFound = false;
|
bool dspfirmFound = false;
|
||||||
std::vector<std::string> Themes = { };
|
std::vector<std::pair<std::string, std::string>> Themes = { };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set, if 3DSX or CIA.
|
Set, if 3DSX or CIA.
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ static const Structs::ButtonPos Theme = { 40, 196, 280, 24 }; // Themes.
|
|||||||
|
|
||||||
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" };
|
static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTORE", "AUTO_UPDATE_SETTINGS_BTN", "GUI_SETTINGS_BTN", "DIRECTORY_SETTINGS_BTN", "CREDITS", "EXIT_APP" };
|
||||||
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "3DSX_IN_FOLDER", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH", "CHANGE_SHORTCUT_PATH", "CHANGE_FIRM_PATH" };
|
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "3DSX_IN_FOLDER", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH", "CHANGE_SHORTCUT_PATH", "CHANGE_FIRM_PATH" };
|
||||||
extern std::vector<std::string> Themes;
|
extern std::vector<std::pair<std::string, std::string>> Themes;
|
||||||
|
|
||||||
/* Note: Украïнська is spelled using a latin i with dieresis to work in the system font */
|
/* Note: Украïнська is spelled using a latin i with dieresis to work in the system font */
|
||||||
static const std::vector<std::string> languages = { "Bruh", "Deutsch", "English", "Español", "Français", "Italiano", /* "Lietuvių", */ "Magyar", /* "Nederlands", */ "Polski", "Português", "Português (Brasil)", "Русский", "Украïнська", /* "עברית", */ "中文 (简体)", "中文 (繁體)", "日本語", /* "한국어" */ };
|
static const std::vector<std::string> languages = { "Bruh", "Deutsch", "English", "Español", "Français", "Italiano", /* "Lietuvių", */ "Magyar", /* "Nederlands", */ "Polski", "Português", "Português (Brasil)", "Русский", "Украïнська", /* "עברית", */ "中文 (简体)", "中文 (繁體)", "日本語", /* "한국어" */ };
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ static const std::vector<Structs::ButtonPos> mainButtons = {
|
|||||||
{ 10, 186, 300, 22 }
|
{ 10, 186, 300, 22 }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<std::string> Themes;
|
extern std::vector<std::pair<std::string, std::string>> Themes;
|
||||||
|
|
||||||
/* Select a Theme. */
|
/* Select a Theme. */
|
||||||
void Overlays::SelectTheme() {
|
void Overlays::SelectTheme() {
|
||||||
@@ -67,6 +67,7 @@ void Overlays::SelectTheme() {
|
|||||||
|
|
||||||
Gui::Draw_Rect(0, 215, 400, 25, UIThemes->BarColor());
|
Gui::Draw_Rect(0, 215, 400, 25, UIThemes->BarColor());
|
||||||
Gui::Draw_Rect(0, 214, 400, 1, UIThemes->BarOutline());
|
Gui::Draw_Rect(0, 214, 400, 1, UIThemes->BarOutline());
|
||||||
|
Gui::DrawStringCentered(0, 40, 0.5f, UIThemes->TextColor(), Themes[selection].second, 380, 140, font);
|
||||||
|
|
||||||
Animation::QueueEntryDone();
|
Animation::QueueEntryDone();
|
||||||
GFX::DrawBottom();
|
GFX::DrawBottom();
|
||||||
@@ -77,7 +78,7 @@ void Overlays::SelectTheme() {
|
|||||||
if (Themes.size() > 0) {
|
if (Themes.size() > 0) {
|
||||||
for(int i = 0; i < 7 && i < (int)Themes.size(); i++) {
|
for(int i = 0; i < 7 && i < (int)Themes.size(); i++) {
|
||||||
if (sPos + i == selection) Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, UIThemes->MarkSelected());
|
if (sPos + i == selection) Gui::Draw_Rect(mainButtons[i].x, mainButtons[i].y, mainButtons[i].w, mainButtons[i].h, UIThemes->MarkSelected());
|
||||||
Gui::DrawStringCentered(10 - 160 + (300 / 2), mainButtons[i].y + 4, 0.45f, UIThemes->TextColor(), Themes[sPos + i], 295, 0, font);
|
Gui::DrawStringCentered(10 - 160 + (300 / 2), mainButtons[i].y + 4, 0.45f, UIThemes->TextColor(), Themes[sPos + i].first, 295, 0, font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,8 +111,8 @@ void Overlays::SelectTheme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hidKeysDown() & KEY_A) {
|
if (hidKeysDown() & KEY_A) {
|
||||||
UIThemes->LoadTheme(Themes[selection]);
|
UIThemes->LoadTheme(Themes[selection].first);
|
||||||
config->theme(Themes[selection]);
|
config->theme(Themes[selection].first);
|
||||||
Finish = true;
|
Finish = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,8 +120,8 @@ void Overlays::SelectTheme() {
|
|||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
if (touching(touch, mainButtons[i])) {
|
if (touching(touch, mainButtons[i])) {
|
||||||
if (i + sPos < (int)Themes.size()) {
|
if (i + sPos < (int)Themes.size()) {
|
||||||
UIThemes->LoadTheme(Themes[i + sPos]);
|
UIThemes->LoadTheme(Themes[i + sPos].first);
|
||||||
config->theme(Themes[i + sPos]);
|
config->theme(Themes[i + sPos].first);
|
||||||
Finish = true;
|
Finish = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-6
@@ -44,8 +44,8 @@ Theme::Theme(const std::string &ThemeJSON) {
|
|||||||
this->json = nlohmann::json::parse(file, nullptr, false);
|
this->json = nlohmann::json::parse(file, nullptr, false);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
if(!file || this->json.is_discarded())
|
|
||||||
this->json = this->InitWithDefaultColors();
|
if (!file || this->json.is_discarded()) this->json = this->InitWithDefaultColors();
|
||||||
this->Loaded = true;
|
this->Loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,8 @@ nlohmann::json Theme::InitWithDefaultColors(const std::string &ThemePath) {
|
|||||||
{ "MarkSelected", "#4D6580" },
|
{ "MarkSelected", "#4D6580" },
|
||||||
{ "MarkUnselected", "#1C213A" },
|
{ "MarkUnselected", "#1C213A" },
|
||||||
{ "DownListPrev", "#1C213A" },
|
{ "DownListPrev", "#1C213A" },
|
||||||
{"SideBarIconColor", "#ADCCEF"}
|
{ "SideBarIconColor", "#ADCCEF" },
|
||||||
|
{ "Description", "Universal-Updater's default Theme.\n\nBy: Universal-Team" }
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -105,12 +106,17 @@ void Theme::LoadTheme(const std::string &ThemeName) {
|
|||||||
this->vSideBarIconColor = this->GetThemeColor(ThemeName, "SideBarIconColor", C2D_Color32(173, 204, 239, 255));
|
this->vSideBarIconColor = this->GetThemeColor(ThemeName, "SideBarIconColor", C2D_Color32(173, 204, 239, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> Theme::ThemeNames() {
|
std::vector<std::pair<std::string, std::string>> Theme::ThemeNames() {
|
||||||
std::vector<std::string> Temp = { };
|
std::vector<std::pair<std::string, std::string>> Temp = { };
|
||||||
|
|
||||||
if (this->Loaded) {
|
if (this->Loaded) {
|
||||||
for(auto it = this->json.begin(); it != this->json.end(); ++it) {
|
for(auto it = this->json.begin(); it != this->json.end(); ++it) {
|
||||||
Temp.push_back(it.key().c_str());
|
if (this->json[it.key()].contains("Description") && this->json[it.key()]["Description"].is_string()) {
|
||||||
|
Temp.push_back(std::make_pair(it.key(), this->json[it.key()]["Description"]));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Temp.push_back(std::make_pair(it.key(), it.key()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user