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-10-14 11:22:24 -04:00
|
|
|
class CommandParser;
|
|
|
|
class CommandFactory;
|
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:
|
2011-10-14 11:22:24 -04:00
|
|
|
void commandReady(QString commandName, QStringList arguments);
|
2011-05-05 17:45:44 -04:00
|
|
|
void finishCommand(Response *response);
|
2011-03-09 00:08:30 -05:00
|
|
|
void pendingLoadFinished(bool success);
|
2012-01-31 16:57:57 -05:00
|
|
|
void pageLoadingFromCommand();
|
2011-02-18 22:53:06 -05:00
|
|
|
|
|
|
|
private:
|
2011-02-25 23:29:36 -05:00
|
|
|
void startCommand();
|
2011-05-05 17:45:44 -04:00
|
|
|
void writeResponse(Response *response);
|
2012-03-21 19:11:50 -04:00
|
|
|
void writePageLoadFailure();
|
2011-02-18 22:53:06 -05:00
|
|
|
|
|
|
|
QTcpSocket *m_socket;
|
2012-03-21 18:56:01 -04:00
|
|
|
Command *m_runningCommand;
|
|
|
|
Command *m_queuedCommand;
|
2011-02-18 22:53:06 -05:00
|
|
|
WebPage *m_page;
|
2011-10-14 11:22:24 -04:00
|
|
|
CommandParser *m_commandParser;
|
|
|
|
CommandFactory *m_commandFactory;
|
2011-05-05 18:27:04 -04:00
|
|
|
bool m_pageSuccess;
|
|
|
|
bool m_commandWaiting;
|
2012-01-31 16:57:57 -05:00
|
|
|
bool m_pageLoadingFromCommand;
|
|
|
|
Response *m_pendingResponse;
|
2011-02-18 22:53:06 -05:00
|
|
|
};
|
|
|
|
|