1
0
mirror of synced 2024-11-24 15:50:16 +01:00

settings: Add option for auto-loading patterns

This commit is contained in:
WerWolv 2021-09-30 12:00:11 +02:00
parent a9e3db0464
commit 194bc3e5be
6 changed files with 18 additions and 0 deletions

View File

@ -25,6 +25,17 @@ namespace hex::plugin::builtin {
return false;
});
ContentRegistry::Settings::add("hex.builtin.setting.general", "hex.builtin.setting.general.auto_load_patterns", 1, [](auto name, nlohmann::json &setting) {
static bool enabled = static_cast<int>(setting);
if (ImGui::Checkbox(name.data(), &enabled)) {
setting = static_cast<int>(enabled);
return true;
}
return false;
});
/* Interface */
ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.color", 0, [](auto name, nlohmann::json &setting) {

View File

@ -627,6 +627,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.imhex.recent_files", "Kürzlich geöffnete Dateien" },
{ "hex.builtin.setting.general", "Allgemein" },
{ "hex.builtin.setting.general.show_tips", "Tipps beim start anzeigen" },
{ "hex.builtin.setting.general.auto_load_patterns", "Unterstützte Pattern automatisch laden" },
{ "hex.builtin.setting.interface", "Aussehen" },
{ "hex.builtin.setting.interface.color", "Farbthema" },
{ "hex.builtin.setting.interface.color.system", "System" },

View File

@ -628,6 +628,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.imhex.recent_files", "Recent Files" },
{ "hex.builtin.setting.general", "General" },
{ "hex.builtin.setting.general.show_tips", "Show tips on startup" },
{ "hex.builtin.setting.general.auto_load_patterns", "Auto-load supported pattern" },
{ "hex.builtin.setting.interface", "Interface" },
{ "hex.builtin.setting.interface.color", "Color theme" },
{ "hex.builtin.setting.interface.color.system", "System" },

View File

@ -626,6 +626,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.imhex.recent_files", "File recenti" },
{ "hex.builtin.setting.general", "Generali" },
{ "hex.builtin.setting.general.show_tips", "Mostra consigli all'avvio" },
//{ "hex.builtin.setting.general.auto_load_patterns", "Auto-load supported pattern" },
{ "hex.builtin.setting.interface", "Interfaccia" },
{ "hex.builtin.setting.interface.color", "Colore del Tema" },
{ "hex.builtin.setting.interface.color.system", "Sistema" },

View File

@ -628,6 +628,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.setting.imhex.recent_files", "最近文件" },
{ "hex.builtin.setting.general", "通用" },
{ "hex.builtin.setting.general.show_tips", "在启动时显示每日提示" },
//{ "hex.builtin.setting.general.auto_load_patterns", "Auto-load supported pattern" },
{ "hex.builtin.setting.interface", "界面" },
{ "hex.builtin.setting.interface.color", "颜色主题" },
{ "hex.builtin.setting.interface.color.system", "跟随系统" },

View File

@ -104,6 +104,9 @@ namespace hex {
});
EventManager::subscribe<EventFileLoaded>(this, [this](const std::string &path) {
if (!ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.auto_load_patterns", 1))
return;
pl::Preprocessor preprocessor;
if (!ImHexApi::Provider::isValid())