Changeset 54a377c


Ignore:
Timestamp:
04/02/13 23:28:06 (9 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
b261e79
Parents:
cdf0332
Message:

Prepared to show an alarm message via tray icon on non-MAEMO systems.

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/gui/eventdialog.cpp

    rcdf0332 r54a377c  
    3232#ifdef MAEMO
    3333    showFullScreen();
    34 #else
    35     alarmButton->hide();
    3634#endif
    3735
  • src/gui/mainwindow.cpp

    rcdf0332 r54a377c  
    6464    mXmlParser = new ScheduleXmlParser(sqlEngine, this);
    6565    mNetworkAccessManager = new QNetworkAccessManager(this);
    66 
     66    systemTrayIcon = new QSystemTrayIcon(qApp->windowIcon(), this);
     67    alarmTimer = new QTimer(this);
     68
     69    alarmTimer->setInterval(60000);
     70    alarmTimer->start();
    6771    saved_title = windowTitle();
    6872
     
    101105    connect(searchTabContainer, SIGNAL(searchResultChanged()), SLOT(onSearchResultChanged()));
    102106
     107    // systm tray icon
     108    connect(systemTrayIcon, SIGNAL(messageClicked()), SLOT(onSystemTrayMessageClicked()));
     109
     110    // timer
     111    connect(alarmTimer, SIGNAL(timeout()), SLOT(onAlarmTimerTimeout()));
    103112
    104113    useConference(Conference::activeConference());
     
    115124    connect(mXmlParser, SIGNAL(parsingScheduleEnd(int)), conferenceModel, SLOT(newConferenceEnd(int)));
    116125}
     126
    117127
    118128void MainWindow::on_aboutAction_triggered()
     
    204214    // No results were found
    205215    searchTabContainer->redisplayDate(dayNavigator->curDate());
     216}
     217
     218
     219void MainWindow::onSystemTrayMessageClicked() {
     220    // TODO: Hide icon
     221}
     222
     223
     224void MainWindow::onAlarmTimerTimeout() {
     225    // TODO: Show Message if an alarm is set on an event that's starting soon and delete the corresponding alarm.
     226    /* Example:
     227    systemTrayIcon->show();
     228    systemTrayIcon->showMessage("title", "message", QSystemTrayIcon::Information, 1000);
     229    QApplication::alert(this);
     230    QApplication::beep();
     231    */
    206232}
    207233
  • src/gui/mainwindow.h

    rcdf0332 r54a377c  
    5050    void onEventChanged(int aEventId, bool favouriteChanged);
    5151    void onSearchResultChanged();
     52
    5253    // TODO: remove
    5354    void networkQueryFinished(QNetworkReply*);
     
    5657    void removeConference(int);
    5758    void changeConferenceUrl(int, const QString&);
     59    void onSystemTrayMessageClicked();
     60    void onAlarmTimerTimeout();
    5861
    5962    void useConference(int conferenceId);
     
    7275    ScheduleXmlParser *mXmlParser;
    7376    QNetworkAccessManager *mNetworkAccessManager;
     77    QSystemTrayIcon* systemTrayIcon; ///< to be able to show notifications
     78    QTimer* alarmTimer; ///< timer that triggers every minute to be able to show alarms
    7479};
    7580
  • src/mvc/delegate.cpp

    rcdf0332 r54a377c  
    110110        else
    111111            mControls[FavouriteControlOff]->paint(painter, option.rect);
    112 #ifdef MAEMO
     112
    113113        if(event->hasAlarm())
    114114            mControls[AlarmControlOn]->paint(painter, option.rect);
    115115        else
    116116            mControls[AlarmControlOff]->paint(painter, option.rect);
    117 #endif
     117
    118118        if(event->hasTimeConflict())
    119119            mControls[WarningControl]->paint(painter, option.rect);
     
    164164    {
    165165        int numFav = numberOfFavourities(index);
    166 #ifdef MAEMO
    167166        int numAlarm = numberOfAlarms(index);
    168 #endif
    169167
    170168        QStyleOptionButton styleOptionButton;
     
    200198        painter->drawText(drawPoint+QPoint(image->width()+2, image->height() - 2),
    201199                QString::number(numFav));
    202 #ifdef MAEMO
     200
    203201        drawPoint.setX(drawPoint.x() - spacer - image->width());
    204202        image = mControls[numAlarm ? AlarmControlOn : AlarmControlOff]->image();
     
    206204        painter->drawText(drawPoint+QPoint(image->width()+2, image->height() - 2),
    207205                QString::number(numAlarm));
    208 #endif
     206
    209207        // draw texts
    210208        QString numEvents = QString::number(index.model()->rowCount(index)).append("/");
     
    314312    mControls.insert(FavouriteControlOff, new Control(FavouriteControlOff, QString(":icons/favourite-off.png"), NULL));
    315313
    316 #ifdef MAEMO
    317314    // ALARM ICONs
    318315    // on
     
    325322    mControls.insert(WarningControl,
    326323                    new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[AlarmControlOff]));
    327 #else
    328     // WARNING ICON
    329     mControls.insert(WarningControl,
    330                     new Control(WarningControl, QString(":icons/dialog-warning.png"), mControls[FavouriteControlOn]));
    331 #endif
    332 
    333 }
     324        }
    334325
    335326bool Delegate::isPointFromRect(const QPoint &aPoint, const QRect &aRect) const
Note: See TracChangeset for help on using the changeset viewer.