|
static QString | percentEncode (const QString &s) |
|
void | setStatus (int code, QByteArray description) |
|
void | setHeader (QByteArray name, QByteArray value) |
|
void | setHeader (QByteArray name, int value) |
|
void | write (QByteArray data) |
|
void | write (QString data) |
|
void | write (const char *data) |
|
void | about () |
|
HttpSession | getSession () |
|
virtual void | writeHeader (HttpRequest &request, HttpResponse &response) |
|
virtual void | writeFooter (HttpRequest &request, HttpResponse &response) |
|
Protected Member Functions inherited from MRequestHandler |
bool | needsLogin (HttpRequest &request, HttpResponse &response) |
|
QString | m_javascript |
|
Protected Attributes inherited from MRequestHandler |
bool | m_needs_access_data |
|
bool | m_needs_change_settings |
|
bool | m_cacheable |
|
Definition at line 16 of file mainpagecontroller.h.
MainPageController::MainPageController |
( |
| ) |
|
Constructor
Definition at line 12 of file mainpagecontroller.cpp.
13 m_needs_access_data =
true;
14 m_needs_change_settings =
false;
15 m_javascript.append(
"var updateInterval = 1000;\n"
17 "function getJSON(callback, url) {\n"
18 " var http_request = new XMLHttpRequest();\n"
19 " http_request.open('GET', url, true);\n"
20 " http_request.onreadystatechange = function () {\n"
21 " var done = 4, ok = 200;\n"
22 " if (http_request.readyState == done) { xhring = 0;\n"
23 " if (http_request.status == ok) {\n"
24 " callback(JSON.parse(http_request.responseText));\n"
26 " http_request.send(null);\n"
29 "function myCall(data) {\n"
30 " var t = document.getElementById('statusTable');\n"
31 " for(var i=t.rows.length; i>0; i--) {\n"
34 " for(var i=0; i<data.status.length; i++) {\n"
35 " var oRow = t.insertRow(-1);\n"
36 " for(j in data.status[i]) {\n"
37 " var x = oRow.insertCell(-1);\n"
38 " x.innerHTML = data.status[i][j];"
40 "setInterval(function() { if(!xhring) {\n"
41 " getJSON(myCall, '/status');\n"
42 " } }, updateInterval);\n");
void MainPageController::servicePrivate |
( |
HttpRequest & |
request | ) |
|
|
virtual |
Generates the response
Implements WebPage.
Definition at line 45 of file mainpagecontroller.cpp.
48 write(QString(
"<h2>%1</h2>\n").arg(tr(
"Status")));
49 write(
"<table class=\"status\">\n");
51 "<thead><tr><th>%1</th><th>%2</th><th>%3</th><th>%4</th><th>%5</th><th>%6</th><th>%7</th><th>%8</th></tr></thead>"
52 "<tbody id=\"statusTable\">\n")
54 tr(
"Line Description"),
62 write(
"</tbody></table>\n");
The documentation for this class was generated from the following files: