#ifndef CLIENT_H
#define CLIENT_H
#include <QTcpSocket>
#include <QMap>
#include <QMapIterator>
#include <QObject>
#include <QDataStream>
#include <QMessageBox>
#include <QListWidgetItem>
#include <QTextStream>
#include "question_item.h"
class MainWindow;
class Client : public QObject
{
Q_OBJECT
private:
void init(MainWindow *);
public:
Client(MainWindow *, QString, int = 0);
Client(MainWindow *, QTcpSocket *, int = 0);
virtual ~Client();
public slots:
void setName(QString); QString name();
void setNumber(int); int number();
void setSocket(QTcpSocket *); QTcpSocket * socket();
float score(); float maximumScore();
bool isReady();
QMap<QString, QuestionAnswer> * results();
void setPassed(bool); bool passed();
void loadResults(QString);
void readClientFeedback();
bool isIdentified();
void displayError(QAbstractSocket::SocketError);
void socketDisconnected();
signals:
void identified(Client *);
void finished(Client *);
void resultsLoaded(Client *);
void disconnected(Client *);
private:
QString c_name;
QTcpSocket * c_socket;
float c_score;
float c_maxscore;
bool c_ready;
QMap<QString, QuestionAnswer> * c_results;
bool c_passed;
quint64 c_blocksize;
bool c_identified;
MainWindow * c_parent;
int c_number;
bool c_test_sent;
};
#endif