[Kbm] Save the remaps to file[part-1] (#2184)

* Added Inital FileWatcher Implementation

* Added logic to read remap from file

* Added remap logic save to file

* Refactor code

* Moved the strings to constant file

* Added logic to handle Win key

* Updated filewatcher logic to avoid duplicate events

* Added comments

* Fix spacing

* Fix spacing

* Update logic to accomodate upstream merge

* Added global property name for os level shortcuts

* Added subkey for inprocess keys

* Remove non required file

* Added Changes required after merge

* Fix spacing in Helper.cpp
This commit is contained in:
udit3333
2020-04-20 08:22:36 -07:00
committed by GitHub
parent cae77ae291
commit 325db535c0
29 changed files with 647 additions and 152 deletions

View File

@@ -4,9 +4,11 @@
#include "Shortcut.h"
#include "RemapShortcut.h"
#include "KeyDelay.h"
#include "KeyboardManagerConstants.h"
#include <interface/lowlevel_keyboard_event_data.h>
#include <mutex>
#include <winrt/Windows.UI.Xaml.Controls.h>
#include <../common/settings_helpers.h>
using namespace winrt::Windows::UI::Xaml::Controls;
// Enum type to store different states of the UI
@@ -51,6 +53,13 @@ private:
// Stores the UI element which is to be updated based on the shortcut entered
StackPanel currentShortcutUI;
std::mutex currentShortcutUI_mutex;
// Stores the current configuration name.
std::wstring currentConfig = KeyboardManagerConstants::DefaultConfiguration;
std::mutex currentConfig_mutex;
// Handle of named mutex used for configuration file.
HANDLE configFile_mutex;
// Registered KeyDelay objects, used to notify delayed key events.
std::map<DWORD, std::unique_ptr<KeyDelay>> keyDelays;
@@ -84,6 +93,9 @@ public:
// Constructor
KeyboardManagerState();
// Destructor
~KeyboardManagerState();
// Function to reset the UI state members
void ResetUIState();
@@ -157,4 +169,13 @@ public:
// Reset the shortcut (backend) state after releasing a key.
void ResetDetectedShortcutKey(DWORD key);
// Save the updated configuration.
bool SaveConfigToFile();
// Sets the Current Active Configuartion Name.
void SetCurrentConfigName(const std::wstring& configName);
// Gets the Current Active Configuartion Name.
std::wstring GetCurrentConfigName();
};