Ignore:
Timestamp:
01/28/10 15:47:21 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
83020cd
Parents:
eb21333
Message:

some performance optimizations

  • favourities reloaded only if they have really changed
  • otherwise only event in the question is updated
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/tabcontainer.cpp

    reb21333 r872aeaa  
    2727    connect(dayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateTreeView(const QDate &)));
    2828
    29     connect(treeView, SIGNAL(eventHasChanged(int)), SIGNAL(eventHasChanged(int)));
     29    connect(treeView, SIGNAL(eventHasChanged(int,bool)), SIGNAL(eventHasChanged(int,bool)));
    3030    connect(treeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
    3131    connect(treeView, SIGNAL(requestForMap(const QModelIndex &)), SLOT(displayMap(const QModelIndex &)));
     
    5050
    5151    EventDialog dialog(static_cast<Event*>(aIndex.internalPointer())->id(),this);
    52     connect(&dialog, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int)));
     52    connect(&dialog, SIGNAL(eventHasChanged(int,bool)), this, SIGNAL(eventHasChanged(int,bool)));
    5353    dialog.exec();
    54     disconnect(&dialog, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int)));
     54    disconnect(&dialog, SIGNAL(eventHasChanged(int,bool)), this, SIGNAL(eventHasChanged(int,bool)));
    5555}
    5656
     
    7979{
    8080    ConflictsDialog dialog(static_cast<Event*>(aIndex.internalPointer())->id(),this);
    81     connect(&dialog, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int)));
     81    connect(&dialog, SIGNAL(eventHasChanged(int,bool)), this, SIGNAL(eventHasChanged(int,bool)));
    8282    dialog.exec();
    83     disconnect(&dialog, SIGNAL(eventHasChanged(int)), this, SIGNAL(eventHasChanged(int)));
     83    disconnect(&dialog, SIGNAL(eventHasChanged(int,bool)), this, SIGNAL(eventHasChanged(int,bool)));
    8484}
    8585
    86 void TabContainer::updateTreeViewModel(int aEventId)
     86void TabContainer::updateTreeViewModel(int aEventId, bool aReloadModel)
    8787{
    88     static_cast<EventModel*>(treeView->model())->updateModel(aEventId);
     88    if(aReloadModel)
     89    {
     90        // requires special handling
     91        // eg. in case of favourities - some favourities may have changed
     92        // and so we need to reload them
     93        int confId = Conference::activeConference();
     94        QDate startDate = Conference::getById(confId).start();
     95        QDate endDate = Conference::getById(confId).end();
     96        dayNavigator->setDates(startDate, endDate);
     97        updateTreeView( Conference::getById(confId).start() );
     98    }
     99    else
     100    {
     101        // just update event in the question
     102        static_cast<EventModel*>(treeView->model())->updateModel(aEventId);
     103    }
    89104}
    90105
Note: See TracChangeset for help on using the changeset viewer.