equal
deleted
inserted
replaced
17 |
17 |
18 #include <QTimer> |
18 #include <QTimer> |
19 #include <QGraphicsLinearLayout> |
19 #include <QGraphicsLinearLayout> |
20 |
20 |
21 #include "hsclockwidget.h" |
21 #include "hsclockwidget.h" |
|
22 #include "hsclockwidgettimer.h" |
22 #include "hsanalogclockwidget.h" |
23 #include "hsanalogclockwidget.h" |
23 #include "hsdigitalclockwidget.h" |
24 #include "hsdigitalclockwidget.h" |
24 |
25 |
25 #ifdef Q_OS_SYMBIAN |
26 #ifdef Q_OS_SYMBIAN |
26 #include "hsclocksettingsnotifier_symbian.h" |
27 #include "hsclocksettingsnotifier_symbian.h" |
54 */ |
55 */ |
55 HsClockWidget::HsClockWidget(QGraphicsItem *parent, Qt::WindowFlags flags) |
56 HsClockWidget::HsClockWidget(QGraphicsItem *parent, Qt::WindowFlags flags) |
56 : HbWidget(parent, flags), |
57 : HbWidget(parent, flags), |
57 mWidget(0), |
58 mWidget(0), |
58 mLayout(0), |
59 mLayout(0), |
59 mTimer(0), |
|
60 mClockType(ANALOG), |
60 mClockType(ANALOG), |
61 mTimeType(TIME12) |
61 mTimeType(TIME12) |
62 { |
62 { |
63 #ifdef Q_OS_SYMBIAN |
63 #ifdef Q_OS_SYMBIAN |
64 mClockSettingsNotifier = new HsClockSettingsNotifier(this); |
64 mClockSettingsNotifier = new HsClockSettingsNotifier(this); |
88 void HsClockWidget::onInitialize() |
88 void HsClockWidget::onInitialize() |
89 { |
89 { |
90 mLayout = new QGraphicsLinearLayout(Qt::Vertical); |
90 mLayout = new QGraphicsLinearLayout(Qt::Vertical); |
91 mLayout->setContentsMargins(0, 0, 0, 0); |
91 mLayout->setContentsMargins(0, 0, 0, 0); |
92 mWidget = loadClockWidget(); |
92 mWidget = loadClockWidget(); |
93 mLayout->addItem(mWidget); |
93 mLayout->addItem(mWidget); |
94 mTimer = new QTimer(this); |
|
95 connect(mTimer, SIGNAL(timeout()), SLOT(updateTime())); |
|
96 setLayout(mLayout); |
94 setLayout(mLayout); |
97 #ifdef Q_OS_SYMBIAN |
95 #ifdef Q_OS_SYMBIAN |
98 connect(mClockSettingsNotifier, SIGNAL(settingsChanged(QString, QString)), this, SLOT(onSettingsChanged(QString, QString))); |
96 connect(mClockSettingsNotifier, SIGNAL(settingsChanged(QString, QString)), this, SLOT(onSettingsChanged(QString, QString))); |
99 #endif |
97 #endif |
100 |
98 |
103 /*! |
101 /*! |
104 Shows this widget. |
102 Shows this widget. |
105 */ |
103 */ |
106 void HsClockWidget::onShow() |
104 void HsClockWidget::onShow() |
107 { |
105 { |
108 mTimer->start(clockUpdateInterval); |
106 HsClockWidgetTimer::instance(); |
|
107 connect(HsClockWidgetTimer::instance(), |
|
108 SIGNAL(tick()), |
|
109 SLOT(updateTime()), |
|
110 Qt::UniqueConnection); |
109 } |
111 } |
110 |
112 |
111 |
113 |
112 /*! |
114 /*! |
113 Hides this widget. |
115 Hides this widget. |
114 */ |
116 */ |
115 void HsClockWidget::onHide() |
117 void HsClockWidget::onHide() |
116 { |
118 { |
117 mTimer->stop(); |
119 HsClockWidgetTimer::instance()->disconnect(this); |
118 } |
120 } |
119 |
121 |
120 /*! |
122 /*! |
121 Uninitializes this widget. |
123 Uninitializes this widget. |
122 */ |
124 */ |
123 void HsClockWidget::onUninitialize() |
125 void HsClockWidget::onUninitialize() |
124 { |
126 { |
125 mTimer->stop(); |
127 HsClockWidgetTimer::instance()->disconnect(this); |
126 } |
128 } |
127 |
129 |
128 /*! |
130 /*! |
129 Draws the clock with every second. |
131 Draws the clock with every second. |
130 */ |
132 */ |