The dateChanged signal is transmitted to the tabcontainers now.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 21 Sep 2011 20:30:03 +0000 (20:30 +0000)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 21 Sep 2011 20:30:03 +0000 (20:30 +0000)
src/gui/daynavigatorwidget.cpp
src/gui/mainwindow.cpp
src/gui/tabcontainer.cpp
src/gui/tabcontainer.h

index f8674af..c6d0a40 100644 (file)
@@ -29,6 +29,8 @@ DayNavigatorWidget::DayNavigatorWidget(QWidget *aParent): QWidget(aParent) {
     connect(prevDayButton, SIGNAL(clicked()), SLOT(prevDayButtonClicked()));
     connect(nextDayButton, SIGNAL(clicked()), SLOT(nextDayButtonClicked()));
     connect(todayButton, SIGNAL(clicked()), SLOT(todayButtonClicked()));
+
+    configureNavigation();
 }
 
 
@@ -70,8 +72,8 @@ void DayNavigatorWidget::setCurDate(const QDate& curDate) {
 
 
 void DayNavigatorWidget::configureNavigation() {
-    prevDayButton->setDisabled(mCurDate == mStartDate);
-    nextDayButton->setDisabled(mCurDate == mEndDate);
+    prevDayButton->setDisabled(!mStartDate.isValid() || mCurDate == mStartDate);
+    nextDayButton->setDisabled(!mEndDate.isValid() || mCurDate == mEndDate);
 }
 
 
@@ -102,7 +104,7 @@ void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent)
 {
     Q_UNUSED(aEvent);
 
-    QString selectedDateStr = mCurDate.toString("dddd\nyyyy-MM-dd");
+    QString selectedDateStr = mCurDate.isValid() ? mCurDate.toString("dddd\nyyyy-MM-dd") : tr("No date");
     QPainter painter(this);
     painter.save();
 
index 71c0bee..91a00e2 100644 (file)
@@ -91,6 +91,14 @@ MainWindow::MainWindow(int aEventId, QWidget *aParent)
     connect(nowTabContainer, SIGNAL(eventHasChanged(int,bool)), SLOT(eventHasChanged(int,bool)));
     connect(searchTabContainer, SIGNAL(eventHasChanged(int,bool)), SLOT(eventHasChanged(int,bool)));
 
+    // date has changed
+    connect(dayNavigator, SIGNAL(dateChanged(QDate)), dayTabContainer, SLOT(setCurDate(QDate)));
+    connect(dayNavigator, SIGNAL(dateChanged(QDate)), favsTabContainer, SLOT(setCurDate(QDate)));
+    connect(dayNavigator, SIGNAL(dateChanged(QDate)), tracksTabContainer, SLOT(setCurDate(QDate)));
+    connect(dayNavigator, SIGNAL(dateChanged(QDate)), roomsTabContainer, SLOT(setCurDate(QDate)));
+    connect(dayNavigator, SIGNAL(dateChanged(QDate)), nowTabContainer, SLOT(setCurDate(QDate)));
+    connect(dayNavigator, SIGNAL(dateChanged(QDate)), searchTabContainer, SLOT(setCurDate(QDate)));
+
     connect(aboutAction, SIGNAL(triggered()), SLOT(aboutApp()));
     connect(settingsAction, SIGNAL(triggered()), SLOT(setup()));
     connect(conferencesAction, SIGNAL(triggered()), SLOT(showConferences()));
index c17eff2..48f9120 100644 (file)
@@ -111,6 +111,12 @@ void TabContainer::updateTreeViewModel(int aEventId, bool aReloadModel)
     }
 }
 
+
+void TabContainer::setCurDate(const QDate& curDate) {
+    updateTreeView(curDate);
+}
+
+
 void TabContainer::setDates(const QDate &aStart, const QDate &aEnd)
 {
     dayNavigator->setDates(aStart, aEnd);
index 572b995..dfbf653 100644 (file)
@@ -45,6 +45,7 @@ signals:
 
 public slots:
     virtual void updateTreeViewModel(int aEventId, bool aReloadModel = false);
+    void setCurDate(const QDate& curDate);
     void setDates(const QDate &aStart, const QDate &aEnd);
 
 protected slots: