Ignore:
Timestamp:
01/21/10 23:03:07 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
d336730
Parents:
1735f55
Message:

EventModel? signaling changed

  • if some of the data (favourite,alarm) has changed on the event, signal 'eventHasChanged' is emitted
  • all treeViews (eg. DayView?, FavsView?, TracksView?, ...) have to listen on this signal

Only favouritiesView is 'reset' when current tab is changed in mainWindow

  • 'cause time groupings have to be recreated, since favs may have changed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r1735f55 rc718a77  
    7979        searchTreeView->setModel(new EventModel());
    8080        searchTreeView->setItemDelegate(new Delegate(searchTreeView));
     81
     82    // event details have changed
     83    connect(dayTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
     84    connect(favTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
     85    connect(trackTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
     86    connect(searchTreeView, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    8187
    8288    // event clicked
     
    97103    // event search button clicked
    98104    connect(searchButton, SIGNAL(clicked()), SLOT(searchClicked()));
    99 
    100     // TESTING: load some 'fav' data
    101     if(Conference::getAll().count()) // no conference(s) in the DB
    102     {
    103         static_cast<EventModel*>(favTreeView->model())->loadFavEvents(Conference::getById(AppSettings::confId()).start(),AppSettings::confId());
    104         favTreeView->reset();
    105     }
     105    //
     106    connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(tabHasChanged(int)));
    106107
    107108    if(!Conference::getAll().count()) // no conference(s) in the DB
     
    128129    }
    129130
    130     connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)));
    131 
    132131    searchTreeView->hide();
    133132    searchDayNavigator->hide();
     
    188187}
    189188
    190 void MainWindow::updateTab(const int aIndex)
    191 {
    192     switch(aIndex)
    193     {
    194     case 0://index 0 of tabWidget: dayViewTab
    195         {
    196             updateDayView(dayNavigator->getCurrentDate());
    197         }
    198         break;
    199     case 1: //index 1 of tabWidget: favouritesTab
    200         {
    201             updateFavouritesView(favouriteDayNavigator->getCurrentDate());
    202         }
    203         break;
    204     case 2: //index 2 of tabWidget: activitiesTab
    205         {
    206             updateTracksView(trackDayNavigator->getCurrentDate());
    207         }
    208         break;
    209     case 3: //index 3 of tabWidget: searchTab
    210        {
    211            updateSearchView( searchDayNavigator->getCurrentDate() );
    212        }
    213        break;
    214     default:
    215         {
    216 
    217         }
    218     };
    219 }
    220 
    221189void MainWindow::updateTracksView(const QDate &aDate)
    222190{
     
    301269}
    302270
     271void MainWindow::eventHasChanged(int aEventId)
     272{
     273    static_cast<EventModel*>(dayTreeView->model())->updateModel(aEventId);
     274    static_cast<EventModel*>(favTreeView->model())->updateModel(aEventId);
     275    static_cast<EventModel*>(trackTreeView->model())->updateModel(aEventId);
     276    static_cast<EventModel*>(searchTreeView->model())->updateModel(aEventId);
     277}
     278
     279void MainWindow::tabHasChanged(int aIndex)
     280{
     281    Q_UNUSED(aIndex);
     282
     283    updateFavouritesView(favouriteDayNavigator->getCurrentDate());
     284}
     285
Note: See TracChangeset for help on using the changeset viewer.