--- a/ui/views/fullscreenview/src/glxcoverflow.cpp Tue Jul 06 14:16:16 2010 +0300
+++ b/ui/views/fullscreenview/src/glxcoverflow.cpp Wed Aug 18 09:48:53 2010 +0300
@@ -24,6 +24,7 @@
#include <QGesture>
#include <hbpangesture.h>
#include <hbiconanimator.h>
+#include <hbinstance.h>
//User Includes
#include <glxmodelparm.h>
@@ -34,25 +35,25 @@
#define GLX_BOUNCEBACK_SPEED 16
#define GLX_BOUNCEBACK_DELTA 8
-GlxCoverFlow::GlxCoverFlow(QGraphicsItem *parent )
- : HbWidget(parent),
- mSelItemIndex (0),
- mRows(0),
- mSelIndex (0),
- mStripLen (0),
- mCurrentPos(0),
- mItemSize (QSize(0,0)),
- mModel ( NULL),
- mMoveDir(NO_MOVE),
+GlxCoverFlow::GlxCoverFlow( QGraphicsItem *parent )
+ : HbWidget( parent ),
+ mSelItemIndex ( 0 ),
+ mRows( 0 ),
+ mSelIndex ( 0 ),
+ mStripLen ( 0 ),
+ mCurrentPos( 0 ),
+ mItemSize ( QSize( 0, 0 ) ),
+ mModel ( NULL ),
+ mMoveDir( NO_MOVE ),
mSpeed ( GLX_COVERFLOW_SPEED ),
- mZoomOn(false),
- mMultitouchFilter(NULL),
- mTimerId(0)
+ mZoomOn( false ),
+ mMultitouchFilter( NULL ),
+ mTimerId( 0 ),
+ mIsInit( false )
{
-//TO:DO through exception
- qDebug("GlxCoverFlow::GlxCoverFlow");
- grabGesture(Qt::PanGesture);
- grabGesture(Qt::TapGesture);
+ qDebug( "GlxCoverFlow::GlxCoverFlow" );
+ grabGesture( Qt::PanGesture );
+ grabGesture( Qt::TapGesture );
connect( this, SIGNAL( autoLeftMoveSignal() ), this, SLOT( autoLeftMove() ), Qt::QueuedConnection );
connect( this, SIGNAL( autoRightMoveSignal() ), this, SLOT( autoRightMove() ), Qt::QueuedConnection );
}
@@ -61,6 +62,7 @@
{
mMultitouchFilter = mtFilter;
}
+
void GlxCoverFlow::setCoverFlow()
{
qDebug("GlxCoverFlow::setCoverFlow");
@@ -74,7 +76,8 @@
mIconItem[i]->setObjectName( QString( "Cover%1" ).arg( i ) );
}
- mUiOn = FALSE;
+ mIsInit = true;
+ mUiOn = false;
mBounceBackDeltaX = GLX_BOUNCEBACK_DELTA;
}
@@ -119,7 +122,7 @@
else {
killTimer(mTimerId);
mTimerId = 0;
- emit doubleTapEventReceived(gesture->position());
+ emit doubleTapEventReceived(hbInstance->allMainWindows().first()->mapToScene(gesture->position().toPoint()));
}
event->accept(gesture);
}
@@ -160,10 +163,11 @@
void GlxCoverFlow::panGesture ( const QPointF & delta )
{
qDebug("GlxCoverFlow::panGesture deltaX= %d", (int)delta.x());
- if(getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S ) {
+
+ if( !mIsInit || getSubState() == IMAGEVIEWER_S || getSubState() == FETCHER_S ) {
return;
}
- move((int) delta.x());
+ move( ( int ) delta.x() );
if( delta.x() > 0 ) {
mMoveDir = RIGHT_MOVE;
}
@@ -238,8 +242,11 @@
int width = mItemSize.width() ;
qDebug("GlxCoverFlow::autoLeftMove current pos = %d mBounceBackDeltaX x = %d", mCurrentPos, mBounceBackDeltaX);
+ if ( !mIsInit ) {
+ return;
+ }
- if ( mSelIndex == ( mRows -1 )) {
+ if ( mSelIndex == ( mRows -1 ) ) {
mSpeed = GLX_BOUNCEBACK_SPEED;
}
//for bounce back effect for last image ( it will do the back)
@@ -288,9 +295,12 @@
void GlxCoverFlow::autoRightMove()
{
qDebug("GlxCoverFlow::autoRightMove ");
+ if ( !mIsInit ) {
+ return;
+ }
int width = mItemSize.width() ;
int diffX = mStripLen - mCurrentPos ;
-
+
//slow the speed for bounce back effect
if ( mSelIndex == 0 ) {
mSpeed = GLX_BOUNCEBACK_SPEED;
@@ -400,6 +410,11 @@
void GlxCoverFlow::loadIconItems()
{
qDebug("GlxCoverFlow::loadIconItems ");
+
+ if ( !mIsInit ) {
+ return ;
+ }
+
int index = 0;
stopAnimation();
mSelIndex = getFocusIndex();
@@ -429,6 +444,7 @@
void GlxCoverFlow::stopAnimation()
{
mIconItem[ mSelItemIndex ]->animator().stopAnimation();
+ mIconItem[ mSelItemIndex ]->setIcon( getIcon( mSelIndex ) );
}
void GlxCoverFlow::updateIconItem (qint16 selIndex, qint16 selItemIndex, qint16 posX)
@@ -478,6 +494,7 @@
{
qDebug("GlxCoverFlow::partiallyClean Enter");
clearCurrentModel(); //during the animation data update will not cause the crash
+ mIsInit = false;
for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
if ( mSelItemIndex != i){
delete mIconItem[i] ;
@@ -486,11 +503,11 @@
}
}
-void GlxCoverFlow::partiallyCreate(QAbstractItemModel *model, QSize itemSize)
+void GlxCoverFlow::partiallyCreate( QAbstractItemModel *model, QSize itemSize, int posY )
{
- qDebug("GlxCoverFlow::resetpartiallyCreated");
+ qDebug("GlxCoverFlow::resetpartiallyCreated poxY %d", posY );
mIconItem[2]->setSize ( itemSize );
- mIconItem[2]->setPos ( QPointF ( 0, 0) );
+ mIconItem[2]->setPos ( QPointF ( 0, posY ) );
mModel = model ;
mSelIndex = getFocusIndex();
mIconItem[2]->setIcon( getIcon( mSelIndex ) ) ;
@@ -508,6 +525,7 @@
void GlxCoverFlow::ClearCoverFlow()
{
qDebug("GlxCoverFlow::ClearCoverFlow " );
+ mIsInit = false;
clearCurrentModel();
for ( qint8 i = 0; i < NBR_ICON_ITEM ; i++ ) {
if(mIconItem[i] != NULL ) {
@@ -530,6 +548,7 @@
void GlxCoverFlow::zoomStarted(int index)
{
Q_UNUSED(index)
+ emit coverFlowEvent( ZOOM_START_EVENT );
stopAnimation();
mZoomOn = true;
}