From 1fe9c90f77990e740c205a5113340583146536e8 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 1 Feb 2012 15:31:48 +0100 Subject: adapted existing classes to reflect changes --- src/fbgui/fbgui.h | 60 +++---------------------------------------------------- 1 file changed, 3 insertions(+), 57 deletions(-) (limited to 'src/fbgui/fbgui.h') diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h index 4891194..2feafa1 100644 --- a/src/fbgui/fbgui.h +++ b/src/fbgui/fbgui.h @@ -23,6 +23,8 @@ #include #include +#include "agui.h" + // Internal default settings #define DEFAULT_URL "http://www.google.com" #define DEFAULT_DOWNLOAD_DIR "/tmp/fbgui" @@ -45,7 +47,7 @@ extern QUrl baseURL; extern int debugMode; extern int updateInterval; -class fbgui: public QMainWindow +class fbgui : public agui { Q_OBJECT @@ -57,68 +59,12 @@ public slots: void init(); private: - //------------------- - // 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(); - // 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(); - - //---------------------------------------- - // 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: - //---------------------------------- - // 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: - //------------------ - // closes the main window provoking the application to quit. - QAction* _quit; - // triggers toggleDebugConsole() - QAction* _toggleDebugConsole; - - // watcher to detect changes in the observed directory. - QFileSystemWatcher* _watcher; - QFile* _logFile; - QTextStream* _logFileIn; - private slots: - // toggles debug console when action _toggleDebugConsole happens. - void toggleDebugConsole(); - void refreshDebugConsole(const QString&); - - // This function is triggered by fileChanged Signal of _watcher. - // It deletes _watcher, since we don't need it anymore and tries to load URL. - void prepareURLLoad(const QString&); void loadURLDone(bool success); - - // shut off the system - void performShutDown(); - // reboot the system - void performReboot(); - // shows "loading system" page void loadSystem(); // prepares kexec by loading downloaded initramfs, kernel into kexec void prepareKexec(); -- cgit v1.2.3-55-g7522 From 3084244f6af4492582c05d27819b6aa61e36c688 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 1 Feb 2012 15:46:36 +0100 Subject: sysInfo gets interface name for MAC adress from networkdiscovery --- src/fbgui/fbgui.cpp | 2 +- src/fbgui/fbgui.h | 1 + src/fbgui/main.cpp | 2 -- src/fbgui/ndgui.cpp | 4 +++- src/fbgui/sysinfo.cpp | 17 +++++------------ 5 files changed, 10 insertions(+), 16 deletions(-) (limited to 'src/fbgui/fbgui.h') diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp index ee74452..7bf84e8 100644 --- a/src/fbgui/fbgui.cpp +++ b/src/fbgui/fbgui.cpp @@ -57,7 +57,7 @@ void fbgui::init() { _webView->page()->mainFrame()); QObject::connect(jsi, SIGNAL(quitFbgui()), this, SLOT(close())); QObject::connect(jsi, SIGNAL(shutDownClient()), this, - SLOT(performShutDown())); + SLOT(shutdownSystem())); QObject::connect(_webView->page()->mainFrame(), SIGNAL( javaScriptWindowObjectCleared()), jsi, SLOT(attachToDOM())); diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h index 2feafa1..46c3b9b 100644 --- a/src/fbgui/fbgui.h +++ b/src/fbgui/fbgui.h @@ -46,6 +46,7 @@ extern QString downloadPath; extern QUrl baseURL; extern int debugMode; extern int updateInterval; +extern QString interfaceName; class fbgui : public agui { diff --git a/src/fbgui/main.cpp b/src/fbgui/main.cpp index e14e683..6286b9f 100644 --- a/src/fbgui/main.cpp +++ b/src/fbgui/main.cpp @@ -10,10 +10,8 @@ #include #include "qlog4cxx.h" -#include "agui.h" #include "fbgui.h" #include "ndgui.h" -#include "console.h" #include "../common/fbgui.h" diff --git a/src/fbgui/ndgui.cpp b/src/fbgui/ndgui.cpp index 34a3f2d..67bfa79 100644 --- a/src/fbgui/ndgui.cpp +++ b/src/fbgui/ndgui.cpp @@ -24,7 +24,7 @@ QString gServerIp(""); bool gAutoUp = true; QString gSocketServerPath(""); QString gPathToDhcpExe(""); - +QString interfaceName(""); /** @@ -233,6 +233,7 @@ void ndgui::handleAllProcessesFinished() { void ndgui::continueBoot(QString ifName) { if (_networkDiscovery->checkConnectivity(ifName)) { LOG4CXX_DEBUG(ndLogger, " continue with interface: " << ifName); + interfaceName = ifName; emit initFbgui(); this->close(); } else { @@ -248,6 +249,7 @@ void ndgui::continueBoot(QString ifName) { */ void ndgui::continueBootWithoutCheck(QString ifName) { LOG4CXX_DEBUG(ndLogger, " continue with interface: " << ifName); + interfaceName = ifName; emit initFbgui(); this->close(); } diff --git a/src/fbgui/sysinfo.cpp b/src/fbgui/sysinfo.cpp index 6338025..807413b 100644 --- a/src/fbgui/sysinfo.cpp +++ b/src/fbgui/sysinfo.cpp @@ -41,7 +41,6 @@ SysInfo::~SysInfo() { * @see JavascriptInterface::getSysInfo(const QString& info) */ const QString SysInfo::getInfo(const QString& infoName) { - LOG4CXX_DEBUG(siLogger, "requested " << infoName); if (infoName == QString("mbserial")) return getMainboardSerial(); else if (infoName == QString("usb")) @@ -55,12 +54,12 @@ const QString SysInfo::getInfo(const QString& infoName) { } const QString SysInfo::getMACAddress() { // Returns MAC address of eth0 for now - QNetworkInterface qni = QNetworkInterface::interfaceFromName(QString("eth0")); + LOG4CXX_DEBUG(siLogger, "Requesting MAC of: " << interfaceName << " ..."); + QNetworkInterface qni = QNetworkInterface::interfaceFromName(interfaceName); if (!qni.isValid()) { - //qxtLog->debug() << "[sysinfo] MAC Address: No interface matching \"eth0\" found."; - return "no_eth0"; + LOG4CXX_DEBUG(siLogger, "No valid interface with name: " << interfaceName); + return "no_interface"; } - //eth0_index = qni.index(); return qni.hardwareAddress(); } // ----------------------------------------------------------------------------------------------- @@ -82,6 +81,7 @@ const QString SysInfo::getMACAddress() { * @see SysInfo::getInfo(const QString& infoName) */ const QString SysInfo::getMainboardSerial() { + LOG4CXX_DEBUG(siLogger, "Requesting Mainboard Serial..."); QString out = ""; struct sysfs_class_device *class_device = sysfs_open_class_device("dmi", "id"); @@ -214,11 +214,4 @@ const QString SysInfo::getUsbVendorIdProductIdSerialNumber() { } libusb_free_device_list(devs, 1); //free the list, unref the devices in it libusb_exit(ctx); //close the session - - - /* - QByteArray json = serializer.serialize(list); - LOG4CXX_DEBUG(siLogger, tag + "json object: " + json); - return json; - */ } -- cgit v1.2.3-55-g7522