summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Goby2011-03-21 13:14:54 +0100
committerNiklas Goby2011-03-21 13:14:54 +0100
commitf6c0c3a888a30718059095fe4dac742f6d88769f (patch)
tree6b06557dce49bb85c3b166dad7b6a7e681d4413f
parentcompilable now (diff)
downloadfbgui-f6c0c3a888a30718059095fe4dac742f6d88769f.tar.gz
fbgui-f6c0c3a888a30718059095fe4dac742f6d88769f.tar.xz
fbgui-f6c0c3a888a30718059095fe4dac742f6d88769f.zip
filesystemwatcher works now. firs: load loadAbout.html page
if changes are done in the directory <applicationDir>/testChange/ switch the page to the the real
-rw-r--r--src/fbgui.cpp19
-rw-r--r--src/fbgui.h6
2 files changed, 24 insertions, 1 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index a48b069..4946944 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -30,7 +30,16 @@ fbgui::fbgui()
createActions();
checkHost();
_webView = new QWebView(this);
- _webView->load(baseURL);
+
+ // initialize filesystem watcher
+ _fileSystemWatcher = new QFileSystemWatcher();
+ // QString path //has to be set to some file or directory
+ // TODO change to the real path
+ _fileSystemWatcher->addPath(QApplication::applicationDirPath() + "/testChange/");
+ // qDebug() << QApplication::applicationDirPath() + "/testChange/";
+ QObject::connect(_fileSystemWatcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(ipReceived()));
+
+ _webView->load(QUrl("qrc:/html/loadAbout.html"));
// debug console split or normal browser
if (debugMode == 1)
@@ -113,3 +122,11 @@ void fbgui::checkHost() const
exit(EXIT_FAILURE);
}
}
+//-------------------------------------------------------------------------------------------
+void fbgui::ipReceived()
+{
+ // TODO reload _webView with the real pbs page
+ // qDebug() << "ip received!";
+ _webView->load(baseURL);
+
+}
diff --git a/src/fbgui.h b/src/fbgui.h
index 2d06afe..d68bd6a 100644
--- a/src/fbgui.h
+++ b/src/fbgui.h
@@ -50,6 +50,7 @@ private:
void createActions();
void checkHost() const;
+
// widgets constituing the gui
QWebView* _webView;
QSplitter* _splitter;
@@ -59,10 +60,15 @@ private:
QAction* _quit;
QAction* _toggleDebug;
+ //
+ QFileSystemWatcher* _fileSystemWatcher;
+
private slots:
// slots for processing actions
void toggleDebug();
+ void ipReceived();
+
};
#endif // FBGUI_H