summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2011-04-24 18:10:03 +0200
committerJonathan Bauer2011-04-24 18:10:03 +0200
commite1e2bc138cafa1e5f26b377b36d31812f59c5e35 (patch)
tree4a052687daef44562b68f7fdb05823ca684203ae
parentAUTHORS more info (diff)
downloadfbgui-e1e2bc138cafa1e5f26b377b36d31812f59c5e35.tar.gz
fbgui-e1e2bc138cafa1e5f26b377b36d31812f59c5e35.tar.xz
fbgui-e1e2bc138cafa1e5f26b377b36d31812f59c5e35.zip
old test
-rwxr-xr-xbuild.sh2
-rw-r--r--src/downloadmanager.cpp18
-rw-r--r--src/fbgui.h2
-rw-r--r--src/javascriptinterface.cpp30
-rw-r--r--src/main.cpp24
5 files changed, 40 insertions, 36 deletions
diff --git a/build.sh b/build.sh
index 8ea3fc5..2eabc4f 100755
--- a/build.sh
+++ b/build.sh
@@ -1,7 +1,7 @@
#!/bin/bash
QT_VERSION=QtEmbedded-4.7.2
-rm fbgui.tgz
+[ -f fbgui.tgz ] && rm fbgui.tgz
mkdir -p pkg
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index adbedd1..22c1c09 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -103,8 +103,9 @@ void DownloadManager::startNextDownload() {
if (downloadDir.exists(tmp)) {
qxtLog->debug() << "[dm] File already exists: "
<< downloadDir.absoluteFilePath(tmp);
- outfile.setFileName(QString(downloadDir.absolutePath() + "/" + tmp
- + ".\%1").arg(downloaded));
+ outfile.setFileName(
+ QString(downloadDir.absolutePath() + "/" + tmp + ".\%1").arg(
+ downloaded));
} else
outfile.setFileName(downloadDir.absoluteFilePath(tmp));
qxtLog->debug() << "[dm] Saving to: " << outfile.fileName();
@@ -172,7 +173,8 @@ void DownloadManager::downloadProgress(qint64 bytesIn, qint64 bytesTotal) {
currentProgress = ((bytesIn * 100) / bytesTotal);
if (currentProgress - lastProgress >= updateInterval) {
lastProgress = currentProgress;
- emit updateProgress(currentProgress, speed, unit);
+ emit
+ updateProgress(currentProgress, speed, unit);
qxtLog->debug() << "[dm] Download progress of "
<< currentDownload->url().toString() << ": " << bytesIn << "/"
<< bytesTotal << "(" << currentProgress << "\%)";
@@ -189,8 +191,8 @@ void DownloadManager::downloadFinished() {
qxtLog->debug() << "[dm] Download of "
<< currentDownload->url().toString()
<< " failed with HTTP error code: " << statusCode;
- emit notify(QString("Download failed! HTTP Status Code: %1").arg(
- statusCode));
+ emit
+ notify(QString("Download failed! HTTP Status Code: %1").arg(statusCode));
currentDownload->deleteLater();
} else {
// end download
@@ -199,8 +201,10 @@ void DownloadManager::downloadFinished() {
qxtLog->debug() << "[dm] Download of "
<< currentDownload->url().toString() << " finished. (downloaded = "
<< downloaded << ")";
- emit notify(QString("Successfully downloaded %1").arg(
- currentDownload->url().toString()));
+ emit
+ notify(
+ QString("Successfully downloaded %1").arg(
+ currentDownload->url().toString()));
currentDownload->deleteLater();
}
dip = false;
diff --git a/src/fbgui.h b/src/fbgui.h
index 5c3247d..98ab4c4 100644
--- a/src/fbgui.h
+++ b/src/fbgui.h
@@ -28,7 +28,7 @@
#define DEFAULT_URL "http://www.google.com"
#define DEFAULT_DOWNLOAD_DIR "/tmp/fbgui"
#define DEFAULT_CONFIG_PATH "/etc/fbgui.conf"
-#define DEFAULT_LOG_FILE_PATH "/tmp/fbgui.log2"
+#define DEFAULT_LOG_FILE_PATH "/tmp/fbgui.log"
#define DEFAULT_UPDATE_INTERVAL 1;
#define DEFAULT_QRC_HTML_DIR ":/html"
#define DEFAULT_FILE_TRIGGER "/tmp/fbgui/trigger"
diff --git a/src/javascriptinterface.cpp b/src/javascriptinterface.cpp
index eba4027..18949ae 100644
--- a/src/javascriptinterface.cpp
+++ b/src/javascriptinterface.cpp
@@ -56,23 +56,23 @@ void JavascriptInterface::loadJQuery() {
QDir qrcJSDir(pathToJsDir);
QFileInfoList fiList = qrcJSDir.entryInfoList();
QFileInfo fi;
-foreach(fi, fiList)
-{
- if (fi.suffix() == "js") {
- //qDebug()<< fi.fileName();
- //qxtLog->debug() << fi.fileName();
- if (fi.fileName() != "test.js") {
- QFile file;
- file.setFileName(pathToJsDir + "/" + fi.fileName());
- file.open(QIODevice::ReadOnly);
- js = file.readAll();
- file.close();
+ foreach(fi, fiList)
+ {
+ if (fi.suffix() == "js") {
+ //qDebug()<< fi.fileName();
+ //qxtLog->debug() << fi.fileName();
+ if (fi.fileName() != "test.js") {
+ QFile file;
+ file.setFileName(pathToJsDir + "/" + fi.fileName());
+ file.open(QIODevice::ReadOnly);
+ js = file.readAll();
+ file.close();
- _parent->evaluateJavaScript(js);
- //qxtLog->debug() << "evaluated " + fi.fileName();
+ _parent->evaluateJavaScript(js);
+ //qxtLog->debug() << "evaluated " + fi.fileName();
+ }
+ }
}
- }
-}
}
//-------------------------------------------------------------------------------------------------------
// Javascript functions for webpage
diff --git a/src/main.cpp b/src/main.cpp
index d51bc02..c913b40 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -174,9 +174,10 @@ int main(int argc, char *argv[]) {
ipConfigFilePath = confFileSettings.value("default/ip_config").toString();
// save path to log file
- if (clOpts.contains("logFile")){
- logFilePath = clOpts.value("logFile");qxtLog->debug() << "LOG FILE: " << clOpts.value("logFile");}
- else if (confFileSettings.contains("default/log_file"))
+ if (clOpts.contains("logFile")) {
+ logFilePath = clOpts.value("logFile");
+ qxtLog->debug() << "LOG FILE: " << clOpts.value("logFile");
+ } else if (confFileSettings.contains("default/log_file"))
logFilePath = confFileSettings.value("default/log_file").toString();
else
logFilePath = DEFAULT_LOG_FILE_PATH;
@@ -184,20 +185,19 @@ int main(int argc, char *argv[]) {
// activate file logger if debug mode activated.
if (debugMode > -1) {
// start debug logging to file.
- qxtLog->addLoggerEngine("file_logger",
- new LoggerEngine_file(logFilePath));
+ qxtLog->addLoggerEngine("file_logger", new LoggerEngine_file(logFilePath));
qxtLog->setMinimumLevel("file_logger", QxtLogger::DebugLevel);
}
// print config
qxtLog->debug() << "************* CONFIG INFO *************";
- qxtLog->debug() << "configFilePath: " << configFilePath.toUtf8();
- qxtLog->debug() << "logFilePath: " << logFilePath.toUtf8();
- qxtLog->debug() << "ipConfigFilePath:" << ipConfigFilePath.toUtf8();
- qxtLog->debug() << "baseURL: " << baseURL.toString().toUtf8();
- qxtLog->debug() << "downloadDir : " << downloadPath.toUtf8();
- qxtLog->debug() << "trigger: " << fileToTriggerURL.toUtf8();
- qxtLog->debug() << "serialLocation: " << serialLocation.toUtf8();
+ qxtLog->debug() << "configFilePath: " << configFilePath.toUtf8();
+ qxtLog->debug() << "logFilePath: " << logFilePath.toUtf8();
+ qxtLog->debug() << "ipConfigFilePath: " << ipConfigFilePath.toUtf8();
+ qxtLog->debug() << "baseURL: " << baseURL.toString().toUtf8();
+ qxtLog->debug() << "downloadDir : " << downloadPath.toUtf8();
+ qxtLog->debug() << "trigger: " << fileToTriggerURL.toUtf8();
+ qxtLog->debug() << "serialLocation: " << serialLocation.toUtf8();
qxtLog->debug() << "*******************************************";
// set invisible cursor