summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fbgui/fbgui.cpp23
-rw-r--r--src/fbgui/main.cpp583
-rw-r--r--src/fbgui/sysinfo.cpp12
-rw-r--r--src/fbgui/sysinfo.h1
4 files changed, 315 insertions, 304 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp
index 759c747..c7cbce6 100644
--- a/src/fbgui/fbgui.cpp
+++ b/src/fbgui/fbgui.cpp
@@ -11,7 +11,6 @@ using namespace log4cxx;
using namespace log4cxx::helpers;
LoggerPtr coreLogger(Logger::getLogger("fbgui.core"));
-
#include <iostream>
#include <QThread>
#include <QtWebKit>
@@ -45,8 +44,6 @@ fbgui::~fbgui() {
dmThread.quit();
}
-
-
/**
* init function.
*/
@@ -54,8 +51,10 @@ void fbgui::init() {
// start fbgui
LOG4CXX_DEBUG(coreLogger, "Initializing fbgui...");
- _watcher = new QFileSystemWatcher(this);
+ // init watcher
+ _watcher = new QFileSystemWatcher(this);
+ // setup layout and actions
setupLayout();
createActions();
@@ -488,15 +487,15 @@ void fbgui::createDebugConsole() {
_logFileIn = new QTextStream(_logFile);
if (!_logFile->open(QFile::ReadOnly | QFile::Text)) {
- //do error
+ LOG4CXX_DEBUG(coreLogger, "Could not open log file: " << logFilePath);
+ }
+ else {
+ _debugConsole->setPlainText(_logFileIn->readAll());
+ _debugConsole->moveCursor(QTextCursor::End);
+ // watch log file
+ _watcher->addPath(logFilePath);
+ QObject::connect(_watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(refreshDebugConsole(const QString&)));
}
- _debugConsole->setPlainText(_logFileIn->readAll());
- _debugConsole->moveCursor(QTextCursor::End);
- LOG4CXX_DEBUG(coreLogger, "Log file opened.");
- // watch log file
- _watcher->addPath(logFilePath);
- QObject::connect(_watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(refreshDebugConsole(const QString&)));
-
}
//-------------------------------------------------------------------------------------------
void fbgui::refreshDebugConsole(const QString& fileName) {
diff --git a/src/fbgui/main.cpp b/src/fbgui/main.cpp
index 6284054..d883469 100644
--- a/src/fbgui/main.cpp
+++ b/src/fbgui/main.cpp
@@ -20,299 +20,298 @@ using namespace log4cxx::helpers;
LoggerPtr logger(Logger::getLogger("fbgui"));
void printHelp() {
- QTextStream qout(stdout);
- qout << QObject::tr("Usage: ./fbgui [OPTIONS]") << endl;
- qout << QObject::tr("Options:") << endl;
- qout << "-c <path>, --config=<path> " << QObject::tr(
- "Path to configuration file.") << endl;
- qout << "-u <URL>, --url=<URL> " << QObject::tr(
- "Sets the URL to be loaded.") << endl;
- qout << "-d <path>, --download=<path> " << QObject::tr(
- "Specify the download directory.") << endl;
- qout << "-t <path, --trigger=<path> " << QObject::tr(
- "Specify location of the file triggering the URL load.") << endl;
- qout << "-s <path, --serial=<path> " << QObject::tr(
- "Specify location of the file containing the serial number.") << endl;
- qout << "-D <level>, --debug=<level> " << QObject::tr(
- "Activate debug mode. [0,1]") << endl;
- qout << "-h, --help " << QObject::tr(
- "Prints this help.") << endl;
- qout.flush();
- exit( EXIT_SUCCESS);
+ QTextStream qout(stdout);
+ qout << QObject::tr("Usage: ./fbgui [OPTIONS]") << endl;
+ qout << QObject::tr("Options:") << endl;
+ qout << "-c <path>, --config=<path> "
+ << QObject::tr("Path to configuration file.") << endl;
+ qout << "-u <URL>, --url=<URL> "
+ << QObject::tr("Sets the URL to be loaded.") << endl;
+ qout << "-d <path>, --download=<path> "
+ << QObject::tr("Specify the download directory.") << endl;
+ qout
+ << "-t <path, --trigger=<path> "
+ << QObject::tr(
+ "Specify location of the file triggering the URL load.")
+ << endl;
+ qout
+ << "-s <path, --serial=<path> "
+ << QObject::tr(
+ "Specify location of the file containing the serial number.")
+ << endl;
+ qout << "-D <level>, --debug=<level> "
+ << QObject::tr("Activate debug mode. [0,1]") << endl;
+ qout << "-h, --help "
+ << QObject::tr("Prints this help.") << endl;
+ qout.flush();
+ exit(EXIT_SUCCESS);
}
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).
-
- QFileInfo loggingConfInfo = QFileInfo(QDir::home(), ".fbgui.logging.conf");
- QString loggingConfigFilePath;
- if (loggingConfInfo.exists())
- loggingConfigFilePath = loggingConfInfo.absoluteFilePath();
- else {
- loggingConfInfo = QFileInfo(QString("/etc/fbgui.logging.conf"));
- if (loggingConfInfo.exists())
- loggingConfigFilePath = loggingConfInfo.absoluteFilePath();
- else
- loggingConfigFilePath = "";
- }
-
- if (loggingConfigFilePath.length() > 0) {
- // BasicConfigurator replaced with PropertyConfigurator.
- PropertyConfigurator::configure(loggingConfigFilePath.toStdString());
- } else {
- BasicConfigurator::configure();
- }
-
- QApplication app(argc, argv, QApplication::GuiServer);
- app.setOrganizationName("team_projekt_2011");
- app.setApplicationName("prebootGUI");
- binPath = QApplication::applicationDirPath();
-
- QTranslator translator;
- translator.load(":" + QLocale::system().name());
- app.installTranslator(&translator);
-
- // parse command line arguments using getopt
- QMap<QString, QString> clOpts;
- int longIndex = 0;
- static const char *optString = "c:u:d:s:t:D:hl:nS:p:e:";
- static const struct option longOpts[] = { { "config", required_argument,
- NULL, 'c' }, { "url", required_argument, NULL, 'u' }, { "download",
- required_argument, NULL, 'd' }, { "serial", required_argument, NULL,
- 's' }, { "trigger", required_argument, NULL, 't' }, { "debug",
- required_argument, NULL, 'D' }, { "help", no_argument, NULL, 'h' }, {
- "log", required_argument, NULL, 'l' },
- { "nd", no_argument, NULL, 'n' }, { "server", required_argument, NULL,
- 'S' }, { "autoup", no_argument, NULL, 'a' }, {
- "socketserverpath", required_argument, NULL, 'p' }, {
- "pathtoexe", required_argument, NULL, 'e' } };
- int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
- while (opt != -1) {
- switch (opt) {
- case 'c':
- clOpts.insert("configFile", optarg);
- break;
- case 'l':
- clOpts.insert("logFile", optarg);
- break;
- case 'u':
- clOpts.insert("url", optarg);
- break;
- case 'd':
- clOpts.insert("downloadDir", optarg);
- break;
- case 's':
- clOpts.insert("serialLocation", optarg);
- break;
- case 't':
- clOpts.insert("trigger", optarg);
- break;
- case 'D':
- clOpts.insert("debug", optarg);
- break;
- case 'h':
- clOpts.insert("help", "help");
- break;
- case 'n':
- clOpts.insert("nd", "nd");
- break;
- case 'S':
- clOpts.insert("server", optarg);
- break;
- case 'a':
- clOpts.insert("autoup", "autoup");
- break;
- case 'p':
- clOpts.insert("socketserverpath", optarg);
- break;
- case 'e':
- clOpts.insert("pathtoexe", optarg);
- break;
- }
- opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
- }
-
- if (clOpts.contains("help"))
- printHelp();
-
- if (clOpts.contains("debug")) {
- debugMode = clOpts.value("debug").toInt();
- // start basic debug output on terminal
- // qxtLog->disableLoggerEngine("DEFAULT");
- // qxtLog->enableLogLevels(QxtLogger::DebugLevel);
- // qxtLog->addLoggerEngine("std_logger", new LoggerEngine_std);
- // qxtLog->initLoggerEngine("std_logger");
- // qxtLog->setMinimumLevel("std_logger", QxtLogger::DebugLevel);
- } else
- debugMode = -1;
-
- // 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"))
- configFilePath = clOpts.value("configFile");
- else {
- confInfo = QFileInfo(QDir::home(), ".fbgui.conf");
- if (confInfo.exists())
- configFilePath = confInfo.absoluteFilePath();
- else {
- confInfo = QFileInfo(QString("/etc/fbgui.conf"));
- if (confInfo.exists())
- configFilePath = QString("/etc/fbgui.conf");
- else
- configFilePath = DEFAULT_CONFIG_PATH;
- }
- }
-
- // read the config file
- QSettings confFileSettings(configFilePath, QSettings::IniFormat);
- confFileSettings.setIniCodec("UTF-8");
-
- // set base URL to be loaded
- if (clOpts.contains("url"))
- baseURL = QUrl(clOpts.value("url"));
- else if (confFileSettings.contains("default/pbs_url"))
- baseURL = confFileSettings.value("default/pbs_url").toUrl();
- else
- baseURL = DEFAULT_URL;
-
- // set directory for downloads
- if (clOpts.contains("downloadDir"))
- downloadPath = clOpts.value("downloadDir");
- else if (confFileSettings.contains("default/download_directory"))
- downloadPath
- = confFileSettings.value("default/download_directory").toString();
- else
- downloadPath = DEFAULT_DOWNLOAD_DIR;
-
- // set update interval for download progress functions of download manager.
- if (confFileSettings.contains("default/update_interval"))
- updateInterval
- = confFileSettings.value("default/update_interval").toInt();
- else
- updateInterval = DEFAULT_UPDATE_INTERVAL;
-
- // 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"))
- fileToTriggerURL
- = confFileSettings.value("default/file_trigger").toString();
- else
- fileToTriggerURL = DEFAULT_FILE_TRIGGER;
-
- // set serial location
- if (clOpts.contains("serialLocation"))
- serialLocation = clOpts.value("serialLocation");
- else if (confFileSettings.contains("default/serial_location"))
- serialLocation
- = confFileSettings.value("default/serial_location").toString();
- else
- serialLocation = QString("/serial"); // tests
-
- // save ip config location (file generated by uchpc)
- if (confFileSettings.contains("default/ip_config"))
- ipConfigFilePath = confFileSettings.value("default/ip_config").toString();
-
- // save path to log file
- if (clOpts.contains("logFile"))
- logFilePath = clOpts.value("logFile");
- else if (confFileSettings.contains("default/log_file"))
- logFilePath = confFileSettings.value("default/log_file").toString();
- else
- logFilePath = DEFAULT_LOG_FILE_PATH;
-
- //
- if (clOpts.contains("server"))
- gServerIp = clOpts.value("server");
- else if (confFileSettings.contains("default/server"))
- gServerIp = confFileSettings.value("default/server").toString();
- else
- gServerIp = "209.85.148.105"; //that is a google server. change this to a proper default address
-
- //
- if (clOpts.contains("autoup"))
- gAutoUp = true;
- else if (confFileSettings.contains("default/autoup"))
- gAutoUp = confFileSettings.value("default/autoup").toBool();
- else
- gAutoUp = false;
-
- //
- if (clOpts.contains("socketserverpath"))
- gSocketServerPath = clOpts.value("socketserverpath");
- else if (confFileSettings.contains("default/socketserverpath"))
- gSocketServerPath
- = confFileSettings.value("default/socketserverpath").toString();
- else
- gSocketServerPath = DEFAULT_QTSOCKETADDRESS;
-
- //
- if (clOpts.contains("pathtoexe"))
- gPathToDhcpExe = clOpts.value("pathtoexe");
- else if (confFileSettings.contains("default/pathtoexe"))
- gPathToDhcpExe = confFileSettings.value("default/pathtoexe").toString();
- else
- gPathToDhcpExe = DEFAULT_PATHTODHCPCDEXE;
-
- // write always a log file
- // // activate file logger if debug mode activated.
- // if (debugMode > -1) {
- // start debug logging to file.
- // qxtLog->addLoggerEngine("file_logger", new LoggerEngine_file(logFilePath));
- // qxtLog->setMinimumLevel("file_logger", QxtLogger::DebugLevel);
- // }
-
- // print config
- LOG4CXX_DEBUG(logger, "************* CONFIG INFO *************");
- LOG4CXX_DEBUG(logger, "configFilePath: " << configFilePath);
- LOG4CXX_DEBUG(logger, "logFilePath: " << logFilePath);
- LOG4CXX_DEBUG(logger, "ipConfigFilePath: " << ipConfigFilePath);
- LOG4CXX_DEBUG(logger, "baseURL: " << baseURL.toString());
- LOG4CXX_DEBUG(logger, "downloadDir : " << downloadPath);
- LOG4CXX_DEBUG(logger, "trigger: " << fileToTriggerURL);
- LOG4CXX_DEBUG(logger, "serialLocation: " << serialLocation);
- if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
- LOG4CXX_DEBUG(logger, "*******************************************");
- LOG4CXX_DEBUG(logger, "Network Discovery activated:");
- LOG4CXX_DEBUG(logger, "server: " << gServerIp);
- LOG4CXX_DEBUG(logger, "autoup: " << gAutoUp);
- LOG4CXX_DEBUG(logger, "socketserverpath: " << gSocketServerPath);
- LOG4CXX_DEBUG(logger, "pathtoexe: " << gPathToDhcpExe);
- } else {
- LOG4CXX_DEBUG(logger, "Network Discovery deactivated.");
- }
- LOG4CXX_DEBUG(logger, "*******************************************");
-
- // set invisible cursor
- //QWSServer::instance()->setCursorVisible(false);
-
- // set default keyboard / mouse drivers. TODO: fix this, doesn't work...
- //QWSServer::instance()->setDefaultKeyboard("TTY:/dev/tty0");
- //QWSServer::instance()->setDefaultMouse("IntelliMouse:/dev/mice");
-
-
- fbgui gui;
- ndgui ngui;
-
- if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
- LOG4CXX_DEBUG(logger, "Initializing ndgui...");
- QObject::connect(&ngui, SIGNAL(initFbgui()), &gui, SLOT(init()));
- ngui.init();
- ngui.show();
- } else {
- gui.init();
- gui.show();
- }
-
- return app.exec();
+ // 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).
+
+ QFileInfo loggingConfInfo = QFileInfo(QDir::home(), ".fbgui.logging.conf");
+ QString loggingConfigFilePath;
+ if (loggingConfInfo.exists())
+ loggingConfigFilePath = loggingConfInfo.absoluteFilePath();
+ else {
+ loggingConfInfo = QFileInfo(QString("/etc/fbgui.logging.conf"));
+ if (loggingConfInfo.exists())
+ loggingConfigFilePath = loggingConfInfo.absoluteFilePath();
+ else
+ loggingConfigFilePath = "";
+ }
+
+ if (loggingConfigFilePath.length() > 0) {
+ // BasicConfigurator replaced with PropertyConfigurator.
+ PropertyConfigurator::configure(loggingConfigFilePath.toStdString());
+ } else {
+ BasicConfigurator::configure();
+ }
+
+ QApplication app(argc, argv, QApplication::GuiServer);
+ app.setOrganizationName("team_projekt_2011");
+ app.setApplicationName("prebootGUI");
+ binPath = QApplication::applicationDirPath();
+
+ QTranslator translator;
+ translator.load(":" + QLocale::system().name());
+ app.installTranslator(&translator);
+
+ // parse command line arguments using getopt
+ QMap<QString, QString> clOpts;
+ int longIndex = 0;
+ static const char *optString = "c:u:d:s:t:D:hl:nS:p:e:";
+ static const struct option longOpts[] = { { "config", required_argument,
+ NULL, 'c' }, { "url", required_argument, NULL, 'u' }, { "download",
+ required_argument, NULL, 'd' }, { "serial", required_argument, NULL,
+ 's' }, { "trigger", required_argument, NULL, 't' }, { "debug",
+ required_argument, NULL, 'D' }, { "help", no_argument, NULL, 'h' },
+ { "log", required_argument, NULL, 'l' }, { "nd", no_argument, NULL,
+ 'n' }, { "server", required_argument, NULL, 'S' }, {
+ "autoup", no_argument, NULL, 'a' }, { "socketserverpath",
+ required_argument, NULL, 'p' }, { "pathtoexe",
+ required_argument, NULL, 'e' } };
+ int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
+ while (opt != -1) {
+ switch (opt) {
+ case 'c':
+ clOpts.insert("configFile", optarg);
+ break;
+ case 'l':
+ clOpts.insert("logFile", optarg);
+ break;
+ case 'u':
+ clOpts.insert("url", optarg);
+ break;
+ case 'd':
+ clOpts.insert("downloadDir", optarg);
+ break;
+ case 's':
+ clOpts.insert("serialLocation", optarg);
+ break;
+ case 't':
+ clOpts.insert("trigger", optarg);
+ break;
+ case 'D':
+ clOpts.insert("debug", optarg);
+ break;
+ case 'h':
+ clOpts.insert("help", "help");
+ break;
+ case 'n':
+ clOpts.insert("nd", "nd");
+ break;
+ case 'S':
+ clOpts.insert("server", optarg);
+ break;
+ case 'a':
+ clOpts.insert("autoup", "autoup");
+ break;
+ case 'p':
+ clOpts.insert("socketserverpath", optarg);
+ break;
+ case 'e':
+ clOpts.insert("pathtoexe", optarg);
+ break;
+ }
+ opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
+ }
+
+ if (clOpts.contains("help"))
+ printHelp();
+
+ if (clOpts.contains("debug")) {
+ debugMode = clOpts.value("debug").toInt();
+ } else
+ debugMode = -1;
+
+ // 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"))
+ configFilePath = clOpts.value("configFile");
+ else {
+ confInfo = QFileInfo(QDir::home(), ".fbgui.conf");
+ if (confInfo.exists())
+ configFilePath = confInfo.absoluteFilePath();
+ else {
+ confInfo = QFileInfo(QString("/etc/fbgui.conf"));
+ if (confInfo.exists())
+ configFilePath = QString("/etc/fbgui.conf");
+ else
+ configFilePath = DEFAULT_CONFIG_PATH;
+ }
+ }
+
+ // read the config file
+ QSettings confFileSettings(configFilePath, QSettings::IniFormat);
+ confFileSettings.setIniCodec("UTF-8");
+
+ // set base URL to be loaded
+ if (clOpts.contains("url"))
+ baseURL = QUrl(clOpts.value("url"));
+ else if (confFileSettings.contains("default/pbs_url"))
+ baseURL = confFileSettings.value("default/pbs_url").toUrl();
+ else
+ baseURL = DEFAULT_URL;
+
+ // set directory for downloads
+ if (clOpts.contains("downloadDir"))
+ downloadPath = clOpts.value("downloadDir");
+ else if (confFileSettings.contains("default/download_directory"))
+ downloadPath =
+ confFileSettings.value("default/download_directory").toString();
+ else
+ downloadPath = DEFAULT_DOWNLOAD_DIR;
+
+ // set update interval for download progress functions of download manager.
+ if (confFileSettings.contains("default/update_interval"))
+ updateInterval =
+ confFileSettings.value("default/update_interval").toInt();
+ else
+ updateInterval = DEFAULT_UPDATE_INTERVAL;
+
+ // 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"))
+ fileToTriggerURL =
+ confFileSettings.value("default/file_trigger").toString();
+ else
+ fileToTriggerURL = DEFAULT_FILE_TRIGGER;
+
+ // set serial location
+ if (clOpts.contains("serialLocation"))
+ serialLocation = clOpts.value("serialLocation");
+ else if (confFileSettings.contains("default/serial_location"))
+ serialLocation =
+ confFileSettings.value("default/serial_location").toString();
+ else
+ serialLocation = QString("/serial"); // tests
+
+ // save ip config location (file generated by uchpc)
+ if (confFileSettings.contains("default/ip_config"))
+ ipConfigFilePath =
+ confFileSettings.value("default/ip_config").toString();
+
+ // save path to log file
+ if (clOpts.contains("logFile"))
+ logFilePath = clOpts.value("logFile");
+ else if (confFileSettings.contains("default/log_file"))
+ logFilePath = confFileSettings.value("default/log_file").toString();
+ else
+ logFilePath = DEFAULT_LOG_FILE_PATH;
+
+ //
+ if (clOpts.contains("server"))
+ gServerIp = clOpts.value("server");
+ else if (confFileSettings.contains("default/server"))
+ gServerIp = confFileSettings.value("default/server").toString();
+ else
+ gServerIp = "209.85.148.105"; //that is a google server. change this to a proper default address
+
+ //
+ if (clOpts.contains("autoup"))
+ gAutoUp = true;
+ else if (confFileSettings.contains("default/autoup"))
+ gAutoUp = confFileSettings.value("default/autoup").toBool();
+ else
+ gAutoUp = false;
+
+ //
+ if (clOpts.contains("socketserverpath"))
+ gSocketServerPath = clOpts.value("socketserverpath");
+ else if (confFileSettings.contains("default/socketserverpath"))
+ gSocketServerPath =
+ confFileSettings.value("default/socketserverpath").toString();
+ else
+ gSocketServerPath = DEFAULT_QTSOCKETADDRESS;
+
+ //
+ if (clOpts.contains("pathtoexe"))
+ gPathToDhcpExe = clOpts.value("pathtoexe");
+ else if (confFileSettings.contains("default/pathtoexe"))
+ gPathToDhcpExe = confFileSettings.value("default/pathtoexe").toString();
+ else
+ gPathToDhcpExe = DEFAULT_PATHTODHCPCDEXE;
+
+ // write always a log file
+ // // activate file logger if debug mode activated.
+ // if (debugMode > -1) {
+ // start debug logging to file.
+ // qxtLog->addLoggerEngine("file_logger", new LoggerEngine_file(logFilePath));
+ // qxtLog->setMinimumLevel("file_logger", QxtLogger::DebugLevel);
+ // }
+
+ // print config
+ LOG4CXX_DEBUG(logger, "************* CONFIG INFO *************");
+ LOG4CXX_DEBUG(logger, "configFilePath: " << configFilePath);
+ LOG4CXX_DEBUG(logger, "logFilePath: " << logFilePath);
+ LOG4CXX_DEBUG(logger, "ipConfigFilePath: " << ipConfigFilePath);
+ LOG4CXX_DEBUG(logger, "baseURL: " << baseURL.toString());
+ LOG4CXX_DEBUG(logger, "downloadDir : " << downloadPath);
+ LOG4CXX_DEBUG(logger, "trigger: " << fileToTriggerURL);
+ LOG4CXX_DEBUG(logger, "serialLocation: " << serialLocation);
+ if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
+ LOG4CXX_DEBUG(logger, "*******************************************");
+ LOG4CXX_DEBUG(logger, "Network Discovery activated:");
+ LOG4CXX_DEBUG(logger, "server: " << gServerIp);
+ LOG4CXX_DEBUG(logger, "autoup: " << gAutoUp);
+ LOG4CXX_DEBUG(logger, "socketserverpath: " << gSocketServerPath);
+ LOG4CXX_DEBUG(logger, "pathtoexe: " << gPathToDhcpExe);
+ } else {
+ LOG4CXX_DEBUG(logger, "Network Discovery deactivated.");
+ }LOG4CXX_DEBUG(logger, "*******************************************");
+
+ // set invisible cursor
+ //QWSServer::instance()->setCursorVisible(false);
+
+ // set default keyboard / mouse drivers. TODO: fix this, doesn't work...
+ //QWSServer::instance()->setDefaultKeyboard("TTY:/dev/tty0");
+ //QWSServer::instance()->setDefaultMouse("IntelliMouse:/dev/mice");
+
+ fbgui gui;
+ ndgui ngui;
+
+ if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
+ LOG4CXX_DEBUG(logger, "Initializing ndgui...");
+ QObject::connect(&ngui, SIGNAL(initFbgui()), &gui, SLOT(init()));
+ ngui.init();
+ ngui.show();
+ } else {
+ gui.init();
+ gui.show();
+ }
+
+ return app.exec();
}
diff --git a/src/fbgui/sysinfo.cpp b/src/fbgui/sysinfo.cpp
index d1ac44f..1af6f76 100644
--- a/src/fbgui/sysinfo.cpp
+++ b/src/fbgui/sysinfo.cpp
@@ -46,11 +46,23 @@ const QString SysInfo::getInfo(const QString& infoName) {
return getMainboardSerial();
else if (infoName == QString("usb"))
return getUsbVendorIdProductIdSerialNumber();
+ else if (infoName == QString("mac"))
+ return getMACAddress();
/* unknown code */
LOG4CXX_DEBUG(siLogger, "unknown requested");
return "info_error";
}
+const QString SysInfo::getMACAddress() {
+ // Returns MAC address of eth0 for now
+ QNetworkInterface qni = QNetworkInterface::interfaceFromName(QString("eth0"));
+ if (!qni.isValid()) {
+ //qxtLog->debug() << "[sysinfo] MAC Address: No interface matching \"eth0\" found.";
+ return "no_eth0";
+ }
+ //eth0_index = qni.index();
+ return qni.hardwareAddress();
+}
// -----------------------------------------------------------------------------------------------
// Mainboard / USB Infos using libsysfs
// -----------------------------------------------------------------------------------------------
diff --git a/src/fbgui/sysinfo.h b/src/fbgui/sysinfo.h
index a4c5a48..08717ac 100644
--- a/src/fbgui/sysinfo.h
+++ b/src/fbgui/sysinfo.h
@@ -41,6 +41,7 @@ public:
private:
// private system information readers
+ const QString getMACAddress();
const QString getMainboardSerial();
const QString getUsbVendorIdProductIdSerialNumber();