From 79de7cb99904109346870bc95fc2eef585c500d0 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 25 Apr 2011 16:33:51 +0200 Subject: 1sec delay between loading page showing & preparing kexec --- src/fbgui.cpp | 28 +++++++++++++--------------- src/fbgui.h | 13 ++++++------- 2 files changed, 19 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/fbgui.cpp b/src/fbgui.cpp index b55fb9c..45524eb 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -63,7 +63,7 @@ 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(showLoadSystem())); + QObject::connect(dm, SIGNAL(downloadQueueEmpty()), this, SLOT(loadSystem())); // move download manager to its own thread dm->moveToThread(&dmThread); @@ -350,6 +350,14 @@ void fbgui::performReboot() { //------------------------------------------------------------------------------------------- // Preparing Kernel Switch per kexec (initiating Stage 3) //------------------------------------------------------------------------------------------- +void fbgui::loadSystem() { + //show loading system page. + //_webView->disconnect(this); + //QObject::connect(_webView, SIGNAL(loadFinished(bool)), this, SLOT(prepareKexec())); + _webView->load(QUrl("qrc:/html/loadsystem.html")); + QTimer::singleShot(1000, this, SLOT(prepareKexec())); +} +//------------------------------------------------------------------------------------------- /** * This method prepares kexec. * @@ -426,9 +434,9 @@ void fbgui::prepareKexec() { * */ void fbgui::runKexec() { - QProcess *process = new QProcess(this); - process->startDetached("kexec -e"); - if (!process->waitForStarted()) { + QProcess process; + process.startDetached("kexec -e"); + if (!process.waitForStarted()) { qxtLog->debug() << "[gui] Failed to execute: kexec -e"; qxtLog->debug() << "[gui] Exiting in 5 seconds..."; QTimer::singleShot(5000, this, SLOT(close())); @@ -479,15 +487,5 @@ void fbgui::toggleDebugConsole() { } //------------------------------------------------------------------------------------------- // + //------------------------------------------------------------------------------------------- -void fbgui::showLoadSystem() { - //show loading system page. - _webView->disconnect(this); - QObject::connect(_webView, SIGNAL(loadFinished(bool)), this, SLOT(prepareKexec())); - _webView->load(QUrl("qrc:/html/loadsystem.html")); -} -//------------------------------------------------------------------------------------------- -void fbgui::quitFailure() { -} -void fbgui::quitSuccess() { -} diff --git a/src/fbgui.h b/src/fbgui.h index 9d19ec2..35197d8 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -103,8 +103,8 @@ private slots: // toggles debug console when action _toggleDebugConsole happens. void toggleDebugConsole(); - // triggered by fileChanged Signal of _watcher - // deletes _watcher, since we don't need it anymore and tries to load URL. + // This function is triggered by fileChanged Signal of _watcher. + // It deletes _watcher, since we don't need it anymore and tries to load URL. void prepareURLLoad(); void loadURLDone(bool success); @@ -112,13 +112,12 @@ private slots: void performShutDown(); // reboot the system void performReboot(); - // Kexec - void showLoadSystem(); + // shows "loading system" page + void loadSystem(); + // prepares kexec by loading downloaded initramfs, kernel into kexec void prepareKexec(); + // executes: kexec -e void runKexec(); - void quitSuccess(); - void quitFailure(); - }; #endif // FBGUI_H -- cgit v1.2.3-55-g7522