File indexing completed on 2022-11-29 15:04:22

0001 /*
0002     SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef VIEWPARABOLIC_H
0007 #define VIEWPARABOLIC_H
0008 
0009 // Qt
0010 #include <QEvent>
0011 #include <QObject>
0012 #include <QQuickItem>
0013 #include <QPointer>
0014 #include <QPointF>
0015 #include <QTimer>
0016 
0017 namespace Latte {
0018 class View;
0019 }
0020 
0021 namespace Latte {
0022 namespace ViewPart {
0023 
0024 class Parabolic: public QObject
0025 {
0026     Q_OBJECT
0027 
0028     Q_PROPERTY(QQuickItem *currentItem READ currentParabolicItem WRITE setCurrentParabolicItem NOTIFY currentParabolicItemChanged)
0029 
0030 public:
0031     Parabolic(Latte::View *parent);
0032     virtual ~Parabolic();
0033 
0034     QQuickItem *currentParabolicItem() const;
0035     void setCurrentParabolicItem(QQuickItem *item);
0036 
0037 signals:
0038     void currentParabolicItemChanged();
0039 
0040 private slots:
0041     void onCurrentParabolicItemChanged();
0042     void onEvent(QEvent *e);
0043 
0044 private:
0045     QPointer<Latte::View> m_view;
0046     QPointer<QQuickItem> m_currentParabolicItem;
0047 
0048     QPointF m_lastOrphanParabolicMove;
0049 
0050     QTimer m_parabolicItemNullifier;
0051 };
0052 
0053 }
0054 }
0055 
0056 #endif