From c5324ca49a3aea1662350083dc6a2ef786b32d8b Mon Sep 17 00:00:00 2001 From: fortefr Date: Tue, 19 Jan 2010 09:45:59 +0000 Subject: [PATCH] Automatic tabs update M src/gui/mainwindow.ui M src/gui/mainwindow.cpp M src/gui/mainwindow.h --- src/gui/mainwindow.cpp | 36 ++++++------- src/gui/mainwindow.h | 4 +- src/gui/mainwindow.ui | 117 +++++++++++++++++++++-------------------- 3 files changed, 78 insertions(+), 79 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 0092c1a..101a4ca 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -38,7 +38,6 @@ MainWindow::MainWindow(QWidget *parent) connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateDayView(const QDate &))); connect(activityDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateActivitiesDayView(const QDate &))); - //connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(updateView(int))); // DAY EVENTS View dayTreeView->setHeaderHidden(true); @@ -95,9 +94,9 @@ MainWindow::MainWindow(QWidget *parent) dayNavigator->setDates(aStartDate, aEndDate); activityDayNavigator->setDates(aStartDate, aEndDate); } - 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())); -/* connect(static_cast(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavViewComplete()));*/ + + connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int))); + } MainWindow::~MainWindow() @@ -151,32 +150,31 @@ void MainWindow::aboutApp() dialog.exec(); } -void MainWindow::updateDayView(const QDate &aDate) +void MainWindow::updateDayView(const QDate aDate) { int confId = 1; - static_cast(dayTreeView->model())->loadEvents(aDate,confId); + static_cast(dayTreeView->model())->loadEvents(Conference::getById(confId).start(),confId); dayTreeView->reset(); dayNavigator->show(); } -void MainWindow::updateFavView() +void MainWindow::updateTab(const int n) { int confId = 1; - static_cast(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId); - favTreeView->reset(); //Necessary reset: - // if favourite event unselected as favourite is the only one in its time, and reset is not produced, crashed - + if(n) //index 1 of tabWidget: favouriteTab + { + static_cast(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId); + favTreeView->reset(); + } + else //index 0 of tabWidget: dayViewTab + { + static_cast(dayTreeView->model())->loadEvents(Conference::getById(confId).start(),confId); + dayTreeView->reset(); + } + //TODO: update of activitiesTab needed? dayNavigator->show(); } -/* -void MainWindow::updateFavViewComplete() -{ - int confId = 1; - updateFavView(); - updateDayView(Conference::getById(confId).start()); -} -*/ void MainWindow::updateActivitiesDayView(const QDate &aDate) { diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 6d7fcae..dcbc14a 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -18,8 +18,8 @@ private slots: void importSchedule(); void showParsingProgress(int aStatus); void aboutApp(); - void updateDayView(const QDate &aDate); - void updateFavView(); + void updateDayView(const QDate aDate); + void updateTab(const int n); /*void updateFavViewComplete();*/ void updateActivitiesDayView(const QDate &aDate); void itemDoubleClicked(const QModelIndex &aIndex); diff --git a/src/gui/mainwindow.ui b/src/gui/mainwindow.ui index 25b46e2..0b56fc5 100644 --- a/src/gui/mainwindow.ui +++ b/src/gui/mainwindow.ui @@ -1,7 +1,8 @@ - + + MainWindow - - + + 0 0 @@ -9,29 +10,29 @@ 375 - + MainWindow - - - - - + + + + + 0 - - + + Day View - - - + + + - + - - + + 16777215 16777215 @@ -43,29 +44,29 @@ - - + + Favourites - - - + + + - - + + Activities - - - + + + - + - - + + 16777215 16777215 @@ -77,13 +78,13 @@ - - + + Search - - + + Map @@ -91,50 +92,50 @@ - - + + 0 0 534 - 22 + 24 - - + + File - - + + - - + + Help - - + + - - + + - - - + + + Import Schedule - - + + About Qt - - + + About application - - + + Quit @@ -160,11 +161,11 @@ MainWindow close() - + -1 -1 - + 266 187 -- 2.39.5