2011-02-18 22:53:06 -05:00
|
|
|
#include <QObject>
|
2011-02-25 23:29:36 -05:00
|
|
|
#include <QStringList>
|
2011-02-18 22:53:06 -05:00
|
|
|
|
|
|
|
class QTcpSocket;
|
|
|
|
class WebPage;
|
|
|
|
class Command;
|
2011-05-05 17:45:44 -04:00
|
|
|
class Response;
|
2011-02-18 22:53:06 -05:00
|
|
|
|
|
|
|
class Connection : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Connection(QTcpSocket *socket, WebPage *page, QObject *parent = 0);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void checkNext();
|
2011-05-05 17:45:44 -04:00
|
|
|
void finishCommand(Response *response);
|
2011-03-09 00:08:30 -05:00
|
|
|
void pendingLoadFinished(bool success);
|
2011-02-18 22:53:06 -05:00
|
|
|
|
|
|
|
private:
|
2011-02-26 13:38:10 -05:00
|
|
|
void readLine();
|
|
|
|
void readDataBlock();
|
|
|
|
void processNext(const char *line);
|
2011-02-25 23:29:36 -05:00
|
|
|
Command *createCommand(const char *name);
|
2011-03-09 00:08:30 -05:00
|
|
|
void processArgument(const char *line);
|
2011-02-25 23:29:36 -05:00
|
|
|
void startCommand();
|
2011-05-05 17:45:44 -04:00
|
|
|
void writeResponse(Response *response);
|
2011-02-18 22:53:06 -05:00
|
|
|
|
|
|
|
QTcpSocket *m_socket;
|
2011-03-09 00:08:30 -05:00
|
|
|
QString m_commandName;
|
2011-02-18 22:53:06 -05:00
|
|
|
Command *m_command;
|
2011-02-25 23:29:36 -05:00
|
|
|
QStringList m_arguments;
|
|
|
|
int m_argumentsExpected;
|
2011-02-18 22:53:06 -05:00
|
|
|
WebPage *m_page;
|
2011-02-26 13:38:10 -05:00
|
|
|
int m_expectingDataSize;
|
2011-05-05 18:27:04 -04:00
|
|
|
bool m_pageSuccess;
|
|
|
|
bool m_commandWaiting;
|
2011-02-18 22:53:06 -05:00
|
|
|
};
|
|
|
|
|