author | zecke <zecke> | 2002-10-07 23:37:48 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-07 23:37:48 (UTC) |
commit | 626183d58f43f010f5cfb055f8582be0227ff59c (patch) (unidiff) | |
tree | ad219a64b642fe63480f04cca7c37de4795c5e84 /core/pim/todo/tableview.h | |
parent | cdc6cad191b866d481085da1d05806afb5602b2c (diff) | |
download | opie-626183d58f43f010f5cfb055f8582be0227ff59c.zip opie-626183d58f43f010f5cfb055f8582be0227ff59c.tar.gz opie-626183d58f43f010f5cfb055f8582be0227ff59c.tar.bz2 |
We're now using a home made painting of cells
This will theoretically speed up things
Currently it's noticeable slower on SQL
Cause we do up to 80 queries for 10 different
items. As you see a cache could be the answer to these
problems.
The reason for custom drawing is speed and memory consumption.
Take the unlikely case of 10.000 items
We would have 40.000 QTableItem
but would only show 40 of them at a time.
The rest seems to be wasted
-rw-r--r-- | core/pim/todo/tableview.h | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 1fa21b2..b608204 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -47,6 +47,4 @@ namespace Todo { | |||
47 | ~TableView(); | 47 | ~TableView(); |
48 | 48 | ||
49 | void updateFromTable( const OTodo&, CheckItem* = 0 ); | ||
50 | OTodo find(int uid); | ||
51 | 49 | ||
52 | QString type()const; | 50 | QString type()const; |
@@ -54,4 +52,5 @@ namespace Todo { | |||
54 | QString currentRepresentation(); | 52 | QString currentRepresentation(); |
55 | 53 | ||
54 | void clear(); | ||
56 | void showOverDue( bool ); | 55 | void showOverDue( bool ); |
57 | void updateView(); | 56 | void updateView(); |
@@ -64,17 +63,19 @@ namespace Todo { | |||
64 | 63 | ||
65 | void setShowCategory(const QString& =QString::null ); | 64 | void setShowCategory(const QString& =QString::null ); |
66 | void clear(); | ||
67 | void newDay(); | 65 | void newDay(); |
68 | QArray<int> completed(); | ||
69 | QWidget* widget(); | 66 | QWidget* widget(); |
70 | void sortColumn(int, bool, bool ); | 67 | void sortColumn(int, bool, bool ); |
68 | |||
69 | /* | ||
70 | * we do our drawing ourselves | ||
71 | * because we don't want to have | ||
72 | * 40.000 QTableItems for 10.000 | ||
73 | * OTodos where we only show 10 at a time! | ||
74 | */ | ||
75 | void paintCell(QPainter* p, int row, int col, const QRect&, bool ); | ||
71 | private: | 76 | private: |
72 | /* reimplented for internal reasons */ | 77 | /* reimplented for internal reasons */ |
73 | void viewportPaintEvent( QPaintEvent* ); | 78 | void viewportPaintEvent( QPaintEvent* ); |
74 | inline void insertTodo( const OTodo&, int row ); | ||
75 | CheckItem* checkItem( int row ); | ||
76 | DueTextItem* dueItem( int row ); | ||
77 | QTimer *m_menuTimer; | 79 | QTimer *m_menuTimer; |
78 | QMap<int, CheckItem*> m_cache; | ||
79 | bool m_enablePaint:1; | 80 | bool m_enablePaint:1; |
80 | 81 | ||
@@ -88,31 +89,4 @@ private slots: | |||
88 | void slotCurrentChanged(int, int ); | 89 | void slotCurrentChanged(int, int ); |
89 | }; | 90 | }; |
90 | inline void TableView::insertTodo( const OTodo& event, int row ) { | ||
91 | |||
92 | |||
93 | QString sortKey = (char) ( (event.isCompleted() ? 'a' : 'A' ) | ||
94 | + event.priority() ) | ||
95 | + Qtopia::buildSortKey( event.description() ); | ||
96 | CheckItem *chk = new CheckItem( this, sortKey, event.uid(), event.categories() ); | ||
97 | chk->setChecked( event.isCompleted() ); | ||
98 | |||
99 | ComboItem *cmb = new ComboItem(this, QTableItem::WhenCurrent ); | ||
100 | cmb->setText( QString::number( event.priority() ) ); | ||
101 | |||
102 | QString sum = event.summary(); | ||
103 | QTableItem* ti = new TodoTextItem( this, sum.isEmpty() ? | ||
104 | event.description().left(40).simplifyWhiteSpace() : | ||
105 | sum ); | ||
106 | ti->setReplaceable( FALSE ); | ||
107 | |||
108 | DueTextItem *due = new DueTextItem(this, event ); | ||
109 | |||
110 | setItem( row, 0, chk ); | ||
111 | setItem( row, 1, cmb ); | ||
112 | setItem( row, 2, ti ); | ||
113 | setItem( row, 3, due ); | ||
114 | |||
115 | m_cache.insert( event.uid(), chk ); | ||
116 | } | ||
117 | }; | 91 | }; |
118 | 92 | ||