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 "nocopyable.h" 20 #include "preferences.h" 21 #include "preferences_errno.h" 22 #include "preferences_helper.h" 23 24 #include "i_preference_manager.h" 25 26 namespace OHOS { 27 namespace MMI { 28 class MultiModalInputPreferencesManager : public IPreferenceManager { 29 public: 30 MultiModalInputPreferencesManager() = default; 31 ~MultiModalInputPreferencesManager() = default; 32 DISALLOW_COPY_AND_MOVE(MultiModalInputPreferencesManager); 33 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> shortcutKeyMap_; 47 int32_t keyboardRepeatRate_ { 50 }; 48 int32_t keyboardRepeatDelay_ { 500 }; 49 int32_t mouseScrollRows_ { 3 }; 50 int32_t mousePrimaryButton_ { 0 }; 51 int32_t pointerSpeed_ { 7 }; 52 int32_t touchpadRightClickType_ { 1 }; 53 int32_t touchpadPointerSpeed_ { 9 }; 54 bool touchpadTapSwitch_ { true }; 55 bool touchpadDoubleTapAndDrag_ { false }; 56 bool touchpadScrollDirection_ { true }; 57 bool touchpadScrollSwitch_ { true }; 58 bool touchpadPinchSwitch_ { true }; 59 bool touchpadSwipeSwitch_ { true }; 60 bool hoverScrollState_ { true }; 61 int32_t pointerColor_ { -1 }; 62 int32_t pointerSize_ { 1 }; 63 int32_t pointerStyle_ { 0 }; 64 const std::string strKeyboardRepeatRate_ = "keyboardRepeatRate"; 65 const std::string strKeyboardRepeatDelay_ = "keyboardRepeatDelay"; 66 const std::string strMouseScrollRows_ = "rows"; 67 const std::string strMousePrimaryButton_ = "primaryButton"; 68 const std::string strPointerSpeed_ = "speed"; 69 const std::string strTouchpadRightClickType_ = "rightMenuSwitch"; 70 const std::string strTouchpadPointerSpeed_ = "touchPadPointerSpeed"; 71 const std::string strTouchpadTapSwitch_ = "touchpadTap"; 72 const std::string strTouchpadScrollDirection_ = "scrollDirection"; 73 const std::string strTouchpadScrollSwitch_ = "scrollSwitch"; 74 const std::string strTouchpadPinchSwitch_ = "touchpadPinch"; 75 const std::string strTouchpadSwipeSwitch_ = "touchpadSwipe"; 76 const std::string strHoverScrollState_ = "isEnableHoverScroll"; 77 const std::string strPointerColor_ = "pointerColor"; 78 const std::string strPointerSize_ = "pointerSize"; 79 const std::string strPointerStyle_ = "pointerStyle"; 80 const std::string strTouchpadDoubleTapAndDrag_ = "touchpadDoubleTapAndDrag"; 81 #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR 82 int32_t magicPointerColor_ { -1 }; 83 int32_t magicPointerSize_ { 1 }; 84 const std::string strMagicPointerColor_ = "magicPointerColor"; 85 const std::string strMagicPointerSize_ = "magicPointerSize"; 86 #endif // OHOS_BUILD_ENABLE_MAGICCURSOR 87 }; 88 } // namespace MMI 89 } // namespace OHOS 90 #endif // MULTIMODAL_INPUT_PREFERENCES_MANAGER_H 91