Changeset c5324ca


Ignore:
Timestamp:
01/19/10 10:45:59 (12 years ago)
Author:
fortefr <fortefr@…>
Branches:
master, qt5
Children:
ec67a0b
Parents:
9afc0ee
Message:

Automatic tabs update

M src/gui/mainwindow.ui
M src/gui/mainwindow.cpp
M src/gui/mainwindow.h

Location:
src/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r9afc0ee rc5324ca  
    3939    connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateDayView(const QDate &)));
    4040    connect(activityDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateActivitiesDayView(const QDate &)));
    41     //connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(updateView(int)));
    4241
    4342    // DAY EVENTS View
     
    9695        activityDayNavigator->setDates(aStartDate, aEndDate);
    9796    }
    98     connect(static_cast<EventModel*>(dayTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView()));
    99     connect(static_cast<EventModel*>(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavView()));
    100 /*    connect(static_cast<EventModel*>(favTreeView->model()), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), SLOT(updateFavViewComplete()));*/
     97
     98    connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)));
     99
    101100}
    102101
     
    152151}
    153152
    154 void MainWindow::updateDayView(const QDate &aDate)
     153void MainWindow::updateDayView(const QDate aDate)
    155154{
    156155    int confId = 1;
    157     static_cast<EventModel*>(dayTreeView->model())->loadEvents(aDate,confId);
     156    static_cast<EventModel*>(dayTreeView->model())->loadEvents(Conference::getById(confId).start(),confId);
    158157    dayTreeView->reset();
    159158    dayNavigator->show();
    160159}
    161160
    162 void MainWindow::updateFavView()
     161void MainWindow::updateTab(const int n)
    163162{
    164163    int confId = 1;
    165     static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId);
    166     favTreeView->reset(); //Necessary reset:
    167                         //  if favourite event unselected as favourite is the only one in its time, and reset is not produced, crashed
    168 
     164    if(n) //index 1 of tabWidget: favouriteTab
     165    {
     166        static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(confId).start(),confId);
     167        favTreeView->reset();
     168    }
     169    else //index 0 of tabWidget: dayViewTab
     170    {
     171        static_cast<EventModel*>(dayTreeView->model())->loadEvents(Conference::getById(confId).start(),confId);
     172        dayTreeView->reset();
     173    }
     174    //TODO: update of activitiesTab needed?
    169175    dayNavigator->show();
    170176}
    171177
    172 /*
    173 void MainWindow::updateFavViewComplete()
    174 {
    175     int confId = 1;
    176     updateFavView();
    177     updateDayView(Conference::getById(confId).start());
    178 }
    179 */
    180178
    181179void MainWindow::updateActivitiesDayView(const QDate &aDate)
  • src/gui/mainwindow.h

    r9afc0ee rc5324ca  
    1919    void showParsingProgress(int aStatus);
    2020    void aboutApp();
    21     void updateDayView(const QDate &aDate);
    22     void updateFavView();
     21    void updateDayView(const QDate aDate);
     22    void updateTab(const int n);
    2323    /*void updateFavViewComplete();*/
    2424    void updateActivitiesDayView(const QDate &aDate);
  • src/gui/mainwindow.ui

    r9afc0ee rc5324ca  
    1 <ui version="4.0" >
     1<?xml version="1.0" encoding="UTF-8"?>
     2<ui version="4.0">
    23 <class>MainWindow</class>
    3  <widget class="QMainWindow" name="MainWindow" >
    4   <property name="geometry" >
     4 <widget class="QMainWindow" name="MainWindow">
     5  <property name="geometry">
    56   <rect>
    67    <x>0</x>
     
    1011   </rect>
    1112  </property>
    12   <property name="windowTitle" >
     13  <property name="windowTitle">
    1314   <string>MainWindow</string>
    1415  </property>
    15   <widget class="QWidget" name="centralwidget" >
    16    <layout class="QGridLayout" name="gridLayout" >
    17     <item row="0" column="0" >
    18      <widget class="QTabWidget" name="tabWidget" >
    19       <property name="currentIndex" >
     16  <widget class="QWidget" name="centralwidget">
     17   <layout class="QGridLayout" name="gridLayout">
     18    <item row="0" column="0">
     19     <widget class="QTabWidget" name="tabWidget">
     20      <property name="currentIndex">
    2021       <number>0</number>
    2122      </property>
    22       <widget class="QWidget" name="dayViewTab" >
    23        <attribute name="title" >
     23      <widget class="QWidget" name="dayViewTab">
     24       <attribute name="title">
    2425        <string>Day View</string>
    2526       </attribute>
    26        <layout class="QGridLayout" name="gridLayout_2" >
    27         <item row="0" column="0" >
    28          <layout class="QVBoxLayout" name="verticalLayout" >
     27       <layout class="QGridLayout" name="gridLayout_2">
     28        <item row="0" column="0">
     29         <layout class="QVBoxLayout" name="verticalLayout">
    2930          <item>
    30            <widget class="DayNavigatorWidget" native="1" name="dayNavigator" />
     31           <widget class="DayNavigatorWidget" name="dayNavigator" native="true"/>
    3132          </item>
    3233          <item>
    33            <widget class="TreeView" name="dayTreeView" >
    34             <property name="maximumSize" >
     34           <widget class="TreeView" name="dayTreeView">
     35            <property name="maximumSize">
    3536             <size>
    3637              <width>16777215</width>
     
    4445       </layout>
    4546      </widget>
    46       <widget class="QWidget" name="favouritesTab" >
    47        <attribute name="title" >
     47      <widget class="QWidget" name="favouritesTab">
     48       <attribute name="title">
    4849        <string>Favourites</string>
    4950       </attribute>
    50        <layout class="QGridLayout" name="gridLayout_3" >
    51         <item row="0" column="0" >
    52          <widget class="TreeView" name="favTreeView" />
     51       <layout class="QGridLayout" name="gridLayout_3">
     52        <item row="0" column="0">
     53         <widget class="TreeView" name="favTreeView"/>
    5354        </item>
    5455       </layout>
    5556      </widget>
    56       <widget class="QWidget" name="activitiesTab" >
    57        <attribute name="title" >
     57      <widget class="QWidget" name="activitiesTab">
     58       <attribute name="title">
    5859        <string>Activities</string>
    5960       </attribute>
    60        <layout class="QGridLayout" name="gridLayout_4" >
    61         <item row="0" column="0" >
    62          <layout class="QVBoxLayout" name="activitiesVerticalLayout" >
     61       <layout class="QGridLayout" name="gridLayout_4">
     62        <item row="0" column="0">
     63         <layout class="QVBoxLayout" name="activitiesVerticalLayout">
    6364          <item>
    64            <widget class="DayNavigatorWidget" native="1" name="activityDayNavigator" />
     65           <widget class="DayNavigatorWidget" name="activityDayNavigator" native="true"/>
    6566          </item>
    6667          <item>
    67            <widget class="TreeView" name="actTreeView" >
    68             <property name="maximumSize" >
     68           <widget class="TreeView" name="actTreeView">
     69            <property name="maximumSize">
    6970             <size>
    7071              <width>16777215</width>
     
    7879       </layout>
    7980      </widget>
    80       <widget class="QWidget" name="searchTab" >
    81        <attribute name="title" >
     81      <widget class="QWidget" name="searchTab">
     82       <attribute name="title">
    8283        <string>Search</string>
    8384       </attribute>
    8485      </widget>
    85       <widget class="QWidget" name="mapTab" >
    86        <attribute name="title" >
     86      <widget class="QWidget" name="mapTab">
     87       <attribute name="title">
    8788        <string>Map</string>
    8889       </attribute>
     
    9293   </layout>
    9394  </widget>
    94   <widget class="QMenuBar" name="menubar" >
    95    <property name="geometry" >
     95  <widget class="QMenuBar" name="menubar">
     96   <property name="geometry">
    9697    <rect>
    9798     <x>0</x>
    9899     <y>0</y>
    99100     <width>534</width>
    100      <height>22</height>
     101     <height>24</height>
    101102    </rect>
    102103   </property>
    103    <widget class="QMenu" name="menuFile" >
    104     <property name="title" >
     104   <widget class="QMenu" name="menuFile">
     105    <property name="title">
    105106     <string>File</string>
    106107    </property>
    107     <addaction name="actionImportSchedule" />
    108     <addaction name="actionQuit" />
     108    <addaction name="actionImportSchedule"/>
     109    <addaction name="actionQuit"/>
    109110   </widget>
    110    <widget class="QMenu" name="menuAbout" >
    111     <property name="title" >
     111   <widget class="QMenu" name="menuAbout">
     112    <property name="title">
    112113     <string>Help</string>
    113114    </property>
    114     <addaction name="actionAboutQt" />
    115     <addaction name="actionAboutApplication" />
     115    <addaction name="actionAboutQt"/>
     116    <addaction name="actionAboutApplication"/>
    116117   </widget>
    117    <addaction name="menuAbout" />
    118    <addaction name="menuFile" />
     118   <addaction name="menuAbout"/>
     119   <addaction name="menuFile"/>
    119120  </widget>
    120   <widget class="QStatusBar" name="statusbar" />
    121   <action name="actionImportSchedule" >
    122    <property name="text" >
     121  <widget class="QStatusBar" name="statusbar"/>
     122  <action name="actionImportSchedule">
     123   <property name="text">
    123124    <string>Import Schedule</string>
    124125   </property>
    125126  </action>
    126   <action name="actionAboutQt" >
    127    <property name="text" >
     127  <action name="actionAboutQt">
     128   <property name="text">
    128129    <string>About Qt</string>
    129130   </property>
    130131  </action>
    131   <action name="actionAboutApplication" >
    132    <property name="text" >
     132  <action name="actionAboutApplication">
     133   <property name="text">
    133134    <string>About application</string>
    134135   </property>
    135136  </action>
    136   <action name="actionQuit" >
    137    <property name="text" >
     137  <action name="actionQuit">
     138   <property name="text">
    138139    <string>Quit</string>
    139140   </property>
     
    161162   <slot>close()</slot>
    162163   <hints>
    163     <hint type="sourcelabel" >
     164    <hint type="sourcelabel">
    164165     <x>-1</x>
    165166     <y>-1</y>
    166167    </hint>
    167     <hint type="destinationlabel" >
     168    <hint type="destinationlabel">
    168169     <x>266</x>
    169170     <y>187</y>
Note: See TracChangeset for help on using the changeset viewer.