Fix hostname reading for Qt < 5.6

This commit is contained in:
Simon Stürz 2019-10-08 09:40:47 +02:00
parent 191936e235
commit cc858b4d0a
3 changed files with 25 additions and 32 deletions

View File

@ -67,13 +67,13 @@ function connectWebsocket() {
webSocket = new WebSocket(urlString); webSocket = new WebSocket(urlString);
webSocket.onopen = function(openEvent) { webSocket.onopen = function(openEvent) {
console.log("WebSocket connected: " + JSON.stringify(openEvent, null, 4)); console.log("WebSocket connected");
webSocketConnected = true; webSocketConnected = true;
document.getElementById("toggleLogsButton").innerHTML = "Stop logs"; document.getElementById("toggleLogsButton").innerHTML = "Stop logs";
}; };
webSocket.onclose = function(closeEvent) { webSocket.onclose = function(closeEvent) {
console.log("WebSocket disconnected: " + JSON.stringify(closeEvent, null, 4)); console.log("WebSocket disconnected");
webSocketConnected = false; webSocketConnected = false;
document.getElementById("toggleLogsButton").innerHTML = "Start logs"; document.getElementById("toggleLogsButton").innerHTML = "Start logs";
}; };
@ -84,7 +84,6 @@ function connectWebsocket() {
webSocket.onmessage = function (messageEvent) { webSocket.onmessage = function (messageEvent) {
var message = messageEvent.data; var message = messageEvent.data;
console.log("WebSocket data received: " + message);
document.getElementById("logsTextArea").value += message; document.getElementById("logsTextArea").value += message;
document.getElementById("logsTextArea").scrollTop = document.getElementById("logsTextArea").scrollHeight; document.getElementById("logsTextArea").scrollTop = document.getElementById("logsTextArea").scrollHeight;
}; };
@ -142,17 +141,14 @@ function loadLoggingCategorySettings() {
return; return;
} }
console.log(request.responseText);
var responseMap = JSON.parse(request.responseText); var responseMap = JSON.parse(request.responseText);
for (var loggingCategory in responseMap['loggingCategories']) { for (var loggingCategory in responseMap['loggingCategories']) {
console.warn(loggingCategory, responseMap['loggingCategories'][loggingCategory])
var loggingCategoryElement = document.getElementById("debug-category-" + loggingCategory) var loggingCategoryElement = document.getElementById("debug-category-" + loggingCategory)
loggingCategoryElement.checked = responseMap['loggingCategories'][loggingCategory] loggingCategoryElement.checked = responseMap['loggingCategories'][loggingCategory]
} }
for (var loggingCategory in responseMap['loggingCategoriesPlugins']) { for (var loggingCategory in responseMap['loggingCategoriesPlugins']) {
console.warn(loggingCategory, responseMap['loggingCategoriesPlugins'][loggingCategory])
var loggingCategoryElement = document.getElementById("debug-category-" + loggingCategory) var loggingCategoryElement = document.getElementById("debug-category-" + loggingCategory)
loggingCategoryElement.checked = responseMap['loggingCategoriesPlugins'][loggingCategory] loggingCategoryElement.checked = responseMap['loggingCategoriesPlugins'][loggingCategory]
} }

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *
* Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io> * * Copyright (C) 2018-2019 Simon Stürz <simon.stuerz@nymea.io> *
* * * *
* This file is part of nymea. * * This file is part of nymea. *
* * * *
@ -39,6 +39,14 @@ h1, h2, h3, h4, h5, h6 {
text-align: center; text-align: center;
} }
table {
display: table;
border-collapse: colapse;
border-color: #efefef;
min-height: 100px;
width: 100%;
}
th, td { th, td {
padding: 3px; padding: 3px;
padding-left: 10px; padding-left: 10px;
@ -52,28 +60,10 @@ hr {
color: #efefef; color: #efefef;
} }
table {
display: table;
border-collapse: colapse;
border-color: #efefef;
min-height: 100px;
width: 100%;
}
button { button {
width: 100%; width: 100%;
} }
textarea {
background-color: #3a4055;
width: 100%;
padding: 15px;
min-height: 100px;
text-align: left;
border-radius: 10px;
outline: none;
}
.tab { .tab {
overflow: hidden; overflow: hidden;
background-color: #efefef; background-color: #efefef;
@ -107,8 +97,18 @@ textarea {
} }
@keyframes fadeEffect { @keyframes fadeEffect {
from {opacity: 0;} from { opacity: 0; }
to {opacity: 1;} to { opacity: 1; }
}
textarea {
background-color: #3a4055;
width: 100%;
padding: 15px;
min-height: 100px;
text-align: left;
border-radius: 10px;
outline: none;
} }
.console-textarea { .console-textarea {
@ -349,7 +349,6 @@ input:checked + .slider:before {
transform: translateX(26px); transform: translateX(26px);
} }
/* Rounded sliders */
.slider.round { .slider.round {
border-radius: 34px; border-radius: 34px;
} }

View File

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *
* Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io> * * Copyright (C) 2018-2019 Simon Stürz <simon.stuerz@nymea.io> *
* * * *
* This file is part of nymea. * * This file is part of nymea. *
* * * *
@ -415,7 +415,7 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath, c
} }
bool enabled = QVariant(requestQuery.queryItems().at(i).second).toBool(); bool enabled = QVariant(requestQuery.queryItems().at(i).second).toBool();
qCDebug(dcDebugServer()) << "Category" << category << enabled; qCDebug(dcDebugServer()) << "Logging category" << category << (enabled ? "enabled" : "disabled");
settings.setValue(QString("%1.debug").arg(category), (enabled ? "true" : "false")); settings.setValue(QString("%1.debug").arg(category), (enabled ? "true" : "false"));
} }
@ -433,7 +433,6 @@ HttpReply *DebugServerHandler::processDebugRequest(const QString &requestPath, c
} }
} }
if (requestPath.startsWith("/debug/report")) { if (requestPath.startsWith("/debug/report")) {
// The client can poll this url in order to get information about the current report generating process. // The client can poll this url in order to get information about the current report generating process.
@ -902,7 +901,6 @@ QByteArray DebugServerHandler::createDebugXmlDocument()
writer.writeStartElement("div"); writer.writeStartElement("div");
writer.writeAttribute("class", "body"); writer.writeAttribute("class", "body");
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
writer.writeStartElement("div"); writer.writeStartElement("div");
writer.writeAttribute("class", "tabcontent"); writer.writeAttribute("class", "tabcontent");