mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Pass the WebPageManager to each command
This commit is contained in:
parent
bfbda84141
commit
f80125e6cb
65 changed files with 109 additions and 134 deletions
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Body : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Body(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Body(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "ClearCookies.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include "NetworkCookieJar.h"
|
||||
#include <QNetworkCookie>
|
||||
|
||||
ClearCookies::ClearCookies(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {}
|
||||
ClearCookies::ClearCookies(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {}
|
||||
|
||||
void ClearCookies::start()
|
||||
{
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class ClearCookies : public Command {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
ClearCookies(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
ClearCookies(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "Command.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Command::Command(WebPage *page, QStringList &arguments, QObject *parent) : QObject(parent) {
|
||||
m_page = page;
|
||||
Command::Command(WebPageManager *manager, QStringList &arguments, QObject *parent) : QObject(parent) {
|
||||
m_manager = manager;
|
||||
m_arguments = arguments;
|
||||
}
|
||||
|
||||
|
@ -10,10 +11,14 @@ void Command::start() {
|
|||
}
|
||||
|
||||
WebPage *Command::page() {
|
||||
return m_page;
|
||||
return m_manager->currentPage();
|
||||
}
|
||||
|
||||
QStringList &Command::arguments() {
|
||||
return m_arguments;
|
||||
}
|
||||
|
||||
WebPageManager *Command::manager() {
|
||||
return m_manager;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
#include "Response.h"
|
||||
|
||||
class WebPage;
|
||||
class WebPageManager;
|
||||
|
||||
class Command : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Command(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Command(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
|
||||
signals:
|
||||
|
@ -20,10 +21,11 @@ class Command : public QObject {
|
|||
protected:
|
||||
WebPage *page();
|
||||
QStringList &arguments();
|
||||
WebPageManager *manager();
|
||||
|
||||
private:
|
||||
WebPage *m_page;
|
||||
QStringList m_arguments;
|
||||
WebPageManager *m_manager;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -38,9 +38,5 @@ Command *CommandFactory::createCommand(const char *name, QStringList &arguments)
|
|||
#include "find_command.h"
|
||||
arguments.clear();
|
||||
arguments.append(QString(name));
|
||||
return new NullCommand(currentPage(), arguments);
|
||||
}
|
||||
|
||||
WebPage *CommandFactory::currentPage() {
|
||||
return m_manager->currentPage();
|
||||
return new NullCommand(m_manager, arguments);
|
||||
}
|
||||
|
|
|
@ -8,11 +8,10 @@ class CommandFactory : public QObject {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CommandFactory(WebPageManager *page, QObject *parent = 0);
|
||||
CommandFactory(WebPageManager *, QObject *parent = 0);
|
||||
Command *createCommand(const char *name, QStringList &arguments);
|
||||
WebPageManager *m_manager;
|
||||
|
||||
private:
|
||||
WebPage *currentPage();
|
||||
WebPageManager *m_manager;
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ Connection::Connection(QTcpSocket *socket, WebPageManager *manager, QObject *par
|
|||
QObject(parent) {
|
||||
m_socket = socket;
|
||||
m_manager = manager;
|
||||
m_manager->setCurrentPage(m_manager->createPage(this));
|
||||
m_commandFactory = new CommandFactory(m_manager, this);
|
||||
m_commandParser = new CommandParser(socket, m_commandFactory, this);
|
||||
m_pageSuccess = true;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "ConsoleMessages.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
ConsoleMessages::ConsoleMessages(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
ConsoleMessages::ConsoleMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void ConsoleMessages::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class ConsoleMessages : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConsoleMessages(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
ConsoleMessages(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "CurrentUrl.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
CurrentUrl::CurrentUrl(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
CurrentUrl::CurrentUrl(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class CurrentUrl : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CurrentUrl(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
CurrentUrl(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "Evaluate.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include <iostream>
|
||||
|
||||
Evaluate::Evaluate(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Evaluate::Evaluate(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
m_buffer = "";
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
|
||||
#include <QVariantList>
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Evaluate : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Evaluate(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Evaluate(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "Execute.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Execute::Execute(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Execute::Execute(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Execute::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Execute : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Execute(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Execute(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "Find.h"
|
||||
#include "Command.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Find::Find(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Find::Find(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Find::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Find : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Find(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Find(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "FrameFocus.h"
|
||||
#include "Command.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
FrameFocus::FrameFocus(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
FrameFocus::FrameFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void FrameFocus::start() {
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
class QWebFrame;
|
||||
|
||||
class FrameFocus : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FrameFocus(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
FrameFocus(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "GetCookies.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include "NetworkCookieJar.h"
|
||||
|
||||
GetCookies::GetCookies(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent)
|
||||
GetCookies::GetCookies(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent)
|
||||
{
|
||||
m_buffer = "";
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class GetCookies : public Command {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
GetCookies(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
GetCookies(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "GetWindowHandle.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include <QStringList>
|
||||
|
||||
GetWindowHandle::GetWindowHandle(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
GetWindowHandle::GetWindowHandle(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void GetWindowHandle::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class GetWindowHandle : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GetWindowHandle(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
GetWindowHandle(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
#include "WebPage.h"
|
||||
#include <QStringList>
|
||||
|
||||
GetWindowHandles::GetWindowHandles(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
GetWindowHandles::GetWindowHandles(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void GetWindowHandles::start() {
|
||||
QListIterator<WebPage *> pageIterator =
|
||||
((CommandFactory *) parent())->m_manager->iterator();
|
||||
QListIterator<WebPage *> pageIterator = manager()->iterator();
|
||||
|
||||
QString handles = "[";
|
||||
QStringList stringList;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class GetWindowHandles : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GetWindowHandles(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
GetWindowHandles(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "Header.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include "NetworkAccessManager.h"
|
||||
|
||||
Header::Header(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Header::Header(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Header::start() {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Header : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Header(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Header(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "Headers.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Headers::Headers(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Headers::Headers(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Headers::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Headers : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Headers(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Headers(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "IgnoreSslErrors.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
IgnoreSslErrors::IgnoreSslErrors(WebPage *page, QStringList &arguments, QObject *parent) :
|
||||
Command(page, arguments, parent) {
|
||||
IgnoreSslErrors::IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
||||
Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void IgnoreSslErrors::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class IgnoreSslErrors : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IgnoreSslErrors(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "Node.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Node::Node(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Node::Node(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Node::start() {
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#include "Command.h"
|
||||
#include <QStringList>
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Node : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Node(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Node(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "NullCommand.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
NullCommand::NullCommand(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {}
|
||||
NullCommand::NullCommand(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {}
|
||||
|
||||
void NullCommand::start() {
|
||||
QString failure = QString("[Capybara WebKit] Unknown command: ") + arguments()[0] + "\n";
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class NullCommand : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
NullCommand(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
NullCommand(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "Render.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Render::Render(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Render::Render(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Render::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
#include <QStringList>
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Render : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Render(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Render(WebPageManager *page, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "RequestedUrl.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
RequestedUrl::RequestedUrl(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
RequestedUrl::RequestedUrl(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void RequestedUrl::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class RequestedUrl : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RequestedUrl(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
RequestedUrl(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "Reset.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include "NetworkAccessManager.h"
|
||||
#include "NetworkCookieJar.h"
|
||||
|
||||
Reset::Reset(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Reset::Reset(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Reset::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Reset : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Reset(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Reset(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "ResizeWindow.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
ResizeWindow::ResizeWindow(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
ResizeWindow::ResizeWindow(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void ResizeWindow::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class ResizeWindow : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ResizeWindow(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
ResizeWindow(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "SetCookie.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include "NetworkCookieJar.h"
|
||||
#include <QNetworkCookie>
|
||||
|
||||
SetCookie::SetCookie(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {}
|
||||
SetCookie::SetCookie(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {}
|
||||
|
||||
void SetCookie::start()
|
||||
{
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class SetCookie : public Command {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
SetCookie(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
SetCookie(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "SetProxy.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
SetProxy::SetProxy(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {}
|
||||
SetProxy::SetProxy(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {}
|
||||
|
||||
void SetProxy::start()
|
||||
{
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class SetProxy : public Command {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
SetProxy(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
SetProxy(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "SetSkipImageLoading.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
SetSkipImageLoading::SetSkipImageLoading(WebPage *page, QStringList &arguments, QObject *parent) :
|
||||
Command(page, arguments, parent) {
|
||||
SetSkipImageLoading::SetSkipImageLoading(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
||||
Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void SetSkipImageLoading::start() {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class SetSkipImageLoading : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SetSkipImageLoading(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
SetSkipImageLoading(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "Source.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Source::Source(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Source::Source(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Source::start() {
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
class QNetworkReply;
|
||||
|
||||
class Source : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Source(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Source(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "Status.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
#include <sstream>
|
||||
|
||||
Status::Status(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Status::Status(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Status::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Status : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Status(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Status(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "Url.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Url::Url(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Url::Url(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Url::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Url : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Url(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Url(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "Visit.h"
|
||||
#include "Command.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Visit::Visit(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Visit::Visit(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Visit::start() {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class Visit : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Visit(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
Visit(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
};
|
||||
|
||||
|
|
|
@ -277,3 +277,7 @@ bool WebPage::matchesWindowSelector(QString selector) {
|
|||
selector == mainFrame()->url().toString() ||
|
||||
selector == uuid());
|
||||
}
|
||||
|
||||
void WebPage::setFocus() {
|
||||
m_manager->setCurrentPage(this);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ class WebPage : public QWebPage {
|
|||
QString uuid();
|
||||
QString getWindowName();
|
||||
bool matchesWindowSelector(QString);
|
||||
void setFocus();
|
||||
|
||||
public slots:
|
||||
bool shouldInterruptJavaScript();
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <stdio.h>
|
||||
|
||||
WebPageManager::WebPageManager(QObject *parent) : QObject(parent) {
|
||||
m_currentPage = NULL;
|
||||
m_ignoreSslErrors = false;
|
||||
createPage(this)->setFocus();
|
||||
}
|
||||
|
||||
void WebPageManager::append(WebPage *value) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "CommandFactory.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
WindowFocus::WindowFocus(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void WindowFocus::start() {
|
||||
|
@ -16,13 +16,12 @@ void WindowFocus::windowNotFound() {
|
|||
}
|
||||
|
||||
void WindowFocus::success(WebPage *page) {
|
||||
((CommandFactory *) parent())->m_manager->setCurrentPage(page);
|
||||
page->setFocus();
|
||||
emit finished(new Response(true));
|
||||
}
|
||||
|
||||
void WindowFocus::focusWindow(QString selector) {
|
||||
QListIterator<WebPage *> pageIterator =
|
||||
((CommandFactory *) parent())->m_manager->iterator();
|
||||
QListIterator<WebPage *> pageIterator = manager()->iterator();
|
||||
|
||||
while (pageIterator.hasNext()) {
|
||||
WebPage *page = pageIterator.next();
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Command.h"
|
||||
|
||||
class WebPage;
|
||||
|
||||
class WindowFocus : public Command {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WindowFocus(WebPage *page, QStringList &arguments, QObject *parent = 0);
|
||||
WindowFocus(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include "Body.h"
|
||||
#include "WebPage.h"
|
||||
#include "WebPageManager.h"
|
||||
|
||||
Body::Body(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
|
||||
Body::Body(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
||||
}
|
||||
|
||||
void Body::start() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define CHECK_COMMAND(expectedName) \
|
||||
if (strcmp(#expectedName, name) == 0) { \
|
||||
return new expectedName(currentPage(), arguments, this); \
|
||||
return new expectedName(m_manager, arguments, this); \
|
||||
}
|
||||
|
||||
CHECK_COMMAND(Visit)
|
||||
|
@ -20,7 +20,6 @@ CHECK_COMMAND(Headers)
|
|||
CHECK_COMMAND(SetCookie)
|
||||
CHECK_COMMAND(ClearCookies)
|
||||
CHECK_COMMAND(GetCookies)
|
||||
CHECK_COMMAND(Headers)
|
||||
CHECK_COMMAND(SetProxy)
|
||||
CHECK_COMMAND(ConsoleMessages)
|
||||
CHECK_COMMAND(RequestedUrl)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue