summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas2011-10-25 18:57:40 +0200
committerNiklas2011-10-25 18:57:40 +0200
commite942d5d431346439533910bf649b10ec17463c03 (patch)
treec6d16dc9c1376d51c587eaa8049d2fafa080a8e6
parentno working (diff)
downloadfbgui-e942d5d431346439533910bf649b10ec17463c03.tar.gz
fbgui-e942d5d431346439533910bf649b10ec17463c03.tar.xz
fbgui-e942d5d431346439533910bf649b10ec17463c03.zip
fixed some bugs. show log screen is now bigger and opens a scrollbar automatically. debug screens added. fixed continue in debug mode, added progress indicator for all screens.
-rw-r--r--src/fbgui.qrc3
-rw-r--r--src/html/images/loading.gifbin0 -> 8787 bytes
-rw-r--r--src/html/js/networkDiscovery.js22
-rw-r--r--src/html/networkdiscovery.css5
-rw-r--r--src/html/networkdiscovery.html207
-rw-r--r--src/html/networkdiscovery_debug.html85
-rw-r--r--src/html/networkdiscovery_userchoice.html13
-rw-r--r--src/html/networkdiscovery_userchoice_debug.html33
-rw-r--r--src/main.cpp4
-rw-r--r--src/ndgui.cpp99
-rw-r--r--src/ndgui.h14
-rw-r--r--src/networkdiscovery.cpp1
12 files changed, 276 insertions, 210 deletions
diff --git a/src/fbgui.qrc b/src/fbgui.qrc
index 77d852a..a5333c5 100644
--- a/src/fbgui.qrc
+++ b/src/fbgui.qrc
@@ -29,5 +29,8 @@
<file>html/css/images/ui-icons_ef8c08_256x240.png</file>
<file>html/css/images/ui-icons_ffd27a_256x240.png</file>
<file>html/css/images/ui-icons_ffffff_256x240.png</file>
+ <file>html/networkdiscovery_debug.html</file>
+ <file>html/networkdiscovery_userchoice_debug.html</file>
+ <file>html/images/loading.gif</file>
</qresource>
</RCC>
diff --git a/src/html/images/loading.gif b/src/html/images/loading.gif
new file mode 100644
index 0000000..cbe59fb
--- /dev/null
+++ b/src/html/images/loading.gif
Binary files differ
diff --git a/src/html/js/networkDiscovery.js b/src/html/js/networkDiscovery.js
index f26385b..1057bd7 100644
--- a/src/html/js/networkDiscovery.js
+++ b/src/html/js/networkDiscovery.js
@@ -1,3 +1,9 @@
+var hideProgressIndicator = function () {
+ $("#ajaxBusy").hide();
+};
+
+
+
var updateTips = function ( t ) {
$( ".validateTips" )
.text( t )
@@ -39,10 +45,16 @@ var checkRegexp = function ( o, regexp, n ) {
var showLog = function (t) {
$("#nd_show_log_msg").html(t);
//$("#nd_show_log_msg").attr('readonly','readonly');
+ $('#nd_show_log_dialog').resizable("enable");
$("#nd_show_log_dialog").dialog(
- { minWidth: 450,
+ { minWidth: 600,
+ maxHeight: 400,
modal: true,
- draggable: false
+ draggable: false,
+ closeOnEscape: false,
+ open: function(event, ui) {
+ $(this).css({'max-height': 400, 'overflow-y': 'auto'});
+ },
});
};
@@ -152,6 +164,7 @@ var ip4_manualConfigurationDialog = function () {
modal: true,
resizable: false,
draggable: false,
+ closeOnEscape: false,
close: function() {allFields.val("").removeClass("ui-state-error");},
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
});
@@ -180,6 +193,7 @@ var abortBootDialog = function (m) {
modal: true,
resizable: false,
draggable: false,
+ closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
});
};
@@ -217,6 +231,7 @@ var chooseInterfaceDialog = function (i) {
modal: true,
resizable: false,
draggable: false,
+ closeOnEscape: false,
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
});
}
@@ -246,6 +261,7 @@ var updateIfStatus = function(i, s){
var addInterface = function (i){
+ hideProgressIndicator();
$("#nd_progress_container").append(
"<div class='interface'>"+
" Interface: " +i+
@@ -254,7 +270,7 @@ var addInterface = function (i){
" style='height: 10px;'></div>"+
"</div>"
);
- $("#"+i+"_progress").progressbar({ value: 33 });
+ //$("#"+i+"_progress").progressbar({ value: 33 });
};
diff --git a/src/html/networkdiscovery.css b/src/html/networkdiscovery.css
index a111ef6..1d3b406 100644
--- a/src/html/networkdiscovery.css
+++ b/src/html/networkdiscovery.css
@@ -64,6 +64,11 @@ aside {
display:none;
}
+#ajaxBusy {
+ margin-left: auto;
+ margin-right: auto;
+}
+
textarea {
width: 400px;
height: 200px;
diff --git a/src/html/networkdiscovery.html b/src/html/networkdiscovery.html
index 1f24b0d..b8c24cd 100644
--- a/src/html/networkdiscovery.html
+++ b/src/html/networkdiscovery.html
@@ -7,208 +7,17 @@
<script type="text/javascript" src="qrc:/html/js/jquery-ui-1.8.16.min.js"></script>
<script type="text/javascript" src="qrc:/html/js/networkDiscovery.js"></script>
-<!--
-<script type="text/javascript">
-
-var updateTips = function ( t ) {
- $( ".validateTips" )
- .text( t )
- .addClass( "ui-state-highlight" );
- setTimeout(
- function() {
- $( ".validateTips" ).removeClass( "ui-state-highlight", 1500 );
- },
- 500 );
-};
-
-var checkLength = function ( o, n, min, max ) {
- if ( o.val().length > max || o.val().length < min ) {
- o.addClass( "ui-state-error" );
- updateTips( "Length of " + n + " must be between " +
- min + " and " + max + "." );
- return false;
- } else {
- return true;
- }
-};
-
-var checkRegexp = function ( o, regexp, n ) {
- if ( !( regexp.test( o.val() ) ) ) {
- o.addClass( "ui-state-error" );
- updateTips( n );
- return false;
- } else {
- return true;
- }
-};
-
-var showLog = function (t) {
- $("#nd_show_log_msg").val(t);
- $("#nd_show_log_msg").attr('readonly','readonly');
- $("#nd_show_log_dialog").dialog(
- { minWidth: 450,
- modal: true,
- resizable: false,
- draggable: false
- });
-};
-
-var ip4_manualConfigurationDialog = function () {
- var jsonArr = fbgui.getManualConfInterfaces();
- //jsonArr = eval('(' + jsonArr + ')');
- var c = "<select name='nd_mc_ifname_select' id='nd_mc_ifname_select'>";
- if(jsonArr == "") {
- c += "<option>NO INTERFACE</option>";
- } else {
- jQuery.each(jsonArr, function() {
- c += " <option>"+ this +"</option>";
- }
- );
- }
- c += "</select>";
- $("#nd_mc_ifname").html(c);
-
- var ifname = $("#nd_mc_ifname_select :selected").text(),
- ipaddr = $("#ipaddr"),
- netmask = $("#netmask"),
- broadcast = $("#broadcast"),
- gateway = $("#gateway"),
- dns = $("#dns"),
- allFields = $([]).add(ipaddr).add(netmask).add(broadcast).add(gateway).add(dns);
-
-
- $("#nd_manual_configuration_dialog").dialog(
- { buttons: { "Cancel": function() {
- $(this).dialog("close");},
- "Ok": function() {
- var bValid = true;
- allFields.removeClass("ui-state-error");
-
- bValid = bValid && checkLength(ipaddr, "IP-Address", 7, 15);
- bValid = bValid && checkLength(netmask, "Netmask Address", 7, 15);
- bValid = bValid && checkLength(broadcast, "Broadcast Address", 7, 15);
- bValid = bValid && checkLength(gateway, "Gateway Address", 7, 15);
- bValid = bValid && checkLength(dns, "DNS Address", 7, 15);
- bValid = bValid && checkRegexp(ipaddr, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 192.168.1.2 (max value is 255)");
- bValid = bValid && checkRegexp(netmask, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 255.255.255.0 (max value is 255)");
- bValid = bValid && checkRegexp(broadcast, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 192.168.1.255 (max value is 255)");
- bValid = bValid && checkRegexp(gateway, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 192.168.1.254 (max value is 255)");
- bValid = bValid && checkRegexp(dns, /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/, "Is not a valid IP-Address! Format has to be e.g.: 192.168.1.111 (max value is 255)");
-
- if (bValid) {
- // put variables into a json object
- // send to qt networkdiscovery
- var o = {"ifname" : ifname,
- "ipaddr" : ipaddr.val(),
- "netmask" : netmask.val(),
- "broadcast" : broadcast.val(),
- "gateway" : gateway.val(),
- "dns" : dns.val() }
- try {
- fbgui.ip4_setManualConfiguration(o);
- } catch (e) {
- fbgui.notifyCall(e);
- }
- $(this).dialog("close");
- } }
- } ,
- minWidth: 450,
- modal: true,
- resizable: false,
- draggable: false,
- close: function() {allFields.val("").removeClass("ui-state-error");},
- open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
- });
-};
-
-var abortBootDialog = function (m) {
- fbgui.notifyCall("abortBootDialog");
- $("#nd_abort_boot_msg").html(m);
- $("#nd_abort_boot_dialog").dialog(
- { buttons: { "Manual Configure": function() {
- ip4_manualConfigurationDialog();},
- "Show Log": function() {
- var text = fbgui.readLogFile();
- showLog(text);
- $(this).dialog("close");},
- "Restart": function() {fbgui.restartSystem();
- $(this).dialog("close"); },
- "Shut Down": function() { fbgui.shutDownSystem();
- $(this).dialog("close"); }
- } ,
- minWidth: 450,
- modal: true,
- resizable: false,
- draggable: false,
- open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
- });
-};
-
-var chooseInterfaceDialog = function (i) {
- var cb = "<label> Choose your interface: </label>"+
- "<select id='nd_ifName_select'>";
- jQuery.each(i, function() {
- cb += " <option>"+ this +"</option>";
- }
- );
- cb += "</select>";
-
- $("#nd_choose_interface_msg").html(cb);
- $("#nd_choose_interface_dialog").dialog(
- { buttons: { "Manual Configure": function() {
- ip4_manualConfigurationDialog();},
- "Show Log": function() {
- var text = fbgui.readLogFile();
- showLog(text);},
- "Restart": function() {fbgui.restartSystem();
- $(this).dialog("close"); },
- "Shut Down": function() { fbgui.shutDownSystem();
- $(this).dialog("close"); },
- "Continue": function() {
- var ifName = $("#nd_ifName_select :selected").text();
- fbgui.continueBoot(ifName,1);
- $(this).dialog("close");
- }
- } ,
- minWidth: 550,
- modal: true,
- resizable: false,
- draggable: false,
- open: function(event, ui) { $(".ui-dialog-titlebar-close").hide();}
- });
-}
-
-var updateStatus = function (s){
-
-};
+<script type="text/javascript">
+// prepare the form when the DOM is ready
+$(document).ready(function() {
+ // Setup the ajax indicator
+ $("#nd_status").append('<div id="ajaxBusy"><p><img src="qrc:/html/images/loading.gif"></p></div>');
+});
-var updateIfProgressBar = function (i, p){
- if (p >= 0 && p <= 100){
- $("#"+i+"_progress").progressbar({ value: p });
- }else{
- $("#"+i+"_progress").progressbar({ value: 0 });
- }
-};
+</script>
-var updateIfStatus = function(i, s){
- $("#"+i+"_status").html(s);
-};
-var addInterface = function (i){
- $("#nd_progress_container").append(
- "<div class='interface'>"+
- " Interface: " +i+
- " <span id='"+i+"_status'>Start DHCP </span>" +
- " <div id='"+i+"_progress' class='progressbar' "+
- " style='height: 10px;'></div>"+
- "</div>"
- );
- $("#"+i+"_progress").progressbar({ value: 33 });
-};
-
- </script>
--->
</head>
<body>
<header>
@@ -226,7 +35,7 @@ var addInterface = function (i){
<div id="mainContent">
<section>
<!-- Main content area -->
- <p>test</p>
+ <p id="nd_status">test</p>
<!-- anchor for the show log dialog -->
<div id="nd_show_log_dialog" title="Log File">
<pre id="nd_show_log_msg"></pre>
diff --git a/src/html/networkdiscovery_debug.html b/src/html/networkdiscovery_debug.html
new file mode 100644
index 0000000..5f17a0c
--- /dev/null
+++ b/src/html/networkdiscovery_debug.html
@@ -0,0 +1,85 @@
+<html>
+<head>
+<!--qrc:/html/ is needed. otherwise qt won't find the files-->
+<link rel="stylesheet" type="text/css" href="qrc:/html/networkdiscovery.css">
+<link rel="stylesheet" type="text/css" href="qrc:/html/css/jquery-ui-1.8.16.css">
+<script type="text/javascript" src="qrc:/html/js/jquery-1.6.4.min.js"></script>
+<script type="text/javascript" src="qrc:/html/js/jquery-ui-1.8.16.min.js"></script>
+<script type="text/javascript" src="qrc:/html/js/networkDiscovery.js"></script>
+
+
+<script type="text/javascript">
+// prepare the form when the DOM is ready
+$(document).ready(function() {
+ // Setup the ajax indicator
+ $("#nd_status").append('<div id="ajaxBusy"><p><img src="qrc:/html/images/loading.gif"></p></div>');
+});
+
+</script>
+
+</head>
+<body>
+ <header>
+ <h1>Network Discovery</h1>
+ </header>
+ <section id="intro">
+ <p>Welcome to the Network Discovery. We are now looking for usable interfaces and will go on as soon as we found one. This may take a few seconds.</p>
+ </section>
+ <div id="content">
+ <div id="left_spacer">
+ <aside>
+ <!-- free space -->
+ </aside>
+ </div>
+ <div id="mainContent">
+ <section>
+ <!-- Main content area -->
+ <p id="nd_status">test</p>
+ <!-- anchor for the show log dialog -->
+ <div id="nd_show_log_dialog" title="Log File">
+ <pre id="nd_show_log_msg"></pre>
+ </div>
+ <!-- anchor for the abort boot dialog -->
+ <div id="nd_abort_boot_dialog" title="Abort Boot">
+ <p id="nd_abort_boot_msg"> <p>
+ </div>
+ <!-- anchor for the choose interface dialog -->
+ <div id="nd_choose_interface_dialog" title="Choose your Interface">
+ <p id="nd_choose_interface_msg"></p>
+ </div>
+ <!-- anchor for the manual configuration dialog -->
+ <div id="nd_manual_configuration_dialog" title="Manual Configuration">
+ <p id="nd_manual_configuration_msg"></p>
+ <p class="validateTips">All form fields are required.</p>
+ <form>
+ <fieldset>
+ <label for="nd_mc_ifname">Interface</label>
+ <span id="nd_mc_ifname"></span>
+ <label for="ipaddr">IP-Address</label>
+ <input type="text" name="ipaddr" id="ipaddr" class="text ui-widget-content ui-corner-all"/>
+ <label for="netmask">Netmask</label>
+ <input type="text" name="netmask" id="netmask" class="text ui-widget-content ui-corner-all"/>
+ <label for="broadcast">Broadcast Address</label>
+ <input type="text" name="broadcast" id="broadcast" class="text ui-widget-content ui-corner-all"/>
+ <label for="gateway">Gateway Address</label>
+ <input type="text" name="gateway" id="gateway" class="text ui-widget-content ui-corner-all"/>
+ <label for="dns">DNS</label>
+ <input type="text" name="dns" id="dns" class="text ui-widget-content ui-corner-all"/>
+ </fieldset>
+ </form>
+ </div>
+ <!-- anchor for qt interface progress foo -->
+ <div id="nd_progress_container"></div>
+ </section>
+ </div>
+ <div id="right_spacer">
+ <aside>
+ <!-- free space -->
+ </aside>
+ </div>
+ </div>
+ <footer>
+ <p>RZ Uni Freiburg, 2011</p>
+ </footer>
+</body>
+</html>
diff --git a/src/html/networkdiscovery_userchoice.html b/src/html/networkdiscovery_userchoice.html
index 9cf165f..3625fe0 100644
--- a/src/html/networkdiscovery_userchoice.html
+++ b/src/html/networkdiscovery_userchoice.html
@@ -5,7 +5,17 @@
<link rel="stylesheet" type="text/css" href="qrc:/html/css/jquery-ui-1.8.16.css">
<script type="text/javascript" src="qrc:/html/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="qrc:/html/js/jquery-ui-1.8.16.min.js"></script>
-<script type="text/javascript" src="qrc:/html/js/nd-functions.js"></script>
+<script type="text/javascript" src="qrc:/html/js/networkDiscovery.js"></script>
+
+
+<script type="text/javascript">
+// prepare the form when the DOM is ready
+$(document).ready(function() {
+ // Setup the ajax indicator
+ $("#nd_status").append('<div id="ajaxBusy"><p><img src="qrc:/html/images/loading.gif"></p></div>');
+});
+
+</script>
</head>
<body>
@@ -14,6 +24,7 @@
</header>
<section id="intro">
<p>Please press F5 if you want to choose which interface to use.</p>
+ <p id="nd_status"> </p>
</section>
<footer>
<p>RZ Uni Freiburg, 2011</p>
diff --git a/src/html/networkdiscovery_userchoice_debug.html b/src/html/networkdiscovery_userchoice_debug.html
new file mode 100644
index 0000000..88da8b4
--- /dev/null
+++ b/src/html/networkdiscovery_userchoice_debug.html
@@ -0,0 +1,33 @@
+<html>
+<head>
+<!--qrc:/html/ is needed. otherwise qt won't find the files-->
+<link rel="stylesheet" type="text/css" href="qrc:/html/networkdiscovery.css">
+<link rel="stylesheet" type="text/css" href="qrc:/html/css/jquery-ui-1.8.16.css">
+<script type="text/javascript" src="qrc:/html/js/jquery-1.6.4.min.js"></script>
+<script type="text/javascript" src="qrc:/html/js/jquery-ui-1.8.16.min.js"></script>
+<script type="text/javascript" src="qrc:/html/js/nd-functions.js"></script>
+
+
+<script type="text/javascript">
+// prepare the form when the DOM is ready
+$(document).ready(function() {
+ // Setup the ajax indicator
+ $("#nd_status").append('<div id="ajaxBusy"><p><img src="qrc:/html/images/loading.gif"></p></div>');
+});
+
+</script>
+
+</head>
+<body>
+ <header>
+ <h1>Network Discovery</h1>
+ </header>
+ <section id="intro">
+ <p>Please press F5 if you want to choose which interface to use.</p>
+ <p id="nd_status"> </p>
+ </section>
+ <footer>
+ <p>RZ Uni Freiburg, 2011</p>
+ </footer>
+</body>
+</html>
diff --git a/src/main.cpp b/src/main.cpp
index 2df76a6..837cf6e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -235,6 +235,10 @@ int main(int argc, char *argv[]) {
qxtLog->debug() << "downloadDir : " << downloadPath.toUtf8();
qxtLog->debug() << "trigger: " << fileToTriggerURL.toUtf8();
qxtLog->debug() << "serialLocation: " << serialLocation.toUtf8();
+ qxtLog->debug() << "server: " << gServerIp.toUtf8();
+ qxtLog->debug() << "autoup: " << gAutoUp;
+ qxtLog->debug() << "socketserverpath: " << gSocketServerPath.toUtf8();
+ qxtLog->debug() << "pathtoexe: " << gPathToDhcpExe.toUtf8();
qxtLog->debug() << "*******************************************";
// set invisible cursor
diff --git a/src/ndgui.cpp b/src/ndgui.cpp
index 05ceac1..145cd78 100644
--- a/src/ndgui.cpp
+++ b/src/ndgui.cpp
@@ -17,6 +17,7 @@ ndgui::ndgui(QMainWindow *parent) :
_userChoice = false;
_tryAgain = false;
+ setupLayout();
createAction();
connect(&networkDiscovery, SIGNAL(addInterface(const QString &)), this, SLOT(addInterface( const QString &)));
@@ -27,16 +28,22 @@ ndgui::ndgui(QMainWindow *parent) :
connect(&networkDiscovery, SIGNAL(allProcessesFinished()), this, SLOT(handleAllProcessesFinished()));
connect(&networkDiscovery, SIGNAL(continueBoot(QString, int)), this, SLOT(continueBoot(QString, int)));
- _webView = new QWebView(this);
+
connect(_webView->page()->mainFrame(), SIGNAL(
javaScriptWindowObjectCleared()), this, SLOT(attachToDOM()));
- setCentralWidget(_webView);
+
setWindowTitle(tr("NetD"));
setAttribute(Qt::WA_QuitOnClose, true);
setWindowFlags(Qt::FramelessWindowHint);
showFullScreen();
- _webView->load(QUrl("qrc:html/networkdiscovery_userchoice.html"));
+ if (debugMode > -1) {
+ _webView->load(QUrl("qrc:html/networkdiscovery_userchoice_debug.html"));
+ }
+ else {
+ _webView->load(QUrl("prc:html/networkdiscovery_userchoice.html"));
+ }
+
_webView->show();
qxtLog->debug() << _tag << "start singel shot";
@@ -53,6 +60,74 @@ ndgui::~ndgui() {
/**
+ * 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 ndgui::setupLayout() {
+ // setup layout of the gui: debug split or browser
+ _webView = new QWebView(this);
+ if (debugMode == 1) {
+ // split main window in browser & debug console
+ createDebugConsole();
+ _splitter = new QSplitter(Qt::Vertical, this);
+ _splitter->addWidget(_webView);
+ _splitter->addWidget(_debugConsole);
+ setCentralWidget(_splitter);
+ } else
+ setCentralWidget(_webView);
+}
+
+
+
+/**
+ * This method creates a debug console as a widget.
+ *
+ * It is basicly a QTextEdit widget as provided by QT's Framework.
+ * An action to toggle this widget is implemented (CTRL + D).
+ *
+ * @see fbgui::toggleDebugConsole()
+ */
+void ndgui::createDebugConsole() {
+ // create the debug console widget
+ _debugConsole = new QTextEdit(this);
+ _debugConsole->setWindowFlags(Qt::FramelessWindowHint);
+ // fanciness
+ QPalette pal;
+ pal.setColor(QPalette::Base, Qt::black);
+ _debugConsole->setPalette(pal);
+ _debugConsole->setTextColor(Qt::white);
+ // enable custom logger engine
+ qxtLog->addLoggerEngine("fb_logger", new LoggerEngine_fb(_debugConsole));
+ //qxtLog->initLoggerEngine("fb_logger");
+ qxtLog->setMinimumLevel("fb_logger", QxtLogger::DebugLevel);
+ // CTRL + D toggles debug window
+ _toggleDebugConsole = new QAction(tr("&toggleDebug"), this);
+ _toggleDebugConsole->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
+ addAction(_toggleDebugConsole);
+ connect(_toggleDebugConsole, SIGNAL(triggered()), this, SLOT(
+ toggleDebugConsole()));
+}
+
+
+
+/**
+ * This method toggles the debug console.
+ *
+ * Toggle the visibility of the debug console if the action _toggleDebugConsole is triggered.
+ *
+ * @see fbgui::createDebugConsole()
+ */
+void ndgui::toggleDebugConsole() {
+ (_debugConsole->isVisible()) ? _debugConsole->hide() : _debugConsole->show();
+}
+
+
+
+/**
* creates an action which you can trigger with the F5 Button during the first
* seconds.
*/
@@ -87,7 +162,13 @@ void ndgui::prepareNetworkDiscover() {
SLOT(startNetworkDiscovery()));
this->removeAction(_allowUserChoice);
- _webView->load(QUrl("qrc:html/networkdiscovery.html"));
+ if (debugMode > -1) {
+ _webView->load(QUrl("qrc:html/networkdiscovery_debug.html"));
+ }
+ else {
+ _webView->load(QUrl("qrc:html/networkdiscovery.html"));
+ }
+
_webView->show();
}
@@ -106,7 +187,7 @@ void ndgui::startNetworkDiscovery(){
_started = true;
QStringList l;
l << "-d";
- networkDiscovery.initAndRun("209.85.148.105", _userChoice, true, "/var/tmp/logfile","/var/tmp/qt_c_socket_custom", DEFAULT_PATHTODHCPCDEXE, &l);
+ networkDiscovery.initAndRun("209.85.148.105", _userChoice, true, logFilePath,"/var/tmp/qt_c_socket_custom", DEFAULT_PATHTODHCPCDEXE, &l);
} else {
_tryAgain = false;
networkDiscovery.tryAgain();
@@ -204,6 +285,7 @@ void ndgui::continueBoot(QString ifName, int userChoice) {
}
if (networkDiscovery.checkConnectivityViaTcp()) {
emit initFbgui();
+ this->close();
} else {
abortBoot("Interface was suddenly made unusable ");
}
@@ -229,7 +311,12 @@ void ndgui::tryAgain() {
_ifNameList.clear();
_manConfList.clear();
createAction();
- _webView->load(QUrl("qrc:html/networkdiscovery_userchoice.html"));
+ if (debugMode > -1) {
+ _webView->load(QUrl("qrc:html/networkdiscovery_userchoice_debug.html"));
+ }
+ else {
+ _webView->load(QUrl("qrc:html/networkdiscovery_userchoice.html"));
+ }
_webView->show();
QTimer::singleShot(2000, this, SLOT(prepareNetworkDiscover()));
diff --git a/src/ndgui.h b/src/ndgui.h
index d8adf63..69a9f83 100644
--- a/src/ndgui.h
+++ b/src/ndgui.h
@@ -5,6 +5,7 @@
#include <QtWebKit>
#include <QVariant>
+#include "fbgui.h"
#include "loggerengine.h"
#include "networkdiscovery.h"
@@ -79,6 +80,19 @@ private:
QString _manualConfInterfaces;
+ // QSplitter to split the main window in two resizable frames.
+ QSplitter* _splitter;
+ // QTextEdit implementing a minimalistic debug console.
+ QTextEdit* _debugConsole;
+
+ // triggers toggleDebugConsole()
+ QAction* _toggleDebugConsole;
+
+
+ void setupLayout();
+ void createDebugConsole();
+ void toggleDebugConsole();
+
};
diff --git a/src/networkdiscovery.cpp b/src/networkdiscovery.cpp
index 75e822b..716e28b 100644
--- a/src/networkdiscovery.cpp
+++ b/src/networkdiscovery.cpp
@@ -258,7 +258,6 @@ QString NetworkDiscovery::readLogFile() {
}
}
qxtLog->debug() << _tag << " could not open log file";
-
}