Diffstat (limited to 'noncore/net/wellenreiter/cornucopia') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/README | 127 | ||||
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.cpp | 147 | ||||
-rw-r--r-- | noncore/net/wellenreiter/cornucopia/olistview.h | 81 |
3 files changed, 345 insertions, 10 deletions
diff --git a/noncore/net/wellenreiter/cornucopia/README b/noncore/net/wellenreiter/cornucopia/README index 36a6954..486dc67 100644 --- a/noncore/net/wellenreiter/cornucopia/README +++ b/noncore/net/wellenreiter/cornucopia/README | |||
@@ -1,3 +1,124 @@ | |||
1 | --------------------------------------------------------------- | 1 | /******************************************************************** |
2 | Dies ist ein Testballon für opielibs1.2 - Codename: Cornucopia | 2 | /* This is an overview of the opielibs 1.2 project |
3 | --------------------------------------------------------------- | 3 | /********************************************************************/ |
4 | |||
5 | Origin: opielibs is about creating classes to | ||
6 | * optimize Qt classes for the embedded environment | ||
7 | * provide sophisticated abstractions for developers | ||
8 | * provide complete documentation and working examples | ||
9 | * provide end users with a common look and feel | ||
10 | * reduce memory footprint through sharing code | ||
11 | * reduce possible bugs through reusing tested code | ||
12 | |||
13 | -------------------------------------------------------- | ||
14 | 1. General Overview | ||
15 | -------------------------------------------------------- | ||
16 | |||
17 | Separation into the following libraries: | ||
18 | - libopiecore | ||
19 | - libopieui | ||
20 | - libopiepim | ||
21 | - libopienet | ||
22 | |||
23 | 1.1 Contents of libopiecore [ opiecore ] | ||
24 | -------------------------------------------------------- | ||
25 | |||
26 | - oprocctrl | ||
27 | - oprocess | ||
28 | - odevice | ||
29 | - odevicebutton | ||
30 | |||
31 | - oconfig | ||
32 | - oconfiggroupsaver | ||
33 | - ocompletionbase | ||
34 | - ocompletion | ||
35 | - ocomptreenodelist | ||
36 | - ocomptreenode | ||
37 | - ocompletionwrapper | ||
38 | - oglobal | ||
39 | - oglobalsettings | ||
40 | - osortableitem | ||
41 | - osortablevaluelist | ||
42 | |||
43 | 1.2 Contents of libopieui [ opieui ] | ||
44 | -------------------------------------------------------- | ||
45 | |||
46 | - oapplication | ||
47 | |||
48 | - ofiledialog | ||
49 | - colordialog | ||
50 | - oclickablelabel | ||
51 | - ocolorbutton | ||
52 | - colorpopupmenu | ||
53 | - otabinfo | ||
54 | - otabbar | ||
55 | - otabwidget | ||
56 | - ofontmenu | ||
57 | - ofontselector | ||
58 | - ofileview | ||
59 | - oticker | ||
60 | |||
61 | - olistview | ||
62 | - olistviewitem | ||
63 | - oversatileview | ||
64 | - oversatileviewitem | ||
65 | - ocompletionbox | ||
66 | - olineedit | ||
67 | - ocombobox | ||
68 | - ohistorycombo | ||
69 | |||
70 | - omessagebox | ||
71 | - odialogbase | ||
72 | |||
73 | - todayconfigwidget (rather into opiepim?) | ||
74 | - orecurrancewidget (rather into opiepim?) | ||
75 | - otimepicker (rather into opiepim?) | ||
76 | |||
77 | 1.3 Contents of libopiepim [ opiepim ] | ||
78 | -------------------------------------------------------- | ||
79 | |||
80 | - ocheckitem | ||
81 | - todoevent | ||
82 | - todoresource | ||
83 | - todayplugininterface | ||
84 | - todovcalresource | ||
85 | |||
86 | 1.4 Contents of libopiedb [ opiedb ] | ||
87 | -------------------------------------------------------- | ||
88 | |||
89 | - tododb | ||
90 | - xmltree | ||
91 | |||
92 | 1.5 Contents of libopienet [ opienet ] | ||
93 | -------------------------------------------------------- | ||
94 | |||
95 | <libmail stuff> | ||
96 | <libbend stuff> | ||
97 | <libftp stuff> | ||
98 | |||
99 | -------------------------------------------------------- | ||
100 | 2.0 Feature Description | ||
101 | -------------------------------------------------------- | ||
102 | |||
103 | 2.1 libopiecore | ||
104 | |||
105 | ... | ||
106 | |||
107 | 2.2 libopieui | ||
108 | |||
109 | ... | ||
110 | |||
111 | 2.2.x OListView, OListViewItem, OListViewFactory | ||
112 | |||
113 | ... | ||
114 | |||
115 | 2.3 libopiepim | ||
116 | |||
117 | ... | ||
118 | |||
119 | 2.4 libopiedb | ||
120 | |||
121 | ... | ||
122 | |||
123 | 2.5 libopienet | ||
124 | |||
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.cpp b/noncore/net/wellenreiter/cornucopia/olistview.cpp index 8bc59de..f2d3730 100644 --- a/noncore/net/wellenreiter/cornucopia/olistview.cpp +++ b/noncore/net/wellenreiter/cornucopia/olistview.cpp | |||
@@ -125,2 +125,78 @@ void OListView::setColumnSeparator( const QPen& p ) | |||
125 | 125 | ||
126 | #ifndef QT_NO_DATASTREAM | ||
127 | void OListView::serializeTo( QDataStream& s ) const | ||
128 | { | ||
129 | #warning Caution... the binary format is still under construction... | ||
130 | qDebug( "storing OListView..." ); | ||
131 | |||
132 | // store number of columns and the labels | ||
133 | s << columns(); | ||
134 | for ( int i = 0; i < columns(); ++i ) | ||
135 | s << columnText( i ); | ||
136 | |||
137 | // calculate the number of top-level items to serialize | ||
138 | int items = 0; | ||
139 | QListViewItem* item = firstChild(); | ||
140 | while ( item ) | ||
141 | { | ||
142 | item = item->nextSibling(); | ||
143 | items++; | ||
144 | } | ||
145 | |||
146 | // store number of items and the items itself | ||
147 | s << items; | ||
148 | item = firstChild(); | ||
149 | for ( int i = 0; i < items; ++i ) | ||
150 | { | ||
151 | s << *static_cast<OListViewItem*>( item ); | ||
152 | item = item->nextSibling(); | ||
153 | } | ||
154 | |||
155 | qDebug( "OListview stored." ); | ||
156 | } | ||
157 | |||
158 | void OListView::serializeFrom( QDataStream& s ) | ||
159 | { | ||
160 | #warning Caution... the binary format is still under construction... | ||
161 | qDebug( "loading OListView..." ); | ||
162 | |||
163 | int cols; | ||
164 | s >> cols; | ||
165 | qDebug( "read number of columns = %d", cols ); | ||
166 | |||
167 | while ( columns() < cols ) addColumn( QString::null ); | ||
168 | |||
169 | for ( int i = 0; i < cols; ++i ) | ||
170 | { | ||
171 | QString coltext; | ||
172 | s >> coltext; | ||
173 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); | ||
174 | setColumnText( i, coltext ); | ||
175 | } | ||
176 | |||
177 | int items; | ||
178 | s >> items; | ||
179 | qDebug( "read number of items = %d", items ); | ||
180 | |||
181 | for ( int i = 0; i < items; ++i ) | ||
182 | { | ||
183 | OListViewItem* item = new OListViewItem( this ); | ||
184 | s >> *item; | ||
185 | } | ||
186 | |||
187 | qDebug( "OListView loaded." ); | ||
188 | |||
189 | } | ||
190 | |||
191 | QDataStream& operator<<( QDataStream& s, const OListView& lv ) | ||
192 | { | ||
193 | lv.serializeTo( s ); | ||
194 | } | ||
195 | |||
196 | QDataStream& operator>>( QDataStream& s, OListView& lv ) | ||
197 | { | ||
198 | lv.serializeFrom( s ); | ||
199 | } | ||
200 | #endif // QT_NO_DATASTREAM | ||
201 | |||
126 | //****************************** OListViewItem *********************************************************************** | 202 | //****************************** OListViewItem *********************************************************************** |
@@ -256,3 +332,3 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in | |||
256 | 332 | ||
257 | //FIXME: Use styling here? | 333 | //FIXME: Use styling here! |
258 | 334 | ||
@@ -262 +338,70 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in | |||
262 | } | 338 | } |
339 | |||
340 | #ifndef QT_NO_DATASTREAM | ||
341 | void OListViewItem::serializeTo( QDataStream& s ) const | ||
342 | { | ||
343 | #warning Caution... the binary format is still under construction... | ||
344 | qDebug( "storing OListViewItem..." ); | ||
345 | |||
346 | // store item text | ||
347 | for ( int i = 0; i < listView()->columns(); ++i ) | ||
348 | { | ||
349 | s << text( i ); | ||
350 | } | ||
351 | |||
352 | // calculate the number of children to serialize | ||
353 | int items = 0; | ||
354 | QListViewItem* item = firstChild(); | ||
355 | while ( item ) | ||
356 | { | ||
357 | item = item->nextSibling(); | ||
358 | items++; | ||
359 | } | ||
360 | |||
361 | // store number of items and the items itself | ||
362 | s << items; | ||
363 | item = firstChild(); | ||
364 | for ( int i = 0; i < items; ++i ) | ||
365 | { | ||
366 | s << *static_cast<OListViewItem*>( item ); | ||
367 | item = item->nextSibling(); | ||
368 | } | ||
369 | |||
370 | qDebug( "OListviewItem stored." ); | ||
371 | } | ||
372 | void OListViewItem::serializeFrom( QDataStream& s ) | ||
373 | { | ||
374 | #warning Caution... the binary format is still under construction... | ||
375 | qDebug( "loading OListViewItem..." ); | ||
376 | |||
377 | for ( int i = 0; i < listView()->columns(); ++i ) | ||
378 | { | ||
379 | QString coltext; | ||
380 | s >> coltext; | ||
381 | qDebug( "read text '%s' for column %d", (const char*) coltext, i ); | ||
382 | setText( i, coltext ); | ||
383 | } | ||
384 | |||
385 | int items; | ||
386 | s >> items; | ||
387 | qDebug( "read number of items = %d", items ); | ||
388 | |||
389 | for ( int i = 0; i < items; ++i ) | ||
390 | { | ||
391 | OListViewItem* item = new OListViewItem( this ); | ||
392 | s >> (*item); | ||
393 | } | ||
394 | |||
395 | qDebug( "OListViewItem loaded." ); | ||
396 | } | ||
397 | |||
398 | QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) | ||
399 | { | ||
400 | lvi.serializeTo( s ); | ||
401 | } | ||
402 | |||
403 | QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) | ||
404 | { | ||
405 | lvi.serializeFrom( s ); | ||
406 | } | ||
407 | #endif // QT_NO_DATASTREAM | ||
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.h b/noncore/net/wellenreiter/cornucopia/olistview.h index 4b9e4b0..9df5500 100644 --- a/noncore/net/wellenreiter/cornucopia/olistview.h +++ b/noncore/net/wellenreiter/cornucopia/olistview.h | |||
@@ -35,10 +35,13 @@ | |||
35 | 35 | ||
36 | #include <qlistview.h> | ||
37 | #include <qcolor.h> | 36 | #include <qcolor.h> |
37 | #include <qlistview.h> | ||
38 | #include <qpen.h> | 38 | #include <qpen.h> |
39 | #include <qdatastream.h> | ||
40 | |||
41 | class OListViewFactory; | ||
39 | 42 | ||
40 | /** | 43 | /** |
41 | * A @ref QListView variant featuring visual enhancements | 44 | * A @ref QListView variant featuring visual and functional enhancements |
42 | * like an alternate background for odd rows and an autostretch | 45 | * like an alternate background for odd rows, an autostretch mode |
43 | * mode for the width of the widget. | 46 | * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. |
44 | * | 47 | * |
@@ -114,2 +117,25 @@ | |||
114 | 117 | ||
118 | #ifndef QT_NO_DATASTREAM | ||
119 | /** | ||
120 | * serialize this object to a @ref QDataStream | ||
121 | * @param s the stream used to serialize this object. | ||
122 | */ | ||
123 | virtual void serializeTo( QDataStream& s ) const; | ||
124 | |||
125 | /** | ||
126 | * serialize this object from a @ref QDataStream | ||
127 | * @param s the stream used to serialize this object. | ||
128 | */ | ||
129 | virtual void serializeFrom( QDataStream& s ); | ||
130 | #endif | ||
131 | |||
132 | /** | ||
133 | * returns a factory for OListView classes | ||
134 | * creates one on the fly if it doesn't exist | ||
135 | * @return the XML Factory | ||
136 | */ | ||
137 | #ifndef QT_NO_XML | ||
138 | //OListViewFactory* Factory(); | ||
139 | #endif | ||
140 | |||
115 | private: | 141 | private: |
@@ -118,5 +144,20 @@ | |||
118 | QPen m_columnSeparator; | 144 | QPen m_columnSeparator; |
119 | 145 | #ifndef QT_NO_XML | |
146 | //OListViewFactory* m_Factory; | ||
147 | #endif | ||
120 | }; | 148 | }; |
121 | 149 | ||
150 | #ifndef QT_NO_DATASTREAM | ||
151 | /** | ||
152 | * \relates QListView | ||
153 | * Writes a listview to the stream and returns a reference to the stream. | ||
154 | */ | ||
155 | QDataStream& operator<<( QDataStream& s, const OListView& lv ); | ||
156 | /** | ||
157 | * \relates QListView | ||
158 | * Reads a listview from the stream and returns a reference to the stream. | ||
159 | */ | ||
160 | QDataStream& operator>>( QDataStream& s, OListView& lv ); | ||
161 | #endif // QT_NO_DATASTREAM | ||
162 | |||
122 | //****************************** OListViewItem ****************************************************************** | 163 | //****************************** OListViewItem ****************************************************************** |
@@ -162,2 +203,16 @@ class OListViewItem: public QListViewItem | |||
162 | 203 | ||
204 | #ifndef QT_NO_DATASTREAM | ||
205 | /** | ||
206 | * serialize this object to or from a @ref QDataStream | ||
207 | * @param s the stream used to serialize this object. | ||
208 | */ | ||
209 | virtual void serializeTo( QDataStream& s ) const; | ||
210 | |||
211 | /** | ||
212 | * serialize this object to or from a @ref QDataStream | ||
213 | * @param s the stream used to serialize this object. | ||
214 | */ | ||
215 | virtual void serializeFrom( QDataStream& s ); | ||
216 | #endif | ||
217 | |||
163 | private: | 218 | private: |
@@ -167,2 +222,16 @@ class OListViewItem: public QListViewItem | |||
167 | 222 | ||
168 | #endif | 223 | #ifndef QT_NO_DATASTREAM |
224 | /** | ||
225 | * \relates QListViewItem | ||
226 | * Writes a listview item and all subitems recursively to the stream | ||
227 | * and returns a reference to the stream. | ||
228 | */ | ||
229 | QDataStream& operator<<( QDataStream &s, const OListViewItem& lvi ); | ||
230 | /** | ||
231 | * \relates QListViewItem | ||
232 | * Reads a listview item from the stream and returns a reference to the stream. | ||
233 | */ | ||
234 | QDataStream& operator>>( QDataStream &s, OListViewItem& lvi ); | ||
235 | #endif // QT_NO_DATASTREAM | ||
236 | |||
237 | #endif // OLISTVIEW_H | ||