ui/views/gridview/src/glxgridview.cpp
changeset 69 45459746d5e8
parent 65 ccee5c4b0de4
child 71 27f2d7aec52a
--- a/ui/views/gridview/src/glxgridview.cpp	Mon Sep 20 12:39:08 2010 +0530
+++ b/ui/views/gridview/src/glxgridview.cpp	Mon Sep 27 15:13:20 2010 +0530
@@ -97,6 +97,7 @@
         mTotalImagesCount->setObjectName( "Count" );
         mTotalImagesCount->hide();
     }
+    mWidget->resetTransform();
     OstTraceFunctionExit0( GLXGRIDVIEW_ACTIVATE_EXIT );
 }
 
@@ -243,8 +244,7 @@
     OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_ENABLEMARKING, "GlxGridView::enableMarking" );
     mWidget->setSelectionMode(HgWidget::MultiSelection);
    
-    if (mMarkingWidget == NULL)
-        {
+    if (mMarkingWidget == NULL) {
         mMarkingWidget = new HbWidget(this);
         mMarkContainer = new QGraphicsLinearLayout(Qt::Horizontal, 0);
         mMarkingWidget->setLayout(mMarkContainer);
@@ -262,13 +262,12 @@
        
         mMarkContainer->addItem(mMarkCheckBox);
         mMarkContainer->addItem(mMarkCountLabel);        
-        }
-
-    hideorshowitems(mWindow->orientation());
+    }
 
-    connect( mWidget->selectionModel() , SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection& ) ), this, SLOT( showMarkedItemCount() ) );
-    connect(mMarkCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( stateChanged(int)));
+    hideorshowitems( mWindow->orientation() );
 
+    connect( mWidget->selectionModel() , SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection& ) ), this, SLOT( showMarkedItemCount() ) );
+    connect( mMarkCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( stateChanged( int ) ));
 }
 
 void GlxGridView::disableMarking()
@@ -305,9 +304,26 @@
 {
     int count = mModel->rowCount();
     QModelIndexList indexList = mWidget->selectionModel()->selectedIndexes();
-    int markItemCount = indexList.count();    
-    QString text= HbParameterLengthLimiter(GLX_LABEL_MARK_COUNT).arg(markItemCount).arg(count);     
-    mMarkCountLabel->setPlainText( text );    
+    int markItemCount = indexList.count();
+    QString text = HbParameterLengthLimiter(GLX_LABEL_MARK_COUNT).arg(markItemCount).arg(count);
+    mMarkCountLabel->setPlainText(text);
+
+    //Block The signals generated by the CheckBox
+    //if we dont block the signals  , then when we call setCheckState to selected and unselect the CheckBox
+    //it causes state change signal to emit which will cause either mark all or un mark all of teh images.
+    mMarkCheckBox->blockSignals(TRUE);
+    if (markItemCount != count && mMarkCheckBox->checkState() == Qt::Checked) {
+        //if the mark all option was checked  and then the user un marks an slected item
+        //Then we have to un check the Mark All check Box
+        mMarkCheckBox->setCheckState(Qt::Unchecked);
+    }
+    else if (markItemCount == count) {
+        //if all the images are selected/marked Indiduvally
+        //Then the the Mark All check Box has to checked/Selected
+        mMarkCheckBox->setCheckState(Qt::Checked);
+    }
+    //UnBlock The signals generated by the CheckBox
+    mMarkCheckBox->blockSignals(FALSE);
 }
 
 void GlxGridView::showItemCount()
@@ -332,9 +348,10 @@
 					if (mAlbumNameHeading) {
                     	mAlbumNameHeading->hide();
 					}
-                    mTotalImagesCount->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24));
+				
                     text = HbParameterLengthLimiter(GLX_GRID_VIEW_COUNT_LABEL, count); 
                     mTotalImagesCount->setHeading ( text );
+                    mTotalImagesCount->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24));
                     mTotalImagesCount->show();
                 }
                 else if ( getSubState() == ALBUM_ITEM_S ) {
@@ -397,18 +414,18 @@
 
     //If fetcher service set only title text
     if ((XQServiceUtil::isService()) && isItemVisible(Hb::TitleBarItem))
-        {
-        mAlbumNameHeading->setGeometry(QRectF(0, 0, screenSize.width(),deviceSize.height() / 24));
+        {       
         mAlbumNameHeading->setHeading(aTitle);
+        mAlbumNameHeading->setGeometry(QRectF(0, 0, screenSize.width(),deviceSize.height() / 24));       
         mAlbumNameHeading->show();
         }
     else
         { //handle album tiltle and count display logic here
         if (isItemVisible(Hb::TitleBarItem))
             {
-            mAlbumNameHeading->setGeometry(QRectF(0, 0, screenSize.width(),deviceSize.height() / 24));
-            QString text = HbParameterLengthLimiter(GLX_ALBUM_NAME_COUNT_LABEL).arg(aTitle).arg(count);            
+            QString text = HbParameterLengthLimiter(GLX_ALBUM_NAME_COUNT_LABEL).arg(aTitle).arg(count);    
             mAlbumNameHeading->setHeading(text);
+            mAlbumNameHeading->setGeometry(QRectF(0, 0, screenSize.width(),deviceSize.height()/24));                 
             mAlbumNameHeading->show();
             }
         }
@@ -512,50 +529,47 @@
     OstTraceFunctionEntry0( GLXGRIDVIEW_GETANIMATIONITEM_ENTRY );
     int selIndex = -1;
 
-    if ( transitionEffect == FULLSCREEN_TO_GRID ) {
+    if ( transitionEffect == FULLSCREEN_TO_GRID  || transitionEffect == FULLSCREEN_TO_GRID_PORTRAIT ) {
         return mWidget;
     }
 
-    if ( transitionEffect == GRID_TO_FULLSCREEN )
-        {
-        QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );
-        if ( variant.isValid() &&  variant.canConvert<int> () )
-            {
-            selIndex = variant.value<int>();
-            }
-        else
-            {
+    if ( transitionEffect == GRID_TO_FULLSCREEN ) {
+        QVariant variant = mModel->data( mModel->index( 0, 0 ), GlxFocusIndexRole );
+        if ( variant.isValid() && variant.canConvert<int> () ) {
+            selIndex = variant.value<int> ();
+        }
+        else {
             return mWidget;
-            }
-        QVariant variantimage = mModel->data(mModel->index(selIndex,0),Qt::DecorationRole);
-        if ( variantimage.isValid() &&  variantimage.canConvert<HbIcon> () )
-            {
+        }
+        QVariant variantimage = mModel->data( mModel->index( selIndex, 0 ), Qt::DecorationRole );
+        if ( variantimage.isValid() && variantimage.canConvert<HbIcon> () ) {
             QPolygonF poly;
-            if (mModelWrapper && !mWidget->getItemOutline(mModelWrapper->index(selIndex,0), poly))
-                {
+            if ( mModelWrapper && !mWidget->getItemOutline( mModelWrapper->index( selIndex, 0 ), poly ) ) {
                 return mWidget;
-                }
+            }
             QRectF itemRect = poly.boundingRect();
 
-            mIconItem->setSize(QSize(120,120));
-            HbIcon tempIcon =  variantimage.value<HbIcon>();
-            QPixmap tempPixmap = tempIcon.qicon().pixmap(120, 120);
-            QSize sz = QSize ( 120, 120);
-            tempPixmap = tempPixmap.scaled(sz, Qt::IgnoreAspectRatio );
-            HbIcon tmp = HbIcon( QIcon(tempPixmap)) ;
-            mIconItem->setIcon(tmp);
-            mIconItem->setPos(itemRect.topLeft());
-            mIconItem->setZValue(mIconItem->zValue() + 20);
+            mIconItem->setSize( QSize( 120, 120 ) );
+            HbIcon tempIcon = variantimage.value<HbIcon> ();
+            QPixmap tempPixmap = tempIcon.qicon().pixmap( 120, 120 );
+            QSize sz = QSize( 120, 120 );
+            tempPixmap = tempPixmap.scaled( sz, Qt::IgnoreAspectRatio );
+            HbIcon tmp = HbIcon( QIcon( tempPixmap ) );
+            mIconItem->setIcon( tmp );
+            mIconItem->setPos( itemRect.topLeft() );
+            mIconItem->setZValue( mIconItem->zValue() + 20 );
             mIconItem->show();
-            return mIconItem;
+            if ( mToolBar ) {
+                mToolBar->setZValue( mIconItem->zValue() - 5 );
             }
-        else
-            {
+            return mIconItem;
+        }
+        else {
             return mWidget;
-            }
         }
+    }
 
-    if ( transitionEffect == GRID_TO_ALBUMLIST  || transitionEffect == ALBUMLIST_TO_GRID ){
+    if ( transitionEffect == GRID_TO_ALBUMLIST || transitionEffect == ALBUMLIST_TO_GRID ) {
         return mWidget;
     }
     OstTraceFunctionExit0( GLXGRIDVIEW_GETANIMATIONITEM_EXIT );
@@ -638,10 +652,8 @@
         mMarkingWidget->setGeometry(QRectF(0,deviceSize.height()/24,screenSize.width(),deviceSize.height()/72));          
               
         mMarkSelectHeading->show();
-        mMarkingWidget->show();
-        
-        showMarkedItemCount();
-        
+        mMarkingWidget->show();        
+        showMarkedItemCount();        
     }
 }