ui/viewmanagement/statehandler/src/glxstatemanager.cpp
author hgs
Thu, 14 Oct 2010 17:54:23 +0530
changeset 72 0a8e959402e5
parent 71 27f2d7aec52a
permissions -rw-r--r--
201041
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
44
hgs
parents: 43
diff changeset
    18
//include
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <QApplication>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <QDebug>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <QItemSelectionModel>
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    22
#include <hbnotificationdialog.h>
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    23
#include <QProcess>
44
hgs
parents: 43
diff changeset
    24
#include <hbinstance.h>
45
hgs
parents: 44
diff changeset
    25
#include <hbapplication.h>
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    26
#include <afactivitystorage.h>
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    27
#include <afactivation.h>
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    28
44
hgs
parents: 43
diff changeset
    29
hgs
parents: 43
diff changeset
    30
//user includes
hgs
parents: 43
diff changeset
    31
#include "glxstatemanager.h"
hgs
parents: 43
diff changeset
    32
#include "glxviewmanager.h"
hgs
parents: 43
diff changeset
    33
#include "glxviewids.h"
hgs
parents: 43
diff changeset
    34
#include "glxmediamodel.h"
hgs
parents: 43
diff changeset
    35
#include "glxgridstate.h"
hgs
parents: 43
diff changeset
    36
#include "glxliststate.h"
hgs
parents: 43
diff changeset
    37
#include "glxfullscreenstate.h"
hgs
parents: 43
diff changeset
    38
#include "glxdetailstate.h"
hgs
parents: 43
diff changeset
    39
#include "glxslideshowsettingsstate.h"
hgs
parents: 43
diff changeset
    40
#include "glxslideshowstate.h"
hgs
parents: 43
diff changeset
    41
#include "glxtnobserver.h"
hgs
parents: 43
diff changeset
    42
#include "glxmodelparm.h"
hgs
parents: 43
diff changeset
    43
#include "glxcollectionpluginall.hrh"
hgs
parents: 43
diff changeset
    44
#include "glxcollectionplugincamera.hrh"
hgs
parents: 43
diff changeset
    45
#include "glxcollectionpluginalbums.hrh"
hgs
parents: 43
diff changeset
    46
#include "glxcollectionpluginimageviewer.hrh"
hgs
parents: 43
diff changeset
    47
#include "glxexternalutility.h"
hgs
parents: 43
diff changeset
    48
#include "glxalbummodel.h"
hgs
parents: 43
diff changeset
    49
#include "glxloggerenabler.h"
hgs
parents: 43
diff changeset
    50
#include "glxmediaid.h"
hgs
parents: 43
diff changeset
    51
#include "glxactionhandler.h"
hgs
parents: 43
diff changeset
    52
#include "glxcommandhandlers.hrh"
hgs
parents: 43
diff changeset
    53
#include "glxplugincommandid.hrh"
hgs
parents: 43
diff changeset
    54
#include "glxlog.h"
hgs
parents: 43
diff changeset
    55
#include "glxtracer.h"
54
hgs
parents: 50
diff changeset
    56
#include <glximageviewermanager.h>
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    57
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    58
GlxStateManager::GlxStateManager() 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    59
    : mAllMediaModel( NULL ), 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    60
      mAlbumGridMediaModel( NULL ),
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    61
      mAlbumMediaModel( NULL ),
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    62
      mImageviewerMediaModel( NULL ), 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    63
      mCurrentModel( NULL ), 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    64
      mCurrentState( NULL ), 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    65
      mActionHandler( NULL ),
43
hgs
parents: 42
diff changeset
    66
      mTNObserver ( NULL ),
65
hgs
parents: 54
diff changeset
    67
      isProgressbarRunning ( false ),
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    68
      mFetcherFilterType ( EGlxFetcherFilterNone ),
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    69
      mActivityStorage (NULL),
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    70
      mActivation (NULL)
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
    qDebug("GlxStateManager::GlxStateManager");
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    PERFORMANCE_ADV ( d1, "view manager creation time") {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
        mViewManager = new GlxViewManager();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
    }
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    76
    mTNObserver = new GlxTNObserver();
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    77
    mActivityStorage = new AfActivityStorage();
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    78
    mActivation = new AfActivation();
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    79
    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    connect ( this, SIGNAL( setupItemsSignal() ), this, SLOT( setupItems() ), Qt::QueuedConnection );
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    81
    connect ( mViewManager, SIGNAL(actionTriggered( qint32 )), this, SLOT(actionTriggered( qint32 )), Qt::QueuedConnection );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
    82
    connect ( mTNObserver, SIGNAL( leftTNCount( int ) ), this, SLOT( updateTNProgress( int ) ) );
45
hgs
parents: 44
diff changeset
    83
    connect ( qobject_cast<HbApplication*>(qApp), SIGNAL (aboutToQuit()), this, SLOT(saveData()));
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
	//TO:DO TBD through exception when it is null
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
void GlxStateManager::enterMarkingMode()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
{
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
    89
    mViewManager->enterMarkingMode( mCurrentState->id(), mCurrentState->commandId() );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
void GlxStateManager::exitMarkingMode()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    mViewManager->exitMarkingMode(mCurrentState->id());
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
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
bool GlxStateManager::executeCommand(qint32 commandId)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
    qDebug( "GlxStateManager::executeCommand() : command ID %d", commandId);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
    QItemSelectionModel * selectionModel = mViewManager->getSelectionModel(mCurrentState->id());
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
    if ( selectionModel == NULL )
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
        return FALSE;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    QModelIndexList indexList = selectionModel->selectedIndexes();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    //if no item is selected then do nothing
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    if (indexList.count() == 0) 
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
        return FALSE;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
    for ( int i = 0; i < indexList.count(); i++) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
        qDebug( "GlxGridView::doneAction() : index %d", indexList[i].row());            
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
        mCurrentModel->setData( indexList[i], indexList[i].row(), GlxSelectedIndexRole );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
    }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   113
    mActionHandler->handleAction(commandId, mCollectionId,indexList);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
    return TRUE;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
44
hgs
parents: 43
diff changeset
   117
bool GlxStateManager::eventFilter(QObject *obj, QEvent *event)
hgs
parents: 43
diff changeset
   118
{
hgs
parents: 43
diff changeset
   119
    TRACER("GlxStateManager::eventFilter() ");
hgs
parents: 43
diff changeset
   120
    GLX_LOG_INFO1("GlxStateManager::eventFilter() %d event type", event->type());
hgs
parents: 43
diff changeset
   121
    
hgs
parents: 43
diff changeset
   122
    if ( event->type() ==  QEvent::ApplicationActivate ) {
hgs
parents: 43
diff changeset
   123
        mTNObserver->startTNMDaemon();
hgs
parents: 43
diff changeset
   124
    }
hgs
parents: 43
diff changeset
   125
    if ( event->type() ==  QEvent::ApplicationDeactivate ) {
hgs
parents: 43
diff changeset
   126
        mTNObserver->stopTNMDaemon();
hgs
parents: 43
diff changeset
   127
    }
hgs
parents: 43
diff changeset
   128
    return QObject::eventFilter(obj, event);
hgs
parents: 43
diff changeset
   129
}
hgs
parents: 43
diff changeset
   130
65
hgs
parents: 54
diff changeset
   131
void GlxStateManager::launchFetcher(int fetcherFilterType)
54
hgs
parents: 50
diff changeset
   132
{
hgs
parents: 50
diff changeset
   133
    qDebug("GlxStateManager::launchFetcher");
72
hgs
parents: 71
diff changeset
   134
    mCurrentState = createState( GLX_GRIDVIEW_ID );
hgs
parents: 71
diff changeset
   135
    mCurrentState->setState( FETCHER_ITEM_S );
hgs
parents: 71
diff changeset
   136
	mFetcherFilterType = ( GlxFetcherFilterType )fetcherFilterType;
hgs
parents: 71
diff changeset
   137
    createModel( GLX_GRIDVIEW_ID );
hgs
parents: 71
diff changeset
   138
    mViewManager->launchApplication( GLX_GRIDVIEW_ID, mCurrentModel );
54
hgs
parents: 50
diff changeset
   139
}
hgs
parents: 50
diff changeset
   140
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
void GlxStateManager::launchApplication()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
{
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   143
    qDebug("GlxStateManager::launchApplication");   
54
hgs
parents: 50
diff changeset
   144
    bool activitySuccess = false;  
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   145
    //To:Do use it in future once performance code is removed nextState(GLX_GRIDVIEW_ID, ALL_ITEM_S)
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   146
    
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   147
    if( mActivation->reason() == Af::ActivationReasonActivity ) {
54
hgs
parents: 50
diff changeset
   148
        activitySuccess = launchActivity();
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   149
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   150
    
54
hgs
parents: 50
diff changeset
   151
    if( !activitySuccess ) { 
hgs
parents: 50
diff changeset
   152
        mCurrentState = createState( GLX_GRIDVIEW_ID );
hgs
parents: 50
diff changeset
   153
        mCurrentState->setState( ALL_ITEM_S );
hgs
parents: 50
diff changeset
   154
       
hgs
parents: 50
diff changeset
   155
        int leftCount = mTNObserver->getTNLeftCount() ;
72
hgs
parents: 71
diff changeset
   156
        if (  leftCount > 0  || leftCount == KErrNotReady ) {
54
hgs
parents: 50
diff changeset
   157
            mViewManager->launchApplication( GLX_GRIDVIEW_ID, mCurrentModel );
hgs
parents: 50
diff changeset
   158
            launchProgressDialog();
hgs
parents: 50
diff changeset
   159
        }
hgs
parents: 50
diff changeset
   160
        else {
hgs
parents: 50
diff changeset
   161
            createModel( GLX_GRIDVIEW_ID );
hgs
parents: 50
diff changeset
   162
            mViewManager->launchApplication( GLX_GRIDVIEW_ID, mCurrentModel );
hgs
parents: 50
diff changeset
   163
        }    
hgs
parents: 50
diff changeset
   164
        mTNObserver->startTNObserving() ; 
72
hgs
parents: 71
diff changeset
   165
    }   
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   166
    
72
hgs
parents: 71
diff changeset
   167
    mActivityStorage->removeActivity( "PhotosMainView" );
50
hgs
parents: 45
diff changeset
   168
}
54
hgs
parents: 50
diff changeset
   169
45
hgs
parents: 44
diff changeset
   170
bool GlxStateManager::launchActivity()
hgs
parents: 44
diff changeset
   171
{
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   172
    QVariant data = mActivityStorage->activityData("PhotosMainView");
45
hgs
parents: 44
diff changeset
   173
    QByteArray serializedModel = data.toByteArray();
hgs
parents: 44
diff changeset
   174
    QDataStream stream(&serializedModel, QIODevice::ReadOnly);
50
hgs
parents: 45
diff changeset
   175
    
45
hgs
parents: 44
diff changeset
   176
    //Fetch the data from the activity Manager
50
hgs
parents: 45
diff changeset
   177
    stream >> mSaveActivity;  
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   178
    
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   179
    if(!validateActivityData())
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   180
        return false;
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   181
    
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   182
	qint32 stateId = mSaveActivity.value("ID");
45
hgs
parents: 44
diff changeset
   183
    mCurrentState = createState(stateId);
50
hgs
parents: 45
diff changeset
   184
    mCurrentState->setState( mSaveActivity.value("InternalState") );
45
hgs
parents: 44
diff changeset
   185
    createModel( stateId);
hgs
parents: 44
diff changeset
   186
	/*Model might not be populated yet to set the visibleWindowIndex right away.
hgs
parents: 44
diff changeset
   187
	*So, let us store the visible index as a temporary Variable, so that  visible Window Index 
hgs
parents: 44
diff changeset
   188
	*is set once the model is populated.
hgs
parents: 44
diff changeset
   189
    */
50
hgs
parents: 45
diff changeset
   190
    mCurrentModel->setData(QModelIndex(), mSaveActivity.value("VisibleIndex") , GlxTempVisualWindowIndex );
45
hgs
parents: 44
diff changeset
   191
    mViewManager->launchApplication(stateId, mCurrentModel); 
hgs
parents: 44
diff changeset
   192
    return true;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   195
bool GlxStateManager::validateActivityData()
72
hgs
parents: 71
diff changeset
   196
{    
hgs
parents: 71
diff changeset
   197
    if( ( mSaveActivity.value("ID") == GLX_GRIDVIEW_ID ) || 
hgs
parents: 71
diff changeset
   198
         ( ( mSaveActivity.value("ID") == GLX_LISTVIEW_ID ) && ( mSaveActivity.value("InternalState") == ALL_ITEM_S ) ) ||
hgs
parents: 71
diff changeset
   199
             ( mSaveActivity.value("VisibleIndex") >= 0 ) ) {
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   200
        return true;
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   201
    }
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   202
    
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   203
    qDebug("GlxStateManager::Validation failed");
72
hgs
parents: 71
diff changeset
   204
    return false;     
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   205
}
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   206
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   207
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
void GlxStateManager::launchFromExternal()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
{
50
hgs
parents: 45
diff changeset
   210
    qDebug("GlxStateManager::launchFromExternal");
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
    mCurrentState = createState(GLX_FULLSCREENVIEW_ID);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
    mCurrentState->setState(IMAGEVIEWER_S);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
    createModel(GLX_FULLSCREENVIEW_ID);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
    mCurrentModel->setData( mCurrentModel->index(0,0), 0, GlxFocusIndexRole );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
    mViewManager->launchApplication( GLX_FULLSCREENVIEW_ID, mCurrentModel);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   217
	setupItems();
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
void GlxStateManager::actionTriggered(qint32 id)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    qDebug("GlxStateManager::actionTriggered action ID = %d", id);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
    mCurrentState->eventHandler(id);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
    if (id != EGlxCmdHandled ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
        eventHandler(id);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
void GlxStateManager::setupItems()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
{    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
    qDebug("GlxStateManager::setupItems()");
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
    mActionHandler = new GlxActionHandler();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
    mViewManager->setupItems();
72
hgs
parents: 71
diff changeset
   234
    
hgs
parents: 71
diff changeset
   235
    switch( mCurrentState->id() ){
50
hgs
parents: 45
diff changeset
   236
        case GLX_LISTVIEW_ID:
72
hgs
parents: 71
diff changeset
   237
            mViewManager->updateToolBarIcon( GLX_ALBUM_ACTION_ID );
50
hgs
parents: 45
diff changeset
   238
            break;
54
hgs
parents: 50
diff changeset
   239
            
50
hgs
parents: 45
diff changeset
   240
        case GLX_GRIDVIEW_ID:
72
hgs
parents: 71
diff changeset
   241
            mViewManager->updateToolBarIcon( GLX_ALL_ACTION_ID );
hgs
parents: 71
diff changeset
   242
            break;
hgs
parents: 71
diff changeset
   243
            
50
hgs
parents: 45
diff changeset
   244
        default:
72
hgs
parents: 71
diff changeset
   245
            mViewManager->updateToolBarIcon( GLX_ALL_ACTION_ID );
hgs
parents: 71
diff changeset
   246
            break;
54
hgs
parents: 50
diff changeset
   247
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   250
void GlxStateManager::updateTNProgress( int count)
43
hgs
parents: 42
diff changeset
   251
{    
44
hgs
parents: 43
diff changeset
   252
    TRACER("GlxStateManager::updateTNProgress() ");
50
hgs
parents: 45
diff changeset
   253
    // this is case when progress bar is not showing
hgs
parents: 45
diff changeset
   254
    // in the case of rename of an image or capture the single item
hgs
parents: 45
diff changeset
   255
    // it is also launching the progress bar, to avoid this scenario add the check of count more than 5
45
hgs
parents: 44
diff changeset
   256
    if ( mCurrentModel && ( count > 5  ) ) { 
72
hgs
parents: 71
diff changeset
   257
        mViewManager->cancelViewTransitionEffect();
hgs
parents: 71
diff changeset
   258
        goBack( GLX_GRIDVIEW_ID, ALL_ITEM_S ) ;
hgs
parents: 71
diff changeset
   259
        cleanAllModel();
hgs
parents: 71
diff changeset
   260
        launchProgressDialog();
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   261
    }
43
hgs
parents: 42
diff changeset
   262
    
hgs
parents: 42
diff changeset
   263
    if ( isProgressbarRunning ){
hgs
parents: 42
diff changeset
   264
        if ( count == 0 ) {
44
hgs
parents: 43
diff changeset
   265
            vanishProgressDialog();
43
hgs
parents: 42
diff changeset
   266
        }
44
hgs
parents: 43
diff changeset
   267
        else {
hgs
parents: 43
diff changeset
   268
            mViewManager->updateProgressDialog( count );
hgs
parents: 43
diff changeset
   269
        }
45
hgs
parents: 44
diff changeset
   270
    }   
hgs
parents: 44
diff changeset
   271
}
54
hgs
parents: 50
diff changeset
   272
hgs
parents: 50
diff changeset
   273
void GlxStateManager::thumbnailPopulated()
hgs
parents: 50
diff changeset
   274
{
hgs
parents: 50
diff changeset
   275
    mViewManager->setModel( mCurrentModel );
hgs
parents: 50
diff changeset
   276
    isProgressbarRunning = false;
hgs
parents: 50
diff changeset
   277
    mViewManager->updateProgressDialog( 0 );  
hgs
parents: 50
diff changeset
   278
    disconnect ( mCurrentModel, SIGNAL( thumbnailPopulated() ), this, SLOT( thumbnailPopulated() ) );
hgs
parents: 50
diff changeset
   279
}
hgs
parents: 50
diff changeset
   280
45
hgs
parents: 44
diff changeset
   281
void GlxStateManager::saveData()
hgs
parents: 44
diff changeset
   282
{
hgs
parents: 44
diff changeset
   283
    if( (mCurrentState->id() == GLX_GRIDVIEW_ID && mCurrentState->state() == ALL_ITEM_S) || mCurrentState->id() == GLX_LISTVIEW_ID ) {
54
hgs
parents: 50
diff changeset
   284
        mSaveActivity.insert("ID",mCurrentState->id()); 
hgs
parents: 50
diff changeset
   285
        mSaveActivity.insert("InternalState",mCurrentState->state());
hgs
parents: 50
diff changeset
   286
        if(mCurrentModel) {
hgs
parents: 50
diff changeset
   287
            QVariant variant = mCurrentModel->data( mCurrentModel->index(0,0), GlxVisualWindowIndex );
hgs
parents: 50
diff changeset
   288
            if ( variant.isValid() &&  variant.canConvert<int> () ) {
hgs
parents: 50
diff changeset
   289
                mSaveActivity.insert("VisibleIndex",variant.value<int>());
hgs
parents: 50
diff changeset
   290
            }
hgs
parents: 50
diff changeset
   291
 		}
hgs
parents: 50
diff changeset
   292
 		else {
hgs
parents: 50
diff changeset
   293
 			mSaveActivity.insert("VisibleIndex",0);
45
hgs
parents: 44
diff changeset
   294
 		}
54
hgs
parents: 50
diff changeset
   295
    
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   296
        
54
hgs
parents: 50
diff changeset
   297
        QVariantHash metadata;
hgs
parents: 50
diff changeset
   298
        HbMainWindow *window = hbInstance->allMainWindows().first();
hgs
parents: 50
diff changeset
   299
        metadata.insert("screenshot", QPixmap::grabWidget(window, window->rect()));
hgs
parents: 50
diff changeset
   300
        
hgs
parents: 50
diff changeset
   301
        QByteArray serializedModel;
hgs
parents: 50
diff changeset
   302
        QDataStream stream(&serializedModel, QIODevice::WriteOnly | QIODevice::Append);
hgs
parents: 50
diff changeset
   303
        stream << mSaveActivity;
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   304
        bool ok = mActivityStorage->saveActivity("PhotosMainView", serializedModel, metadata);
54
hgs
parents: 50
diff changeset
   305
        
hgs
parents: 50
diff changeset
   306
        if ( !ok )
hgs
parents: 50
diff changeset
   307
        {
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   308
            qDebug("SaveData::Save activity failed" );
50
hgs
parents: 45
diff changeset
   309
        }
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   310
    }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   311
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   312
72
hgs
parents: 71
diff changeset
   313
void GlxStateManager::nextState( qint32 state, int internalState )
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
    qDebug("GlxStateManager::nextState next state = %u", state);
72
hgs
parents: 71
diff changeset
   316
    //no view transition is aloo during the progress dialog display
hgs
parents: 71
diff changeset
   317
    if( isProgressbarRunning ) {
hgs
parents: 71
diff changeset
   318
        return ;
hgs
parents: 71
diff changeset
   319
    }
hgs
parents: 71
diff changeset
   320
    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
    GlxEffect effect = NO_EFFECT ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
    GlxViewEffect viewEffect = NO_VIEW ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
    
72
hgs
parents: 71
diff changeset
   324
    mCurrentState = createState( state ); //create a new state
hgs
parents: 71
diff changeset
   325
    mCurrentState->setState( internalState );     
hgs
parents: 71
diff changeset
   326
    createModel( state ); //model should created after the internal state was set.
hgs
parents: 71
diff changeset
   327
hgs
parents: 71
diff changeset
   328
    mCurrentState->setTranstionParameter( FORWARD_DIR, effect, viewEffect ); // to run the transtion effect
hgs
parents: 71
diff changeset
   329
    if ( viewEffect == NO_VIEW ) {
hgs
parents: 71
diff changeset
   330
        mViewManager->launchView( state, mCurrentModel );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
    }
72
hgs
parents: 71
diff changeset
   332
    else {
hgs
parents: 71
diff changeset
   333
        mViewManager->launchView( state, mCurrentModel, effect, viewEffect );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
void GlxStateManager::previousState()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
    qDebug("GlxStateManager::previousState");
72
hgs
parents: 71
diff changeset
   340
    //no view transition is aloo during the progress dialog display
hgs
parents: 71
diff changeset
   341
    if( isProgressbarRunning ) {
hgs
parents: 71
diff changeset
   342
        return ;
hgs
parents: 71
diff changeset
   343
    }
hgs
parents: 71
diff changeset
   344
    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    GlxEffect effect = NO_EFFECT ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
    GlxViewEffect viewEffect = NO_VIEW ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
    GlxState *state = mCurrentState; // To delete the current state later  
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
    if ( mCurrentState->previousState() == NULL ) { //In the case only one state in stack then exit from the application
54
hgs
parents: 50
diff changeset
   351
        saveImage(); // save image if it is in private folder
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
        exitApplication() ;
45
hgs
parents: 44
diff changeset
   353
        return ;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   355
    else {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
        //effect parameter should be set here other wise there is no way to know from where it come from
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   357
        mCurrentState->setTranstionParameter( BACKWARD_DIR, effect, viewEffect);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   358
        mCurrentState = mCurrentState->previousState(); //get the pervious state
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   359
        createModel( mCurrentState->id(), BACKWARD_DIR ); 
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
        if ( viewEffect == NO_VIEW ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
            mViewManager->launchView( mCurrentState->id(), mCurrentModel );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
        }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   364
        else {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
            mViewManager->launchView( mCurrentState->id(), mCurrentModel, effect, viewEffect);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
        }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
    delete state;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
}
54
hgs
parents: 50
diff changeset
   370
hgs
parents: 50
diff changeset
   371
void GlxStateManager::saveImage()
hgs
parents: 50
diff changeset
   372
    {
hgs
parents: 50
diff changeset
   373
    CGlxImageViewerManager *imageViewerInstance = CGlxImageViewerManager::InstanceL();
hgs
parents: 50
diff changeset
   374
    if(imageViewerInstance->IsPrivate())
hgs
parents: 50
diff changeset
   375
        {
hgs
parents: 50
diff changeset
   376
        HBufC* imagePath = imageViewerInstance->ImageUri();
hgs
parents: 50
diff changeset
   377
		QString srcPath = QString::fromUtf16(imagePath->Des().Ptr(),imagePath->Length());
hgs
parents: 50
diff changeset
   378
		QString imageName = srcPath.section('\\', -1);
hgs
parents: 50
diff changeset
   379
		QString imagesFolderPath("c:/data/images/");
hgs
parents: 50
diff changeset
   380
		QString destPath;
hgs
parents: 50
diff changeset
   381
		destPath.append(imagesFolderPath);
hgs
parents: 50
diff changeset
   382
		destPath.append(imageName);
hgs
parents: 50
diff changeset
   383
		int cnt = 1;
hgs
parents: 50
diff changeset
   384
		qDebug() << "GlxStateManager::saveImage path before while = "<< destPath;
hgs
parents: 50
diff changeset
   385
		while(!QFile::copy(srcPath,destPath))
hgs
parents: 50
diff changeset
   386
			{
hgs
parents: 50
diff changeset
   387
			QString filename = imageName.section('.', 0,0);
hgs
parents: 50
diff changeset
   388
			QString ext = imageName.section('.', -1);
hgs
parents: 50
diff changeset
   389
			destPath.clear();
hgs
parents: 50
diff changeset
   390
			destPath = imagesFolderPath + filename + QString::number(cnt) + "." + ext;
hgs
parents: 50
diff changeset
   391
			qDebug() << "GlxStateManager::saveImage path = "<< destPath;
hgs
parents: 50
diff changeset
   392
			cnt++;
hgs
parents: 50
diff changeset
   393
			}
hgs
parents: 50
diff changeset
   394
        }
hgs
parents: 50
diff changeset
   395
    imageViewerInstance->Close();
hgs
parents: 50
diff changeset
   396
    }
hgs
parents: 50
diff changeset
   397
	
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
void GlxStateManager::goBack(qint32 stateId, int internalState)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   400
    qDebug("GlxStateManager::goBack()");
72
hgs
parents: 71
diff changeset
   401
    //no view transition is aloo during the progress dialog display
hgs
parents: 71
diff changeset
   402
    if( isProgressbarRunning ) {
hgs
parents: 71
diff changeset
   403
        return ;
hgs
parents: 71
diff changeset
   404
    }
hgs
parents: 71
diff changeset
   405
        
43
hgs
parents: 42
diff changeset
   406
    //if current state and it internal state is same then no need to do any thing
hgs
parents: 42
diff changeset
   407
    if ( mCurrentState->id() == stateId  && mCurrentState->state() == internalState ) {
hgs
parents: 42
diff changeset
   408
        return ;
hgs
parents: 42
diff changeset
   409
    }
hgs
parents: 42
diff changeset
   410
    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
    GlxState *state = mCurrentState;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
    
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   413
    while ( mCurrentState ) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   414
        if ( mCurrentState->id() == stateId  && mCurrentState->state() == internalState ) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   415
            break ;           
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   416
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   417
        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
        mCurrentState = mCurrentState->previousState(); // set pervious state to the current state
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
        delete state; //delete the current state
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   420
        state = mCurrentState;    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
    //case when new state is not hierarchy then create a new state
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
    if ( mCurrentState == NULL ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
        mCurrentState = createState(stateId);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
        mCurrentState->setState( internalState );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
    }   
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
    qDebug("GlxStateManager::goBack() state %u", mCurrentState);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
    createModel( mCurrentState->id() ); //model should created after the internal state was set.
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
    mViewManager->launchView( mCurrentState->id(), mCurrentModel );   
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
void GlxStateManager::changeState(qint32 stateId, int internalState)
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
    qDebug("GlxStateManager::changeState %d", stateId);	
72
hgs
parents: 71
diff changeset
   437
    //no view transition is aloo during the progress dialog display
hgs
parents: 71
diff changeset
   438
    if( isProgressbarRunning ) {
hgs
parents: 71
diff changeset
   439
        return ;
hgs
parents: 71
diff changeset
   440
    }
hgs
parents: 71
diff changeset
   441
        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
    GlxState *state = mCurrentState;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
    GlxEffect effect = NO_EFFECT ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
    GlxViewEffect viewEffect = NO_VIEW ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
    mCurrentState = mCurrentState->previousState();//pervious state of current state become the pervious state of new state 
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
    mCurrentState = createState(stateId);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
    mCurrentState->setState( internalState );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
    createModel( stateId ); //model should created after the internal state was set.
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
    mCurrentState->setTranstionParameter( NO_DIR, effect, viewEffect); //set the transition parameter    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
    if ( viewEffect == NO_VIEW ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
        mViewManager->launchView( mCurrentState->id(), mCurrentModel );
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
    else {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
        mViewManager->launchView( mCurrentState->id(), mCurrentModel, effect, viewEffect);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
    delete state;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
}
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
void GlxStateManager::removeCurrentModel()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
{
44
hgs
parents: 43
diff changeset
   464
    TRACER("GlxStateManager::removeCurrentModel() ");
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
    if ( mCurrentModel == mAllMediaModel ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   466
        qDebug("GlxStateManager::removeCurrentModel() remove all media model");	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
        delete mAllMediaModel ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
        mAllMediaModel = NULL ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   469
        mCurrentModel = NULL ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   470
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
    else if ( mCurrentModel == mAlbumGridMediaModel ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   472
        qDebug("GlxStateManager::removeCurrentModel() remove album grid media model");	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
        delete mAlbumGridMediaModel ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
        mAlbumGridMediaModel = NULL ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
        mCurrentModel = NULL ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
    else if ( mCurrentModel == mAlbumMediaModel ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
        qDebug("GlxStateManager::removeCurrentModel() remove  model");	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   479
        delete mAlbumMediaModel ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   480
        mAlbumMediaModel = NULL ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
        mCurrentModel = NULL ;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
    else {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
    	qDebug("GlxStateManager::removeCurrentModel() do nothing");
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
    	//do nothing
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
    }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   489
void GlxStateManager::cleanAllModel()
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   490
{
44
hgs
parents: 43
diff changeset
   491
    TRACER("GlxStateManager::cleanAllModel() ");
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   492
    delete mAllMediaModel ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   493
    mAllMediaModel = NULL ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   494
    delete mAlbumMediaModel ; 
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   495
    mAlbumMediaModel = NULL ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   496
    delete mAlbumGridMediaModel ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   497
    mAlbumGridMediaModel = NULL ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   498
    delete mImageviewerMediaModel ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   499
    mImageviewerMediaModel = NULL ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   500
    mCurrentModel = NULL ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   501
}
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   502
44
hgs
parents: 43
diff changeset
   503
void GlxStateManager::launchProgressDialog()
hgs
parents: 43
diff changeset
   504
{
hgs
parents: 43
diff changeset
   505
    TRACER("GlxStateManager::launchProgressDialog() ");
hgs
parents: 43
diff changeset
   506
    
hgs
parents: 43
diff changeset
   507
    QCoreApplication::instance()->installEventFilter( this );
54
hgs
parents: 50
diff changeset
   508
    if ( isProgressbarRunning ) {
hgs
parents: 50
diff changeset
   509
        mViewManager->updateProgressDialog( mTNObserver->getTNLeftCount() );
hgs
parents: 50
diff changeset
   510
    }
hgs
parents: 50
diff changeset
   511
    else {
hgs
parents: 50
diff changeset
   512
        mViewManager->launchProgressDialog( mTNObserver->getTNLeftCount() );
hgs
parents: 50
diff changeset
   513
    }
44
hgs
parents: 43
diff changeset
   514
    isProgressbarRunning = true ;
hgs
parents: 43
diff changeset
   515
}
hgs
parents: 43
diff changeset
   516
hgs
parents: 43
diff changeset
   517
void GlxStateManager::vanishProgressDialog()
hgs
parents: 43
diff changeset
   518
{
hgs
parents: 43
diff changeset
   519
    TRACER("GlxStateManager::vanishProgressDialog() ");
hgs
parents: 43
diff changeset
   520
    QCoreApplication::instance()->removeEventFilter( this );
54
hgs
parents: 50
diff changeset
   521
    createModel( mCurrentState->id() );
hgs
parents: 50
diff changeset
   522
    connect ( mCurrentModel, SIGNAL( thumbnailPopulated() ), this, SLOT( thumbnailPopulated() ) );
44
hgs
parents: 43
diff changeset
   523
}
hgs
parents: 43
diff changeset
   524
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
GlxState * GlxStateManager::createState(qint32 stateId)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
    qDebug("GlxStateManager::createState state id = %d", stateId);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
    switch( stateId ) {    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
    case GLX_GRIDVIEW_ID :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
        return new GlxGridState( this, mCurrentState );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   532
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
    case GLX_LISTVIEW_ID :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
        return new GlxListState( mCurrentState );    	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
    	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
    case GLX_FULLSCREENVIEW_ID :
50
hgs
parents: 45
diff changeset
   537
        return new GlxFullScreenState( this, mCurrentState );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   538
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
    case GLX_DETAILSVIEW_ID:
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
        return new GlxDetailState( mCurrentState );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   542
    case GLX_SLIDESHOWVIEW_ID :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   543
        return new GlxSlideShowState( this, mCurrentState );
72
hgs
parents: 71
diff changeset
   544
        
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   545
    case GLX_SLIDESHOWSETTINGSVIEW_ID :
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   546
        return new GlxSlideShowSettingsState(this, mCurrentState );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
    	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
    default :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   549
        return NULL;		
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
    } 
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
void GlxStateManager::createModel(qint32 stateId, NavigationDir dir)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   554
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
    switch( stateId ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   556
    case GLX_GRIDVIEW_ID :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   557
        createGridModel( mCurrentState->state(), dir );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   559
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
    case GLX_LISTVIEW_ID :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
    	//To:Do change the code when integrate the album list model
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
        if (mAlbumMediaModel == NULL) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
            GlxModelParm modelParm (KGlxCollectionPluginAlbumsImplementationUid, 0);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
            mAlbumMediaModel = new GlxAlbumModel (modelParm);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
        }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
        mCurrentModel = mAlbumMediaModel;
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   567
        mCollectionId = KGlxCollectionPluginAlbumsImplementationUid;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   568
        mCurrentModel->setData(QModelIndex(), (int)GlxContextPtList, GlxContextRole );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   569
        mViewManager->updateToolBarIcon(GLX_ALBUM_ACTION_ID);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   570
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   571
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   572
    case GLX_FULLSCREENVIEW_ID :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   573
		if ( mCurrentState->state() == IMAGEVIEWER_S) {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   574
            GlxModelParm modelParm (KGlxCollectionPluginImageViewerImplementationUid, 0);
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   575
            mCurrentModel = mImageviewerMediaModel = new GlxMediaModel (modelParm);
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   576
            mCollectionId = KGlxCollectionPluginImageViewerImplementationUid;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
		}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   578
        else if ( mCurrentState->state() == EXTERNAL_S) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   579
            if(!mAllMediaModel) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   580
                GlxModelParm modelParm (KGlxCollectionPluginAllImplementationUid, 0);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
                mCurrentModel = mAllMediaModel = new GlxMediaModel (modelParm);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   582
            }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   583
            else {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
                mCurrentModel = mAllMediaModel;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   585
            }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   586
            mCollectionId = KGlxCollectionPluginAllImplementationUid;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   587
        }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   588
		setFullScreenContext();
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   590
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
    case GLX_DETAILSVIEW_ID :
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   592
        setFullScreenContext();
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   595
    case GLX_SLIDESHOWVIEW_ID :
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   596
        if ( mCurrentState->state() == SLIDESHOW_ALBUM_ITEM_S ) {
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
            GlxModelParm modelParm ( KGlxAlbumsMediaId , 0);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   598
            mCurrentModel = mAlbumGridMediaModel = new GlxMediaModel( modelParm );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   599
        }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   600
        setFullScreenContext();
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   601
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   602
    	    	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   603
    default :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   604
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   605
    }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   606
    mCurrentModel->setData( QModelIndex(), mCurrentState->state(), GlxSubStateRole );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   607
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   608
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   609
void GlxStateManager::createGridModel(int internalState, NavigationDir dir)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   610
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
    GlxModelParm modelParm;
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   612
    GlxContextMode mode;
65
hgs
parents: 54
diff changeset
   613
    modelParm.setFilterType(EGlxFilterImage);
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   614
    if ( mViewManager->orientation() == Qt::Horizontal ) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   615
        mode = GlxContextLsGrid ;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   616
    }
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   617
    else {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   618
        mode = GlxContextPtGrid ;
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
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   621
    switch( internalState) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   622
    case ALL_ITEM_S :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
        if ( mAllMediaModel == NULL ) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
            modelParm.setCollection( KGlxCollectionPluginAllImplementationUid );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   625
            modelParm.setDepth(0);
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   626
            modelParm.setContextMode( mode ) ;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
            mAllMediaModel = new GlxMediaModel( modelParm );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   628
        }
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   629
        mCollectionId = KGlxCollectionPluginAllImplementationUid;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   630
        mCurrentModel = mAllMediaModel;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   631
        mViewManager->updateToolBarIcon(GLX_ALL_ACTION_ID);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   632
        break;
65
hgs
parents: 54
diff changeset
   633
hgs
parents: 54
diff changeset
   634
    case FETCHER_ITEM_S:
hgs
parents: 54
diff changeset
   635
        if ( mAllMediaModel == NULL ) {
hgs
parents: 54
diff changeset
   636
            modelParm.setCollection( KGlxCollectionPluginAllImplementationUid );
hgs
parents: 54
diff changeset
   637
            modelParm.setDepth(0); 
hgs
parents: 54
diff changeset
   638
            if(EGlxFetcherFilterNone != mFetcherFilterType ){
hgs
parents: 54
diff changeset
   639
                modelParm.setFilterType(EGlxFilterFetcherMimeType);
hgs
parents: 54
diff changeset
   640
                modelParm.setFetcherFiterType(mFetcherFilterType);
hgs
parents: 54
diff changeset
   641
            }
hgs
parents: 54
diff changeset
   642
            modelParm.setContextMode( mode ) ;
hgs
parents: 54
diff changeset
   643
            mAllMediaModel = new GlxMediaModel( modelParm );
hgs
parents: 54
diff changeset
   644
        }
hgs
parents: 54
diff changeset
   645
        mCollectionId = KGlxCollectionPluginAllImplementationUid;
hgs
parents: 54
diff changeset
   646
        mCurrentModel = mAllMediaModel;
hgs
parents: 54
diff changeset
   647
        mViewManager->updateToolBarIcon(GLX_ALL_ACTION_ID);
hgs
parents: 54
diff changeset
   648
        break;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   649
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
    case ALBUM_ITEM_S :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
        if ( dir != BACKWARD_DIR ) { 
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
            modelParm.setCollection( KGlxAlbumsMediaId );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   653
            modelParm.setDepth(0);
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   654
            modelParm.setContextMode( mode ) ;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
            mAlbumGridMediaModel = new GlxMediaModel( modelParm );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
        }               
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
        mCollectionId = KGlxAlbumsMediaId;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
        mCurrentModel = mAlbumGridMediaModel ;
65
hgs
parents: 54
diff changeset
   659
        break;
hgs
parents: 54
diff changeset
   660
hgs
parents: 54
diff changeset
   661
    case FETCHER_ALBUM_ITEM_S :    
hgs
parents: 54
diff changeset
   662
        if ( dir != BACKWARD_DIR ) { 
hgs
parents: 54
diff changeset
   663
            modelParm.setCollection( KGlxAlbumsMediaId );
hgs
parents: 54
diff changeset
   664
            modelParm.setDepth(0);
hgs
parents: 54
diff changeset
   665
            if(EGlxFetcherFilterNone != mFetcherFilterType){
hgs
parents: 54
diff changeset
   666
                modelParm.setFilterType(EGlxFilterFetcherMimeType);
hgs
parents: 54
diff changeset
   667
                modelParm.setFetcherFiterType(mFetcherFilterType);
hgs
parents: 54
diff changeset
   668
            }
hgs
parents: 54
diff changeset
   669
            modelParm.setContextMode( mode ) ;
hgs
parents: 54
diff changeset
   670
            mAlbumGridMediaModel = new GlxMediaModel( modelParm );
hgs
parents: 54
diff changeset
   671
        }               
hgs
parents: 54
diff changeset
   672
        mCollectionId = KGlxAlbumsMediaId;
hgs
parents: 54
diff changeset
   673
        mCurrentModel = mAlbumGridMediaModel ;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   674
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   675
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   676
    default :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   677
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   678
    }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   679
    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   680
    mCurrentModel->setData(QModelIndex(), (int)mode, GlxContextRole );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   681
}
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   682
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   683
void GlxStateManager::setFullScreenContext()
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   684
{
40
hgs
parents: 26
diff changeset
   685
    if ( mViewManager->orientation() == Qt::Horizontal || mCurrentState->id() == GLX_SLIDESHOWVIEW_ID ) {
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   686
        mCurrentModel->setData(QModelIndex(), (int)GlxContextLsFs, GlxContextRole );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   687
    }
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   688
    else {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   689
        mCurrentModel->setData(QModelIndex(), (int)GlxContextPtFs, GlxContextRole );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   690
    }    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   691
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   692
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   693
void GlxStateManager::eventHandler(qint32 &id)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   694
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   695
    qDebug("GlxStateManager::eventHandler action id = %d", id);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   696
    switch(id) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   697
    case EGlxCmdAllGridOpen :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   698
        changeState( GLX_GRIDVIEW_ID, ALL_ITEM_S );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   699
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   700
        break;
54
hgs
parents: 50
diff changeset
   701
hgs
parents: 50
diff changeset
   702
    case EGlxCmdFetcherAllGridOpen :
hgs
parents: 50
diff changeset
   703
        changeState( GLX_GRIDVIEW_ID, FETCHER_ITEM_S );
hgs
parents: 50
diff changeset
   704
        id = EGlxCmdHandled;
hgs
parents: 50
diff changeset
   705
        break;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   706
    	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   707
    case EGlxCmdAlbumListOpen:
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   708
        changeState( GLX_LISTVIEW_ID, -1 );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   709
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   710
        break;
54
hgs
parents: 50
diff changeset
   711
    case EGlxCmdFetcherAlbumListOpen:
hgs
parents: 50
diff changeset
   712
        changeState( GLX_LISTVIEW_ID, FETCHER_ALBUM_S );
hgs
parents: 50
diff changeset
   713
        id = EGlxCmdHandled;
hgs
parents: 50
diff changeset
   714
        break;
hgs
parents: 50
diff changeset
   715
        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   716
    case EGlxCmdAlbumGridOpen:
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   717
        nextState( GLX_GRIDVIEW_ID, ALBUM_ITEM_S );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   718
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   719
        break;
54
hgs
parents: 50
diff changeset
   720
    case EGlxCmdFetcherAlbumGridOpen:
hgs
parents: 50
diff changeset
   721
        nextState( GLX_GRIDVIEW_ID, FETCHER_ALBUM_ITEM_S );
hgs
parents: 50
diff changeset
   722
        id = EGlxCmdHandled;
hgs
parents: 50
diff changeset
   723
        break;
hgs
parents: 50
diff changeset
   724
        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   725
    case EGlxCmdFirstSlideshow :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   726
        //play the slide show with first item
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   727
        mCurrentModel->setData( mCurrentModel->index(0, 0), 0, GlxFocusIndexRole );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   728
        nextState( GLX_SLIDESHOWVIEW_ID, SLIDESHOW_GRID_ITEM_S );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   729
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   730
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   731
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   732
    case EGlxCmdSelectSlideshow:
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   733
        //play the slide show with selected item
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   734
        nextState( GLX_SLIDESHOWVIEW_ID, SLIDESHOW_GRID_ITEM_S );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   735
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   736
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   737
        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   738
    case EGlxCmdAlbumSlideShow:
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   739
        //play the slide show for a album
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   740
        nextState( GLX_SLIDESHOWVIEW_ID, SLIDESHOW_ALBUM_ITEM_S );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   741
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   742
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   743
        
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   744
    case EGlxCmdSlideshowSettings:
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   745
        nextState(GLX_SLIDESHOWSETTINGSVIEW_ID,-1 );
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   746
        id = EGlxCmdHandled;
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   747
        break;
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   748
        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   749
    case EGlxCmdDetailsOpen:
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   750
        qDebug("GlxStateManager::eventHandler EGlxCmdDetailsOpen");
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
        nextState( GLX_DETAILSVIEW_ID, -1 );
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   752
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   753
        break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   754
        
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   755
    case EGlxCmdEmptyData : {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   756
        GlxState *tmpState = mCurrentState ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   757
        while ( tmpState->id() != GLX_GRIDVIEW_ID ) {
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   758
            tmpState = tmpState->previousState() ;
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   759
        }
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   760
        
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   761
        goBack( GLX_GRIDVIEW_ID, tmpState->state() );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   762
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   763
        break;
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   764
    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   765
    	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   766
    case EGlxCmdBack :
54
hgs
parents: 50
diff changeset
   767
    case EGlxCmdSlideShowBack :
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   768
    	previousState();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
    	id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   770
    	break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   771
    	
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   772
    case EGlxCmdCameraOpen:
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   773
		{
72
hgs
parents: 71
diff changeset
   774
		QProcess::startDetached( QString( "cxui.exe" ) );
hgs
parents: 71
diff changeset
   775
		mViewManager->updateToolBarActionState( GLX_CAMERA_ACTION_ID, false );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   776
		id = EGlxCmdHandled;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
		}
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   778
        break;	
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   779
        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   780
    case EGlxCmdOviOpen:
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
		{
72
hgs
parents: 71
diff changeset
   782
		HbNotificationDialog::launchDialog( "Not Implemented" );
hgs
parents: 71
diff changeset
   783
		mViewManager->updateToolBarActionState( GLX_OVI_ACTION_ID, false );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
        id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
		}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
        break;	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
        
54
hgs
parents: 50
diff changeset
   788
   case EGlxCmdMarkAll :
hgs
parents: 50
diff changeset
   789
   case EGlxCmdUnMarkAll :
hgs
parents: 50
diff changeset
   790
   case EGlxCmd3DEffectOn :
hgs
parents: 50
diff changeset
   791
   case EGlxCmd3DEffectOff :
hgs
parents: 50
diff changeset
   792
   case EGlxCmdPlayBackAnim :
hgs
parents: 50
diff changeset
   793
       mViewManager->handleUserAction( mCurrentState->id(), id );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
       id = EGlxCmdHandled;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
       break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
       
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
   case EGlxCmdSetupItem :
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   798
       emit setupItemsSignal();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   799
       break;
54
hgs
parents: 50
diff changeset
   800
   
hgs
parents: 50
diff changeset
   801
   case EGlxCmdFetcherSelect: 
hgs
parents: 50
diff changeset
   802
       {
hgs
parents: 50
diff changeset
   803
       QModelIndex selectedIndex = mCurrentModel->index(mCurrentModel->data(mCurrentModel->index(0,0),GlxFocusIndexRole).value<int>(),0);
hgs
parents: 50
diff changeset
   804
       emit gridItemSelected(selectedIndex,*mCurrentModel);
hgs
parents: 50
diff changeset
   805
       id = EGlxCmdHandled;
hgs
parents: 50
diff changeset
   806
       }
hgs
parents: 50
diff changeset
   807
       break;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
       
54
hgs
parents: 50
diff changeset
   809
   default :
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
        mActionHandler->handleAction(id,mCollectionId);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
    	break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   812
    }	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   813
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   814
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   815
void GlxStateManager::exitApplication()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   816
{
45
hgs
parents: 44
diff changeset
   817
    
hgs
parents: 44
diff changeset
   818
    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   819
    //To:Do memory cleanup
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   820
        QApplication::quit();
45
hgs
parents: 44
diff changeset
   821
     
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   822
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   823
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   824
GlxStateManager::~GlxStateManager()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   826
    qDebug("GlxStateManager::~GlxStateManager");
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   827
    cleanAllModel();
50
hgs
parents: 45
diff changeset
   828
    mSaveActivity.clear();
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
    delete mActionHandler;
71
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   830
    delete mActivation;
27f2d7aec52a 201039_01
hgs
parents: 69
diff changeset
   831
    delete mActivityStorage;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
    qDebug("GlxStateManager::~GlxStateManager delete Model");
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   833
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   834
    disconnect ( mViewManager, SIGNAL(actionTriggered(qint32 )), this, SLOT(actionTriggered(qint32 )) );
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   835
    disconnect ( mTNObserver, SIGNAL( leftTNCount( int ) ), this, SLOT( updateTNProgress( int ) ) );
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   836
    disconnect ( this, SIGNAL( setupItemsSignal() ), this, SLOT( setupItems() ) );
45
hgs
parents: 44
diff changeset
   837
    disconnect ( qobject_cast<HbApplication*>(qApp), SIGNAL (aboutToQuit()), this, SLOT(saveData()));
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   838
    
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   839
    delete mTNObserver;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   840
    delete mViewManager; 
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   841
    qDebug("GlxStateManager::~GlxStateManager delete view manager");
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   842
    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   843
    GlxState *tmp;   
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   844
    while (mCurrentState) {
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   845
        tmp = mCurrentState;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   846
        mCurrentState = mCurrentState->previousState();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
        delete tmp;        
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
    }
42
5e1df1b52eb3 201019_01
hgs
parents: 40
diff changeset
   849
    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   850
    qDebug("GlxStateManager::~GlxStateManager Exit");
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   851
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   852
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   853
void GlxStateManager::cleanupExternal()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   854
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   855
    qDebug("GlxStateManager::cleanupExternal");
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
    mViewManager->deactivateCurrentView();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
}