]> git.lyx.org Git - features.git/blob - src/frontends/qt4/SocketCallback.h
1c6b4633e3650a3e1cf47669fd949831ca98eed5
[features.git] / src / frontends / qt4 / SocketCallback.h
1 // -*- C++ -*-
2 /**
3  * \file io_callback.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author John Levon
9  * \author João Luis M. Assirati
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef SOCKET_CALLBACK_H
15 #define SOCKET_CALLBACK_H
16
17 #include <QObject>
18 #include <QSocketNotifier>
19
20 #include <boost/function.hpp>
21
22
23 namespace lyx {
24
25 /**
26  * socket_callback - a simple wrapper for asynchronous socket notification
27  *
28  * This is used by the lyxsocket to notice the socket is ready to be
29  * connected/read.
30  *
31  * FIXME: this code apparently will not work on Windows.
32  */
33
34 class SocketCallback : public QObject
35 {
36         Q_OBJECT
37
38 public:
39         /// connect a connection notification from the LyXServerSocket
40         SocketCallback(QObject * parent, int fd, boost::function<void()> func);
41
42 public Q_SLOTS:
43         void dataReceived();
44
45 private:
46         /// Our notifier
47         QSocketNotifier * sn_;
48         /// The callback function
49         boost::function<void()> func_;
50 };
51
52
53 } // namespace lyx
54
55 #endif // SOCKET_CALLBACK_H