diff options
author | Jonathan Bauer | 2011-04-24 02:22:03 +0200 |
---|---|---|
committer | Jonathan Bauer | 2011-04-24 02:22:03 +0200 |
commit | ce42f447314d241d725f77d4dd12b00f7ca5a7b6 (patch) | |
tree | 2df47d0b382dece1a14b6205584af3c3d9fa305c /src | |
parent | loading system page (diff) | |
download | fbgui-ce42f447314d241d725f77d4dd12b00f7ca5a7b6.tar.gz fbgui-ce42f447314d241d725f77d4dd12b00f7ca5a7b6.tar.xz fbgui-ce42f447314d241d725f77d4dd12b00f7ca5a7b6.zip |
download manager threaded again, debug preload page
Diffstat (limited to 'src')
-rw-r--r-- | src/downloadmanager.cpp | 2 | ||||
-rw-r--r-- | src/fbgui.cpp | 38 | ||||
-rw-r--r-- | src/fbgui.h | 3 | ||||
-rw-r--r-- | src/fbgui.qrc | 2 | ||||
-rw-r--r-- | src/html/preload-debug.html | 8 |
5 files changed, 36 insertions, 17 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 1be8964..7458b4c 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -7,7 +7,7 @@ DownloadManager::DownloadManager() { qxtLog->debug() << "Initializing download manager..."; checkDownloadDirectory(); _qnam = new QNetworkAccessManager(); - //_qnam->moveToThread(&dmThread); + _qnam->moveToThread(&dmThread); dip = false; } DownloadManager::~DownloadManager() { diff --git a/src/fbgui.cpp b/src/fbgui.cpp index bd0c508..63f6983 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -10,7 +10,7 @@ #include <QtWebKit> #include <QxtCore> -//QThread dmThread; +QThread dmThread; QString ipConfigFilePath(""); QString binPath(""); QUrl baseURL(""); @@ -68,16 +68,20 @@ fbgui::fbgui() { SLOT(updateProgressBar(const int&, const double&, const QString&))); QObject::connect(dm, SIGNAL(downloadQueueEmpty()), jsi, SLOT( callbackOnFinished())); - QObject::connect(dm, SIGNAL(downloadQueueEmpty()), this, - SLOT(prepareKexec())); + QObject::connect(dm, SIGNAL(downloadQueueEmpty()), this, SLOT(loadSystem())); // move download manager to its own thread - //dm->moveToThread(&dmThread); - //dmThread.start(); + dm->moveToThread(&dmThread); + dmThread.start(); // show "waiting for internet" page until triggered. - _webView->load(QUrl("qrc:/html/preload.html")); + if (debugMode > -1) { + _webView->load(QUrl("qrc:/html/preload-debug.html")); + } else { + _webView->load(QUrl("qrc:/html/preload.html")); + } //statusBar()->showMessage("Waiting for internet..."); + // start watching for fileToTriggerURL watchForTrigger(); @@ -88,7 +92,7 @@ fbgui::fbgui() { showFullScreen(); } fbgui::~fbgui() { - //dmThread.quit(); + dmThread.quit(); } //------------------------------------------------------------------------------------------- // Layout / actions setup @@ -186,9 +190,10 @@ void fbgui::prepareURLLoad() { // Preparations for URL load //------------------------------------------------------------------------------------------- /** - * This method checks if is connected to the internet. + * This method checks the existance of the host. * - * This method checks if is connected to the internet. + * This method checks if the host exists / can be found. + * The host is from the URL given through the configuration. */ bool fbgui::checkHost() const { QHostInfo hostInfo = QHostInfo::fromName(baseURL.host()); @@ -203,7 +208,7 @@ bool fbgui::checkHost() const { } //------------------------------------------------------------------------------------------- /** - * This method loads the main screen. + * This method tries loads the URL. * * This method loads the main screen via an POST request. If also disconnects the watcher * of the file, (Watcher is set in the fbgui::watchForTrigger() method). @@ -224,6 +229,7 @@ void fbgui::loadURL() { QWSServer::instance()->setCursorVisible(true); _webView->load(req, QNetworkAccessManager::PostOperation, postData); } + // TODO: error page if no host. } //------------------------------------------------------------------------------------------- /** @@ -234,6 +240,8 @@ void fbgui::loadURL() { * The hardwarehash is a MD5 hash over the MAC address and the * mainboard serial number. * The specific serial number is set at the creation of the usb boot stick. + * This file has to be present on the directory specified in + * the configuration for this to work. * * @see SysInfo::getMACAddress() * @see SysInfo::getMainboardSerial() @@ -277,7 +285,7 @@ QByteArray fbgui::generatePOSTData() { } //------------------------------------------------------------------------------------------- -// System Calls Functions +// Shutdown / Reboot of the client //------------------------------------------------------------------------------------------- // TODO One function for reboot and shutdown, with parameter for the action. // for example: doSystemCall(_REBOOT_); @@ -453,3 +461,11 @@ void fbgui::createDebugConsole() { void fbgui::toggleDebugConsole() { (_debugConsole->isVisible()) ? _debugConsole->hide() : _debugConsole->show(); } +//------------------------------------------------------------------------------------------- +// +//------------------------------------------------------------------------------------------- +void fbgui::loadSystem() { + //show loading system page. + _webView->load(QUrl("qrc:/html/loadsystem.html")); + prepareKexec(); +} diff --git a/src/fbgui.h b/src/fbgui.h index 664eea4..48ddce4 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -109,7 +109,8 @@ private slots: void performShutDown(); // reboot the system void performReboot(); - // prepareKexec + // Kexec + void loadSystem(); void prepareKexec(); void runKexec(); }; diff --git a/src/fbgui.qrc b/src/fbgui.qrc index 10a8bd6..8f576cc 100644 --- a/src/fbgui.qrc +++ b/src/fbgui.qrc @@ -8,5 +8,7 @@ <file>html/preload.html</file> <file>html/bg.png</file> <file>html/preload-debug.html</file> + <file>html/loadsystem.css</file> + <file>html/loadsystem.html</file> </qresource> </RCC> diff --git a/src/html/preload-debug.html b/src/html/preload-debug.html index cc69aa1..0aad6c5 100644 --- a/src/html/preload-debug.html +++ b/src/html/preload-debug.html @@ -13,13 +13,13 @@ function quitgui(){ <body> <div id="top"> <h1>Preboot GUI</h1> + <p>Waiting on internet... + <input type="button" name="go" value="load URL" + style="font-size:75%" + onclick="gogo()"> <input type="button" name="quit" value="quit" style="font-size:75%" onclick="quitgui()"> - <p>Waiting on internet...i - <input type="button" name="go" value="click me" - style="font-size:75%" - onclick="gogo()"> </p> </div> <div id="container"> |