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