aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-05-09 22:44:51 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2011-05-09 22:44:51 -0400
commitd97245c8352871a0de8bd80beaaf7695d184b1be (patch)
tree59e07faabda4db57e0f67cda48074a28bc428570
downloadServerExecute-d97245c8352871a0de8bd80beaaf7695d184b1be.tar.xz
ServerExecute-d97245c8352871a0de8bd80beaaf7695d184b1be.zip
Initial import.
-rw-r--r--.gitignore5
-rw-r--r--PageRunner.cpp18
-rw-r--r--PageRunner.h22
-rw-r--r--ServerExecute.cpp12
-rw-r--r--ServerExecute.pro8
5 files changed, 65 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..92b199e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.pro.user
+moc_*
+*.o
+Makefile
+ServerExecute
diff --git a/PageRunner.cpp b/PageRunner.cpp
new file mode 100644
index 0000000..26d3266
--- /dev/null
+++ b/PageRunner.cpp
@@ -0,0 +1,18 @@
+#include "PageRunner.h"
+#include <QApplication>
+#include <QWebPage>
+#include <QWebFrame>
+#include <iostream>
+
+PageRunner::PageRunner(const QUrl &webpage, QObject *parent) :
+ QObject(parent)
+{
+ m_page = new QWebPage(this);
+ connect(m_page, SIGNAL(loadFinished(bool)), this, SLOT(loaded()));
+ m_page->mainFrame()->load(webpage);
+}
+void PageRunner::loaded()
+{
+ std::cout << m_page->mainFrame()->toHtml().toStdString();
+ qApp->quit();
+}
diff --git a/PageRunner.h b/PageRunner.h
new file mode 100644
index 0000000..a9891cc
--- /dev/null
+++ b/PageRunner.h
@@ -0,0 +1,22 @@
+#ifndef PAGERUNNER_H
+#define PAGERUNNER_H
+
+#include <QObject>
+#include <QUrl>
+class QWebPage;
+
+class PageRunner : public QObject
+{
+ Q_OBJECT
+public:
+ PageRunner(const QUrl &webpage, QObject *parent = 0);
+
+private:
+ QWebPage *m_page;
+
+public slots:
+ void loaded();
+
+};
+
+#endif // PAGERUNNER_H
diff --git a/ServerExecute.cpp b/ServerExecute.cpp
new file mode 100644
index 0000000..6ba8acd
--- /dev/null
+++ b/ServerExecute.cpp
@@ -0,0 +1,12 @@
+#include <QApplication>
+#include <QStringList>
+#include "PageRunner.h"
+
+int main(int argc, char *argv[])
+{
+ if (argc != 2)
+ return -1;
+ QApplication app(argc, argv);
+ PageRunner page(app.arguments().at(1));
+ return app.exec();
+}
diff --git a/ServerExecute.pro b/ServerExecute.pro
new file mode 100644
index 0000000..5700149
--- /dev/null
+++ b/ServerExecute.pro
@@ -0,0 +1,8 @@
+QT += webkit
+
+SOURCES += \
+ ServerExecute.cpp \
+ PageRunner.cpp
+
+HEADERS += \
+ PageRunner.h