ASAPCabinetFE
 
Loading...
Searching...
No Matches
config_ui.h
Go to the documentation of this file.
1
10#ifndef CONFIG_UI_H
11#define CONFIG_UI_H
12
16#include "tables/table_data.h"
17#include "core/iapp_callbacks.h"
18#include "isection_renderer.h"
19#include "section_config.h"
20#include "ImGuiFileDialog.h"
21#include <string>
22#include <vector>
23#include <nlohmann/json.hpp>
24#include <memory>
25#include <unordered_map>
26
35class ConfigUI {
36public:
51 ConfigUI(IConfigService* configService, IKeybindProvider* keybindProvider,
52 IAssetManager* assets, size_t* currentIndex, std::vector<TableData>* tables,
53 IAppCallbacks* appCallbacks, bool& showConfig, bool standaloneMode = false);
54
60 void drawGUI();
61
69 void handleEvent(const SDL_Event& event);
70
76 void saveConfig();
77
83 bool shouldClose() const { return !showConfig_; }
84
90 bool isStandalone() const { return standaloneMode_; }
91
99 void resetSectionToDefault(const std::string& sectionName);
100
101 void refreshUIState();
102
103private:
104 IConfigService* configService_;
105 IKeybindProvider* keybindProvider_;
106 IAssetManager* assets_;
107 IAppCallbacks* appCallbacks_;
108 bool& showConfig_;
109 bool standaloneMode_;
110 nlohmann::json jsonData_;
111 nlohmann::json originalJsonData_;
112 SectionConfig sectionConfig_;
113 std::unordered_map<std::string, std::unique_ptr<ISectionRenderer>> renderers_;
114 std::unordered_map<std::string, bool> sectionCollapseStates_;
115
116 bool isCapturingKey_ = false;
117 std::string capturingKeyName_;
118
119 bool isDialogOpen_ = false;
120 std::string dialogKey_ = "";
121
122 ImGuiFileDialog standaloneFileDialog_;
123 ImGuiFileDialog normalFileDialog_;
124
130 void initializeRenderers();
131
140 void updateKeybind(const std::string& action, const std::string& bind);
141};
142
143#endif // CONFIG_UI_H
Manages the ImGui-based configuration UI.
Definition config_ui.h:35
void saveConfig()
Saves the current configuration.
Definition config_ui.cpp:297
void handleEvent(const SDL_Event &event)
Handles an SDL event for keybinding capture.
Definition config_ui.cpp:237
void drawGUI()
Draws the configuration UI.
Definition config_ui.cpp:59
void resetSectionToDefault(const std::string &sectionName)
Resets a section to its default values.
Definition config_ui.cpp:406
bool shouldClose() const
Checks if the UI should close.
Definition config_ui.h:83
bool isStandalone() const
Checks if the UI is in standalone mode.
Definition config_ui.h:90
Interface for handling various application callbacks.
Definition iapp_callbacks.h:22
The IAssetManager interface provides methods to manage and access various assets used in the applicat...
Definition iasset_manager.h:36
Interface for configuration services (forward declaration).
Definition iconfig_service.h:30
Interface for keybind providers (forward declaration).
Definition ikeybind_provider.h:30
Manages section and key order for configuration UI rendering.
Definition section_config.h:12
Defines the IAssetManager interface for managing assets in ASAPCabinetFE.
Defines the IConfigService interface for managing configuration in ASAPCabinetFE.
Defines the IKeybindProvider interface for managing input bindings in ASAPCabinetFE.
Defines the ISectionRenderer interface and BaseSectionRenderer for rendering configuration sections i...
Defines the TableData struct for storing VPX table metadata and media paths.