![]() |
Home · All Namespaces · All Classes |
#include <clockview.h>


Public Member Functions | |
| ClockView (Clock *controller) | |
Protected Slots | |
| virtual void | updateData (const QList< const char * > &modifications) |
| REIMPLEMENTATION | |
| void | updateLabel () |
| | |
Protected Member Functions | |
| virtual void | applyStyle () |
| REIMPLEMENTATION | |
| void | setupModel () |
Protected Attributes | |
| MLabel * | label |
| | |
A view class for the Clock.
Definition at line 33 of file clockview.h.
| ClockView::ClockView | ( | Clock * | controller | ) |
Constructs a new view for Clock. This view shows the clock's time as a digital number.
Definition at line 29 of file clockview.cpp.
00029 : 00030 MWidgetView(controller), 00031 locale(new MLocale(this)) 00032 { 00033 QGraphicsLinearLayout *l = new QGraphicsLinearLayout(Qt::Horizontal); 00034 l->setContentsMargins(0, 0, 0, 0); 00035 controller->setLayout(l); 00036 00037 label = new MLabel; 00038 label->setObjectName(controller->objectName() + "Label"); 00039 l->addItem(label); 00040 00041 // React to system-wide locale changes 00042 locale->connectSettings(); 00043 connect(locale, SIGNAL(settingsChanged()), this, SLOT(updateLabel())); 00044 }

| void ClockView::applyStyle | ( | ) | [protected, virtual] |
REIMPLEMENTATION
Definition at line 46 of file clockview.cpp.
00047 { 00048 MWidgetView::applyStyle(); 00049 00050 label->setAlignment(style()->horizontalAlign()); 00051 updateLabel(); 00052 }

| void ClockView::setupModel | ( | ) | [protected] |
Definition at line 54 of file clockview.cpp.
00055 { 00056 MWidgetView::setupModel(); 00057 QList<const char *> modifications; 00058 modifications << ClockModel::Time; 00059 modifications << ClockModel::TimeFormat24h; 00060 updateData(modifications); 00061 }

| void ClockView::updateData | ( | const QList< const char * > & | modifications | ) | [protected, virtual, slot] |
REIMPLEMENTATION
Definition at line 63 of file clockview.cpp.
00064 { 00065 MWidgetView::updateData(modifications); 00066 const char *member; 00067 foreach(member, modifications) { 00068 if (member == ClockModel::Time || member == ClockModel::ShortDisplay) { 00069 updateLabel(); 00070 } else if (member == ClockModel::TimeFormat24h) { 00071 00072 if (model()->timeFormat24h()) { 00073 style().setModeDefault(); 00074 } else { 00075 style().setModeTwelveHour(); 00076 } 00077 updateLabel(); 00078 } 00079 } 00080 }

| void ClockView::updateLabel | ( | ) | [protected, slot] |
Updates the visuals of this view
Definition at line 82 of file clockview.cpp.
00083 { 00084 QDateTime time = model()->time(); 00085 QString text = locale->formatDateTime(time, style()->timeFormat()); 00086 00087 if (model()->shortDisplay() && style()->shortRemoveAmPmIndicator()) { 00088 /* Remove the AM/PM indicator in the "short display" mode if the 00089 * theme dictates so. Also remove possible spaces that were between 00090 * the time and the AM/PM indicator. 00091 */ 00092 QString indicator = locale->formatDateTime(time, "%p"); 00093 text.remove(indicator); 00094 text = text.trimmed(); 00095 } 00096 00097 if (text != previousLabel) { 00098 // Only update the label if the text has changed 00099 label->setText(text); 00100 previousLabel = text; 00101 } 00102 }
MLabel* ClockView::label [protected] |
A label to be used to render the clock time
Definition at line 52 of file clockview.h.
| Copyright © 2010 Nokia Corporation | Generated on Wed Nov 10 16:05:03 2010 Doxygen 1.6.1 |
MeeGo Touch |