mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
remove_io_callback for Qt
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4813 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
18d401aab8
commit
1faca4e07e
@ -1,3 +1,9 @@
|
||||
2002-07-31 John Levon <levon@movementarian.org>
|
||||
|
||||
* io_callback.h: make a more proper class
|
||||
|
||||
* lyx_gui.C: implement removal of I/O callbacks
|
||||
|
||||
2002-07-30 John Levon <levon@movementarian.org>
|
||||
|
||||
* qlkey.h:
|
||||
|
@ -13,9 +13,12 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "lyxserver.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <qsocketnotifier.h>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
/**
|
||||
* io_callback - a simple wrapper for asynchronous pipe notification
|
||||
*
|
||||
@ -30,17 +33,19 @@ public:
|
||||
/// connect a read ready notification for fd to the LyXComm
|
||||
io_callback(int fd, LyXComm * comm)
|
||||
: comm_(comm) {
|
||||
QSocketNotifier * sn = new QSocketNotifier(fd,
|
||||
QSocketNotifier::Read, this);
|
||||
connect(sn, SIGNAL(activated(int)), this, SLOT(data_received()));
|
||||
sn_.reset(new QSocketNotifier(fd, QSocketNotifier::Read, this));
|
||||
connect(sn_.get(), SIGNAL(activated(int)), this, SLOT(data_received()));
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
void data_received() {
|
||||
comm_->read_ready();
|
||||
}
|
||||
|
||||
private:
|
||||
/// our notifier
|
||||
boost::scoped_ptr<QSocketNotifier> sn_;
|
||||
|
||||
LyXComm * comm_;
|
||||
};
|
||||
|
||||
|
@ -47,7 +47,7 @@ using std::exit;
|
||||
#endif
|
||||
|
||||
using std::vector;
|
||||
using std::hex;
|
||||
using std::map;
|
||||
using std::endl;
|
||||
|
||||
extern BufferList bufferlist;
|
||||
@ -147,9 +147,23 @@ bool lyx_gui::font_available(LyXFont const & font)
|
||||
return fontloader.available(font);
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
map<int, io_callback *> io_callbacks;
|
||||
}
|
||||
|
||||
|
||||
void lyx_gui::set_read_callback(int fd, LyXComm * comm)
|
||||
{
|
||||
// FIXME: "leak"
|
||||
new io_callback(fd, comm);
|
||||
io_callbacks[fd] = new io_callback(fd, comm);
|
||||
}
|
||||
|
||||
|
||||
void lyx_gui::remove_read_callback(int fd)
|
||||
{
|
||||
map<int, io_callback *>::iterator it = io_callbacks.find(fd);
|
||||
if (it != io_callbacks.end()) {
|
||||
delete it->second;
|
||||
io_callbacks.erase(it);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user