summaryrefslogtreecommitdiffstats
path: root/src/fbgui.cpp
diff options
context:
space:
mode:
authorNiklas Goby2011-04-12 19:21:47 +0200
committerNiklas Goby2011-04-12 19:21:47 +0200
commit9e5d4d97055b5af5b40df94bb8edd895078e5d9f (patch)
tree31ff9cdeda07369c2ba7b300319b88ecef5b66e1 /src/fbgui.cpp
parentadded some comments in according to the doxigen (diff)
downloadfbgui-9e5d4d97055b5af5b40df94bb8edd895078e5d9f.tar.gz
fbgui-9e5d4d97055b5af5b40df94bb8edd895078e5d9f.tar.xz
fbgui-9e5d4d97055b5af5b40df94bb8edd895078e5d9f.zip
some more comments in the fbgui class
Diffstat (limited to 'src/fbgui.cpp')
-rw-r--r--src/fbgui.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index 30a6011..0cf3868 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -19,6 +19,16 @@ QString sessionID("");
int debugMode = -1;
//-------------------------------------------------------------------------------------------
+/**
+ * A constructor.
+ *
+ * The constructor of the fbgui class. It initializes the main objects
+ * which are needed while the program is running.
+ * The appearance of the webView is here also defined.
+ *
+ * @see JavascriptInterface
+ * @see DownloadManager
+ */
fbgui::fbgui()
{
// test for libsys function
@@ -66,6 +76,14 @@ fbgui::fbgui()
//-------------------------------------------------------------------------------------------
// Layout / actions setup
//-------------------------------------------------------------------------------------------
+/**
+ * This method sets the used Layout.
+ *
+ * This method sets the used Layout. Possible layout are:
+ * - browser mode: only the browser is visible
+ * - debug mode: the screen is divided into the browser and a debug
+ * out console
+ */
void fbgui::setupLayout()
{
// setup layout of the gui: debug split or browser
@@ -82,6 +100,9 @@ void fbgui::setupLayout()
setCentralWidget(_webView);
}
//-------------------------------------------------------------------------------------------
+/**
+ * This method enables a shortcut for closing the program.
+ */
void fbgui::createActions()
{
// CTRL + X to kill the gui
@@ -93,6 +114,15 @@ void fbgui::createActions()
//-------------------------------------------------------------------------------------------
// File system watching
//-------------------------------------------------------------------------------------------
+/**
+ * This method sets a "watchdog" to a special file.
+ *
+ * This method sets a "watchdog" to a special file. If needed it creates the
+ * file which it has to watch over. It than connects a QFileSystemWatcher with
+ * this file. If changes happen to this file, the
+ * fbgui::checkForTrigger(const QString& dirname) method will be called.
+ *
+ */
void fbgui::watchForTrigger()
{
// check if the directory to fileToTriggerURL exists
@@ -131,6 +161,16 @@ void fbgui::watchForTrigger()
}
}
//-------------------------------------------------------------------------------------------
+/**
+ * This method checks if the trigger was valid.
+ *
+ * This method checks if the trigger was valid. If yes,
+ * we have received an IP Address an can load the main screen.
+ * If not, something some error happened.
+ *
+ * @see fbgui::checkHost()
+ * @see fbgui::loadURL()
+ */
void fbgui::checkForTrigger(const QString& dirname)
{
// check if fileToTriggerURL exists in the directory where the change occured
@@ -148,6 +188,11 @@ void fbgui::checkForTrigger(const QString& dirname)
//-------------------------------------------------------------------------------------------
// Preparations for URL load
//-------------------------------------------------------------------------------------------
+/**
+ * This method checks if is connected to the internet.
+ *
+ * This method checks if is connected to the internet.
+ */
bool fbgui::checkHost() const
{
QHostInfo hostInfo = QHostInfo::fromName(baseURL.host());
@@ -161,6 +206,16 @@ bool fbgui::checkHost() const
}
}
//-------------------------------------------------------------------------------------------
+/**
+ * This method loads the main screen.
+ *
+ * This method loads the main screen via an POST request. If also disconnects the watcher
+ * of the file, (Watcher is set in the fbgui::watchForTrigger() method).
+ * and generates the POST data body.
+ *
+ * @see fbgui::watchForTrigger()
+ * @see fbgui::generatePOSTData()
+ */
void fbgui::loadURL()
{
// disconnect _watcher, his job is done
@@ -174,6 +229,18 @@ void fbgui::loadURL()
_webView->load(req, QNetworkAccessManager::PostOperation, postData);
}
//-------------------------------------------------------------------------------------------
+/**
+ * This method generates the POST data body.
+ *
+ * This method generates the POST data body. The body contains the
+ * MAC address, an hardwarehas and a specific serial number.
+ * The hardwarehash is a MD5 hash over the MAC address and the
+ * mainboard serial number.
+ * The specific serial number is set at the creation of the usb boot stick.
+ *
+ * @see SysInfo::getMACAddress()
+ * @see SysInfo::getMainboardSerial()
+ */
QByteArray fbgui::generatePOSTData()
{
qxtLog->debug() << "[gui] Generating POST data...";