mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
feature: User now can add custom directories (#444)
* feat: user directories * ux: show setting categories in order they were created * feat: add descriptable setting categories
This commit is contained in:
@@ -30,13 +30,29 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.settings.name").c_str(), &this->getWindowOpenState(), ImGuiWindowFlags_NoResize)) {
|
||||
if (ImGui::BeginTabBar("settings")) {
|
||||
for (auto &[category, entries] : ContentRegistry::Settings::getEntries()) {
|
||||
auto &entries = ContentRegistry::Settings::getEntries();
|
||||
|
||||
std::vector<std::decay_t<decltype(entries)>::const_iterator> sortedCategories;
|
||||
|
||||
for (auto it = entries.cbegin(); it != entries.cend(); it++) {
|
||||
sortedCategories.emplace_back(std::move(it));
|
||||
}
|
||||
|
||||
std::sort(sortedCategories.begin(), sortedCategories.end(), [](auto &item0, auto &item1) {
|
||||
return item0->first.slot < item1->first.slot;
|
||||
});
|
||||
|
||||
const auto &descriptions = ContentRegistry::Settings::getCategoryDescriptions();
|
||||
|
||||
for (auto &it : sortedCategories) {
|
||||
auto &[category, entries] = *it;
|
||||
if (ImGui::BeginTabItem(LangEntry(category))) {
|
||||
ImGui::TextUnformatted(LangEntry(category));
|
||||
const std::string &categoryDesc = descriptions.count(category) ? descriptions.at(category) : category.name;
|
||||
ImGui::TextUnformatted(LangEntry(categoryDesc));
|
||||
ImGui::Separator();
|
||||
|
||||
for (auto &[name, callback] : entries) {
|
||||
if (callback(LangEntry(name), ContentRegistry::Settings::getSettingsData()[category][name]))
|
||||
if (callback(LangEntry(name), ContentRegistry::Settings::getSettingsData()[category.name][name]))
|
||||
EventManager::post<EventSettingsChanged>();
|
||||
}
|
||||
|
||||
@@ -51,4 +67,4 @@ namespace hex::plugin::builtin {
|
||||
this->getWindowOpenState() = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user