dtkNotification.cpp 915 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
// Version: $Id$
//
//

// Commentary:
//
//

// Change Log:
//
//

// Code:
14 15

#include "dtkNotification.h"
16
#include "dtkNotificationQueue.h"
NICLAUSSE Nicolas's avatar
NICLAUSSE Nicolas committed
17
#include "dtkNotificationEvent.h"
18

19
#include <QtWidgets>
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

void dtkNotify(const QString& message)
{
    dtkNotificationEvent *event = new dtkNotificationEvent;
    event->setType(dtkNotificationEvent::Persistent);
    event->setMessage(message);

    dtkNotify(event);
}

void dtkNotify(const QString& message, int duration)
{
    dtkNotificationEvent *event = new dtkNotificationEvent;
    event->setType(dtkNotificationEvent::NonPersistent);
    event->setMessage(message);
    event->setDuration(duration);

    dtkNotify(event);
}

void dtkNotify(dtkNotificationEvent *event)
{
42
    QApplication::postEvent(dtkNotificationQueue::instance(), event);
43
}
44 45 46 47 48

void dtkClearNotifications(void)
{
    dtkNotificationQueue::instance()->clear();
}
49 50 51

//
// dtkNotification.cpp ends here