equal
deleted
inserted
replaced
71 { |
71 { |
72 mHourElements.clear(); |
72 mHourElements.clear(); |
73 } |
73 } |
74 |
74 |
75 /*! |
75 /*! |
76 \brief SLOT scrolls the view vertically to new position. |
|
77 |
|
78 \param newPosition New position |
|
79 */ |
|
80 void CalenDayHourScrollArea::scrollVertically(const QPointF &newPosition) |
|
81 { |
|
82 QPointF currentPos = contentWidget()->pos(); |
|
83 if (abs(newPosition.y()) != abs(currentPos.y())) { |
|
84 currentPos.setY(newPosition.y()); |
|
85 scrollContentsTo(currentPos, 0); |
|
86 } |
|
87 } |
|
88 |
|
89 /*! |
|
90 \brief Sets date and time for this container. |
76 \brief Sets date and time for this container. |
91 |
77 |
92 \param dateTime new date and time |
78 \param dateTime new date and time |
93 */ |
79 */ |
94 void CalenDayHourScrollArea::setDateTime(const QDateTime &dateTime) |
80 void CalenDayHourScrollArea::setDateTime(const QDateTime &dateTime) |
95 { |
81 { |
96 mDateTime = dateTime; |
82 mDateTime = dateTime; |
97 } |
83 } |
|
84 |
98 /*! |
85 /*! |
99 \brief Returns date and time assigned to current view. |
86 \brief Returns date and time assigned to current view. |
100 */ |
87 */ |
101 QDateTime CalenDayHourScrollArea::dateTime() const |
88 QDateTime CalenDayHourScrollArea::dateTime() const |
102 { |
89 { |
127 } |
114 } |
128 |
115 |
129 scrollContentsTo(newPos); |
116 scrollContentsTo(newPos); |
130 } |
117 } |
131 |
118 |
|
119 /*! |
|
120 \brief SLOT scrolls the view vertically to new position. |
|
121 |
|
122 \param newPosition New position |
|
123 */ |
|
124 void CalenDayHourScrollArea::scrollVertically(const QPointF &newPosition) |
|
125 { |
|
126 QPointF currentPos = contentWidget()->pos(); |
|
127 if (abs(newPosition.y()) != abs(currentPos.y())) { |
|
128 currentPos.setY(newPosition.y()); |
|
129 scrollContentsTo(currentPos, 0); |
|
130 } |
|
131 } |
|
132 |
|
133 /*! |
|
134 \brief SLOT updates time/date representation when system locale are changed. |
|
135 */ |
|
136 void CalenDayHourScrollArea::localeChanged() |
|
137 { |
|
138 for (int i = 0; i < mHourElements.count(); i++) { |
|
139 mHourElements.at(i)->localeChanged(); |
|
140 mHourElements.at(i)->update(mHourElements.at(i)->rect()); |
|
141 } |
|
142 } |
|
143 |
|
144 /*! |
|
145 \brief SLOT refreshes time indicator if current day is displayed. |
|
146 |
|
147 Time indicator should also be updated if transition between prev/next |
|
148 day was done previously: failure ou1cimx1#565650 fixed |
|
149 */ |
|
150 void CalenDayHourScrollArea::updateTimeIndicator() |
|
151 { |
|
152 QDateTime currentDateTime = QDateTime::currentDateTime(); |
|
153 |
|
154 bool updateNeeded = mDateTime.date() >= currentDateTime.date().addDays(-1); |
|
155 updateNeeded = updateNeeded && mDateTime.date() <= currentDateTime.date().addDays(1); |
|
156 |
|
157 if (updateNeeded) { |
|
158 for (int i = 0; i < mHourElements.count(); i++) { |
|
159 mHourElements.at(i)->update(mHourElements.at(i)->rect()); |
|
160 } |
|
161 } |
|
162 } |
|
163 |
132 // End of File |
164 // End of File |