Don't construct IDs

This commit is contained in:
blankie 2023-02-04 22:26:47 +07:00
parent e852ead133
commit b545fbffd5
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 6 additions and 8 deletions

View File

@ -24,11 +24,10 @@ static void render_filter(Filter* filter, std::string* title, bool* request_remo
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
ImGui::Text("Title:%s%s", title->empty() ? "" : " ", title->c_str()); ImGui::Text("Title:%s%s", title->empty() ? "" : " ", title->c_str());
ImGui::SameLine(); ImGui::SameLine();
std::string change_title_id = std::string("changefiltertitle_") + std::to_string(reinterpret_cast<size_t>(filter));
if (ImGui::Button("Edit")) { if (ImGui::Button("Edit")) {
ImGui::OpenPopup(change_title_id.c_str()); ImGui::OpenPopup("change_filter_title");
} }
if (ImGui::BeginPopup(change_title_id.c_str())) { if (ImGui::BeginPopup("change_filter_title")) {
ImGui::InputText("##title", title); ImGui::InputText("##title", title);
ImGui::EndPopup(); ImGui::EndPopup();
} }
@ -168,11 +167,10 @@ static inline void render_group_filter(GroupFilter* filter) {
} }
} }
std::string add_filter_id = std::string("addfilter_") + std::to_string(reinterpret_cast<size_t>(filter));
if (ImGui::Button("+ add filter")) { if (ImGui::Button("+ add filter")) {
ImGui::OpenPopup(add_filter_id.c_str()); ImGui::OpenPopup("add_filter");
} }
if (ImGui::BeginPopup(add_filter_id.c_str())) { if (ImGui::BeginPopup("add_filter")) {
std::unique_ptr<Filter> added_filter = render_add_filter_popup(); std::unique_ptr<Filter> added_filter = render_add_filter_popup();
if (added_filter) { if (added_filter) {
filter->filters.push_back(std::move(added_filter)); filter->filters.push_back(std::move(added_filter));
@ -238,9 +236,9 @@ void filters_fragment(Config& active_config, Filters& active_filters, Filters& i
} }
if (ImGui::Button("+ add filter")) { if (ImGui::Button("+ add filter")) {
ImGui::OpenPopup("addfilter_root"); ImGui::OpenPopup("add_filter");
} }
if (ImGui::BeginPopup("addfilter_root")) { if (ImGui::BeginPopup("add_filter")) {
std::unique_ptr<Filter> added_filter = render_add_filter_popup(); std::unique_ptr<Filter> added_filter = render_add_filter_popup();
if (added_filter) { if (added_filter) {
inactive_filters.push_back(std::make_pair("", std::move(added_filter))); inactive_filters.push_back(std::make_pair("", std::move(added_filter)));