|
|
@ -22,8 +22,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "qiomanager.h"
|
|
|
|
#include "qiomanager.h"
|
|
|
|
#include "qiomanager_p.h"
|
|
|
|
#include "qiomanager_p.h"
|
|
|
|
#include <qsocketnotifier.h>
|
|
|
|
#include <tqsocketnotifier.h>
|
|
|
|
#include <qapplication.h>
|
|
|
|
#include <tqapplication.h>
|
|
|
|
#include "debug.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "dispatcher.h"
|
|
|
|
#include "dispatcher.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "thread.h"
|
|
|
@ -66,11 +66,11 @@ static bool qioBlocking;
|
|
|
|
* QIOWatch:
|
|
|
|
* QIOWatch:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
QIOWatch::QIOWatch(int fd, int type, IONotify *notify,
|
|
|
|
QIOWatch::QIOWatch(int fd, int type, IONotify *notify,
|
|
|
|
QSocketNotifier::Type qtype, bool reentrant)
|
|
|
|
TQSocketNotifier::Type qtype, bool reentrant)
|
|
|
|
: _fd(fd), _type(type), _client(notify), _reentrant(reentrant)
|
|
|
|
: _fd(fd), _type(type), _client(notify), _reentrant(reentrant)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
qsocketnotify = new QSocketNotifier(fd,qtype,this);
|
|
|
|
qsocketnotify = new TQSocketNotifier(fd,qtype,this);
|
|
|
|
connect(qsocketnotify,SIGNAL(activated(int)),this,SLOT(notify(int)));
|
|
|
|
connect(qsocketnotify,TQT_SIGNAL(activated(int)),this,TQT_SLOT(notify(int)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QIOWatch::notify(int socket)
|
|
|
|
void QIOWatch::notify(int socket)
|
|
|
@ -80,17 +80,17 @@ void QIOWatch::notify(int socket)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* QTimeWatch:
|
|
|
|
* TQTimeWatch:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
QTimeWatch::QTimeWatch(int milliseconds, TimeNotify *notify)
|
|
|
|
TQTimeWatch::TQTimeWatch(int milliseconds, TimeNotify *notify)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
timer = new QTimer(this);
|
|
|
|
timer = new TQTimer(this);
|
|
|
|
connect( timer, SIGNAL(timeout()), this, SLOT(notify()) );
|
|
|
|
connect( timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(notify()) );
|
|
|
|
timer->start(milliseconds);
|
|
|
|
timer->start(milliseconds);
|
|
|
|
_client = notify;
|
|
|
|
_client = notify;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QTimeWatch::notify()
|
|
|
|
void TQTimeWatch::notify()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
qioManager->dispatch(this);
|
|
|
|
qioManager->dispatch(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -179,19 +179,19 @@ void QIOManager::watchFD(int fd, int types, IONotify *notify)
|
|
|
|
if(types & IOType::read)
|
|
|
|
if(types & IOType::read)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fdList.push_back(
|
|
|
|
fdList.push_back(
|
|
|
|
new QIOWatch(fd, IOType::read, notify, QSocketNotifier::Read, r)
|
|
|
|
new QIOWatch(fd, IOType::read, notify, TQSocketNotifier::Read, r)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(types & IOType::write)
|
|
|
|
if(types & IOType::write)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fdList.push_back(
|
|
|
|
fdList.push_back(
|
|
|
|
new QIOWatch(fd, IOType::write, notify, QSocketNotifier::Write, r)
|
|
|
|
new QIOWatch(fd, IOType::write, notify, TQSocketNotifier::Write, r)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(types & IOType::except)
|
|
|
|
if(types & IOType::except)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fdList.push_back(
|
|
|
|
fdList.push_back(
|
|
|
|
new QIOWatch(fd, IOType::except, notify, QSocketNotifier::Exception,
|
|
|
|
new QIOWatch(fd, IOType::except, notify, TQSocketNotifier::Exception,
|
|
|
|
r)
|
|
|
|
r)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -228,17 +228,17 @@ void QIOManager::addTimer(int milliseconds, TimeNotify *notify)
|
|
|
|
notify = new HandleNotifications();
|
|
|
|
notify = new HandleNotifications();
|
|
|
|
milliseconds = 0;
|
|
|
|
milliseconds = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
timeList.push_back(new QTimeWatch(milliseconds,notify));
|
|
|
|
timeList.push_back(new TQTimeWatch(milliseconds,notify));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QIOManager::removeTimer(TimeNotify *notify)
|
|
|
|
void QIOManager::removeTimer(TimeNotify *notify)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
list<QTimeWatch *>::iterator i;
|
|
|
|
list<TQTimeWatch *>::iterator i;
|
|
|
|
|
|
|
|
|
|
|
|
i = timeList.begin();
|
|
|
|
i = timeList.begin();
|
|
|
|
while(i != timeList.end())
|
|
|
|
while(i != timeList.end())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QTimeWatch *w = *i;
|
|
|
|
TQTimeWatch *w = *i;
|
|
|
|
|
|
|
|
|
|
|
|
if(w->client() == notify)
|
|
|
|
if(w->client() == notify)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -271,7 +271,7 @@ void QIOManager::dispatch(QIOWatch *ioWatch)
|
|
|
|
qioLevel--;
|
|
|
|
qioLevel--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QIOManager::dispatch(QTimeWatch *timeWatch)
|
|
|
|
void QIOManager::dispatch(TQTimeWatch *timeWatch)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
qioLevel++;
|
|
|
|
qioLevel++;
|
|
|
|
if(qioLevel == 1)
|
|
|
|
if(qioLevel == 1)
|
|
|
|