summaryrefslogtreecommitdiffstats
path: root/src/fbgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fbgui.cpp')
-rw-r--r--src/fbgui.cpp37
1 files changed, 24 insertions, 13 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"));
+}