• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_helper.h"
21 
22 #include "i_preference_manager.h"
23 
24 namespace OHOS {
25 namespace MMI {
26 class MultiModalInputPreferencesManager : public IPreferenceManager {
27 public:
28     MultiModalInputPreferencesManager() = default;
29     ~MultiModalInputPreferencesManager() = default;
30     DISALLOW_COPY_AND_MOVE(MultiModalInputPreferencesManager);
31 
32     int32_t InitPreferences();
33     int32_t GetPreferencesSettings();
34     int32_t InitPreferencesMap();
35     int32_t GetIntValue(const std::string &key, int32_t defaultValue);
36     bool GetBoolValue(const std::string &key, bool defaultValue);
37     int32_t SetIntValue(const std::string &key, const std::string &setFile, int32_t setValue);
38     int32_t SetBoolValue(const std::string &key, const std::string &setFile, bool setValue);
39     int32_t GetShortKeyDuration(const std::string &key);
40     int32_t SetShortKeyDuration(const std::string &key, int32_t setValue);
41 
42 private:
43     std::map<std::string, std::pair<std::string, int32_t>> preferencesMap_;
44     std::map<std::string, int32_t> shortcutKeyMap_;
45     int32_t keyboardRepeatRate_ { 50 };
46     int32_t keyboardRepeatDelay_ { 500 };
47     int32_t mouseScrollRows_ { 3 };
48     int32_t mousePrimaryButton_ { 0 };
49     int32_t pointerSpeed_ { 10 };
50     int32_t touchpadRightClickType_ { 1 };
51     int32_t touchpadPointerSpeed_ { 9 };
52     bool touchpadTapSwitch_ { true };
53     bool touchpadDoubleTapAndDrag_ { false };
54     bool touchpadScrollDirection_ { true };
55     bool touchpadScrollSwitch_ { true };
56     bool touchpadPinchSwitch_ { true };
57     bool touchpadSwipeSwitch_ { true };
58     bool hoverScrollState_ { true };
59 #ifdef OHOS_BUILD_ENABLE_MOVE_EVENT_FILTERS
60     bool moveEventFilterFlag_ { false };
61 #endif // OHOS_BUILD_ENABLE_MOVE_EVENT_FILTERS
62     bool touchpadThreeFingerTapSwitch_ {false};
63     int32_t pointerColor_ { -1 };
64     int32_t pointerSize_ { 1 };
65     int32_t pointerStyle_ { 0 };
66     int32_t touchpadScrollRows_ { 3 };
67     const std::string strKeyboardRepeatRate_ = "keyboardRepeatRate";
68     const std::string strKeyboardRepeatDelay_ = "keyboardRepeatDelay";
69     const std::string strMouseScrollRows_ = "rows";
70     const std::string strMousePrimaryButton_ = "primaryButton";
71     const std::string strPointerSpeed_ = "speed";
72     const std::string strTouchpadRightClickType_ = "rightMenuSwitch";
73     const std::string strTouchpadPointerSpeed_ = "touchPadPointerSpeed";
74     const std::string strTouchpadTapSwitch_ = "touchpadTap";
75     const std::string strTouchpadScrollDirection_ = "scrollDirection";
76     const std::string strTouchpadScrollSwitch_ = "scrollSwitch";
77     const std::string strTouchpadPinchSwitch_ = "touchpadPinch";
78     const std::string strTouchpadSwipeSwitch_ = "touchpadSwipe";
79     const std::string strHoverScrollState_ = "isEnableHoverScroll";
80 #ifdef OHOS_BUILD_ENABLE_MOVE_EVENT_FILTERS
81     const std::string strMoveEventFilterFlag_ = "moveEventFilterFlag";
82 #endif // OHOS_BUILD_ENABLE_MOVE_EVENT_FILTERS
83     const std::string strPointerColor_ = "pointerColor";
84     const std::string strPointerSize_ = "pointerSize";
85     const std::string strPointerStyle_ = "pointerStyle";
86     const std::string strTouchpadThreeFingerTapSwitch_ = "touchpadThreeFingerTap";
87     const std::string strTouchpadScrollRows_ = "touchpadScrollRows";
88     const std::string strTouchpadDoubleTapAndDrag_ = "touchpadDoubleTapAndDrag";
89 #ifdef OHOS_BUILD_ENABLE_MAGICCURSOR
90     int32_t magicPointerColor_ { -1 };
91     int32_t magicPointerSize_ { 1 };
92     const std::string strMagicPointerColor_ = "magicPointerColor";
93     const std::string strMagicPointerSize_ = "magicPointerSize";
94 #endif // OHOS_BUILD_ENABLE_MAGICCURSOR
95 };
96 } // namespace MMI
97 } // namespace OHOS
98 #endif // MULTIMODAL_INPUT_PREFERENCES_MANAGER_H