36 hotkeyData(uint32_t key,
const std::function<
void()>& hotkeyEvent,
const std::vector<hotkeys::additionalKeys>& additionalKeys);
38 hotkeyData(uint32_t key,
const std::string& functionName,
const std::string& moduleName,
const std::vector<hotkeys::additionalKeys>& additionalKeys);
55 json::JSONParser jsonSettings;
56 std::unique_ptr<threading::ThreadPool> threadPool;
57 INITCOMMONCONTROLSEX comm;
58 std::unordered_map<std::
string, HMODULE, localization::utility::StringViewHash, localization::utility::StringViewEqual> modules;
59 std::unordered_map<std::
string, std::
string> modulesPaths;
60 std::unordered_map<
size_t,
smartPointerType<utility::BaseComponentCreator>> creators;
61 std::unordered_map<
size_t,
smartPointerType<interfaces::IDeserializer>> deserializers;
64 std::unordered_multimap<std::wstring, uint32_t> generatedIds;
65 std::queue<uint32_t> availableIds;
68 std::atomic<uint32_t> nextTrayId;
71 std::unordered_map<size_t, std::function<void()>> hotkeys;
72 std::vector<std::set<uint32_t>> allHotkeys;
73 std::unordered_map<size_t, hotkeyData> serializableHotkeysData;
74 std::mutex hotkeyIdMutex;
76#pragma region ComponentsFinding
77 std::vector<BaseComponent*> components;
78 std::recursive_mutex componentsMutex;
81 std::vector<std::unique_ptr<threading::Future>> asyncModulesHandles;
82 std::mutex loadModulesMutex;
83 std::vector<std::string> cantLoadedModules;
85#pragma region RunOnUIThread
86 std::recursive_mutex runOnUIThreadMutex;
87 std::queue<std::function<void()>> runOnUIFunctions;
93 void initDeserializers();
100 uint32_t generateId(std::wstring_view windowName);
102 uint32_t generateTrayId();
104 void removeIds(
const std::wstring& windowName);
106 void removeId(
const std::wstring& windowName, uint32_t
id);
108 std::vector<uint32_t> getIds(
const std::wstring& windowName);
110 void processHotkeys()
const;
112 void initUIThreadId();
114 void loadModule(
const std::string& modulePath,
const std::string& moduleName);
116 void loadModulesFromSettings(
const json::utility::jsonObject& settingsObject);
141 static void restartApplication(
int exitCode = 0);
145 static DWORD getUIThreadId();
151 static std::string getGUIFrameworkVersion();
158 std::unique_ptr<threading::Future>
addTask(
const std::function<
void()>& task,
const std::function<
void()>& callback =
nullptr);
164 std::unique_ptr<threading::Future>
addTask(
const std::function<
void()>& task, std::function<
void()>&& callback);
170 std::unique_ptr<threading::Future>
addTask(std::function<
void()>&& task,
const std::function<
void()>& callback =
nullptr);
176 std::unique_ptr<threading::Future>
addTask(std::function<
void()>&& task, std::function<
void()>&& callback);
193 size_t registerHotkey(
hotkeys::keys key,
const std::string& functionName,
const std::string& moduleName,
const std::vector<hotkeys::additionalKeys>& additionalKeys = {});
198 bool unregisterHotkey(
size_t hotkeyId);
204 bool unregisterHotkey(uint32_t key,
const std::vector<hotkeys::additionalKeys>& additionalKeys = {});
208 std::vector<hotkeyData> getRegisteredHotkeys();
215 void loadModule(
const std::string& moduleName,
const std::filesystem::path& pathToModule);
219 void unloadModule(
const std::string& moduleName);
228 std::vector<json::utility::jsonObject> serializeHotkeys();
232 void deserializeHotkeys(
const json::utility::jsonObject& description);
236 bool isModulesLoaded()
const;
240 void changeLocalization(
const std::string& language)
const;
244 const std::unordered_map<size_t, smartPointerType<utility::BaseComponentCreator>>& getCreators()
const;
248 const std::unordered_map<size_t, smartPointerType<interfaces::IDeserializer>>& getDeserializers()
const;
252 const json::JSONParser& getJSONSettings()
const;
256 const std::unordered_map<std::string, HMODULE, localization::utility::StringViewHash, localization::utility::StringViewEqual>& getModules()
const;
260 const std::unordered_map<std::string, std::string>& getModulesPaths()
const;
264 std::vector<std::string> getCantLoadedModules();
272 HMODULE operator [](
const std::string& moduleName)
const;
277 template<
typename T = BaseComponent>
278 T* findComponent(HWND handle);
283 template<
typename T = BaseComponent>
284 T* findComponent(
const std::wstring& componentName);
287 template<std::derived_from<BaseComponent> T, std::derived_from<utility::BaseComponentCreator> CreatorT,
typename... Args>
288 void addCreator(Args&&... args);
291 template<std::derived_from<BaseComponent> T, std::derived_from<
interfaces::IDeserializer> DeserializerT,
typename... Args>
292 void addDeserializer(Args&&... args);
293#pragma region FriendClasses