41 GlxSlideShowView::GlxSlideShowView(HbMainWindow *window,HbDocumentLoader *DocLoader) : GlxView(GLX_SLIDESHOWVIEW_ID), mModel(NULL), |
41 GlxSlideShowView::GlxSlideShowView(HbMainWindow *window,HbDocumentLoader *DocLoader) : GlxView(GLX_SLIDESHOWVIEW_ID), mModel(NULL), |
42 mWindow(window), mSlideShowWidget(NULL),mTvOutWrapper(NULL) |
42 mWindow(window), mSlideShowWidget(NULL),mTvOutWrapper(NULL) |
43 { |
43 { |
44 TRACER("GlxSlideShowView::GlxSlideShowView()"); |
44 TRACER("GlxSlideShowView::GlxSlideShowView()"); |
45 mDocLoader = DocLoader; |
45 mDocLoader = DocLoader; |
|
46 HbEffect::add( QString( "HbIconItem" ), QString( ":/data/rotatelandscape.fxml" ), QString( "RotateLS" ) ); |
|
47 HbEffect::add( QString( "HbIconItem" ), QString( ":/data/rotateprotrait.fxml" ), QString( "RotatePT" ) ); |
46 } |
48 } |
47 |
49 |
48 GlxSlideShowView::~GlxSlideShowView() |
50 GlxSlideShowView::~GlxSlideShowView() |
49 { |
51 { |
50 TRACER("GlxSlideShowView::~GlxSlideShowView()"); |
52 TRACER("GlxSlideShowView::~GlxSlideShowView()"); |
57 if(mDocLoader) { |
59 if(mDocLoader) { |
58 mDocLoader->reset(); |
60 mDocLoader->reset(); |
59 delete mDocLoader; |
61 delete mDocLoader; |
60 mDocLoader = NULL; |
62 mDocLoader = NULL; |
61 } |
63 } |
|
64 HbEffect::remove( QString( "HbIconItem" ), QString( ":/data/rotate.fxml" ), QString( "RotateStart" ) ); |
|
65 HbEffect::remove( QString( "HbIconItem" ), QString( ":/data/rotate1.fxml" ), QString( "RotateEnd" ) ); |
62 } |
66 } |
63 |
67 |
64 void GlxSlideShowView::activate() |
68 void GlxSlideShowView::activate() |
65 { |
69 { |
66 TRACER("GlxSlideShowView::activate()"); |
70 TRACER("GlxSlideShowView::activate()"); |
67 mWindow->setOrientation(Qt::Horizontal, false); |
|
68 |
71 |
69 //finds the widgets from the docml |
72 //finds the widgets from the docml |
70 loadObjects(); |
73 loadObjects(); |
71 setTitleBarVisible(FALSE); |
74 setTitleBarVisible(FALSE); |
72 setStatusBarVisible(FALSE); |
75 setStatusBarVisible(FALSE); |
73 connect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); |
76 connect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); |
74 connect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) ); |
77 connect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) ); |
|
78 connect( mWindow, SIGNAL( viewReady() ), this, SLOT( playLsOrientChangeAnim() ) ); |
75 |
79 |
76 QCoreApplication::instance()->installEventFilter(this); |
80 QCoreApplication::instance()->installEventFilter(this); |
77 |
81 |
78 if (!mTvOutWrapper) { |
82 if (!mTvOutWrapper) { |
79 mTvOutWrapper = new GlxTvOutWrapper(); |
83 mTvOutWrapper = new GlxTvOutWrapper(); |
81 } |
85 } |
82 |
86 |
83 void GlxSlideShowView::deActivate() |
87 void GlxSlideShowView::deActivate() |
84 { |
88 { |
85 TRACER("GlxSlideShowView::deActivate()"); |
89 TRACER("GlxSlideShowView::deActivate()"); |
86 mWindow->unsetOrientation(false); |
90 mWindow->unsetOrientation( false ); |
87 |
91 |
88 setStatusBarVisible(TRUE); |
92 setStatusBarVisible(TRUE); |
89 setTitleBarVisible(TRUE); |
93 setTitleBarVisible(TRUE); |
90 |
|
91 |
94 |
92 disconnect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); |
95 disconnect( mSlideShowWidget, SIGNAL( slideShowEvent( GlxSlideShowEvent ) ), this, SLOT( slideShowEventHandler( GlxSlideShowEvent ) ) ); |
93 disconnect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) ); |
96 disconnect( mSlideShowWidget, SIGNAL( indexchanged() ), this, SLOT( indexchanged() ) ); |
|
97 disconnect( mWindow, SIGNAL( viewReady() ), this, SLOT( playLsOrientChangeAnim() ) ); |
94 |
98 |
95 //Delete the Items in the slide show widget |
99 //Delete the Items in the slide show widget |
96 mSlideShowWidget->cleanUp(); |
100 mSlideShowWidget->cleanUp(); |
97 |
101 |
98 QCoreApplication::instance()->removeEventFilter(this); |
102 QCoreApplication::instance()->removeEventFilter(this); |
105 |
109 |
106 void GlxSlideShowView::setModel(QAbstractItemModel *model) |
110 void GlxSlideShowView::setModel(QAbstractItemModel *model) |
107 { |
111 { |
108 TRACER("GlxSlideShowView::setModel()"); |
112 TRACER("GlxSlideShowView::setModel()"); |
109 GLX_LOG_INFO2("GlxSlideShowView::setModel() model %u mModel %u", model, mModel); |
113 GLX_LOG_INFO2("GlxSlideShowView::setModel() model %u mModel %u", model, mModel); |
110 if ( mModel != model ) { |
114 |
111 |
115 if ( mModel != model ) { |
112 modelDestroyed(); |
116 modelDestroyed(); |
113 mModel = model; |
117 mModel = model; |
114 connect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
118 connect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
115 } |
119 } |
|
120 |
116 setModelContext(); |
121 setModelContext(); |
117 mSlideShowWidget->setModel(mModel); |
122 mSlideShowWidget->setModel(mModel); |
118 |
123 |
119 if (mTvOutWrapper){ |
124 if (mTvOutWrapper){ |
120 mTvOutWrapper->setModel(mModel, screenSize(), true); |
125 mTvOutWrapper->setModel(mModel, screenSize(), true); |
125 void GlxSlideShowView::setModelContext() |
130 void GlxSlideShowView::setModelContext() |
126 { |
131 { |
127 TRACER("GlxSlideShowView::setModelContext()"); |
132 TRACER("GlxSlideShowView::setModelContext()"); |
128 if ( mModel && mWindow ) { |
133 if ( mModel && mWindow ) { |
129 GLX_LOG_INFO1("GlxSlideShowView::setModelContext %d", mWindow->orientation() ); |
134 GLX_LOG_INFO1("GlxSlideShowView::setModelContext %d", mWindow->orientation() ); |
130 |
135 if ( mWindow->orientation() == Qt::Horizontal ) { |
131 mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole ); |
|
132 /* if ( mWindow->orientation() == Qt::Horizontal ) { |
|
133 mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole ); |
136 mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole ); |
134 } |
137 } |
135 else { |
138 else { |
136 mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole ); |
139 mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole ); |
137 } */ |
140 } |
|
141 } |
|
142 } |
|
143 |
|
144 void GlxSlideShowView::handleUserAction( qint32 commandId ) |
|
145 { |
|
146 switch( commandId ){ |
|
147 case EGlxCmdPlayBackAnim : |
|
148 playPtOrientChangeAnim(); |
|
149 break; |
|
150 |
|
151 default : |
|
152 break; |
138 } |
153 } |
139 } |
154 } |
140 |
155 |
141 void GlxSlideShowView::orientationChanged(Qt::Orientation) |
156 void GlxSlideShowView::orientationChanged(Qt::Orientation) |
142 { |
157 { |
189 disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
204 disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
190 mModel = NULL; |
205 mModel = NULL; |
191 } |
206 } |
192 } |
207 } |
193 |
208 |
|
209 void GlxSlideShowView::playLsOrientChangeAnim() |
|
210 { |
|
211 qDebug( "GlxSlideShowView::playLsOrientChangeAnim() enter "); |
|
212 if ( mWindow->orientation( ) == Qt ::Vertical ) { |
|
213 mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole ); |
|
214 mSlideShowWidget->updateAnimationItem(); |
|
215 HbEffect::start( mSlideShowWidget->animationItem(), QString( "HbIconItem" ), QString( "RotateLS" ), this, "LsOrientChangeAnimFinished" ); |
|
216 qDebug( "GlxSlideShowView::playLsOrientChangeAnim() exit1 "); |
|
217 } |
|
218 else { |
|
219 mWindow->setOrientation( Qt::Horizontal, false ); |
|
220 } |
|
221 } |
|
222 |
|
223 void GlxSlideShowView::playPtOrientChangeAnim() |
|
224 { |
|
225 mModel->setData( QModelIndex(), ( int )GlxContextPtFs, GlxContextRole ); |
|
226 setTitleBarVisible( FALSE ); |
|
227 setStatusBarVisible( FALSE ); |
|
228 mSlideShowWidget->updateAnimationItem(); |
|
229 HbEffect::start( mSlideShowWidget->animationItem(), QString( "HbIconItem" ), QString( "RotatePT" ), this, "PtOrientChangeAnimFinished" ); |
|
230 } |
|
231 |
|
232 void GlxSlideShowView::LsOrientChangeAnimFinished( const HbEffect::EffectStatus ) |
|
233 { |
|
234 mWindow->setOrientation( Qt::Horizontal, false ); |
|
235 orientationChanged( Qt::Horizontal ); |
|
236 } |
|
237 |
|
238 void GlxSlideShowView::PtOrientChangeAnimFinished( const HbEffect::EffectStatus ) |
|
239 { |
|
240 emit actionTriggered( EGlxCmdSlideShowBack ); |
|
241 } |
|
242 |
194 bool GlxSlideShowView::eventFilter(QObject *obj, QEvent *event) |
243 bool GlxSlideShowView::eventFilter(QObject *obj, QEvent *event) |
195 { |
244 { |
196 TRACER("GlxSlideShowView::event()"); |
245 TRACER("GlxSlideShowView::event()"); |
197 GLX_LOG_INFO1("GlxSlideShowView::event() %d event type", event->type()); |
246 GLX_LOG_INFO1("GlxSlideShowView::event() %d event type", event->type()); |
198 if ( event->type() == QEvent::ApplicationActivate && mSlideShowWidget) { |
247 if ( event->type() == QEvent::ApplicationActivate && mSlideShowWidget) { |