#ifndef ALERTDISPATCHER_H #define ALERTDISPATCHER_H #include #include #include #include #include #include class QAlertDispatcher : public QObject { Q_OBJECT Q_DISABLE_COPY(QAlertDispatcher) public: QAlertDispatcher(libtorrent::session *session, QObject* parent); ~QAlertDispatcher(); void getPendingAlertsNoWait(std::deque&); void getPendingAlerts(std::deque&); signals: void alertsReceived(); private: static void dispatch(QSharedPointer >, std::auto_ptr); void enqueueToMainThread(); private slots: void deliverSignal(); private: libtorrent::session *session; QMutex alerts_mutex; QWaitCondition alerts_condvar; std::deque alerts; QSharedPointer > current_tag; bool event_posted; }; #endif // ALERTDISPATCHER_H