diff options
author | Thomas Preud'homme <robotux@celest.fr> | 2013-01-04 14:50:19 +0100 |
---|---|---|
committer | Thomas Preud'homme <robotux@celest.fr> | 2013-01-04 14:50:19 +0100 |
commit | 8f9f382e1c97cab2e72e97495650c73ac4b97314 (patch) | |
tree | 78510a0d81368c09b56f444fb19bb132c8bc3009 /LocalListener.h |
Imported Upstream version 0.3.0.5
Diffstat (limited to 'LocalListener.h')
-rw-r--r-- | LocalListener.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/LocalListener.h b/LocalListener.h new file mode 100644 index 0000000..50905a9 --- /dev/null +++ b/LocalListener.h @@ -0,0 +1,65 @@ +/** \file LocalListener.h +\brief The have local server, to have unique instance, and send arguments to the current running instance +\author alpha_one_x86 +\version 0.3 +\date 2010 +\licence GPL3, see the file COPYING */ + +#ifndef LOCALLISTENER_H +#define LOCALLISTENER_H + +#include <QObject> +#include <QLocalServer> +#include <QLocalSocket> +#include <QStringList> +#include <QString> +#include <QCoreApplication> +#include <QFSFileEngine> +#include <QMessageBox> +#include <QTimer> +#include <QList> + +#include "Environment.h" +#include "ExtraSocket.h" + +/** \brief To have unique instance, and pass arguments to the existing instance if needed */ +class LocalListener : public QObject +{ + Q_OBJECT +public: + explicit LocalListener(QObject *parent = 0); + ~LocalListener(); +public slots: + /// try connect to existing server + bool tryConnect(); + /// the listen server + void listenServer(); +private: + QLocalServer localServer; + QTimer TimeOutQLocalSocket; + typedef struct { + QLocalSocket * socket; + QByteArray data; + int size; + bool haveData; + } composedData; + QList<composedData> clientList; +private slots: + //the time is done + void timeoutDectected(); + /// \brief Data is incomming + void dataIncomming(); + /// \brief Deconnexion client + void deconnectClient(); + /// LocalListener New connexion + void newConnexion(); + #ifdef ULTRACOPIER_DEBUG + /** \brief If error occured at socket + \param theErrorDefine The error define */ + void error(QLocalSocket::LocalSocketError theErrorDefine); + #endif +signals: + void cli(const QStringList &ultracopierArguments,const bool &external); +}; + +#endif // LOCALLISTENER_H |