blob: a0fbee11178d328ba75f616761f3c329a2d84e35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/** \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"
#include "GlobalClass.h"
/** \brief To have unique instance, and pass arguments to the existing instance if needed */
class LocalListener : public QObject, public GlobalClass
{
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
/// \can now parse the cli
void allPluginIsloaded();
signals:
void cli(const QStringList &ultracopierArguments,const bool &external,const bool &onlyCheck);
};
#endif // LOCALLISTENER_H
|