2021-09-24 14:47:56 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QskControl.h>
|
|
|
|
#include <QskPanGestureRecognizer.h>
|
2022-08-02 09:36:22 +02:00
|
|
|
#include <QskStackBox.h>
|
2021-09-24 14:47:56 +02:00
|
|
|
|
|
|
|
#include <QQuickWindow>
|
|
|
|
|
2022-12-22 18:15:04 +01:00
|
|
|
class MenuBar;
|
2021-09-24 14:47:56 +02:00
|
|
|
class QskBox;
|
|
|
|
class QskLinearBox;
|
2022-08-02 09:36:22 +02:00
|
|
|
|
|
|
|
class Cube : public QskStackBox
|
|
|
|
{
|
2022-12-22 18:15:04 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2022-08-02 09:36:22 +02:00
|
|
|
public:
|
2023-01-02 11:46:23 +01:00
|
|
|
enum Position {
|
2022-12-22 18:15:04 +01:00
|
|
|
Left,
|
|
|
|
Right,
|
|
|
|
Top,
|
2023-01-02 11:46:23 +01:00
|
|
|
Bottom,
|
|
|
|
Front,
|
|
|
|
Back,
|
|
|
|
NumPositions
|
|
|
|
};
|
2022-12-22 18:15:04 +01:00
|
|
|
|
2022-08-02 09:36:22 +02:00
|
|
|
explicit Cube( QQuickItem* parent = nullptr );
|
2023-01-02 11:46:23 +01:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void switchPosition( const Qsk::Direction direction );
|
|
|
|
void switchToPosition( const Cube::Position position );
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
// might be different from indexChanged:
|
|
|
|
void cubeIndexChanged( const int index );
|
|
|
|
|
|
|
|
private:
|
|
|
|
Qsk::Direction direction( const Position from, const Position to );
|
|
|
|
void startAnimation( Qsk::Direction direction, int position );
|
|
|
|
|
|
|
|
Cube::Position m_currentPosition;
|
|
|
|
|
|
|
|
static Position s_neighbors[ NumPositions ][ 4 ];
|
2022-08-02 09:36:22 +02:00
|
|
|
};
|
2021-09-24 14:47:56 +02:00
|
|
|
|
|
|
|
class MainItem : public QskControl
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MainItem( QQuickItem* parent = nullptr );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool gestureFilter( QQuickItem*, QEvent* ) override final;
|
|
|
|
void gestureEvent( QskGestureEvent* ) override final;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QskLinearBox* m_mainLayout;
|
2023-01-02 10:22:23 +01:00
|
|
|
MenuBar* m_menuBar;
|
|
|
|
Cube* m_cube;
|
2021-09-24 14:47:56 +02:00
|
|
|
QskPanGestureRecognizer m_panRecognizer;
|
|
|
|
};
|