Favourites dayNavigator
authorfortefr <fortefr@localhost>
Tue, 19 Jan 2010 12:55:24 +0000 (12:55 +0000)
committerfortefr <fortefr@localhost>
Tue, 19 Jan 2010 12:55:24 +0000 (12:55 +0000)
src/gui/mainwindow.cpp
src/gui/mainwindow.h
src/gui/mainwindow.ui

index ac971ad..9d58b29 100644 (file)
@@ -38,6 +38,7 @@ 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(favouriteDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateFavouritesDayView(const QDate &)));
 
     // DAY EVENTS View
     dayTreeView->setHeaderHidden(true);
@@ -93,6 +94,7 @@ MainWindow::MainWindow(QWidget *parent)
         QDate aEndDate = Conference::getById(confId).end();
         dayNavigator->setDates(aStartDate, aEndDate);
         activityDayNavigator->setDates(aStartDate, aEndDate);
+        favouriteDayNavigator->setDates(aStartDate, aEndDate);
     }
 
     connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)));
@@ -167,23 +169,31 @@ void MainWindow::updateTab(const int aIndex)
         {
             static_cast<EventModel*>(dayTreeView->model())->loadEvents(Conference::getById(confId).start(),confId);
             dayTreeView->reset();
+            dayNavigator->show();
         }
         break;
     case 1: //index 1 of tabWidget: favouritesTab
         {
-                static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId);
-                favTreeView->reset();
+            static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId);
+            favTreeView->reset();
+            favouriteDayNavigator->show();
+        }
+        break;
+    case 2: //index 2 of tabWidget: activitiesTab
+        {
+            static_cast<EventModel*>(actTreeView->model())->loadEventsByActivities(Conference::getById(confId).start(),confId);
+            actTreeView->reset();
+            activityDayNavigator->show();
         }
         break;
     default:
         {
-            //TODO: update of activitiesTab needed?
+
         }
     };
 
-    dayNavigator->show();
-}
 
+}
 
 void MainWindow::updateActivitiesDayView(const QDate &aDate)
 {
@@ -193,6 +203,14 @@ void MainWindow::updateActivitiesDayView(const QDate &aDate)
     activityDayNavigator->show();
 }
 
+void MainWindow::updateFavouritesDayView(const QDate &aDate)
+{
+    int confId = 1;
+    static_cast<EventModel*>(favTreeView->model())->loadFavEvents(aDate,confId);
+    favTreeView->reset();
+    favouriteDayNavigator->show();
+}
+
 void MainWindow::itemDoubleClicked(const QModelIndex &aIndex)
 {
     // have to handle only events, not time-groups
index 1d7fcf7..65719d0 100644 (file)
@@ -20,8 +20,8 @@ private slots:
     void aboutApp();
     void updateDayView(const QDate &aDate);
     void updateTab(const int n);
-    /*void updateFavViewComplete();*/
     void updateActivitiesDayView(const QDate &aDate);
+    void updateFavouritesDayView(const QDate &aDate);
     void itemDoubleClicked(const QModelIndex &aIndex);
     void displayMap(const QModelIndex &aIndex);
 private:
index 7d3e2b8..e9d255e 100644 (file)
@@ -1,7 +1,8 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow" >
-  <property name="geometry" >
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <height>373</height>
    </rect>
   </property>
-  <property name="minimumSize" >
+  <property name="minimumSize">
    <size>
     <width>400</width>
     <height>300</height>
    </size>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>MainWindow</string>
   </property>
-  <widget class="QWidget" name="centralwidget" >
-   <layout class="QGridLayout" name="gridLayout" >
-    <item row="0" column="0" >
-     <widget class="QTabWidget" name="tabWidget" >
-      <property name="currentIndex" >
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="0" column="0">
+     <widget class="QTabWidget" name="tabWidget">
+      <property name="currentIndex">
        <number>1</number>
       </property>
-      <widget class="QWidget" name="dayViewTab" >
-       <attribute name="title" >
+      <widget class="QWidget" name="dayViewTab">
+       <attribute name="title">
         <string>Day View</string>
        </attribute>
-       <layout class="QGridLayout" name="gridLayout_2" >
-        <item row="0" column="0" >
-         <layout class="QVBoxLayout" name="verticalLayout" >
+       <layout class="QGridLayout" name="gridLayout_2">
+        <item row="0" column="0">
+         <layout class="QVBoxLayout" name="verticalLayout">
           <item>
-           <widget class="DayNavigatorWidget" native="1" name="dayNavigator" />
+           <widget class="DayNavigatorWidget" name="dayNavigator" native="true"/>
           </item>
           <item>
-           <widget class="TreeView" name="dayTreeView" >
-            <property name="maximumSize" >
+           <widget class="TreeView" name="dayTreeView">
+            <property name="maximumSize">
              <size>
               <width>16777215</width>
               <height>16777215</height>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="favouritesTab" >
-       <attribute name="title" >
+      <widget class="QWidget" name="favouritesTab">
+       <attribute name="title">
         <string>Favourites</string>
        </attribute>
-       <layout class="QGridLayout" name="gridLayout_3" >
-        <item row="0" column="0" >
-         <widget class="TreeView" name="favTreeView" />
+       <layout class="QGridLayout" name="gridLayout_3">
+        <item row="0" column="0">
+         <layout class="QVBoxLayout" name="verticalLayout_2">
+          <item>
+           <widget class="DayNavigatorWidget" name="favouriteDayNavigator" native="true"/>
+          </item>
+          <item>
+           <widget class="TreeView" name="favTreeView"/>
+          </item>
+         </layout>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="activitiesTab" >
-       <attribute name="title" >
+      <widget class="QWidget" name="activitiesTab">
+       <attribute name="title">
         <string>Activities</string>
        </attribute>
-       <layout class="QGridLayout" name="gridLayout_4" >
-        <item row="0" column="0" >
-         <layout class="QVBoxLayout" name="activitiesVerticalLayout" >
+       <layout class="QGridLayout" name="gridLayout_4">
+        <item row="0" column="0">
+         <layout class="QVBoxLayout" name="activitiesVerticalLayout">
           <item>
-           <widget class="DayNavigatorWidget" native="1" name="activityDayNavigator" />
+           <widget class="DayNavigatorWidget" name="activityDayNavigator" native="true"/>
           </item>
           <item>
-           <widget class="TreeView" name="actTreeView" >
-            <property name="maximumSize" >
+           <widget class="TreeView" name="actTreeView">
+            <property name="maximumSize">
              <size>
               <width>16777215</width>
               <height>16777215</height>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="searchTab" >
-       <attribute name="title" >
+      <widget class="QWidget" name="searchTab">
+       <attribute name="title">
         <string>Search</string>
        </attribute>
       </widget>
-      <widget class="QWidget" name="mapTab" >
-       <attribute name="title" >
+      <widget class="QWidget" name="mapTab">
+       <attribute name="title">
         <string>Map</string>
        </attribute>
       </widget>
     </item>
    </layout>
   </widget>
-  <widget class="QMenuBar" name="menubar" >
-   <property name="geometry" >
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
      <width>531</width>
-     <height>40</height>
+     <height>24</height>
     </rect>
    </property>
-   <widget class="QMenu" name="menuFile" >
-    <property name="title" >
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
      <string>File</string>
     </property>
-    <addaction name="actionImportSchedule" />
-    <addaction name="actionQuit" />
+    <addaction name="actionImportSchedule"/>
+    <addaction name="actionQuit"/>
    </widget>
-   <widget class="QMenu" name="menuAbout" >
-    <property name="title" >
+   <widget class="QMenu" name="menuAbout">
+    <property name="title">
      <string>Help</string>
     </property>
-    <addaction name="actionAboutQt" />
-    <addaction name="actionAboutApplication" />
+    <addaction name="actionAboutQt"/>
+    <addaction name="actionAboutApplication"/>
    </widget>
-   <addaction name="menuAbout" />
-   <addaction name="menuFile" />
+   <addaction name="menuAbout"/>
+   <addaction name="menuFile"/>
   </widget>
-  <widget class="QStatusBar" name="statusbar" />
-  <action name="actionImportSchedule" >
-   <property name="text" >
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="actionImportSchedule">
+   <property name="text">
     <string>Import Schedule</string>
    </property>
   </action>
-  <action name="actionAboutQt" >
-   <property name="text" >
+  <action name="actionAboutQt">
+   <property name="text">
     <string>About Qt</string>
    </property>
   </action>
-  <action name="actionAboutApplication" >
-   <property name="text" >
+  <action name="actionAboutApplication">
+   <property name="text">
     <string>About application</string>
    </property>
   </action>
-  <action name="actionQuit" >
-   <property name="text" >
+  <action name="actionQuit">
+   <property name="text">
     <string>Quit</string>
    </property>
   </action>
    <receiver>MainWindow</receiver>
    <slot>close()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>-1</x>
      <y>-1</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>266</x>
      <y>187</y>
     </hint>