mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Split Command into more abstract Command and concrete SocketCommand
This commit is contained in:
parent
d9b18985e1
commit
95732ad796
71 changed files with 162 additions and 140 deletions
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "NetworkAccessManager.h"
|
#include "NetworkAccessManager.h"
|
||||||
|
|
||||||
Authenticate::Authenticate(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Authenticate::Authenticate(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Authenticate::start() {
|
void Authenticate::start() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class WebPage;
|
class WebPage;
|
||||||
|
|
||||||
class Authenticate : public Command {
|
class Authenticate : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Body : public Command {
|
class Body : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "NetworkCookieJar.h"
|
#include "NetworkCookieJar.h"
|
||||||
#include <QNetworkCookie>
|
#include <QNetworkCookie>
|
||||||
|
|
||||||
ClearCookies::ClearCookies(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {}
|
ClearCookies::ClearCookies(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
|
||||||
|
|
||||||
void ClearCookies::start()
|
void ClearCookies::start()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class ClearCookies : public Command {
|
class ClearCookies : public SocketCommand {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,27 +1,8 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
#include "WebPage.h"
|
|
||||||
#include "WebPageManager.h"
|
|
||||||
|
|
||||||
Command::Command(WebPageManager *manager, QStringList &arguments, QObject *parent) : QObject(parent) {
|
Command::Command(QObject *parent) : QObject(parent) {
|
||||||
m_manager = manager;
|
|
||||||
m_arguments = arguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Command::start() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Command::toString() const {
|
QString Command::toString() const {
|
||||||
return metaObject()->className();
|
return metaObject()->className();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebPage *Command::page() const {
|
|
||||||
return m_manager->currentPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
const QStringList &Command::arguments() const {
|
|
||||||
return m_arguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
WebPageManager *Command::manager() const {
|
|
||||||
return m_manager;
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,32 +2,18 @@
|
||||||
#define COMMAND_H
|
#define COMMAND_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStringList>
|
|
||||||
#include "Response.h"
|
#include "Response.h"
|
||||||
|
|
||||||
class WebPage;
|
|
||||||
class WebPageManager;
|
|
||||||
|
|
||||||
class Command : public QObject {
|
class Command : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Command(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
Command(QObject *parent = 0);
|
||||||
virtual void start();
|
virtual void start() = 0;
|
||||||
virtual QString toString() const;
|
virtual QString toString() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished(Response *response);
|
void finished(Response *response);
|
||||||
|
|
||||||
protected:
|
|
||||||
WebPage *page() const;
|
|
||||||
const QStringList &arguments() const;
|
|
||||||
WebPageManager *manager() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_arguments;
|
|
||||||
WebPageManager *m_manager;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "CommandFactory.h"
|
#include "CommandFactory.h"
|
||||||
#include "NullCommand.h"
|
#include "NullCommand.h"
|
||||||
|
#include "SocketCommand.h"
|
||||||
#include "Visit.h"
|
#include "Visit.h"
|
||||||
#include "Find.h"
|
#include "Find.h"
|
||||||
#include "Command.h"
|
|
||||||
#include "Reset.h"
|
#include "Reset.h"
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
#include "Url.h"
|
#include "Url.h"
|
||||||
|
@ -38,7 +38,5 @@ CommandFactory::CommandFactory(WebPageManager *manager, QObject *parent) : QObje
|
||||||
|
|
||||||
Command *CommandFactory::createCommand(const char *name, QStringList &arguments) {
|
Command *CommandFactory::createCommand(const char *name, QStringList &arguments) {
|
||||||
#include "find_command.h"
|
#include "find_command.h"
|
||||||
arguments.clear();
|
return new NullCommand(QString(name));
|
||||||
arguments.append(QString(name));
|
|
||||||
return new NullCommand(m_manager, arguments);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "CommandParser.h"
|
#include "CommandParser.h"
|
||||||
#include "CommandFactory.h"
|
#include "CommandFactory.h"
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "CommandParser.h"
|
#include "CommandParser.h"
|
||||||
#include "CommandFactory.h"
|
#include "CommandFactory.h"
|
||||||
#include "PageLoadingCommand.h"
|
#include "PageLoadingCommand.h"
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
ConsoleMessages::ConsoleMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
ConsoleMessages::ConsoleMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleMessages::start() {
|
void ConsoleMessages::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class ConsoleMessages : public Command {
|
class ConsoleMessages : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
CurrentUrl::CurrentUrl(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
CurrentUrl::CurrentUrl(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class CurrentUrl : public Command {
|
class CurrentUrl : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "EnableLogging.h"
|
#include "EnableLogging.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
EnableLogging::EnableLogging(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
EnableLogging::EnableLogging(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnableLogging::start() {
|
void EnableLogging::start() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class WebPageManager;
|
class WebPageManager;
|
||||||
|
|
||||||
class EnableLogging : public Command {
|
class EnableLogging : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
Evaluate::Evaluate(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Evaluate::Evaluate(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
m_buffer = "";
|
m_buffer = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
#include <QVariantList>
|
#include <QVariantList>
|
||||||
|
|
||||||
class Evaluate : public Command {
|
class Evaluate : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Execute::Execute(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Execute::Execute(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Execute::start() {
|
void Execute::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Execute : public Command {
|
class Execute : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "Find.h"
|
#include "Find.h"
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Find::Find(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Find::Find(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Find::start() {
|
void Find::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Find : public Command {
|
class Find : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "FrameFocus.h"
|
#include "FrameFocus.h"
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
FrameFocus::FrameFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
FrameFocus::FrameFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameFocus::start() {
|
void FrameFocus::start() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class QWebFrame;
|
class QWebFrame;
|
||||||
|
|
||||||
class FrameFocus : public Command {
|
class FrameFocus : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
#include "NetworkCookieJar.h"
|
#include "NetworkCookieJar.h"
|
||||||
|
|
||||||
GetCookies::GetCookies(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent)
|
GetCookies::GetCookies(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent)
|
||||||
{
|
{
|
||||||
m_buffer = "";
|
m_buffer = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class GetCookies : public Command {
|
class GetCookies : public SocketCommand {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
GetWindowHandle::GetWindowHandle(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
GetWindowHandle::GetWindowHandle(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetWindowHandle::start() {
|
void GetWindowHandle::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class GetWindowHandle : public Command {
|
class GetWindowHandle : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
GetWindowHandles::GetWindowHandles(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
GetWindowHandles::GetWindowHandles(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetWindowHandles::start() {
|
void GetWindowHandles::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class GetWindowHandles : public Command {
|
class GetWindowHandles : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
#include "NetworkAccessManager.h"
|
#include "NetworkAccessManager.h"
|
||||||
|
|
||||||
Header::Header(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Header::Header(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Header::start() {
|
void Header::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Header : public Command {
|
class Header : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Headers::Headers(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Headers::Headers(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Headers::start() {
|
void Headers::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Headers : public Command {
|
class Headers : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
IgnoreSslErrors::IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
IgnoreSslErrors::IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
||||||
Command(manager, arguments, parent) {
|
SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IgnoreSslErrors::start() {
|
void IgnoreSslErrors::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class IgnoreSslErrors : public Command {
|
class IgnoreSslErrors : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Node::Node(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Node::Node(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::start() {
|
void Node::start() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
class Node : public Command {
|
class Node : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
NullCommand::NullCommand(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {}
|
NullCommand::NullCommand(QString name, QObject *parent) : Command(parent) {
|
||||||
|
m_name = name;
|
||||||
|
}
|
||||||
|
|
||||||
void NullCommand::start() {
|
void NullCommand::start() {
|
||||||
QString failure = QString("[Capybara WebKit] Unknown command: ") + arguments()[0] + "\n";
|
QString failure = QString("[Capybara WebKit] Unknown command: ") + m_name + "\n";
|
||||||
emit finished(new Response(false, failure));
|
emit finished(new Response(false, failure));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ class NullCommand : public Command {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NullCommand(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
NullCommand(QString name, QObject *parent = 0);
|
||||||
virtual void start();
|
virtual void start();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_name;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "PageLoadingCommand.h"
|
#include "PageLoadingCommand.h"
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Render::Render(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Render::Render(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Render::start() {
|
void Render::start() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
class Render : public Command {
|
class Render : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
RequestedUrl::RequestedUrl(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
RequestedUrl::RequestedUrl(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestedUrl::start() {
|
void RequestedUrl::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class RequestedUrl : public Command {
|
class RequestedUrl : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Reset::Reset(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Reset::Reset(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reset::start() {
|
void Reset::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Reset : public Command {
|
class Reset : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
ResizeWindow::ResizeWindow(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
ResizeWindow::ResizeWindow(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizeWindow::start() {
|
void ResizeWindow::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class ResizeWindow : public Command {
|
class ResizeWindow : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "NetworkCookieJar.h"
|
#include "NetworkCookieJar.h"
|
||||||
#include <QNetworkCookie>
|
#include <QNetworkCookie>
|
||||||
|
|
||||||
SetCookie::SetCookie(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {}
|
SetCookie::SetCookie(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
|
||||||
|
|
||||||
void SetCookie::start()
|
void SetCookie::start()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class SetCookie : public Command {
|
class SetCookie : public SocketCommand {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
|
|
||||||
SetProxy::SetProxy(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {}
|
SetProxy::SetProxy(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {}
|
||||||
|
|
||||||
void SetProxy::start()
|
void SetProxy::start()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class SetProxy : public Command {
|
class SetProxy : public SocketCommand {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
SetSkipImageLoading::SetSkipImageLoading(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
SetSkipImageLoading::SetSkipImageLoading(WebPageManager *manager, QStringList &arguments, QObject *parent) :
|
||||||
Command(manager, arguments, parent) {
|
SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSkipImageLoading::start() {
|
void SetSkipImageLoading::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class SetSkipImageLoading : public Command {
|
class SetSkipImageLoading : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
21
src/SocketCommand.cpp
Normal file
21
src/SocketCommand.cpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include "SocketCommand.h"
|
||||||
|
#include "WebPage.h"
|
||||||
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
|
SocketCommand::SocketCommand(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(parent) {
|
||||||
|
m_manager = manager;
|
||||||
|
m_arguments = arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
WebPage *SocketCommand::page() const {
|
||||||
|
return m_manager->currentPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
const QStringList &SocketCommand::arguments() const {
|
||||||
|
return m_arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
WebPageManager *SocketCommand::manager() const {
|
||||||
|
return m_manager;
|
||||||
|
}
|
||||||
|
|
29
src/SocketCommand.h
Normal file
29
src/SocketCommand.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef SOCKET_COMMAND_H
|
||||||
|
#define SOCKET_COMMAND_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QStringList>
|
||||||
|
#include "Command.h"
|
||||||
|
|
||||||
|
class WebPage;
|
||||||
|
class WebPageManager;
|
||||||
|
class Response;
|
||||||
|
|
||||||
|
class SocketCommand : public Command {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SocketCommand(WebPageManager *, QStringList &arguments, QObject *parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
WebPage *page() const;
|
||||||
|
const QStringList &arguments() const;
|
||||||
|
WebPageManager *manager() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QStringList m_arguments;
|
||||||
|
WebPageManager *m_manager;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Source::Source(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Source::Source(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Source::start() {
|
void Source::start() {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
|
|
||||||
class Source : public Command {
|
class Source : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
Status::Status(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Status::Status(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Status::start() {
|
void Status::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Status : public Command {
|
class Status : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Url::Url(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Url::Url(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Url::start() {
|
void Url::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Url : public Command {
|
class Url : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include "Visit.h"
|
#include "Visit.h"
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Visit::Visit(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Visit::Visit(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Visit::start() {
|
void Visit::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class Visit : public Command {
|
class Visit : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include "WindowFocus.h"
|
#include "WindowFocus.h"
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "CommandFactory.h"
|
#include "CommandFactory.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowFocus::start() {
|
void WindowFocus::start() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Command.h"
|
#include "SocketCommand.h"
|
||||||
|
|
||||||
class WindowFocus : public Command {
|
class WindowFocus : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
#include "WebPageManager.h"
|
#include "WebPageManager.h"
|
||||||
|
|
||||||
Body::Body(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
Body::Body(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Body::start() {
|
void Body::start() {
|
||||||
|
|
|
@ -13,6 +13,7 @@ HEADERS = \
|
||||||
Server.h \
|
Server.h \
|
||||||
Connection.h \
|
Connection.h \
|
||||||
Command.h \
|
Command.h \
|
||||||
|
SocketCommand.h \
|
||||||
Visit.h \
|
Visit.h \
|
||||||
Find.h \
|
Find.h \
|
||||||
Reset.h \
|
Reset.h \
|
||||||
|
@ -59,6 +60,7 @@ SOURCES = \
|
||||||
Server.cpp \
|
Server.cpp \
|
||||||
Connection.cpp \
|
Connection.cpp \
|
||||||
Command.cpp \
|
Command.cpp \
|
||||||
|
SocketCommand.cpp \
|
||||||
Visit.cpp \
|
Visit.cpp \
|
||||||
Find.cpp \
|
Find.cpp \
|
||||||
Reset.cpp \
|
Reset.cpp \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "NAME.h"
|
#include "NAME.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
|
|
||||||
NAME::NAME(WebPageManager *manager, QStringList &arguments, QObject *parent) : Command(manager, arguments, parent) {
|
NAME::NAME(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NAME::start() {
|
void NAME::start() {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class WebPage;
|
class WebPage;
|
||||||
|
|
||||||
class NAME : public Command {
|
class NAME : public SocketCommand {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue