Some changes

This commit is contained in:
XorTroll 2019-11-17 16:31:02 +01:00
parent 1744f71532
commit 78d31fc477
17 changed files with 37 additions and 16 deletions

View file

@ -151,19 +151,19 @@ namespace cfg
Theme theme = {};
theme.base_name = base_name;
auto themedir = std::string(Q_THEMES_PATH) + "/" + base_name;
if(base_name.empty() || !fs::ExistsDirectory(themedir)) themedir = CFG_THEME_DEFAULT;
auto metajson = themedir + "/theme/Manifest.json";
if(base_name.empty() || !fs::ExistsFile(metajson)) themedir = CFG_THEME_DEFAULT;
metajson = themedir + "/theme/Manifest.json";
auto [rc, meta] = util::LoadJSONFromFile(metajson);
if(R_SUCCEEDED(rc))
{
theme.manifest.name = meta.value("name", "'" + base_name + "'");
theme.manifest.format_version = meta.value("format_version", CurrentThemeFormatVersion);
theme.manifest.format_version = meta.value("format_version", 0);
theme.manifest.release = meta.value("release", "");
theme.manifest.description = meta.value("description", "");
theme.manifest.author = meta.value("author", "");
theme.path = themedir;
}
else return LoadTheme("");
return theme;
}

View file

@ -36,6 +36,8 @@ namespace ui
void HandleThemesMenu();
void HandleControllerAppletOpen();
void HandleShowHelp();
void HandleOpenAlbum();
void HandlePowerDialog();
void HandleMultiselectMoveToFolder(std::string folder);
void StopMultiselect();
private:

View file

@ -1,6 +1,6 @@
{
"name": "Default theme",
"format_version": 0,
"format_version": 1,
"release": "...",
"description": "Default uLaunch theme",
"author": "XorTroll"

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

View file

@ -66,16 +66,19 @@ int main()
// Information block sent as an extra storage to QMenu.
am::QLibraryAppletReadStorage(&status, sizeof(status));
app_buf = new u8[RawRGBAScreenBufferSize]();
qmenu::Initialize();
list = cfg::LoadTitleList(true);
// First read sent storages, then init the renderer (UI, which also inits RomFs), then init everything else
if(smode != am::QMenuStartMode::Invalid)
{
auto renderer = pu::ui::render::Renderer::New(SDL_INIT_EVERYTHING, pu::ui::render::RendererInitOptions::RendererEverything, pu::ui::render::RendererHardwareFlags);
qapp = ui::QMenuApplication::New(renderer);
// Renderer initializes RomFs, so we start initializing the rest of stuff here!
app_buf = new u8[RawRGBAScreenBufferSize]();
qmenu::Initialize();
list = cfg::LoadTitleList(true);
// Get system language and load translations (default one if not present)
u64 lcode = 0;
setGetLanguageCode(&lcode);

View file

@ -125,11 +125,14 @@ namespace ui
this->quickMenu = QuickMenu::New(cfg::GetAssetByTheme(theme, "ui/QuickMenuMain.png"));
this->quickMenu->SetEntry(QuickMenuDirection::Down, cfg::GetAssetByTheme(theme, "ui/QuickMenuSettingsItem.png"), std::bind(&MenuLayout::settings_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Left, cfg::GetAssetByTheme(theme, "ui/QuickMenuWebItem.png"), std::bind(&MenuLayout::web_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Right, cfg::GetAssetByTheme(theme, "ui/QuickMenuThemesItem.png"), std::bind(&MenuLayout::themes_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::UpLeft, cfg::GetAssetByTheme(theme, "ui/QuickMenuControllerItem.png"), std::bind(&MenuLayout::HandleControllerAppletOpen, this));
this->quickMenu->SetEntry(QuickMenuDirection::DownRight, cfg::GetAssetByTheme(theme, "ui/QuickMenuHelpItem.png"), std::bind(&MenuLayout::HandleShowHelp, this));
this->quickMenu->SetEntry(QuickMenuDirection::Up, cfg::GetAssetByTheme(theme, "ui/UserIcon.png"), std::bind(&MenuLayout::users_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Down, cfg::GetAssetByTheme(theme, "ui/SettingsIcon.png"), std::bind(&MenuLayout::settings_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Left, cfg::GetAssetByTheme(theme, "ui/WebIcon.png"), std::bind(&MenuLayout::web_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Right, cfg::GetAssetByTheme(theme, "ui/ThemesIcon.png"), std::bind(&MenuLayout::themes_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::UpLeft, cfg::GetAssetByTheme(theme, "ui/ControllerIcon.png"), std::bind(&MenuLayout::HandleControllerAppletOpen, this));
this->quickMenu->SetEntry(QuickMenuDirection::UpRight, cfg::GetAssetByTheme(theme, "ui/AlbumIcon.png"), std::bind(&MenuLayout::HandleOpenAlbum, this));
this->quickMenu->SetEntry(QuickMenuDirection::DownLeft, cfg::GetAssetByTheme(theme, "ui/PowerIcon.png"), std::bind(&MenuLayout::HandlePowerDialog, this));
this->quickMenu->SetEntry(QuickMenuDirection::DownRight, cfg::GetAssetByTheme(theme, "ui/HelpIcon.png"), std::bind(&MenuLayout::HandleShowHelp, this));
this->Add(this->quickMenu);
@ -732,7 +735,6 @@ namespace ui
{
auto path = os::GetIconCacheImagePath(user);
this->users->SetImage(path);
this->quickMenu->SetEntry(QuickMenuDirection::Up, path, std::bind(&MenuLayout::users_Click, this));
this->users->SetWidth(50);
this->users->SetHeight(50);
}
@ -1081,6 +1083,11 @@ namespace ui
}
void MenuLayout::HandleShowHelp()
{
// ...
}
void MenuLayout::HandleOpenAlbum()
{
am::QMenuCommandWriter writer(am::QDaemonMessage::OpenAlbum);
writer.FinishWrite();
@ -1090,6 +1097,11 @@ namespace ui
return;
}
void MenuLayout::HandlePowerDialog()
{
// ...
}
void MenuLayout::HandleMultiselectMoveToFolder(std::string folder)
{
if(this->select_on)

View file

@ -95,12 +95,16 @@ namespace ui
for(auto &[direction, subitem]: this->item_map)
{
auto [x, y] = this->ComputePositionForDirection(direction);
auto tex = subitem.nicon;
auto texw = pu::ui::render::GetTextureWidth(tex);
auto texh = pu::ui::render::GetTextureHeight(tex);
x += (SubItemsSize - texw) / 2;
y += (SubItemsSize - texh) / 2;
if(direction == dir) SDL_SetTextureColorMod(tex, 200, 200, 255);
else SDL_SetTextureColorMod(tex, 255, 255, 255);
Drawer->RenderTexture(tex, x, y, { fgalpha, SubItemsSize, SubItemsSize, -1 });
Drawer->RenderTexture(tex, x, y, { fgalpha, texw, texh, -1 });
}
}