ui/views/gridview/src/glxgridview.cpp
author hgs
Mon, 17 May 2010 13:35:26 +0530
changeset 42 5e1df1b52eb3
parent 40 112f0ac2d1f0
child 36 6481344a6d67
permissions -rw-r--r--
201019_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
//Includes
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <hbmainwindow.h>
40
hgs
parents: 26
diff changeset
    22
#include <hggrid.h>
hgs
parents: 26
diff changeset
    23
#include <glxmodelwrapper.h>
hgs
parents: 26
diff changeset
    24
#include <hbpushbutton.h>
hgs
parents: 26
diff changeset
    25
#include <HbToolBar> // Temp
hgs
parents: 26
diff changeset
    26
#include <hbiconitem.h>
hgs
parents: 26
diff changeset
    27
#include <hbicon.h>
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include <xqserviceutil.h>
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    29
#include <hbcheckbox.h>
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    30
#include <hblabel.h>
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    31
#include <QString>
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    32
#include <hbframeitem.h>
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
//User Includes
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include "glxviewids.h"
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include "glxgridview.h"
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
#include "glxmodelparm.h"
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
#include "glxcommandhandlers.hrh"
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    39
#include "glxicondefs.h"
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    40
#include "glxlocalisationstrings.h"
40
hgs
parents: 26
diff changeset
    41
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
#include "OstTraceDefinitions.h"
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
#ifdef OST_TRACE_COMPILER_IN_USE
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include "glxgridviewTraces.h"
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
#endif
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    47
GlxGridView::GlxGridView(HbMainWindow *window) 
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    48
    : GlxView ( GLX_GRIDVIEW_ID ), 
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    49
      mWindow(window), 
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    50
      mModel ( NULL), 
40
hgs
parents: 26
diff changeset
    51
      mWidget(NULL),
hgs
parents: 26
diff changeset
    52
      mSelectionModel(NULL),
hgs
parents: 26
diff changeset
    53
      mModelWrapper(NULL),
hgs
parents: 26
diff changeset
    54
      mUiOnButton(NULL),
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    55
      mCameraButton(NULL),
40
hgs
parents: 26
diff changeset
    56
      mScrolling(FALSE),
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    57
      mIconItem(NULL),
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    58
      mMarkCheckBox(NULL),
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    59
      mCountItem(NULL),
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    60
      mMainLabel(NULL),
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    61
      mCountLabel(NULL),
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    62
      mZeroItemLabel(NULL),
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    63
      mAlbumName(NULL)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    64
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
    OstTraceFunctionEntry0( GLXGRIDVIEW_GLXGRIDVIEW_ENTRY );
40
hgs
parents: 26
diff changeset
    66
    mModelWrapper = new GlxModelWrapper();
hgs
parents: 26
diff changeset
    67
    mModelWrapper->setRoles(GlxQImageSmall);
hgs
parents: 26
diff changeset
    68
    mIconItem = new HbIconItem(this);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
    OstTraceFunctionExit0( GLXGRIDVIEW_GLXGRIDVIEW_EXIT );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    70
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
void GlxGridView::activate()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    73
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
    OstTraceFunctionEntry0( GLXGRIDVIEW_ACTIVATE_ENTRY );
40
hgs
parents: 26
diff changeset
    75
    if(mUiOnButton == NULL) {
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    76
        mUiOnButton = new HbPushButton(this);
40
hgs
parents: 26
diff changeset
    77
        connect(mUiOnButton, SIGNAL(clicked(bool)), this, SLOT(uiButtonClicked(bool)));
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    78
        mUiOnButton->setGeometry(QRectF(590,0,40,40));
40
hgs
parents: 26
diff changeset
    79
        mUiOnButton->setZValue(1);
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    80
        mUiOnButton->setIcon(HbIcon(GLXICON_WALL_UI_ON));
40
hgs
parents: 26
diff changeset
    81
        mUiOnButton->hide();
hgs
parents: 26
diff changeset
    82
    }
hgs
parents: 26
diff changeset
    83
    loadGridView();
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    84
	connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationchanged(Qt::Orientation)),Qt::UniqueConnection);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    85
    if(mCountItem == NULL) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    86
        mCountItem = new HbLabel(this);        
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    87
        HbFrameItem *frame = new HbFrameItem(this); //graphics for mCountItem
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    88
        frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    89
        frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    90
        frame->graphicsItem()->setOpacity(1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    91
        mCountItem->setBackgroundItem(frame->graphicsItem(),-1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    92
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    OstTraceFunctionExit0( GLXGRIDVIEW_ACTIVATE_EXIT );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    94
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
void GlxGridView::deActivate()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    97
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    OstTraceFunctionEntry0( GLXGRIDVIEW_DEACTIVATE_ENTRY );
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    99
    mScrolling = FALSE;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   100
    if (mUiOnButton)
40
hgs
parents: 26
diff changeset
   101
        {
hgs
parents: 26
diff changeset
   102
        mUiOnButton->hide();
hgs
parents: 26
diff changeset
   103
        }    
hgs
parents: 26
diff changeset
   104
    if(mIconItem)
hgs
parents: 26
diff changeset
   105
        {
hgs
parents: 26
diff changeset
   106
        mIconItem->hide();
hgs
parents: 26
diff changeset
   107
        mIconItem->resetTransform();
hgs
parents: 26
diff changeset
   108
        mIconItem->setOpacity(0);
hgs
parents: 26
diff changeset
   109
        mIconItem->setZValue(mIconItem->zValue()-20);
hgs
parents: 26
diff changeset
   110
        }
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   111
    if (mCountItem) 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   112
        {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   113
        mCountItem->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   114
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   115
    if (mAlbumName) 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   116
        {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   117
        mAlbumName->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   118
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   119
    if(mZeroItemLabel) 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   120
        {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   121
        mZeroItemLabel->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   122
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   123
    if(mCameraButton) 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   124
        {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   125
        mCameraButton->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   126
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   127
    disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationchanged(Qt::Orientation)));
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   128
    OstTraceFunctionExit0( GLXGRIDVIEW_DEACTIVATE_EXIT );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   129
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   131
void GlxGridView::initializeView(QAbstractItemModel *model)
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   132
{
40
hgs
parents: 26
diff changeset
   133
    activate();
hgs
parents: 26
diff changeset
   134
    setModel(model);
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   135
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   137
void GlxGridView::clearCurrentModel()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   138
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   139
    if ( mModel ) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   140
        disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(showItemCount()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   141
        disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(showItemCount()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   142
        disconnect(mModel, SIGNAL(destroyed()), this, SLOT( clearCurrentModel()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   143
        disconnect(mModel, SIGNAL(albumTitleAvailable(QString)), this, SLOT(showAlbumTitle(QString)));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   144
        disconnect(mModel, SIGNAL(populated()), this, SLOT( populated()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   145
        mModel = NULL ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   146
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   147
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   148
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   149
void GlxGridView::initializeNewModel()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   150
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   151
    if ( mModel ) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   152
        connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(showItemCount()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   153
        connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(showItemCount()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   154
        connect(mModel, SIGNAL(destroyed()), this, SLOT( clearCurrentModel()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   155
        connect(mModel, SIGNAL(albumTitleAvailable(QString)), this, SLOT(showAlbumTitle(QString)));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   156
        connect(mModel, SIGNAL(populated()), this, SLOT( populated()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   157
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   158
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   159
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   160
void GlxGridView::setModel(QAbstractItemModel *model)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   161
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
    OstTraceFunctionEntry0( GLXGRIDVIEW_SETMODEL_ENTRY );
40
hgs
parents: 26
diff changeset
   163
    if(model)
hgs
parents: 26
diff changeset
   164
        {
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   165
        clearCurrentModel();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   166
        mModel = model;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   167
        initializeNewModel();
40
hgs
parents: 26
diff changeset
   168
        QVariant variantimage = mModel->data(mModel->index(0,0),GlxDefaultImage);
hgs
parents: 26
diff changeset
   169
        if (mWidget && variantimage.isValid() &&  variantimage.canConvert<QImage> () )
hgs
parents: 26
diff changeset
   170
            {
hgs
parents: 26
diff changeset
   171
            mWidget->setDefaultImage(variantimage.value<QImage>());
hgs
parents: 26
diff changeset
   172
            }
hgs
parents: 26
diff changeset
   173
        mModelWrapper->setModel(mModel);
hgs
parents: 26
diff changeset
   174
        mWidget->setModel(mModelWrapper);  
hgs
parents: 26
diff changeset
   175
        if(!mSelectionModel)
hgs
parents: 26
diff changeset
   176
            {
hgs
parents: 26
diff changeset
   177
            mSelectionModel = new QItemSelectionModel(mModelWrapper, this);
hgs
parents: 26
diff changeset
   178
            connect(mSelectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(visibleIndexChanged(const QModelIndex &, const QModelIndex &)));
hgs
parents: 26
diff changeset
   179
            mWidget->setSelectionModel(mSelectionModel);
hgs
parents: 26
diff changeset
   180
            }
hgs
parents: 26
diff changeset
   181
        scrolltofocus();  // Need to do it here ?
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   182
        showItemCount();
40
hgs
parents: 26
diff changeset
   183
        }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
    OstTraceFunctionExit0( GLXGRIDVIEW_SETMODEL_EXIT );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   185
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
40
hgs
parents: 26
diff changeset
   187
void GlxGridView::visibleIndexChanged(const QModelIndex& current, const QModelIndex& previous)
hgs
parents: 26
diff changeset
   188
{
hgs
parents: 26
diff changeset
   189
    if(mScrolling)
hgs
parents: 26
diff changeset
   190
        {
hgs
parents: 26
diff changeset
   191
        Q_UNUSED(previous);
hgs
parents: 26
diff changeset
   192
        if(current.row() >= 0 || current.row() < mModel->rowCount())
hgs
parents: 26
diff changeset
   193
            {
hgs
parents: 26
diff changeset
   194
            mModel->setData(mModel->index(0,0),current.row(),GlxVisualWindowIndex);
hgs
parents: 26
diff changeset
   195
            }
hgs
parents: 26
diff changeset
   196
        }
hgs
parents: 26
diff changeset
   197
}
hgs
parents: 26
diff changeset
   198
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
void GlxGridView::addToolBar( HbToolBar *toolBar ) 
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   200
{
40
hgs
parents: 26
diff changeset
   201
    OstTraceFunctionEntry0( GLXGRIDVIEW_ADDTOOLBAR_ENTRY ); 
hgs
parents: 26
diff changeset
   202
    setToolBar(toolBar);  
hgs
parents: 26
diff changeset
   203
    hideorshowitems(mWindow->orientation());
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
    OstTraceFunctionExit0( GLXGRIDVIEW_ADDTOOLBAR_EXIT );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   205
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
void GlxGridView::enableMarking()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   208
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
    OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_ENABLEMARKING, "GlxGridView::enableMarking" );
40
hgs
parents: 26
diff changeset
   210
    mWidget->setSelectionMode(HgWidget::MultiSelection);
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   211
    if (mMainLabel == NULL) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   212
        mMainLabel = new HbLabel("Select Photos", this);        
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   213
        HbFrameItem *frame1 = new HbFrameItem(this);    //graphics for mMainLabel
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   214
        frame1->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   215
        frame1->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   216
        frame1->graphicsItem()->setOpacity(1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   217
        mMainLabel->setBackgroundItem(frame1->graphicsItem(),-1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   218
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   219
    if (mMarkCheckBox == NULL) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   220
        mMarkCheckBox = new HbCheckBox(GLX_OPTION_MARK_ALL, this);        
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   221
        HbFrameItem *frame2 = new HbFrameItem(this);    //graphics for mMarkCheckBox
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   222
        frame2->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   223
        frame2->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   224
        frame2->graphicsItem()->setOpacity(1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   225
        mMarkCheckBox->setBackgroundItem(frame2->graphicsItem(),-1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   226
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   227
    if (mCountLabel == NULL) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   228
        mCountLabel = new HbLabel(this);        
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   229
        HbFrameItem *frame3 = new HbFrameItem(this);    //graphics for mCountLabel
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   230
        frame3->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   231
        frame3->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   232
        frame3->graphicsItem()->setOpacity(1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   233
        mCountLabel->setBackgroundItem(frame3->graphicsItem(),-1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   234
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   235
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   236
    hideorshowitems(mWindow->orientation());
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   237
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   238
    connect( mWidget->selectionModel() , SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection& ) ), this, SLOT( showMarkedItemCount() ) );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   239
    connect(mMarkCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( stateChanged(int)));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   240
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   241
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
void GlxGridView::disableMarking() 
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   244
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
    OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_DISABLEMARKING, "GlxGridView::disableMarking" );
40
hgs
parents: 26
diff changeset
   246
    mWidget->setSelectionMode(HgWidget::NoSelection);
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   247
    disconnect( mWidget->selectionModel() , SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection& ) ), this, SLOT( showMarkedItemCount() ) );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   248
    disconnect(mMarkCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( stateChanged(int)));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   249
    if (mMainLabel) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   250
        mMainLabel->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   251
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   252
    if (mMarkCheckBox) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   253
        mMarkCheckBox->setCheckState(Qt::Unchecked);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   254
        mMarkCheckBox->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   255
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   256
    if (mCountLabel) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   257
        mCountLabel->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   258
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   259
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   260
    hideorshowitems(mWindow->orientation());
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   261
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   262
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   263
void GlxGridView::stateChanged(int state)
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   264
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   265
    if(state)
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   266
        handleUserAction(EGlxCmdMarkAll);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   267
    else
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   268
        handleUserAction(EGlxCmdUnMarkAll);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   269
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   270
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   271
void GlxGridView::showMarkedItemCount()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   272
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   273
    int count = mModel->rowCount();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   274
    QModelIndexList indexList = mWidget->selectionModel()->selectedIndexes();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   275
    int markItemCount = indexList.count();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   276
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   277
    QString text= QString("%1 / %2").arg( markItemCount ).arg( count );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   278
    mCountLabel->setPlainText( text );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   279
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   280
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   281
void GlxGridView::showItemCount()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   282
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   283
    int count = 0;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   284
    if(mModel) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   285
        count = mModel->rowCount();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   286
        QSize deviceSize = HbDeviceProfile::current().logicalSize();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   287
        QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() )
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   288
                                                                       : QSize( deviceSize.height(), deviceSize.width() )  ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   289
        if(count) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   290
            if(mZeroItemLabel) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   291
                mZeroItemLabel->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   292
            }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   293
            if(mCameraButton) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   294
                mCameraButton->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   295
            }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   296
            if(isItemVisible(Hb::TitleBarItem)) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   297
                QString text;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   298
                if (getSubState() == ALL_ITEM_S) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   299
					if (mAlbumName) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   300
                    	mAlbumName->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   301
					}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   302
                    mCountItem->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   303
                    text = QString("%1 Items").arg( count );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   304
                    mCountItem->setPlainText( text );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   305
                    mCountItem->setAlignment(Qt::AlignLeft);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   306
                    mCountItem->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   307
                }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   308
                else if (getSubState() == ALBUM_ITEM_S) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   309
                    mCountItem->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   310
                    QVariant variant = mModel->data(mModel->index(0,0),GlxViewTitle);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   311
                    if (variant.toString() != NULL) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   312
                        showAlbumTitle(variant.toString());
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   313
                    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   314
                }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   315
            }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   316
            else {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   317
                if (mCountItem) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   318
                    mCountItem->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   319
                }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   320
                if (mAlbumName) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   321
                    mAlbumName->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   322
                }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   323
            }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   324
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   325
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   326
        else {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   327
            bool populated = FALSE;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   328
            QVariant variant = mModel->data(mModel->index(0,0),GlxPopulated);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   329
            if (variant.isValid() &&  variant.canConvert<bool>() )
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   330
                {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   331
                populated = variant.value<bool>();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   332
                }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   333
            if(populated) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   334
                if (mCountItem) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   335
                    mCountItem->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   336
                }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   337
                if (mAlbumName) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   338
                    mAlbumName->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   339
                }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   340
                
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   341
                showNoImageString();            
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   342
                
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   343
                if (getSubState() == ALBUM_ITEM_S) {                
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   344
                    QVariant variant = mModel->data(mModel->index(0,0),GlxViewTitle);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   345
                    if (variant.toString() != NULL) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   346
                        showAlbumTitle(variant.toString());
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   347
                    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   348
                }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   349
            }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   350
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   351
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   352
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   353
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   354
void GlxGridView::showAlbumTitle(QString aTitle)
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   355
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   356
    int count = mModel->rowCount();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   357
    QSize deviceSize = HbDeviceProfile::current().logicalSize();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   358
    QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() )
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   359
                                                                   : QSize( deviceSize.height(), deviceSize.width() )  ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   360
    if(mAlbumName == NULL) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   361
        mAlbumName = new HbLabel(this);            
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   362
        HbFrameItem *frame = new HbFrameItem(this); //graphics for mAlbumName
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   363
        frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   364
        frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   365
        frame->graphicsItem()->setOpacity(1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   366
        mAlbumName->setBackgroundItem(frame->graphicsItem(),-1);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   367
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   368
    
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   369
    if(count && isItemVisible(Hb::TitleBarItem)) {        
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   370
        mAlbumName->setGeometry(QRectF(0,0,screenSize.width()/2,deviceSize.height()/24));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   371
        QString text = QString(aTitle);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   372
        mAlbumName->setPlainText( text );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   373
        mAlbumName->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   374
        mCountItem->setGeometry(QRectF(screenSize.width()/2,0,screenSize.width()/2,deviceSize.height()/24));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   375
        text = QString("(%1)").arg(count);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   376
        mCountItem->setPlainText( text );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   377
        mCountItem->setAlignment(Qt::AlignRight);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   378
        mCountItem->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   379
    }    
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   380
    else if((!count) && isItemVisible(Hb::TitleBarItem)) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   381
        mAlbumName->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   382
        QString text = QString(aTitle);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   383
        mAlbumName->setPlainText( text );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   384
        mAlbumName->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   385
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   386
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   387
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   388
void GlxGridView::showNoImageString()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   389
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   390
    qreal chromeHeight = 0.0;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   391
    QSize deviceSize = HbDeviceProfile::current().logicalSize();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   392
    QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() )
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   393
                                                                   : QSize( deviceSize.height(), deviceSize.width() )  ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   394
    qreal midHeight = screenSize.height()/2;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   395
    if (isItemVisible(Hb::TitleBarItem)) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   396
        style()->parameter("hb-param-widget-chrome-height", chromeHeight);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   397
        midHeight -= chromeHeight;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   398
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   399
    if (mZeroItemLabel == NULL) {                
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   400
        mZeroItemLabel = new HbLabel("(No Images)\n To capture images Open", this);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   401
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   402
    mZeroItemLabel->setGeometry(QRectF(0, midHeight - deviceSize.height()/16, screenSize.width(), 3*deviceSize.height()/32));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   403
    mZeroItemLabel->setAlignment(Qt::AlignHCenter);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   404
    mZeroItemLabel->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   405
    if (mCameraButton == NULL) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   406
        mCameraButton = new HbPushButton(this);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   407
        mCameraButton->setIcon(HbIcon(GLXICON_CAMERA));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   408
        connect(mCameraButton, SIGNAL(clicked(bool)), this, SLOT(cameraButtonClicked(bool)));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   409
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   410
    mCameraButton->setGeometry(QRectF(screenSize.width()/2 - 3*deviceSize.height()/64, midHeight + deviceSize.height()/32, deviceSize.height()/32, deviceSize.height()/32));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   411
    mCameraButton->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   412
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   413
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   414
void GlxGridView::populated()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   415
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   416
    showItemCount();
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   417
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
void GlxGridView::handleUserAction(qint32 commandId)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   420
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
    OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_HANDLEUSERACTION, "GlxGridView::handleUserAction" );
40
hgs
parents: 26
diff changeset
   422
    switch( commandId ) {
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
        case EGlxCmdMarkAll :
40
hgs
parents: 26
diff changeset
   424
            mWidget->selectAll();
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
            break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
        case EGlxCmdUnMarkAll :
40
hgs
parents: 26
diff changeset
   428
            mWidget->clearSelection();
hgs
parents: 26
diff changeset
   429
            break;        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
        default :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
            break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
    }    
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   434
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
QItemSelectionModel * GlxGridView::getSelectionModel()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   437
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   438
    OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_GETSELECTIONMODEL, "GlxGridView::getSelectionModel" );
40
hgs
parents: 26
diff changeset
   439
    return mWidget->selectionModel();
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   440
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
QGraphicsItem * GlxGridView::getAnimationItem(GlxEffect transitionEffect)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   443
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
    OstTraceFunctionEntry0( GLXGRIDVIEW_GETANIMATIONITEM_ENTRY );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
    int selIndex = -1;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
    if ( transitionEffect == FULLSCREEN_TO_GRID ) {
40
hgs
parents: 26
diff changeset
   448
        return mWidget;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
40
hgs
parents: 26
diff changeset
   451
    if ( transitionEffect == GRID_TO_FULLSCREEN )
hgs
parents: 26
diff changeset
   452
        {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   453
        QVariant variant = mModel->data( mModel->index(0,0), GlxFocusIndexRole );    
40
hgs
parents: 26
diff changeset
   454
        if ( variant.isValid() &&  variant.canConvert<int> () ) 
hgs
parents: 26
diff changeset
   455
            {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   456
            selIndex = variant.value<int>();  
40
hgs
parents: 26
diff changeset
   457
            } 
hgs
parents: 26
diff changeset
   458
        else 
hgs
parents: 26
diff changeset
   459
            {
hgs
parents: 26
diff changeset
   460
            return mWidget;
hgs
parents: 26
diff changeset
   461
            }
hgs
parents: 26
diff changeset
   462
        QVariant variantimage = mModel->data(mModel->index(selIndex,0),Qt::DecorationRole);
hgs
parents: 26
diff changeset
   463
        if ( variantimage.isValid() &&  variantimage.canConvert<HbIcon> () )
hgs
parents: 26
diff changeset
   464
            {
hgs
parents: 26
diff changeset
   465
            QPolygonF poly;
hgs
parents: 26
diff changeset
   466
            if (mModelWrapper && !mWidget->getItemOutline(mModelWrapper->index(selIndex,0), poly))
hgs
parents: 26
diff changeset
   467
                {
hgs
parents: 26
diff changeset
   468
                return mWidget;
hgs
parents: 26
diff changeset
   469
                }
hgs
parents: 26
diff changeset
   470
            QRectF itemRect = poly.boundingRect();
hgs
parents: 26
diff changeset
   471
hgs
parents: 26
diff changeset
   472
            mIconItem->setSize(QSize(120,120));
hgs
parents: 26
diff changeset
   473
            HbIcon tempIcon =  variantimage.value<HbIcon>();
hgs
parents: 26
diff changeset
   474
            QPixmap tempPixmap = tempIcon.qicon().pixmap(120, 120);
hgs
parents: 26
diff changeset
   475
            QSize sz = QSize ( 120, 120);
hgs
parents: 26
diff changeset
   476
            tempPixmap = tempPixmap.scaled(sz, Qt::IgnoreAspectRatio );
hgs
parents: 26
diff changeset
   477
            HbIcon tmp = HbIcon( QIcon(tempPixmap)) ;
hgs
parents: 26
diff changeset
   478
            mIconItem->setIcon(tmp);
hgs
parents: 26
diff changeset
   479
            mIconItem->setPos(itemRect.topLeft());
hgs
parents: 26
diff changeset
   480
            mIconItem->setZValue(mIconItem->zValue() + 20);
hgs
parents: 26
diff changeset
   481
            mIconItem->show();
hgs
parents: 26
diff changeset
   482
            return mIconItem;   
hgs
parents: 26
diff changeset
   483
            }
hgs
parents: 26
diff changeset
   484
        else
hgs
parents: 26
diff changeset
   485
            {
hgs
parents: 26
diff changeset
   486
            return mWidget;
hgs
parents: 26
diff changeset
   487
            }
hgs
parents: 26
diff changeset
   488
        }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
    if ( transitionEffect == GRID_TO_ALBUMLIST  || transitionEffect == ALBUMLIST_TO_GRID ){
40
hgs
parents: 26
diff changeset
   491
        return mWidget;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
    OstTraceFunctionExit0( GLXGRIDVIEW_GETANIMATIONITEM_EXIT );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   494
    return NULL;    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   495
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
40
hgs
parents: 26
diff changeset
   497
void GlxGridView::loadGridView()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   498
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
    OstTraceFunctionEntry0( GLXGRIDVIEW_LOADGRIDVIEW_ENTRY );
40
hgs
parents: 26
diff changeset
   500
    if(mWidget == NULL) {
hgs
parents: 26
diff changeset
   501
        Qt::Orientation orient = mWindow->orientation();
hgs
parents: 26
diff changeset
   502
        mWindow->viewport()->grabGesture(Qt::PanGesture);
hgs
parents: 26
diff changeset
   503
        mWindow->viewport()->grabGesture(Qt::TapGesture);
hgs
parents: 26
diff changeset
   504
        mWindow->viewport()->grabGesture(Qt::TapAndHoldGesture);
hgs
parents: 26
diff changeset
   505
        mWidget = new HgGrid(orient);
hgs
parents: 26
diff changeset
   506
        mWidget->setLongPressEnabled(true);
hgs
parents: 26
diff changeset
   507
        mWidget->setScrollBarPolicy(HgWidget::ScrollBarAutoHide);  
hgs
parents: 26
diff changeset
   508
        setWidget( mWidget );  
hgs
parents: 26
diff changeset
   509
        addViewConnection();
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   510
        hideorshowitems(orient);
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   511
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   512
    OstTraceFunctionExit0( GLXGRIDVIEW_LOADGRIDVIEW_EXIT );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   513
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   514
40
hgs
parents: 26
diff changeset
   515
void GlxGridView::orientationchanged(Qt::Orientation orient)
hgs
parents: 26
diff changeset
   516
{
hgs
parents: 26
diff changeset
   517
    hideorshowitems(orient);
hgs
parents: 26
diff changeset
   518
}
hgs
parents: 26
diff changeset
   519
void GlxGridView::hideorshowitems(Qt::Orientation orient)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   520
{
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   521
    if (mWidget->selectionMode() == HgWidget::NoSelection) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   522
        if(orient == Qt::Horizontal)
40
hgs
parents: 26
diff changeset
   523
            {
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   524
			setItemVisible(Hb::AllItems, FALSE) ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   525
        	setViewFlags(viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   526
        	showItemCount();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   527
            if (mUiOnButton)
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   528
                {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   529
                mUiOnButton->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   530
                }
40
hgs
parents: 26
diff changeset
   531
            }
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   532
        else
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   533
            {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   534
            showHbItems();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   535
            }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   536
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   537
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   538
    if (mWidget->selectionMode() == HgWidget::MultiSelection) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   539
        setItemVisible(Hb::TitleBarItem, FALSE) ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   540
        if (mUiOnButton) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   541
            mUiOnButton->hide();
40
hgs
parents: 26
diff changeset
   542
        }
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   543
        if (mCountItem) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   544
            mCountItem->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   545
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   546
        if (mAlbumName) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   547
            mAlbumName->hide();
40
hgs
parents: 26
diff changeset
   548
        }
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   549
        QSize deviceSize = HbDeviceProfile::current().logicalSize();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   550
        QSize screenSize = ( mWindow->orientation() == Qt::Vertical ) ? QSize( deviceSize.width(), deviceSize.height() )
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   551
                                                                       : QSize( deviceSize.height(), deviceSize.width() )  ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   552
        mMainLabel->setGeometry(QRectF(0,0,screenSize.width(),deviceSize.height()/24));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   553
        mMarkCheckBox->setGeometry(QRectF(0,deviceSize.height()/24,screenSize.width()/2,deviceSize.height()/72));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   554
        mCountLabel->setGeometry(QRectF(screenSize.width()/2,deviceSize.height()/24,screenSize.width()/2,deviceSize.height()/12 - 3));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   555
        mCountLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   556
        mMainLabel->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   557
        mMarkCheckBox->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   558
        mCountLabel->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   559
        showMarkedItemCount();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   560
    }
40
hgs
parents: 26
diff changeset
   561
}
hgs
parents: 26
diff changeset
   562
hgs
parents: 26
diff changeset
   563
void GlxGridView::scrolltofocus()
hgs
parents: 26
diff changeset
   564
{
hgs
parents: 26
diff changeset
   565
    if(mModelWrapper && mWidget)
hgs
parents: 26
diff changeset
   566
        {
hgs
parents: 26
diff changeset
   567
        QVariant variant = mModelWrapper->data( mModelWrapper->index(0,0), GlxFocusIndexRole );    
hgs
parents: 26
diff changeset
   568
        if ( variant.isValid() &&  variant.canConvert<int> () ) 
hgs
parents: 26
diff changeset
   569
            {
hgs
parents: 26
diff changeset
   570
            mWidget->scrollTo( mModelWrapper->index( variant.value<int>(),0) );
hgs
parents: 26
diff changeset
   571
            mModel->setData(mModel->index(0,0),variant.value<int>(),GlxVisualWindowIndex);
hgs
parents: 26
diff changeset
   572
            }
hgs
parents: 26
diff changeset
   573
        }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   574
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   575
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   576
QVariant  GlxGridView::itemChange (GraphicsItemChange change, const QVariant &value) 
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
    {
40
hgs
parents: 26
diff changeset
   578
    OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_ITEMCHANGE, "GlxGridView::itemChange" );    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   579
    static bool isEmit = true;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   580
    if ( isEmit && change == QGraphicsItem::ItemVisibleHasChanged && value.toBool()  ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
    emit actionTriggered( EGlxCmdSetupItem );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   582
    isEmit = false;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   583
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
    return HbWidget::itemChange(change, value);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   585
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   586
40
hgs
parents: 26
diff changeset
   587
void GlxGridView::addViewConnection()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   588
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
    OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_ADDVIEWCONNECTION, "GlxGridView::addViewConnection" );
40
hgs
parents: 26
diff changeset
   590
    //connect(mWindow, SIGNAL(aboutToChangeOrientation()), mWidget, SLOT(aboutToChangeOrientation()));
hgs
parents: 26
diff changeset
   591
    connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), mWidget, SLOT(orientationChanged(Qt::Orientation)));
hgs
parents: 26
diff changeset
   592
    connect(mWidget, SIGNAL(activated(const QModelIndex &)), SLOT( itemSelected(const QModelIndex &)));
hgs
parents: 26
diff changeset
   593
    connect(mWidget, SIGNAL( scrollingStarted() ), this, SLOT( scrollingStarted() ) );
hgs
parents: 26
diff changeset
   594
    connect(mWidget, SIGNAL( scrollingEnded() ), this, SLOT( scrollingEnded() ) );
hgs
parents: 26
diff changeset
   595
    connect(mWidget, SIGNAL(longPressed(const QModelIndex &, QPointF)), SLOT( indicateLongPress(const QModelIndex &, QPointF) ) );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   596
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   598
void GlxGridView::removeViewConnection ()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   599
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   600
    OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_REMOVEVIEWCONNECTION, "GlxGridView::removeViewConnection" );
40
hgs
parents: 26
diff changeset
   601
    if(mWidget)
hgs
parents: 26
diff changeset
   602
        {
hgs
parents: 26
diff changeset
   603
        //disconnect(mWindow, SIGNAL(aboutToChangeOrientation()), mWidget, SLOT(aboutToChangeOrientation()));
hgs
parents: 26
diff changeset
   604
        disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), mWidget, SLOT(orientationChanged(Qt::Orientation)));
hgs
parents: 26
diff changeset
   605
        disconnect(mWidget, SIGNAL(activated(const QModelIndex &)),this, SLOT( itemSelected(const QModelIndex &)));
hgs
parents: 26
diff changeset
   606
        disconnect(mWidget, SIGNAL( scrollingStarted() ), this, SLOT( scrollingStarted() ) );
hgs
parents: 26
diff changeset
   607
        disconnect(mWidget, SIGNAL( scrollingEnded() ), this, SLOT( scrollingEnded() ) );
hgs
parents: 26
diff changeset
   608
        disconnect(mWidget,  SIGNAL(longPressed(const QModelIndex &, QPointF)),this, SLOT( indicateLongPress(const QModelIndex &, QPointF) ) );
hgs
parents: 26
diff changeset
   609
        }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   610
}
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   611
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   613
void GlxGridView::itemSelected(const QModelIndex &  index)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   614
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
    OstTrace1( TRACE_NORMAL, GLXGRIDVIEW_ITEMSELECTED, "GlxGridView::itemSelected;index=%d", index.row() );
40
hgs
parents: 26
diff changeset
   616
    if ( mWidget->selectionMode() == HgWidget::MultiSelection )
hgs
parents: 26
diff changeset
   617
        { 
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   618
        return ;
40
hgs
parents: 26
diff changeset
   619
        }    
hgs
parents: 26
diff changeset
   620
   if(XQServiceUtil::isService()){
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   621
        emit gridItemSelected(index);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   622
        return;
40
hgs
parents: 26
diff changeset
   623
    }    
hgs
parents: 26
diff changeset
   624
    OstTraceEventStart0( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START, "Fullscreen Launch Time" );    
hgs
parents: 26
diff changeset
   625
    if ( mModel ) 
hgs
parents: 26
diff changeset
   626
        {
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
        mModel->setData( index, index.row(), GlxFocusIndexRole );
40
hgs
parents: 26
diff changeset
   628
        }
hgs
parents: 26
diff changeset
   629
    setItemVisible(Hb::AllItems, FALSE);
hgs
parents: 26
diff changeset
   630
    emit actionTriggered( EGlxCmdFullScreenOpen ); 
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   631
    OstTraceEventStop( EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_STOP, "Fullscreen Launch Time", EVENT_DUP1_GLXGRIDVIEW_ITEMSELECTED_START );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   632
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
40
hgs
parents: 26
diff changeset
   634
void GlxGridView::scrollingStarted()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   635
{
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   636
    if ((mWindow->orientation() == Qt::Horizontal) && mWidget->selectionMode() == HgWidget::NoSelection)
40
hgs
parents: 26
diff changeset
   637
        {
hgs
parents: 26
diff changeset
   638
        setItemVisible(Hb::AllItems, FALSE) ;
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   639
        setViewFlags(viewFlags() | HbView::ViewTitleBarHidden | HbView::ViewStatusBarHidden);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   640
        if (mUiOnButton)
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   641
            {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   642
            mUiOnButton->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   643
            }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   644
		if (mCountItem) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   645
			mCountItem->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   646
		}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   647
		if (mAlbumName) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   648
            mAlbumName->hide();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   649
		}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   650
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   651
40
hgs
parents: 26
diff changeset
   652
    mScrolling = TRUE;
hgs
parents: 26
diff changeset
   653
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
40
hgs
parents: 26
diff changeset
   655
void GlxGridView::scrollingEnded()
hgs
parents: 26
diff changeset
   656
{
hgs
parents: 26
diff changeset
   657
    mScrolling = FALSE;
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   658
    if (mUiOnButton && (mWindow->orientation() == Qt::Horizontal))
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   659
        {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   660
        mUiOnButton->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   661
        }
40
hgs
parents: 26
diff changeset
   662
    QList<QModelIndex> visibleIndex = mWidget->getVisibleItemIndices();
hgs
parents: 26
diff changeset
   663
    if (visibleIndex.count() <= 0)
hgs
parents: 26
diff changeset
   664
        {
hgs
parents: 26
diff changeset
   665
        return;
hgs
parents: 26
diff changeset
   666
        }
hgs
parents: 26
diff changeset
   667
    QModelIndex index = visibleIndex.at(0);
hgs
parents: 26
diff changeset
   668
    if (  index.row() < 0 || index.row() >= mModel->rowCount() )
hgs
parents: 26
diff changeset
   669
        {
hgs
parents: 26
diff changeset
   670
        return;
hgs
parents: 26
diff changeset
   671
        }    
hgs
parents: 26
diff changeset
   672
    if(mModel)
hgs
parents: 26
diff changeset
   673
        {
hgs
parents: 26
diff changeset
   674
        mModel->setData( index, index.row(), GlxVisualWindowIndex);
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   675
        mModel->setData( index, index.row(), GlxFocusIndexRole );
40
hgs
parents: 26
diff changeset
   676
        }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   677
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   678
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   679
GlxGridView::~GlxGridView()
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   680
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   681
    OstTraceFunctionEntry0( DUP1_GLXGRIDVIEW_GLXGRIDVIEW_ENTRY );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   682
    removeViewConnection();
40
hgs
parents: 26
diff changeset
   683
    if(mSelectionModel)
hgs
parents: 26
diff changeset
   684
        {
hgs
parents: 26
diff changeset
   685
        disconnect(mSelectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(visibleIndexChanged(const QModelIndex &, const QModelIndex &)));
hgs
parents: 26
diff changeset
   686
        delete mSelectionModel;
hgs
parents: 26
diff changeset
   687
        }
hgs
parents: 26
diff changeset
   688
    delete mWidget;
hgs
parents: 26
diff changeset
   689
    delete mModelWrapper;
hgs
parents: 26
diff changeset
   690
    if(mUiOnButton) {
hgs
parents: 26
diff changeset
   691
        disconnect(mUiOnButton, SIGNAL(clicked(bool)), this, SLOT(uiButtonClicked(bool)));
hgs
parents: 26
diff changeset
   692
        delete mUiOnButton;
hgs
parents: 26
diff changeset
   693
    }
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   694
    if(mCameraButton) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   695
        disconnect(mCameraButton, SIGNAL(clicked()), this, SLOT(cameraButtonClicked()));
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   696
        delete mCameraButton;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   697
    }
40
hgs
parents: 26
diff changeset
   698
    delete mIconItem;
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   699
    delete mCountItem;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   700
    delete mAlbumName;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   701
    delete mMainLabel;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   702
    delete mMarkCheckBox;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   703
    delete mCountLabel;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   704
    delete mZeroItemLabel;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   705
    OstTraceFunctionExit0( DUP1_GLXGRIDVIEW_GLXGRIDVIEW_EXIT );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   706
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   707
40
hgs
parents: 26
diff changeset
   708
void GlxGridView::indicateLongPress(const QModelIndex& index, QPointF coords)
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   709
{
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   710
    OstTrace0( TRACE_NORMAL, GLXGRIDVIEW_INDICATELONGPRESS, "GlxGridView::indicateLongPress" );
40
hgs
parents: 26
diff changeset
   711
     
hgs
parents: 26
diff changeset
   712
     if ( mWidget->selectionMode() == HgWidget::MultiSelection )
hgs
parents: 26
diff changeset
   713
         { 
hgs
parents: 26
diff changeset
   714
         return;
hgs
parents: 26
diff changeset
   715
         }     
hgs
parents: 26
diff changeset
   716
     if ( mModel ) 
hgs
parents: 26
diff changeset
   717
         {
hgs
parents: 26
diff changeset
   718
         mModel->setData( index, index.row(), GlxFocusIndexRole );
hgs
parents: 26
diff changeset
   719
         }     
hgs
parents: 26
diff changeset
   720
     emit itemSpecificMenuTriggered(viewId(),coords);
hgs
parents: 26
diff changeset
   721
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   722
40
hgs
parents: 26
diff changeset
   723
void GlxGridView::uiButtonClicked(bool /*checked*/)
hgs
parents: 26
diff changeset
   724
{
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   725
    showHbItems();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   726
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   727
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   728
void GlxGridView::showHbItems()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   729
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   730
        setItemVisible(Hb::AllItems, TRUE) ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   731
    setViewFlags(viewFlags() &~ HbView::ViewTitleBarHidden &~ HbView::ViewStatusBarHidden);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   732
        showItemCount();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   733
		toolBar()->resetTransform(); // Temp, this is for HbToolbar issue to get fixed
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   734
        toolBar()->show();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   735
    if (mUiOnButton)
40
hgs
parents: 26
diff changeset
   736
        {
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   737
        mUiOnButton->hide();
40
hgs
parents: 26
diff changeset
   738
        }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   739
}
40
hgs
parents: 26
diff changeset
   740
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   741
void GlxGridView::cameraButtonClicked(bool /*checked*/)
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   742
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   743
    emit actionTriggered(EGlxCmdCameraOpen);
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   744
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   745
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   746
int GlxGridView::getSubState()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   747
{
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   748
    int substate = NO_GRID_S;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   749
    QVariant variant = mModel->data( mModel->index(0,0), GlxSubStateRole );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   750
    if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   751
        substate = variant.value<int>();
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   752
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   753
    return substate;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   754
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   755