From: kirilma Date: Thu, 22 Apr 2010 15:10:46 +0000 (+0000) Subject: optimization X-Git-Tag: 0.5.0~87 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/c8c414fd82781f088a99084090eb4866ff4e26d0?hp=f7dc75a738ef32b484dba70b656933d317036e71 optimization --- diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index f5b9dd7..08ba45b 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -108,6 +108,12 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) connect(conferencesAction, SIGNAL(triggered()), SLOT(showConferences())); useConference(Conference::activeConference()); + // optimization, see useConference() code + try { + initTabs(); + } catch (OrmException) { + clearTabs(); + } #if 0 // TODO: remove GUI @@ -253,9 +259,24 @@ void MainWindow::useConference(int id) { try { Conference::getById(Conference::activeConference()).update("active",0); - Conference::getById(id).update("active",1); + Conference new_active = Conference::getById(id); + new_active.update("active",1); - initTabs(); + // looks like it does not work at n900 + setWindowTitle(new_active.title()); + + // optimization. + // dont run initTabs() here + // it takes much CPU, making travelling between conferences in ConferenceEditor longer + // and is not seen in maemo WM anyway + // instead run it explicitly where needed + // dont forget to protect the calls by try-catch! + + // just in case, clear conference selection instead + clearTabs(); + + // end of optimization + // initTabs(); } catch (OrmException& e) { // cannon set an active conference unsetConference(); @@ -270,7 +291,6 @@ void MainWindow::initTabs() Conference active = Conference::getById(confId); QDate startDate = active.start(); QDate endDate = active.end(); - setWindowTitle(active.title()); // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates dayTabContainer->setDates(startDate, endDate); @@ -282,7 +302,7 @@ void MainWindow::initTabs() nowTabContainer->updateTreeView(QDate::currentDate()); } -void MainWindow::unsetConference() +void MainWindow::clearTabs() { dayTabContainer->clearModel(); tracksTabContainer->clearModel(); @@ -291,9 +311,11 @@ void MainWindow::unsetConference() searchTabContainer->clearModel(); searchTabContainer->searchAgainClicked(); nowTabContainer->clearModel(); +} - // TODO: remove - // conferenceHeader->hide(); +void MainWindow::unsetConference() +{ + clearTabs(); setWindowTitle(saved_title); } @@ -344,6 +366,13 @@ void MainWindow::showConferences() connect(this, SIGNAL(conferenceRemoved()), &dialog, SLOT(conferenceRemoved())); dialog.exec(); + + // optimization, see useConference() code + try { + initTabs(); + } catch (OrmException) { + clearTabs(); + } } void MainWindow::networkQueryFinished(QNetworkReply *aReply) diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 0ac7e4f..c01f6bf 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -59,6 +59,7 @@ private slots: private: void fillAndShowConferenceHeader(); void initTabs(); + void clearTabs(); void importData(const QByteArray &aData, const QString& url); QString saved_title;