DrCute
Défi DVP 2
client.h
Go to the documentation of this file.
00001 #ifndef CLIENT_H
00002 #define CLIENT_H
00003 
00004 #include <QTcpSocket>
00005 #include <QImage>
00006 #include "imageprovider.h"
00007 #include "config.h"
00008 
00009 QT_BEGIN_NAMESPACE
00010 class QTcpSocket;
00011 class QNetworkSession;
00012 class QHostAddress;
00013 class QSettings;
00014 QT_END_NAMESPACE
00015 
00016 class Client : public Config
00017 {
00018     Q_OBJECT
00019 
00020 public:
00021     Client(QObject *parent = 0);
00022     QImage clientImage;
00023     ImageProvider imageProvider;
00024 //    Config config;
00025 
00026     Q_INVOKABLE QImage getImage() const {
00027         return clientImage;
00028     }
00029 
00030 signals:
00031     void imageAvailable();
00032 
00033 public slots:
00034     void sendString(const QString &msg);
00035     void interpretCommandAndSendMessage(const QString &msg);
00036     void sendMessage(const QString &cmd, const QStringList &msgList);
00037     void startTransfer();
00038     void setRootObject(QObject *object);
00039     void addPatient(QString idNumber, QString title, QString firstName, QString lastName);
00040     void addDoctor(QString idNumber, QString title, QString firstName, QString lastName);
00041     void clearPatients();
00042     void clearDoctors();
00043 
00044 private slots:
00045     void readNextItem();
00046     void readString();
00047     void readStringList();
00048     void readImage();
00049     void displayError(QAbstractSocket::SocketError socketError);
00050     void sessionOpened();
00051 
00052 
00053 private:
00054     void interpretAnswer(const QString uniqueId, const QString &cmd, const QStringList &msgList);
00055     QTcpSocket *tcpSocket;
00056     quint16 blockSize;
00057     QByteArray block;
00058     bool nextConnexionIsAnImage;
00059 
00060     QNetworkSession *networkSession;
00061     QObject *rootObject;
00062 };
00063 
00064 #endif // CLIENT_H
 All Classes Files Functions Variables