diff options
| author | Niklas Goby | 2011-03-21 14:13:52 +0100 |
|---|---|---|
| committer | Niklas Goby | 2011-03-21 14:13:52 +0100 |
| commit | 8706d06738380a26bca8f76db85cd6038f50eb91 (patch) | |
| tree | 9a0f490e0caed4362e80252e72578f89354810bf /src | |
| parent | filesystemwatcher works now. firs: load loadAbout.html page (diff) | |
| download | fbgui-8706d06738380a26bca8f76db85cd6038f50eb91.tar.gz fbgui-8706d06738380a26bca8f76db85cd6038f50eb91.tar.xz fbgui-8706d06738380a26bca8f76db85cd6038f50eb91.zip | |
some changes in the filesystemwatcher
add tow new methods
Diffstat (limited to 'src')
| -rw-r--r-- | src/fbgui.cpp | 37 | ||||
| -rw-r--r-- | src/fbgui.h | 3 |
2 files changed, 26 insertions, 14 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 4946944..6511dca 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -31,15 +31,7 @@ fbgui::fbgui() checkHost(); _webView = new QWebView(this); - // 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")); + watchDHCP(); // debug console split or normal browser if (debugMode == 1) @@ -123,10 +115,29 @@ void fbgui::checkHost() const } } //------------------------------------------------------------------------------------------- -void fbgui::ipReceived() +void fbgui::ipReceived(const QString& name) { - // TODO reload _webView with the real pbs page - // qDebug() << "ip received!"; - _webView->load(baseURL); + QFileInfo fi(name + "/foo"); + if (fi.exists()){ + qxtLog->debug() << "correct file!"; + if (checkHost()){ + qxtLog->debug() << "DHCP active, loading URL..."; + _webView->load(baseURL); + } + } + else + qxtLog->debug() << "weird file!"; } +//------------------------------------------------------------------------------------------- +void fbgui::watchDHCP() +{ + qxtLog->debug() << "Watching /etc/fbgui"; + QStringList pathToWatch("/etc/fbgui"); + _fileSystemWatcher = new QFileSystemWatcher(pathToWatch, this); + // QString path //has to be set to some file or directory + // TODO change to the real path + // _fileSystemWatcher->addPath(QApplication::applicationDirPath() + "/testChange/"); + QObject::connect(_watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(ipReceived(const QString&))); + _webView->load(QUrl("qrc:/html/loadAbout.html")); +} diff --git a/src/fbgui.h b/src/fbgui.h index d68bd6a..2821a31 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -49,6 +49,7 @@ private: void setupDebugSplit(); void createActions(); void checkHost() const; + void watchDHCP(); // widgets constituing the gui @@ -67,7 +68,7 @@ private slots: // slots for processing actions void toggleDebug(); - void ipReceived(); + void ipReceived(const QString& name); }; |
