summaryrefslogtreecommitdiffstats
path: root/src/fbgui.cpp
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-21 14:28:49 +0100
committerJonathan Bauer2011-03-21 14:28:49 +0100
commit48e3b223b885ab2b1691b082da994972aa845908 (patch)
tree6114b22a9253c00683c2fbb7ad8ecd9e18a37b2c /src/fbgui.cpp
parentloadAbout.html added (diff)
downloadfbgui-48e3b223b885ab2b1691b082da994972aa845908.tar.gz
fbgui-48e3b223b885ab2b1691b082da994972aa845908.tar.xz
fbgui-48e3b223b885ab2b1691b082da994972aa845908.zip
checkHost now returns bool
Diffstat (limited to 'src/fbgui.cpp')
-rw-r--r--src/fbgui.cpp30
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"));
}