diff options
author | Antti Hölttä <AHoelttae@luxoft.com> | 2018-11-13 15:40:13 +0100 |
---|---|---|
committer | Antti Hölttä <AHoelttae@luxoft.com> | 2019-03-18 16:33:53 +0100 |
commit | c9a97de34ca56d4cab671beeeb6d27a66ac3da4e (patch) | |
tree | 652a2fc55284fa22506795eccb2e043aa18446b5 /plugin/cursornavigation.h | |
parent | 67dd94b0daecc445bbd3af7b5956ddcbdbdb5f39 (diff) |
Add 360 algorithm
Add algorithm that allows navigation to any direction. Works somewhat
well now. Example app has a page with a gamepad/stick support.
Diffstat (limited to 'plugin/cursornavigation.h')
-rw-r--r-- | plugin/cursornavigation.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/plugin/cursornavigation.h b/plugin/cursornavigation.h index 96c5e67..956d900 100644 --- a/plugin/cursornavigation.h +++ b/plugin/cursornavigation.h @@ -4,13 +4,14 @@ #include "cursornavigationattached.h" #include "inputtypes.h" #include "inputadapter.h" +#include "spatialnavigation360.h" +#include "spatialnavigation4dir.h" #include <QObject> #include <qqml.h> #include <QStack> class QQuickItem; -class CursorNavigationAlgorithm; class CursorNavigation : public QObject { @@ -19,7 +20,10 @@ class CursorNavigation : public QObject public: CursorNavigation(QQuickWindow *parent); - bool inputCommand(const CursorNavigationCommand &cmd); + //bool inputCommand(const CursorNavigationCommand &cmd); + void move(qreal angle, qreal tolerance, bool discrete); + void move(const QVector2D& vector, qreal tolerance, bool discrete); + void action(Action action); static CursorNavigationAttached *qmlAttachedProperties(QObject *object); @@ -33,15 +37,16 @@ private: void registerItem(CursorNavigationAttached* item); void unregisterItem(CursorNavigationAttached* item); - bool handleDirectionCommand(const CursorNavigationCommand &cmd); - bool handleActionCommand(const CursorNavigationCommand &cmd); + bool handleMove(const CursorNavigationCommand &cmd, bool discrete); private: static const char windowPropertyName[]; QQuickWindow *m_window; InputAdapter m_inputAdapter; CursorNavigationAttached *m_currentItem; //item that currently has the cursor - QList<CursorNavigationAlgorithm*> m_algorithms; + //QList<CursorNavigationAlgorithm*> m_algorithms; + SpatialNavigation360 m_navigation360; + SpatialNavigation4Dir m_navigation4Dir; //a root item that is not tied to any actual QQuickItem CursorNavigationAttached *m_rootItem; //QStack<CursorNavigationAttached*> m_scopeStack; |