author | zautrix <zautrix> | 2005-03-20 14:04:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-20 14:04:37 (UTC) |
commit | 69d75020eea5f95b9f5d77d97ed85ec8869d32db (patch) (unidiff) | |
tree | 378b920b9392e7ed4472597e586154d7b99b0645 /korganizer/kodaymatrix.h | |
parent | 289dd44f4f23d92c45d8f28c867a14a980fd5dde (diff) | |
download | kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.zip kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.tar.gz kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.tar.bz2 |
layout fixes
-rw-r--r-- | korganizer/kodaymatrix.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index c049942..39946de 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -77,192 +77,193 @@ private: | |||
77 | KODayMatrix* matrix; | 77 | KODayMatrix* matrix; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. | 81 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. |
82 | * Cornelius thought this was a waste of memory and a lot of overhead. | 82 | * Cornelius thought this was a waste of memory and a lot of overhead. |
83 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame | 83 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame |
84 | * that draws the labels and allows for dragging selection while maintaining nearly full | 84 | * that draws the labels and allows for dragging selection while maintaining nearly full |
85 | * compatibility in behaviour with its predecessor. | 85 | * compatibility in behaviour with its predecessor. |
86 | * | 86 | * |
87 | * The following functionality has been changed: | 87 | * The following functionality has been changed: |
88 | * | 88 | * |
89 | * o when shifting events in the agenda view from one day to another the day matrix is updated now | 89 | * o when shifting events in the agenda view from one day to another the day matrix is updated now |
90 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. | 90 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. |
91 | * o no support for Ctrl+click to create groups of dates | 91 | * o no support for Ctrl+click to create groups of dates |
92 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it | 92 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it |
93 | * user friendly.) | 93 | * user friendly.) |
94 | * This feature has been replaced with dragging a selection on the matrix. The matrix will | 94 | * This feature has been replaced with dragging a selection on the matrix. The matrix will |
95 | * automatically choose the appropriate selection (e.g. you are not any longer able to select | 95 | * automatically choose the appropriate selection (e.g. you are not any longer able to select |
96 | * two distinct groups of date selections as in the old class) | 96 | * two distinct groups of date selections as in the old class) |
97 | * o now that you can select more then a week it can happen that not all selected days are | 97 | * o now that you can select more then a week it can happen that not all selected days are |
98 | * displayed in the matrix. However this is preferred to the alternative which would mean to | 98 | * displayed in the matrix. However this is preferred to the alternative which would mean to |
99 | * adjust the selection and leave some days undisplayed while scrolling through the months | 99 | * adjust the selection and leave some days undisplayed while scrolling through the months |
100 | * | 100 | * |
101 | * @short day matrix widget of the KDateNavigator | 101 | * @short day matrix widget of the KDateNavigator |
102 | * | 102 | * |
103 | * @author Eitzenberger Thomas | 103 | * @author Eitzenberger Thomas |
104 | */ | 104 | */ |
105 | class KODayMatrix: public QFrame { | 105 | class KODayMatrix: public QFrame { |
106 | 106 | ||
107 | Q_OBJECT | 107 | Q_OBJECT |
108 | 108 | ||
109 | public: | 109 | public: |
110 | 110 | ||
111 | /** constructor to create a day matrix widget. | 111 | /** constructor to create a day matrix widget. |
112 | * | 112 | * |
113 | * @param parent widget that is the parent of the day matrix. Normally this should | 113 | * @param parent widget that is the parent of the day matrix. Normally this should |
114 | * be a KDateNavigator | 114 | * be a KDateNavigator |
115 | * @param calendar instance of a calendar on which all calculations are based | 115 | * @param calendar instance of a calendar on which all calculations are based |
116 | * @param date start date of the matrix (is expected to be already fixed). It is | 116 | * @param date start date of the matrix (is expected to be already fixed). It is |
117 | * assumed that this date is the first week day to be shown in the matrix. | 117 | * assumed that this date is the first week day to be shown in the matrix. |
118 | * @param name name of the widget | 118 | * @param name name of the widget |
119 | */ | 119 | */ |
120 | KODayMatrix( QWidget *parent, const char *name ); | 120 | KODayMatrix( QWidget *parent, const char *name ); |
121 | //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); | 121 | //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); |
122 | 122 | ||
123 | /** destructor that deallocates all dynamically allocated private members. | 123 | /** destructor that deallocates all dynamically allocated private members. |
124 | */ | 124 | */ |
125 | ~KODayMatrix(); | 125 | ~KODayMatrix(); |
126 | 126 | ||
127 | /** updates the day matrix to start with the given date. Does all the necessary | 127 | /** updates the day matrix to start with the given date. Does all the necessary |
128 | * checks for holidays or events on a day and stores them for display later on. | 128 | * checks for holidays or events on a day and stores them for display later on. |
129 | * Does NOT update the view visually. Call repaint() for this. | 129 | * Does NOT update the view visually. Call repaint() for this. |
130 | * | 130 | * |
131 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this | 131 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this |
132 | * date. | 132 | * date. |
133 | */ | 133 | */ |
134 | void updateView(QDate actdate); | 134 | void updateView(QDate actdate); |
135 | void updateEvents(); | 135 | void updateEvents(); |
136 | 136 | ||
137 | /** returns the QDate object associated with day indexed by the | 137 | /** returns the QDate object associated with day indexed by the |
138 | * supplied offset. | 138 | * supplied offset. |
139 | */ | 139 | */ |
140 | const QDate& getDate(int offset); | 140 | const QDate& getDate(int offset); |
141 | void setCalendar( Calendar * ); | 141 | void setCalendar( Calendar * ); |
142 | /** returns the official name of this holy day or 0 if there is no label | 142 | /** returns the official name of this holy day or 0 if there is no label |
143 | * for this day. | 143 | * for this day. |
144 | */ | 144 | */ |
145 | QString getHolidayLabel(int offset); | 145 | QString getHolidayLabel(int offset); |
146 | 146 | ||
147 | /** adds all actual selected days from mSelStart to mSelEnd to the supplied | 147 | /** adds all actual selected days from mSelStart to mSelEnd to the supplied |
148 | * DateList. | 148 | * DateList. |
149 | */ | 149 | */ |
150 | void addSelectedDaysTo(DateList&); | 150 | void addSelectedDaysTo(DateList&); |
151 | 151 | ||
152 | /** sets the actual to be displayed selection in the day matrix starting from | 152 | /** sets the actual to be displayed selection in the day matrix starting from |
153 | * start and ending with end. Theview must be manually updated by calling | 153 | * start and ending with end. Theview must be manually updated by calling |
154 | * repaint. (?) | 154 | * repaint. (?) |
155 | */ | 155 | */ |
156 | void setSelectedDaysFrom(const QDate& start, const QDate& end); | 156 | void setSelectedDaysFrom(const QDate& start, const QDate& end); |
157 | void clearSelection(); | 157 | void clearSelection(); |
158 | 158 | ||
159 | /** Is today visible in the view? Keep this in sync with | 159 | /** Is today visible in the view? Keep this in sync with |
160 | * the values today (below) can take. | 160 | * the values today (below) can take. |
161 | */ | 161 | */ |
162 | bool isTodayVisible() const { return today>=0; } ; | 162 | bool isTodayVisible() const { return today>=0; } ; |
163 | 163 | ||
164 | /** If today is visible, then we can find out if today is | 164 | /** If today is visible, then we can find out if today is |
165 | * near the beginning or the end of the month. | 165 | * near the beginning or the end of the month. |
166 | * This is dependent on today remaining the index | 166 | * This is dependent on today remaining the index |
167 | * in the array of visible dates and going from | 167 | * in the array of visible dates and going from |
168 | * top left (0) to bottom right (41). | 168 | * top left (0) to bottom right (41). |
169 | */ | 169 | */ |
170 | bool isBeginningOfMonth() const { return today<=8; } ; | 170 | bool isBeginningOfMonth() const { return today<=8; } ; |
171 | bool isEndOfMonth() const { return today>=27; } ; | 171 | bool isEndOfMonth() const { return today>=27; } ; |
172 | QString getWhatsThisText( QPoint ) ; | 172 | QString getWhatsThisText( QPoint ) ; |
173 | QSize sizeHint() const; | ||
173 | 174 | ||
174 | public slots: | 175 | public slots: |
175 | /** Recalculates all the flags of the days in the matrix like holidays or events | 176 | /** Recalculates all the flags of the days in the matrix like holidays or events |
176 | * on a day (Actually calls above method with the actual startdate). | 177 | * on a day (Actually calls above method with the actual startdate). |
177 | */ | 178 | */ |
178 | void updateView(); | 179 | void updateView(); |
179 | void updateViewTimed(); | 180 | void updateViewTimed(); |
180 | void repaintViewTimed(); | 181 | void repaintViewTimed(); |
181 | 182 | ||
182 | /** | 183 | /** |
183 | * Calculate which square in the matrix should be | 184 | * Calculate which square in the matrix should be |
184 | * hilighted to indicate it's today. | 185 | * hilighted to indicate it's today. |
185 | */ | 186 | */ |
186 | void recalculateToday(); | 187 | void recalculateToday(); |
187 | 188 | ||
188 | /* | 189 | /* |
189 | void setStartDate(QDate); | 190 | void setStartDate(QDate); |
190 | */ | 191 | */ |
191 | 192 | ||
192 | signals: | 193 | signals: |
193 | 194 | ||
194 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle | 195 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle |
195 | * inside the matrix | 196 | * inside the matrix |
196 | * | 197 | * |
197 | * @param daylist list of days that have been selected by the user | 198 | * @param daylist list of days that have been selected by the user |
198 | */ | 199 | */ |
199 | void selected( const KCal::DateList &daylist ); | 200 | void selected( const KCal::DateList &daylist ); |
200 | 201 | ||
201 | /** emitted if the user has dropped an event inside the matrix | 202 | /** emitted if the user has dropped an event inside the matrix |
202 | * | 203 | * |
203 | * @param event the dropped calendar event | 204 | * @param event the dropped calendar event |
204 | */ | 205 | */ |
205 | void eventDropped(Event *event); | 206 | void eventDropped(Event *event); |
206 | 207 | ||
207 | protected: | 208 | protected: |
208 | 209 | ||
209 | void paintEvent(QPaintEvent *ev); | 210 | void paintEvent(QPaintEvent *ev); |
210 | 211 | ||
211 | void mousePressEvent (QMouseEvent* e); | 212 | void mousePressEvent (QMouseEvent* e); |
212 | 213 | ||
213 | void mouseReleaseEvent (QMouseEvent* e); | 214 | void mouseReleaseEvent (QMouseEvent* e); |
214 | 215 | ||
215 | void mouseMoveEvent (QMouseEvent* e); | 216 | void mouseMoveEvent (QMouseEvent* e); |
216 | 217 | ||
217 | void dragEnterEvent(QDragEnterEvent *); | 218 | void dragEnterEvent(QDragEnterEvent *); |
218 | 219 | ||
219 | void dragMoveEvent(QDragMoveEvent *); | 220 | void dragMoveEvent(QDragMoveEvent *); |
220 | 221 | ||
221 | void dragLeaveEvent(QDragLeaveEvent *); | 222 | void dragLeaveEvent(QDragLeaveEvent *); |
222 | 223 | ||
223 | void dropEvent(QDropEvent *); | 224 | void dropEvent(QDropEvent *); |
224 | 225 | ||
225 | void resizeEvent(QResizeEvent *); | 226 | void resizeEvent(QResizeEvent *); |
226 | 227 | ||
227 | private: | 228 | private: |
228 | bool mouseDown; | 229 | bool mouseDown; |
229 | QBitArray bDays; | 230 | QBitArray bDays; |
230 | QPixmap myPix; | 231 | QPixmap myPix; |
231 | QTimer* mUpdateTimer; | 232 | QTimer* mUpdateTimer; |
232 | QTimer* mRepaintTimer; | 233 | QTimer* mRepaintTimer; |
233 | bool mDayChanged; | 234 | bool mDayChanged; |
234 | bool mPendingUpdateBeforeRepaint; | 235 | bool mPendingUpdateBeforeRepaint; |
235 | 236 | ||
236 | /** returns the index of the day located at the matrix's widget (x,y) position. | 237 | /** returns the index of the day located at the matrix's widget (x,y) position. |
237 | * | 238 | * |
238 | * @param x horizontal coordinate | 239 | * @param x horizontal coordinate |
239 | * @param y vertical coordinate | 240 | * @param y vertical coordinate |
240 | */ | 241 | */ |
241 | int getDayIndexFrom(int x, int y); | 242 | int getDayIndexFrom(int x, int y); |
242 | 243 | ||
243 | /** calculates a "shaded" color from the supplied color object. | 244 | /** calculates a "shaded" color from the supplied color object. |
244 | * (Copied from Cornelius's kdpdatebutton.cpp) | 245 | * (Copied from Cornelius's kdpdatebutton.cpp) |
245 | * | 246 | * |
246 | * @param color source based on which a shaded color should be calculated. | 247 | * @param color source based on which a shaded color should be calculated. |
247 | */ | 248 | */ |
248 | QColor getShadedColor(QColor color); | 249 | QColor getShadedColor(QColor color); |
249 | 250 | ||
250 | /** number of days to be displayed. For now there is no support for any other number then 42. | 251 | /** number of days to be displayed. For now there is no support for any other number then 42. |
251 | so change it at your own risk :o) */ | 252 | so change it at your own risk :o) */ |
252 | static const int NUMDAYS; | 253 | static const int NUMDAYS; |
253 | 254 | ||
254 | /** calendar instance to be queried for holidays, events, ... */ | 255 | /** calendar instance to be queried for holidays, events, ... */ |
255 | Calendar *mCalendar; | 256 | Calendar *mCalendar; |
256 | 257 | ||
257 | /** starting date of the matrix */ | 258 | /** starting date of the matrix */ |
258 | QDate startdate; | 259 | QDate startdate; |
259 | 260 | ||
260 | /** array of day labels to optimeize drawing performance. */ | 261 | /** array of day labels to optimeize drawing performance. */ |
261 | QString *daylbls; | 262 | QString *daylbls; |
262 | 263 | ||
263 | /** array of days displayed to reduce memory consumption by | 264 | /** array of days displayed to reduce memory consumption by |
264 | subsequently calling QDate::addDays(). */ | 265 | subsequently calling QDate::addDays(). */ |
265 | QDate *days; | 266 | QDate *days; |
266 | 267 | ||
267 | /** array of storing the number of events on a given day. | 268 | /** array of storing the number of events on a given day. |
268 | * used for drawing a bold font if there is at least one event on that day. | 269 | * used for drawing a bold font if there is at least one event on that day. |