From: fortefr Date: Mon, 18 Jan 2010 14:00:32 +0000 (+0000) Subject: Fav table update X-Git-Tag: 0.5.0~292 X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/commitdiff_plain/584234909d9101dee5a156339212aaa436907568 Fav table update M trunk/src/gui/mainwindow.h M trunk/src/gui/mainwindow.cpp M trunk/src/mvc/treeview.h M trunk/src/mvc/eventmodel.cpp M trunk/src/mvc/event.h M trunk/src/fosdem.pro --- diff --git a/src/fosdem.pro b/src/fosdem.pro index fb46540..374b7b0 100644 --- a/src/fosdem.pro +++ b/src/fosdem.pro @@ -3,5 +3,5 @@ TEMPLATE = subdirs SUBDIRS = orm mvc sql gui app maemo : SUBDIRS += alarm #SUBDIRS += test -CONFIG += ordered +CONFIG += ordered debug diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 09263da..5747356 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -36,6 +36,7 @@ MainWindow::MainWindow(QWidget *parent) connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateDayView(const QDate &))); + // DAY EVENTS View dayTreeView->setHeaderHidden(true); dayTreeView->setRootIsDecorated(false); @@ -66,6 +67,9 @@ MainWindow::MainWindow(QWidget *parent) int confId = 1; dayNavigator->setDates(Conference::getById(confId).start(),Conference::getById(confId).end()); } + + connect(static_cast(dayTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView())); + connect(static_cast(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView())); } MainWindow::~MainWindow() @@ -126,3 +130,10 @@ void MainWindow::updateDayView(const QDate &aDate) dayNavigator->show(); } +void MainWindow::updateFavView() +{ + int confId = 1; + static_cast(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId); + favTreeView->reset(); + updateDayView(Conference::getById(confId).start()); +} diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index c0716be..670df95 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -19,6 +19,7 @@ private slots: void showParsingProgress(int aStatus); void aboutApp(); void updateDayView(const QDate &aDate); + void updateFavView(); private: SqlEngine *mSqlEngine; ScheduleXmlParser *mXmlParser; diff --git a/src/mvc/event.h b/src/mvc/event.h index 2433016..b09daa8 100644 --- a/src/mvc/event.h +++ b/src/mvc/event.h @@ -26,7 +26,6 @@ public: public: static Event getById(int id, int conferenceId); - static Event getVirtualById(int id, int conferenceId); static QList getByDate(const QDate& date, int conferenceId); static QList getFavByDate(const QDate& date, int conferenceId); // get Favourities by Date diff --git a/src/mvc/eventmodel.cpp b/src/mvc/eventmodel.cpp index 650c372..f00750d 100644 --- a/src/mvc/eventmodel.cpp +++ b/src/mvc/eventmodel.cpp @@ -47,16 +47,11 @@ QVariant EventModel::data(const QModelIndex& index, int role) const if (index.isValid() && role == Qt::DisplayRole) { if (index.internalId() == 0) - { //range of time data - //qDebug() << qVariantValue(mGroups.at(index.row()).mTitle); + { return mGroups.at(index.row()).mTitle; } else //event data { - //qDebug() << qVariantValue(static_cast(index.internalPointer())->id()); - //return static_cast(index.internalPointer())->id(); - //qDebug() << Event::getVirtualById(static_cast(index.internalPointer())->id(), 1).title();// Id Conference is 1 by now - //return 1; return static_cast(index.internalPointer())->id(); } } diff --git a/src/mvc/treeview.h b/src/mvc/treeview.h index 2a81907..fe8e0e2 100644 --- a/src/mvc/treeview.h +++ b/src/mvc/treeview.h @@ -3,6 +3,7 @@ #include + class TreeView : public QTreeView { public: