clock/clockui/clockviews/src/clockmainview.cpp
changeset 50 579cc610882e
parent 49 5de72ea7a065
child 58 ef813d54df51
equal deleted inserted replaced
49:5de72ea7a065 50:579cc610882e
   125 
   125 
   126 	HbMainWindow *window = hbInstance->allMainWindows().first();
   126 	HbMainWindow *window = hbInstance->allMainWindows().first();
   127 
   127 
   128 	bool loadSuccess = false;
   128 	bool loadSuccess = false;
   129 	Qt::Orientation currentOrienation = window->orientation();
   129 	Qt::Orientation currentOrienation = window->orientation();
       
   130 	
       
   131 	// Get the dividers.
       
   132 	mHorizontalDivider = static_cast<HbLabel *> (
       
   133 			mDocLoader->findObject("horizontalDivider"));
       
   134 	mVerticalDivider = static_cast<HbLabel *> (
       
   135 				mDocLoader->findObject("verticalDivider"));
   130 
   136 
   131 	// Get the "No alarm set" label.
   137 	// Get the "No alarm set" label.
   132 	mNoAlarmLabel = qobject_cast<HbLabel *> (
   138 	mNoAlarmLabel = qobject_cast<HbLabel *> (
   133 			mDocLoader->findWidget(CLOCK_NOALARMLABEL));
   139 			mDocLoader->findWidget(CLOCK_NOALARMLABEL));
   134 
   140 
   157 	if (Qt::Vertical == currentOrienation) {
   163 	if (Qt::Vertical == currentOrienation) {
   158 		mDocLoader->load(
   164 		mDocLoader->load(
   159 				CLOCK_MAIN_VIEW_DOCML,
   165 				CLOCK_MAIN_VIEW_DOCML,
   160 				CLOCK_MAIN_VIEW_PORTRAIT_SECTION,
   166 				CLOCK_MAIN_VIEW_PORTRAIT_SECTION,
   161 				&loadSuccess);
   167 				&loadSuccess);
       
   168 		mHorizontalDivider->setVisible(true);
       
   169 		mVerticalDivider->setVisible(false);
   162 	} else {
   170 	} else {
   163 		mDocLoader->load(
   171 		mDocLoader->load(
   164 				CLOCK_MAIN_VIEW_DOCML,
   172 				CLOCK_MAIN_VIEW_DOCML,
   165 				CLOCK_MAIN_VIEW_LANDSCAPE_SECTION,
   173 				CLOCK_MAIN_VIEW_LANDSCAPE_SECTION,
   166 				&loadSuccess);
   174 				&loadSuccess);
       
   175 		mHorizontalDivider->setVisible(false);
       
   176 		mVerticalDivider->setVisible(true);
   167 	}
   177 	}
   168 	if (loadSuccess) {
   178 	if (loadSuccess) {
   169 		if (0 == alarmCount) {
   179 		if (0 == alarmCount) {
   170 			hideAlarmList(true);
   180 			hideAlarmList(true);
   171 		} else {
   181 		} else {
   172 			hideAlarmList(false);
   182 			hideAlarmList(false);
   173 			mAlarmListModel->populateModel();
   183 			mAlarmListModel->populateModel();
   174 		}
   184 		}
   175 	}
   185 	}
   176 
   186 
   177 	mDayLabel = static_cast<HbLabel *> (
   187 	mDayLabel = static_cast<HbLabel *> (mDocLoader->findObject("dateLabel"));
   178 			mDocLoader->findObject("dateLabel"));
   188 	mPlaceLabel = static_cast<HbLabel *> (mDocLoader->findObject("placeLabel"));
   179 
       
   180 	mPlaceLabel = static_cast<HbLabel *> (
       
   181 			mDocLoader->findObject("placeLabel"));
       
   182 
       
   183 	
       
   184 
       
   185 	mClockWidget = static_cast<ClockWidget*> (
   189 	mClockWidget = static_cast<ClockWidget*> (
   186 			mDocLoader->findObject(CLOCK_WIDGET));
   190 			mDocLoader->findObject(CLOCK_WIDGET));
   187 
   191 
   188 	// Update the date info.
   192 	// Update the date info.
   189 	updateDateLabel();
   193 	updateDateLabel();
   580 	// If horizontal, load the landscape section.
   584 	// If horizontal, load the landscape section.
   581 	if (Qt::Horizontal == orientation) {
   585 	if (Qt::Horizontal == orientation) {
   582 		mDocLoader->load(
   586 		mDocLoader->load(
   583 				CLOCK_MAIN_VIEW_DOCML, CLOCK_MAIN_VIEW_LANDSCAPE_SECTION,
   587 				CLOCK_MAIN_VIEW_DOCML, CLOCK_MAIN_VIEW_LANDSCAPE_SECTION,
   584 				&success);
   588 				&success);
       
   589 		mHorizontalDivider->setVisible(false);
       
   590 		mVerticalDivider->setVisible(true);
   585 	} else {
   591 	} else {
   586 		mDocLoader->load(
   592 		mDocLoader->load(
   587 				CLOCK_MAIN_VIEW_DOCML, CLOCK_MAIN_VIEW_PORTRAIT_SECTION,
   593 				CLOCK_MAIN_VIEW_DOCML, CLOCK_MAIN_VIEW_PORTRAIT_SECTION,
   588 				&success);
   594 				&success);
       
   595 		mHorizontalDivider->setVisible(true);
       
   596 		mVerticalDivider->setVisible(false);
   589 	}
   597 	}
   590 
   598 
   591 	if(success) {
   599 	if(success) {
   592 		QList<AlarmInfo> alarmInfoList;
   600 		QList<AlarmInfo> alarmInfoList;
   593 		// Get the list of all clock alarms.
   601 		// Get the list of all clock alarms.
   685 /*!
   693 /*!
   686 	Updates the clock widget display.
   694 	Updates the clock widget display.
   687  */
   695  */
   688 void ClockMainView::updateClockWidget()
   696 void ClockMainView::updateClockWidget()
   689 {
   697 {
       
   698 	QStringList clockType;
       
   699     int index = mSettingsUtility->clockType(clockType);
       
   700     int zeroIndex(0);
       
   701     if(zeroIndex == index){
       
   702     	mClockWidget->setClockType(ClockWidget::ClockTypeDigital);
       
   703     } else {
       
   704     	mClockWidget->setClockType(ClockWidget::ClockTypeAnalog);
       
   705     }
       
   706     
       
   707     QStringList timeFormat;
       
   708 
       
   709     if (zeroIndex == mSettingsUtility->timeFormat(timeFormat)) {
       
   710     	mClockWidget->setTimeFormat(ClockWidget::TimeFormat24Hrs);
       
   711     } else {
       
   712     	mClockWidget->setTimeFormat(ClockWidget::TimeFormat12Hrs);
       
   713     }
       
   714 
   690 	mClockWidget->updateTime();
   715 	mClockWidget->updateTime();
   691 }
   716 }
   692 
   717 
   693 /*!
   718 /*!
   694 	CaptureScreenShot captures screen shot 
   719 	CaptureScreenShot captures screen shot