From 9e5d4d97055b5af5b40df94bb8edd895078e5d9f Mon Sep 17 00:00:00 2001 From: Niklas Goby Date: Tue, 12 Apr 2011 19:21:47 +0200 Subject: some more comments in the fbgui class --- src/fbgui.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++++ src/javascriptinterface.cpp | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) 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..."; diff --git a/src/javascriptinterface.cpp b/src/javascriptinterface.cpp index 13bcd38..634b478 100644 --- a/src/javascriptinterface.cpp +++ b/src/javascriptinterface.cpp @@ -10,7 +10,7 @@ * A constructor. * * @param parent - * Is of type QWebFrame. + * Is of type QWebFrame. */ JavascriptInterface::JavascriptInterface(QWebFrame *parent){ qxtLog->debug() << "Initializing javascript interface..."; -- cgit v1.2.3-55-g7522