clock/clockui/clockviewmanager/src/clockviewmanager.cpp
changeset 58 ef813d54df51
parent 49 5de72ea7a065
child 68 a5a1242fd2e8
equal deleted inserted replaced
50:579cc610882e 58:ef813d54df51
    17 */
    17 */
    18 
    18 
    19 // System includes
    19 // System includes
    20 #include <HbMainWindow>
    20 #include <HbMainWindow>
    21 #include <HbInstance>
    21 #include <HbInstance>
    22 #include <hbapplication> // hbapplication
    22 #include <HbApplication>
    23 #include <hbactivitymanager> // hbactivitymanager
    23 #include <HbActivityManager>
       
    24 #include <HbToolBar>
    24 
    25 
    25 // User includes
    26 // User includes
    26 #include "clockviewmanager.h"
    27 #include "clockviewmanager.h"
    27 #include "clockdocloader.h"
    28 #include "clockdocloader.h"
    28 #include "clockmainview.h"
    29 #include "clockmainview.h"
    29 #include "clockcommon.h"
    30 #include "clockcommon.h"
    30 #include "clockdatatypes.h"
    31 #include "clockdatatypes.h"
    31 #include "clockworldview.h"
    32 #include "clockworldview.h"
       
    33 #include "OstTraceDefinitions.h"
       
    34 #ifdef OST_TRACE_COMPILER_IN_USE
       
    35 #include "clockviewmanagerTraces.h"
       
    36 #endif
       
    37 
    32 
    38 
    33 /*!
    39 /*!
    34 	\class ClockViewManager
    40 	\class ClockViewManager
    35 
    41 
    36 	This is the heart of the clock application. This is responsible for
    42 	This is the heart of the clock application. This is responsible for
    46 		ClockAppControllerIf &controllerIf, QObject *parent)
    52 		ClockAppControllerIf &controllerIf, QObject *parent)
    47 :QObject(parent),
    53 :QObject(parent),
    48  mAppControllerIf(controllerIf),
    54  mAppControllerIf(controllerIf),
    49  mWorldClockView(0)
    55  mWorldClockView(0)
    50 {
    56 {
       
    57     OstTraceFunctionEntry0( CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_ENTRY );
    51     // Activity Reason from Activity Manager
    58     // Activity Reason from Activity Manager
    52     int activityReason = qobject_cast<HbApplication*>(qApp)->activateReason();
    59     int activityReason = qobject_cast<HbApplication*>(qApp)->activateReason();
    53     
    60     
    54     if (Hb::ActivationReasonActivity == activityReason) {
    61     if (Hb::ActivationReasonActivity == activityReason) {
    55         // Application is started from an activity
    62         // Application is started from an activity
    84         connect(
    91         connect(
    85                 window, SIGNAL(viewReady()),
    92                 window, SIGNAL(viewReady()),
    86                 this, SLOT(loadOtherViews()));
    93                 this, SLOT(loadOtherViews()));
    87     }
    94     }
    88 
    95 
       
    96 OstTraceFunctionExit0( CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_EXIT );
    89 }
    97 }
    90 
    98 
    91 /*!
    99 /*!
    92 	Destructor.
   100 	Destructor.
    93  */
   101  */
    94 ClockViewManager::~ClockViewManager()
   102 ClockViewManager::~ClockViewManager()
    95 {
   103 {
       
   104 	OstTraceFunctionEntry0( DUP1_CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_ENTRY );
    96 	// No implementation yet.
   105 	// No implementation yet.
       
   106 OstTraceFunctionExit0( DUP1_CLOCKVIEWMANAGER_CLOCKVIEWMANAGER_EXIT );
    97 }
   107 }
    98 
   108 
    99 /*!
   109 /*!
   100 	Switches to view specified by view.
   110 	Switches to view specified by view.
   101 
   111 
   102 	\param view View Id.
   112 	\param view View Id.
   103  */
   113  */
   104 void ClockViewManager::showView(ClockViews view)
   114 void ClockViewManager::showView(ClockViews view)
   105 {
   115 {
       
   116 	OstTraceFunctionEntry0( CLOCKVIEWMANAGER_SHOWVIEW_ENTRY );
   106 	HbMainWindow *window = hbInstance->allMainWindows().first();
   117 	HbMainWindow *window = hbInstance->allMainWindows().first();
   107 
   118 
   108 	switch (view) {
   119 	switch (view) {
   109 		case MainView:
   120 		case MainView:
   110 		    // set captured screenshot as invalid as main view 
   121 		    // set captured screenshot as invalid as main view 
   128 			break;
   139 			break;
   129 
   140 
   130 		default:
   141 		default:
   131 			break;
   142 			break;
   132 	}
   143 	}
       
   144 OstTraceFunctionExit0( CLOCKVIEWMANAGER_SHOWVIEW_EXIT );
   133 }
   145 }
   134 
   146 
   135 /*!
   147 /*!
   136 	Loads the clock main view.
   148 	Loads the clock main view.
   137  */
   149  */
   138 void ClockViewManager::loadMainView()
   150 void ClockViewManager::loadMainView()
   139 {
   151 {
       
   152 	OstTraceFunctionEntry0( CLOCKVIEWMANAGER_LOADMAINVIEW_ENTRY );
   140 	bool loadSuccess;
   153 	bool loadSuccess;
   141 
   154 
   142 	// Construct the document loader instance
   155 	// Construct the document loader instance
   143 	ClockDocLoader *docLoader = new ClockDocLoader();
   156 	ClockDocLoader *docLoader = new ClockDocLoader();
   144 
   157 
   146 	docLoader->load(CLOCK_MAIN_VIEW_DOCML, &loadSuccess);
   159 	docLoader->load(CLOCK_MAIN_VIEW_DOCML, &loadSuccess);
   147 
   160 
   148 	// Find the main view.
   161 	// Find the main view.
   149 	mMainView = static_cast<ClockMainView *> (
   162 	mMainView = static_cast<ClockMainView *> (
   150 			docLoader->findWidget(CLOCK_MAIN_VIEW));
   163 			docLoader->findWidget(CLOCK_MAIN_VIEW));
       
   164 	
       
   165 	// Disable animation effect on toolbar.
       
   166 	HbEffect::disable(mMainView->toolBar()->graphicsItem());
   151 
   167 
   152 	// Setup the view.
   168 	// Setup the view.
   153 	mMainView->setupView(mAppControllerIf, docLoader);
   169 	mMainView->setupView(mAppControllerIf, docLoader);
   154 
   170 
   155 	// Set the main view to the window
   171 	// Set the main view to the window
   156 	hbInstance->allMainWindows().first()->addView(mMainView);
   172 	hbInstance->allMainWindows().first()->addView(mMainView);
       
   173 OstTraceFunctionExit0( CLOCKVIEWMANAGER_LOADMAINVIEW_EXIT );
   157 }
   174 }
   158 
   175 
   159 /*!
   176 /*!
   160 	Loads the world clock view.
   177 	Loads the world clock view.
   161  */
   178  */
   162 void ClockViewManager::loadWorldClockView()
   179 void ClockViewManager::loadWorldClockView()
   163 {
   180 {
       
   181 	OstTraceFunctionEntry0( CLOCKVIEWMANAGER_LOADWORLDCLOCKVIEW_ENTRY );
   164 	// Construct the document loader instance
   182 	// Construct the document loader instance
   165 	ClockDocLoader *docLoader = new ClockDocLoader();
   183 	ClockDocLoader *docLoader = new ClockDocLoader();
   166 
   184 
   167 	bool loadSuccess;
   185 	bool loadSuccess;
   168 
   186 
   170 	docLoader->load(CLOCK_WORLD_VIEW_DOCML, &loadSuccess);
   188 	docLoader->load(CLOCK_WORLD_VIEW_DOCML, &loadSuccess);
   171 
   189 
   172 	// Get the world list view.
   190 	// Get the world list view.
   173 	mWorldClockView = static_cast<ClockWorldView *> (
   191 	mWorldClockView = static_cast<ClockWorldView *> (
   174 			docLoader->findWidget(CLOCK_WORLD_VIEW));
   192 			docLoader->findWidget(CLOCK_WORLD_VIEW));
       
   193 	
       
   194 	// Disable animation effect on toolbar.
       
   195 	HbEffect::disable(mWorldClockView->toolBar()->graphicsItem());
   175 
   196 
   176 	mWorldClockView->setupView(mAppControllerIf, docLoader);
   197 	mWorldClockView->setupView(mAppControllerIf, docLoader);
       
   198 OstTraceFunctionExit0( CLOCKVIEWMANAGER_LOADWORLDCLOCKVIEW_EXIT );
   177 }
   199 }
   178 
   200 
   179 /*!
   201 /*!
   180 	Load other views
   202 	Load other views
   181  */
   203  */
   182 void ClockViewManager::loadOtherViews()
   204 void ClockViewManager::loadOtherViews()
   183 {
   205 {
       
   206 	OstTraceFunctionEntry0( CLOCKVIEWMANAGER_LOADOTHERVIEWS_ENTRY );
   184 	mMainView->setupAfterViewReady();
   207 	mMainView->setupAfterViewReady();
   185 	
   208 	
   186 	// Load world clock view
   209 	// Load world clock view
   187 	loadWorldClockView();
   210 	loadWorldClockView();
   188 
   211 
   189 	// Disconnect the signal viewReady as all the views are loaded.
   212 	// Disconnect the signal viewReady as all the views are loaded.
   190 	HbMainWindow *window = hbInstance->allMainWindows().first();
   213 	HbMainWindow *window = hbInstance->allMainWindows().first();
   191 	disconnect(
   214 	disconnect(
   192 			window, SIGNAL(viewReady()),
   215 			window, SIGNAL(viewReady()),
   193 			this, SLOT(loadOtherViews()));
   216 			this, SLOT(loadOtherViews()));
       
   217 	
       
   218 	// Need to emit this signal after the view is fully constructed & populated
       
   219 	// with actual data and ready to be used. So entry view & instance view
       
   220 	// needs to be created so that a new entry can also be created. Finally
       
   221 	// NotesApplication object needs to emit applicationReady Signal.
       
   222 	emit appReady();
       
   223 OstTraceFunctionExit0( CLOCKVIEWMANAGER_LOADOTHERVIEWS_EXIT );
   194 }
   224 }
   195 
   225 
   196 // End of file	--Don't remove this.
   226 // End of file	--Don't remove this.