64 lines
1.4 KiB
QML
64 lines
1.4 KiB
QML
import QtQuick 2.12
|
|
import QtQuick.Controls 2.12
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import Controls 1.0 as Controls
|
|
import Cubo 1.0
|
|
import Utils 1.0
|
|
|
|
ColumnLayout {
|
|
spacing: 20
|
|
|
|
Controls.Frame {
|
|
Flickable {
|
|
id: outputFlickable
|
|
clip: true
|
|
anchors.fill: parent
|
|
boundsBehavior: Flickable.StopAtBounds
|
|
|
|
TextArea.flickable: Controls.TextArea {
|
|
id: outputArea
|
|
textFormat: Text.RichText
|
|
}
|
|
|
|
ScrollBar.horizontal: Controls.ScrollBar { }
|
|
ScrollBar.vertical: Controls.ScrollBar { }
|
|
}
|
|
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
}
|
|
|
|
Controls.Button {
|
|
text: qsTr("Clear")
|
|
Layout.preferredWidth: 120
|
|
onClicked: outputArea.clear()
|
|
}
|
|
|
|
Connections {
|
|
target: BmsInterface
|
|
onStatusMessage: printMessage(msg, isGood)
|
|
}
|
|
|
|
function printMessage(msg, isGood) {
|
|
var message = ""
|
|
|
|
if (!isGood) {
|
|
message += "<font color=\"" + Palette.invalidColor + "\">"
|
|
}
|
|
|
|
message += new Date().toLocaleString(Qt.locale("en-US"), "dd.MM.yyyy hh:mm:ss") + ": " + msg
|
|
|
|
if (!isGood) {
|
|
message += "</font>"
|
|
}
|
|
|
|
message += "<br>"
|
|
|
|
outputArea.insert(outputArea.length, message)
|
|
outputArea.cursorPosition = outputArea.length
|
|
|
|
outputFlickable.contentX = 0
|
|
}
|
|
}
|