2022-01-17 11:50:24 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <guiddef.h>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
|
|
#include <FancyZonesLib/ModuleConstants.h>
|
|
|
|
|
|
|
|
|
|
#include <common/SettingsAPI/FileWatcher.h>
|
|
|
|
|
#include <common/SettingsAPI/settings_helpers.h>
|
|
|
|
|
|
|
|
|
|
namespace NonLocalizable
|
|
|
|
|
{
|
|
|
|
|
namespace LayoutHotkeysIds
|
|
|
|
|
{
|
|
|
|
|
const static wchar_t* LayoutHotkeysArrayID = L"layout-hotkeys";
|
|
|
|
|
const static wchar_t* LayoutUuidID = L"layout-id";
|
|
|
|
|
const static wchar_t* KeyID = L"key";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class LayoutHotkeys
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
using THotkeyMap = std::map<int, GUID>;
|
|
|
|
|
|
|
|
|
|
static LayoutHotkeys& instance();
|
|
|
|
|
|
|
|
|
|
inline static std::wstring LayoutHotkeysFileName()
|
|
|
|
|
{
|
|
|
|
|
std::wstring saveFolderPath = PTSettingsHelper::get_module_save_folder_location(NonLocalizable::ModuleKey);
|
|
|
|
|
#if defined(UNIT_TESTS)
|
|
|
|
|
return saveFolderPath + L"\\test-layout-hotkeys.json";
|
2022-12-12 17:21:48 +00:00
|
|
|
#else
|
2022-01-17 11:50:24 +03:00
|
|
|
return saveFolderPath + L"\\layout-hotkeys.json";
|
2022-12-12 17:21:48 +00:00
|
|
|
#endif
|
2022-01-17 11:50:24 +03:00
|
|
|
}
|
|
|
|
|
|
2022-12-12 17:21:48 +00:00
|
|
|
void LoadData();
|
|
|
|
|
|
2022-01-17 11:50:24 +03:00
|
|
|
std::optional<GUID> GetLayoutId(int key) const noexcept;
|
|
|
|
|
size_t GetHotkeysCount() const noexcept;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
LayoutHotkeys();
|
|
|
|
|
~LayoutHotkeys() = default;
|
|
|
|
|
|
|
|
|
|
THotkeyMap m_hotkeyMap;
|
|
|
|
|
std::unique_ptr<FileWatcher> m_fileWatcher;
|
|
|
|
|
};
|