-rw-r--r-- | x11/ipc/client/ocopclient.cpp | 9 | ||||
-rw-r--r-- | x11/ipc/client/ocopclient.h | 7 |
2 files changed, 15 insertions, 1 deletions
diff --git a/x11/ipc/client/ocopclient.cpp b/x11/ipc/client/ocopclient.cpp index c1def73..6085481 100644 --- a/x11/ipc/client/ocopclient.cpp +++ b/x11/ipc/client/ocopclient.cpp | |||
@@ -11,12 +11,21 @@ | |||
11 | #include <qtimer.h> | 11 | #include <qtimer.h> |
12 | 12 | ||
13 | #include "../common/ocoppacket.h" | 13 | #include "../common/ocoppacket.h" |
14 | 14 | ||
15 | #include "ocopclient.h" | 15 | #include "ocopclient.h" |
16 | 16 | ||
17 | OCOPClient* OCOPClient::m_self = 0; | ||
18 | |||
19 | OCOPClient* OCOPClient::self() { | ||
20 | if (!m_self ) { | ||
21 | m_self = new OCOPClient(); | ||
22 | } | ||
23 | return m_self; | ||
24 | } | ||
25 | |||
17 | OCOPClient::OCOPClient( const QString& path, QObject* obj ) | 26 | OCOPClient::OCOPClient( const QString& path, QObject* obj ) |
18 | : QObject( obj ) | 27 | : QObject( obj ) |
19 | { | 28 | { |
20 | m_tries = 0; | 29 | m_tries = 0; |
21 | init(QFile::encodeName(path) ); | 30 | init(QFile::encodeName(path) ); |
22 | } | 31 | } |
diff --git a/x11/ipc/client/ocopclient.h b/x11/ipc/client/ocopclient.h index 53018a5..ee2015a 100644 --- a/x11/ipc/client/ocopclient.h +++ b/x11/ipc/client/ocopclient.h | |||
@@ -17,13 +17,17 @@ | |||
17 | * calling and receiving calls | 17 | * calling and receiving calls |
18 | */ | 18 | */ |
19 | class OCOPPacket; | 19 | class OCOPPacket; |
20 | class OCOPClient : public QObject{ | 20 | class OCOPClient : public QObject{ |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | public: | 22 | public: |
23 | 23 | /* | |
24 | * this is the static | ||
25 | * OCopClient | ||
26 | */ | ||
27 | static OCOPClient* self(); | ||
24 | /** | 28 | /** |
25 | * Occasionally I decide to start a Server from here | 29 | * Occasionally I decide to start a Server from here |
26 | */ | 30 | */ |
27 | OCOPClient(const QString& pathToServer = QString::null, QObject* obj = 0l); | 31 | OCOPClient(const QString& pathToServer = QString::null, QObject* obj = 0l); |
28 | ~OCOPClient(); | 32 | ~OCOPClient(); |
29 | 33 | ||
@@ -53,9 +57,10 @@ private: | |||
53 | void call( const OCOPPacket& ); | 57 | void call( const OCOPPacket& ); |
54 | 58 | ||
55 | QSocketNotifier* m_notify; | 59 | QSocketNotifier* m_notify; |
56 | int m_socket; | 60 | int m_socket; |
57 | int m_tries; | 61 | int m_tries; |
58 | 62 | ||
63 | static OCOPClient* m_self; | ||
59 | }; | 64 | }; |
60 | 65 | ||
61 | #endif | 66 | #endif |