Welcome logo! toasts, small minor changes

This commit is contained in:
XorTroll 2019-11-02 14:10:22 +01:00
parent 5ea82686a1
commit 420a6a83e4
10 changed files with 41 additions and 21 deletions

View file

@ -7,9 +7,12 @@ namespace am
bool LibraryAppletIsActive() bool LibraryAppletIsActive()
{ {
if(applet_holder.StateChangedEvent.revent == INVALID_HANDLE) return false; bool active = false;
if(!serviceIsActive(&applet_holder.s)) return false; if(applet_holder.StateChangedEvent.revent == INVALID_HANDLE) active = false;
return !appletHolderCheckFinished(&applet_holder); if(!serviceIsActive(&applet_holder.s)) active = false;
active = !appletHolderCheckFinished(&applet_holder);
if(!active) appletUpdateCallerAppletCaptureImage();
return active;
} }
bool LibraryAppletIsQMenu() bool LibraryAppletIsQMenu()

View file

@ -4,7 +4,7 @@
#include <stdio.h> #include <stdio.h>
const char g_noticeText[] = const char g_noticeText[] =
"uLaunch's HbTarget impl v" Q_VERSION " (custom wrapper of nx-hbloader)\0" "uLaunch's HbTarget impl (custom wrapper of nx-hbloader v2.2.0)\0"
"There is only one true CFW in the scene."; // Biggest truth "There is only one true CFW in the scene."; // Biggest truth
static char g_argv[2048]; static char g_argv[2048];

View file

@ -29,6 +29,7 @@ namespace ui
u64 GetSuspendedApplicationId(); u64 GetSuspendedApplicationId();
void NotifyEndSuspended(); void NotifyEndSuspended();
bool LaunchFailed(); bool LaunchFailed();
void ShowNotification(std::string text);
template<typename T> template<typename T>
T GetUIConfigValue(std::string name, T def) T GetUIConfigValue(std::string name, T def)
@ -81,6 +82,7 @@ namespace ui
MenuLayout::Ref menuLayout; MenuLayout::Ref menuLayout;
ThemeMenuLayout::Ref themeMenuLayout; ThemeMenuLayout::Ref themeMenuLayout;
SettingsMenuLayout::Ref settingsMenuLayout; SettingsMenuLayout::Ref settingsMenuLayout;
pu::ui::extras::Toast::Ref notifToast;
am::QSuspendedInfo suspinfo; am::QSuspendedInfo suspinfo;
u128 selected_user; u128 selected_user;
JSON uijson; JSON uijson;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -180,12 +180,12 @@ namespace ui
auto sopt = qapp->CreateShowDialog("Add to menu", "Would you like to add this homebrew to the main menu?", { "Yes", "Cancel" }, true); auto sopt = qapp->CreateShowDialog("Add to menu", "Would you like to add this homebrew to the main menu?", { "Yes", "Cancel" }, true);
if(sopt == 0) if(sopt == 0)
{ {
if(cfg::ExistsRecord(list, hb)) qapp->CreateShowDialog("Add to menu", "The homebrew is already in the main menu.\nNothing was added nor removed.\n\nYou can remove it from main menu itself.", { "Ok" }, true); if(cfg::ExistsRecord(list, hb)) qapp->ShowNotification("The homebrew is already in the main menu. Nothing was added nor removed.");
else else
{ {
cfg::SaveRecord(hb); cfg::SaveRecord(hb);
list.root.titles.push_back(hb); list.root.titles.push_back(hb);
qapp->CreateShowDialog("Add to menu", "The homebrew was successfully added to the main menu.", { "Ok" }, true); qapp->ShowNotification("The homebrew was successfully added to the main menu.");
} }
} }
} }
@ -218,7 +218,7 @@ namespace ui
else else
{ {
auto rc = reader.GetReadResult(); auto rc = reader.GetReadResult();
qapp->CreateShowDialog("Title launch", "An error ocurred attempting to launch the title:\n" + util::FormatResult(rc), { "Ok" }, true); qapp->ShowNotification("An error ocurred attempting to launch the title: " + util::FormatResult(rc));
} }
reader.FinishRead(); reader.FinishRead();
} }
@ -274,7 +274,7 @@ namespace ui
{ {
cfg::RemoveRecord(title); cfg::RemoveRecord(title);
folder.titles.erase(folder.titles.begin() + realidx); folder.titles.erase(folder.titles.begin() + realidx);
qapp->CreateShowDialog("Remove entry", "The entry was successfully removed.", { "Ok" }, true); qapp->ShowNotification("The entry was successfully removed.");
this->MoveFolder(this->curfolder, true); this->MoveFolder(this->curfolder, true);
} }
} }
@ -570,7 +570,7 @@ namespace ui
void MenuLayout::logo_Click() void MenuLayout::logo_Click()
{ {
qapp->CreateShowDialog("About uLaunch", "uLaunch v" + std::string(Q_VERSION) + "\n\n - Custom, open source Nintendo Switch HOME menu reimplementation", { "Ok" }, true, "romfs:/Logo.png"); qapp->CreateShowDialog("About uLaunch", "uLaunch v" + std::string(Q_VERSION) + "\n\n - Custom, open source Nintendo Switch HOME menu reimplementation", { "Ok" }, true, "romfs:/LogoLarge.png");
} }
void MenuLayout::settings_Click() void MenuLayout::settings_Click()
@ -674,7 +674,7 @@ namespace ui
else else
{ {
auto rc = reader.GetReadResult(); auto rc = reader.GetReadResult();
qapp->CreateShowDialog("Title launch", "An error ocurred attempting to launch the title:\n" + util::FormatResult(rc), { "Ok" }, true); qapp->ShowNotification("An error ocurred attempting to launch the title:\n" + util::FormatResult(rc));
} }
reader.FinishRead(); reader.FinishRead();
} }
@ -744,7 +744,7 @@ namespace ui
am::QMenuCommandResultReader reader; am::QMenuCommandResultReader reader;
rc = reader.GetReadResult(); rc = reader.GetReadResult();
} }
qapp->CreateShowDialog("Change password", R_SUCCEEDED(rc) ? "The password was successfully changed." : "An error ocurred while attempting to change the password: " + util::FormatResult(rc), { "Ok" }, true); qapp->ShowNotification(R_SUCCEEDED(rc) ? "The password was successfully changed." : "An error ocurred while attempting to change the password: " + util::FormatResult(rc));
} }
} }
} }
@ -760,7 +760,7 @@ namespace ui
am::QMenuCommandResultReader reader; am::QMenuCommandResultReader reader;
rc = reader.GetReadResult(); rc = reader.GetReadResult();
qapp->CreateShowDialog("Remove password", R_SUCCEEDED(rc) ? "The password was successfully removed." : "An error ocurred while attempting to remove the password: " + util::FormatResult(rc), { "Ok" }, true); qapp->ShowNotification(R_SUCCEEDED(rc) ? "The password was successfully removed." : "An error ocurred while attempting to remove the password: " + util::FormatResult(rc));
} }
} }
} }
@ -794,7 +794,7 @@ namespace ui
rc = reader.GetReadResult(); rc = reader.GetReadResult();
} }
} }
qapp->CreateShowDialog("Register password", R_SUCCEEDED(rc) ? "The password was successfully registered." : "An error ocurred while attempting to register the password: " + util::FormatResult(rc), { "Ok" }, true); qapp->ShowNotification(R_SUCCEEDED(rc) ? "The password was successfully registered." : "An error ocurred while attempting to register the password: " + util::FormatResult(rc));
} }
} }
} }

View file

@ -35,6 +35,10 @@ namespace ui
this->bgm_fade_in_ms = this->bgmjson.value("fade_in_ms", 1500); this->bgm_fade_in_ms = this->bgmjson.value("fade_in_ms", 1500);
this->bgm_fade_out_ms = this->bgmjson.value("fade_out_ms", 500); this->bgm_fade_out_ms = this->bgmjson.value("fade_out_ms", 500);
pu::ui::Color toasttextclr = pu::ui::Color::FromHex(GetUIConfigValue<std::string>("toast_text_color", "#e1e1e1ff"));
pu::ui::Color toastbaseclr = pu::ui::Color::FromHex(GetUIConfigValue<std::string>("toast_base_color", "#282828ff"));
this->notifToast = pu::ui::extras::Toast::New("...", 20, toasttextclr, toastbaseclr);
this->bgm = pu::audio::Open(cfg::ProcessedThemeResource(theme, "sound/BGM.mp3")); this->bgm = pu::audio::Open(cfg::ProcessedThemeResource(theme, "sound/BGM.mp3"));
this->startupLayout = StartupLayout::New(); this->startupLayout = StartupLayout::New();
@ -130,6 +134,13 @@ namespace ui
return (this->stmode == am::QMenuStartMode::MenuLaunchFailure); return (this->stmode == am::QMenuStartMode::MenuLaunchFailure);
} }
void QMenuApplication::ShowNotification(std::string text)
{
this->EndOverlay();
this->notifToast->SetText(text);
this->StartOverlayWithTimeout(this->notifToast, 1500);
}
void QMenuApplication::StartPlayBGM() void QMenuApplication::StartPlayBGM()
{ {
if(this->bgm != NULL) if(this->bgm != NULL)

View file

@ -80,7 +80,7 @@ namespace ui
this->curThemeAuthor->SetVisible(true); this->curThemeAuthor->SetVisible(true);
this->curThemeAuthor->SetText(theme.base.manifest.author); this->curThemeAuthor->SetText(theme.base.manifest.author);
this->curThemeVersion->SetVisible(true); this->curThemeVersion->SetVisible(true);
this->curThemeVersion->SetText(theme.base.manifest.release); this->curThemeVersion->SetText("v" + theme.base.manifest.release);
this->curThemeBanner->SetVisible(true); this->curThemeBanner->SetVisible(true);
this->curThemeIcon->SetVisible(true); this->curThemeIcon->SetVisible(true);
this->curThemeIcon->SetImage(theme.base.path + "/theme/Icon.png"); this->curThemeIcon->SetImage(theme.base.path + "/theme/Icon.png");
@ -122,12 +122,16 @@ namespace ui
{ {
auto seltheme = this->loadedThemes[this->themesMenu->GetSelectedIndex()]; auto seltheme = this->loadedThemes[this->themesMenu->GetSelectedIndex()];
auto iconpath = seltheme.path + "/theme/Icon.png"; auto iconpath = seltheme.path + "/theme/Icon.png";
auto sopt = qapp->CreateShowDialog("Set theme", "Would you like to set '" + seltheme.manifest.name + "' theme as uLaunch's theme?\nNote: changes require a reboot.", { "Yes", "Cancel" }, true, iconpath); if(seltheme.base_name == theme.base.base_name) qapp->ShowNotification("This is theme is the currently active one.");
else
{
auto sopt = qapp->CreateShowDialog("Set theme", "Would you like to set '" + seltheme.manifest.name + "' theme as uLaunch's theme?", { "Yes", "Cancel" }, true, iconpath);
if(sopt == 0) if(sopt == 0)
{ {
config.theme_name = seltheme.base_name; config.theme_name = seltheme.base_name;
cfg::SaveConfig(config); cfg::SaveConfig(config);
qapp->CreateShowDialog("Set theme", "uLaunch's theme was updated.", { "Ok" }, true); qapp->ShowNotification("uLaunch's theme was updated. Reboot in order to see changes.");
}
} }
} }
} }

View file

@ -1,5 +1,5 @@
export Q_VERSION := dev export Q_VERSION := 0.1
.PHONY: all dev clean .PHONY: all dev clean

View file

@ -1,4 +1,4 @@
# uLaunch <img width="200" src="LibraryAppletQMenu/RomFs/LogoLarge.png">
> Custom, open-source replacement/reimplementation for Nintendo Switch's HOME Menu (qlaunch), extending it with amazing, homebrew-orienteed functionality! > Custom, open-source replacement/reimplementation for Nintendo Switch's HOME Menu (qlaunch), extending it with amazing, homebrew-orienteed functionality!