summaryrefslogtreecommitdiff
path: root/core/pim/todo/tableview.h
authorzecke <zecke>2002-10-07 23:37:48 (UTC)
committer zecke <zecke>2002-10-07 23:37:48 (UTC)
commit626183d58f43f010f5cfb055f8582be0227ff59c (patch) (side-by-side diff)
treead219a64b642fe63480f04cca7c37de4795c5e84 /core/pim/todo/tableview.h
parentcdc6cad191b866d481085da1d05806afb5602b2c (diff)
downloadopie-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
Diffstat (limited to 'core/pim/todo/tableview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableview.h44
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
@@ -46,13 +46,12 @@ namespace Todo {
TableView( MainWindow*, QWidget* parent );
~TableView();
- void updateFromTable( const OTodo&, CheckItem* = 0 );
- OTodo find(int uid);
QString type()const;
int current();
QString currentRepresentation();
+ void clear();
void showOverDue( bool );
void updateView();
void setTodo( int uid, const OTodo& );
@@ -63,19 +62,21 @@ namespace Todo {
void setShowDeadline( bool );
void setShowCategory(const QString& =QString::null );
- void clear();
void newDay();
- QArray<int> completed();
QWidget* widget();
void sortColumn(int, bool, bool );
+
+ /*
+ * we do our drawing ourselves
+ * because we don't want to have
+ * 40.000 QTableItems for 10.000
+ * OTodos where we only show 10 at a time!
+ */
+ void paintCell(QPainter* p, int row, int col, const QRect&, bool );
private:
/* reimplented for internal reasons */
void viewportPaintEvent( QPaintEvent* );
- inline void insertTodo( const OTodo&, int row );
- CheckItem* checkItem( int row );
- DueTextItem* dueItem( int row );
QTimer *m_menuTimer;
- QMap<int, CheckItem*> m_cache;
bool m_enablePaint:1;
private slots:
@@ -87,33 +88,6 @@ private slots:
void slotValueChanged(int, int);
void slotCurrentChanged(int, int );
};
- inline void TableView::insertTodo( const OTodo& event, int row ) {
-
-
- QString sortKey = (char) ( (event.isCompleted() ? 'a' : 'A' )
- + event.priority() )
- + Qtopia::buildSortKey( event.description() );
- CheckItem *chk = new CheckItem( this, sortKey, event.uid(), event.categories() );
- chk->setChecked( event.isCompleted() );
-
- ComboItem *cmb = new ComboItem(this, QTableItem::WhenCurrent );
- cmb->setText( QString::number( event.priority() ) );
-
- QString sum = event.summary();
- QTableItem* ti = new TodoTextItem( this, sum.isEmpty() ?
- event.description().left(40).simplifyWhiteSpace() :
- sum );
- ti->setReplaceable( FALSE );
-
- DueTextItem *due = new DueTextItem(this, event );
-
- setItem( row, 0, chk );
- setItem( row, 1, cmb );
- setItem( row, 2, ti );
- setItem( row, 3, due );
-
- m_cache.insert( event.uid(), chk );
- }
};
#endif