Ignore:
Timestamp:
01/20/17 21:46:55 (5 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
ec7fa22
Parents:
ea8416e
Message:

Event favourite is now tristate in the code now and the corresponding buttons are tristate as well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/eventdialog.cpp

    rea8416e r7b3cd0e  
    8989    connect(alarmButton, SIGNAL(clicked()), SLOT(alarmClicked()));
    9090
    91     if(event.isFavourite())
    92     {
    93         favouriteButton->setIcon(QIcon(":/icons/favourite-on.png"));
    94     }
     91    updateFavouriteButton(event);
    9592
    9693    if(event.hasAlarm())
     
    103100{
    104101    Event event = Event::getById(mEventId, mConferenceId);
     102    event.cycleFavourite();
     103    event.update("favourite");
     104    updateFavouriteButton(event);
    105105
     106    // 'conflicts' list may have changed
    106107    QList<Event> conflicts = Event::conflictEvents(event.id(), mConferenceId);
    107     if(event.isFavourite())
    108     {
    109         event.setFavourite(false);
    110         favouriteButton->setIcon(QIcon(":/icons/favourite-off.png"));
    111     }
    112     else
    113     {
    114         event.setFavourite(true);
    115         favouriteButton->setIcon(QIcon(":/icons/favourite-on.png"));
    116     }
    117     event.update("favourite");
    118 
    119     if(event.isFavourite())
    120     {
    121         // event has became 'favourite' and so 'conflicts' list may have changed
    122         conflicts = Event::conflictEvents(event.id(), mConferenceId);
    123     }
    124108
    125109    // have to emit 'eventChanged' signal on all events in conflict
     
    163147}
    164148
     149
     150void EventDialog::updateFavouriteButton(const Event& event) {
     151    switch (event.favourite()) {
     152        case Favourite_no: favouriteButton->setIcon(QIcon(":/icons/favourite-off.png")); break;
     153        case Favourite_weak: favouriteButton->setIcon(QIcon(":/icons/favourite-weak.png")); break;
     154        case Favourite_strong: favouriteButton->setIcon(QIcon(":/icons/favourite-on.png")); break;
     155    }
     156}
     157
Note: See TracChangeset for help on using the changeset viewer.