From 9254ecb8588906f998bcf5fa973a4df289249ac3 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 11 Apr 2011 15:26:40 +0200 Subject: started inline documentation --- src/fbgui.h | 35 ++++++++++++++++++++++++++++------- src/main.cpp | 17 ++++++++++++++--- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/src/fbgui.h b/src/fbgui.h index d385426..4ad17df 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -51,32 +51,53 @@ public: fbgui(); private: - // layout setup + //------------------- + // layout setup: + //------------------- + // Sets the layout depending on the debug mode: + // no debug or debugMode = 0 -> only browser shown. + // debugMode = 1 -> split main window in browser and debug console. void setupLayout(); + // Create all actions for the GUI. (Currently only quit.) void createActions(); - // debug console setup + // Create a debug console widget as QTextEdit in order to print debug messages + // directly within the GUI. This was needed since ttys can't really be used + // for debugging purposes in the preboot environment. void createDebugConsole(); - // functions to control the loading of baseURL + //---------------------------------------- + // control the display of components: + //---------------------------------------- + // watches for the file triggering the loading of the URL. + // the file can be specified by the corresponding option. void watchForTrigger(); bool checkHost() const; void loadURL(); QByteArray generatePOSTData(); - // widgets constituing the gui + //---------------------------------- + // widgets constituing the gui: + //---------------------------------- + // QWebView for displaying internet content QWebView* _webView; + // QSplitter to split the main window in two resizable frames. QSplitter* _splitter; + // QTextEdit implementing a minimalistic debug console. QTextEdit* _debugConsole; - // action list + //------------------ + // action list: + //------------------ + // closes the main window provoking the application to quit. QAction* _quit; + // triggers toggleDebugConsole() QAction* _toggleDebugConsole; - // watcher to detect changes in the observed directory + // watcher to detect changes in the observed directory. QFileSystemWatcher* _watcher; private slots: - // action slots + // toggles debug console when action _toggleDebugConsole happens. void toggleDebugConsole(); // checks if the change reported by _watcher is the one we are looking for diff --git a/src/main.cpp b/src/main.cpp index b9643c1..ad86396 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,6 +25,13 @@ void printHelp() int main(int argc, char *argv[]) { + // Initialisation of the QApplication: + // In QT, every application is composed of two separate + // components: the GUI-Client and the GUI-Server. + // + // The third parameter sets the application as the + // GUI-Server (aswell as the GUI-Client). + QApplication app(argc, argv, QApplication::GuiServer); app.setOrganizationName("team_projekt_2011"); app.setApplicationName("prebootGUI"); @@ -34,7 +41,7 @@ int main(int argc, char *argv[]) translator.load(":" + QLocale::system().name()); app.installTranslator(&translator); - // parse command line arguments + // parse command line arguments using getopt QMap clOpts; int longIndex = 0; static const char *optString = "c:u:d:s:t:D:h"; @@ -94,7 +101,11 @@ int main(int argc, char *argv[]) else debugMode = -1; - // look for config file + // look for config file either in: + // - the path found in the configuration file + // - the user's home directory (as .fbgui.conf) + // - /etc/fbgui.conf + QString configFilePath; QFileInfo confInfo; if (clOpts.contains("configFile")) @@ -137,7 +148,7 @@ int main(int argc, char *argv[]) else updateInterval = DEFAULT_UPDATE_INTERVAL; - // sets which file to watch to trigger loading of URL + // set which file to watch to trigger loading of URL if (clOpts.contains("trigger")) fileToTriggerURL = clOpts.value("trigger"); else if (confFileSettings.contains("default/file_trigger")) -- cgit v1.2.3-55-g7522