Changeset 872aeaa


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
Location:
src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • src/gui/eventdialog.cpp

    reb21333 r872aeaa  
    6767    qDebug() << " FAVOURITE [" << event.id() << "] -> " << event.isFavourite();
    6868
    69     // since the Favourite icon has changed, update TreeViews accordingly
    70     // all TreeViews have to listen on this signal
    71     emit(eventHasChanged(event.id()));
    72 
    7369    // have to emit 'eventHasChanged' signal on all events in conflict
    7470    for(int i=0; i<conflicts.count(); i++)
    7571        emit(eventHasChanged(conflicts[i].id()));
     72
     73    // since the Favourite icon has changed, update TreeViews accordingly
     74    // all TreeViews have to listen on this signal
     75    emit(eventHasChanged(event.id(),true));
    7676}
    7777
  • src/gui/eventdialog.h

    reb21333 r872aeaa  
    1616    void alarmClicked();
    1717signals:
    18     void eventHasChanged(int aEventId); // emited when user changes some event details, eg. sets it Favourite
     18    void eventHasChanged(int aEventId, bool aReloadModel = false); // emited when user changes some event details, eg. sets it Favourite
    1919private:
    2020    int mEventId;
  • src/gui/favtabcontainer.cpp

    reb21333 r872aeaa  
    1111}
    1212
    13 void FavTabContainer::updateTreeViewModel(int aEventId)
    14 {
    15     Q_UNUSED(aEventId);
    16 
    17     // requires special handling
    18     // we need to reload favourites, because some favourite could be deleted
    19     //static_cast<EventModel*>(favTreeView->model())->updateModel(aEventId);
    20     int confId = Conference::activeConference();
    21     QDate startDate = Conference::getById(confId).start();
    22     QDate endDate = Conference::getById(confId).end();
    23     dayNavigator->setDates(startDate, endDate);
    24     updateTreeView( Conference::getById(confId).start() );
    25 }
    26 
  • src/gui/favtabcontainer.h

    reb21333 r872aeaa  
    1212    virtual ~FavTabContainer(){}
    1313
    14 public slots:
    15     virtual void updateTreeViewModel(int aEventId);
    16 
    1714protected:
    1815    virtual void loadEvents( const QDate &aDate, const int aConferenceId );
  • src/gui/mainwindow.cpp

    reb21333 r872aeaa  
    3232
    3333    // event details have changed
    34     connect(dayTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    35     connect(favsTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    36     connect(tracksTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    37     connect(roomsTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    38     connect(nowTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
    39     connect(searchTabContainer, SIGNAL(eventHasChanged(int)), SLOT(eventHasChanged(int)));
     34    connect(dayTabContainer, SIGNAL(eventHasChanged(int,bool)), SLOT(eventHasChanged(int,bool)));
     35    connect(favsTabContainer, SIGNAL(eventHasChanged(int,bool)), SLOT(eventHasChanged(int,bool)));
     36    connect(tracksTabContainer, SIGNAL(eventHasChanged(int,bool)), SLOT(eventHasChanged(int,bool)));
     37    connect(roomsTabContainer, SIGNAL(eventHasChanged(int,bool)), SLOT(eventHasChanged(int,bool)));
     38    connect(nowTabContainer, SIGNAL(eventHasChanged(int,bool)), SLOT(eventHasChanged(int,bool)));
     39    connect(searchTabContainer, SIGNAL(eventHasChanged(int,bool)), SLOT(eventHasChanged(int,bool)));
    4040
    4141    // event conference map button clicked
     
    105105}
    106106
    107 void MainWindow::eventHasChanged(int aEventId)
     107void MainWindow::eventHasChanged(int aEventId, bool aReloadModel)
    108108{
    109109    dayTabContainer->updateTreeViewModel(aEventId);
    110     favsTabContainer->updateTreeViewModel(aEventId);
     110    favsTabContainer->updateTreeViewModel(aEventId,aReloadModel);
    111111    tracksTabContainer->updateTreeViewModel(aEventId);
    112112    nowTabContainer->updateTreeViewModel(aEventId);
     
    138138    tracksTabContainer->setDates(startDate, endDate);
    139139    roomsTabContainer->setDates(startDate, endDate);
    140     //favsTabContainer->setDates(startDate, endDate);
    141     //searchTabContainer->setDates(startDate, endDate);
     140    favsTabContainer->setDates(startDate, endDate);
     141    searchTabContainer->setDates(startDate, endDate);
    142142    searchTabContainer->searchAgainClicked();
    143143    nowTabContainer->updateTreeView(QDate::currentDate());
  • src/gui/mainwindow.h

    reb21333 r872aeaa  
    1818    void aboutApp();
    1919    void conferenceMapClicked();
    20     void eventHasChanged(int aEventId);
     20    void eventHasChanged(int aEventId, bool aReloadModel);
    2121private:
    2222    void fillAndShowConferenceHeader();
  • 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
  • src/gui/tabcontainer.h

    reb21333 r872aeaa  
    2626
    2727signals:
    28     void eventHasChanged(int aEventId);
     28    void eventHasChanged(int aEventId, bool aReloadModel);
    2929
    3030public slots:
    31     virtual void updateTreeViewModel(int aEventId);
     31    virtual void updateTreeViewModel(int aEventId, bool aReloadModel = false);
    3232    void setDates(const QDate &aStart, const QDate &aEnd);
    3333
  • src/mvc/treeview.cpp

    reb21333 r872aeaa  
    6565                }
    6666
    67                 // since the Favourite icon has changed, update TreeViews accordingly
    68                 // all TreeViews have to listen on this signal
    69                 emit(eventHasChanged(event.id()));
    70 
    7167                // have to emit 'eventHasChanged' signal on all events in conflict
    7268                for(int i=0; i<conflicts.count(); i++)
    7369                    emit(eventHasChanged(conflicts[i].id()));
     70               
     71                // since the Favourite icon has changed, update TreeViews accordingly
     72                // all TreeViews have to listen on this signal
     73                emit(eventHasChanged(event.id(),true));
    7474
    7575                handled = true;
  • src/mvc/treeview.h

    reb21333 r872aeaa  
    2020    void requestForMap(const QModelIndex &aIndex);
    2121    void requestForConflicts(const QModelIndex &aIndex);
    22     void eventHasChanged(int aEventId); // emited when user changes some event details, eg. sets it Favourite
     22    void eventHasChanged(int aEventId, bool aReloadModel = false); // emited when user changes some event details, eg. sets it Favourite
    2323};
    2424
Note: See TracChangeset for help on using the changeset viewer.