X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/blobdiff_plain/1735f5512cf3a65b37ef7dcdd7572457372f5095..c718a77f5a7fbf085dfe014e12a444be344a4140:/src/gui/mainwindow.cpp diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 7fa5c64..d2d1138 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -79,6 +79,12 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) searchTreeView->setModel(new EventModel()); searchTreeView->setItemDelegate(new Delegate(searchTreeView)); + // event details have changed + connect(dayTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); + connect(favTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); + connect(trackTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); + connect(searchTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int))); + // event clicked connect(dayTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); connect(favTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &))); @@ -96,13 +102,8 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) connect(searchTreeView, SIGNAL(requestForWarning(const QModelIndex &)), SLOT(displayWarning(const QModelIndex &))); // event search button clicked connect(searchButton, SIGNAL(clicked()), SLOT(searchClicked())); - - // TESTING: load some 'fav' data - if(Conference::getAll().count()) // no conference(s) in the DB - { - static_cast(favTreeView->model())->loadFavEvents(Conference::getById(AppSettings::confId()).start(),AppSettings::confId()); - favTreeView->reset(); - } + // + connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(tabHasChanged(int))); if(!Conference::getAll().count()) // no conference(s) in the DB { @@ -127,8 +128,6 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent) Conference::getById(AppSettings::confId()).end().toString("dd-MM-yyyy")); } - connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int))); - searchTreeView->hide(); searchDayNavigator->hide(); @@ -187,37 +186,6 @@ void MainWindow::updateDayView(const QDate &aDate) dayNavigator->show(); } -void MainWindow::updateTab(const int aIndex) -{ - switch(aIndex) - { - case 0://index 0 of tabWidget: dayViewTab - { - updateDayView(dayNavigator->getCurrentDate()); - } - break; - case 1: //index 1 of tabWidget: favouritesTab - { - updateFavouritesView(favouriteDayNavigator->getCurrentDate()); - } - break; - case 2: //index 2 of tabWidget: activitiesTab - { - updateTracksView(trackDayNavigator->getCurrentDate()); - } - break; - case 3: //index 3 of tabWidget: searchTab - { - updateSearchView( searchDayNavigator->getCurrentDate() ); - } - break; - default: - { - - } - }; -} - void MainWindow::updateTracksView(const QDate &aDate) { static_cast(trackTreeView->model())->loadEventsByTrack(aDate, AppSettings::confId()); @@ -300,3 +268,18 @@ void MainWindow::displayWarning(const QModelIndex &aIndex) tr("This event happens at the same time than another one of your favourites.") ); } +void MainWindow::eventHasChanged(int aEventId) +{ + static_cast(dayTreeView->model())->updateModel(aEventId); + static_cast(favTreeView->model())->updateModel(aEventId); + static_cast(trackTreeView->model())->updateModel(aEventId); + static_cast(searchTreeView->model())->updateModel(aEventId); +} + +void MainWindow::tabHasChanged(int aIndex) +{ + Q_UNUSED(aIndex); + + updateFavouritesView(favouriteDayNavigator->getCurrentDate()); +} +