File indexing completed on 2024-05-12 04:19:52
0001 /* 0002 Gwenview: an image viewer 0003 Copyright 2019 Steffen Hartleib <steffenhartleib@t-online.de> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public License 0007 as published by the Free Software Foundation; either version 2 0008 of the License, or (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more detai 0014 ls. 0015 0016 You should have received a copy of the GNU General Public License 0017 along with this program; if not, write to the Free Software 0018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA. 0019 0020 */ 0021 #ifndef TOUCH_HELPER_H 0022 #define TOUCH_HELPER_H 0023 0024 // Qt 0025 0026 // KF 0027 0028 // Local 0029 #include <lib/gwenviewlib_export.h> 0030 0031 class QPoint; 0032 class QEvent; 0033 0034 namespace Gwenview 0035 { 0036 namespace Touch_Helper 0037 { 0038 // constant variables that define touch behavior 0039 struct Touch { 0040 // a little delay in the begin of the gesture, to get more data of the touch points moving so the recognizing 0041 // of the pan gesture is better 0042 static const int gestureDelay = 110; 0043 // this defines how much a touch point can move, for a single tap gesture 0044 static const int wiggleRoomForTap = 10; 0045 // how long must a touch point be stationary, before he can move for a TabHoldAndMoving gesture 0046 static const int durationForTapHold = 400; 0047 // in what time and how far must the touch point moving to trigger a swipe gesture 0048 static const int maxTimeFrameForSwipe = 100; 0049 static const int minDistanceForSwipe = 70; 0050 // How long is the duration for a simple tap gesture 0051 static const int maxTimeForTap = 100; 0052 // max interval for a double tap gesture 0053 static const int doubleTapInterval = 400; 0054 }; 0055 0056 GWENVIEWLIB_EXPORT QPoint simpleTapPosition(QEvent *); 0057 GWENVIEWLIB_EXPORT QPoint simpleTouchPosition(QEvent *, int = 0); 0058 GWENVIEWLIB_EXPORT bool touchStationary(QEvent *); 0059 0060 } // namespace 0061 } // namespace 0062 0063 #endif /* TOUCH_HELPER_H */