diff options
Diffstat (limited to 'src/fbgui.cpp')
| -rw-r--r-- | src/fbgui.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 6511dca..1130f68 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -28,7 +28,6 @@ fbgui::fbgui() // base of the gui createActions(); - checkHost(); _webView = new QWebView(this); watchDHCP(); @@ -105,29 +104,30 @@ void fbgui::toggleDebug() _debugConsole->show(); } //------------------------------------------------------------------------------------------- -void fbgui::checkHost() const +bool fbgui::checkHost() const { // TODO instead of closing app, show error page from qrc QHostInfo hostInfo = QHostInfo::fromName(baseURL.host()); if (hostInfo.error() != QHostInfo::NoError){ qxtLog->debug() << "Lookup of " << baseURL.host() << "failed. Exiting..."; - exit(EXIT_FAILURE); + return false; } + else + return true; } //------------------------------------------------------------------------------------------- void fbgui::ipReceived(const QString& name) { - 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!"; - + 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() @@ -138,6 +138,6 @@ void fbgui::watchDHCP() // 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&))); + QObject::connect(_fileSystemWatcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(ipReceived(const QString&))); _webView->load(QUrl("qrc:/html/loadAbout.html")); } |
