X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-qt%2Fqt-watch.cpp;h=c0b21402348722b742cbc74563fac4d444a214b0;hb=8185ec8431c51946095d3f11e80545e3519f67cf;hp=407a9055a972c8f072d17202f404e62426a62e20;hpb=520f6eb0e117cc9010a307cf1ec9237188e663ee;p=catta diff --git a/avahi-qt/qt-watch.cpp b/avahi-qt/qt-watch.cpp index 407a905..c0b2140 100644 --- a/avahi-qt/qt-watch.cpp +++ b/avahi-qt/qt-watch.cpp @@ -1,3 +1,5 @@ +/* $Id$ */ + /*** This file is part of avahi. @@ -113,6 +115,9 @@ AvahiTimeout::AvahiTimeout(const struct timeval* tv, AvahiTimeoutCallback callba m_callback(callback), m_userdata(userdata) { connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout())); +#ifdef QT4 + m_timer.setSingleShot(true); +#endif update(tv); } @@ -122,7 +127,11 @@ void AvahiTimeout::update(const struct timeval *tv) if (tv) { struct timeval now; gettimeofday(&now, 0); +#ifdef QT4 m_timer.start((tv->tv_sec-now.tv_sec)*1000+(tv->tv_usec-now.tv_usec)/1000); +#else + m_timer.start((tv->tv_sec-now.tv_sec)*1000+(tv->tv_usec-now.tv_usec)/1000,true); +#endif } } @@ -170,7 +179,7 @@ static void q_timeout_free(AvahiTimeout *t) static AvahiPoll qt_poll; -const AvahiPoll* avahi_qt_poll_get() +const AvahiPoll* avahi_qt_poll_get(void) { qt_poll.userdata=0; qt_poll.watch_new = q_watch_new; @@ -184,4 +193,8 @@ const AvahiPoll* avahi_qt_poll_get() return &qt_poll; } -#include "qt-watch.moc" +#ifdef QT4 +#include "qt-watch.moc4" +#else +#include "qt-watch.moc3" +#endif