diff options
author | Niklas Goby | 2011-03-21 13:14:54 +0100 |
---|---|---|
committer | Niklas Goby | 2011-03-21 13:14:54 +0100 |
commit | f6c0c3a888a30718059095fe4dac742f6d88769f (patch) | |
tree | 6b06557dce49bb85c3b166dad7b6a7e681d4413f /src | |
parent | compilable now (diff) | |
download | fbgui-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
Diffstat (limited to 'src')
-rw-r--r-- | src/fbgui.cpp | 19 | ||||
-rw-r--r-- | src/fbgui.h | 6 |
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 |