add option in config to remove install warning prompt

This commit is contained in:
ITotalJustice
2024-12-21 18:01:57 +00:00
parent d02fbcf282
commit 97085ef282
4 changed files with 33 additions and 18 deletions

View File

@@ -64,6 +64,7 @@ public:
static auto GetLogEnable() -> bool; static auto GetLogEnable() -> bool;
static auto GetReplaceHbmenuEnable() -> bool; static auto GetReplaceHbmenuEnable() -> bool;
static auto GetInstallSdEnable() -> bool; static auto GetInstallSdEnable() -> bool;
static auto GetInstallPrompt() -> bool;
static auto GetThemeShuffleEnable() -> bool; static auto GetThemeShuffleEnable() -> bool;
static auto GetThemeMusicEnable() -> bool; static auto GetThemeMusicEnable() -> bool;
static auto GetLanguage() -> long; static auto GetLanguage() -> long;
@@ -139,6 +140,7 @@ public:
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_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::OptionBool m_theme_shuffle{INI_SECTION, "theme_shuffle", false}; option::OptionBool m_theme_shuffle{INI_SECTION, "theme_shuffle", false};
option::OptionBool m_theme_music{INI_SECTION, "theme_music", true}; option::OptionBool m_theme_music{INI_SECTION, "theme_music", true};
option::OptionLong m_language{INI_SECTION, "language", 0}; // auto option::OptionLong m_language{INI_SECTION, "language", 0}; // auto

View File

@@ -367,6 +367,10 @@ auto App::GetInstallSdEnable() -> bool {
return g_app->m_install_sd.Get(); return g_app->m_install_sd.Get();
} }
auto App::GetInstallPrompt() -> bool {
return g_app->m_install_prompt.Get();
}
auto App::GetThemeShuffleEnable() -> bool { auto App::GetThemeShuffleEnable() -> bool {
return g_app->m_theme_shuffle.Get(); return g_app->m_theme_shuffle.Get();
} }

View File

@@ -610,20 +610,18 @@ 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 (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](){;
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){
if (GetEntry().GetExtension() == "nro") { if (op_index && *op_index) {
if (R_FAILED(homebrew::Menu::InstallHomebrewFromPath(GetNewPathCurrent()))) {
log_write("failed to create forwarder\n");
}
} else {
InstallForwarder(); InstallForwarder();
} }
} }
} ));
)); } else {
InstallForwarder();
}
})); }));
} }
@@ -860,6 +858,13 @@ void Menu::SetIndex(std::size_t index) {
} }
void Menu::InstallForwarder() { void Menu::InstallForwarder() {
if (GetEntry().GetExtension() == "nro") {
if (R_FAILED(homebrew::Menu::InstallHomebrewFromPath(GetNewPathCurrent()))) {
log_write("failed to create forwarder\n");
}
return;
}
const auto assoc_list = FindFileAssocFor(); const auto assoc_list = FindFileAssocFor();
if (assoc_list.empty()) { if (assoc_list.empty()) {
log_write("failed to find assoc for: %s ext: %s\n", GetEntry().name, GetEntry().extension.c_str()); log_write("failed to find assoc for: %s ext: %s\n", GetEntry().name, GetEntry().extension.c_str());

View File

@@ -127,14 +127,18 @@ Menu::Menu() : MenuBase{"Homebrew"_i18n} {
}, true)); }, true));
options->Add(std::make_shared<SidebarEntryCallback>("Install Forwarder"_i18n, [this](){ 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 {
InstallHomebrew();
}
}, true)); }, true));
} }
}}) }})