equal
deleted
inserted
replaced
54 HsClockWidget::HsClockWidget(QGraphicsItem *parent, Qt::WindowFlags flags) |
54 HsClockWidget::HsClockWidget(QGraphicsItem *parent, Qt::WindowFlags flags) |
55 : HbWidget(parent, flags), |
55 : HbWidget(parent, flags), |
56 mWidget(0), |
56 mWidget(0), |
57 mLayout(0), |
57 mLayout(0), |
58 mClockType(ANALOG), |
58 mClockType(ANALOG), |
59 mTimeType(TIME12) |
59 mTimeFormat(TIME12) |
60 { |
60 { |
61 #ifdef Q_OS_SYMBIAN |
61 #ifdef Q_OS_SYMBIAN |
62 mClockSettingsNotifier = new HsClockSettingsNotifier(this); |
62 mClockSettingsNotifier = new HsClockSettingsNotifier(this); |
63 mClockType = mClockSettingsNotifier->clockFormat(); |
63 mClockType = mClockSettingsNotifier->clockType(); |
64 mTimeType = mClockSettingsNotifier->timeFormat(); |
64 mTimeFormat = mClockSettingsNotifier->timeFormat(); |
65 #endif |
65 #endif |
66 } |
66 } |
67 |
67 |
68 /*! |
68 /*! |
69 Destructor. |
69 Destructor. |
138 } |
138 } |
139 |
139 |
140 /*! |
140 /*! |
141 \internal |
141 \internal |
142 */ |
142 */ |
143 void HsClockWidget::onSettingsChanged(const QString &clockFormat, const QString &timeFormat) |
143 void HsClockWidget::onSettingsChanged(const QString &clockType, const QString &timeFormat) |
144 { |
144 { |
145 if (mClockType != clockFormat) { |
145 if (mClockType != clockType) { |
146 mClockType = clockFormat; |
146 mClockType = clockType; |
147 mLayout->removeItem(mWidget); |
147 mLayout->removeItem(mWidget); |
148 delete mWidget; |
148 delete mWidget; |
149 mWidget = 0; |
149 mWidget = 0; |
150 mWidget = loadClockWidget(); |
150 mWidget = loadClockWidget(); |
151 mLayout->addItem(mWidget); |
151 mLayout->addItem(mWidget); |
152 } |
152 } |
153 |
153 |
154 if (mTimeType != timeFormat) { |
154 if (mTimeFormat != timeFormat) { |
155 mTimeType = timeFormat; |
155 mTimeFormat = timeFormat; |
156 if (mClockType == DIGITAL) { |
156 if (mClockType == DIGITAL) { |
157 if (mTimeType == TIME12) { |
157 if (mTimeFormat == TIME12) { |
158 static_cast<HsDigitalClockWidget*>(mWidget)->setAmPm(true); |
158 static_cast<HsDigitalClockWidget*>(mWidget)->setAmPm(true); |
159 } else { |
159 } else { |
160 static_cast<HsDigitalClockWidget*>(mWidget)->setAmPm(false); |
160 static_cast<HsDigitalClockWidget*>(mWidget)->setAmPm(false); |
161 } |
161 } |
162 } |
162 } |
169 void HsClockWidget::onClockTapped() |
169 void HsClockWidget::onClockTapped() |
170 { |
170 { |
171 #ifndef Q_OS_SYMBIAN |
171 #ifndef Q_OS_SYMBIAN |
172 if (mClockType == ANALOG) { |
172 if (mClockType == ANALOG) { |
173 mClockType = DIGITAL; |
173 mClockType = DIGITAL; |
174 if (mTimeType == TIME12) { |
174 if (mTimeFormat == TIME12) { |
175 mTimeType = TIME24; |
175 mTimeFormat = TIME24; |
176 } else { |
176 } else { |
177 mTimeType = TIME12; |
177 mTimeFormat = TIME12; |
178 } |
178 } |
179 } else { |
179 } else { |
180 mClockType = ANALOG; |
180 mClockType = ANALOG; |
181 } |
181 } |
182 mLayout->removeItem(mWidget); |
182 mLayout->removeItem(mWidget); |
211 { |
211 { |
212 HbWidget *clockWidget = 0; |
212 HbWidget *clockWidget = 0; |
213 |
213 |
214 if (mClockType == DIGITAL) { |
214 if (mClockType == DIGITAL) { |
215 bool useAmPm = true; |
215 bool useAmPm = true; |
216 if (mTimeType == TIME24) { |
216 if (mTimeFormat == TIME24) { |
217 useAmPm = false; |
217 useAmPm = false; |
218 } |
218 } |
219 clockWidget = new HsDigitalClockWidget(useAmPm); |
219 clockWidget = new HsDigitalClockWidget(useAmPm); |
220 } else { |
220 } else { |
221 clockWidget = new HsAnalogClockWidget(); |
221 clockWidget = new HsAnalogClockWidget(); |