diff options
| -rw-r--r-- | src/DownloadManager.cpp | 3 | ||||
| -rw-r--r-- | src/DownloadManager.h | 2 | ||||
| -rw-r--r-- | src/fbgui.cpp | 1 | ||||
| -rw-r--r-- | src/fbgui.h | 1 | ||||
| -rw-r--r-- | src/main.cpp | 23 | ||||
| -rwxr-xr-x | src/testApp.sh | 2 |
6 files changed, 19 insertions, 13 deletions
diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index d105498..ce0e82a 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -1,7 +1,6 @@ #include "DownloadManager.h" -int downloaded = 0; - +int DownloadManager::downloaded = 0; // ---------------------------------------------------------------------------------------- void DownloadManager::downloadFile(QString& filename){ if (debug) qDebug() << "DM received signal for: " << filename; diff --git a/src/DownloadManager.h b/src/DownloadManager.h index 8973eed..3003ad6 100644 --- a/src/DownloadManager.h +++ b/src/DownloadManager.h @@ -28,7 +28,7 @@ private: QFile outfile; // Download-in-progress flag. bool dip; - int downloaded; + static int downloaded; signals: void finished(); diff --git a/src/fbgui.cpp b/src/fbgui.cpp index da72c21..f3fd320 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -8,6 +8,7 @@ #include <QtWebKit> #include <QApplication> + QUrl baseURL(DEFAULT_URL); QDir downloadDirectory("./downloads/"); bool debug = false; diff --git a/src/fbgui.h b/src/fbgui.h index fdd4477..fe5242b 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -7,6 +7,7 @@ #define DEFAULT_URL "http://www.google.com" +extern QString binPath; extern QUrl baseURL; extern QDir downloadDirectory; extern bool debug; diff --git a/src/main.cpp b/src/main.cpp index 81e10dc..6f3d283 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) /* Parse cmdline argus. */ QMap<QString, QString> clo; int longIndex = 0; - static const char *optString = "u:hDd"; + static const char *optString = "u:hDd:"; static const struct option longOpts[] = { {"url", required_argument, NULL, 'u'}, @@ -53,14 +53,15 @@ int main(int argc, char *argv[]) clo.insert("url", optarg); break; case 'd': - clo.insert("downloadDir", optarg); - break; + qDebug() << "Read from CLO: DD = " << optarg; + clo.insert("downloadDir", optarg); + break; case 'D': - clo.insert("debug", "debug"); - break; + clo.insert("debug", "debug"); + break; case 'h': - clo.insert("help", "help"); - break; + clo.insert("help", "help"); + break; } opt = getopt_long(argc, argv, optString, longOpts, &longIndex); } @@ -83,10 +84,14 @@ int main(int argc, char *argv[]) else baseURL = DEFAULT_URL; - if (clo.contains("downloadDir")) + if (clo.contains("downloadDir")){ downloadDirectory = QDir(clo.value("downloadDir")); - else if (confFileSettings.contains("default/downloadDirectory")) + if (debug) qDebug() << "downloadDir set to: " << clo.value("downloadDir"); + } + else if (confFileSettings.contains("default/downloadDirectory")){ downloadDirectory = QDir(confFileSettings.value("default/downloadDirectory").toString()); + if (debug) qDebug() << "downloadDir set to: " << confFileSettings.value("default/downloadDirectory").toString(); + } else downloadDirectory = QDir("."); if (debug) qDebug() << "Downloads will be saved to: " << downloadDirectory.dirName(); diff --git a/src/testApp.sh b/src/testApp.sh index 21308c2..7ff12a4 100755 --- a/src/testApp.sh +++ b/src/testApp.sh @@ -17,7 +17,7 @@ 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 +$working_path/fbgui -display QVFb:$display_id -D -u $url -d ./downdir/ # Check if fbbrowser is not running, if so kill the qvfb. if [ $(ps aux | grep -v grep | grep -c fbgui) -eq 1 ] then |
