mirror of
https://github.com/XorTroll/uLaunch
synced 2025-02-18 13:38:32 +00:00
Progressively faster scrolling, remove all titles option
This commit is contained in:
parent
420a6a83e4
commit
114b62ba43
7 changed files with 74 additions and 70 deletions
|
@ -17,7 +17,7 @@ namespace am
|
||||||
enum class QMenuMessage
|
enum class QMenuMessage
|
||||||
{
|
{
|
||||||
Invalid,
|
Invalid,
|
||||||
HomeRequest,
|
HomeRequest
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class QDaemonMessage
|
enum class QDaemonMessage
|
||||||
|
@ -36,7 +36,7 @@ namespace am
|
||||||
TryLogUser,
|
TryLogUser,
|
||||||
RegisterUserPassword,
|
RegisterUserPassword,
|
||||||
ChangeUserPassword,
|
ChangeUserPassword,
|
||||||
RemoveUserPassword,
|
RemoveUserPassword
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QSuspendedInfo
|
struct QSuspendedInfo
|
||||||
|
|
|
@ -63,6 +63,8 @@ namespace ui
|
||||||
bool scrollmoveflag;
|
bool scrollmoveflag;
|
||||||
std::chrono::steady_clock::time_point scrollmovetp;
|
std::chrono::steady_clock::time_point scrollmovetp;
|
||||||
u32 scrollflag;
|
u32 scrollflag;
|
||||||
|
u32 scrolltpvalue;
|
||||||
|
u32 scrollcount;
|
||||||
bool IsLeftFirst();
|
bool IsLeftFirst();
|
||||||
bool IsRightLast();
|
bool IsRightLast();
|
||||||
void ReloadIcons(u32 Direction);
|
void ReloadIcons(u32 Direction);
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB |
|
@ -93,9 +93,8 @@ namespace ui
|
||||||
qapp->ApplyConfigForElement("main_menu", "firmware_text", this->fwText);
|
qapp->ApplyConfigForElement("main_menu", "firmware_text", this->fwText);
|
||||||
this->Add(this->fwText);
|
this->Add(this->fwText);
|
||||||
|
|
||||||
this->menuToggle = ClickableImage::New(0, 200, cfg::ProcessedThemeResource(theme, "ui/ToggleClick.png"));
|
this->menuToggle = ClickableImage::New(520, 200, cfg::ProcessedThemeResource(theme, "ui/ToggleClick.png"));
|
||||||
this->menuToggle->SetOnClick(std::bind(&MenuLayout::menuToggle_Click, this));
|
this->menuToggle->SetOnClick(std::bind(&MenuLayout::menuToggle_Click, this));
|
||||||
this->menuToggle->SetHorizontalAlign(pu::ui::elm::HorizontalAlign::Center);
|
|
||||||
qapp->ApplyConfigForElement("main_menu", "menu_toggle_button", this->menuToggle);
|
qapp->ApplyConfigForElement("main_menu", "menu_toggle_button", this->menuToggle);
|
||||||
this->Add(this->menuToggle);
|
this->Add(this->menuToggle);
|
||||||
|
|
||||||
|
@ -155,15 +154,12 @@ namespace ui
|
||||||
qapp->CloseWithFadeOut();
|
qapp->CloseWithFadeOut();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
qapp->CreateShowDialog("All", "All titles...", {"Ok"}, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u32 realidx = index - 1;
|
u32 realidx = index;
|
||||||
|
if(this->homebrew_mode) realidx--;
|
||||||
if(this->homebrew_mode)
|
if(this->homebrew_mode)
|
||||||
{
|
{
|
||||||
auto hb = homebrew[realidx];
|
auto hb = homebrew[realidx];
|
||||||
|
@ -305,11 +301,19 @@ namespace ui
|
||||||
{
|
{
|
||||||
this->itemAuthor->SetVisible(true);
|
this->itemAuthor->SetVisible(true);
|
||||||
this->itemVersion->SetVisible(true);
|
this->itemVersion->SetVisible(true);
|
||||||
if(index > 0)
|
u32 realidx = index;
|
||||||
|
if(this->homebrew_mode)
|
||||||
{
|
{
|
||||||
u32 realidx = index - 1;
|
if(index == 0)
|
||||||
if(this->homebrew_mode)
|
|
||||||
{
|
{
|
||||||
|
this->itemAuthor->SetVisible(false);
|
||||||
|
this->itemVersion->SetVisible(false);
|
||||||
|
this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerHomebrew.png"));
|
||||||
|
this->itemName->SetText("Launch hbmenu");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
realidx--;
|
||||||
auto hb = homebrew[realidx];
|
auto hb = homebrew[realidx];
|
||||||
auto info = cfg::GetRecordInformation(hb);
|
auto info = cfg::GetRecordInformation(hb);
|
||||||
auto lent = cfg::GetRecordInformationLanguageEntry(info);
|
auto lent = cfg::GetRecordInformationLanguageEntry(info);
|
||||||
|
@ -327,55 +331,37 @@ namespace ui
|
||||||
else this->itemVersion->SetText("0");
|
else this->itemVersion->SetText("0");
|
||||||
this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerHomebrew.png"));
|
this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerHomebrew.png"));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
auto &folder = cfg::FindFolderByName(list, this->curfolder);
|
|
||||||
if(realidx < folder.titles.size())
|
|
||||||
{
|
|
||||||
auto title = folder.titles[realidx];
|
|
||||||
auto info = cfg::GetRecordInformation(title);
|
|
||||||
auto lent = cfg::GetRecordInformationLanguageEntry(info);
|
|
||||||
if(lent != NULL)
|
|
||||||
{
|
|
||||||
this->itemName->SetText(lent->name);
|
|
||||||
this->itemAuthor->SetText(lent->author);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this->itemName->SetText("Unknown");
|
|
||||||
this->itemAuthor->SetText("Unknown");
|
|
||||||
}
|
|
||||||
if(strlen(info.nacp.version)) this->itemVersion->SetText(info.nacp.version);
|
|
||||||
else this->itemVersion->SetText("0");
|
|
||||||
if((cfg::TitleType)title.title_type == cfg::TitleType::Homebrew) this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerHomebrew.png"));
|
|
||||||
else this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerInstalled.png"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto foldr = list.folders[realidx - folder.titles.size()];
|
|
||||||
this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerFolder.png"));
|
|
||||||
this->itemAuthor->SetText(std::to_string(foldr.titles.size()) + " entries");
|
|
||||||
this->itemVersion->SetVisible(false);
|
|
||||||
this->itemName->SetText(foldr.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->itemAuthor->SetVisible(false);
|
auto &folder = cfg::FindFolderByName(list, this->curfolder);
|
||||||
this->itemVersion->SetVisible(false);
|
if(realidx < folder.titles.size())
|
||||||
|
|
||||||
if(this->homebrew_mode)
|
|
||||||
{
|
{
|
||||||
// Since it will launch hbmenu...
|
auto title = folder.titles[realidx];
|
||||||
this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerHomebrew.png"));
|
auto info = cfg::GetRecordInformation(title);
|
||||||
this->itemName->SetText("Launch hbmenu");
|
auto lent = cfg::GetRecordInformationLanguageEntry(info);
|
||||||
|
if(lent != NULL)
|
||||||
|
{
|
||||||
|
this->itemName->SetText(lent->name);
|
||||||
|
this->itemAuthor->SetText(lent->author);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->itemName->SetText("Unknown");
|
||||||
|
this->itemAuthor->SetText("Unknown");
|
||||||
|
}
|
||||||
|
if(strlen(info.nacp.version)) this->itemVersion->SetText(info.nacp.version);
|
||||||
|
else this->itemVersion->SetText("0");
|
||||||
|
if((cfg::TitleType)title.title_type == cfg::TitleType::Homebrew) this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerHomebrew.png"));
|
||||||
|
else this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerInstalled.png"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Since it will show "all titles"...
|
auto foldr = list.folders[realidx - folder.titles.size()];
|
||||||
this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerInstalled.png"));
|
this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerFolder.png"));
|
||||||
this->itemName->SetText("Show all titles");
|
this->itemAuthor->SetText(std::to_string(foldr.titles.size()) + " entries");
|
||||||
|
this->itemVersion->SetVisible(false);
|
||||||
|
this->itemName->SetText(foldr.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!this->curfolder.empty()) this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerFolder.png")); // This way user always knows he's inside a folder
|
if(!this->curfolder.empty()) this->bannerImage->SetImage(cfg::ProcessedThemeResource(theme, "ui/BannerFolder.png")); // This way user always knows he's inside a folder
|
||||||
|
@ -398,22 +384,27 @@ namespace ui
|
||||||
}
|
}
|
||||||
|
|
||||||
this->itemsMenu->ClearItems();
|
this->itemsMenu->ClearItems();
|
||||||
auto initial_itm = cfg::ProcessedThemeResource(theme, "ui/AllTitles.png");
|
if(this->homebrew_mode) this->itemsMenu->AddItem(cfg::ProcessedThemeResource(theme, "ui/Hbmenu.png"));
|
||||||
if(this->homebrew_mode) initial_itm = cfg::ProcessedThemeResource(theme, "ui/Hbmenu.png");
|
|
||||||
this->itemsMenu->AddItem(initial_itm);
|
|
||||||
|
|
||||||
u32 tmpidx = 0;
|
u32 tmpidx = 0;
|
||||||
for(auto itm: itm_list)
|
for(auto itm: itm_list)
|
||||||
{
|
{
|
||||||
|
bool set_susp = false;
|
||||||
if((cfg::TitleType)itm.title_type == cfg::TitleType::Installed)
|
if((cfg::TitleType)itm.title_type == cfg::TitleType::Installed)
|
||||||
{
|
{
|
||||||
if(qapp->IsTitleSuspended()) if(qapp->GetSuspendedApplicationId() == itm.app_id) this->itemsMenu->SetSuspendedItem(tmpidx + 1); // Skip initial item
|
if(qapp->IsTitleSuspended()) if(qapp->GetSuspendedApplicationId() == itm.app_id) set_susp = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(qapp->IsHomebrewSuspended()) if(qapp->GetSuspendedHomebrewPath() == std::string(itm.nro_target.nro_path)) this->itemsMenu->SetSuspendedItem(tmpidx + 1); // Skip initial item
|
if(qapp->IsHomebrewSuspended()) if(qapp->GetSuspendedHomebrewPath() == std::string(itm.nro_target.nro_path)) set_susp = true;
|
||||||
}
|
}
|
||||||
this->itemsMenu->AddItem(cfg::GetRecordIconPath(itm));
|
this->itemsMenu->AddItem(cfg::GetRecordIconPath(itm));
|
||||||
|
if(set_susp)
|
||||||
|
{
|
||||||
|
u32 suspidx = tmpidx;
|
||||||
|
if(this->homebrew_mode) suspidx++; // Skip initial item if homebrew mode
|
||||||
|
this->itemsMenu->SetSuspendedItem(suspidx);
|
||||||
|
}
|
||||||
tmpidx++;
|
tmpidx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,7 +538,8 @@ namespace ui
|
||||||
{
|
{
|
||||||
if(!this->curfolder.empty()) this->MoveFolder("", true);
|
if(!this->curfolder.empty()) this->MoveFolder("", true);
|
||||||
}
|
}
|
||||||
else if(down & KEY_UP) this->menuToggle_Click();
|
else if(down & KEY_PLUS) this->logo_Click();
|
||||||
|
else if(down & KEY_MINUS) this->menuToggle_Click();
|
||||||
else if(down & KEY_ZL) this->HandleUserMenu();
|
else if(down & KEY_ZL) this->HandleUserMenu();
|
||||||
else if(down & KEY_L) this->HandleWebPageOpen();
|
else if(down & KEY_L) this->HandleWebPageOpen();
|
||||||
else if(down & KEY_R) this->HandleSettingsMenu();
|
else if(down & KEY_R) this->HandleSettingsMenu();
|
||||||
|
@ -570,7 +562,8 @@ 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:/LogoLarge.png");
|
qapp->CreateShowDialog("About uLaunch", "uLaunch v" + std::string(Q_VERSION) + "\n\nuLaunch is a custom, open source Nintendo Switch HOME menu reimplementation.\nIt's the rewrite and evolution of eQlipse project.\n\nIn order to contribute, suggest ideas or report issues, check uLaunch's GitHub repository:\nhttps://github.com/XorTroll/uLaunch", { "Ok" }, true, "romfs:/LogoLarge.png");
|
||||||
|
qapp->ShowNotification("(-) -> Swap the menu | (X) -> Close suspended item | (Y) -> Move the selected item | (L), (R), (ZL), (ZR) -> Open top menus");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuLayout::settings_Click()
|
void MenuLayout::settings_Click()
|
||||||
|
|
|
@ -16,6 +16,8 @@ namespace ui
|
||||||
this->suspicon = pu::ui::render::LoadImage(SuspendedImagePath);
|
this->suspicon = pu::ui::render::LoadImage(SuspendedImagePath);
|
||||||
this->onselect = [&](u32,u64){};
|
this->onselect = [&](u32,u64){};
|
||||||
this->onselch = [&](u32){};
|
this->onselch = [&](u32){};
|
||||||
|
this->scrolltpvalue = 50;
|
||||||
|
this->scrollcount = 0;
|
||||||
this->SetY(y);
|
this->SetY(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,10 +197,16 @@ namespace ui
|
||||||
if(this->scrollmoveflag)
|
if(this->scrollmoveflag)
|
||||||
{
|
{
|
||||||
auto diff2 = std::chrono::duration_cast<std::chrono::milliseconds>(curtp - this->scrollmovetp).count();
|
auto diff2 = std::chrono::duration_cast<std::chrono::milliseconds>(curtp - this->scrollmovetp).count();
|
||||||
if(diff2 >= 50)
|
if(diff2 >= this->scrolltpvalue)
|
||||||
{
|
{
|
||||||
|
if(this->scrollcount >= 5)
|
||||||
|
{
|
||||||
|
this->scrollcount = 0;
|
||||||
|
this->scrolltpvalue /= 2;
|
||||||
|
}
|
||||||
this->scrollmoveflag = false;
|
this->scrollmoveflag = false;
|
||||||
this->HandleMoveRight();
|
this->HandleMoveRight();
|
||||||
|
this->scrollcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -214,7 +222,12 @@ namespace ui
|
||||||
this->scrolltp = std::chrono::steady_clock::now();
|
this->scrolltp = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else this->scrollflag = 0;
|
else
|
||||||
|
{
|
||||||
|
this->scrollflag = 0;
|
||||||
|
this->scrollcount = 0;
|
||||||
|
this->scrolltpvalue = 50;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideMenu::SetOnItemSelected(std::function<void(u64, u32)> Fn)
|
void SideMenu::SetOnItemSelected(std::function<void(u64, u32)> Fn)
|
||||||
|
|
|
@ -172,4 +172,6 @@ If you get a crash using uLaunch, please check:
|
||||||
|
|
||||||
- Switchbrew team for libnx and [hbloader](https://github.com/switchbrew/nx-hbloader), the base of *QHbTarget projects (they're some useful wrappers of hbloader in the end)
|
- Switchbrew team for libnx and [hbloader](https://github.com/switchbrew/nx-hbloader), the base of *QHbTarget projects (they're some useful wrappers of hbloader in the end)
|
||||||
|
|
||||||
|
- C4Phoenix for the amazing design of this project's logo.
|
||||||
|
|
||||||
- [Icons8](https://icons8.com/) website for a big part of the icons used by the default style.
|
- [Icons8](https://icons8.com/) website for a big part of the icons used by the default style.
|
8
TODO.md
8
TODO.md
|
@ -1,10 +1,4 @@
|
||||||
## TODO
|
# uLaunch's TODO list
|
||||||
|
|
||||||
All the stuff to do before first release:
|
|
||||||
|
|
||||||
- "All titles" menu
|
|
||||||
|
|
||||||
- Polish UI (specially speaking of startup menu)
|
|
||||||
|
|
||||||
## Plans
|
## Plans
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue