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