disable install by default, enabled via advanced menu. disable web browser if applet.

This commit is contained in:
ITotalJustice
2024-12-21 18:49:40 +00:00
parent 986ffdcd9c
commit 4a058d3caf
5 changed files with 69 additions and 26 deletions

View File

@@ -63,6 +63,7 @@ public:
static auto GetNxlinkEnable() -> bool; static auto GetNxlinkEnable() -> bool;
static auto GetLogEnable() -> bool; static auto GetLogEnable() -> bool;
static auto GetReplaceHbmenuEnable() -> bool; static auto GetReplaceHbmenuEnable() -> bool;
static auto GetInstallEnable() -> bool;
static auto GetInstallSdEnable() -> bool; static auto GetInstallSdEnable() -> bool;
static auto GetInstallPrompt() -> bool; static auto GetInstallPrompt() -> bool;
static auto GetThemeShuffleEnable() -> bool; static auto GetThemeShuffleEnable() -> bool;
@@ -72,7 +73,9 @@ public:
static void SetNxlinkEnable(bool enable); static void SetNxlinkEnable(bool enable);
static void SetLogEnable(bool enable); static void SetLogEnable(bool enable);
static void SetReplaceHbmenuEnable(bool enable); static void SetReplaceHbmenuEnable(bool enable);
static void SetInstallEnable(bool enable);
static void SetInstallSdEnable(bool enable); static void SetInstallSdEnable(bool enable);
static void SetInstallPrompt(bool enable);
static void SetThemeShuffleEnable(bool enable); static void SetThemeShuffleEnable(bool enable);
static void SetThemeMusicEnable(bool enable); static void SetThemeMusicEnable(bool enable);
static void SetLanguage(long index); static void SetLanguage(long index);
@@ -139,6 +142,7 @@ public:
option::OptionBool m_nxlink_enabled{INI_SECTION, "nxlink_enabled", true}; option::OptionBool m_nxlink_enabled{INI_SECTION, "nxlink_enabled", true};
option::OptionBool m_log_enabled{INI_SECTION, "log_enabled", false}; option::OptionBool m_log_enabled{INI_SECTION, "log_enabled", false};
option::OptionBool m_replace_hbmenu{INI_SECTION, "replace_hbmenu", false}; option::OptionBool m_replace_hbmenu{INI_SECTION, "replace_hbmenu", false};
option::OptionBool m_install{INI_SECTION, "install", false};
option::OptionBool m_install_sd{INI_SECTION, "install_sd", true}; option::OptionBool m_install_sd{INI_SECTION, "install_sd", true};
option::OptionLong m_install_prompt{INI_SECTION, "install_prompt", true}; option::OptionLong m_install_prompt{INI_SECTION, "install_prompt", true};
option::OptionBool m_theme_shuffle{INI_SECTION, "theme_shuffle", false}; option::OptionBool m_theme_shuffle{INI_SECTION, "theme_shuffle", false};

View File

@@ -363,6 +363,10 @@ auto App::GetReplaceHbmenuEnable() -> bool {
return g_app->m_replace_hbmenu.Get(); return g_app->m_replace_hbmenu.Get();
} }
auto App::GetInstallEnable() -> bool {
return g_app->m_install.Get();
}
auto App::GetInstallSdEnable() -> bool { auto App::GetInstallSdEnable() -> bool {
return g_app->m_install_sd.Get(); return g_app->m_install_sd.Get();
} }
@@ -409,10 +413,18 @@ void App::SetReplaceHbmenuEnable(bool enable) {
g_app->m_replace_hbmenu.Set(enable); g_app->m_replace_hbmenu.Set(enable);
} }
void App::SetInstallEnable(bool enable) {
g_app->m_install.Set(enable);
}
void App::SetInstallSdEnable(bool enable) { void App::SetInstallSdEnable(bool enable) {
g_app->m_install_sd.Set(enable); g_app->m_install_sd.Set(enable);
} }
void App::SetInstallPrompt(bool enable) {
g_app->m_install_prompt.Set(enable);
}
void App::SetThemeShuffleEnable(bool enable) { void App::SetThemeShuffleEnable(bool enable) {
g_app->m_theme_shuffle.Set(enable); g_app->m_theme_shuffle.Set(enable);
} }

View File

@@ -608,7 +608,7 @@ Menu::Menu(const std::vector<NroEntry>& nro_entries) : MenuBase{"FileBrowser"_i1
} }
if (m_entries_current.size()) { if (m_entries_current.size()) {
if (HasTypeInSelectedEntries(FsDirEntryType_File) && !m_selected_count && (GetEntry().GetExtension() == "nro" || !FindFileAssocFor().empty())) { if (App::GetInstallEnable() && HasTypeInSelectedEntries(FsDirEntryType_File) && !m_selected_count && (GetEntry().GetExtension() == "nro" || !FindFileAssocFor().empty())) {
options->Add(std::make_shared<SidebarEntryCallback>("Install Forwarder"_i18n, [this](){; options->Add(std::make_shared<SidebarEntryCallback>("Install Forwarder"_i18n, [this](){;
if (App::GetInstallPrompt()) { if (App::GetInstallPrompt()) {
App::Push(std::make_shared<OptionBox>( App::Push(std::make_shared<OptionBox>(

View File

@@ -126,20 +126,22 @@ Menu::Menu() : MenuBase{"Homebrew"_i18n} {
)); ));
}, true)); }, true));
options->Add(std::make_shared<SidebarEntryCallback>("Install Forwarder"_i18n, [this](){ if (App::GetInstallEnable()) {
if (App::GetInstallPrompt()) { options->Add(std::make_shared<SidebarEntryCallback>("Install Forwarder"_i18n, [this](){
App::Push(std::make_shared<OptionBox>( if (App::GetInstallPrompt()) {
"WARNING: Installing forwarders will lead to a ban!"_i18n, App::Push(std::make_shared<OptionBox>(
"Back"_i18n, "Install"_i18n, 0, [this](auto op_index){ "WARNING: Installing forwarders will lead to a ban!"_i18n,
if (op_index && *op_index) { "Back"_i18n, "Install"_i18n, 0, [this](auto op_index){
InstallHomebrew(); if (op_index && *op_index) {
InstallHomebrew();
}
} }
} ));
)); } else {
} else { InstallHomebrew();
InstallHomebrew(); }
} }, true));
}, true)); }
} }
}}) }})
); );

View File

@@ -204,7 +204,6 @@ MainMenu::MainMenu() {
SidebarEntryArray::Items language_items; SidebarEntryArray::Items language_items;
language_items.push_back("Auto"_i18n); language_items.push_back("Auto"_i18n);
language_items.push_back("English"_i18n); language_items.push_back("English"_i18n);
language_items.push_back("Japanese"_i18n); language_items.push_back("Japanese"_i18n);
language_items.push_back("French"_i18n); language_items.push_back("French"_i18n);
@@ -266,17 +265,10 @@ MainMenu::MainMenu() {
} }
})); }));
options->Add(std::make_shared<SidebarEntryArray>("Language"_i18n, language_items, [this, language_items](std::size_t& index_out){ options->Add(std::make_shared<SidebarEntryArray>("Language"_i18n, language_items, [this](std::size_t& index_out){
App::SetLanguage(index_out); App::SetLanguage(index_out);
}, (std::size_t)App::GetLanguage())); }, (std::size_t)App::GetLanguage()));
options->Add(std::make_shared<SidebarEntryBool>("Logging"_i18n, App::GetLogEnable(), [this](bool& enable){
App::SetLogEnable(enable);
}, "Enabled"_i18n, "Disabled"_i18n));
options->Add(std::make_shared<SidebarEntryBool>("Replace hbmenu on exit"_i18n, App::GetReplaceHbmenuEnable(), [this](bool& enable){
App::SetReplaceHbmenuEnable(enable);
}, "Enabled"_i18n, "Disabled"_i18n));
options->Add(std::make_shared<SidebarEntryCallback>("Misc"_i18n, [this](){ options->Add(std::make_shared<SidebarEntryCallback>("Misc"_i18n, [this](){
auto options = std::make_shared<Sidebar>("Misc Options"_i18n, Sidebar::Side::LEFT); auto options = std::make_shared<Sidebar>("Misc Options"_i18n, Sidebar::Side::LEFT);
ON_SCOPE_EXIT(App::Push(options)); ON_SCOPE_EXIT(App::Push(options));
@@ -284,12 +276,45 @@ MainMenu::MainMenu() {
options->Add(std::make_shared<SidebarEntryCallback>("Themezer"_i18n, [](){ options->Add(std::make_shared<SidebarEntryCallback>("Themezer"_i18n, [](){
App::Push(std::make_shared<menu::themezer::Menu>()); App::Push(std::make_shared<menu::themezer::Menu>());
})); }));
options->Add(std::make_shared<SidebarEntryCallback>("Irs"_i18n, [](){ options->Add(std::make_shared<SidebarEntryCallback>("Irs"_i18n, [](){
App::Push(std::make_shared<menu::irs::Menu>()); App::Push(std::make_shared<menu::irs::Menu>());
})); }));
options->Add(std::make_shared<SidebarEntryCallback>("Web"_i18n, [](){
WebShow("https://lite.duckduckgo.com/lite"); if (App::IsApplication()) {
})); options->Add(std::make_shared<SidebarEntryCallback>("Web"_i18n, [](){
WebShow("https://lite.duckduckgo.com/lite");
}));
}
}));
options->Add(std::make_shared<SidebarEntryCallback>("Advanced"_i18n, [this](){
auto options = std::make_shared<Sidebar>("Advanced Options"_i18n, Sidebar::Side::LEFT);
ON_SCOPE_EXIT(App::Push(options));
SidebarEntryArray::Items install_items;
install_items.push_back("System memory"_i18n);
install_items.push_back("microSD card"_i18n);
options->Add(std::make_shared<SidebarEntryBool>("Logging"_i18n, App::GetLogEnable(), [this](bool& enable){
App::SetLogEnable(enable);
}, "Enabled"_i18n, "Disabled"_i18n));
options->Add(std::make_shared<SidebarEntryBool>("Replace hbmenu on exit"_i18n, App::GetReplaceHbmenuEnable(), [this](bool& enable){
App::SetReplaceHbmenuEnable(enable);
}, "Enabled"_i18n, "Disabled"_i18n));
options->Add(std::make_shared<SidebarEntryBool>("Install forwarders"_i18n, App::GetInstallEnable(), [this](bool& enable){
App::SetInstallEnable(enable);
}, "Enabled"_i18n, "Disabled"_i18n));
options->Add(std::make_shared<SidebarEntryArray>("Install location"_i18n, install_items, [this](std::size_t& index_out){
App::SetInstallSdEnable(index_out);
}, (std::size_t)App::GetInstallSdEnable()));
options->Add(std::make_shared<SidebarEntryBool>("Show install warning"_i18n, App::GetInstallPrompt(), [this](bool& enable){
App::SetInstallPrompt(enable);
}, "Enabled"_i18n, "Disabled"_i18n));
})); }));
}}) }})
); );