ui/viewmanagement/viewmanager/src/glxviewmanager.cpp
changeset 55 fb37077c270f
parent 49 f291796e213d
child 61 743eb0b9959e
equal deleted inserted replaced
49:f291796e213d 55:fb37077c270f
    38 #include <hbprogressdialog.h>
    38 #include <hbprogressdialog.h>
    39 #include <QItemSelectionModel>
    39 #include <QItemSelectionModel>
    40 #include <glxmainwindoweventfilter.h>
    40 #include <glxmainwindoweventfilter.h>
    41 #include <xqsettingsmanager.h>
    41 #include <xqsettingsmanager.h>
    42 #include <xqsettingskey.h>
    42 #include <xqsettingskey.h>
    43 
    43 #include <glxviewids.h>
       
    44 #include "glxmodelroles.h"
    44 
    45 
    45 GlxViewManager::GlxViewManager() 
    46 GlxViewManager::GlxViewManager() 
    46     : mBackAction( NULL ), 
    47     : mBackAction( NULL ), 
    47       mMenuManager( NULL ), 
    48       mMenuManager( NULL ), 
    48       mEffectEngine( NULL ), 
    49       mEffectEngine( NULL ), 
    50       mMarkingToolBar( NULL ), 
    51       mMarkingToolBar( NULL ), 
    51       mSelectionModel ( NULL ),
    52       mSelectionModel ( NULL ),
    52       mProgressDialog( NULL )
    53       mProgressDialog( NULL )
    53 {
    54 {
    54     qDebug("GlxViewManager::GlxViewManager() ");
    55     qDebug("GlxViewManager::GlxViewManager() ");
    55     PERFORMANCE_ADV ( viewMgrD1, "main window creation time" ) {
    56 
    56         //check the case when application launch through some other application (view plugin)
    57     //check the case when application launch through some other application (view plugin)
    57         mMainWindow = GlxExternalUtility::instance()->getMainWindow();
    58     mMainWindow = GlxExternalUtility::instance()->getMainWindow();
    58         if(mMainWindow == NULL)	{
    59     if(mMainWindow == NULL)	{
    59             mMainWindow = new HbMainWindow();
    60         mMainWindow = new HbMainWindow();
    60             connect(mMainWindow, SIGNAL( viewReady() ), this, SLOT( handleReadyView() ));
    61     }
    61         }
    62     connect(mMainWindow, SIGNAL( viewReady() ), this, SLOT( handleReadyView() ));
    62 		//Without this Zoom Does not work
    63     //Without this Zoom Does not work
    63 
    64 
    64 		mWindowEventFilter = new GlxMainWindowEventFilter;
    65     mWindowEventFilter = new GlxMainWindowEventFilter;
    65 		mMainWindow->scene()->installEventFilter(mWindowEventFilter);
    66     mMainWindow->scene()->installEventFilter(mWindowEventFilter);
    66 		mMainWindow->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
    67     mMainWindow->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
    67 		mMainWindow->viewport()->grabGesture(Qt::PinchGesture);
    68     mMainWindow->viewport()->grabGesture(Qt::PinchGesture);
    68     }
    69 
    69     HbStyleLoader::registerFilePath(":/data/photos.css");
    70     HbStyleLoader::registerFilePath(":/data/photos.css");
    70 }
    71 }
       
    72 
    71 void GlxViewManager::handleReadyView()
    73 void GlxViewManager::handleReadyView()
    72 {
    74 {
    73     emit actionTriggered( EGlxCmdSetupItem );
    75     emit actionTriggered( EGlxCmdSetupItem );
    74     emit applicationReady();
    76     emit applicationReady();
    75     disconnect(mMainWindow, SIGNAL( viewReady() ), this, SLOT( handleReadyView() ));
    77     disconnect(mMainWindow, SIGNAL( viewReady() ), this, SLOT( handleReadyView() ));
    76 }
    78 }
    77 
    79 
    78 void GlxViewManager::setupItems( )
    80 void GlxViewManager::setupItems( )
    79 {
    81 {
    80     mMenuManager = new GlxMenuManager(mMainWindow);
       
    81     addBackSoftKeyAction();    
    82     addBackSoftKeyAction();    
    82     addConnection();    
    83     addConnection();
    83     mMenuManager->addMenu( mView->viewId(), mView->menu() );
    84 }
       
    85 
       
    86 void GlxViewManager::launchApplication(qint32 id, QAbstractItemModel *model)
       
    87 {
       
    88     mModel = model;
       
    89     mMenuManager = new GlxMenuManager( mMainWindow );  //menu manager should be created before view.
    84     mMenuManager->setModel( mModel );
    90     mMenuManager->setModel( mModel );
    85 }
    91     mView = resolveView( id );
    86 
    92 
    87 void GlxViewManager::launchApplication(qint32 id, QAbstractItemModel *model)
       
    88 {
       
    89     mModel = model;
       
    90     PERFORMANCE_ADV ( viewMgrD1, "View Creation time" ) {
       
    91         mView = resolveView(id);
       
    92     }
       
    93     createToolBar();
    93     createToolBar();
    94     mView->addToolBar(mViewToolBar);
       
    95     
    94     
    96     /* We are showing the toolBar before activating the 
    95     /* We are showing the toolBar before activating the 
    97      * view. This is done to avoid the animation effect seen otherwise 
    96      * view. This is done to avoid the animation effect seen otherwise 
    98      * when the tool bar comes up.
    97      * when the tool bar comes up.
    99      * 
    98      * 
   101      * since we are creating a new tool bar..although a fake tool bar was 
   100      * since we are creating a new tool bar..although a fake tool bar was 
   102      * already created on the splashscreen
   101      * already created on the splashscreen
   103      * 
   102      * 
   104      */
   103      */
   105     mView->activate();
   104     mView->activate();
   106     
   105     mView->setModel( mModel );
   107     PERFORMANCE_ADV ( viewMgrD3, "Set Model time")  
   106     //visibility of tool bar dependes of view internal state so add the toolbar after setting model
   108         mView->setModel(mModel);
   107     mView->addToolBar( mViewToolBar ); 
   109         
   108     mMainWindow->setCurrentView( mView, false );
   110     PERFORMANCE_ADV( viewMgrD4, "View Display time") {
   109     mMainWindow->showFullScreen();
   111         mMainWindow->setCurrentView(mView, false);
       
   112         mMainWindow->showFullScreen();           
       
   113     }    
       
   114 }
   110 }
   115 
   111 
   116 void GlxViewManager::handleMenuAction(qint32 commandId)
   112 void GlxViewManager::handleMenuAction(qint32 commandId)
   117 {
   113 {
   118     emit actionTriggered(commandId);
   114     emit actionTriggered(commandId);
   119 }
   115 }
   120 
   116 
   121 void GlxViewManager::handleAction()
   117 void GlxViewManager::handleAction()
   122 {
   118 {
   123     HbAction *action = qobject_cast<HbAction*>(sender());
   119     HbAction *action = qobject_cast<HbAction*>(sender());
       
   120     action->setChecked( TRUE );
   124     qint32 commandId = action->data().toInt();
   121     qint32 commandId = action->data().toInt();
   125     emit actionTriggered(commandId);
   122     emit actionTriggered(commandId);
   126 }
   123 }
   127 
   124 
   128 void GlxViewManager::addBackSoftKeyAction ( )
   125 void GlxViewManager::addBackSoftKeyAction ( )
   129 {
   126 {
   130     qDebug("GlxViewManager::addBackSoftKeyAction ");
   127     qDebug("GlxViewManager::addBackSoftKeyAction ");
   131     //create the back soft key action and set the data
   128     //create the back soft key action and set the data
   132     mBackAction = new HbAction(Hb::BackNaviAction, this);
   129     mBackAction = new HbAction( Hb::BackNaviAction, this );
   133     mBackAction->setData(EGlxCmdBack);
   130     mBackAction->setData( EGlxCmdBack );
   134     mBackAction->setObjectName( "App Back" );
   131     mBackAction->setObjectName( "App Back" );
   135     mView->setNavigationAction( mBackAction );
   132     mView->setNavigationAction( mBackAction );
   136 }
   133 }
   137 
   134 
   138 Qt::Orientation GlxViewManager::orientation() const
   135 Qt::Orientation GlxViewManager::orientation() const
   139 {
   136 {
   140     return mMainWindow->orientation();
   137     return mMainWindow->orientation();
   141 }
   138 }
   142 
   139 
   143 void GlxViewManager::launchView(qint32 id, QAbstractItemModel *model)
   140 void GlxViewManager::launchView( qint32 id, QAbstractItemModel *model )
   144 {
   141 {
   145     qDebug("GlxViewManager::launchView Id = %d ", id);
   142     qDebug( "GlxViewManager::launchView Id = %d ", id );
   146     mModel = model;
   143     mModel = model;
   147     deActivateView();
   144     deActivateView();
   148     
   145     mMenuManager->setModel( mModel ); //set the model to get the item type info and row count info
   149     PERFORMANCE_ADV ( viewMgrD1, "View Creation time" ) {
   146     mView = resolveView( id );
   150         mView = resolveView(id);
       
   151     }
       
   152     
       
   153     activateView();
   147     activateView();
   154 }
   148 }
   155 
   149 
   156 void GlxViewManager::launchView (qint32 id, QAbstractItemModel *model, GlxEffect effect, GlxViewEffect viewEffect)
   150 void GlxViewManager::launchView (qint32 id, QAbstractItemModel *model, GlxEffect effect, GlxViewEffect viewEffect)
   157 {
   151 {
   174     itemList.clear();
   168     itemList.clear();
   175     
   169     
   176     //partially clean the view so that animation run smoothly
   170     //partially clean the view so that animation run smoothly
   177     GlxView *curr_view = (GlxView *) mMainWindow->currentView();
   171     GlxView *curr_view = (GlxView *) mMainWindow->currentView();
   178     curr_view->resetView();
   172     curr_view->resetView();
   179     
   173 
       
   174     mMenuManager->setModel( model ); //set the model to get the item type info and row count info
   180     mView = resolveView(id);
   175     mView = resolveView(id);
   181     //partially initialise the view so that animation run smoothly
   176     //partially initialise the view so that animation run smoothly
   182     mView->initializeView( model);
   177     mView->initializeView( model, curr_view );
   183     mModel = model; 
   178     mModel = model; 
   184 
   179 
   185     if ( viewEffect == CURRENT_VIEW || viewEffect == BOTH_VIEW ) { 
   180     if ( viewEffect == CURRENT_VIEW || viewEffect == BOTH_VIEW ) { 
   186         item = curr_view->getAnimationItem(effect);
   181         item = curr_view->getAnimationItem(effect);
   187         if ( item ) {
   182         if ( item ) {
   199             item->show();        
   194             item->show();        
   200             itemList.append(item);
   195             itemList.append(item);
   201         }
   196         }
   202     }
   197     }
   203     
   198     
       
   199     if ( effect == GRID_TO_FULLSCREEN ) {
       
   200         mViewToolBar->setZValue( item->zValue() - 5 );
       
   201     }
       
   202     
   204     //error check
   203     //error check
   205     if ( itemList.count() > 0 ) {
   204     if ( itemList.count() > 0 ) {
   206         mEffectEngine->runEffect(itemList, effect);
   205         mEffectEngine->runEffect(itemList, effect);
   207         mMainWindow->grabMouse();
   206         mMainWindow->grabMouse();
   208     }
   207     }
   245     User::ResetInactivityTime();  
   244     User::ResetInactivityTime();  
   246 
   245 
   247     //To:Do temp code remove later
   246     //To:Do temp code remove later
   248     if ( mProgressDialog ) {
   247     if ( mProgressDialog ) {
   249         i = ++i % 10;
   248         i = ++i % 10;
   250         switch ( i ) {
   249         icon = HbIcon( QString( ":/data/Wait/qgn_graf_ring_wait_%1.svg" ).arg( i + 1, 2, 10, QChar( '0' ) ) );
   251         case 0 :
   250         mProgressDialog->setIcon(icon);
   252             icon = HbIcon( QString(":/data/Image1.jpg") );
       
   253             break;
       
   254         case 1 :
       
   255             icon = HbIcon( QString(":/data/Image2.jpg") );
       
   256             break;
       
   257         case 2 :
       
   258             icon = HbIcon( QString(":/data/Image3.jpg") );
       
   259             break;
       
   260         case 3 :
       
   261             icon = HbIcon( QString(":/data/Image4.jpg") );
       
   262             break;
       
   263         case 4 :
       
   264             icon = HbIcon( QString(":/data/Image5.jpg") );
       
   265             break;
       
   266         case 5 :
       
   267             icon = HbIcon( QString(":/data/Image6.jpg") );
       
   268             break;
       
   269         case 6 :
       
   270             icon = HbIcon( QString(":/data/Image7.jpg") );
       
   271             break;
       
   272         case 7 :
       
   273             icon = HbIcon( QString(":/data/Image8.jpg") );
       
   274             break;
       
   275         case 8 :
       
   276             icon = HbIcon( QString(":/data/Image9.jpg") );
       
   277             break;
       
   278         case 9 :
       
   279             icon = HbIcon( QString(":/data/Image10.jpg") );
       
   280             break;            
       
   281         }
       
   282         
   251         
   283         int max = mProgressDialog->maximum() ;
   252         int max = mProgressDialog->maximum() ;
   284         if ( currentValue > max ) {
   253         if ( currentValue > max ) {
   285             mProgressDialog->setMaximum( currentValue );
   254             mProgressDialog->setMaximum( currentValue );
   286             max = currentValue ;
   255             max = currentValue ;
   287         }
   256         }
   288         
   257         
   289         mProgressDialog->setIcon(icon);
       
   290         
       
   291         if ( currentValue < 0 ) {
   258         if ( currentValue < 0 ) {
   292             mProgressDialog->setText( QString( "Refreshing" ) ); //To:Do string will change later
   259             mProgressDialog->setText( QString( GLX_REFRESHING ) ); //To:Do string will change later
   293             mProgressDialog->setProgressValue( 0 );
   260             mProgressDialog->setProgressValue( 0 );
   294         }
   261         }
   295         else {
   262         else {
   296             int value = max - currentValue;
   263             int value = max - currentValue;
   297             mProgressDialog->setProgressValue( value );
   264             mProgressDialog->setProgressValue( value );
   315     int toolBarActionId = (int) GLX_ALL_ACTION_ID;
   282     int toolBarActionId = (int) GLX_ALL_ACTION_ID;
   316     int count = mActionList.count();
   283     int count = mActionList.count();
   317     
   284     
   318     qDebug("GlxViewManager::updateToolBarIcon() action ID list %d count %d", id, count);
   285     qDebug("GlxViewManager::updateToolBarIcon() action ID list %d count %d", id, count);
   319     
   286     
   320     for ( int i = 0; i < count ; i++ )
   287     for ( int i = 0; i < count ; i++ ) {
   321         {
       
   322         qDebug("GlxViewManager::updateToolBarIcon() toolBarActionId %d value %d", toolBarActionId, ( id & toolBarActionId ) );
   288         qDebug("GlxViewManager::updateToolBarIcon() toolBarActionId %d value %d", toolBarActionId, ( id & toolBarActionId ) );
   323         //check and get the icon path
   289         //check and get the icon path
   324         if ( ( id & toolBarActionId ) == toolBarActionId )
   290         if ( ( id & toolBarActionId ) == toolBarActionId ) {
   325             {
       
   326             mActionList[i]->setCheckable(TRUE);
       
   327             mActionList[i]->setChecked(TRUE);                        
   291             mActionList[i]->setChecked(TRUE);                        
   328             }
   292         }
   329         else 
   293         else {
   330             {
       
   331             mActionList[i]->setChecked(FALSE);
   294             mActionList[i]->setChecked(FALSE);
   332             }
   295         }
   333         //to get it the next action id to verify it is selecter or not
   296         //to get it the next action id to verify it is selecter or not
   334         toolBarActionId = toolBarActionId << 1; 
   297         toolBarActionId = toolBarActionId << 1; 
   335         }
   298     }
   336 }
   299 }
   337 
   300 
   338 void GlxViewManager::checkMarked()
   301 void GlxViewManager::checkMarked()
   339 {
   302 {
   340     qDebug("GlxViewManager::checkMarked");
   303     qDebug("GlxViewManager::checkMarked");
   341     QModelIndexList selectedModelIndex = mSelectionModel->selectedIndexes();
   304     QModelIndexList selectedModelIndex = mSelectionModel->selectedIndexes();
   342     for ( int i = 0 ; i <  mMarkingActionList.count(); i++) {
   305     for ( int i = 0 ; i <  mMarkingActionList.count(); i++) {
   343         if( mMarkingActionList.at(i)->data()==EGlxCmdSelect) {
   306         if( mMarkingActionList.at(i)->data()==EGlxCmdSelect) {
   344        	    bool noSelection=selectedModelIndex.empty();
   307        	    bool noSelection=selectedModelIndex.empty();
   345             mMarkingActionList.at(i)->setDisabled(noSelection);
   308             mMarkingActionList.at(i)->setDisabled(noSelection);
   346             mMenuManager->disableAction(mView->menu(),noSelection);
       
   347             break;
   309             break;
   348         }
   310         }
   349     }
   311     }
   350 }
   312 }
   351 
   313 
   415     if ( mMenuManager ) {
   377     if ( mMenuManager ) {
   416         mMenuManager->setModel( model );
   378         mMenuManager->setModel( model );
   417     }    
   379     }    
   418 }
   380 }
   419 
   381 
   420 GlxView * GlxViewManager::resolveView(qint32 id)
   382 GlxView * GlxViewManager::resolveView( qint32 id )
   421 {
   383 {
   422     qDebug("GlxViewManager::resolveView %d", id);
   384     qDebug("GlxViewManager::resolveView %d", id );
   423     GlxView *view = findView ( id );
   385     GlxView *view = findView ( id );
   424     if ( view ) {
   386     if ( view ) {
   425         return view ;
   387         return view ;
   426     }
   388     }
   427     
   389     
   428     view = GlxViewsFactory::createView(id, mMainWindow);
   390     view = GlxViewsFactory::createView( id, mMainWindow );
   429     if ( view ) {
   391     if ( view ) {
   430         connect ( view, SIGNAL(actionTriggered(qint32 )), this, SLOT(actionProcess(qint32 )), Qt::QueuedConnection );
   392         connect ( view, SIGNAL( actionTriggered( qint32 ) ), this, SLOT( actionProcess( qint32 ) ), Qt::QueuedConnection );
   431         connect ( view, SIGNAL(itemSpecificMenuTriggered(qint32,QPointF ) ), this, SLOT( itemSpecificMenuTriggered(qint32,QPointF ) ), Qt::QueuedConnection );
   393         connect ( view, SIGNAL( itemSpecificMenuTriggered( qint32, QPointF ) ), this, SLOT( itemSpecificMenuTriggered( qint32, QPointF ) ), Qt::QueuedConnection );
   432         mViewList.append(view);
   394         mViewList.append( view );
   433         mMainWindow->addView(view);
   395         mMainWindow->addView( view );
   434         if ( mMenuManager ) {
   396         mMenuManager->addMenu( id, view->menu() );
   435             mMenuManager->addMenu( id, view->menu());
   397         
   436         }
       
   437         if ( mBackAction ) {
   398         if ( mBackAction ) {
   438             view->setNavigationAction( mBackAction );
   399             view->setNavigationAction( mBackAction );
   439         }
   400         }
   440     }
   401     }
   441     return view;
   402     return view;
   486 }
   447 }
   487 
   448 
   488 void GlxViewManager::activateView()
   449 void GlxViewManager::activateView()
   489 {
   450 {
   490     qDebug("GlxViewManager::activateView()");
   451     qDebug("GlxViewManager::activateView()");
   491         
   452 
   492     PERFORMANCE_ADV ( viewMgrD2, "View Activation time") {
   453     mView->activate();
   493         mView->addToolBar(mViewToolBar);
   454     mView->show();
   494         mView->activate();
   455     mView->setModel( mModel );
   495         mView->show();
   456     //visibility of tool bar dependes of view internal state so add the toolbar after setting model
   496         mMenuManager->setModel( mModel ); //set the model to get the item type info and row count info
   457     mView->addToolBar( mViewToolBar );
   497     }        
   458     mMainWindow->setCurrentView(mView, false);
   498       
   459     mMainWindow->showFullScreen(); 
   499     PERFORMANCE_ADV ( viewMgrD3, "Set Model time")  
       
   500         mView->setModel(mModel);
       
   501         
       
   502     PERFORMANCE_ADV( viewMgrD4, "View Display time") {
       
   503         mMainWindow->setCurrentView(mView, false);
       
   504         mMainWindow->showFullScreen();           
       
   505     }
       
   506 }
   460 }
   507 
   461 
   508 void GlxViewManager::createActions()
   462 void GlxViewManager::createActions()
   509 {
   463 {
   510     qDebug("GlxViewManager::createActions() " );
   464     qDebug("GlxViewManager::createActions() " );
   511     mActionList.clear();  
   465     mActionList.clear();  
       
   466 
       
   467     int curSubstate = getSubState();    
   512     
   468     
   513     //create the All tool bar button action
   469     //create the All tool bar button action
   514     HbAction* allAction = new HbAction( this );
   470     HbAction* allAction = new HbAction( this );
   515     allAction->setData( EGlxCmdAllGridOpen );
   471 
       
   472     if( curSubstate == FETCHER_ITEM_S ) {
       
   473         allAction->setData( EGlxCmdFetcherAllGridOpen );
       
   474     }else{
       
   475         allAction->setData( EGlxCmdAllGridOpen );
       
   476     }
       
   477 
   516     mActionList.append( allAction );    
   478     mActionList.append( allAction );    
   517     allAction->setIcon( HbIcon( GLXICON_ALL ) ) ;
   479     allAction->setIcon( HbIcon( GLXICON_ALL ) ) ;
   518     allAction->setObjectName( "All Action" );
   480     allAction->setObjectName( "All Action" );
   519        
   481        
   520     //create the Album tool bar button action
   482     //create the Album tool bar button action
   521     HbAction* albumAction = new HbAction( this );
   483     HbAction* albumAction = new HbAction( this );
   522     albumAction->setData( EGlxCmdAlbumListOpen );
   484 
       
   485     if( curSubstate == FETCHER_ITEM_S ) {
       
   486         albumAction->setData( EGlxCmdFetcherAlbumListOpen );
       
   487     }else{
       
   488         albumAction->setData( EGlxCmdAlbumListOpen );
       
   489     }
       
   490 
   523     mActionList.append( albumAction );
   491     mActionList.append( albumAction );
   524     albumAction->setIcon( HbIcon( GLXICON_ALBUMS ) ) ;
   492     albumAction->setIcon( HbIcon( GLXICON_ALBUMS ) ) ;
   525     albumAction->setObjectName( "Album Action" );
   493     albumAction->setObjectName( "Album Action" );
   526    
   494 	
       
   495 	//in case of fetcher no need to create other actions
       
   496 	if( curSubstate == FETCHER_ITEM_S ) {
       
   497 		return;
       
   498 		}	
   527     //create the album tool bar button action
   499     //create the album tool bar button action
   528     HbAction* cameraAction = new HbAction( this );
   500     HbAction* cameraAction = new HbAction( this );
   529     cameraAction->setData( EGlxCmdCameraOpen );
   501     cameraAction->setData( EGlxCmdCameraOpen );
   530     mActionList.append( cameraAction );  
   502     mActionList.append( cameraAction );  
   531     cameraAction->setIcon( HbIcon( GLXICON_CAMERA ) ) ;
   503     cameraAction->setIcon( HbIcon( GLXICON_CAMERA ) ) ;
   605     
   577     
   606     qDebug("GlxViewManager::createToolBar() clear the action" );
   578     qDebug("GlxViewManager::createToolBar() clear the action" );
   607     int count = mActionList.count();
   579     int count = mActionList.count();
   608     for ( int i = 0; i < count; i++ ) {
   580     for ( int i = 0; i < count; i++ ) {
   609         connect( mActionList.at(i), SIGNAL(triggered( )), this, SLOT(handleAction( )) );
   581         connect( mActionList.at(i), SIGNAL(triggered( )), this, SLOT(handleAction( )) );
       
   582         mActionList.at(i)->setCheckable( TRUE );
   610         mViewToolBar->addAction( mActionList.at(i) );      
   583         mViewToolBar->addAction( mActionList.at(i) );      
   611     }
   584     }
   612     qDebug("GlxViewManager::createToolBar() exit" );
   585     qDebug("GlxViewManager::createToolBar() exit" );
   613 }
   586 }
   614 
   587 
   703         mEffectEngine->deregistertransitionEffect();
   676         mEffectEngine->deregistertransitionEffect();
   704         delete mEffectEngine;
   677         delete mEffectEngine;
   705     }
   678     }
   706  
   679  
   707     if( mMainWindow != GlxExternalUtility::instance()->getMainWindow() ){
   680     if( mMainWindow != GlxExternalUtility::instance()->getMainWindow() ){
   708         qDebug("GlxViewManager::~GlxViewManager remove view");
   681         qDebug("GlxViewManager::~GlxViewManager delete mainwindow");
   709         delete mMainWindow;
   682         delete mMainWindow;
   710     }
   683     }
   711     delete mWindowEventFilter;
   684     delete mWindowEventFilter;
   712     
   685     
   713     qDebug("GlxViewManager::~GlxViewManager Exit");
   686     qDebug("GlxViewManager::~GlxViewManager Exit");
   714 }
   687 }
   715 
   688 
       
   689 int GlxViewManager::getSubState()
       
   690 {
       
   691     int curSubstate = NO_GRID_S;    
       
   692     
       
   693     if ( mModel  ) {    
       
   694         QVariant variant = mModel->data( mModel->index(0,0), GlxSubStateRole );    
       
   695         if ( variant.isValid() &&  variant.canConvert<int> ()  ) {
       
   696             curSubstate = variant.value<int>();
       
   697         }
       
   698     }
       
   699     return curSubstate;
       
   700 }