mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
chore: update ui
This commit is contained in:
parent
4cbe31ccb2
commit
01a9e71a44
@ -10,12 +10,14 @@ import "common"
|
||||
|
||||
Window {
|
||||
id: mainWindow
|
||||
title: qsTr("EasyDebug")
|
||||
visible: true
|
||||
|
||||
width: 1280
|
||||
height: 720
|
||||
visible: true
|
||||
color: "#00000000"
|
||||
title: qsTr("EasyDebug")
|
||||
flags: Qt.FramelessWindowHint | Qt.Window
|
||||
opacity: 0.3
|
||||
|
||||
property alias keysObj: settingKeys
|
||||
|
||||
@ -64,20 +66,17 @@ Window {
|
||||
|
||||
onEdMaterialThemeChanged: {
|
||||
if (sakSettings) {
|
||||
sakSettings.setValue(settingKeys.materialTheme,
|
||||
String(edMaterialTheme))
|
||||
sakSettings.setValue(settingKeys.materialTheme, String(edMaterialTheme))
|
||||
}
|
||||
}
|
||||
onEdMaterialAccentChanged: {
|
||||
if (sakSettings) {
|
||||
sakSettings.setValue(settingKeys.materialAccent,
|
||||
String(edMaterialAccent))
|
||||
sakSettings.setValue(settingKeys.materialAccent, String(edMaterialAccent))
|
||||
}
|
||||
}
|
||||
onEdMaterialPrimaryChanged: {
|
||||
if (sakSettings) {
|
||||
sakSettings.setValue(settingKeys.materialPrimary,
|
||||
String(edMaterialPrimary))
|
||||
sakSettings.setValue(settingKeys.materialPrimary, String(edMaterialPrimary))
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,13 +146,7 @@ Window {
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
onPageIndexChanged: sakSettings.setValue(settingKeys.pageIndex,
|
||||
pageIndex)
|
||||
onInvokeAddPage: function (qmlFile) {
|
||||
pageRepeaterListModel.append({
|
||||
"page": "qrc:/qml/" + qmlFile
|
||||
})
|
||||
}
|
||||
onPageIndexChanged: sakSettings.setValue(settingKeys.pageIndex, pageIndex)
|
||||
onInvokeRemovePage: function (pageIndex) {
|
||||
var i = pageIndex - fixedpage
|
||||
if (i >= 0 && i < pageRepeaterListModel.count) {
|
||||
@ -215,18 +208,6 @@ Window {
|
||||
MainWindowWebSocketServerPage {
|
||||
id: websocketServerPage
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: pageRepeater
|
||||
model: ListModel {
|
||||
id: pageRepeaterListModel
|
||||
}
|
||||
Loader {
|
||||
asynchronous: true
|
||||
source: page
|
||||
}
|
||||
}
|
||||
|
||||
MainWindowInfoPage {
|
||||
id: infoPage
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ SAKPane {
|
||||
property bool devIsWorking: comTool ? comTool.isWorking : false
|
||||
property bool ignoredUpdate: comTool ? comTool.isWorking : false
|
||||
|
||||
signal invokeRefreshDevice()
|
||||
signal invokeRefreshDevice
|
||||
|
||||
onIgnoredUpdateChanged: spController.setIgnoredUpdate(ignoredUpdate)
|
||||
|
||||
@ -40,11 +40,26 @@ SAKPane {
|
||||
|
||||
ListModel {
|
||||
id: additionListModel
|
||||
ListElement {text: qsTr("None"); value: ""}
|
||||
ListElement {text: qsTr("\\r"); value: "\r"}
|
||||
ListElement {text: qsTr("\\n"); value: "\n"}
|
||||
ListElement {text: qsTr("\\r\\n"); value: "\r\n"}
|
||||
ListElement {text: qsTr("\\n\\r"); value: "\n\r"}
|
||||
ListElement {
|
||||
text: qsTr("None")
|
||||
value: ""
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("\\r")
|
||||
value: "\r"
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("\\n")
|
||||
value: "\n"
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("\\r\\n")
|
||||
value: "\r\n"
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("\\n\\r")
|
||||
value: "\n\r"
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
@ -57,7 +72,7 @@ SAKPane {
|
||||
color: Material.foreground
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Port names")
|
||||
text: qsTr("Port name")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: portNameComboBox
|
||||
@ -65,8 +80,7 @@ SAKPane {
|
||||
enabled: !devIsWorking
|
||||
Layout.fillWidth: true
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.portName,
|
||||
portNameComboBox.currentText)
|
||||
sakSettings.setValue(settingKeys.portName, portNameComboBox.currentText)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var portName = sakSettings.value(settingKeys.portName)
|
||||
@ -121,9 +135,18 @@ SAKPane {
|
||||
enabled: !devIsWorking
|
||||
Layout.fillWidth: true
|
||||
model: ListModel {
|
||||
ListElement{text: "1"; value: 1}
|
||||
ListElement{text: "1.5"; value: 3}
|
||||
ListElement{text: "2"; value: 2}
|
||||
ListElement {
|
||||
text: "1"
|
||||
value: 1
|
||||
}
|
||||
ListElement {
|
||||
text: "1.5"
|
||||
value: 3
|
||||
}
|
||||
ListElement {
|
||||
text: "2"
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.stopBits, stopBitsComboBox.currentValue)
|
||||
@ -148,10 +171,22 @@ SAKPane {
|
||||
enabled: !devIsWorking
|
||||
Layout.fillWidth: true
|
||||
model: ListModel {
|
||||
ListElement{text: "8"; value: 8}
|
||||
ListElement{text: "7"; value: 7}
|
||||
ListElement{text: "6"; value: 6}
|
||||
ListElement{text: "5"; value: 5}
|
||||
ListElement {
|
||||
text: "8"
|
||||
value: 8
|
||||
}
|
||||
ListElement {
|
||||
text: "7"
|
||||
value: 7
|
||||
}
|
||||
ListElement {
|
||||
text: "6"
|
||||
value: 6
|
||||
}
|
||||
ListElement {
|
||||
text: "5"
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.dataBits, dataBitsComboBox.currentValue)
|
||||
@ -176,11 +211,26 @@ SAKPane {
|
||||
enabled: !devIsWorking
|
||||
Layout.fillWidth: true
|
||||
model: ListModel {
|
||||
ListElement{text: qsTr("No"); value: 0}
|
||||
ListElement{text: qsTr("Even"); value: 2}
|
||||
ListElement{text: qsTr("Odd"); value: 3}
|
||||
ListElement{text: qsTr("Space"); value: 4}
|
||||
ListElement{text: qsTr("Mark"); value: 5}
|
||||
ListElement {
|
||||
text: qsTr("No")
|
||||
value: 0
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Even")
|
||||
value: 2
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Odd")
|
||||
value: 3
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Space")
|
||||
value: 4
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Mark")
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.parity, parityComboBox.currentValue)
|
||||
@ -205,13 +255,21 @@ SAKPane {
|
||||
enabled: !devIsWorking
|
||||
Layout.fillWidth: true
|
||||
model: ListModel {
|
||||
ListElement{text: qsTr("No"); value: 0}
|
||||
ListElement{text: qsTr("Hardware"); value: 1}
|
||||
ListElement{text: qsTr("Software"); value: 2}
|
||||
ListElement {
|
||||
text: qsTr("No")
|
||||
value: 0
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Hardware")
|
||||
value: 1
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Software")
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.flowControl,
|
||||
flowControlComboBox.currentValue)
|
||||
sakSettings.setValue(settingKeys.flowControl, flowControlComboBox.currentValue)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var flowControl = sakSettings.value(settingKeys.flowControl)
|
||||
@ -246,7 +304,7 @@ SAKPane {
|
||||
onClicked: {
|
||||
spController.setIgnoredBusyDevice(ignoredBusyDeviceCheckBox.checked)
|
||||
sakSettings.setValue(settingKeys.ignoredBusyDevice,
|
||||
ignoredBusyDeviceCheckBox.checked)
|
||||
ignoredBusyDeviceCheckBox.checked)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var ignoredBusyDevice = sakSettings.value(settingKeys.ignoredBusyDevice)
|
||||
@ -261,14 +319,17 @@ SAKPane {
|
||||
Layout.columnSpan: 2
|
||||
onClicked: {
|
||||
spController.setAutoUpdatePortNames(autoUpdatePortNameCheckBox.checked)
|
||||
sakSettings.setValue(settingKeys.autoUpdatePortNames, autoUpdatePortNameCheckBox.checked)
|
||||
sakSettings.setValue(settingKeys.autoUpdatePortNames,
|
||||
autoUpdatePortNameCheckBox.checked)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var autoUpdatePortNames = sakSettings.value(settingKeys.autoUpdatePortNames)
|
||||
autoUpdatePortNameCheckBox.checked = autoUpdatePortNames === edTrue ? true : false
|
||||
}
|
||||
}
|
||||
Item { Layout.fillHeight: true }
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
function portName() {
|
||||
|
||||
@ -9,18 +9,10 @@ SAKPane {
|
||||
|
||||
property int mainWindowVisibility: Window.Windowed
|
||||
|
||||
signal invokeShowMaximized()
|
||||
signal invokeShowMinimized()
|
||||
signal invokeClose()
|
||||
signal invokeShowWindowed()
|
||||
|
||||
SAKLabel {
|
||||
text: "EasyDebug"
|
||||
font.pixelSize: 24
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 8
|
||||
}
|
||||
signal invokeShowMaximized
|
||||
signal invokeShowMinimized
|
||||
signal invokeClose
|
||||
signal invokeShowWindowed
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
@ -34,16 +26,11 @@ SAKPane {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Repeater {
|
||||
model: [
|
||||
"qrc:/resources/icon/IconMinimized.svg",
|
||||
"qrc:/resources/icon/IconWindowed.svg",
|
||||
"qrc:/resources/icon/IconMaximized.svg",
|
||||
"qrc:/resources/icon/IconClose.svg"
|
||||
]
|
||||
model: ["qrc:/resources/icon/IconMinimized.svg", "qrc:/resources/icon/IconWindowed.svg", "qrc:/resources/icon/IconMaximized.svg", "qrc:/resources/icon/IconClose.svg"]
|
||||
Rectangle {
|
||||
id: bt
|
||||
height: root.height
|
||||
width: height*1.4
|
||||
width: height * 1.4
|
||||
radius: index === 3 ? mainWindowVisibility === Window.Windowed ? 8 : 0 : 0
|
||||
visible: {
|
||||
if (index === 1) {
|
||||
@ -95,7 +82,7 @@ SAKPane {
|
||||
}
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
height: parent.height*0.6
|
||||
height: parent.height * 0.6
|
||||
width: height
|
||||
source: modelData
|
||||
mipmap: true
|
||||
@ -110,4 +97,3 @@ SAKPane {
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,9 +8,6 @@ import "common"
|
||||
ToolBar {
|
||||
id: root
|
||||
width: toolColumnLayout.width
|
||||
property int pageIndex: 0
|
||||
property int fixedpage: 0
|
||||
|
||||
background: Rectangle {
|
||||
radius: isWindowed ? 8 : 0
|
||||
color: Material.primary
|
||||
@ -23,6 +20,8 @@ ToolBar {
|
||||
}
|
||||
}
|
||||
|
||||
property int pageIndex: 0
|
||||
|
||||
signal invokeAddPage(var qmlFile)
|
||||
signal invokeRemovePage(var pageIndex)
|
||||
|
||||
@ -32,23 +31,63 @@ ToolBar {
|
||||
|
||||
ColumnLayout {
|
||||
id: toolColumnLayout
|
||||
spacing: 0
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
Item {
|
||||
Layout.minimumHeight: 24
|
||||
Layout.minimumHeight: titleBar.height
|
||||
Layout.fillWidth: true
|
||||
Row {
|
||||
spacing: 4
|
||||
anchors.centerIn: parent
|
||||
Text {
|
||||
id: easyText
|
||||
text: "Easy"
|
||||
color: "green"
|
||||
font.bold: true
|
||||
font.pixelSize: 20
|
||||
font.italic: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.verticalCenterOffset: 1
|
||||
}
|
||||
Text {
|
||||
text: "Debug"
|
||||
color: "#efeff0"
|
||||
font: easyText.font
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.verticalCenterOffset: -1
|
||||
}
|
||||
}
|
||||
SAKHorizontalLine {
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
Repeater {
|
||||
id: btRepeater
|
||||
model: [["qrc:/resources/icon/IconSerialPort.svg", SAKToolsFactory.SerialportTool, qsTr(
|
||||
"SerialPort"), "MainWindowSerialPortPage.qml"], ["qrc:/resources/icon/IconBlueTooth.svg", SAKToolsFactory.SerialportTool, qsTr("SerialPort"), "MainWindowBlePage.qml"], ["qrc:/resources/icon/IconUdpClient.svg", SAKToolsFactory.UdpClientTool, qsTr("UDP Client"), "MainWindowUdpClientPage.qml"], ["qrc:/resources/icon/IconUdpServer.svg", SAKToolsFactory.UdpServerTool, qsTr("UDP Server"), "MainWindowUdpServerPage.qml"], ["qrc:/resources/icon/IconTcpClient.svg", SAKToolsFactory.TcpClientTool, qsTr("TCP Client"), "MainWindowTcpClientPage.qml"], ["qrc:/resources/icon/IconTcpServer.svg", SAKToolsFactory.TcpServerTool, qsTr("TCP Server"), "MainWindowTcpServerPage.qml"], ["qrc:/resources/icon/IconWebSocketClient.svg", SAKToolsFactory.WebSocketClientTool, qsTr("WebSocket Client"), "MainWindowWebSocketClientPage.qml"], ["qrc:/resources/icon/IconWebSocketServer.svg", SAKToolsFactory.WebSocketServerTool, qsTr("WebSocket Server"), "MainWindowWebSocketServerPage.qml"]]
|
||||
SAKToolButton {
|
||||
model: {
|
||||
var serialPort = [qsTr("Serial Port"), "qrc:/resources/icon/IconSerialPort.svg"]
|
||||
var bleCentral = [qsTr("BLE Central"), "qrc:/resources/icon/IconBlueTooth.svg"]
|
||||
var udpClient = [qsTr("UDP Client"), "qrc:/resources/icon/IconUdpClient.svg"]
|
||||
var ucpServer = [qsTr("UDP Server"), "qrc:/resources/icon/IconUdpServer.svg"]
|
||||
var tcpClient = [qsTr("TCP Client"), "qrc:/resources/icon/IconTcpClient.svg"]
|
||||
var tcpServer = [qsTr("TCP Server"), "qrc:/resources/icon/IconTcpServer.svg"]
|
||||
var wsClient = [qsTr("WebSocket Client"), "qrc:/resources/icon/IconWebSocketClient.svg"]
|
||||
var wsServer = [qsTr("WebSocket Server"), "qrc:/resources/icon/IconWebSocketServer.svg"]
|
||||
|
||||
var tmp = [serialPort, bleCentral, udpClient, ucpServer, tcpClient, tcpServer, wsClient, wsServer]
|
||||
return tmp
|
||||
}
|
||||
MainWindowToolBarItem {
|
||||
id: bt
|
||||
checkable: true
|
||||
icon.source: modelData[0]
|
||||
onClicked: root.pageIndex = index
|
||||
icon.source: modelData[1]
|
||||
checked: pageIndex === index
|
||||
text: modelData[0]
|
||||
leftPadding: 4
|
||||
onClicked: root.pageIndex = index
|
||||
onDoubleClicked: invokeRemovePage(index)
|
||||
tips: modelData[2]
|
||||
|
||||
Layout.fillWidth: true
|
||||
Component.onCompleted: {
|
||||
bg.addButton(bt)
|
||||
if (index === pageIndex) {
|
||||
@ -57,60 +96,23 @@ ToolBar {
|
||||
}
|
||||
}
|
||||
}
|
||||
ToolButton {
|
||||
icon.source: "qrc:/resources/icon/IconAdd.svg"
|
||||
onClicked: optionMenu.open()
|
||||
visible: false
|
||||
Menu {
|
||||
id: optionMenu
|
||||
Repeater {
|
||||
model: [["qrc:/resources/icon/IconSerialPort.svg", SAKToolsFactory.SerialportTool, qsTr(
|
||||
"SerialPort"), "MainWindowSerialPortPage.qml"], ["qrc:/resources/icon/IconUdpClient.svg", SAKToolsFactory.UdpClientTool, qsTr("UDP Client"), "MainWindowUdpClientPage.qml"], ["qrc:/resources/icon/IconUdpServer.svg", SAKToolsFactory.UdpServerTool, qsTr("UDP Server"), "MainWindowUdpServerPage.qml"], ["qrc:/resources/icon/IconTcpClient.svg", SAKToolsFactory.TcpClientTool, qsTr("TCP Client"), "MainWindowTcpClientPage.qml"], ["qrc:/resources/icon/IconTcpServer.svg", SAKToolsFactory.TcpServerTool, qsTr("TCP Server"), "MainWindowTcpServerPage.qml"], ["qrc:/resources/icon/IconWebSocketClient.svg", SAKToolsFactory.WebSocketClientTool, qsTr("WebSocket Client"), "MainWindowWebSocketClientPage.qml"], ["qrc:/resources/icon/IconWebSocketServer.svg", SAKToolsFactory.WebSocketServerTool, qsTr("WebSocket Server"), "MainWindowWebSocketServerPage.qml"]]
|
||||
MenuItem {
|
||||
text: modelData[2]
|
||||
icon.source: modelData[0]
|
||||
onTriggered: {
|
||||
var temp = []
|
||||
temp = btRepeater.model
|
||||
temp.push(modelData)
|
||||
btRepeater.model = temp
|
||||
root.invokeAddPage(modelData[3])
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
SAKHorizontalLine {
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
MainWindowToolBarItem {
|
||||
id: settingsToolButton
|
||||
checkable: true
|
||||
text: qsTr("Settings")
|
||||
icon.source: "qrc:/resources/icon/IconSettings.svg"
|
||||
onClicked: pageIndex = btRepeater.model.length
|
||||
Layout.fillWidth: true
|
||||
Component.onCompleted: bg.addButton(settingsToolButton)
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
ToolButton {
|
||||
id: infoToolButton
|
||||
checkable: true
|
||||
icon.source: "qrc:/resources/icon/IconInfo.svg"
|
||||
onClicked: pageIndex = btRepeater.model.length
|
||||
Component.onCompleted: bg.addButton(infoToolButton)
|
||||
}
|
||||
ToolButton {
|
||||
id: settingsToolButton
|
||||
checkable: true
|
||||
icon.source: "qrc:/resources/icon/IconSettings.svg"
|
||||
onClicked: pageIndex = btRepeater.model.length + 1
|
||||
Component.onCompleted: bg.addButton(settingsToolButton)
|
||||
}
|
||||
Item {
|
||||
Layout.minimumHeight: 24
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: fixedpage = btRepeater.model.length
|
||||
|
||||
function removePageIndex(index) {
|
||||
if (index >= fixedpage && index < btRepeater.model.length) {
|
||||
var newModel = btRepeater.model
|
||||
newModel.splice(index, 1)
|
||||
btRepeater.model = newModel
|
||||
pageIndex = pageIndex - 1
|
||||
console.info("Page index removed:", index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
42
qml/MainWindowToolBarItem.qml
Normal file
42
qml/MainWindowToolBarItem.qml
Normal file
@ -0,0 +1,42 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.Material
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
import "common"
|
||||
|
||||
SAKToolButton {
|
||||
id: root
|
||||
|
||||
contentItem: Row {
|
||||
spacing: root.spacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Image {
|
||||
id: iconImage
|
||||
source: root.icon.source
|
||||
width: root.icon.width
|
||||
height: root.icon.height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
ColorOverlay {
|
||||
anchors.fill: iconImage
|
||||
source: iconImage
|
||||
color: root.icon.color
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
id: textLabel
|
||||
font: root.font
|
||||
text: root.text
|
||||
color: root.icon.color
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 4
|
||||
height: root.height * 0.8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
color: root.icon.color
|
||||
visible: root.checked
|
||||
}
|
||||
}
|
||||
@ -1,34 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
|
||||
ToolButton {
|
||||
id: root
|
||||
|
||||
property alias tips: tipLabel.text
|
||||
|
||||
onHoveredChanged: {
|
||||
if (tips !== "") {
|
||||
if (hovered) {
|
||||
var popupX = mapToItem(tipsPopup.parent, 0, 0).x
|
||||
var popupY = mapToItem(tipsPopup.parent, 0, 0).y
|
||||
tipsPopup.x = popupX - (tipsPopup.width - root.width)/2
|
||||
tipsPopup.y = popupY - tipsPopup.height
|
||||
|
||||
tipsPopup.width = tipLabel + tipsPopup.padding*2
|
||||
tipsPopup.open()
|
||||
} else {
|
||||
tipsPopup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAKPopup {
|
||||
id: tipsPopup
|
||||
dim: false
|
||||
modal: false
|
||||
contentItem: SAKLabel {
|
||||
id: tipLabel
|
||||
text: tips
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ Item {
|
||||
readonly property string txColor: "blue"
|
||||
|
||||
signal invokeOpenDrawer(var pageIndex)
|
||||
signal invokeSend()
|
||||
signal invokeSend
|
||||
|
||||
onInputFormatChanged: inputComboBox.editText = ""
|
||||
|
||||
@ -57,14 +57,7 @@ Item {
|
||||
anchors.fill: parent
|
||||
RowLayout {
|
||||
Repeater {
|
||||
model: [
|
||||
[qsTr("Rx"), groupName + "/outputRx"],
|
||||
[qsTr("Tx"), groupName + "/outputTx"],
|
||||
[qsTr("Date"), groupName + "/outputShowDate"],
|
||||
[qsTr("Time"), groupName + "/outputShowTime"],
|
||||
[qsTr("MS"), groupName + "/outputShowMS"],
|
||||
[qsTr("Wrap"), groupName + "/outputShowWrap"]
|
||||
]
|
||||
model: [[qsTr("Rx"), groupName + "/outputRx"], [qsTr("Tx"), groupName + "/outputTx"], [qsTr("Date"), groupName + "/outputShowDate"], [qsTr("Time"), groupName + "/outputShowTime"], [qsTr("MS"), groupName + "/outputShowMS"], [qsTr("Wrap"), groupName + "/outputShowWrap"]]
|
||||
SAKCheckBox {
|
||||
id: cbCheckBox
|
||||
text: modelData[0]
|
||||
@ -73,17 +66,29 @@ Item {
|
||||
visible: index !== 5
|
||||
Component.onCompleted: {
|
||||
if (index === 0) {
|
||||
showRx = Qt.binding(function (){return checked})
|
||||
showRx = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
} else if (index === 1) {
|
||||
showTx = Qt.binding(function (){return checked})
|
||||
} else if (index === 2) {
|
||||
showDate = Qt.binding(function (){return checked})
|
||||
showTx = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
} else if (index === 2) {
|
||||
showDate = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
} else if (index === 3) {
|
||||
showTime = Qt.binding(function (){return checked})
|
||||
showTime = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
} else if (index === 4) {
|
||||
showMs = Qt.binding(function (){return checked})
|
||||
showMs = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
} else if (index === 5) {
|
||||
showWrap = Qt.binding(function (){return checked})
|
||||
showWrap = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
}
|
||||
|
||||
if (index === 0 || index === 1) {
|
||||
@ -92,7 +97,9 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
Item { Layout.fillWidth: true }
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKTextFormatComboBox {
|
||||
id: outputTextFormatComboBox
|
||||
tips: qsTr("Output text format")
|
||||
@ -154,12 +161,8 @@ Item {
|
||||
id: intervalComboBox
|
||||
enabled: communicationTool ? communicationTool.isWorking : null
|
||||
tips: qsTr("Cycle sending interval")
|
||||
model: [
|
||||
qsTr("Disable"),
|
||||
20, 40, 60, 80, 100,
|
||||
200, 400, 600, 800, 1000,
|
||||
2000, 4000, 6000, 8000, 10000
|
||||
]
|
||||
model: [qsTr(
|
||||
"Disable"), 20, 40, 60, 80, 100, 200, 400, 600, 800, 1000, 2000, 4000, 6000, 8000, 10000]
|
||||
onActivated: {
|
||||
if (intervalComboBox.currentIndex === 0) {
|
||||
cycleSendingTimer.stop()
|
||||
@ -196,22 +199,23 @@ Item {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
// var values = sakSettings.sakArrayValues(keysObj.itemGroup, keysObj.itemArray, keysObj.itemAll)
|
||||
// var item = {}
|
||||
// for (var i = 0; i < values.length; i++) {
|
||||
// var str = sakInterface.hexString2String(values[i])
|
||||
// var jsonObj = JSON.parse(str)
|
||||
// item[keysObj.itemText] = jsonObj[keysObj.itemText]
|
||||
// item[keysObj.itemFormat] = jsonObj[keysObj.itemFormat]
|
||||
// hisrotyListModel.append(item)
|
||||
// }
|
||||
|
||||
// var index = sakSettings.value(keysObj.itemCurrentIndex)
|
||||
// if (index >= 0 && index < hisrotyListModel.count) {
|
||||
// currentIndex = index
|
||||
// editText = currentText
|
||||
// // Todo: no effect, need to fix.
|
||||
// }
|
||||
// var values = sakSettings.sakArrayValues(keysObj.itemGroup, keysObj.itemArray, keysObj.itemAll)
|
||||
// var item = {}
|
||||
// for (var i = 0; i < values.length; i++) {
|
||||
// var str = sakInterface.hexString2String(values[i])
|
||||
// var jsonObj = JSON.parse(str)
|
||||
// item[keysObj.itemText] = jsonObj[keysObj.itemText]
|
||||
// item[keysObj.itemFormat] = jsonObj[keysObj.itemFormat]
|
||||
// hisrotyListModel.append(item)
|
||||
// }
|
||||
|
||||
// var index = sakSettings.value(keysObj.itemCurrentIndex)
|
||||
// if (index >= 0 && index < hisrotyListModel.count) {
|
||||
// currentIndex = index
|
||||
// editText = currentText
|
||||
// // Todo: no effect, need to fix.
|
||||
// }
|
||||
}
|
||||
}
|
||||
SAKButton {
|
||||
@ -221,7 +225,10 @@ Item {
|
||||
id: menu
|
||||
Repeater {
|
||||
id: menuRepeater
|
||||
MenuItem { text: modelData; onTriggered: presotrerTool.send(index) }
|
||||
MenuItem {
|
||||
text: modelData
|
||||
onTriggered: presotrerTool.send(index)
|
||||
}
|
||||
}
|
||||
|
||||
function resetMenu() {
|
||||
@ -259,7 +266,7 @@ Item {
|
||||
Connections {
|
||||
target: communicationTool
|
||||
|
||||
function onBytesInputted(flag, inputedBytes) {
|
||||
function onBytesWritten(inputedBytes, to) {
|
||||
if (showTx) {
|
||||
var str = cookedBytes(flag, inputedBytes, false)
|
||||
outputTextArea.append(str)
|
||||
@ -278,7 +285,7 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
function appendHisroty (text, format) {
|
||||
function appendHisroty(text, format) {
|
||||
var count = hisrotyListModel.count
|
||||
for (var i = 0; i < count; i++) {
|
||||
if (i == 10) {
|
||||
@ -289,7 +296,7 @@ Item {
|
||||
if (item[keysObj.itemText] === text) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item = {}
|
||||
item[keysObj.itemText] = text
|
||||
@ -317,28 +324,30 @@ Item {
|
||||
var dateTimeInfo = ""
|
||||
if (showDate && showTime) {
|
||||
if (showMs) {
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd hh:mm:ss.zzz ");
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd hh:mm:ss.zzz ")
|
||||
} else {
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd hh:mm:ss ");
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd hh:mm:ss ")
|
||||
}
|
||||
} else if (showDate) {
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd ");
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd ")
|
||||
} else if (showTime) {
|
||||
if (showMs) {
|
||||
dateTimeInfo = sakInterface.dateTimeString("hh:mm:ss.zzz ");
|
||||
dateTimeInfo = sakInterface.dateTimeString("hh:mm:ss.zzz ")
|
||||
} else {
|
||||
dateTimeInfo = sakInterface.dateTimeString("hh:mm:ss ");
|
||||
dateTimeInfo = sakInterface.dateTimeString("hh:mm:ss ")
|
||||
}
|
||||
}
|
||||
dateTimeInfo = String("<font color=%1>%2</font>").arg(Material.color(Material.Grey)).arg(dateTimeInfo)
|
||||
dateTimeInfo = String("<font color=%1>%2</font>").arg(Material.color(Material.Grey)).arg(
|
||||
dateTimeInfo)
|
||||
|
||||
var flagInfo = isRx ? "Rx" : "Tx"
|
||||
flagInfo += "(" + flag + ")"
|
||||
flagInfo = isRx ? String("<font color=%1>%2</font>").arg(Material.color(Material.Red)).arg(flagInfo)
|
||||
: String("<font color=%1>%2</font>").arg(Material.color(Material.Blue)).arg(flagInfo)
|
||||
flagInfo = isRx ? String("<font color=%1>%2</font>").arg(Material.color(Material.Red)).arg(
|
||||
flagInfo) : String("<font color=%1>%2</font>").arg(
|
||||
Material.color(Material.Blue)).arg(flagInfo)
|
||||
|
||||
var cookedString = "[" + dateTimeInfo + " " + flagInfo + "] "
|
||||
cookedString = String("<font color=silver>%1</font>").arg(cookedString)
|
||||
cookedString = String("<font color=silver>%1</font>").arg(cookedString)
|
||||
var bytesString = sakInterface.arrayToString(bytes, outputFormat)
|
||||
cookedString += bytesString
|
||||
|
||||
|
||||
@ -77,5 +77,6 @@
|
||||
<file>qml/common/SAKTextFormatComboBox.qml</file>
|
||||
<file>qml/common/SAKToolButton.qml</file>
|
||||
<file>qml/common/SAKVerticalLine.qml</file>
|
||||
<file>qml/MainWindowToolBarItem.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user