|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef GLXCOVERFLOW_H |
|
21 #define GLXCOVERFLOW_H |
|
22 |
|
23 #define NBR_ICON_ITEM 5 |
|
24 |
|
25 #include <hbscrollarea.h> |
|
26 #include <hbeffect.h> |
|
27 |
|
28 //forward declaration |
|
29 class HbIconItem; |
|
30 class HbMainWindow; |
|
31 class QAbstractItemModel; |
|
32 |
|
33 typedef enum |
|
34 { |
|
35 NO_MOVE, |
|
36 TAP_MOVE, |
|
37 LEFT_MOVE, |
|
38 RIGHT_MOVE, |
|
39 LONGPRESS_MOVE, |
|
40 } GlxUserMove; |
|
41 |
|
42 typedef enum |
|
43 { |
|
44 TAP_EVENT, //send the signal when user tap on full screen |
|
45 PANNING_START_EVENT, //send the signal when panning of full screen start |
|
46 EMPTY_ROW_EVENT //send the signal when model have no data |
|
47 } GlxCoverFlowEvent; |
|
48 |
|
49 class GlxCoverFlow : public HbScrollArea |
|
50 { |
|
51 Q_OBJECT |
|
52 |
|
53 public : |
|
54 GlxCoverFlow (QGraphicsItem *parent = NULL); |
|
55 ~GlxCoverFlow (); |
|
56 void setItemSize (QSize &size); |
|
57 void setModel (QAbstractItemModel *model); |
|
58 void indexChanged (int index); |
|
59 void setUiOn(bool uiOn) { mUiOn = uiOn; } |
|
60 void partiallyClean(); |
|
61 void partiallyCreate(QAbstractItemModel *model, QSize itemSize); |
|
62 void rotateImage(); |
|
63 void setCoverFlow(); |
|
64 void ClearCoverFlow(); |
|
65 |
|
66 public slots: |
|
67 void rotationEffectFinished( const HbEffect::EffectStatus &status ); |
|
68 |
|
69 signals : |
|
70 void coverFlowEvent(GlxCoverFlowEvent e); |
|
71 void changeSelectedIndex(const QModelIndex &index); |
|
72 void autoLeftMoveSignal(); |
|
73 void autoRightMoveSignal(); |
|
74 |
|
75 protected slots: |
|
76 void panGesture ( const QPointF & delta ) ; |
|
77 void leftGesture (int value); |
|
78 void rightGesture (int value) ; |
|
79 void longPressGesture(const QPointF &point) ; |
|
80 void dataChanged(QModelIndex startIndex, QModelIndex endIndex); |
|
81 void rowsInserted(const QModelIndex &parent, int start, int end); |
|
82 void rowsRemoved(const QModelIndex &parent, int start, int end); |
|
83 void autoLeftMove(); |
|
84 void autoRightMove(); |
|
85 |
|
86 protected: |
|
87 void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
88 void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) ; |
|
89 |
|
90 void move(int value); |
|
91 |
|
92 void setRows() ; |
|
93 void setStripLen(); |
|
94 int calculateIndex(int index); |
|
95 |
|
96 void loadIconItems (); |
|
97 void updateIconItem (qint16 selIndex, qint16 selIconIndex, qint16 deltaX); |
|
98 |
|
99 //clear all the model connection |
|
100 void clearCurrentModel(); |
|
101 //add the connection to the model |
|
102 void initializeNewModel(); |
|
103 //reset all the data of cover flow |
|
104 void resetCoverFlow(); |
|
105 |
|
106 private slots: |
|
107 |
|
108 private: |
|
109 HbIconItem *mIconItem[NBR_ICON_ITEM]; //at most contain only five item |
|
110 qint16 mSelItemIndex; // current full screen index |
|
111 qint16 mRows; // total number of item |
|
112 //QModelIndex mIndex; //current model index of seleced item |
|
113 qint16 mSelIndex; // remove once model concept is integreted |
|
114 qint32 mStripLen; //virtual strip lenght |
|
115 qint32 mCurrentPos; //current postion in the virtual strip |
|
116 QSize mItemSize; //hb icon item size |
|
117 bool mUiOn; |
|
118 int mBounceBackDeltaX; |
|
119 QAbstractItemModel *mModel; |
|
120 GlxUserMove mMoveDir; //arun_goel3 may be remove later or change later |
|
121 int rotAngle; |
|
122 |
|
123 }; |
|
124 |
|
125 #endif /* GLXCOVERFLOW_H_ */ |