2012-03-23 20:34:39 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
class Command;
|
|
|
|
class Response;
|
2012-05-15 01:59:28 +00:00
|
|
|
class WebPageManager;
|
2012-03-23 20:34:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Decorates a Command by deferring the finished() signal until any pending
|
|
|
|
* page loads are complete.
|
|
|
|
*
|
|
|
|
* If a Command starts a page load, no signal will be emitted until the page
|
|
|
|
* load is finished.
|
|
|
|
*
|
|
|
|
* If a pending page load fails, the command's response will be discarded and a
|
|
|
|
* failure response will be emitted instead.
|
|
|
|
*/
|
|
|
|
class PageLoadingCommand : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2012-05-15 01:59:28 +00:00
|
|
|
PageLoadingCommand(Command *command, WebPageManager *page, QObject *parent = 0);
|
2012-03-23 20:34:39 +00:00
|
|
|
void start();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void pageLoadingFromCommand();
|
|
|
|
void pendingLoadFinished(bool success);
|
|
|
|
void commandFinished(Response *response);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void finished(Response *response);
|
|
|
|
|
|
|
|
private:
|
2012-05-15 01:59:28 +00:00
|
|
|
WebPageManager *m_manager;
|
2012-03-23 20:34:39 +00:00
|
|
|
Command *m_command;
|
|
|
|
Response *m_pendingResponse;
|
|
|
|
bool m_pageSuccess;
|
|
|
|
bool m_pageLoadingFromCommand;
|
|
|
|
};
|
|
|
|
|