diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fbgui.cpp | 23 | ||||
-rw-r--r-- | src/main.cpp | 12 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp index df0919b..c0a8839 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -37,7 +37,7 @@ fbgui::fbgui() qxtLog->debug() << "Initializing fbgui..."; } - // base of the gui + // setup base layout of the gui _webView = new QWebView(this); // debug console split or normal browser if (debugMode == 1) @@ -45,6 +45,7 @@ fbgui::fbgui() else { setCentralWidget(_webView); } + createActions(); // initialize javascript interface JavascriptInterface* jsi = new JavascriptInterface(_webView->page()->mainFrame()); @@ -64,7 +65,7 @@ fbgui::fbgui() QObject::connect(dm, SIGNAL(downloadQueueEmpty()), jsi, SLOT(callbackOnFinished())); - createActions(); + // load content _webView->load(QUrl("qrc:/html/loadAbout.html")); watchForTrigger(); @@ -84,38 +85,36 @@ void fbgui::createActions() this->addAction(_quit); connect(_quit, SIGNAL(triggered()), this, SLOT(close())); } - - //------------------------------------------------------------------------------------------- void fbgui::watchForTrigger() { // check if the directory to fileToTriggerURL exists QFileInfo fi(fileToTriggerURL); if (!fi.absoluteDir().exists()){ - qxtLog->debug() << fi.absolutePath() << " does not exists!"; + qxtLog->debug() << "[watcher] " << fi.absolutePath() << " does not exists!"; if (QDir::home().mkdir(fi.absolutePath())) - qxtLog->debug() << "Successfully created " << fi.absolutePath(); + qxtLog->debug() << "[watcher] Successfully created " << fi.absolutePath(); else - qxtLog->debug() << "Failed to create " << fi.absolutePath(); + qxtLog->debug() << "[watcher] Failed to create " << fi.absolutePath(); } else - qxtLog->debug() << fi.absolutePath() << " exists!"; + qxtLog->debug() << "[watcher] " << fi.absolutePath() << " exists!"; // check if fileToTriggerURL already exists if (fi.exists()){ - qxtLog->debug() << fileToTriggerURL << " exists already!"; + qxtLog->debug() << "[watcher] " << fileToTriggerURL << " exists already!"; // try to remove it QFile file(fi.absoluteFilePath()); if (file.remove()) - qxtLog->debug() << "Purged: " << file.fileName(); + qxtLog->debug() << "[watcher] Purged: " << file.fileName(); else{ - qxtLog->debug() << "Could not remove: " << file.fileName(); + qxtLog->debug() << "[watcher] Could not remove: " << file.fileName(); exit(EXIT_FAILURE); } } else { // watch the path where trigger file is expected - qxtLog->debug() << "Watching " << fi.absolutePath() << " for file: " << fi.fileName(); + qxtLog->debug() << "[watcher] Watching " << fi.absolutePath() << " for file: " << fi.fileName(); QStringList pathToWatch(fi.absolutePath()); _watcher = new QFileSystemWatcher(pathToWatch, this); QObject::connect(_watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(checkForTrigger(const QString&))); diff --git a/src/main.cpp b/src/main.cpp index 0e3ce53..1fa82ee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -50,14 +50,17 @@ int main(int argc, char *argv[]) { switch(opt) { + case 'c': + clOpts.insert("configFile", optarg); + break; case 'u': clOpts.insert("url", optarg); break; case 'd': clOpts.insert("downloadDir", optarg); break; - case 'c': - clOpts.insert("configFile", optarg); + case 's': + clOpts.insert("serialLocation", optarg); break; case 't': clOpts.insert("trigger", optarg); @@ -136,15 +139,14 @@ int main(int argc, char *argv[]) fileToTriggerURL = DEFAULT_FILE_TRIGGER; // set serial location - if (clOpts.contains("serial")) - serialLocation = clOpts.value("serial"); + if (clOpts.contains("serialLocation")) + serialLocation = clOpts.value("serialLocation"); else if (confFileSettings.contains("default/serial_location")) serialLocation = confFileSettings.value("default/serial_location").toString(); else serialLocation = QString("/serial"); // basic std out engine is ugly... not yet initialised so using qDebug - qDebug() << "************* CONFIG INFO *************"; qDebug() << "configFilePath: " << configFilePath; qDebug() << "baseURL: " << baseURL; |