25 |
25 |
26 #ifndef HBDATETIMEPICKER_P_H |
26 #ifndef HBDATETIMEPICKER_P_H |
27 #define HBDATETIMEPICKER_P_H |
27 #define HBDATETIMEPICKER_P_H |
28 |
28 |
29 #include "hbwidget_p.h" |
29 #include "hbwidget_p.h" |
30 #include "hbtumbleview.h" |
|
31 #include "hbdatetimepicker.h" |
30 #include "hbdatetimepicker.h" |
32 |
31 #include "hbdatepickerview_p.h" |
33 #include "hbextendedlocale.h" |
32 #include "hbextendedlocale.h" |
34 |
33 |
35 #include <QStringListModel> |
34 #include <QStringListModel> |
36 #include <QGraphicsLinearLayout> |
35 #include <QGraphicsGridLayout> |
37 #include <QDateTime> |
36 #include <QDateTime> |
38 #include <QGraphicsWidget> |
37 #include <QGraphicsWidget> |
39 #include <QList> |
38 #include <QList> |
40 #include <QHash> |
39 #include <QHash> |
41 |
40 #include <QPointer> |
42 #define VIEWER HbTumbleView |
41 |
43 |
42 #include "hbstyleframeprimitivedata.h" |
|
43 #include "hbstyletextprimitivedata.h" |
|
44 |
|
45 #define VIEWER HbDatePickerView |
44 |
46 |
45 #define HBDATETIMEPICKER_TIME_MIN QTime(0, 0, 0, 0) |
47 #define HBDATETIMEPICKER_TIME_MIN QTime(0, 0, 0, 0) |
46 #define HBDATETIMEPICKER_TIME_MAX QTime(23, 59, 59, 999) |
48 #define HBDATETIMEPICKER_TIME_MAX QTime(23, 59, 59, 999) |
47 #define HBDATETIMEPICKER_DATE_MIN QDate(1900, 1, 1) //15th Oct 4713 B.C. |
49 #define HBDATETIMEPICKER_DATE_MIN QDate(1900, 1, 1) //15th Oct 4713 B.C. |
48 //#define HBDATETIMEPICKER_DATE_MIN QDate(-4713, 10, 15) //15th Oct 4713 B.C. |
50 //#define HBDATETIMEPICKER_DATE_MIN QDate(-4713, 10, 15) //15th Oct 4713 B.C. |
98 int sectionPos(int index) const; |
100 int sectionPos(int index) const; |
99 int sectionPos(const SectionNode &sn) const; |
101 int sectionPos(const SectionNode &sn) const; |
100 const SectionNode §ionNode(int index) const; |
102 const SectionNode §ionNode(int index) const; |
101 |
103 |
102 QString mDisplayFormat; |
104 QString mDisplayFormat; |
|
105 |
103 Sections mDisplaySections; |
106 Sections mDisplaySections; |
104 QVector<SectionNode> mSectionNodes; |
107 QVector<SectionNode> mSectionNodes; |
105 QStringList mSeparators; |
108 QStringList mSeparators; |
106 }; |
109 }; |
107 |
110 |
|
111 ///////////////////////HbDatePickerViewLabel////////////////////////// |
|
112 |
|
113 class HbDatePickerViewLabel : public HbWidget |
|
114 { |
|
115 Q_OBJECT |
|
116 |
|
117 public: |
|
118 HbDatePickerViewLabel(QGraphicsItem *parent = 0); |
|
119 HbDatePickerViewLabel(const QString &displayText, QGraphicsItem *parent = 0); |
|
120 |
|
121 void initPrimitiveData(HbStylePrimitiveData *primitiveData, const QGraphicsObject *primitive); |
|
122 |
|
123 void createPrimitives(); |
|
124 |
|
125 public slots: |
|
126 void updatePrimitives(); |
|
127 |
|
128 private: |
|
129 QGraphicsObject *mTextItem; |
|
130 }; |
|
131 //////////////////////////////////////////////// |
|
132 |
108 class HbDateTimePickerPrivate : public HbWidgetPrivate |
133 class HbDateTimePickerPrivate : public HbWidgetPrivate |
109 { |
134 { |
110 Q_DECLARE_PUBLIC(HbDateTimePicker) |
135 Q_DECLARE_PUBLIC(HbDateTimePicker) |
111 |
136 |
112 public: |
137 public: |
114 ~HbDateTimePickerPrivate(); |
139 ~HbDateTimePickerPrivate(); |
115 |
140 |
116 void init(QVariant::Type type = QVariant::Date); |
141 void init(QVariant::Type type = QVariant::Date); |
117 QString localeDateTimeFormat(const QVariant::Type &mode); |
142 QString localeDateTimeFormat(const QVariant::Type &mode); |
118 bool isFormatValid(const QString &newFormat); |
143 bool isFormatValid(const QString &newFormat); |
119 void parseDisplayFormat(const QString &format); |
144 void processDisplaySections(); |
120 void rearrangeTumbleViews(); |
145 void rearrangeTumbleViews(); |
121 void makeConnections(); |
146 void makeConnections(); |
122 void removeConnections(); |
147 void removeConnections(); |
123 void setRanges(); |
148 void setRanges(); |
124 void emitDateChange(); |
149 void emitDateChange(); |
129 void setDateTimeRange(const QDateTime &start |
154 void setDateTimeRange(const QDateTime &start |
130 , const QDateTime &end); |
155 , const QDateTime &end); |
131 void setDateTime(const QDateTime &newDateTime); |
156 void setDateTime(const QDateTime &newDateTime); |
132 void setMinimumDateTime(const QDateTime &newMinDateTime); |
157 void setMinimumDateTime(const QDateTime &newMinDateTime); |
133 void setMaximumDateTime(const QDateTime &newMaxDateTime); |
158 void setMaximumDateTime(const QDateTime &newMaxDateTime); |
|
159 void postFormatEvent(); |
|
160 void processFormatEvent(); |
134 |
161 |
135 //helpers |
162 //helpers |
136 void setYearRange(int start,int end); |
163 void setYearRange(int start,int end); |
137 void setMonthRange(int start,int end); |
164 void setMonthRange(int start,int end); |
138 void setDayRange(int start,int end); |
165 void setDayRange(int start,int end); |
209 QDateTime mDateTime; |
236 QDateTime mDateTime; |
210 QDateTime mMinimumDate; |
237 QDateTime mMinimumDate; |
211 QDateTime mMaximumDate; |
238 QDateTime mMaximumDate; |
212 QVariant::Type mDateTimeMode; |
239 QVariant::Type mDateTimeMode; |
213 |
240 |
214 QGraphicsLinearLayout *mLayout; |
241 QGraphicsGridLayout *mLayout; |
215 QString mFormat; |
242 QString mFormat; |
|
243 int mFormatEventType; |
216 |
244 |
217 HbDateTimeParser mParser; |
245 HbDateTimeParser mParser; |
218 QList<HbDateTimeParser::Section> mDisplaySections; |
246 QList<HbDateTimeParser::Section> mDisplaySections; |
219 QString mYearFormat; |
247 QString mYearFormat; |
220 QString mMonthFormat; |
248 QString mMonthFormat; |
223 QString mMinuteFormat; |
251 QString mMinuteFormat; |
224 QString mSecondFormat; |
252 QString mSecondFormat; |
225 bool mIs24HourFormat; |
253 bool mIs24HourFormat; |
226 bool mIsTwoDigitYearFormat; |
254 bool mIsTwoDigitYearFormat; |
227 |
255 |
228 HbExtendedLocale mLocale; |
256 HbExtendedLocale mLocale; |
229 |
|
230 //graphics items/style items |
|
231 QGraphicsItem *mBackground; |
|
232 QGraphicsItem *mFrame; |
|
233 HbWidget *mContent; |
257 HbWidget *mContent; |
234 QHash<QDateTimeEdit::Section, int> mIntervals; |
258 QHash<QDateTimeEdit::Section, int> mIntervals; |
235 QGraphicsItem *mHighlight; |
259 |
|
260 //graphics items/style items |
|
261 QGraphicsObject *mBackground; |
|
262 QGraphicsObject *mFrame; |
|
263 QGraphicsObject *mHighlight; |
|
264 |
|
265 QPointer<HbDatePickerViewLabel> mLabelDay; |
|
266 QPointer<HbDatePickerViewLabel> mLabelMonth; |
|
267 QPointer<HbDatePickerViewLabel> mLabelYear; |
|
268 QPointer<HbDatePickerViewLabel> mLabelHour; |
|
269 QPointer<HbDatePickerViewLabel> mLabelMinute; |
|
270 QPointer<HbDatePickerViewLabel> mLabelSecond; |
|
271 QPointer<VIEWER> mLastAdded; |
236 }; |
272 }; |
237 |
273 |
238 #endif //HBDATETIMEPICKER_P_H |
274 #endif //HBDATETIMEPICKER_P_H |