finish up theme mod code

This commit is contained in:
mrdude2478 2023-10-06 02:34:49 +01:00
parent 23e5000c21
commit db232952e0
4 changed files with 16 additions and 8 deletions

View File

@ -44,7 +44,7 @@ DATA := data
INCLUDES := include include/ui include/data include/install include/nx include/nx/ipc include/util $(CURDIR)/include/Plutonium/Plutonium/include
APP_TITLE := TinWoo Installer
APP_AUTHOR := MrDude
APP_VERSION := 1.0.20
APP_VERSION := 1.0.21
ROMFS := romfs
APP_ICON := icon.jpg

View File

@ -5,7 +5,7 @@
namespace inst::config {
static const std::string appDir = "sdmc:/switch/tinwoo";
static const std::string configPath = appDir + "/config.json";
static const std::string appVersion = "1.0.20";
static const std::string appVersion = "1.0.21";
extern std::string gAuthKey;
extern std::string sigPatchesUrl;

View File

@ -1,5 +1,6 @@
#include <thread>
#include <string>
//#include <sstream>
#include <switch.h>
#include "util/error.hpp"
#include "ui/MainApplication.hpp"
@ -14,8 +15,15 @@ int main(int argc, char* argv[])
try {
Theme::Load();
int x = 0;
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "fonts.default"_theme)) {
x = 1;
int langInt = inst::config::languageSetting;
//Don't use custom fonts if Taiwanese or Japanese language is selected.
//but still use custom fonts if the system language is selected.
if (langInt != 2) {
if (langInt != 8) {
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "fonts.default"_theme)) {
x = 1;
}
}
}
auto renderer_opts = pu::ui::render::RendererInitOptions(SDL_INIT_EVERYTHING, pu::ui::render::RendererHardwareFlags);
renderer_opts.UseImage(pu::ui::render::IMGAllFlags);

View File

@ -132,11 +132,11 @@ namespace inst::ui {
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json")) ourEntry->SetColor(COLOR(text_colour));
else ourEntry->SetColor(COLOR("#FFFFFFFF"));
std::string folder_up = "romfs:/images/icons/folder-upload.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.folder_up"_theme)) {
folder_up = inst::config::appDir + "icons_others.folder_up"_theme;
std::string folder = "romfs:/images/icons/folder.png";
if (inst::config::useTheme && std::filesystem::exists(inst::config::appDir + "/theme/theme.json") && std::filesystem::exists(inst::config::appDir + "icons_others.folder"_theme)) {
folder = inst::config::appDir + "icons_others.folder"_theme;
}
ourEntry->SetIcon(folder_up);
ourEntry->SetIcon(folder);
this->menu->AddItem(ourEntry);
}
for (auto& file : this->ourFiles) {