1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef MULTIMODAL_INPUT_PREFERENCES_MANAGER_H 17 #define MULTIMODAL_INPUT_PREFERENCES_MANAGER_H 18 19 #include "preferences.h" 20 #include "preferences_impl.h" 21 #include "preferences_errno.h" 22 #include "preferences_helper.h" 23 #include "preferences_xml_utils.h" 24 25 #include "singleton.h" 26 27 namespace OHOS { 28 namespace MMI { 29 class MultiModalInputPreferencesManager { 30 DECLARE_DELAYED_SINGLETON(MultiModalInputPreferencesManager); 31 32 public: 33 DISALLOW_COPY_AND_MOVE(MultiModalInputPreferencesManager); 34 int32_t InitPreferences(); 35 int32_t GetPreferencesSettings(); 36 int32_t InitPreferencesMap(); 37 int32_t GetIntValue(const std::string &key, int32_t defaultValue); 38 bool GetBoolValue(const std::string &key, bool defaultValue); 39 int32_t SetIntValue(const std::string &key, const std::string &setFile, int32_t setValue); 40 int32_t SetBoolValue(const std::string &key, const std::string &setFile, bool setValue); 41 int32_t GetShortKeyDuration(const std::string &key); 42 int32_t SetShortKeyDuration(const std::string &key, int32_t setValue); 43 44 private: 45 std::map<std::string, std::pair<std::string, int32_t>> preferencesMap; 46 std::map<std::string, int32_t> g_shortcutKeyMap; 47 int32_t g_keyboardRepeatRate { 50 }; 48 int32_t g_keyboardRepeatDelay { 500 }; 49 int32_t g_mouseScrollRows { 3 }; 50 int32_t g_mousePrimaryButton { 0 }; 51 int32_t g_pointerSpeed { 5 }; 52 int32_t g_touchpadRightClickType { 1 }; 53 int32_t g_touchpadPointerSpeed { 9 }; 54 bool g_touchpadTapSwitch { true }; 55 bool g_touchpadScrollDirection { true }; 56 bool g_touchpadScrollSwitch { true }; 57 bool g_touchpadPinchSwitch { true }; 58 bool g_touchpadSwipeSwitch { true }; 59 bool g_hoverScrollState { true }; 60 int32_t g_pointerColor { -1 }; 61 int32_t g_pointerSize { 1 }; 62 int32_t g_pointerStyle { 0 }; 63 const std::string keyboardRepeatRate = "keyboardRepeatRate"; 64 const std::string keyboardRepeatDelay = "keyboardRepeatDelay"; 65 const std::string mouseScrollRows = "rows"; 66 const std::string mousePrimaryButton = "primaryButton"; 67 const std::string pointerSpeed = "speed"; 68 const std::string touchpadRightClickType = "rightMenuSwitch"; 69 const std::string touchpadPointerSpeed = "touchPadPointerSpeed"; 70 const std::string touchpadTapSwitch = "touchpadTap"; 71 const std::string touchpadScrollDirection = "scrollDirection"; 72 const std::string touchpadScrollSwitch = "scrollSwitch"; 73 const std::string touchpadPinchSwitch = "touchpadPinch"; 74 const std::string touchpadSwipeSwitch = "touchpadSwipe"; 75 const std::string hoverScrollState = "isEnableHoverScroll"; 76 const std::string pointerColor = "pointerColor"; 77 const std::string pointerSize = "pointerSize"; 78 const std::string pointerStyle = "pointerStyle"; 79 }; 80 81 #define PreferencesMgr ::OHOS::DelayedSingleton<MultiModalInputPreferencesManager>::GetInstance() 82 } // namespace MMI 83 } // namespace OHOS 84 #endif // MULTIMODAL_INPUT_PREFERENCES_MANAGER_H