QTfrontend/util/frontlibpoller.cpp
author unc0rr
Wed, 05 Dec 2012 23:55:22 +0400
branchflibqtfrontend
changeset 8233 d3966a555e5e
parent 8100 0e6fadf81a2c
permissions -rw-r--r--
Show others if spectator is in game
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     1
#include <QTimerEvent>
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     2
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     3
#include "frontlibpoller.h"
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     4
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     5
FrontLibPoller::FrontLibPoller(void (*poll)(void * data), void *data, QObject *parent) :
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     6
    QObject(parent)
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     7
{
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     8
    m_poll = poll;
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
     9
    m_data = data;
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    10
8100
0e6fadf81a2c - frontlib loads team config via physfs
unc0rr
parents: 8092
diff changeset
    11
    if(m_data)
0e6fadf81a2c - frontlib loads team config via physfs
unc0rr
parents: 8092
diff changeset
    12
        m_timer.start(50, this);
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    13
}
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    14
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    15
void FrontLibPoller::timerEvent(QTimerEvent *event)
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    16
{
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    17
    if(event->timerId() == m_timer.timerId())
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    18
        m_poll(m_data);
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    19
    else
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    20
        QObject::timerEvent(event);
08960209db8c Try to use map preview facilities:
unc0rr
parents:
diff changeset
    21
}