summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DownloadManager.cpp4
-rw-r--r--src/fbgui.conf2
-rw-r--r--src/fbgui.cpp2
-rw-r--r--src/main.cpp13
-rwxr-xr-xsrc/testApp.sh17
5 files changed, 17 insertions, 21 deletions
diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp
index 2b1cc8a..eec6909 100644
--- a/src/DownloadManager.cpp
+++ b/src/DownloadManager.cpp
@@ -128,9 +128,9 @@ DownloadManager::DownloadManager()
downloadDir = QDir(downloadPath);
// Check if downloadPath exists, if not create it.
if (!downloadDir.exists()){
- if (debug) qDebug() << downloadDir.path() << "doesn't exist.";
+ if (debug) qDebug() << "Download directory: " << downloadDir.path() << "doesn't exist.";
QDir::current().mkdir(downloadPath);
if (downloadDir.exists() && debug) qDebug() << "Created download directory: " << downloadPath;
}
- else if (debug) qDebug() << downloadDir.path() << "exists.";
+ else if (debug) qDebug() << "Download directory: " << downloadDir.path() << "exists.";
}
diff --git a/src/fbgui.conf b/src/fbgui.conf
index 3de418c..2319dbd 100644
--- a/src/fbgui.conf
+++ b/src/fbgui.conf
@@ -1,3 +1,3 @@
[default]
url=http://132.230.4.3/test.html
-downloadDirectory=./downloads
+downloadDirectory=/downloads
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index d764882..ac078e0 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -16,7 +16,7 @@ bool debug = false;
fbgui::fbgui(QApplication *parent)
{
- qDebug() << "Application dir path: " << QApplication::applicationDirPath();
+ if (debug) qDebug() << "Application dir path: " << QApplication::applicationDirPath();
/* Browser init. */
QWebView* webView = new QWebView(this);
webView->load(baseURL);
diff --git a/src/main.cpp b/src/main.cpp
index 92e8819..44efa47 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -53,7 +53,6 @@ int main(int argc, char *argv[])
clo.insert("url", optarg);
break;
case 'd':
- qDebug() << "Read from CLO: DD = " << optarg;
clo.insert("downloadDir", optarg);
break;
case 'D':
@@ -69,10 +68,10 @@ int main(int argc, char *argv[])
if (clo.contains("help"))
printHelp();
// Debug mode
- if (clo.contains("debug"))
- debug = true;
- else
- debug = false;
+ if (clo.contains("debug")){
+ debug = true;
+ qDebug() << "Debug mode activated.";
+ }
// Read the config file, for now hardcoded expected name.
QSettings confFileSettings(app.applicationDirPath() + "/fbgui.conf", QSettings::IniFormat);
confFileSettings.setIniCodec("UTF-8");
@@ -87,15 +86,13 @@ int main(int argc, char *argv[])
// Setting target downloads directory.
if (clo.contains("downloadDir")){
downloadPath = binPath + clo.value("downloadDir");
- if (debug) qDebug() << "clo set downloadDir to: " << binPath + clo.value("downloadDir");
}
else if (confFileSettings.contains("default/downloadDirectory")){
downloadPath = binPath + confFileSettings.value("default/downloadDirectory").toString();
- if (debug) qDebug() << "conf set downloadDir to: " << binPath + confFileSettings.value("default/downloadDirectory").toString();
}
else
downloadPath = binPath + "/downloads";
- if (debug) qDebug() << "Downloads will be saved to: " << downloadPath;
+ if (debug) qDebug() << "Downloads saved in: " << downloadPath;
// Start fbgui.
fbgui gui(&app);
gui.setAttribute(Qt::WA_QuitOnClose, true);
diff --git a/src/testApp.sh b/src/testApp.sh
index 21308c2..4e80f5a 100755
--- a/src/testApp.sh
+++ b/src/testApp.sh
@@ -1,12 +1,10 @@
#!/bin/sh
-# If an argument is passed (=URL), set the URL.
-# If no arg is passed, set the default test URL.
-if [ $# = 0 ]; then
- url="http://132.230.4.3/test.html"
-else
- url=$1
-fi
-
+# Script now simply passes all arguments to the fbgui call.
+# Use: ./testApp.sh [OPTIONS]
+# OPTIONS: -D, --debug
+# -u <url>, --url=<url>
+# -d <dir>, --downloaddir=<dir> (dir relative)
+#
script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
# to get the path only - not the script name - add
@@ -17,7 +15,8 @@ display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}')
/usr/local/Trolltech/Qt-4.7.1/bin/qvfb -width 800 -height 600 -qwsdisplay :$display_id &
sleep 0.1
# Start fbgui.
-$working_path/fbgui -display QVFb:$display_id -D -u $url
+echo "$working_path/fbgui -display QVFb:$display_id $@"
+$working_path/fbgui -display QVFb:$display_id $@
# Check if fbbrowser is not running, if so kill the qvfb.
if [ $(ps aux | grep -v grep | grep -c fbgui) -eq 1 ]
then