Permalink
Browse files

Rename Command::emitFinished to finish

  • Loading branch information...
1 parent 9f85bb2 commit c74949bd04a8b974ca6ad63cafbf2b5c3eae0b29 @mhoran mhoran committed Feb 11, 2013
View
@@ -13,6 +13,6 @@ void Authenticate::start() {
networkAccessManager->setUserName(username);
networkAccessManager->setPassword(password);
- emitFinished(true);
+ finish(true);
}
View
@@ -9,5 +9,5 @@ ClearCookies::ClearCookies(WebPageManager *manager, QStringList &arguments, QObj
void ClearCookies::start()
{
manager()->cookieJar()->clearCookies();
- emitFinished(true);
+ finish(true);
}
View
@@ -7,5 +7,5 @@ ClearPromptText::ClearPromptText(WebPageManager *manager, QStringList &arguments
void ClearPromptText::start()
{
page()->setPromptText(QString());
- emitFinished(true);
+ finish(true);
}
View
@@ -8,18 +8,18 @@ QString Command::toString() const {
return metaObject()->className();
}
-void Command::emitFinished(bool success) {
+void Command::finish(bool success) {
emit finished(new Response(success, this));
}
-void Command::emitFinished(bool success, QString message) {
+void Command::finish(bool success, QString message) {
emit finished(new Response(success, message, this));
}
-void Command::emitFinished(bool success, QByteArray message) {
+void Command::finish(bool success, QByteArray message) {
emit finished(new Response(success, message, this));
}
-void Command::emitFinished(bool success, ErrorMessage *message) {
+void Command::finish(bool success, ErrorMessage *message) {
emit finished(new Response(success, message, this));
}
View
@@ -16,10 +16,10 @@ class Command : public QObject {
virtual QString toString() const;
protected:
- void emitFinished(bool success);
- void emitFinished(bool success, QString message);
- void emitFinished(bool success, QByteArray message);
- void emitFinished(bool success, ErrorMessage *message);
+ void finish(bool success);
+ void finish(bool success, QString message);
+ void finish(bool success, QByteArray message);
+ void finish(bool success, ErrorMessage *message);
signals:
void finished(Response *response);
View
@@ -9,6 +9,6 @@ ConsoleMessages::ConsoleMessages(WebPageManager *manager, QStringList &arguments
void ConsoleMessages::start() {
JsonSerializer serializer;
QByteArray json = serializer.serialize(page()->consoleMessages());
- emitFinished(true, json);
+ finish(true, json);
}
View
@@ -9,6 +9,6 @@ void CurrentUrl::start() {
QStringList arguments;
QVariant result = page()->currentFrame()->evaluateJavaScript("window.location.toString()");
QString url = result.toString();
- emitFinished(true, url);
+ finish(true, url);
}
View
@@ -6,5 +6,5 @@ EnableLogging::EnableLogging(WebPageManager *manager, QStringList &arguments, QO
void EnableLogging::start() {
manager()->enableLogging();
- emitFinished(true);
+ finish(true);
}
View
@@ -10,5 +10,5 @@ Evaluate::Evaluate(WebPageManager *manager, QStringList &arguments, QObject *par
void Evaluate::start() {
QVariant result = page()->currentFrame()->evaluateJavaScript(arguments()[0]);
JsonSerializer serializer;
- emitFinished(true, serializer.serialize(result));
+ finish(true, serializer.serialize(result));
}
View
@@ -10,9 +10,9 @@ void Execute::start() {
QString script = arguments()[0] + QString("; 'success'");
QVariant result = page()->currentFrame()->evaluateJavaScript(script);
if (result.isValid()) {
- emitFinished(true);
+ finish(true);
} else {
- emitFinished(false, new ErrorMessage("Javascript failed to execute"));
+ finish(false, new ErrorMessage("Javascript failed to execute"));
}
}
View
@@ -11,10 +11,10 @@ void Find::start() {
InvocationResult result = page()->invokeCapybaraFunction("find", arguments());
if (result.hasError())
- return emitFinished(false, result.errorMessage());
+ return finish(false, result.errorMessage());
QString message;
message = result.result().toString();
- emitFinished(true, message);
+ finish(true, message);
}
View
@@ -52,17 +52,17 @@ void FrameFocus::focusId(QString name) {
void FrameFocus::focusParent() {
if (page()->currentFrame()->parentFrame() == 0) {
- emitFinished(false, new ErrorMessage("Already at parent frame."));
+ finish(false, new ErrorMessage("Already at parent frame."));
} else {
page()->currentFrame()->parentFrame()->setFocus();
success();
}
}
void FrameFocus::frameNotFound() {
- emitFinished(false, new ErrorMessage("Unable to locate frame."));
+ finish(false, new ErrorMessage("Unable to locate frame."));
}
void FrameFocus::success() {
- emitFinished(true);
+ finish(true);
}
View
@@ -15,5 +15,5 @@ void GetCookies::start()
m_buffer.append(cookie.toRawForm());
m_buffer.append("\n");
}
- emitFinished(true, m_buffer);
+ finish(true, m_buffer);
}
View
@@ -5,5 +5,5 @@ GetTimeout::GetTimeout(WebPageManager *manager, QStringList &arguments, QObject
}
void GetTimeout::start() {
- emitFinished(true, QString::number(manager()->getTimeout()));
+ finish(true, QString::number(manager()->getTimeout()));
}
View
@@ -7,5 +7,5 @@ GetWindowHandle::GetWindowHandle(WebPageManager *manager, QStringList &arguments
}
void GetWindowHandle::start() {
- emitFinished(true, page()->uuid());
+ finish(true, page()->uuid());
}
View
@@ -17,5 +17,5 @@ void GetWindowHandles::start() {
JsonSerializer serializer;
QByteArray json = serializer.serialize(handles);
- emitFinished(true, json);
+ finish(true, json);
}
View
@@ -15,5 +15,5 @@ void Header::start() {
} else {
networkAccessManager->addHeader(key, value);
}
- emitFinished(true);
+ finish(true);
}
View
@@ -11,6 +11,6 @@ void Headers::start() {
foreach(QNetworkReply::RawHeaderPair header, page()->pageHeaders())
headers << header.first+": "+header.second;
- emitFinished(true, headers.join("\n"));
+ finish(true, headers.join("\n"));
}
View
@@ -8,6 +8,6 @@ IgnoreSslErrors::IgnoreSslErrors(WebPageManager *manager, QStringList &arguments
void IgnoreSslErrors::start() {
manager()->setIgnoreSslErrors(true);
- emitFinished(true);
+ finish(true);
}
@@ -9,5 +9,5 @@ void JavascriptAlertMessages::start()
{
JsonSerializer serializer;
QByteArray json = serializer.serialize(page()->alertMessages());
- emitFinished(true, json);
+ finish(true, json);
}
@@ -9,5 +9,5 @@ void JavascriptConfirmMessages::start()
{
JsonSerializer serializer;
QByteArray json = serializer.serialize(page()->confirmMessages());
- emitFinished(true, json);
+ finish(true, json);
}
@@ -9,5 +9,5 @@ void JavascriptPromptMessages::start()
{
JsonSerializer serializer;
QByteArray json = serializer.serialize(page()->promptMessages());
- emitFinished(true, json);
+ finish(true, json);
}
View
@@ -12,10 +12,10 @@ void Node::start() {
InvocationResult result = page()->invokeCapybaraFunction(functionName, functionArguments);
if (result.hasError())
- return emitFinished(false, result.errorMessage());
+ return finish(false, result.errorMessage());
QString attributeValue = result.result().toString();
- emitFinished(true, attributeValue);
+ finish(true, attributeValue);
}
QString Node::toString() const {
View
@@ -9,6 +9,6 @@ NullCommand::NullCommand(QString name, QObject *parent) : Command(parent) {
void NullCommand::start() {
QString failure = QString("[Capybara WebKit] Unknown command: ") + m_name + "\n";
- emitFinished(false, new ErrorMessage(failure));
+ finish(false, new ErrorMessage(failure));
}
@@ -31,7 +31,7 @@ void PageLoadingCommand::pendingLoadFinished(bool success) {
emit finished(m_pendingResponse);
} else {
QString message = m_manager->currentPage()->failureString();
- emitFinished(false, new ErrorMessage(message));
+ finish(false, new ErrorMessage(message));
}
}
}
View
@@ -14,5 +14,5 @@ void Render::start() {
bool result = page()->render( imagePath, size );
- emitFinished(result);
+ finish(result);
}
View
@@ -10,6 +10,6 @@ void Reset::start() {
manager()->reset();
- emitFinished(true);
+ finish(true);
}
View
@@ -12,6 +12,6 @@ void ResizeWindow::start() {
QSize size(width, height);
page()->setViewportSize(size);
- emitFinished(true);
+ finish(true);
}
View
@@ -7,5 +7,5 @@ SetConfirmAction::SetConfirmAction(WebPageManager *manager, QStringList &argumen
void SetConfirmAction::start()
{
page()->setConfirmAction(arguments()[0]);
- emitFinished(true);
+ finish(true);
}
View
@@ -11,5 +11,5 @@ void SetCookie::start()
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(arguments()[0].toAscii());
NetworkCookieJar *jar = manager()->cookieJar();
jar->overwriteCookies(cookies);
- emitFinished(true);
+ finish(true);
}
View
@@ -7,5 +7,5 @@ SetPromptAction::SetPromptAction(WebPageManager *manager, QStringList &arguments
void SetPromptAction::start()
{
page()->setPromptAction(arguments()[0]);
- emitFinished(true);
+ finish(true);
}
View
@@ -7,5 +7,5 @@ SetPromptText::SetPromptText(WebPageManager *manager, QStringList &arguments, QO
void SetPromptText::start()
{
page()->setPromptText(arguments()[0]);
- emitFinished(true);
+ finish(true);
}
View
@@ -19,5 +19,5 @@ void SetProxy::start()
arguments()[3]);
page()->networkAccessManager()->setProxy(proxy);
- emitFinished(true);
+ finish(true);
}
@@ -8,5 +8,5 @@ SetSkipImageLoading::SetSkipImageLoading(WebPageManager *manager, QStringList &a
void SetSkipImageLoading::start() {
page()->setSkipImageLoading(arguments().contains("true"));
- emitFinished(true);
+ finish(true);
}
View
@@ -12,9 +12,9 @@ void SetTimeout::start() {
if (ok) {
manager()->setTimeout(timeout);
- emitFinished(true);
+ finish(true);
} else {
- emitFinished(false, new ErrorMessage("Invalid value for timeout"));
+ finish(false, new ErrorMessage("Invalid value for timeout"));
}
}
View
@@ -10,6 +10,6 @@ SetUrlBlacklist::SetUrlBlacklist(WebPageManager *manager, QStringList &arguments
void SetUrlBlacklist::start() {
NetworkAccessManager* networkAccessManager = page()->networkAccessManager();
networkAccessManager->setUrlBlacklist(arguments());
- emitFinished(true);
+ finish(true);
}
View
@@ -8,6 +8,6 @@ Status::Status(WebPageManager *manager, QStringList &arguments, QObject *parent)
void Status::start() {
int status = page()->getLastStatus();
- emitFinished(true, QString::number(status));
+ finish(true, QString::number(status));
}
View
@@ -46,7 +46,7 @@ void TimeoutCommand::pendingLoadFinished(bool success) {
} else {
disconnect(m_timer, SIGNAL(timeout()), this, SLOT(commandTimeout()));
disconnect(m_manager, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand()));
- emitFinished(false, new ErrorMessage(m_manager->currentPage()->failureString()));
+ finish(false, new ErrorMessage(m_manager->currentPage()->failureString()));
}
}
@@ -60,7 +60,7 @@ void TimeoutCommand::commandTimeout() {
disconnect(m_command, SIGNAL(finished(Response *)), this, SLOT(commandFinished(Response *)));
m_manager->currentPage()->triggerAction(QWebPage::Stop);
QString message = QString("Request timed out after %1 second(s)").arg(m_manager->getTimeout());
- emitFinished(false, new ErrorMessage("Capybara::Webkit::TimeoutError", message));
+ finish(false, new ErrorMessage("Capybara::Webkit::TimeoutError", message));
}
void TimeoutCommand::commandFinished(Response *response) {
View
@@ -9,5 +9,5 @@ void Version::start() {
QString("Qt: ") + QT_VERSION_STR +
QString("\nWebKit: ") + qWebKitVersion() +
QString("\nQtWebKit: ") + QTWEBKIT_VERSION_STR;
- emitFinished(true, result);
+ finish(true, result);
}
View
@@ -9,5 +9,5 @@ Visit::Visit(WebPageManager *manager, QStringList &arguments, QObject *parent) :
void Visit::start() {
QUrl requestedUrl = QUrl::fromEncoded(arguments()[0].toUtf8(), QUrl::StrictMode);
page()->currentFrame()->load(QUrl(requestedUrl));
- emitFinished(true);
+ finish(true);
}
View
@@ -13,12 +13,12 @@ void WindowFocus::start() {
}
void WindowFocus::windowNotFound() {
- emitFinished(false, new ErrorMessage("Unable to locate window."));
+ finish(false, new ErrorMessage("Unable to locate window."));
}
void WindowFocus::success(WebPage *page) {
page->setFocus();
- emitFinished(true);
+ finish(true);
}
void WindowFocus::focusWindow(QString selector) {
View
@@ -12,5 +12,5 @@ void Body::start() {
else
result = page()->currentFrame()->toHtml();
- emitFinished(true, result);
+ finish(true, result);
}

0 comments on commit c74949b

Please sign in to comment.