TQt port avahi-tqt

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/avahi-tqt@1258013 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru v3.5.13
tpearson 13 years ago
parent 1e8b0cadbd
commit 0cddf92b0d

@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
AM_CFLAGS=-I$(top_srcdir)
AM_CFLAGS=-I$(top_srcdir) -I/usr/include/tqt
lib_LTLIBRARIES =
BUILT_SOURCES =

@ -18,21 +18,16 @@
***/
#include <sys/time.h>
#ifdef QT4
#include <Qt/qsocketnotifier.h>
#include <Qt/qobject.h>
#include <Qt/qtimer.h>
#else
#include <qsocketnotifier.h>
#include <qobject.h>
#include <qtimer.h>
#endif
#include <tqsocketnotifier.h>
#include <tqobject.h>
#include <tqtimer.h>
#include <avahi-common/timeval.h>
#include "qt-watch.h"
class AvahiWatch : public QObject
class AvahiWatch : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
AvahiWatch(int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void* userdata);
~AvahiWatch() {}
@ -44,8 +39,8 @@ private slots:
void gotOut();
private:
QSocketNotifier* m_in;
QSocketNotifier* m_out;
TQSocketNotifier* m_in;
TQSocketNotifier* m_out;
//FIXME: ERR and HUP?
AvahiWatchCallback m_callback;
AvahiWatchEvent m_lastEvent;
@ -54,9 +49,10 @@ private:
bool m_incallback;
};
class AvahiTimeout : public QObject
class AvahiTimeout : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
AvahiTimeout(const struct timeval* tv, AvahiTimeoutCallback callback, void* userdata);
@ -67,7 +63,7 @@ private slots:
void timeout();
private:
QTimer m_timer;
TQTimer m_timer;
AvahiTimeoutCallback m_callback;
void* m_userdata;
};
@ -101,22 +97,19 @@ void AvahiWatch::setWatchedEvents(AvahiWatchEvent event)
if (!(event & AVAHI_WATCH_IN)) { delete m_in; m_in=0; }
if (!(event & AVAHI_WATCH_OUT)) { delete m_out; m_out=0; }
if (event & AVAHI_WATCH_IN) {
m_in = new QSocketNotifier(m_fd,QSocketNotifier::Read, this);
connect(m_in,SIGNAL(activated(int)),SLOT(gotIn()));
m_in = new TQSocketNotifier(m_fd,TQSocketNotifier::Read, this);
connect(m_in,TQT_SIGNAL(activated(int)),TQT_SLOT(gotIn()));
}
if (event & AVAHI_WATCH_OUT) {
m_out = new QSocketNotifier(m_fd,QSocketNotifier::Write, this);
connect(m_out,SIGNAL(activated(int)),SLOT(gotOut()));
m_out = new TQSocketNotifier(m_fd,TQSocketNotifier::Write, this);
connect(m_out,TQT_SIGNAL(activated(int)),TQT_SLOT(gotOut()));
}
}
AvahiTimeout::AvahiTimeout(const struct timeval* tv, AvahiTimeoutCallback callback, void *userdata) :
m_callback(callback), m_userdata(userdata)
{
connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
#ifdef QT4
m_timer.setSingleShot(true);
#endif
connect(&m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout()));
update(tv);
}
@ -125,11 +118,7 @@ void AvahiTimeout::update(const struct timeval *tv)
m_timer.stop();
if (tv) {
AvahiUsec u = avahi_age(tv)/1000;
#ifdef QT4
m_timer.start( (u>0) ? 0 : -u);
#else
m_timer.start( (u>0) ? 0 : -u,true);
#endif
}
}
@ -191,8 +180,4 @@ const AvahiPoll* avahi_qt_poll_get(void)
return &qt_poll;
}
#ifdef QT4
#include "qt-watch.moc4"
#else
#include "qt-watch.moc3"
#endif

@ -1,5 +1,5 @@
#ifndef QAVAHI_H
#define QAVAHI_H
#ifndef TQAVAHI_H
#define TQAVAHI_H
/***
This file is part of avahi.
@ -20,13 +20,13 @@
USA.
***/
/** \file qt-watch.h Qt main loop adapter */
/** \file qt-watch.h TQt main loop adapter */
#include <avahi-common/watch.h>
AVAHI_C_DECL_BEGIN
/** Setup abstract poll structure for integration with Qt main loop */
/** Setup abstract poll structure for integration with TQt main loop */
const AvahiPoll* avahi_qt_poll_get(void)
#ifdef HAVE_VISIBILITY_HIDDEN
__attribute__ ((visibility("default")))

Loading…
Cancel
Save