28 #include <xqserviceutil.h> |
28 #include <xqserviceutil.h> |
29 #include <hbcheckbox.h> |
29 #include <hbcheckbox.h> |
30 #include <hblabel.h> |
30 #include <hblabel.h> |
31 #include <QString> |
31 #include <QString> |
32 #include <hbframeitem.h> |
32 #include <hbframeitem.h> |
|
33 #include <hbgroupbox.h> |
|
34 #include <hbparameterlengthlimiter.h> |
|
35 #include <QGraphicsLinearLayout> |
33 |
36 |
34 //User Includes |
37 //User Includes |
35 #include "glxviewids.h" |
38 #include "glxviewids.h" |
36 #include "glxgridview.h" |
39 #include "glxgridview.h" |
37 #include "glxmodelparm.h" |
40 #include "glxmodelparm.h" |
38 #include "glxcommandhandlers.hrh" |
41 #include "glxcommandhandlers.hrh" |
39 #include "glxicondefs.h" |
42 #include "glxicondefs.h" |
40 #include "glxlocalisationstrings.h" |
43 #include "glxlocalisationstrings.h" |
41 #include "glxsettinginterface.h" |
44 #include "glxsettinginterface.h" |
42 |
45 |
|
46 |
43 #include "OstTraceDefinitions.h" |
47 #include "OstTraceDefinitions.h" |
44 #ifdef OST_TRACE_COMPILER_IN_USE |
48 #ifdef OST_TRACE_COMPILER_IN_USE |
45 #include "glxgridviewTraces.h" |
49 #include "glxgridviewTraces.h" |
46 #endif |
50 #endif |
47 |
51 |
50 mWindow(window), |
54 mWindow(window), |
51 mModel ( NULL), |
55 mModel ( NULL), |
52 mWidget(NULL), |
56 mWidget(NULL), |
53 mSelectionModel(NULL), |
57 mSelectionModel(NULL), |
54 mModelWrapper(NULL), |
58 mModelWrapper(NULL), |
55 mUiOnButton(NULL), |
59 mUiOnButton(NULL), |
56 mCameraButton(NULL), |
|
57 mScrolling(FALSE), |
60 mScrolling(FALSE), |
58 mIconItem(NULL), |
61 mIconItem(NULL), |
59 mMarkCheckBox(NULL), |
62 mMarkCheckBox(NULL), |
60 mCountItem(NULL), |
63 mTotalImagesCount(NULL), |
61 mMainLabel(NULL), |
64 mMarkSelectHeading(NULL), |
62 mCountLabel(NULL), |
65 mMarkCountLabel(NULL), |
63 mZeroItemLabel(NULL), |
66 mZeroItemLabel(NULL), |
64 mAlbumName(NULL) |
67 mAlbumNameHeading(NULL), |
|
68 mMarkContainer(NULL), |
|
69 mMarkingWidget(NULL) |
65 { |
70 { |
66 OstTraceFunctionEntry0( GLXGRIDVIEW_GLXGRIDVIEW_ENTRY ); |
71 OstTraceFunctionEntry0( GLXGRIDVIEW_GLXGRIDVIEW_ENTRY ); |
67 mModelWrapper = new GlxModelWrapper(); |
72 mModelWrapper = new GlxModelWrapper(); |
68 mModelWrapper->setRoles(GlxQImageSmall); |
73 mModelWrapper->setRoles(GlxQImageSmall); |
69 mIconItem = new HbIconItem(this); |
74 mIconItem = new HbIconItem(this); |
70 mSettings = GlxSettingInterface::instance() ; |
75 mSettings = GlxSettingInterface::instance() ; |
|
76 |
|
77 mUiOnButton = new HbPushButton(this); |
|
78 connect(mUiOnButton, SIGNAL(clicked(bool)), this, SLOT(uiButtonClicked(bool))); |
|
79 mUiOnButton->setGeometry(QRectF(590,0,40,40)); |
|
80 mUiOnButton->setZValue(1); |
|
81 mUiOnButton->setIcon(HbIcon(GLXICON_WALL_UI_ON)); |
|
82 mUiOnButton->setObjectName( "UiOn Button" ); |
|
83 |
71 OstTraceFunctionExit0( GLXGRIDVIEW_GLXGRIDVIEW_EXIT ); |
84 OstTraceFunctionExit0( GLXGRIDVIEW_GLXGRIDVIEW_EXIT ); |
72 } |
85 } |
73 |
86 |
74 void GlxGridView::activate() |
87 void GlxGridView::activate() |
75 { |
88 { |
76 OstTraceFunctionEntry0( GLXGRIDVIEW_ACTIVATE_ENTRY ); |
89 OstTraceFunctionEntry0( GLXGRIDVIEW_ACTIVATE_ENTRY ); |
77 loadGridView(); |
90 loadGridView(); |
78 connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationchanged(Qt::Orientation)),Qt::UniqueConnection); |
91 connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationchanged(Qt::Orientation)),Qt::UniqueConnection); |
79 if(mCountItem == NULL) { |
92 if(mTotalImagesCount == NULL) { |
80 mCountItem = new HbLabel(this); |
93 mTotalImagesCount = new HbGroupBox(this); |
81 mCountItem->setObjectName( "Count" ); |
94 mTotalImagesCount->setObjectName( "Count" ); |
82 HbFrameItem *frame = new HbFrameItem(this); //graphics for mCountItem |
95 mTotalImagesCount->hide(); |
83 frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
84 frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); |
|
85 frame->graphicsItem()->setOpacity(1); |
|
86 mCountItem->setBackgroundItem(frame->graphicsItem(),-1); |
|
87 mCountItem->hide(); |
|
88 } |
96 } |
89 OstTraceFunctionExit0( GLXGRIDVIEW_ACTIVATE_EXIT ); |
97 OstTraceFunctionExit0( GLXGRIDVIEW_ACTIVATE_EXIT ); |
90 } |
98 } |
91 |
99 |
92 void GlxGridView::deActivate() |
100 void GlxGridView::deActivate() |
100 mIconItem->hide(); |
108 mIconItem->hide(); |
101 mIconItem->resetTransform(); |
109 mIconItem->resetTransform(); |
102 mIconItem->setOpacity(0); |
110 mIconItem->setOpacity(0); |
103 mIconItem->setZValue(mIconItem->zValue()-20); |
111 mIconItem->setZValue(mIconItem->zValue()-20); |
104 } |
112 } |
105 if (mCountItem) { |
113 if (mTotalImagesCount) { |
106 mCountItem->hide(); |
114 mTotalImagesCount->hide(); |
107 } |
115 } |
108 if (mAlbumName) { |
116 if (mAlbumNameHeading) { |
109 mAlbumName->hide(); |
117 mAlbumNameHeading->hide(); |
110 } |
118 } |
111 if(mZeroItemLabel) { |
119 if(mZeroItemLabel) { |
112 mZeroItemLabel->hide(); |
120 mZeroItemLabel->hide(); |
113 } |
121 } |
114 if(mCameraButton) { |
122 |
115 mCameraButton->hide(); |
|
116 } |
|
117 disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationchanged(Qt::Orientation))); |
123 disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationchanged(Qt::Orientation))); |
118 OstTraceFunctionExit0( GLXGRIDVIEW_DEACTIVATE_EXIT ); |
124 OstTraceFunctionExit0( GLXGRIDVIEW_DEACTIVATE_EXIT ); |
119 } |
125 } |
120 |
126 |
121 void GlxGridView::initializeView( QAbstractItemModel *model, GlxView *preView ) |
127 void GlxGridView::initializeView( QAbstractItemModel *model, GlxView *preView ) |
141 { |
147 { |
142 if ( mModel ) { |
148 if ( mModel ) { |
143 connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(showItemCount())); |
149 connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(showItemCount())); |
144 connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(showItemCount())); |
150 connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(showItemCount())); |
145 connect(mModel, SIGNAL(destroyed()), this, SLOT( clearCurrentModel())); |
151 connect(mModel, SIGNAL(destroyed()), this, SLOT( clearCurrentModel())); |
146 connect(mModel, SIGNAL(albumTitleAvailable(QString)), this, SLOT(showAlbumTitle(QString))); |
152 if(getSubState() == ALBUM_ITEM_S){ |
|
153 connect(mModel, SIGNAL(albumTitleAvailable(QString)), this, SLOT(showAlbumTitle(QString))); |
|
154 } |
147 connect(mModel, SIGNAL(populated()), this, SLOT( populated())); |
155 connect(mModel, SIGNAL(populated()), this, SLOT( populated())); |
148 } |
156 } |
149 } |
157 } |
150 |
158 |
151 void GlxGridView::setModel(QAbstractItemModel *model) |
159 void GlxGridView::setModel(QAbstractItemModel *model) |
189 |
197 |
190 void GlxGridView::addToolBar( HbToolBar *toolBar ) |
198 void GlxGridView::addToolBar( HbToolBar *toolBar ) |
191 { |
199 { |
192 OstTraceFunctionEntry0( GLXGRIDVIEW_ADDTOOLBAR_ENTRY ); |
200 OstTraceFunctionEntry0( GLXGRIDVIEW_ADDTOOLBAR_ENTRY ); |
193 setToolBar(toolBar); |
201 setToolBar(toolBar); |
194 hideorshowitems(mWindow->orientation()); |
202 showHbItems(); |
195 OstTraceFunctionExit0( GLXGRIDVIEW_ADDTOOLBAR_EXIT ); |
203 OstTraceFunctionExit0( GLXGRIDVIEW_ADDTOOLBAR_EXIT ); |
196 } |
204 } |
197 |
205 |
198 void GlxGridView::enableMarking() |
206 void GlxGridView::enableMarking() |
199 { |
207 { |
200 OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_ENABLEMARKING, "GlxGridView::enableMarking" ); |
208 OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_ENABLEMARKING, "GlxGridView::enableMarking" ); |
201 mWidget->setSelectionMode(HgWidget::MultiSelection); |
209 mWidget->setSelectionMode(HgWidget::MultiSelection); |
202 if (mMainLabel == NULL) { |
210 |
203 mMainLabel = new HbLabel("Select Photos", this); |
211 if (mMarkingWidget == NULL) |
204 mMainLabel->setObjectName( "Select Photos"); |
212 { |
205 HbFrameItem *frame1 = new HbFrameItem(this); //graphics for mMainLabel |
213 mMarkingWidget = new HbWidget(this); |
206 frame1->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
214 mMarkContainer = new QGraphicsLinearLayout(Qt::Horizontal, 0); |
207 frame1->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); |
215 mMarkingWidget->setLayout(mMarkContainer); |
208 frame1->graphicsItem()->setOpacity(1); |
216 |
209 mMainLabel->setBackgroundItem(frame1->graphicsItem(),-1); |
217 mMarkSelectHeading = new HbGroupBox(this); |
210 } |
218 mMarkSelectHeading->setHeading(GLX_SELECT_IMAGES); |
211 if (mMarkCheckBox == NULL) { |
219 mMarkSelectHeading->setObjectName("Select Photos"); |
212 mMarkCheckBox = new HbCheckBox(GLX_OPTION_MARK_ALL, this); |
220 |
213 mMarkCheckBox->setObjectName( "CheckB MarkAll" ); |
221 mMarkCountLabel = new HbLabel(mMarkingWidget); |
214 HbFrameItem *frame2 = new HbFrameItem(this); //graphics for mMarkCheckBox |
222 mMarkCountLabel->setObjectName("MarkCount"); |
215 frame2->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
223 mMarkCountLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); |
216 frame2->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); |
224 |
217 frame2->graphicsItem()->setOpacity(1); |
225 mMarkCheckBox = new HbCheckBox(GLX_LABEL_MARK_ALL, mMarkingWidget); |
218 mMarkCheckBox->setBackgroundItem(frame2->graphicsItem(),-1); |
226 mMarkCheckBox->setObjectName("CheckB MarkAll"); |
219 } |
227 |
220 if (mCountLabel == NULL) { |
228 mMarkContainer->addItem(mMarkCheckBox); |
221 mCountLabel = new HbLabel(this); |
229 mMarkContainer->addItem(mMarkCountLabel); |
222 mCountLabel->setObjectName( "MarkCount" ); |
230 } |
223 HbFrameItem *frame3 = new HbFrameItem(this); //graphics for mCountLabel |
|
224 frame3->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
225 frame3->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); |
|
226 frame3->graphicsItem()->setOpacity(1); |
|
227 mCountLabel->setBackgroundItem(frame3->graphicsItem(),-1); |
|
228 } |
|
229 |
231 |
230 hideorshowitems(mWindow->orientation()); |
232 hideorshowitems(mWindow->orientation()); |
231 |
233 |
232 connect( mWidget->selectionModel() , SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection& ) ), this, SLOT( showMarkedItemCount() ) ); |
234 connect( mWidget->selectionModel() , SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection& ) ), this, SLOT( showMarkedItemCount() ) ); |
233 connect(mMarkCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( stateChanged(int))); |
235 connect(mMarkCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( stateChanged(int))); |
238 { |
240 { |
239 OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_DISABLEMARKING, "GlxGridView::disableMarking" ); |
241 OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_DISABLEMARKING, "GlxGridView::disableMarking" ); |
240 mWidget->setSelectionMode(HgWidget::NoSelection); |
242 mWidget->setSelectionMode(HgWidget::NoSelection); |
241 disconnect( mWidget->selectionModel() , SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection& ) ), this, SLOT( showMarkedItemCount() ) ); |
243 disconnect( mWidget->selectionModel() , SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection& ) ), this, SLOT( showMarkedItemCount() ) ); |
242 disconnect(mMarkCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( stateChanged(int))); |
244 disconnect(mMarkCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( stateChanged(int))); |
243 if (mMainLabel) { |
245 |
244 mMainLabel->hide(); |
246 if (mMarkSelectHeading) { |
245 } |
247 mMarkSelectHeading->hide(); |
246 if (mMarkCheckBox) { |
248 } |
247 mMarkCheckBox->setCheckState(Qt::Unchecked); |
249 |
248 mMarkCheckBox->hide(); |
250 if (mMarkingWidget) { |
249 } |
251 mMarkingWidget->hide(); |
250 if (mCountLabel) { |
252 } |
251 mCountLabel->hide(); |
253 |
252 } |
254 showHbItems(); |
253 |
|
254 hideorshowitems(mWindow->orientation()); |
|
255 } |
255 } |
256 |
256 |
257 void GlxGridView::stateChanged(int state) |
257 void GlxGridView::stateChanged(int state) |
258 { |
258 { |
259 if(state) |
259 if(state) |
282 : QSize( deviceSize.height(), deviceSize.width() ) ; |
283 : QSize( deviceSize.height(), deviceSize.width() ) ; |
283 if(count) { |
284 if(count) { |
284 if(mZeroItemLabel) { |
285 if(mZeroItemLabel) { |
285 mZeroItemLabel->hide(); |
286 mZeroItemLabel->hide(); |
286 } |
287 } |
287 if(mCameraButton) { |
288 |
288 mCameraButton->hide(); |
|
289 } |
|
290 if(isItemVisible(Hb::TitleBarItem)) { |
289 if(isItemVisible(Hb::TitleBarItem)) { |
291 QString text; |
290 QString text; |
292 if(XQServiceUtil::isService()) |
291 if(XQServiceUtil::isService()) |
293 { |
292 { |
294 showAlbumTitle(GLX_FETCHER_TITLE); |
293 showAlbumTitle(GLX_SELECT_IMAGE); |
295 } |
294 } |
296 else if (getSubState() == ALL_ITEM_S) { |
295 else if (getSubState() == ALL_ITEM_S) { |
297 if (mAlbumName) { |
296 if (mAlbumNameHeading) { |
298 mAlbumName->hide(); |
297 mAlbumNameHeading->hide(); |
299 } |
298 } |
300 mCountItem->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24)); |
299 mTotalImagesCount->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24)); |
301 text = QString("%1 Items").arg( count ); |
300 text = HbParameterLengthLimiter(GLX_GRID_VIEW_COUNT_LABEL, count); |
302 mCountItem->setPlainText( text ); |
301 mTotalImagesCount->setHeading ( text ); |
303 mCountItem->setAlignment(Qt::AlignLeft); |
302 mTotalImagesCount->show(); |
304 mCountItem->show(); |
|
305 } |
303 } |
306 else if (getSubState() == ALBUM_ITEM_S) { |
304 else if (getSubState() == ALBUM_ITEM_S) { |
307 mCountItem->hide(); |
305 mTotalImagesCount->hide(); |
308 QVariant variant = mModel->data(mModel->index(0,0),GlxViewTitle); |
306 QVariant variant = mModel->data(mModel->index(0,0),GlxViewTitle); |
309 if (variant.toString() != NULL) { |
307 if (variant.toString() != NULL) { |
310 showAlbumTitle(variant.toString()); |
308 showAlbumTitle(variant.toString()); |
311 } |
309 } |
312 } |
310 } |
313 } |
311 } |
314 else { |
312 else { |
315 if (mCountItem) { |
313 if (mTotalImagesCount) { |
316 mCountItem->hide(); |
314 mTotalImagesCount->hide(); |
317 } |
315 } |
318 if (mAlbumName) { |
316 if (mAlbumNameHeading) { |
319 mAlbumName->hide(); |
317 mAlbumNameHeading->hide(); |
320 } |
318 } |
321 } |
319 } |
322 |
320 |
323 } |
321 } |
324 else { |
322 else { |
353 { |
351 { |
354 int count = mModel->rowCount(); |
352 int count = mModel->rowCount(); |
355 QSize deviceSize = HbDeviceProfile::current().logicalSize(); |
353 QSize deviceSize = HbDeviceProfile::current().logicalSize(); |
356 QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() ) |
354 QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() ) |
357 : QSize( deviceSize.height(), deviceSize.width() ) ; |
355 : QSize( deviceSize.height(), deviceSize.width() ) ; |
358 if(mAlbumName == NULL) { |
356 if (mAlbumNameHeading == NULL) |
359 mAlbumName = new HbLabel(this); |
357 { |
360 mAlbumName->setObjectName( "Album Name" ); |
358 mAlbumNameHeading = new HbGroupBox(this); |
361 HbFrameItem *frame = new HbFrameItem(this); //graphics for mAlbumName |
359 mAlbumNameHeading->setObjectName("Album Name"); |
362 frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
360 } |
363 frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans"); |
361 |
364 frame->graphicsItem()->setOpacity(1); |
362 //If fetcher service set only title text |
365 mAlbumName->setBackgroundItem(frame->graphicsItem(),-1); |
363 if ((XQServiceUtil::isService()) && isItemVisible(Hb::TitleBarItem)) |
366 } |
364 { |
367 |
365 mAlbumNameHeading->setGeometry(QRectF(0, 0, screenSize.width(),deviceSize.height() / 24)); |
368 //If fetcher service set only title text |
366 mAlbumNameHeading->setHeading(aTitle); |
369 if((XQServiceUtil::isService() ) && isItemVisible(Hb::TitleBarItem)) { |
367 mAlbumNameHeading->show(); |
370 mAlbumName->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24)); |
368 } |
371 QString text = QString(aTitle); |
369 else |
372 mAlbumName->setPlainText( text ); |
370 { //handle album tiltle and count display logic here |
373 mAlbumName->show(); |
371 if (count && isItemVisible(Hb::TitleBarItem)) |
374 } |
372 { |
375 else{ //handle album tiltle and count display logic here |
373 mAlbumNameHeading->setGeometry(QRectF(0, 0, screenSize.width(),deviceSize.height() / 24)); |
376 if( count && isItemVisible(Hb::TitleBarItem)) { |
374 QString text = HbParameterLengthLimiter(GLX_ALBUM_NAME_COUNT_LABEL).arg(aTitle).arg(count); |
377 mAlbumName->setGeometry(QRectF(0,0,screenSize.width()/2,deviceSize.height()/24)); |
375 mAlbumNameHeading->setHeading(text); |
378 QString text = QString(aTitle); |
376 mAlbumNameHeading->show(); |
379 mAlbumName->setPlainText( text ); |
377 } |
380 mAlbumName->show(); |
378 } |
381 mCountItem->setGeometry(QRectF(screenSize.width()/2,0,screenSize.width()/2,deviceSize.height()/24)); |
|
382 text = QString("(%1)").arg(count); |
|
383 mCountItem->setPlainText( text ); |
|
384 mCountItem->setAlignment(Qt::AlignRight); |
|
385 mCountItem->show(); |
|
386 } |
|
387 else if((!count) && isItemVisible(Hb::TitleBarItem)) { |
|
388 mAlbumName->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24)); |
|
389 QString text = QString(aTitle); |
|
390 mAlbumName->setPlainText( text ); |
|
391 mAlbumName->show(); |
|
392 } |
|
393 } |
|
394 } |
379 } |
395 |
380 |
396 void GlxGridView::showNoImageString() |
381 void GlxGridView::showNoImageString() |
397 { |
382 { |
398 qreal chromeHeight = 0.0; |
383 qreal chromeHeight = 0.0; |
404 style()->parameter("hb-param-widget-chrome-height", chromeHeight); |
389 style()->parameter("hb-param-widget-chrome-height", chromeHeight); |
405 midHeight -= chromeHeight; |
390 midHeight -= chromeHeight; |
406 } |
391 } |
407 if (mZeroItemLabel == NULL) { |
392 if (mZeroItemLabel == NULL) { |
408 QString displayText(GLX_GRID_NO_IMAGE); |
393 QString displayText(GLX_GRID_NO_IMAGE); |
409 if(!XQServiceUtil::isService()) |
|
410 { |
|
411 displayText.append(GLX_GRID_OPEN_CAMERA); |
|
412 } |
|
413 mZeroItemLabel = new HbLabel(displayText, this); |
394 mZeroItemLabel = new HbLabel(displayText, this); |
414 mZeroItemLabel->setObjectName( "No Image" ); |
395 mZeroItemLabel->setObjectName( "No Image" ); |
415 } |
396 } |
416 mZeroItemLabel->setGeometry(QRectF(0, midHeight - deviceSize.height()/16, screenSize.width(), 3*deviceSize.height()/32)); |
397 mZeroItemLabel->setGeometry(QRectF(0, midHeight - deviceSize.height()/16, screenSize.width(), 3*deviceSize.height()/32)); |
417 mZeroItemLabel->setAlignment(Qt::AlignHCenter); |
398 mZeroItemLabel->setAlignment(Qt::AlignHCenter); |
418 mZeroItemLabel->show(); |
399 mZeroItemLabel->show(); |
419 if (mCameraButton == NULL) { |
400 |
420 mCameraButton = new HbPushButton(this); |
|
421 mCameraButton->setObjectName( "Camera Button" ); |
|
422 mCameraButton->setIcon(HbIcon(GLXICON_CAMERA)); |
|
423 mCameraButton->hide(); |
|
424 connect(mCameraButton, SIGNAL(clicked(bool)), this, SLOT(cameraButtonClicked(bool))); |
|
425 } |
|
426 if(!XQServiceUtil::isService()) |
|
427 { |
|
428 mCameraButton->setGeometry(QRectF(screenSize.width()/2 - 3*deviceSize.height()/64, midHeight + deviceSize.height()/32, deviceSize.height()/32, deviceSize.height()/32)); |
|
429 mCameraButton->show(); |
|
430 } |
|
431 } |
401 } |
432 |
402 |
433 void GlxGridView::populated() |
403 void GlxGridView::populated() |
434 { |
404 { |
435 QVariant variant = mModelWrapper->data(mModelWrapper->index(0,0), GlxVisualWindowIndex ); |
405 QVariant variant = mModelWrapper->data(mModelWrapper->index(0,0), GlxVisualWindowIndex ); |
551 { |
521 { |
552 mWidget->setEffect3dEnabled(mSettings->mediaWall3DEffect()); |
522 mWidget->setEffect3dEnabled(mSettings->mediaWall3DEffect()); |
553 } |
523 } |
554 setWidget( mWidget ); |
524 setWidget( mWidget ); |
555 addViewConnection(); |
525 addViewConnection(); |
|
526 } |
|
527 OstTraceFunctionExit0( GLXGRIDVIEW_LOADGRIDVIEW_EXIT ); |
|
528 } |
|
529 |
|
530 void GlxGridView::orientationchanged(Qt::Orientation orient) |
|
531 { |
|
532 if (mWidget && mWidget->selectionMode() == HgWidget::MultiSelection) { |
556 hideorshowitems(orient); |
533 hideorshowitems(orient); |
557 } |
534 } |
558 OstTraceFunctionExit0( GLXGRIDVIEW_LOADGRIDVIEW_EXIT ); |
535 showHbItems(); |
559 } |
536 } |
560 |
537 |
561 void GlxGridView::orientationchanged(Qt::Orientation orient) |
|
562 { |
|
563 hideorshowitems(orient); |
|
564 } |
|
565 void GlxGridView::hideorshowitems(Qt::Orientation orient) |
538 void GlxGridView::hideorshowitems(Qt::Orientation orient) |
566 { |
539 { |
567 if ( mWidget && mWidget->selectionMode() == HgWidget::NoSelection ) { |
540 if ( mWidget && mWidget->selectionMode() == HgWidget::NoSelection ) { |
568 if( orient == Qt::Horizontal ) { |
541 if( orient == Qt::Horizontal ) { |
569 setItemVisible(Hb::AllItems, FALSE) ; |
542 setItemVisible(Hb::AllItems, FALSE) ; |
582 else { |
555 else { |
583 showHbItems(); |
556 showHbItems(); |
584 } |
557 } |
585 } |
558 } |
586 else if (mWidget && mWidget->selectionMode() == HgWidget::MultiSelection) { |
559 else if (mWidget && mWidget->selectionMode() == HgWidget::MultiSelection) { |
587 setItemVisible(Hb::TitleBarItem, FALSE) ; |
560 setItemVisible(Hb::AllItems, FALSE) ; |
|
561 setViewFlags(viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden); |
588 if (mUiOnButton) { |
562 if (mUiOnButton) { |
589 mUiOnButton->hide(); |
563 mUiOnButton->hide(); |
590 } |
564 } |
591 if (mCountItem) { |
565 if (mTotalImagesCount) { |
592 mCountItem->hide(); |
566 mTotalImagesCount->hide(); |
593 } |
567 } |
594 if (mAlbumName) { |
568 if (mAlbumNameHeading) { |
595 mAlbumName->hide(); |
569 mAlbumNameHeading->hide(); |
596 } |
570 } |
|
571 |
597 QSize deviceSize = HbDeviceProfile::current().logicalSize(); |
572 QSize deviceSize = HbDeviceProfile::current().logicalSize(); |
598 QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() ) |
573 QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() ) |
599 : QSize( deviceSize.height(), deviceSize.width() ) ; |
574 : QSize( deviceSize.height(), deviceSize.width() ) ; |
600 mMainLabel->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24)); |
575 |
601 mMarkCheckBox->setGeometry(QRectF(0,deviceSize.height()/24,screenSize.width()/2,deviceSize.height()/72)); |
576 mMarkSelectHeading->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24)); |
602 mCountLabel->setGeometry(QRectF(screenSize.width()/2,deviceSize.height()/24,screenSize.width()/2,deviceSize.height()/12 - 3)); |
577 mMarkingWidget->setGeometry(QRectF(0,deviceSize.height()/24,screenSize.width(),deviceSize.height()/72)); |
603 mCountLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); |
578 |
604 mMainLabel->show(); |
579 mMarkSelectHeading->show(); |
605 mMarkCheckBox->show(); |
580 mMarkingWidget->show(); |
606 mCountLabel->show(); |
581 |
607 showMarkedItemCount(); |
582 showMarkedItemCount(); |
|
583 |
608 } |
584 } |
609 } |
585 } |
610 |
586 |
611 void GlxGridView::scrolltofocus() |
587 void GlxGridView::scrolltofocus() |
612 { |
588 { |
652 { |
628 { |
653 OstTrace1( TRACE_NORMAL, GLXGRIDVIEW_ITEMSELECTED, "GlxGridView::itemSelected;index=%d", index.row() ); |
629 OstTrace1( TRACE_NORMAL, GLXGRIDVIEW_ITEMSELECTED, "GlxGridView::itemSelected;index=%d", index.row() ); |
654 if ( mWidget->selectionMode() == HgWidget::MultiSelection ) { |
630 if ( mWidget->selectionMode() == HgWidget::MultiSelection ) { |
655 return ; |
631 return ; |
656 } |
632 } |
657 if(XQServiceUtil::isService()){ |
|
658 emit gridItemSelected(index); |
|
659 return; |
|
660 } |
|
661 OstTraceEventStart0( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START, "Fullscreen Launch Time" ); |
633 OstTraceEventStart0( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START, "Fullscreen Launch Time" ); |
662 if ( mModel ) { |
634 if ( mModel ) { |
663 mModel->setData( index, index.row(), GlxFocusIndexRole ); |
635 mModel->setData( index, index.row(), GlxFocusIndexRole ); |
664 } |
636 } |
|
637 if(XQServiceUtil::isService()){ |
|
638 qDebug("GlxGridView::itemSelected actionTriggered( EGlxCmdFetcherSelect )" ); |
|
639 emit actionTriggered( EGlxCmdFetcherSelect ); |
|
640 return; |
|
641 } |
665 emit actionTriggered( EGlxCmdFullScreenOpen ); |
642 emit actionTriggered( EGlxCmdFullScreenOpen ); |
666 OstTraceEventStop( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_STOP, "Fullscreen Launch Time", EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START ); |
643 OstTraceEventStop( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_STOP, "Fullscreen Launch Time", EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START ); |
667 } |
644 } |
668 |
645 |
669 void GlxGridView::scrollingStarted() |
646 void GlxGridView::scrollingStarted() |
670 { |
647 { |
671 if ((mWindow->orientation() == Qt::Horizontal) && mWidget->selectionMode() == HgWidget::NoSelection) |
648 if ((mWindow->orientation() == Qt::Horizontal)/* && mWidget->selectionMode() == HgWidget::NoSelection*/) |
672 { |
649 { |
673 setItemVisible(Hb::AllItems, FALSE) ; |
650 setItemVisible(Hb::AllItems, FALSE) ; |
674 setViewFlags(viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden); |
651 setViewFlags(viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden); |
675 if (mUiOnButton) |
652 if (mUiOnButton) |
676 { |
653 { |
677 mUiOnButton->hide(); |
654 mUiOnButton->hide(); |
678 } |
655 } |
679 if (mCountItem) { |
656 if (mTotalImagesCount) { |
680 mCountItem->hide(); |
657 mTotalImagesCount->hide(); |
681 } |
658 } |
682 if (mAlbumName) { |
659 if (mAlbumNameHeading) { |
683 mAlbumName->hide(); |
660 mAlbumNameHeading->hide(); |
684 } |
661 } |
685 } |
662 } |
686 |
663 |
687 mScrolling = TRUE; |
664 mScrolling = TRUE; |
688 } |
665 } |
724 delete mModelWrapper; |
701 delete mModelWrapper; |
725 if(mUiOnButton) { |
702 if(mUiOnButton) { |
726 disconnect(mUiOnButton, SIGNAL(clicked(bool)), this, SLOT(uiButtonClicked(bool))); |
703 disconnect(mUiOnButton, SIGNAL(clicked(bool)), this, SLOT(uiButtonClicked(bool))); |
727 delete mUiOnButton; |
704 delete mUiOnButton; |
728 } |
705 } |
729 if(mCameraButton) { |
706 |
730 disconnect(mCameraButton, SIGNAL(clicked()), this, SLOT(cameraButtonClicked())); |
|
731 delete mCameraButton; |
|
732 } |
|
733 delete mIconItem; |
707 delete mIconItem; |
734 delete mCountItem; |
708 delete mTotalImagesCount; |
735 delete mAlbumName; |
709 delete mAlbumNameHeading; |
736 delete mMainLabel; |
710 delete mMarkSelectHeading; |
737 delete mMarkCheckBox; |
711 delete mMarkCheckBox; |
738 delete mCountLabel; |
712 delete mMarkCountLabel; |
|
713 delete mMarkingWidget; |
739 delete mZeroItemLabel; |
714 delete mZeroItemLabel; |
|
715 |
740 OstTraceFunctionExit0( DUP1_GLXGRIDVIEW_GLXGRIDVIEW_EXIT ); |
716 OstTraceFunctionExit0( DUP1_GLXGRIDVIEW_GLXGRIDVIEW_EXIT ); |
741 } |
717 } |
742 |
718 |
743 void GlxGridView::indicateLongPress(const QModelIndex& index, QPointF coords) |
719 void GlxGridView::indicateLongPress(const QModelIndex& index, QPointF coords) |
744 { |
720 { |
760 showHbItems(); |
736 showHbItems(); |
761 } |
737 } |
762 |
738 |
763 void GlxGridView::showHbItems() |
739 void GlxGridView::showHbItems() |
764 { |
740 { |
765 setItemVisible(Hb::AllItems, TRUE) ; |
741 if(mWidget && mWidget->selectionMode() == HgWidget::NoSelection) { |
766 setViewFlags(viewFlags() &~ HbView::ViewTitleBarHidden &~ HbView::ViewStatusBarHidden); |
742 setItemVisible( Hb::TitleBarItem, TRUE ); |
|
743 setItemVisible( Hb::StatusBarItem, TRUE ); |
|
744 setViewFlags(viewFlags() &~ HbView::ViewTitleBarHidden &~ HbView::ViewStatusBarHidden); |
767 showItemCount(); |
745 showItemCount(); |
768 toolBar()->resetTransform(); // Temp, this is for HbToolbar issue to get fixed |
746 } |
769 toolBar()->show(); |
747 updateToolBar(); |
770 if (mUiOnButton) |
748 if (mUiOnButton) { |
771 { |
|
772 mUiOnButton->hide(); |
749 mUiOnButton->hide(); |
773 } |
750 } |
774 } |
751 } |
775 |
752 |
776 void GlxGridView::cameraButtonClicked(bool /*checked*/) |
753 void GlxGridView::cameraButtonClicked(bool /*checked*/) |
777 { |
754 { |
778 emit actionTriggered(EGlxCmdCameraOpen); |
755 emit actionTriggered(EGlxCmdCameraOpen); |
779 } |
756 } |
780 |
757 |
781 int GlxGridView::getSubState() |
758 int GlxGridView::getSubState() |
782 { |
759 { |
783 int substate = NO_GRID_S; |
760 int substate = NO_GRID_S; |
784 QVariant variant = mModel->data( mModel->index(0,0), GlxSubStateRole ); |
761 if ( mModel ) { |
785 if ( variant.isValid() && variant.canConvert<int> () ) { |
762 QVariant variant = mModel->data( mModel->index(0,0), GlxSubStateRole ); |
786 substate = variant.value<int>(); |
763 if ( variant.isValid() && variant.canConvert<int> () ) { |
|
764 substate = variant.value<int>(); |
|
765 } |
787 } |
766 } |
788 return substate; |
767 return substate; |
789 } |
768 } |
790 |
769 |
|
770 void GlxGridView::updateToolBar() |
|
771 { |
|
772 //In the case of multiselection show the tool bar. |
|
773 if ( mWidget && mWidget->selectionMode() == HgWidget::MultiSelection ) { |
|
774 setItemVisible( Hb::ToolBarItem, TRUE ) ; |
|
775 return ; |
|
776 } |
|
777 |
|
778 //In Album grid it is not required to show tool bar |
|
779 int subState = getSubState(); |
|
780 if ( subState == ALBUM_ITEM_S || subState == FETCHER_ALBUM_ITEM_S ) { |
|
781 setItemVisible( Hb::ToolBarItem, FALSE ) ; |
|
782 } |
|
783 else { |
|
784 setItemVisible( Hb::ToolBarItem, TRUE ); |
|
785 } |
|
786 } |
|
787 |