author | hgs |
Fri, 23 Jul 2010 20:41:04 +0530 | |
changeset 52 | a3a4c0de738e |
parent 50 | a0f57508af73 |
child 54 | 0f0f3f26f787 |
permissions | -rw-r--r-- |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: ?Description |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
//Includes |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <QDebug> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <QTimer> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <e32base.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <hbiconitem.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <hbpushbutton.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include <hbmainwindow.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include <hbdocumentloader.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <QAbstractItemModel> |
40 | 29 |
#include <QGesture> |
30 |
#include <hbpangesture.h> |
|
50 | 31 |
#include <hblabel.h> |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
//User Includes |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
34 |
#include "glxicondefs.h" //Contains the icon names/Ids |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
#include "glxmodelparm.h" |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
#include "glxeffectengine.h" |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
#include "glxdocloaderdefs.h" |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#include "glxslideshowwidget.h" |
43 | 39 |
#include "glxsettinginterface.h" |
50 | 40 |
#include "glxlocalisationstrings.h" |
43 | 41 |
#include "glxlog.h" |
42 |
#include "glxtracer.h" |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
|
40 | 45 |
GlxSlideShowWidget::GlxSlideShowWidget( QGraphicsItem *parent ) |
50 | 46 |
: HbWidget( parent ), |
47 |
mEffectEngine( NULL ), |
|
43 | 48 |
mSettings( NULL ), |
52 | 49 |
mBackGroundItem( NULL ), |
50 | 50 |
mContinueButton( NULL ), |
51 |
mErrorNote( NULL ), |
|
52 |
mItemIndex( 1 ), |
|
53 |
mSlideTimer( NULL ), |
|
54 |
mModel( NULL ), |
|
55 |
mSlideShowItemCount( 0 ) |
|
40 | 56 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
TRACER("GlxSlideShowWidget::GlxSlideShowWidget()"); |
43 | 58 |
mSettings = GlxSettingInterface::instance() ; //no owner ship |
40 | 59 |
grabGesture( Qt::PanGesture ); |
60 |
grabGesture( Qt::TapGesture ); |
|
61 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
void GlxSlideShowWidget::setSlideShowWidget(HbDocumentLoader *DocLoader) |
43 | 64 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
//To:Do error handling |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
66 |
TRACER("GlxSlideShowWidget::setSlideShowWidget()"); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
67 |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
//create the effect engine |
43 | 69 |
mEffectEngine = new GlxEffectEngine(); |
52 | 70 |
|
71 |
mBackGroundItem = new HbIconItem( this ); |
|
72 |
mBackGroundItem->setBrush( QBrush( Qt::black ) ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
// Now load the view and the contents. |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
75 |
// and then set the play icon to the button |
50 | 76 |
mContinueButton = static_cast<HbPushButton*>( DocLoader->findWidget( GLXSLIDESHOW_PB ) ); |
77 |
mContinueButton->setIcon( HbIcon( GLXICON_PLAY ) ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
mContinueButton->hide(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
mIsPause = false; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
for ( int i = 0; i < NBR_ITEM ; i++) { |
50 | 82 |
mSelIndex[ i ] = -1; |
83 |
mIconItems[ i ] = new HbIconItem( this ); |
|
84 |
mIconItems[ i ]->setAlignment( Qt::AlignCenter ); |
|
85 |
mIconItems[ i ]->setObjectName( QString( "SlideShowIcon%1" ).arg( i ) ); |
|
52 | 86 |
} |
87 |
||
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
mSlideTimer = new QTimer(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
mItemList.clear(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
//Add the signal-slot for this widget. |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
addConnections(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
//Create the settings for the effects |
43 | 95 |
mEffectEngine->registerEffect( QString("HbIconItem") ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
97 |
//provide the xml info for the effect to take place |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
HbEffect::add( QString("HbIconItem"), QString(":/data/transition.fxml"), QString( "Move" )); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
HbEffect::add( QString("HbIconItem"), QString(":/data/transitionleft.fxml"), QString( "LeftMove" )); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
HbEffect::add( QString("HbIconItem"), QString(":/data/transitionright.fxml"), QString( "RightMove" )); |
43 | 101 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
GlxSlideShowWidget::~GlxSlideShowWidget() |
43 | 104 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
TRACER("GlxSlideShowWidget::~GlxSlideShowWidget()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
106 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
//Delete the resources allocated |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
cleanUp(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
|
43 | 110 |
if(mContinueButton) { |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
delete mContinueButton; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
mContinueButton = NULL; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
} |
43 | 114 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
void GlxSlideShowWidget::cleanUp() |
43 | 117 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
TRACER("GlxSlideShowWidget::cleanUp()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
removeConnections(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
|
50 | 121 |
if( mEffectEngine ) { |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
mEffectEngine->deRegisterEffect( QString("HbIconItem") ); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
delete mEffectEngine; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
mEffectEngine = NULL; |
43 | 125 |
} |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
126 |
|
43 | 127 |
for ( int i = 0; i < NBR_ITEM ; i++) { |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
128 |
delete mIconItems[i] ; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
129 |
mIconItems[i] = NULL; |
43 | 130 |
} |
52 | 131 |
|
132 |
delete mBackGroundItem ; |
|
133 |
mBackGroundItem = NULL; |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
|
50 | 135 |
if( mSlideTimer ) { |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
delete mSlideTimer; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
mSlideTimer = NULL; |
43 | 138 |
} |
50 | 139 |
|
140 |
if ( mErrorNote ) { |
|
141 |
delete mErrorNote ; |
|
142 |
mErrorNote = NULL; |
|
143 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
clearCurrentModel(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
HbEffect::remove( QString("HbIconItem"), QString(":/data/transition.fxml"), QString( "Move" )); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionleft.fxml"), QString( "LeftMove" )); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
HbEffect::remove( QString("HbIconItem"), QString(":/data/transitionright.fxml"), QString( "RightMove" )); |
43 | 149 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
|
52 | 151 |
void GlxSlideShowWidget::setModel ( QAbstractItemModel *model ) |
43 | 152 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
TRACER("GlxSlideShowWidget::setModel()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
if ( model == mModel ) { |
43 | 155 |
return ; |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
157 |
clearCurrentModel(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
158 |
mModel = model; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
159 |
initializeNewModel(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
160 |
resetSlideShow(); |
43 | 161 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
|
52 | 163 |
void GlxSlideShowWidget::setItemGeometry( QRect screenRect ) |
43 | 164 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
165 |
TRACER("GlxSlideShowWidget::setItemGeometry()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
166 |
int index = mItemIndex; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
mScreenRect = screenRect; |
52 | 168 |
mIconItems[ index ]->setGeometry( mScreenRect ); |
169 |
index = ( mItemIndex + 1 ) % NBR_ITEM; |
|
170 |
mIconItems[ index ]->setGeometry( QRect( mScreenRect.width(), mScreenRect.top(), mScreenRect.width(), mScreenRect.height() ) ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
index = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; |
52 | 172 |
mIconItems[ index ]->setGeometry( QRect( -mScreenRect.width(), mScreenRect.top(), mScreenRect.width(), mScreenRect.height() ) ); |
173 |
mBackGroundItem->setGeometry( mScreenRect ); |
|
43 | 174 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
175 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
176 |
void GlxSlideShowWidget::triggeredEffect() |
43 | 177 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
TRACER("GlxSlideShowWidget::triggeredEffect()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
int index = mItemIndex; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
mSlideTimer->stop(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
mItemList.clear(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
User::ResetInactivityTime(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
mItemList.append( mIconItems[index] ); |
43 | 185 |
index = ( mItemIndex + 1 ) % NBR_ITEM; |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
mItemList.append( mIconItems[index] ); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
GLX_LOG_INFO3("GlxSlideShowWidget::triggeredEffect() image selected index %d array index %d index %d", mSelIndex, mItemIndex, index); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
mEffectEngine->runEffect( mItemList, QString("HbIconItem") ); |
43 | 190 |
emit slideShowEvent( EFFECT_STARTED ); |
44 | 191 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
void GlxSlideShowWidget::effectFinshed() |
43 | 194 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
GLX_LOG_INFO2("GlxSlideShowWidget::effectFinshed() before image selected index %d array index %d", mSelIndex, mItemIndex); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
mItemIndex = ( ++mItemIndex ) % NBR_ITEM; |
50 | 198 |
mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxFocusIndexRole ); |
199 |
mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxVisualWindowIndex ); |
|
200 |
setNextItemIcon(); |
|
43 | 201 |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
GLX_LOG_INFO2("GlxSlideShowWidget::effectFinshed() after image selected index %d array index %d ", mSelIndex, mItemIndex); |
43 | 203 |
|
50 | 204 |
startSlideShow(); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
mItemList.clear(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
emit indexchanged(); // on each item change |
43 | 207 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
void GlxSlideShowWidget::cancelEffect() |
43 | 210 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
TRACER("GlxSlideShowWidget::cancelEffect()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
mEffectEngine->cancelEffect( mItemList ); |
43 | 213 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
void GlxSlideShowWidget::pauseSlideShow() |
43 | 216 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
TRACER("GlxSlideShowWidget::pauseSlideShow()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
GLX_LOG_INFO1("GlxSlideShowWidget::pauseSlideShow() %d", this->zValue()); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
mIsPause = true; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
mSlideTimer->stop(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
cancelEffect(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
222 |
mContinueButton->setZValue( this->zValue() + 2); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
mContinueButton->show() ; |
50 | 224 |
emit slideShowEvent( UI_ON_EVENT ); |
43 | 225 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
void GlxSlideShowWidget::continueSlideShow(bool checked) |
43 | 228 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
229 |
Q_UNUSED( checked ) |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
230 |
TRACER("GlxSlideShowWidget::continueSlideShow()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
mIsPause = false; |
50 | 232 |
if ( mModel && mSlideShowItemCount > 1 ) { |
43 | 233 |
mSlideTimer->start( mSettings->slideShowDelayTime() ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
mContinueButton->hide(); |
50 | 236 |
emit slideShowEvent( UI_OFF_EVENT ); |
43 | 237 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
void GlxSlideShowWidget::dataChanged(QModelIndex startIndex, QModelIndex endIndex) |
43 | 240 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
241 |
Q_UNUSED( endIndex ) |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
242 |
TRACER("GlxSlideShowWidget::dataChanged()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
243 |
GLX_LOG_INFO2("GlxSlideShowWidget::dataChanged startIndex = %d mSelIndex = %d ", startIndex.row(), mSelIndex ); |
43 | 244 |
|
50 | 245 |
for( int i = 0; i < NBR_ITEM; ++i ) { |
246 |
if ( mSelIndex[ i ] == startIndex.row() ) { |
|
247 |
mIconItems[ i ]->setIcon( getIcon( startIndex.row() ) ); |
|
43 | 248 |
} |
50 | 249 |
} |
43 | 250 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
252 |
void GlxSlideShowWidget::rowsInserted(const QModelIndex &parent, int start, int end) |
43 | 253 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
TRACER("GlxSlideShowWidget::rowsInserted()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
Q_UNUSED(parent); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
Q_UNUSED(start); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
Q_UNUSED(end); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
resetSlideShow(); |
43 | 259 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
void GlxSlideShowWidget::rowsRemoved(const QModelIndex &parent, int start, int end) |
43 | 262 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
TRACER("GlxSlideShowWidget::rowsRemoved()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
Q_UNUSED(parent); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
Q_UNUSED(start); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
Q_UNUSED(end); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
GLX_LOG_INFO1( "GlxSlideShowWidget::rowsRemoved row count = %d ", mModel->rowCount() ); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
if ( mModel->rowCount() <= 0 ) { |
43 | 271 |
clearCurrentModel(); |
272 |
emit slideShowEvent( EMPTY_DATA_EVENT ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
else { |
43 | 275 |
resetSlideShow(); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
} |
43 | 277 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
278 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
void GlxSlideShowWidget::modelDestroyed() |
43 | 280 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
TRACER("GlxSlideShowWidget::modelDestroyed()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
282 |
clearCurrentModel(); |
43 | 283 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
284 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
286 |
void GlxSlideShowWidget::orientationChanged(QRect screenRect) |
40 | 287 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
TRACER("GlxSlideShowWidget::orientationChanged()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
cancelEffect(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
290 |
setItemGeometry( screenRect); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
291 |
resetSlideShow(); |
40 | 292 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
293 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
294 |
void GlxSlideShowWidget::leftGesture(int value) |
40 | 295 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
296 |
Q_UNUSED(value) |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
297 |
TRACER("GlxSlideShowWidget::leftGesture()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
298 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
299 |
int index = ( mItemIndex + 1 ) % NBR_ITEM; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
300 |
moveImage( index, mScreenRect.width(), QString("LeftMove"), "leftMoveEffectFinished"); |
40 | 301 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
302 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
303 |
void GlxSlideShowWidget::rightGesture(int value) |
40 | 304 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
305 |
Q_UNUSED(value) |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
306 |
TRACER ("GlxSlideShowWidget::rightGesture()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
307 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
int index = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
moveImage( index, -mScreenRect.width(), QString("RightMove"), "rightMoveEffectFinished"); |
40 | 310 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
311 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
312 |
void GlxSlideShowWidget::leftMoveEffectFinished( const HbEffect::EffectStatus &status ) |
43 | 313 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
Q_UNUSED(status) |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
315 |
TRACER("GlxSlideShowWidget::leftMoveEffectFinished()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
GLX_LOG_INFO1("GlxSlideShowWidget::leftMoveEffectFinished() %d status", status.reason); |
50 | 317 |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
mItemIndex = ( ++mItemIndex ) % NBR_ITEM; |
50 | 319 |
mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxFocusIndexRole ); |
320 |
mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxVisualWindowIndex ); |
|
321 |
setNextItemIcon(); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
322 |
startSlideShow(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
323 |
emit indexchanged(); // on left swipe |
43 | 324 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
325 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
326 |
void GlxSlideShowWidget::rightMoveEffectFinished( const HbEffect::EffectStatus &status ) |
43 | 327 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
328 |
Q_UNUSED(status) |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
329 |
TRACER ( "GlxSlideShowWidget::rightMoveEffectFinished( ) "); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
330 |
GLX_LOG_INFO1("GlxSlideShowWidget::rightMoveEffectFinished() %d status", status.reason); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
331 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
332 |
mItemIndex = mItemIndex ? mItemIndex - 1 : NBR_ITEM - 1; |
50 | 333 |
mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxFocusIndexRole ); |
334 |
mModel->setData( mModel->index( 0, 0 ), mSelIndex[ mItemIndex ], GlxVisualWindowIndex ); |
|
335 |
setPreItemIcon(); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
336 |
startSlideShow(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
337 |
emit indexchanged(); // on right swipe |
43 | 338 |
} |
40 | 339 |
|
340 |
void GlxSlideShowWidget::gestureEvent(QGestureEvent *event) |
|
341 |
{ |
|
342 |
if( QTapGesture *gesture = static_cast<QTapGesture *>( event->gesture( Qt::TapGesture ) ) ) { |
|
343 |
if ( gesture->state() == Qt::GestureFinished ) { |
|
344 |
if ( mIsPause == false ) { |
|
345 |
pauseSlideShow(); |
|
346 |
} |
|
347 |
event->accept(gesture); |
|
348 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
} |
40 | 350 |
|
351 |
if (QPanGesture *panningGesture = qobject_cast<QPanGesture*>(event->gesture(Qt::PanGesture))) { |
|
352 |
HbPanGesture *hbPanGesture = qobject_cast<HbPanGesture *>(panningGesture); |
|
353 |
if ( hbPanGesture ) { |
|
354 |
if( hbPanGesture->state() == Qt::GestureFinished ) { |
|
355 |
QPointF delta( hbPanGesture->sceneDelta() ); |
|
356 |
if ( delta.x() > 0 ) { |
|
357 |
rightGesture( delta.x() ); |
|
358 |
} |
|
359 |
else { |
|
360 |
leftGesture( delta.x() ); |
|
361 |
} |
|
362 |
} |
|
363 |
event->accept(panningGesture); |
|
364 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
} |
40 | 366 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
367 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
368 |
void GlxSlideShowWidget::startSlideShow ( ) |
43 | 369 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
370 |
TRACER ( "GlxSlideShowWidget::startSlideShow( ) "); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
371 |
GLX_LOG_INFO1 ( "GlxSlideShowWidget::startSlideShow( ) is pause %d", mIsPause); |
50 | 372 |
|
373 |
if ( mSlideShowItemCount == 0 ) { |
|
374 |
showErrorNote(); |
|
375 |
} |
|
376 |
if ( mIsPause == false && mModel && mSlideShowItemCount > 1 ) { |
|
43 | 377 |
mSlideTimer->start( mSettings->slideShowDelayTime() ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
378 |
} |
43 | 379 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
380 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
381 |
void GlxSlideShowWidget::stopSlideShow ( ) |
43 | 382 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
383 |
TRACER ( "GlxSlideShowWidget::stopSlideShow( ) "); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
384 |
cancelEffect(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
385 |
mSlideTimer->stop(); |
43 | 386 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
387 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
388 |
void GlxSlideShowWidget::clearCurrentModel() |
43 | 389 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
390 |
TRACER ( "GlxSlideShowWidget::clearCurrentModel( ) "); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
391 |
if ( mModel ) { |
43 | 392 |
disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); |
393 |
disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); |
|
394 |
disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); |
|
395 |
disconnect(mModel, SIGNAL(destroyed()), this, SLOT( modelDestroyed())); |
|
396 |
mModel = NULL ; |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
397 |
} |
43 | 398 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
399 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
400 |
void GlxSlideShowWidget::initializeNewModel() |
43 | 401 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
402 |
TRACER("GlxSlideShowWidget::initializeNewModel" ); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
if ( mModel ) { |
43 | 404 |
connect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); |
405 |
connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); |
|
406 |
connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); |
|
407 |
connect(mModel, SIGNAL(destroyed()), this, SLOT( modelDestroyed())); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
408 |
} |
43 | 409 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
410 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
411 |
void GlxSlideShowWidget::resetSlideShow() |
43 | 412 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
413 |
TRACER("GlxSlideShowWidget::resetSlideShow()" ); |
50 | 414 |
if( mModel == NULL || mModel->rowCount() == 0 ) { |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
415 |
return; |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
416 |
} |
50 | 417 |
|
418 |
mSlideShowItemCount = mModel->rowCount(); |
|
419 |
setFocusItemIcon() ; |
|
420 |
setNextItemIcon() ; |
|
421 |
setPreItemIcon() ; |
|
422 |
startSlideShow(); |
|
423 |
||
424 |
qDebug( "GlxSlideShowWidget::resetSlideShow slide show item count %d" , mSlideShowItemCount ); |
|
425 |
if ( mErrorNote && mErrorNote->isVisible() && mSlideShowItemCount > 1 ){ |
|
426 |
hideErrorNote(); |
|
427 |
} |
|
43 | 428 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
429 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
430 |
void GlxSlideShowWidget::moveImage(int nextIndex, int posX, const QString & move, char * callBack) |
43 | 431 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
432 |
TRACER("GlxSlideShowWidget::MoveImage()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
433 |
|
50 | 434 |
if ( mSlideShowItemCount <= 1 || mEffectEngine->isEffectRuning( mItemList ) ) { |
43 | 435 |
return ; |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
436 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
437 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
438 |
mSlideTimer->stop(); |
43 | 439 |
HbEffect::start( mIconItems[mItemIndex], QString("HbIconItem"), move ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
440 |
mIconItems[nextIndex]->setPos( posX, mScreenRect.top()); |
43 | 441 |
mIconItems[nextIndex]->setOpacity(1); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
442 |
HbEffect::start(mIconItems[nextIndex], QString("HbIconItem"), QString("Move"), this, callBack ); |
43 | 443 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
444 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
445 |
void GlxSlideShowWidget::addConnections() |
43 | 446 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
447 |
TRACER("GlxSlideShowWidget::addConnections()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
448 |
if ( mEffectEngine ) { |
43 | 449 |
connect( mEffectEngine, SIGNAL( effectFinished() ), this, SLOT( effectFinshed() ) ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
450 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
451 |
if ( mSlideTimer ) { |
43 | 452 |
connect( mSlideTimer, SIGNAL(timeout()), this, SLOT( triggeredEffect() ) ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
453 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
454 |
if ( mContinueButton ) { |
43 | 455 |
connect( mContinueButton, SIGNAL( clicked(bool) ), this, SLOT( continueSlideShow(bool) ) ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
456 |
} |
43 | 457 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
458 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
459 |
void GlxSlideShowWidget::removeConnections() |
43 | 460 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
461 |
TRACER("GlxSlideShowWidget::removeConnections()"); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
462 |
if ( mEffectEngine ) { |
43 | 463 |
disconnect( mEffectEngine, SIGNAL( effectFinished() ), this, SLOT( effectFinshed() ) ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
464 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
465 |
if ( mSlideTimer ) { |
43 | 466 |
disconnect( mSlideTimer, SIGNAL(timeout()), this, SLOT( triggeredEffect() ) ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
467 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
468 |
if ( mContinueButton ) { |
43 | 469 |
disconnect( mContinueButton, SIGNAL( clicked(bool) ), this, SLOT( continueSlideShow(bool) ) ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
470 |
} |
43 | 471 |
} |
50 | 472 |
|
473 |
int GlxSlideShowWidget::getFocusIndex( ) |
|
474 |
{ |
|
475 |
QVariant variant = mModel->data( mModel->index( 0, 0 ), GlxFocusIndexRole ) ; |
|
476 |
if ( variant.isValid() && variant.canConvert< int > () ) { |
|
477 |
return variant.value< int > (); |
|
478 |
} |
|
479 |
return -1; |
|
480 |
} |
|
481 |
||
482 |
HbIcon GlxSlideShowWidget::getIcon( int index ) |
|
483 |
{ |
|
484 |
QVariant variant = mModel->data( mModel->index( index, 0 ), GlxFsImageRole ); |
|
485 |
if ( variant.isValid() && variant.canConvert< HbIcon > () ) { |
|
486 |
return variant.value< HbIcon > () ; |
|
487 |
} |
|
488 |
return HbIcon() ; |
|
489 |
} |
|
490 |
||
491 |
bool GlxSlideShowWidget::isCorrupt( int index ) |
|
492 |
{ |
|
493 |
QVariant variant = mModel->data( mModel->index( index, 0 ), GlxImageCorruptRole ); |
|
494 |
if ( variant.isValid() && variant.canConvert< bool> () ) { |
|
495 |
return variant.value< bool > () ; |
|
496 |
} |
|
497 |
return false ; |
|
498 |
} |
|
499 |
||
500 |
bool GlxSlideShowWidget::setFocusItemIcon( ) |
|
501 |
{ |
|
502 |
int nbrItem = mModel->rowCount(); |
|
503 |
int focusIndex = getFocusIndex(); |
|
504 |
||
505 |
for ( int i = 0; i < nbrItem ; ++i ) { |
|
506 |
if ( isCorrupt( focusIndex ) == false ) { |
|
507 |
qDebug( "GlxSlideShowWidget::setFocusItemIcon1 focus index %d" , focusIndex ); |
|
508 |
mIconItems[ mItemIndex ]->setIcon( getIcon( focusIndex ) ) ; |
|
509 |
mSelIndex[ mItemIndex ] = focusIndex ; |
|
510 |
if ( i != 0 ) { |
|
511 |
mModel->setData( mModel->index( 0, 0 ), focusIndex, GlxFocusIndexRole ); |
|
512 |
mModel->setData( mModel->index( 0, 0 ), focusIndex, GlxVisualWindowIndex ); |
|
513 |
} |
|
514 |
return true; |
|
515 |
} |
|
516 |
focusIndex = ( focusIndex + 1 ) % nbrItem; |
|
517 |
} |
|
518 |
mSlideShowItemCount = 0; |
|
519 |
return false; |
|
520 |
} |
|
521 |
||
522 |
bool GlxSlideShowWidget::setNextItemIcon( ) |
|
523 |
{ |
|
524 |
int nbrItem = mModel->rowCount(); |
|
525 |
int imageIndex = ( mSelIndex[ mItemIndex ] + 1 ) % nbrItem ; |
|
526 |
int itemIndex = ( mItemIndex + 1 ) % NBR_ITEM ; |
|
527 |
||
528 |
for( int i = 1; i < nbrItem; ++i ) { |
|
529 |
if ( isCorrupt( imageIndex ) == false ) { |
|
530 |
mIconItems[ itemIndex ]->setIcon( getIcon( imageIndex ) ); |
|
531 |
mSelIndex[ itemIndex ] = imageIndex ; |
|
532 |
return true; |
|
533 |
} |
|
534 |
imageIndex = ( imageIndex + 1 ) % nbrItem ; |
|
535 |
} |
|
536 |
||
537 |
if ( isCorrupt( imageIndex ) ) { |
|
538 |
mSlideShowItemCount = 0; |
|
539 |
} |
|
540 |
else { |
|
541 |
mSlideShowItemCount = 1; |
|
542 |
} |
|
543 |
return false ; |
|
544 |
} |
|
545 |
||
546 |
bool GlxSlideShowWidget::setPreItemIcon() |
|
547 |
{ |
|
548 |
int nbrItem = mModel->rowCount() ; |
|
549 |
int imageIndex = mSelIndex[ mItemIndex ] > 0 ? mSelIndex[ mItemIndex ] - 1 : nbrItem - 1 ; |
|
550 |
int itemIndex = mItemIndex > 0 ? mItemIndex - 1 : mItemIndex ; |
|
551 |
||
552 |
for( int i = 1; i < nbrItem; ++i ) { |
|
553 |
if ( isCorrupt( imageIndex ) == false ) { |
|
554 |
mIconItems[ itemIndex ]->setIcon( getIcon( imageIndex ) ) ; |
|
555 |
mSelIndex[ itemIndex ] = imageIndex ; |
|
556 |
return true; |
|
557 |
} |
|
558 |
imageIndex = imageIndex > 0 ? imageIndex - 1 : nbrItem - 1 ; |
|
559 |
} |
|
560 |
if ( isCorrupt( imageIndex ) ) { |
|
561 |
mSlideShowItemCount = 0; |
|
562 |
} |
|
563 |
else { |
|
564 |
mSlideShowItemCount = 1; |
|
565 |
} |
|
566 |
return false; |
|
567 |
} |
|
568 |
||
569 |
void GlxSlideShowWidget::showErrorNote() |
|
570 |
{ |
|
571 |
if ( mErrorNote == NULL ){ |
|
572 |
mErrorNote = new HbLabel( QString( GLX_NOIMAGE_PLAY_SLIDESHOW ), this); |
|
573 |
mErrorNote->setObjectName( "No Image" ); |
|
574 |
mErrorNote->setGeometry( mIconItems[ 0 ]->geometry() ); |
|
575 |
mErrorNote->setAlignment( Qt::AlignCenter ); |
|
576 |
} |
|
577 |
||
578 |
for( int i = 0; i < NBR_ITEM; ++i ){ |
|
579 |
mIconItems[ i ]->setVisible( false ); |
|
580 |
} |
|
581 |
mErrorNote->setVisible( true ); |
|
582 |
emit slideShowEvent( UI_ON_EVENT ); |
|
583 |
} |
|
584 |
||
585 |
void GlxSlideShowWidget::hideErrorNote() |
|
586 |
{ |
|
587 |
for( int i = 0; i < NBR_ITEM; ++i ){ |
|
588 |
mIconItems[ i ]->setVisible( true ); |
|
589 |
} |
|
590 |
mErrorNote->setVisible( false ); |
|
591 |
emit slideShowEvent( UI_OFF_EVENT ); |
|
592 |
} |
|
593 |