|
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 //Includes |
|
20 #include <QDebug> |
|
21 #include <QTimer> |
|
22 #include <hbmenu.h> |
|
23 #include <hbgridview.h> |
|
24 #include <hbpushbutton.h> |
|
25 #include <hbmainwindow.h> |
|
26 #include <shareuidialog.h> |
|
27 #include <hbdocumentloader.h> |
|
28 #include <QAbstractItemModel> |
|
29 #include <hbabstractviewitem.h> |
|
30 |
|
31 |
|
32 //User Includes |
|
33 #include "glxviewids.h" //contains the view ids of all the views in photos app. |
|
34 #include "glxmodelparm.h" |
|
35 #include "glxcoverflow.h" |
|
36 #include "glxzoomslider.h" |
|
37 #include "glxzoomcontrol.h" |
|
38 #include "glxdocloaderdefs.h" //contains the definations of path, widget names and view names in docml |
|
39 #include "glxloggerenabler.h" |
|
40 #include "glxfullscreenview.h" |
|
41 #include "glxcommandhandlers.hrh" |
|
42 #include <glxhdmicontroller.h> |
|
43 #include <glxlog.h> |
|
44 #include <glxtracer.h> |
|
45 |
|
46 |
|
47 const int KUiOffTime = 3000; |
|
48 |
|
49 GlxFullScreenView::GlxFullScreenView(HbMainWindow *window,HbDocumentLoader *DocLoader) : GlxView ( GLX_FULLSCREENVIEW_ID), |
|
50 mModel(NULL), mWindow( window), mCoverFlow(NULL) , mImageStrip (NULL), mUiOffTimer(NULL), |
|
51 mZmPushButton(NULL), mZoomSlider(NULL), mZoomControl(NULL),mSendUserActivityEvent(false), |
|
52 mFlipPushButton(NULL), nbrCol(0),iHdmiController(NULL) |
|
53 { |
|
54 TRACER("GlxFullScreenView::GlxFullScreenView()" ); |
|
55 mDocLoader = DocLoader; |
|
56 setContentFullScreen( true ); |
|
57 HbEffect::add( QString("HbGridView"), QString(":/data/transitionup.fxml"), QString( "TapShow" )); |
|
58 HbEffect::add( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" )); |
|
59 } |
|
60 |
|
61 void GlxFullScreenView::initializeView(QAbstractItemModel *model) |
|
62 { |
|
63 TRACER("GlxFullScreenView::initializeView()" ); |
|
64 |
|
65 //Load/Retrieve the Widgets |
|
66 loadWidgets(); |
|
67 |
|
68 //Initialize the coverflow and partially creates the coverflow with one image |
|
69 // to make the widget light weight in order to make |
|
70 // transition smooth |
|
71 QRect screen_rect = mWindow->geometry(); |
|
72 QSize sz(screen_rect.width(), screen_rect.height()); |
|
73 mCoverFlow->partiallyCreate( model, sz); |
|
74 } |
|
75 |
|
76 void GlxFullScreenView::loadWidgets() |
|
77 { |
|
78 TRACER("GlxFullScreenView::loadWidgets()"); |
|
79 //Load the View and Widget |
|
80 GlxFullScreenView *view = static_cast<GlxFullScreenView*> (mDocLoader->findWidget(GLXFULLSCREEN_VIEW)); |
|
81 mCoverFlow = static_cast<GlxCoverFlow*> (mDocLoader->findWidget(GLXFULLSCREEN_COVERFLOW)); |
|
82 |
|
83 //initialise the cover flow for basic connections and the rest |
|
84 mCoverFlow->setCoverFlow(); |
|
85 |
|
86 //Load the IMAGE STRIP & FULLSCREEN TOOLBAR[PUSH BUTTON] |
|
87 mImageStrip = static_cast<HbGridView*> (mDocLoader->findWidget(GLXFULLSCREEN_FILMSTRIP)); |
|
88 mFlipPushButton = static_cast<HbPushButton*> (mDocLoader->findWidget(GLXFULLSCREEN_FLIP)); |
|
89 |
|
90 //When the widget is loaded/retreived the widgets are shown by default. |
|
91 //@to do : hide the widgets by default in docml |
|
92 mImageStrip->hide(); |
|
93 mFlipPushButton->hide(); |
|
94 } |
|
95 |
|
96 void GlxFullScreenView::activate() |
|
97 { |
|
98 TRACER("GlxFullScreenView::activate()" ); |
|
99 |
|
100 mWindow->setItemVisible(Hb::AllItems, FALSE) ; |
|
101 |
|
102 if(!mCoverFlow) |
|
103 { |
|
104 //retrives the widgets |
|
105 loadWidgets(); |
|
106 } |
|
107 |
|
108 loadViewSection(); |
|
109 |
|
110 if(mZmPushButton == NULL) { |
|
111 mZmPushButton = new HbPushButton("ZM",this); |
|
112 } |
|
113 |
|
114 if(NULL == mZoomSlider) { |
|
115 mZoomSlider = new GlxZoomSlider(this); |
|
116 } |
|
117 |
|
118 if(NULL == mZoomControl) { |
|
119 mZoomControl = new GlxZoomControl(this); |
|
120 } |
|
121 |
|
122 addConnection(); |
|
123 hideUi(); |
|
124 setLayout(); |
|
125 mSendUserActivityEvent = true; |
|
126 if (!iHdmiController) |
|
127 { |
|
128 GLX_LOG_INFO("GlxFullScreenView::activate() - CGlxHdmi" ); |
|
129 iHdmiController = CGlxHdmiController::NewL(); |
|
130 } |
|
131 } |
|
132 |
|
133 void GlxFullScreenView::loadViewSection() |
|
134 { |
|
135 TRACER("GlxFullScreenView::loadViewSection()" ); |
|
136 bool loaded =true; |
|
137 if( mWindow->orientation() == Qt::Horizontal ) |
|
138 { |
|
139 //Load the Landscape section for Horizontal |
|
140 mDocLoader->load(GLXFULLSCREENDOCMLPATH,GLXFULLSCREENLSSECTION,&loaded); |
|
141 } |
|
142 else |
|
143 { |
|
144 //Load the Portrait section for Horizontal |
|
145 mDocLoader->load(GLXFULLSCREENDOCMLPATH,GLXFULLSCREENPTSECTION,&loaded); |
|
146 } |
|
147 } |
|
148 |
|
149 |
|
150 void GlxFullScreenView::resetView() |
|
151 { |
|
152 TRACER("GlxFullScreenView::resetView()" ); |
|
153 |
|
154 //Clear the 4 icons present in the Coverflow,so that the transition between the views are smooth |
|
155 mCoverFlow->partiallyClean(); |
|
156 |
|
157 //Clean up the rest of the resources allocated |
|
158 cleanUp(); |
|
159 } |
|
160 |
|
161 void GlxFullScreenView::deActivate() |
|
162 { |
|
163 TRACER("GlxFullScreenView::deActivate()" ); |
|
164 |
|
165 mWindow->setItemVisible(Hb::AllItems , TRUE); |
|
166 |
|
167 //Clean up the rest of the resources allocated |
|
168 cleanUp(); |
|
169 |
|
170 //deletes the iconitems in the coverflow |
|
171 mCoverFlow->ClearCoverFlow(); |
|
172 |
|
173 //the coverflow is not deleted as it is loaded by document loader |
|
174 //the coverflow is initialised to null |
|
175 //to just reset to the initial state |
|
176 mCoverFlow = NULL; |
|
177 } |
|
178 |
|
179 void GlxFullScreenView::cleanUp() |
|
180 { |
|
181 TRACER("GlxFullScreenView::cleanUp()" ); |
|
182 |
|
183 removeConnection(); |
|
184 |
|
185 if ( mUiOffTimer ) { |
|
186 GLX_LOG_INFO("GlxFullScreenView::cleanUp() mUiOffTimer" ); |
|
187 mUiOffTimer->stop(); |
|
188 delete mUiOffTimer; |
|
189 mUiOffTimer = NULL; |
|
190 } |
|
191 |
|
192 mSendUserActivityEvent = false; |
|
193 |
|
194 if(mZmPushButton) { |
|
195 GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mZmPushButton " ); |
|
196 delete mZmPushButton; |
|
197 mZmPushButton = NULL; |
|
198 } |
|
199 |
|
200 if(mZoomSlider) { |
|
201 GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mZoomSlider " ); |
|
202 delete mZoomSlider; |
|
203 mZoomSlider = NULL; |
|
204 } |
|
205 |
|
206 if(mZoomControl) { |
|
207 GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mZoomControl " ); |
|
208 delete mZoomControl; |
|
209 mZoomControl = NULL; |
|
210 } |
|
211 if (iHdmiController) { |
|
212 GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete iHdmiController " ); |
|
213 delete iHdmiController; |
|
214 iHdmiController = NULL; |
|
215 } |
|
216 |
|
217 } |
|
218 |
|
219 QGraphicsItem * GlxFullScreenView::getAnimationItem(GlxEffect transitionEffect) |
|
220 { |
|
221 TRACER("GlxFullScreenView::getAnimationItem(GlxEffect transitionEffect)"); |
|
222 if ( transitionEffect == GRID_TO_FULLSCREEN |
|
223 || transitionEffect == FULLSCREEN_TO_DETAIL |
|
224 || transitionEffect == DETAIL_TO_FULLSCREEN ) { |
|
225 return this; |
|
226 } |
|
227 |
|
228 return NULL; |
|
229 } |
|
230 |
|
231 void GlxFullScreenView::setModel( QAbstractItemModel *model ) |
|
232 { |
|
233 TRACER("GlxFullScreenView::setModel( QAbstractItemModel *model )"); |
|
234 GLX_LOG_INFO2("GlxFullScreenView::setModel() model %u mModel %u", model, mModel ); |
|
235 |
|
236 mModel = model; |
|
237 mCoverFlow->setModel(mModel); |
|
238 mZoomSlider->setModel(mModel); |
|
239 mZoomControl->setModel(mModel); |
|
240 setImageStripModel(); |
|
241 SetImageToHdmiL(); // for the first image on screen |
|
242 } |
|
243 |
|
244 void GlxFullScreenView::setModelContext() |
|
245 { |
|
246 TRACER("GlxFullScreenView::setModelContext()"); |
|
247 if ( mModel && mWindow ) { |
|
248 GLX_LOG_INFO1("GlxFullScreenView::setModelContext %d", mWindow->orientation() ); |
|
249 |
|
250 if ( mWindow->orientation() == Qt::Horizontal ) { |
|
251 WRITE_TIMESTAMP("set the fullscreen landscape context") |
|
252 mModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole ); |
|
253 } |
|
254 else { |
|
255 WRITE_TIMESTAMP("set the fullscreen portrait context") |
|
256 mModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole ); |
|
257 } |
|
258 } |
|
259 } |
|
260 |
|
261 void GlxFullScreenView::orientationChanged(Qt::Orientation orient) |
|
262 { |
|
263 TRACER("GlxFullScreenView::orientationChanged()"); |
|
264 // fullscreen thumnail size is depends on orientation of phone so change the model context before changing the layout |
|
265 GLX_LOG_INFO1("GlxFullScreenView::orientationChanged() %d", orient ); |
|
266 setModelContext(); |
|
267 loadViewSection(); |
|
268 setLayout(); |
|
269 } |
|
270 |
|
271 void GlxFullScreenView::activateUI() |
|
272 { |
|
273 TRACER("GlxFullScreenView::activateUI()"); |
|
274 GLX_LOG_INFO1("GlxFullScreenView::activateUI() %d", mUiOff ); |
|
275 if(mSendUserActivityEvent){ |
|
276 mSendUserActivityEvent = false; |
|
277 emit cancelTimer(); |
|
278 } |
|
279 if ( mUiOff ){ |
|
280 |
|
281 if ( mUiOffTimer == NULL ) { |
|
282 mUiOffTimer = new QTimer(); |
|
283 connect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi())); |
|
284 } |
|
285 |
|
286 //set and scrool the current index to the center |
|
287 QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); |
|
288 if ( variant.isValid() && variant.canConvert<int> () ) { |
|
289 mImageStrip->setCurrentIndex ( mModel->index( variant.value<int>(), 0) ); |
|
290 mImageStrip->scrollTo( mModel->index( variant.value<int>(), 0), HbGridView::PositionAtCenter ); |
|
291 } |
|
292 mImageStrip->show(); |
|
293 |
|
294 //mZmPushButton->show(); |
|
295 mFlipPushButton->setZValue( 6 + mCoverFlow->zValue() ); |
|
296 mFlipPushButton->show(); |
|
297 mZmPushButton->hide(); |
|
298 mUiOff = FALSE; |
|
299 mUiOffTimer->start(KUiOffTime); |
|
300 mCoverFlow->setUiOn(TRUE); |
|
301 mWindow->setItemVisible(Hb::AllItems, TRUE) ; |
|
302 HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapShow"), this, "effectFinished" ); |
|
303 } |
|
304 else { |
|
305 hideUi(); |
|
306 } |
|
307 } |
|
308 |
|
309 void GlxFullScreenView::hideUi() |
|
310 { |
|
311 TRACER("GlxFullScreenView::hideUi()"); |
|
312 GLX_LOG_INFO1("GlxFullScreenView::hideUi() %d", mUiOff ); |
|
313 if(mSendUserActivityEvent){ |
|
314 mSendUserActivityEvent = false; |
|
315 emit cancelTimer(); |
|
316 } |
|
317 HbMenu *menuWidget = menu(); |
|
318 |
|
319 //if option menu is open then no need to hide the status bar and image strip |
|
320 if ( menuWidget->isVisible() ) { |
|
321 return ; |
|
322 } |
|
323 |
|
324 mWindow->setItemVisible(Hb::AllItems, FALSE) ; |
|
325 if ( mImageStrip ) { |
|
326 HbEffect::start(mImageStrip, QString("HbGridView"), QString("TapHide"), this, "effectFinished" ); |
|
327 //mImageStrip->hide(); |
|
328 } |
|
329 mZmPushButton->hide(); |
|
330 |
|
331 if(mFlipPushButton){ |
|
332 mFlipPushButton->hide(); |
|
333 } |
|
334 |
|
335 if ( mUiOffTimer ) { |
|
336 mUiOffTimer->stop(); |
|
337 } |
|
338 mUiOff = TRUE; |
|
339 mCoverFlow->setUiOn(FALSE); |
|
340 } |
|
341 |
|
342 void GlxFullScreenView::changeSelectedIndex(const QModelIndex &index) |
|
343 { |
|
344 TRACER("GlxFullScreenView::changeSelectedIndex()"); |
|
345 GLX_LOG_INFO1("GlxFullScreenView::changeSelectedIndex() %d", index.row() ); |
|
346 QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); |
|
347 if ( variant.isValid() && variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) { |
|
348 return; |
|
349 } |
|
350 mModel->setData( index, index.row(), GlxFocusIndexRole ); |
|
351 mZoomSlider->indexChanged(index.row()); |
|
352 // mZoomControl->indexChanged(index.row()); |
|
353 SetImageToHdmiL(); // for the image changed on swipe |
|
354 } |
|
355 |
|
356 void GlxFullScreenView::indexChanged(const QModelIndex &index) |
|
357 { |
|
358 TRACER("GlxFullScreenView::indexChanged()"); |
|
359 GLX_LOG_INFO1("GlxFullScreenView::indexChanged() %d", index.row() ); |
|
360 QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); |
|
361 if ( variant.isValid() && variant.canConvert<int> () && ( index.row() == variant.value<int>() ) ) { |
|
362 return; |
|
363 } |
|
364 mModel->setData( index, index.row(), GlxFocusIndexRole ); |
|
365 mCoverFlow->indexChanged(index.row()); |
|
366 mZoomSlider->indexChanged(index.row()); |
|
367 mImageStrip->scrollTo(index, HbGridView::PositionAtCenter ); |
|
368 //mZoomControl->indexChanged(index.row()); |
|
369 SetImageToHdmiL(); // for the indexchnaged through filmstrip |
|
370 } |
|
371 |
|
372 void GlxFullScreenView::scrollingStarted() |
|
373 { |
|
374 TRACER("GlxFullScreenView::scrollingStarted() "); |
|
375 //no need to hide the ui during image strip scrolling |
|
376 if ( mUiOffTimer ) { |
|
377 mUiOffTimer->stop(); |
|
378 } |
|
379 } |
|
380 |
|
381 void GlxFullScreenView::scrollingEnded() |
|
382 { |
|
383 TRACER("GlxFullScreenView::scrollingEnded() "); |
|
384 if ( mUiOffTimer ) { |
|
385 mUiOffTimer->start(KUiOffTime); |
|
386 } |
|
387 setVisvalWindowIndex(); |
|
388 } |
|
389 |
|
390 void GlxFullScreenView::pressed(const QModelIndex &index) |
|
391 { |
|
392 Q_UNUSED(index) |
|
393 TRACER("GlxFullScreenView::pressed() "); |
|
394 if ( mUiOffTimer ) { |
|
395 mUiOffTimer->stop(); |
|
396 } |
|
397 } |
|
398 |
|
399 void GlxFullScreenView::released(const QModelIndex &index) |
|
400 { |
|
401 Q_UNUSED(index) |
|
402 TRACER("GlxFullScreenView::released() "); |
|
403 |
|
404 if ( mUiOffTimer && mImageStrip->isScrolling() == false ) { |
|
405 mUiOffTimer->start(KUiOffTime); |
|
406 } |
|
407 } |
|
408 |
|
409 void GlxFullScreenView::setVisvalWindowIndex() |
|
410 { |
|
411 TRACER("GlxFullScreenView::setVisvalWindowIndex()"); |
|
412 QList< HbAbstractViewItem * > visibleItemList = mImageStrip->visibleItems(); |
|
413 |
|
414 GLX_LOG_INFO1("GlxFullScreenView::setVisvalWindowIndex() %d", visibleItemList.count()); |
|
415 if ( visibleItemList.count() <= 0 ) |
|
416 return ; |
|
417 |
|
418 HbAbstractViewItem *item = visibleItemList.at(0); |
|
419 GLX_LOG_INFO1("GlxFullScreenView::setVisvalWindowIndex()1 item %u", item); |
|
420 if ( item == NULL ) |
|
421 return ; |
|
422 |
|
423 GLX_LOG_INFO1("GlxFullScreenView::setVisvalWindowIndex() item %u", item); |
|
424 |
|
425 GLX_LOG_INFO1("GlxFullScreenView::setVisvalWindowIndex() visual index %d", item->modelIndex().row() ); |
|
426 if ( item->modelIndex().row() < 0 || item->modelIndex().row() >= mModel->rowCount() ) |
|
427 return ; |
|
428 |
|
429 mModel->setData( item->modelIndex (), item->modelIndex().row(), GlxVisualWindowIndex); |
|
430 } |
|
431 |
|
432 void GlxFullScreenView::coverFlowEventHandle( GlxCoverFlowEvent e ) |
|
433 { |
|
434 TRACER("GlxFullScreenView::coverFlowEventHandle()"); |
|
435 switch( e ){ |
|
436 case TAP_EVENT : |
|
437 activateUI(); |
|
438 break ; |
|
439 |
|
440 case PANNING_START_EVENT : |
|
441 hideUi(); |
|
442 break ; |
|
443 |
|
444 case EMPTY_ROW_EVENT : |
|
445 emit actionTriggered( EGlxCmdEmptyData ); |
|
446 break ; |
|
447 |
|
448 default : |
|
449 break ; |
|
450 } |
|
451 } |
|
452 |
|
453 void GlxFullScreenView::setLayout() |
|
454 { |
|
455 TRACER("GlxFullScreenView::setLayout()"); |
|
456 //TO:DO read form layout doc |
|
457 GLX_LOG_INFO1("GlxFullScreenView::setLayout() %d", mWindow->orientation() ); |
|
458 |
|
459 QRect screen_rect = mWindow->geometry(); |
|
460 QSize sz(screen_rect.width(), screen_rect.height()); |
|
461 |
|
462 |
|
463 mCoverFlow->setItemSize(sz); |
|
464 mZoomControl->setGeometry(screen_rect); |
|
465 mZoomControl->setWindowSize(sz); |
|
466 |
|
467 mZmPushButton->setZValue(6); |
|
468 mZmPushButton->setGeometry(QRectF(0,50,50,50)); |
|
469 } |
|
470 |
|
471 void GlxFullScreenView::addConnection() |
|
472 { |
|
473 TRACER("GlxFullScreenView::addConnection() " ); |
|
474 if ( mCoverFlow ) { |
|
475 connect( mCoverFlow, SIGNAL( coverFlowEvent( GlxCoverFlowEvent ) ), this, SLOT( coverFlowEventHandle( GlxCoverFlowEvent ) ) ); |
|
476 connect( mCoverFlow, SIGNAL(changeSelectedIndex(const QModelIndex &)), this, SLOT( changeSelectedIndex( const QModelIndex & ))); |
|
477 |
|
478 } |
|
479 |
|
480 if ( mImageStrip ) { |
|
481 connect(mImageStrip, SIGNAL( activated(const QModelIndex &) ), this, SLOT( indexChanged(const QModelIndex &) )); |
|
482 connect(mImageStrip, SIGNAL( scrollingStarted()), this, SLOT( scrollingStarted())); |
|
483 connect(mImageStrip, SIGNAL( scrollingEnded()), this, SLOT( scrollingEnded())); |
|
484 connect(mImageStrip, SIGNAL( pressed(const QModelIndex &) ), this, SLOT( pressed(const QModelIndex &) )); |
|
485 connect(mImageStrip, SIGNAL( released(const QModelIndex &) ), this, SLOT( released(const QModelIndex &) )); |
|
486 } |
|
487 |
|
488 if ( mUiOffTimer ) { |
|
489 connect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi())); |
|
490 } |
|
491 //for Zoom |
|
492 if(mZmPushButton &&mZoomSlider) { |
|
493 connect(mZmPushButton, SIGNAL(clicked()), mZoomSlider, SLOT(toggleSliderVisibility())); |
|
494 } |
|
495 |
|
496 if(mFlipPushButton) |
|
497 { |
|
498 connect(mFlipPushButton, SIGNAL(clicked()), this, SLOT(showdetailsview()), Qt::QueuedConnection); |
|
499 } |
|
500 |
|
501 |
|
502 if(mZoomControl && mZoomSlider) { |
|
503 connect(mZoomSlider, SIGNAL(initialZoomFactor(int)), mZoomControl, SLOT(initialZoomFactor(int))); |
|
504 connect(mZoomSlider, SIGNAL(valueChanged(int)), mZoomControl, SLOT(zoomImage(int))); |
|
505 connect(mZoomControl, SIGNAL(hideFullScreenUi()), this, SLOT(hideUi())); |
|
506 } |
|
507 |
|
508 connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); |
|
509 } |
|
510 |
|
511 void GlxFullScreenView::removeConnection() |
|
512 { |
|
513 TRACER("GlxFullScreenView::removeConnection() " ); |
|
514 |
|
515 if ( mCoverFlow ) { |
|
516 GLX_LOG_INFO("GlxFullScreenView::removeConnection() mCoverFlow " ); |
|
517 disconnect( mCoverFlow, SIGNAL( coverFlowEvent( GlxCoverFlowEvent ) ), this, SLOT( coverFlowEventHandle( GlxCoverFlowEvent ) ) ); |
|
518 disconnect( mCoverFlow, SIGNAL(changeSelectedIndex(const QModelIndex &)), this, SLOT( changeSelectedIndex( const QModelIndex & ))); |
|
519 |
|
520 } |
|
521 |
|
522 //For Image Strip |
|
523 if ( mImageStrip ) { |
|
524 GLX_LOG_INFO("GlxFullScreenView::removeConnection() mImageStrip " ); |
|
525 disconnect(mImageStrip, SIGNAL( activated(const QModelIndex &) ), this, SLOT( indexChanged(const QModelIndex &) )); |
|
526 disconnect(mImageStrip, SIGNAL( scrollingStarted()), this, SLOT( scrollingStarted())); |
|
527 disconnect(mImageStrip, SIGNAL( scrollingEnded()), this, SLOT( scrollingEnded())); |
|
528 disconnect(mImageStrip, SIGNAL( pressed(const QModelIndex &) ), this, SLOT( pressed(const QModelIndex &) )); |
|
529 disconnect(mImageStrip, SIGNAL( released(const QModelIndex &) ), this, SLOT( released(const QModelIndex &) )); |
|
530 } |
|
531 |
|
532 if ( mUiOffTimer ) { |
|
533 GLX_LOG_INFO("GlxFullScreenView::removeConnection() mUiOffTimer " ); |
|
534 disconnect(mUiOffTimer, SIGNAL(timeout()), this, SLOT(hideUi())); |
|
535 } |
|
536 |
|
537 //for Zoom |
|
538 if(mZmPushButton &&mZoomSlider) { |
|
539 GLX_LOG_INFO("GlxFullScreenView::removeConnection() mZoomSlider " ); |
|
540 disconnect(mZmPushButton, SIGNAL(clicked()), mZoomSlider, SLOT(toggleSliderVisibility())); |
|
541 } |
|
542 |
|
543 if(mZoomControl &&mZoomSlider) { |
|
544 GLX_LOG_INFO("GlxFullScreenView::removeConnection() mZoomSlider " ); |
|
545 disconnect(mZoomSlider, SIGNAL(initialZoomFactor(int)), mZoomControl, SLOT(initialZoomFactor(int))); |
|
546 disconnect(mZoomSlider, SIGNAL(valueChanged(int)), mZoomControl, SLOT(zoomImage(int))); |
|
547 disconnect(mZoomControl, SIGNAL(hideFullScreenUi()), this, SLOT(hideUi())); |
|
548 } |
|
549 |
|
550 //for Details view launching |
|
551 if(mFlipPushButton) { |
|
552 GLX_LOG_INFO("GlxFullScreenView::removeConnection() mFlipPushButton " ); |
|
553 disconnect(mFlipPushButton, SIGNAL(clicked()), this, SLOT(showdetailsview())); |
|
554 } |
|
555 |
|
556 disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged(Qt::Orientation))); |
|
557 } |
|
558 |
|
559 void GlxFullScreenView::setImageStripModel() |
|
560 { |
|
561 TRACER("GlxFullScreenView::setImageStripModel()" ); |
|
562 if ( mModel && mImageStrip ) { |
|
563 mImageStrip->setModel( mModel ); |
|
564 QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole ); |
|
565 if ( variant.isValid() && variant.canConvert<int> () ) { |
|
566 mImageStrip->setCurrentIndex ( mModel->index( variant.value<int>(), 0) ); |
|
567 } |
|
568 } |
|
569 } |
|
570 |
|
571 GlxFullScreenView::~GlxFullScreenView() |
|
572 { |
|
573 TRACER("GlxFullScreenView::~GlxFullScreenView()" ); |
|
574 cleanUp(); |
|
575 |
|
576 if(mImageStrip) { |
|
577 GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mImageStrip " ); |
|
578 delete mImageStrip; |
|
579 mImageStrip = NULL; |
|
580 } |
|
581 |
|
582 if(mFlipPushButton) { |
|
583 GLX_LOG_INFO("GlxFullScreenView::cleanUp() delete mFlipPushButton " ); |
|
584 delete mFlipPushButton; |
|
585 mFlipPushButton = NULL; |
|
586 } |
|
587 |
|
588 if(mCoverFlow) { |
|
589 GLX_LOG_INFO("GlxFullScreenView::~GlxFullScreenView() delete mCoverFlow " ); |
|
590 delete mCoverFlow; |
|
591 mCoverFlow = NULL; |
|
592 } |
|
593 |
|
594 if(mDocLoader != NULL) |
|
595 { |
|
596 mDocLoader->reset(); |
|
597 delete mDocLoader; |
|
598 } |
|
599 HbEffect::remove( QString("HbGridView"), QString(":/data/transitionup.fxml"), QString( "TapShow" )); |
|
600 HbEffect::remove( QString("HbGridView"), QString(":/data/transitiondown.fxml"), QString( "TapHide" )); |
|
601 } |
|
602 |
|
603 void GlxFullScreenView::showdetailsview() |
|
604 { |
|
605 TRACER("GlxFullScreenView::showdetailsview()" ); |
|
606 //trigger the details view to be shown |
|
607 emit actionTriggered( EGlxCmdDetailsOpen ); |
|
608 } |
|
609 |
|
610 void GlxFullScreenView::handleUserAction(qint32 commandId) |
|
611 { |
|
612 TRACER("GlxFullScreenView::handleUserAction()" ); |
|
613 switch( commandId ) |
|
614 { |
|
615 case EGlxCmdRotate : |
|
616 //trigger the rotate Effect in CoverFlow |
|
617 mCoverFlow->rotateImage(); |
|
618 break; |
|
619 case EGlxCmdSend: |
|
620 { |
|
621 QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>(); |
|
622 if(imagePath.isNull()) |
|
623 { |
|
624 GLX_LOG_INFO("GlxFullScreenView::SendUi() path is null" ); |
|
625 } |
|
626 qDebug() << "GlxFullScreenView::SendUi() imagePath= " << imagePath; |
|
627 |
|
628 ShareUi dialog; |
|
629 QList <QVariant> fileList; |
|
630 fileList.append(QVariant(imagePath)); |
|
631 dialog.init(fileList,true); |
|
632 } |
|
633 break; |
|
634 default : |
|
635 break; |
|
636 } |
|
637 } |
|
638 |
|
639 void GlxFullScreenView::SetImageToHdmiL() |
|
640 { |
|
641 TRACER("GlxFullScreenView::SetImageToHdmiL() - CGlxHdmi 1" ); |
|
642 if (iHdmiController) |
|
643 { |
|
644 GLX_LOG_INFO("GlxFullScreenView::SetImageToHdmiL() - CGlxHdmi 2" ); |
|
645 // Get the image uri |
|
646 QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>(); |
|
647 if(imagePath.isNull()) |
|
648 { |
|
649 GLX_LOG_INFO("GlxFullScreenView::SetImageToHdmiL() path is null" ); |
|
650 } |
|
651 qDebug() << "GlxFullScreenView::SetImageToHdmiL() imagePath= " << imagePath; |
|
652 TPtrC aPtr = reinterpret_cast<const TUint16*>(imagePath.utf16()); |
|
653 |
|
654 // Get the image Dimensions |
|
655 QSize imageDimension = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxDimensionsRole)).value<QSize>(); |
|
656 TSize imageSize(imageDimension.width(),imageDimension.height()); |
|
657 |
|
658 // Get the framecount |
|
659 int frameCount = (mModel->data(mModel->index(mModel->data(mModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxFrameCount)).value<int>(); |
|
660 iHdmiController->SetImageL(aPtr,imageSize, frameCount); |
|
661 } |
|
662 } |