summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Bauer2011-04-25 15:30:30 +0200
committerJonathan Bauer2011-04-25 15:30:30 +0200
commit76f9e4bf6eccce658f98c2563226c84552647b15 (patch)
tree5cf7a8c6c8ec2c33f13fa4ed9b4c837a0e025739 /src
parentpreload & loadsystem lighter theme (diff)
downloadfbgui-76f9e4bf6eccce658f98c2563226c84552647b15.tar.gz
fbgui-76f9e4bf6eccce658f98c2563226c84552647b15.tar.xz
fbgui-76f9e4bf6eccce658f98c2563226c84552647b15.zip
loading system page improved display logic
Diffstat (limited to 'src')
-rw-r--r--src/fbgui.cpp43
-rw-r--r--src/fbgui.h2
2 files changed, 30 insertions, 15 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index 9a0ee1d..b55fb9c 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -44,9 +44,11 @@ fbgui::fbgui() {
createActions();
// initialize javascript interface
- JavascriptInterface* jsi = new JavascriptInterface(_webView->page()->mainFrame());
+ JavascriptInterface* jsi = new JavascriptInterface(
+ _webView->page()->mainFrame());
QObject::connect(jsi, SIGNAL(quitFbgui()), this, SLOT(close()));
- QObject::connect(jsi, SIGNAL(shutDownClient()), this, SLOT(performShutDown()));
+ QObject::connect(jsi, SIGNAL(shutDownClient()), this,
+ SLOT(performShutDown()));
QObject::connect(_webView->page()->mainFrame(), SIGNAL(
javaScriptWindowObjectCleared()), jsi, SLOT(attachToDOM()));
@@ -59,8 +61,9 @@ fbgui::fbgui() {
SLOT(downloadFile(const QString&)));
QObject::connect(dm, SIGNAL(updateProgress(const int&, const double&, const QString&)), jsi,
SLOT(updateProgressBar(const int&, const double&, const QString&)));
- QObject::connect(dm, SIGNAL(downloadQueueEmpty()), jsi, SLOT(callbackOnFinished()));
- QObject::connect(dm, SIGNAL(downloadQueueEmpty()), this, SLOT(loadSystem()));
+ QObject::connect(dm, SIGNAL(downloadQueueEmpty()), jsi, SLOT(
+ callbackOnFinished()));
+ QObject::connect(dm, SIGNAL(downloadQueueEmpty()), this, SLOT(showLoadSystem()));
// move download manager to its own thread
dm->moveToThread(&dmThread);
@@ -145,7 +148,8 @@ void fbgui::watchForTrigger() {
qxtLog->debug() << "[gui] Created: " << fileToTriggerURL;
file.close();
} else {
- qxtLog->debug() << "[gui] Creation of " << fileToTriggerURL << " failed!";
+ qxtLog->debug() << "[gui] Creation of " << fileToTriggerURL
+ << " failed!";
qxtLog->debug() << "[gui] Exiting in 5 seconds...";
QTimer::singleShot(5000, this, SLOT(close()));
}
@@ -153,7 +157,7 @@ void fbgui::watchForTrigger() {
// watch the path to trigger file
qxtLog->debug() << "[watcher] Watching " << fileToTriggerURL;
_watcher = new QFileSystemWatcher(QStringList(fileToTriggerURL), this);
- QObject::connect(_watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(prepareURLLoad()));
+QObject::connect(_watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(prepareURLLoad()));
}
//-------------------------------------------------------------------------------------------
@@ -225,12 +229,19 @@ void fbgui::loadURL() {
void fbgui::loadURLDone(bool success) {
// done contains the success of the loading: false / true
if (!success) {
- qxtLog->debug() << "[gui] Loading failed. URL: " << _webView->url().toString();
+ qxtLog->debug() << "[gui] Loading failed. URL: "
+ << _webView->url().toString();
qxtLog->debug() << "[gui] Exiting in 5 seconds...";
QTimer::singleShot(5000, this, SLOT(close()));
- }
- else {
+ } else {
qxtLog->debug() << "[gui] Loaded URL: " << _webView->url().toString();
+ // if loadsystem, start prepareKexec()
+ if (_webView->url() == QUrl("qrc:/html/loadystem.html")) {
+ qxtLog->debug() << "aosidhailshlashgajglkahgäolh";
+ qxtLog->debug() << "aosidhailshlashgajglkahgäolh";
+ qxtLog->debug() << "aosidhailshlashgajglkahgäolh";
+ prepareKexec();
+ }
}
}
//-------------------------------------------------------------------------------------------
@@ -384,7 +395,8 @@ void fbgui::prepareKexec() {
// load the kernel + initramfs + append of kcl into kexec.
QProcess *process = new QProcess(this);
QString cmdline = "kexec -l " + downloadPath.toUtf8() + "/kernel --initrd="
- + downloadPath.toUtf8() + "/initramfs --append=\"" + kcl.toUtf8() + "\"";
+ + downloadPath.toUtf8() + "/initramfs --append=\"" + kcl.toUtf8()
+ + "\"";
qxtLog->debug() << "[gui] kexec cmdline: " << cmdline;
process->start(cmdline);
bool ret = process->waitForFinished();
@@ -398,8 +410,10 @@ void fbgui::prepareKexec() {
// if process successfully finished, try to run kexec -e
runKexec();
} else {
- qxtLog->debug() << "[gui] Skipping execution of kexec - open debug shell.";
- qxtLog->debug() << "[gui] To start the system execute \"kexec -e\" in your shell.";
+ qxtLog->debug()
+ << "[gui] Skipping execution of kexec - open debug shell.";
+ qxtLog->debug()
+ << "[gui] To start the system execute \"kexec -e\" in your shell.";
close();
}
}
@@ -466,10 +480,11 @@ void fbgui::toggleDebugConsole() {
//-------------------------------------------------------------------------------------------
//
//-------------------------------------------------------------------------------------------
-void fbgui::loadSystem() {
+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"));
- prepareKexec();
}
//-------------------------------------------------------------------------------------------
void fbgui::quitFailure() {
diff --git a/src/fbgui.h b/src/fbgui.h
index 80cbb25..9d19ec2 100644
--- a/src/fbgui.h
+++ b/src/fbgui.h
@@ -113,7 +113,7 @@ private slots:
// reboot the system
void performReboot();
// Kexec
- void loadSystem();
+ void showLoadSystem();
void prepareKexec();
void runKexec();
void quitSuccess();