mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
chore: remove useless files
This commit is contained in:
parent
30bad0a4e4
commit
ab57b607cd
@ -1,181 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
import QtQuick.Controls.Material
|
||||
|
||||
import SAK.Custom
|
||||
import "common"
|
||||
|
||||
Window {
|
||||
id: mainWindow
|
||||
|
||||
width: 1280
|
||||
height: 720
|
||||
visible: true
|
||||
color: "#00000000"
|
||||
title: qsTr("EasyDebug")
|
||||
flags: Qt.FramelessWindowHint | Qt.Window
|
||||
opacity: 0.4
|
||||
|
||||
property alias keysObj: settingKeys
|
||||
|
||||
property int edMaterialTheme: {
|
||||
if (!sakSettings) {
|
||||
return Material.System
|
||||
}
|
||||
|
||||
var theme = sakSettings.value(settingKeys.materialTheme)
|
||||
|
||||
if (theme === Material.Dark) {
|
||||
|
||||
//edMaterialAccent = Material.color(edMaterialAccent, Material.Shade200)
|
||||
}
|
||||
|
||||
if (theme) {
|
||||
return theme
|
||||
} else {
|
||||
return Material.System
|
||||
}
|
||||
}
|
||||
property string edMaterialAccent: {
|
||||
if (!sakSettings) {
|
||||
return Material.color(Material.Pink)
|
||||
}
|
||||
|
||||
var accent = sakSettings.value(settingKeys.materialAccent)
|
||||
if (accent) {
|
||||
return accent
|
||||
} else {
|
||||
return Material.color(Material.Pink)
|
||||
}
|
||||
}
|
||||
property string edMaterialPrimary: {
|
||||
if (!sakSettings) {
|
||||
return Material.color(Material.Pink)
|
||||
}
|
||||
|
||||
var primary = sakSettings.value(settingKeys.materialPrimary)
|
||||
if (primary) {
|
||||
return primary
|
||||
} else {
|
||||
return Material.color(Material.Indigo)
|
||||
}
|
||||
}
|
||||
|
||||
onEdMaterialThemeChanged: {
|
||||
if (sakSettings) {
|
||||
sakSettings.setValue(settingKeys.materialTheme, String(edMaterialTheme))
|
||||
}
|
||||
}
|
||||
onEdMaterialAccentChanged: {
|
||||
if (sakSettings) {
|
||||
sakSettings.setValue(settingKeys.materialAccent, String(edMaterialAccent))
|
||||
}
|
||||
}
|
||||
onEdMaterialPrimaryChanged: {
|
||||
if (sakSettings) {
|
||||
sakSettings.setValue(settingKeys.materialPrimary, String(edMaterialPrimary))
|
||||
}
|
||||
}
|
||||
|
||||
Material.theme: edMaterialTheme
|
||||
Material.accent: edMaterialAccent
|
||||
Material.primary: edMaterialPrimary
|
||||
|
||||
property bool isWindowed: visibility === Window.Windowed
|
||||
readonly property string edTrue: "true"
|
||||
readonly property string edFalse: "false"
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string materialTheme: "materialTheme"
|
||||
readonly property string materialAccent: "materialAccent"
|
||||
readonly property string materialPrimary: "materialPrimary"
|
||||
readonly property string pageIndex: "pageIndex"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onPositionChanged: function (mouse) {
|
||||
if (mouse.x < 4) {
|
||||
cursorShape = Qt.SizeHorCursor
|
||||
} else if (mouse.x > mainWindow.width - 4) {
|
||||
cursorShape = Qt.SizeHorCursor
|
||||
} else if (mouse.y < 4) {
|
||||
cursorShape = Qt.SizeVerCursor
|
||||
} else if (mouse.y > mainWindow.height - 4) {
|
||||
cursorShape = Qt.SizeVerCursor
|
||||
}
|
||||
}
|
||||
onPressed: function (mouse) {
|
||||
if (mouse.x < 4) {
|
||||
mainWindow.startSystemResize(Qt.LeftEdge)
|
||||
} else if (mouse.x > mainWindow.width - 4) {
|
||||
mainWindow.startSystemResize(Qt.RightEdge)
|
||||
} else if (mouse.y < 4) {
|
||||
mainWindow.startSystemResize(Qt.TopEdge)
|
||||
} else if (mouse.y > mainWindow.height - 4) {
|
||||
mainWindow.startSystemResize(Qt.BottomEdge)
|
||||
}
|
||||
}
|
||||
}
|
||||
Pane {
|
||||
id: mainWindowPane
|
||||
anchors.fill: parent
|
||||
anchors.margins: isWindowed ? 8 : 0
|
||||
padding: 0
|
||||
antialiasing: true
|
||||
background: Rectangle {
|
||||
id: mainWindowPaneBackgroundRectangle
|
||||
radius: isWindowed ? 8 : 0
|
||||
border.width: 0
|
||||
layer.enabled: true
|
||||
antialiasing: true
|
||||
color: Material.background
|
||||
layer.effect: DropShadow {
|
||||
antialiasing: true
|
||||
samples: mainWindowPaneBackgroundRectangle.radius * 2
|
||||
radius: mainWindowPaneBackgroundRectangle.radius
|
||||
}
|
||||
}
|
||||
MainWindowToolBar {
|
||||
id: toolBar
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
onPageIndexChanged: sakSettings.setValue(settingKeys.pageIndex, pageIndex)
|
||||
Component.onCompleted: {
|
||||
var index = sakSettings.value(settingKeys.pageIndex)
|
||||
if (index !== undefined) {
|
||||
pageIndex = index
|
||||
}
|
||||
}
|
||||
SAKVerticalLine {
|
||||
anchors.right: parent.right
|
||||
}
|
||||
}
|
||||
MainWindowTitleBar {
|
||||
id: titleBar
|
||||
mainWindowVisibility: mainWindow.visibility
|
||||
height: 40
|
||||
anchors.top: parent.top
|
||||
anchors.left: toolBar.right
|
||||
anchors.right: parent.right
|
||||
onInvokeClose: mainWindow.close()
|
||||
onInvokeShowWindowed: mainWindow.showNormal()
|
||||
onInvokeShowMaximized: mainWindow.showMaximized()
|
||||
onInvokeShowMinimized: mainWindow.showMinimized()
|
||||
}
|
||||
MainWindowPages {
|
||||
id: pageStackLayout
|
||||
pageIndex: toolBar.pageIndex
|
||||
anchors.top: titleBar.bottom
|
||||
anchors.left: toolBar.right
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
} // SAKPane
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
import QtQuick.Controls.Material
|
||||
|
||||
import SAK.Custom
|
||||
import "common"
|
||||
import "pages"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property alias pageIndex: pageStackLayout.currentIndex
|
||||
|
||||
StackLayout {
|
||||
id: pageStackLayout
|
||||
anchors.fill: parent
|
||||
SerialPortPage {
|
||||
id: comPage
|
||||
}
|
||||
|
||||
BleCentralPage {
|
||||
id: blePage
|
||||
}
|
||||
UdpClientPage {
|
||||
id: udpClientPage
|
||||
}
|
||||
UdpServerPage {
|
||||
id: udpServerPage
|
||||
}
|
||||
TcpClientPage {
|
||||
id: tcpClientPage
|
||||
}
|
||||
TcpServerPage {
|
||||
id: tcpServerPage
|
||||
}
|
||||
WebSocketClientPage {
|
||||
id: websocketClientPage
|
||||
}
|
||||
WebSocketServerPage {
|
||||
id: websocketServerPage
|
||||
}
|
||||
AboutPage {
|
||||
id: aboutPage
|
||||
}
|
||||
SettingsPage {
|
||||
id: settingsPage
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,99 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import "common"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property int mainWindowVisibility: Window.Windowed
|
||||
|
||||
signal invokeShowMaximized
|
||||
signal invokeShowMinimized
|
||||
signal invokeClose
|
||||
signal invokeShowWindowed
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPressed: {
|
||||
mainWindow.startSystemMove()
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
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"]
|
||||
Rectangle {
|
||||
id: bt
|
||||
height: root.height
|
||||
width: height * 1.4
|
||||
radius: index === 3 ? mainWindowVisibility === Window.Windowed ? 8 : 0 : 0
|
||||
visible: {
|
||||
if (index === 1) {
|
||||
return root.mainWindowVisibility !== Window.Windowed
|
||||
} else if (index === 2) {
|
||||
return root.mainWindowVisibility !== Window.Maximized
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
color: {
|
||||
if (index === 3) {
|
||||
return btMouse.containsMouse ? "red" : "#00000000"
|
||||
}
|
||||
|
||||
return btMouse.containsMouse ? Material.accent : "#00000000"
|
||||
}
|
||||
Rectangle {
|
||||
width: parent.radius
|
||||
anchors.left: parent.left
|
||||
height: parent.height
|
||||
color: parent.color
|
||||
visible: index === 3
|
||||
}
|
||||
Rectangle {
|
||||
height: parent.radius
|
||||
color: parent.color
|
||||
width: parent.width
|
||||
anchors.bottom: parent.bottom
|
||||
visible: index === 3
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: btMouse
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (index === 0) {
|
||||
root.invokeShowMinimized()
|
||||
} else if (index === 1) {
|
||||
root.invokeShowWindowed()
|
||||
} else if (index === 2) {
|
||||
root.invokeShowMaximized()
|
||||
} else if (index === 3) {
|
||||
root.invokeClose()
|
||||
}
|
||||
}
|
||||
}
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
height: parent.height * 0.6
|
||||
width: height
|
||||
source: modelData
|
||||
mipmap: true
|
||||
fillMode: Image.PreserveAspectFit
|
||||
//color: Material.foreground
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAKHorizontalLine {
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
@ -1,126 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "common"
|
||||
|
||||
ToolBar {
|
||||
id: root
|
||||
width: toolColumnLayout.width
|
||||
background: Rectangle {
|
||||
radius: isWindowed ? 8 : 0
|
||||
color: Material.primary
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
color: parent.color
|
||||
anchors.right: parent.right
|
||||
width: parent.radius
|
||||
}
|
||||
}
|
||||
|
||||
property int pageIndex: 0
|
||||
|
||||
signal invokeAddPage(var qmlFile)
|
||||
signal invokeRemovePage(var pageIndex)
|
||||
|
||||
ButtonGroup {
|
||||
id: bg
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: toolColumnLayout
|
||||
spacing: 0
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
Item {
|
||||
Layout.minimumHeight: titleBar.height
|
||||
Layout.fillWidth: true
|
||||
Row {
|
||||
spacing: 4
|
||||
anchors.centerIn: parent
|
||||
Text {
|
||||
id: easyText
|
||||
text: "Easy"
|
||||
color: "red"
|
||||
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: {
|
||||
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[1]
|
||||
checked: pageIndex === index
|
||||
text: modelData[0]
|
||||
leftPadding: 4
|
||||
onClicked: root.pageIndex = index
|
||||
onDoubleClicked: invokeRemovePage(index)
|
||||
|
||||
Layout.fillWidth: true
|
||||
Component.onCompleted: {
|
||||
bg.addButton(bt)
|
||||
if (index === pageIndex) {
|
||||
checked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
SAKHorizontalLine {
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
MainWindowToolBarItem {
|
||||
id: aboutToolButton
|
||||
checkable: true
|
||||
text: qsTr("About")
|
||||
icon.source: "qrc:/resources/icon/IconInfo.svg"
|
||||
onClicked: pageIndex = btRepeater.model.length
|
||||
Layout.fillWidth: true
|
||||
Component.onCompleted: bg.addButton(aboutToolButton)
|
||||
}
|
||||
MainWindowToolBarItem {
|
||||
id: settingsToolButton
|
||||
checkable: true
|
||||
text: qsTr("Settings")
|
||||
icon.source: "qrc:/resources/icon/IconSettings.svg"
|
||||
onClicked: pageIndex = btRepeater.model.length + 1
|
||||
Layout.fillWidth: true
|
||||
Component.onCompleted: bg.addButton(settingsToolButton)
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
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,6 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
RegularExpressionValidator {
|
||||
id: root
|
||||
regularExpression: /([ -~])*/
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
RegularExpressionValidator {
|
||||
id: root
|
||||
regularExpression: /([01][01][01][01][01][01][01][01][ ])*/
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
|
||||
SAKComboBox {
|
||||
id: root
|
||||
model: ble.names
|
||||
|
||||
property var bleController: ble
|
||||
|
||||
SAKBleScanner {
|
||||
id: ble
|
||||
}
|
||||
BusyIndicator {
|
||||
anchors.centerIn: parent
|
||||
visible: running
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
Button {
|
||||
id: root
|
||||
Material.roundedScale: Material.ExtraSmallScale
|
||||
}
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
CheckBox {
|
||||
id: root
|
||||
|
||||
property string settingKey: ""
|
||||
|
||||
onClicked: {
|
||||
if (settingKey) {
|
||||
sakSettings.setValue(settingKey, root.checked)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (settingKey) {
|
||||
var ret = sakSettings.value(settingKey)
|
||||
root.checked = ret === edTrue ? true : false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.Material
|
||||
|
||||
ComboBox {
|
||||
id: root
|
||||
property string settingKey: ""
|
||||
property bool useValueRole: true
|
||||
property string tips: ""
|
||||
|
||||
onActivated: {
|
||||
if (settingKey) {
|
||||
sakSettings.setValue(settingKey, useValueRole ? currentValue : currentText)
|
||||
}
|
||||
}
|
||||
|
||||
onEditTextChanged: {
|
||||
if (settingKey && editable) {
|
||||
//sakSettings.setValue(settingKey, useValueRole ? currentValue : editText)
|
||||
}
|
||||
}
|
||||
|
||||
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.open()
|
||||
} else {
|
||||
tipsPopup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
updateSettings()
|
||||
}
|
||||
|
||||
SAKPopup {
|
||||
id: tipsPopup
|
||||
dim: false
|
||||
modal: false
|
||||
contentItem: SAKLabel {
|
||||
text: tips
|
||||
}
|
||||
}
|
||||
|
||||
function updateSettings() {
|
||||
if (settingKey) {
|
||||
var parameter = sakSettings.value(settingKey)
|
||||
var ret = useValueRole ? root.indexOfValue(parameter) : root.find(parameter)
|
||||
if (ret !== -1) {
|
||||
root.currentIndex = ret
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
import SAK.Custom
|
||||
|
||||
SAKComboBox {
|
||||
id: root
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
model: ListModel {
|
||||
ListElement { text: "CRC_8"; value: SAKCrcInterface.CRC_8}
|
||||
ListElement { text: "CRC_8_ITU"; value: SAKCrcInterface.CRC_8_ITU}
|
||||
ListElement { text: "CRC_8_ROHC"; value: SAKCrcInterface.CRC_8_ROHC}
|
||||
ListElement { text: "CRC_8_MAXIM"; value: SAKCrcInterface.CRC_8_MAXIM}
|
||||
|
||||
ListElement { text: "CRC_16_IBM"; value: SAKCrcInterface.CRC_16_IBM}
|
||||
ListElement { text: "CRC_16_MAXIM"; value: SAKCrcInterface.CRC_16_MAXIM}
|
||||
ListElement { text: "CRC_16_USB"; value: SAKCrcInterface.CRC_16_USB}
|
||||
ListElement { text: "CRC_16_MODBUS"; value: SAKCrcInterface.CRC_16_MODBUS}
|
||||
ListElement { text: "CRC_16_CCITT"; value: SAKCrcInterface.CRC_16_CCITT}
|
||||
ListElement { text: "CRC_16_CCITT_FALSE"; value: SAKCrcInterface.CRC_16_CCITT_FALSE}
|
||||
ListElement { text: "CRC_16_x25"; value: SAKCrcInterface.CRC_16_x25}
|
||||
ListElement { text: "CRC_16_XMODEM"; value: SAKCrcInterface.CRC_16_XMODEM}
|
||||
ListElement { text: "CRC_16_DNP"; value: SAKCrcInterface.CRC_16_DNP}
|
||||
|
||||
ListElement { text: "CRC_32"; value: SAKCrcInterface.CRC_32}
|
||||
ListElement { text: "CRC_32_MPEG2"; value: SAKCrcInterface.CRC_32_MPEG2}
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
RegularExpressionValidator{
|
||||
id: root
|
||||
regularExpression: /([0-9][0-9][ ])*/
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
|
||||
SAKComboBox {
|
||||
id: root
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
model: ListModel {
|
||||
ListElement{text: qsTr("None"); value: SAKDataStructure.EscapeCharacterOptionNone}
|
||||
ListElement{text: "\\r"; value: SAKDataStructure.EscapeCharacterOptionR}
|
||||
ListElement{text: "\\n"; value: SAKDataStructure.EscapeCharacterOptionN}
|
||||
ListElement{text: "\\r\\n"; value: SAKDataStructure.EscapeCharacterOptionRN}
|
||||
ListElement{text: "\\n\\r"; value: SAKDataStructure.EscapeCharacterOptionNR}
|
||||
ListElement{text: "\\rAnd\\n"; value: SAKDataStructure.EscapeCharacterOptionRAndN}
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
SAKComboBox {
|
||||
id: root
|
||||
//model: edFontFamilies
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
GroupBox {
|
||||
id: root
|
||||
padding: 8
|
||||
background: Rectangle {
|
||||
color: Material.background
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
RegularExpressionValidator {
|
||||
id: root
|
||||
regularExpression: /([0-9a-fA-F][0-9a-fA-F][ ])*/
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "gray"
|
||||
opacity: 0.5
|
||||
height: 1
|
||||
|
||||
property bool autoScale: true
|
||||
|
||||
onParentChanged: {
|
||||
if (parent && autoScale) {
|
||||
anchors.left = Qt.binding(function func(){ return parent.left })
|
||||
anchors.right = Qt.binding(function func(){ return parent.right })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
import SAK.Custom
|
||||
|
||||
SAKComboBox {
|
||||
id: root
|
||||
editable: true
|
||||
model: networkInterface.ipList
|
||||
|
||||
property alias enableIpV4: networkInterface.enableIpV4
|
||||
property alias enableIpV6: networkInterface.enableIpV6
|
||||
property alias enableAutoRefresh: networkInterface.enableAutoRefresh
|
||||
|
||||
SAKNetworkInterfaceScanner {
|
||||
id: networkInterface
|
||||
enableAutoRefresh: root.enabled
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
Label {
|
||||
id: root
|
||||
//renderType: Text.QtRendering
|
||||
}
|
||||
@ -1,121 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
|
||||
GridLayout {
|
||||
id: root
|
||||
columns: 10
|
||||
|
||||
property string specifyColor: ""
|
||||
property var option: SAKMaterialColors.Option.MaterialUnknow
|
||||
|
||||
enum Option {
|
||||
MaterialUnknow,
|
||||
MaterialAccent,
|
||||
MaterialPrimary,
|
||||
MaterialForeground,
|
||||
MaterialBackground
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: mainWindow
|
||||
function onEdMaterialThemeChanged() {
|
||||
colorRepeater.model = colorModel()
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: colorRepeater
|
||||
SAKButton {
|
||||
Rectangle {
|
||||
id: colorRectangle
|
||||
anchors.fill: parent
|
||||
color: edColor(modelData, option === SAKMaterialColors.Option.MaterialPrimary)
|
||||
SAKCheckBox {
|
||||
anchors.centerIn: parent
|
||||
checked: visible
|
||||
visible: {
|
||||
if (option === SAKMaterialColors.Option.MaterialAccent) {
|
||||
return edColor(modelData, false) === Material.accent
|
||||
} else if (option === SAKMaterialColors.Option.MaterialPrimary) {
|
||||
return edColor(modelData, true) === Material.primary
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (option === SAKMaterialColors.Option.MaterialAccent) {
|
||||
edMaterialAccent = edColor(modelData, false)
|
||||
} else if (option === SAKMaterialColors.Option.MaterialPrimary) {
|
||||
edMaterialPrimary = edColor(modelData, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: addButton
|
||||
icon.source: "qrc:/resources/icon/IconAdd.svg"
|
||||
onClicked: colorDialog.open()
|
||||
property string bgColor: "white"
|
||||
Layout.alignment: Qt.AlignHCenter|Qt.AlignVCenter
|
||||
}
|
||||
|
||||
|
||||
ColorDialog {
|
||||
id: colorDialog
|
||||
selectedColor: addButton.bgColor
|
||||
onAccepted: {
|
||||
addButton.bgColor = selectedColor
|
||||
if (option === SAKMaterialColors.Option.MaterialAccent) {
|
||||
edMaterialAccent = selectedColor
|
||||
} else if (option === SAKMaterialColors.Option.MaterialPrimary) {
|
||||
edMaterialPrimary = selectedColor
|
||||
} else {
|
||||
console.warn("Unknow option type of Material. The color is:", selectedColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: colorRepeater.model = colorModel()
|
||||
|
||||
function edColor(color, isPrimary) {
|
||||
if (edMaterialTheme === Material.Dark) {
|
||||
if (isPrimary) {
|
||||
return Material.color(color)
|
||||
} else {
|
||||
return Material.color(color, Material.Shade200)
|
||||
}
|
||||
} else {
|
||||
return Material.color(color)
|
||||
}
|
||||
}
|
||||
|
||||
function colorModel() {
|
||||
var colors = []
|
||||
colors.push(Material.Red)
|
||||
colors.push(Material.Pink)
|
||||
colors.push(Material.Purple)
|
||||
colors.push(Material.DeepPurple)
|
||||
colors.push(Material.Indigo)
|
||||
colors.push(Material.Blue)
|
||||
colors.push(Material.LightBlue)
|
||||
colors.push(Material.Cyan)
|
||||
colors.push(Material.Teal)
|
||||
colors.push(Material.Green)
|
||||
colors.push(Material.LightGreen)
|
||||
colors.push(Material.Lime)
|
||||
colors.push(Material.Yellow)
|
||||
colors.push(Material.Amber)
|
||||
colors.push(Material.Orange)
|
||||
colors.push(Material.DeepOrange)
|
||||
colors.push(Material.Brown)
|
||||
colors.push(Material.Grey)
|
||||
colors.push(Material.BlueGrey)
|
||||
|
||||
return colors
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
RegularExpressionValidator {
|
||||
id: root
|
||||
regularExpression: /([0-7][0-7][ ])*/
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
Pane {
|
||||
id: root
|
||||
background: Rectangle {
|
||||
radius: 8
|
||||
color: Material.background
|
||||
border.width: 0
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
Popup {
|
||||
id: root
|
||||
dim: true
|
||||
parent: Overlay.overlay
|
||||
x: Math.round((parent.width - width) / 2)
|
||||
y: Math.round((parent.height - height) / 2)
|
||||
modal: true
|
||||
|
||||
signal accepted()
|
||||
signal rejected()
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
ProgressBar {
|
||||
id: root
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
SAKComboBox {
|
||||
id: root
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
model: ListModel {
|
||||
ListElement{text: qsTr("None"); value: ""}
|
||||
ListElement{text: "\\r"; value: "\r"}
|
||||
ListElement{text: "\\n"; value: "\n"}
|
||||
ListElement{text: "\\r\\n"; value: "\r\n"}
|
||||
ListElement{text: "\\n\\r"; value: "\n\r"}
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
|
||||
SAKComboBox {
|
||||
id: root
|
||||
valueRole: "value"
|
||||
textRole: "text"
|
||||
model: ListModel {
|
||||
//ListElement { text: qsTr("Disable"); value: SAKDataStructure.ResponseOptionDisable }
|
||||
ListElement { text: qsTr("Echo"); value: SAKDataStructure.ResponseOptionEcho }
|
||||
ListElement { text: qsTr("Aways"); value: SAKDataStructure.ResponseOptionAlways }
|
||||
ListElement { text: qsTr("InputEqualReference"); value: SAKDataStructure.ResponseOptionInputEqualReference }
|
||||
ListElement { text: qsTr("InputContainReference"); value: SAKDataStructure.ResponseOptionInputContainReference }
|
||||
ListElement { text: qsTr("InputDiscontainReference"); value: SAKDataStructure.ResponseOptionInputDiscontainReference }
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
SpinBox {
|
||||
id: root
|
||||
property string settingKey: ""
|
||||
from: 0
|
||||
to: 24*60*60*1000
|
||||
editable: true
|
||||
|
||||
onValueModified: {
|
||||
if (settingKey) {
|
||||
sakSettings.setValue(settingKey, root.value)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (settingKey) {
|
||||
var v = sakSettings.value(settingKey)
|
||||
if (v) {
|
||||
root.value = v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
Text {
|
||||
id: root
|
||||
}
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick.Controls
|
||||
|
||||
TextArea {
|
||||
id: root
|
||||
}
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
TextField {
|
||||
id: root
|
||||
|
||||
property string settingKey: ""
|
||||
|
||||
onTextEdited: {
|
||||
if (settingKey) {
|
||||
sakSettings.setValue(settingKey, root.text)
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (settingKey) {
|
||||
var txt = sakSettings.value(settingKey)
|
||||
if (txt) {
|
||||
root.text = txt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,91 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
import SAK.Custom
|
||||
|
||||
SAKComboBox {
|
||||
id: root
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
model: ListModel {
|
||||
id: listModel
|
||||
ListElement { text: "Bin"; value: SAKDataStructure.TextFormatBin }
|
||||
ListElement { text: "Otc"; value: SAKDataStructure.TextFormatOct }
|
||||
ListElement { text: "Dec"; value: SAKDataStructure.TextFormatDec }
|
||||
ListElement { text: "Hex"; value: SAKDataStructure.TextFormatHex }
|
||||
ListElement { text: "Ascii"; value: SAKDataStructure.TextFormatAscii }
|
||||
ListElement { text: "Utf8"; value: SAKDataStructure.TextFormatUtf8 }
|
||||
}
|
||||
|
||||
property bool enableBin: true
|
||||
property bool enableOtc: true
|
||||
property bool enableDec: true
|
||||
property bool enableHex: true
|
||||
property bool enableAscii: true
|
||||
property bool enableUtf8: true
|
||||
|
||||
SAKBinRegularExpressionValidator{ id: binREV }
|
||||
SAKOctRegularExpressionValidator{ id: octREV }
|
||||
SAKDecRegularExpressionValidator{ id: decREV }
|
||||
SAKHexRegularExpressionValidator{ id: hexREV }
|
||||
SAKAsciiRegularExpressionValidator{ id: asciiREV }
|
||||
|
||||
property var currentValidator: {
|
||||
if (currentValue === SAKDataStructure.TextFormatBin) {
|
||||
return binREV
|
||||
} else if (currentValue === SAKDataStructure.TextFormatOct) {
|
||||
return octREV
|
||||
} else if (currentValue === SAKDataStructure.TextFormatDec) {
|
||||
return decREV
|
||||
} else if (currentValue === SAKDataStructure.TextFormatHex) {
|
||||
return hexREV
|
||||
} else if (currentValue === SAKDataStructure.TextFormatAscii) {
|
||||
return asciiREV
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!enableBin) {
|
||||
var ret = root.indexOfValue(SAKDataStructure.TextFormatBin)
|
||||
if (ret !== -1) {
|
||||
listModel.remove(ret)
|
||||
}
|
||||
}
|
||||
|
||||
if (!enableOtc) {
|
||||
ret = root.indexOfValue(SAKDataStructure.TextFormatOct)
|
||||
if (ret !== -1) {
|
||||
listModel.remove(ret)
|
||||
}
|
||||
}
|
||||
|
||||
if (!enableDec) {
|
||||
ret = root.indexOfValue(SAKDataStructure.TextFormatDec)
|
||||
if (ret !== -1) {
|
||||
listModel.remove(ret)
|
||||
}
|
||||
}
|
||||
|
||||
if (!enableHex) {
|
||||
ret = root.indexOfValue(SAKDataStructure.TextFormatHex)
|
||||
if (ret !== -1) {
|
||||
listModel.remove(ret)
|
||||
}
|
||||
}
|
||||
|
||||
if (!enableAscii) {
|
||||
ret = root.indexOfValue(SAKDataStructure.TextFormatAscii)
|
||||
if (ret !== -1) {
|
||||
listModel.remove(ret)
|
||||
}
|
||||
}
|
||||
|
||||
if (!enableUtf8) {
|
||||
ret = root.indexOfValue(SAKDataStructure.TextFormatUtf8)
|
||||
if (ret !== -1) {
|
||||
listModel.remove(ret)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.Material
|
||||
|
||||
ToolButton {
|
||||
id: root
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
import QtQuick
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "gray"
|
||||
opacity: 0.5
|
||||
width: 1
|
||||
|
||||
property bool autoScale: true
|
||||
|
||||
onParentChanged: {
|
||||
if (parent && autoScale) {
|
||||
anchors.top = Qt.binding(function func(){ return parent.top })
|
||||
anchors.bottom = Qt.binding(function func(){ return parent.bottom })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../common"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
contentItem: Item {
|
||||
GridLayout {
|
||||
columns: 2
|
||||
SAKLabel {
|
||||
text: qsTr("Version:")
|
||||
}
|
||||
SAKLabel {
|
||||
text: Application.version
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Report a bug:")
|
||||
}
|
||||
SAKLabel {
|
||||
text: "qsaker@foxmail.com"
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Build info:")
|
||||
}
|
||||
SAKLabel {
|
||||
text: sakInterface.buildDateTime(sakInterface.dateFormat(
|
||||
) + " " + sakInterface.timeFormat())
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("User QQ Group:")
|
||||
}
|
||||
Row {
|
||||
spacing: 8
|
||||
SAKLabel {
|
||||
id: qqGroupLabel
|
||||
text: "952218522"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
SAKButton {
|
||||
text: qsTr("Copy")
|
||||
onClicked: sakInterface.setClipboardText(qqGroupLabel.text)
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Copyright information:")
|
||||
}
|
||||
SAKLabel {
|
||||
text: String("Copyright 2023-%1 Qsaker. All rights reserved.").arg(
|
||||
sakInterface.buildDateTime("yyyy"))
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../common"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
|
||||
Item {
|
||||
id: controllerArea
|
||||
width: 250
|
||||
height: root.height
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
Item {
|
||||
id: outoutArea
|
||||
}
|
||||
Item {
|
||||
id: inputArea
|
||||
}
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Universal
|
||||
|
||||
import SAK.Custom
|
||||
import "../toolbox"
|
||||
|
||||
ToolBox {
|
||||
id: root
|
||||
controllerComponent: comComtrollerComponent
|
||||
groupName: "BleCentral"
|
||||
|
||||
property SAKBleCentralTool bleCentral: toolBox.communication ? toolBox.communication : null
|
||||
|
||||
Component {
|
||||
id: comComtrollerComponent
|
||||
BleCentralPageController {
|
||||
onInvokeChangedNotify: root.onInvokeChangedNotify()
|
||||
onInvokeRead: root.onInvokeRead()
|
||||
onCurrentCharacteristicIndexChanged: updateNotify()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: bleCentral
|
||||
function onDescriptorWritten(descriptor, newValue) {
|
||||
updateNotify(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toolBox.initialize(SAKToolsFactory.BleCentral)
|
||||
if (bleCentral) {
|
||||
var controller = deviceControllerLoader.item
|
||||
bleCentral.currentCharacteristicIndex = Qt.binding(function () {
|
||||
return controller.currentCharacteristicIndex
|
||||
})
|
||||
bleCentral.currentServiceIndex = Qt.binding(function () {
|
||||
return controller.currentServiceIndex
|
||||
})
|
||||
bleCentral.writeModel = Qt.binding(function () {
|
||||
return controller.writeModel
|
||||
})
|
||||
controller.characteristicNames = Qt.binding(function () {
|
||||
return bleCentral.characteristicNames
|
||||
})
|
||||
controller.serviceNames = Qt.binding(function () {
|
||||
return bleCentral.serviceNames
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onInvokeOpenDevice: {
|
||||
toolBox.open()
|
||||
}
|
||||
|
||||
onInvokeCloseDevice: {
|
||||
toolBox.close()
|
||||
}
|
||||
|
||||
function onInvokeChangedNotify() {
|
||||
bleCentral.changeNotify()
|
||||
}
|
||||
|
||||
function onInvokeRead() {
|
||||
bleCentral.readCharacteristic()
|
||||
}
|
||||
|
||||
function updateNotify(value) {
|
||||
var cookedValue = sakInterface.arrayToString(value, sakDataStructure.TextFormatHex)
|
||||
var controller = deviceControllerLoader.item
|
||||
if (cookedValue === "00 00") {
|
||||
controller.setNotifyText(false)
|
||||
} else {
|
||||
controller.setNotifyText(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,117 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property alias filtter: filtterTextField.text
|
||||
property alias timerout: timeoutSpinBox.text
|
||||
|
||||
property alias currentServiceIndex: serviceComboBox.currentIndex
|
||||
property alias currentCharacteristicIndex: characteristicsComboBox.currentIndex
|
||||
property alias writeModel: writtingComboBox.currentIndex
|
||||
property alias serviceNames: serviceComboBox.model
|
||||
property alias characteristicNames: characteristicsComboBox.model
|
||||
|
||||
signal invokeChangedNotify
|
||||
signal invokeRead
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string filter: groupName + "/filter"
|
||||
readonly property string timeout: groupName + "/timeout"
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: contentGridLayout
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
SAKLabel {
|
||||
text: qsTr("BLE central settings")
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Device list")
|
||||
}
|
||||
SAKBleComboBox {
|
||||
id: namesComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("filter")
|
||||
}
|
||||
SAKTextField {
|
||||
id: filtterTextField
|
||||
settingKey: settingKeys.filter
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: namesComboBox.bleController.filtter = text
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Timeout")
|
||||
}
|
||||
SAKTextField {
|
||||
id: timeoutSpinBox
|
||||
settingKey: settingKeys.timeout
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: namesComboBox.bleController.timeout = Number(text)
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Services")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: serviceComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Characteristics")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: characteristicsComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Writting")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: writtingComboBox
|
||||
model: [qsTr("Write"), qsTr("Write without Response")]
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Grid {
|
||||
id: btGrid
|
||||
columns: 2
|
||||
spacing: contentGridLayout.columnSpacing
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
Repeater {
|
||||
id: btRepeater
|
||||
model: [qsTr("Notify"), qsTr("Read")]
|
||||
SAKButton {
|
||||
text: modelData
|
||||
width: (parent.width - btGrid.spacing) / 2
|
||||
onClicked: {
|
||||
if (index === 0) {
|
||||
root.invokeChangedNotify()
|
||||
} else {
|
||||
root.invokeRead()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setNotifyText(notified) {
|
||||
var bt = btRepeater.itemAt(0)
|
||||
bt.text = notified ? qsTr("Unnotify") : qsTR("Notify")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setNotifyText(notified) {
|
||||
btGrid.setNotifyText(notified)
|
||||
}
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Universal
|
||||
|
||||
import SAK.Custom
|
||||
import "../toolbox"
|
||||
|
||||
ToolBox {
|
||||
id: root
|
||||
controllerComponent: comComtrollerComponent
|
||||
groupName: "SerialportToolBox"
|
||||
|
||||
property SAKSerialport comTool: null
|
||||
|
||||
Component {
|
||||
id: comComtrollerComponent
|
||||
SerialPortPageController {
|
||||
comTool: root.toolBox.communicator
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toolBox.initialize(SAKToolsFactory.SerialportTool)
|
||||
comTool = toolBox.communicator
|
||||
}
|
||||
|
||||
onInvokeOpenDevice: {
|
||||
var comComtroller = deviceControllerLoader.item
|
||||
var portName = comComtroller.portName()
|
||||
var baudRate = comComtroller.baudRate()
|
||||
var dataBits = comComtroller.dataBits()
|
||||
var stopBits = comComtroller.stopBits()
|
||||
var flowControl = comComtroller.flowControl()
|
||||
var parity = comComtroller.parity()
|
||||
|
||||
comTool.portName = portName
|
||||
comTool.baudRate = baudRate
|
||||
comTool.dataBits = dataBits
|
||||
comTool.stopBits = stopBits
|
||||
comTool.parity = parity
|
||||
comTool.flowControl = flowControl
|
||||
toolBox.open()
|
||||
}
|
||||
|
||||
onInvokeCloseDevice: {
|
||||
toolBox.close()
|
||||
}
|
||||
}
|
||||
@ -1,307 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property var portNames: []
|
||||
property var baudRates: []
|
||||
|
||||
property SAKSerialport comTool: null
|
||||
property bool devIsWorking: comTool ? comTool.isWorking : false
|
||||
property bool ignoredUpdate: comTool ? comTool.isWorking : false
|
||||
|
||||
signal invokeRefreshDevice
|
||||
|
||||
onIgnoredUpdateChanged: spController.setIgnoredUpdate(ignoredUpdate)
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
|
||||
readonly property string portName: groupName + "/portNmae"
|
||||
readonly property string baudRate: groupName + "/baudRate"
|
||||
readonly property string dataBits: groupName + "/dataBits"
|
||||
readonly property string stopBits: groupName + "/stopBits"
|
||||
readonly property string parity: groupName + "/parity"
|
||||
readonly property string flowControl: groupName + "/flowControl"
|
||||
readonly property string customBaudRate: groupName + "/customBaudRate"
|
||||
readonly property string ignoredBusyDevice: groupName + "/ignoredBusyDevice"
|
||||
readonly property string autoUpdatePortNames: groupName + "/autoUpdatePortNames"
|
||||
}
|
||||
|
||||
SAKSerialPortScanner {
|
||||
id: spController
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
SAKLabel {
|
||||
Layout.columnSpan: 2
|
||||
text: qsTr("Serial port settings")
|
||||
font.weight: Font.Bold
|
||||
color: Material.foreground
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Port name")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: portNameComboBox
|
||||
model: spController.portNames
|
||||
enabled: !devIsWorking
|
||||
Layout.fillWidth: true
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.portName, portNameComboBox.currentText)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var portName = sakSettings.value(settingKeys.portName)
|
||||
var ret = portNameComboBox.find(portName)
|
||||
if (ret !== -1) {
|
||||
portNameComboBox.currentIndex = ret
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Baud rate")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: baudRateComboBox
|
||||
model: spController.baudRates
|
||||
editable: true
|
||||
enabled: !devIsWorking
|
||||
Layout.fillWidth: true
|
||||
onActivated: {
|
||||
writeBaudRateToIniFile()
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var baudRate = sakSettings.value(settingKeys.baudRate)
|
||||
var defaultBaudRate = "9600"
|
||||
if (baudRate !== 0) {
|
||||
defaultBaudRate = String(baudRate)
|
||||
}
|
||||
|
||||
var ret = baudRateComboBox.find(defaultBaudRate)
|
||||
if (ret !== -1) {
|
||||
baudRateComboBox.currentIndex = ret
|
||||
}
|
||||
}
|
||||
|
||||
function writeBaudRateToIniFile() {
|
||||
var bd = Number(baudRateComboBox.currentText)
|
||||
sakSettings.setValue(settingKeys.baudRate, bd)
|
||||
}
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Stop bits")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: stopBitsComboBox
|
||||
valueRole: "value"
|
||||
textRole: "text"
|
||||
enabled: !devIsWorking
|
||||
Layout.fillWidth: true
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
text: "1"
|
||||
value: 1
|
||||
}
|
||||
ListElement {
|
||||
text: "1.5"
|
||||
value: 3
|
||||
}
|
||||
ListElement {
|
||||
text: "2"
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.stopBits, stopBitsComboBox.currentValue)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var stopBits = sakSettings.value(settingKeys.stopBits)
|
||||
if (stopBits !== 0) {
|
||||
var ret = stopBitsComboBox.indexOfValue(stopBits)
|
||||
if (ret !== -1) {
|
||||
stopBitsComboBox.currentIndex = ret
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Data bits")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: dataBitsComboBox
|
||||
valueRole: "value"
|
||||
textRole: "text"
|
||||
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
|
||||
}
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.dataBits, dataBitsComboBox.currentValue)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var dataBit = sakSettings.value(settingKeys.dataBits)
|
||||
if (dataBit !== 0) {
|
||||
var ret = dataBitsComboBox.indexOfValue(dataBit)
|
||||
if (ret !== -1) {
|
||||
dataBitsComboBox.currentIndex = ret
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Parity")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: parityComboBox
|
||||
valueRole: "value"
|
||||
textRole: "text"
|
||||
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
|
||||
}
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.parity, parityComboBox.currentValue)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var parity = sakSettings.value(settingKeys.parity)
|
||||
if (parity !== 0) {
|
||||
var ret = parityComboBox.indexOfValue(parity)
|
||||
if (ret !== -1) {
|
||||
parityComboBox.currentIndex = ret
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Flow control")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: flowControlComboBox
|
||||
valueRole: "value"
|
||||
textRole: "text"
|
||||
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
|
||||
}
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(settingKeys.flowControl, flowControlComboBox.currentValue)
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var flowControl = sakSettings.value(settingKeys.flowControl)
|
||||
if (flowControl !== 0) {
|
||||
var ret = flowControlComboBox.indexOfValue(flowControl)
|
||||
if (ret !== -1) {
|
||||
flowControlComboBox.currentIndex = ret
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
|
||||
function portName() {
|
||||
return portNameComboBox.currentText
|
||||
}
|
||||
|
||||
function baudRate() {
|
||||
return parseInt(baudRateComboBox.currentText)
|
||||
}
|
||||
|
||||
function dataBits() {
|
||||
return dataBitsComboBox.currentValue
|
||||
}
|
||||
|
||||
function stopBits() {
|
||||
return stopBitsComboBox.currentValue
|
||||
}
|
||||
|
||||
function parity() {
|
||||
return parityComboBox.currentValue
|
||||
}
|
||||
|
||||
function flowControl() {
|
||||
return flowControlComboBox.currentValue
|
||||
}
|
||||
}
|
||||
@ -1,175 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
ScrollView {
|
||||
anchors.fill: parent
|
||||
ColumnLayout {
|
||||
SAKLabel {
|
||||
text: qsTr("General")
|
||||
font.bold: true
|
||||
}
|
||||
SAKLabel {
|
||||
id: dpiLabel
|
||||
text: qsTr("High dpi scale factor rounding policy (need to reboot the app)")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: hidComboBox
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
model: ListModel {
|
||||
id: hidListModel
|
||||
ListElement {
|
||||
text: qsTr(".5")
|
||||
value: 1
|
||||
detail: qsTr("Round up for .5 and above.")
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Up")
|
||||
value: 2
|
||||
detail: qsTr("Always round up.")
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Down")
|
||||
value: 3
|
||||
detail: qsTr("Always round down.")
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr(".75")
|
||||
value: 4
|
||||
detail: qsTr("Round up for .75 and above.")
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Don't")
|
||||
value: 5
|
||||
detail: qsTr("Don't round.")
|
||||
}
|
||||
}
|
||||
|
||||
onActivated: sakSettings.hdpiPolicy = hidComboBox.currentValue
|
||||
|
||||
property string detail: hidListModel.get(currentIndex).detail
|
||||
|
||||
Component.onCompleted: {
|
||||
var v = sakSettings.hdpiPolicy
|
||||
var ret = hidComboBox.indexOfValue(v)
|
||||
if (ret >= 0 && ret < hidComboBox.count) {
|
||||
hidComboBox.currentIndex = ret
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: String("(%1)").arg(hidComboBox.detail)
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("UI")
|
||||
}
|
||||
SAKComboBox {
|
||||
model: [qsTr("Classical"), qsTr("Modern")]
|
||||
onActivated: {
|
||||
if (currentIndex === 0) {
|
||||
sakSettings.uiType = SAKSettings.UiTypeWidget
|
||||
} else {
|
||||
sakSettings.uiType = SAKSettings.UiTypeQml
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (sakSettings.uiType === SAKSettings.UiTypeQml) {
|
||||
currentIndex = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Language")
|
||||
}
|
||||
SAKComboBox {
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
settingKey: "language"
|
||||
//Layout.fillWidth: true
|
||||
model: ListModel {
|
||||
id: languageListModel
|
||||
}
|
||||
onActivated: sakI18n.installTranslator(currentValue)
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Font Family")
|
||||
visible: false
|
||||
}
|
||||
SAKFontFamiliesComboBox {
|
||||
settingKey: "fontFamily"
|
||||
//Layout.fillWidth: true
|
||||
onActivated: sakInterface.setAppFont(currentText)
|
||||
visible: false
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Theme")
|
||||
font.bold: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Application theme")
|
||||
}
|
||||
SAKComboBox {
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
settingKey: mainWindow.keysObj.materialTheme
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
text: qsTr("System")
|
||||
value: Material.System
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Dark")
|
||||
value: Material.Dark
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Light")
|
||||
value: Material.Light
|
||||
}
|
||||
}
|
||||
onActivated: edMaterialTheme = currentValue
|
||||
Component.onCompleted: edMaterialTheme = currentValue
|
||||
}
|
||||
Repeater {
|
||||
model: [[qsTr("Accent color"), SAKMaterialColors.Option.MaterialAccent], [qsTr("Primary color"), SAKMaterialColors.Option.MaterialPrimary]]
|
||||
Column {
|
||||
SAKLabel {
|
||||
text: modelData[0]
|
||||
}
|
||||
SAKMaterialColors {
|
||||
option: modelData[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Reset accent color and primary to default")
|
||||
}
|
||||
SAKButton {
|
||||
text: qsTr("Reset")
|
||||
onClicked: {
|
||||
edMaterialPrimary = Material.color(Material.Indigo)
|
||||
if (edMaterialTheme === Material.Dark) {
|
||||
edMaterialAccent = Material.color(Material.Pink, Material.Shade200)
|
||||
} else {
|
||||
edMaterialAccent = Material.color(Material.Pink)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
var list = sakI18n.languanges
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var item = {}
|
||||
item["text"] = list[i]["friendly-name"]
|
||||
item["value"] = list[i]["name"]
|
||||
languageListModel.append(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Universal
|
||||
|
||||
import SAK.Custom
|
||||
import "../toolbox"
|
||||
|
||||
ToolBox {
|
||||
id: root
|
||||
controllerComponent: comComtrollerComponent
|
||||
groupName: "TCPClient"
|
||||
|
||||
property SAKTcpClientTool tcpClientTool: null
|
||||
|
||||
Component {
|
||||
id: comComtrollerComponent
|
||||
TcpClientPageController {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toolBox.initialize(SAKToolsFactory.TcpClientTool)
|
||||
tcpClientTool = toolBox.communicator
|
||||
if (tcpClientTool) {
|
||||
var controller = deviceControllerLoader.item
|
||||
tcpClientTool.clientIp = Qt.binding(function () {
|
||||
return controller.deviceController.clientIp
|
||||
})
|
||||
tcpClientTool.clientPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.clientPort)
|
||||
})
|
||||
tcpClientTool.specifyClientIpPort = Qt.binding(function () {
|
||||
return controller.deviceController.specifyClientIpPort
|
||||
})
|
||||
tcpClientTool.serverIp = Qt.binding(function () {
|
||||
return controller.deviceController.serverIp
|
||||
})
|
||||
tcpClientTool.serverPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.serverPort)
|
||||
})
|
||||
controller.deviceController.bindingIpPort = Qt.binding(function () {
|
||||
return tcpClientTool.bindingIpPort
|
||||
})
|
||||
controller.deviceController.deviceIsWorking = Qt.binding(function () {
|
||||
return tcpClientTool.isWorking
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onInvokeOpenDevice: {
|
||||
toolBox.open()
|
||||
}
|
||||
|
||||
onInvokeCloseDevice: {
|
||||
toolBox.close()
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
import "../toolbox"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property alias deviceController: controller
|
||||
|
||||
ToolBoxCommonClient {
|
||||
id: controller
|
||||
anchors.fill: parent
|
||||
title: qsTr("TCP client settings")
|
||||
}
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Universal
|
||||
|
||||
import SAK.Custom
|
||||
import "../toolbox"
|
||||
|
||||
ToolBox {
|
||||
id: root
|
||||
controllerComponent: comComtrollerComponent
|
||||
groupName: "TcpServer"
|
||||
|
||||
property SAKTcpServerTool tcpServerTool: nullptr
|
||||
|
||||
Component {
|
||||
id: comComtrollerComponent
|
||||
TcpServerPageController {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toolBox.initialize(SAKToolsFactory.TcpServerTool)
|
||||
tcpServerTool = toolBox.communicator
|
||||
if (tcpServerTool) {
|
||||
var controller = deviceControllerLoader.item
|
||||
tcpServerTool.serverIp = Qt.binding(function () {
|
||||
return controller.deviceController.serverIp
|
||||
})
|
||||
tcpServerTool.serverPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.serverPort)
|
||||
})
|
||||
tcpServerTool.clientIndex = Qt.binding(function () {
|
||||
return Number(controller.deviceController.clientIndex)
|
||||
})
|
||||
controller.deviceController.deviceIsWorking = Qt.binding(function () {
|
||||
return tcpServerTool.isWorking
|
||||
})
|
||||
controller.deviceController.clients = Qt.binding(function () {
|
||||
return tcpServerTool.clients
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onInvokeOpenDevice: {
|
||||
toolBox.open()
|
||||
}
|
||||
|
||||
onInvokeCloseDevice: {
|
||||
toolBox.close()
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
import "../toolbox"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property alias deviceController: controller
|
||||
|
||||
ToolBoxCommonServer {
|
||||
id: controller
|
||||
anchors.fill: parent
|
||||
title: qsTr("TCP server settings")
|
||||
}
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Universal
|
||||
|
||||
import SAK.Custom
|
||||
import "../toolbox"
|
||||
|
||||
ToolBox {
|
||||
id: root
|
||||
controllerComponent: controllerComponent
|
||||
groupName: "UDPClient"
|
||||
|
||||
property SAKUdpClientTool udpClientTool: null
|
||||
|
||||
Component {
|
||||
id: controllerComponent
|
||||
UdpClientPageController {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toolBox.initialize(SAKToolsFactory.UdpClientTool)
|
||||
udpClientTool = toolBox.communicator
|
||||
if (udpClientTool) {
|
||||
var controller = deviceControllerLoader.item
|
||||
udpClientTool.clientIp = Qt.binding(function () {
|
||||
return controller.deviceController.clientIp
|
||||
})
|
||||
udpClientTool.clientPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.clientPort)
|
||||
})
|
||||
udpClientTool.specifyClientIpPort = Qt.binding(function () {
|
||||
return controller.deviceController.specifyClientIpPort
|
||||
})
|
||||
udpClientTool.serverIp = Qt.binding(function () {
|
||||
return controller.deviceController.serverIp
|
||||
})
|
||||
udpClientTool.serverPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.serverPort)
|
||||
})
|
||||
controller.deviceController.bindingIpPort = Qt.binding(function () {
|
||||
return udpClientTool.bindingIpPort
|
||||
})
|
||||
controller.deviceController.deviceIsWorking = Qt.binding(function () {
|
||||
return udpClientTool.isWorking
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onInvokeOpenDevice: toolBox.open()
|
||||
onInvokeCloseDevice: toolBox.close()
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
import "../toolbox"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property alias deviceController: clientController
|
||||
|
||||
ToolBoxCommonClient {
|
||||
id: clientController
|
||||
anchors.fill: parent
|
||||
title: qsTr("UDP client settings")
|
||||
}
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Universal
|
||||
|
||||
import SAK.Custom
|
||||
import "../toolbox"
|
||||
|
||||
ToolBox {
|
||||
id: root
|
||||
controllerComponent: comComtrollerComponent
|
||||
groupName: "UDPServer"
|
||||
|
||||
property SAKUdpServerTool udpServerTool: toolBox.communication ? toolBox.communication : null
|
||||
|
||||
Component {
|
||||
id: comComtrollerComponent
|
||||
UdpServerPageController {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toolBox.initialize(SAKToolsFactory.UdpServerTool)
|
||||
if (udpServerTool) {
|
||||
var controller = deviceControllerLoader.item
|
||||
udpServerTool.serverIp = Qt.binding(function () {
|
||||
return controller.deviceController.serverIp
|
||||
})
|
||||
udpServerTool.serverPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.serverPort)
|
||||
})
|
||||
udpServerTool.clientIndex = Qt.binding(function () {
|
||||
return Number(controller.deviceController.clientIndex)
|
||||
})
|
||||
controller.deviceController.deviceIsWorking = Qt.binding(function () {
|
||||
return udpServerTool.isWorking
|
||||
})
|
||||
controller.deviceController.clients = Qt.binding(function () {
|
||||
return udpServerTool.clients
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onInvokeOpenDevice: {
|
||||
toolBox.open()
|
||||
}
|
||||
|
||||
onInvokeCloseDevice: {
|
||||
toolBox.close()
|
||||
}
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
import "../toolbox"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property alias deviceController: controller
|
||||
|
||||
ToolBoxCommonServer {
|
||||
id: controller
|
||||
anchors.fill: parent
|
||||
title: qsTr("UDP server settings")
|
||||
}
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Universal
|
||||
|
||||
import SAK.Custom
|
||||
import "../toolbox"
|
||||
|
||||
ToolBox {
|
||||
id: root
|
||||
controllerComponent: comComtrollerComponent
|
||||
groupName: "WebSocketClient"
|
||||
|
||||
property SAKWebSocketClientTool webSocketClient: toolBox.communication ? toolBox.communication : null
|
||||
|
||||
Component {
|
||||
id: comComtrollerComponent
|
||||
WebSocketClientPageController {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toolBox.initialize(SAKToolsFactory.WebSocketClientTool)
|
||||
if (webSocketClient) {
|
||||
var controller = deviceControllerLoader.item
|
||||
webSocketClient.clientIp = Qt.binding(function () {
|
||||
return controller.deviceController.clientIp
|
||||
})
|
||||
webSocketClient.clientPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.clientPort)
|
||||
})
|
||||
webSocketClient.specifyClientIpPort = Qt.binding(function () {
|
||||
return controller.deviceController.specifyClientIpPort
|
||||
})
|
||||
webSocketClient.serverIp = Qt.binding(function () {
|
||||
return controller.deviceController.serverIp
|
||||
})
|
||||
webSocketClient.serverPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.serverPort)
|
||||
})
|
||||
webSocketClient.messageType = Qt.binding(function () {
|
||||
return Number(controller.deviceController.messageType)
|
||||
})
|
||||
controller.deviceController.bindingIpPort = Qt.binding(function () {
|
||||
return webSocketClient.bindingIpPort
|
||||
})
|
||||
controller.deviceController.deviceIsWorking = Qt.binding(function () {
|
||||
return webSocketClient.isWorking
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onInvokeOpenDevice: {
|
||||
toolBox.open()
|
||||
}
|
||||
|
||||
onInvokeCloseDevice: {
|
||||
toolBox.close()
|
||||
}
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
import "../toolbox"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property alias deviceController: controller
|
||||
|
||||
ToolBoxCommonClient {
|
||||
id: controller
|
||||
anchors.fill: parent
|
||||
showClientInfo: false
|
||||
showWebSocketInfo: true
|
||||
title: qsTr("WebSocket client settings")
|
||||
}
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Universal
|
||||
|
||||
import SAK.Custom
|
||||
import "../toolbox"
|
||||
|
||||
ToolBox {
|
||||
id: root
|
||||
controllerComponent: comComtrollerComponent
|
||||
groupName: "WebSocketServer"
|
||||
|
||||
property SAKWebSocketServerTool webSocketServer: toolBox.communication ? toolBox.communication : null
|
||||
|
||||
Component {
|
||||
id: comComtrollerComponent
|
||||
WebSocketServerPageController {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
toolBox.initialize(SAKToolsFactory.WebSocketServerTool)
|
||||
if (webSocketServer) {
|
||||
var controller = deviceControllerLoader.item
|
||||
webSocketServer.serverIp = Qt.binding(function () {
|
||||
return controller.deviceController.serverIp
|
||||
})
|
||||
webSocketServer.serverPort = Qt.binding(function () {
|
||||
return Number(controller.deviceController.serverPort)
|
||||
})
|
||||
webSocketServer.clientIndex = Qt.binding(function () {
|
||||
return Number(controller.deviceController.clientIndex)
|
||||
})
|
||||
webSocketServer.messageType = Qt.binding(function () {
|
||||
return Number(controller.deviceController.messageType)
|
||||
})
|
||||
controller.deviceController.deviceIsWorking = Qt.binding(function () {
|
||||
return webSocketServer.isWorking
|
||||
})
|
||||
controller.deviceController.clients = Qt.binding(function () {
|
||||
return webSocketServer.clients
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onInvokeOpenDevice: {
|
||||
toolBox.open()
|
||||
}
|
||||
|
||||
onInvokeCloseDevice: {
|
||||
toolBox.close()
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
import "../toolbox"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
padding: 0
|
||||
|
||||
property alias deviceController: controller
|
||||
|
||||
ToolBoxCommonServer {
|
||||
id: controller
|
||||
anchors.fill: parent
|
||||
showWebSocketInfo: true
|
||||
title: qsTr("WebSocket server settings")
|
||||
}
|
||||
}
|
||||
@ -1,105 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property alias toolBox: innerToolBox
|
||||
property alias controllerModule: devicePageController
|
||||
property alias readwriteModule: devicePageReadWrite
|
||||
property alias drawerModule: devicePageReadWrite
|
||||
property alias deviceControllerLoader: devicePageController.deviceControllerLoader
|
||||
|
||||
property var controllerComponent: null
|
||||
property string groupName: "EasyDebug"
|
||||
property SAKCommunicator communicator: innerToolBox.communicator
|
||||
|
||||
signal invokeOpenDevice
|
||||
signal invokeCloseDevice
|
||||
|
||||
SAKToolBox {
|
||||
id: innerToolBox
|
||||
}
|
||||
|
||||
ToolBoxController {
|
||||
id: devicePageController
|
||||
controllerComponent: root.controllerComponent
|
||||
communicator: root.communicator
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
width: 250
|
||||
onInvokeOpenDevice: root.invokeOpenDevice()
|
||||
onInvokeCloseDevice: root.invokeCloseDevice()
|
||||
onInvokeClearOutput: devicePageReadWrite.clearOutput()
|
||||
onInvokeOpenDrawer: function func(pageIndex) {
|
||||
devicePageDrawer.customOpen(pageIndex)
|
||||
}
|
||||
SAKVerticalLine {
|
||||
anchors.right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
ToolBoxReadWrite {
|
||||
id: devicePageReadWrite
|
||||
communicator: root.communicator
|
||||
emitterTool: toolBox.emitter
|
||||
responserTool: toolBox.responser
|
||||
presotrerTool: toolBox.prestorer
|
||||
showWrap: devicePageDrawer.showWrap
|
||||
showDate: devicePageDrawer.showDate
|
||||
showTime: devicePageDrawer.showTime
|
||||
showMs: devicePageDrawer.showMs
|
||||
showRx: devicePageDrawer.showRx
|
||||
showTx: devicePageDrawer.showTx
|
||||
anchors.left: devicePageController.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
onInvokeOpenDrawer: function func(pageIndex) {
|
||||
devicePageDrawer.customOpen(pageIndex)
|
||||
}
|
||||
onInvokeSend: function () {
|
||||
if (!toolBox.isWorking) {
|
||||
console.info("The device is not working, the operation will be ignored!")
|
||||
return
|
||||
}
|
||||
|
||||
var text = devicePageReadWrite.inputText
|
||||
if (text === "") {
|
||||
console.info("The input text if empty, the operation will be ignored!")
|
||||
return
|
||||
}
|
||||
|
||||
var cookedString = sakDataStructure.cookEscapeCharacter(
|
||||
devicePageDrawer.inputEscapeCharacter, text)
|
||||
var cookedBytes = sakInterface.string2array(cookedString, inputFormat)
|
||||
cookedBytes = sakInterface.arrayAppendArray(devicePageDrawer.prefix, cookedBytes)
|
||||
if (devicePageDrawer.crcEnable) {
|
||||
var startIndex = devicePageDrawer.crcStartIndex
|
||||
var endIndex = devicePageDrawer.crcEndIndex
|
||||
var model = devicePageDrawer.crcType
|
||||
var crcBytes = sakCrc.calculateBytes(cookedBytes, model, startIndex, endIndex)
|
||||
cookedBytes = sakInterface.arrayAppendArray(cookedBytes, crcBytes)
|
||||
}
|
||||
cookedBytes = sakInterface.arrayAppendArray(cookedBytes, devicePageDrawer.suffix)
|
||||
toolBox.send(cookedBytes)
|
||||
|
||||
appendHisroty(text, inputFormat)
|
||||
}
|
||||
}
|
||||
|
||||
ToolBoxDrawer {
|
||||
id: devicePageDrawer
|
||||
width: 350
|
||||
x: mainWindow.width - mainWindowPane.anchors.margins
|
||||
y: titleBar.height + mainWindowPane.anchors.margins
|
||||
height: root.height
|
||||
storer: toolBox.storer
|
||||
Component.onCompleted: setDocument(devicePageReadWrite.textVar)
|
||||
}
|
||||
}
|
||||
@ -1,113 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../common"
|
||||
|
||||
GridLayout {
|
||||
id: root
|
||||
columns: 2
|
||||
|
||||
property alias title: titleLabel.text
|
||||
property alias clientIp: clientIpAddressComboBox.editText
|
||||
property alias clientPort: clientPortTextField.text
|
||||
property alias specifyClientIpPort: specifyClientIpPortCheckBox.checked
|
||||
property alias serverIp: serverIpAddressComboBox.editText
|
||||
property alias serverPort: serverPortTextField.text
|
||||
property alias bindingIpPort: bindingInfoTextField.text
|
||||
property alias messageType: messageComboBox.currentIndex
|
||||
|
||||
property bool showClientInfo: true
|
||||
property bool deviceIsWorking: false
|
||||
property bool showWebSocketInfo: false
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string clientIp: groupName + "/clientIp"
|
||||
readonly property string clientPort: groupName + "/clientPort"
|
||||
readonly property string specifyClientIpPort: groupName + "/specifyClientIpPort"
|
||||
readonly property string serverIp: groupName + "/serverIp"
|
||||
readonly property string serverPort: groupName + "/serverPort"
|
||||
readonly property string messageType: groupName + "/messageType"
|
||||
}
|
||||
|
||||
SAKLabel {
|
||||
id: titleLabel
|
||||
Layout.columnSpan: 2
|
||||
font.weight: Font.Bold
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Address")
|
||||
visible: showClientInfo
|
||||
}
|
||||
SAKIpComboBox {
|
||||
id: clientIpAddressComboBox
|
||||
settingKey: settingKeys.clientIp
|
||||
enabled: !deviceIsWorking
|
||||
Layout.fillWidth: true
|
||||
visible: showClientInfo
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Port")
|
||||
visible: showClientInfo
|
||||
}
|
||||
SAKTextField {
|
||||
id: clientPortTextField
|
||||
settingKey: settingKeys.clientPort
|
||||
enabled: !deviceIsWorking
|
||||
visible: showClientInfo
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Binding")
|
||||
visible: showClientInfo
|
||||
}
|
||||
SAKTextField {
|
||||
id: bindingInfoTextField
|
||||
enabled: false
|
||||
visible: showClientInfo
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKCheckBox {
|
||||
id: specifyClientIpPortCheckBox
|
||||
text: qsTr("Specify client information")
|
||||
settingKey: settingKeys.specifyClientIpPort
|
||||
enabled: !deviceIsWorking
|
||||
visible: showClientInfo
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Server settings")
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Address")
|
||||
}
|
||||
SAKIpComboBox {
|
||||
id: serverIpAddressComboBox
|
||||
settingKey: settingKeys.serverIp
|
||||
enabled: !deviceIsWorking
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Port")
|
||||
}
|
||||
SAKTextField {
|
||||
id: serverPortTextField
|
||||
settingKey: settingKeys.serverPort
|
||||
enabled: !deviceIsWorking
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Message")
|
||||
visible: showWebSocketInfo
|
||||
}
|
||||
SAKComboBox {
|
||||
id: messageComboBox
|
||||
model: ["Bin", "Text"]
|
||||
visible: showWebSocketInfo
|
||||
settingKey: settingKeys.messageType
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Item { Layout.fillHeight: true }
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
title: qsTr("CRC Parameters")
|
||||
Layout.fillWidth: true
|
||||
|
||||
property alias parameterKeys: parameterKeysObject
|
||||
|
||||
QtObject {
|
||||
id: parameterKeysObject
|
||||
|
||||
readonly property string crcEnable: "crcEnable"
|
||||
readonly property string crcArithmetic: "crcArithmetic"
|
||||
readonly property string crcStartIndex: "crcStartIndex"
|
||||
readonly property string crcEndIndex: "crcEndIndex"
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
SAKCheckBox {
|
||||
id: crcEnableCheckBox
|
||||
text: qsTr("CRC enable")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC arithmetic")
|
||||
}
|
||||
SAKCrcComboBox {
|
||||
id: crcArithmeticComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC start index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: crcStartIndexSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC end index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: crcEndIndexSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
function getParameters() {
|
||||
var parameters = {}
|
||||
parameters[parameterKeys.crcEnable] = crcEnableCheckBox.checked
|
||||
parameters[parameterKeys.crcArithmetic] = crcArithmeticComboBox.currentValue
|
||||
parameters[parameterKeys.crcStartIndex] = crcStartIndexSpinBox.value
|
||||
parameters[parameterKeys.crcEndIndex] = crcEndIndexSpinBox.value
|
||||
|
||||
return parameters
|
||||
}
|
||||
|
||||
function setParameters(parameters) {
|
||||
crcEnableCheckBox.checked = parameters[parameterKeys.crcEnable]
|
||||
var ret = crcArithmeticComboBox.indexOfValue(parameters[parameterKeys.crcArithmetic])
|
||||
if (ret >= 0) {
|
||||
crcArithmeticComboBox.currentIndex = ret
|
||||
}
|
||||
crcStartIndexSpinBox.value = parameters[parameterKeys.crcStartIndex]
|
||||
crcEndIndexSpinBox.value = parameters[parameterKeys.crcEndIndex]
|
||||
}
|
||||
|
||||
function resetParameters() {
|
||||
crcEnableCheckBox.checked = true
|
||||
crcArithmeticComboBox.currentIndex = 0
|
||||
crcStartIndexSpinBox.value = 0
|
||||
crcEndIndexSpinBox.value = 0
|
||||
}
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../common"
|
||||
|
||||
GridLayout {
|
||||
id: root
|
||||
columns: 2
|
||||
|
||||
property alias title: titleLabel.text
|
||||
property var clients: []
|
||||
property bool deviceIsWorking: false
|
||||
property alias serverIp: addressComboBox.editText
|
||||
property alias serverPort: portTextField.text
|
||||
property alias clientIndex: clientsComboBox.currentIndex
|
||||
property alias messageType: messageComboBox.currentIndex
|
||||
|
||||
property bool showWebSocketInfo: false
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string serverIp: "serverIp"
|
||||
readonly property string serverPort: "serverPort"
|
||||
readonly property string messageType: "messageType"
|
||||
}
|
||||
|
||||
SAKLabel {
|
||||
id: titleLabel
|
||||
Layout.columnSpan: 2
|
||||
font.weight: Font.Bold
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Address")
|
||||
}
|
||||
SAKIpComboBox {
|
||||
id: addressComboBox
|
||||
editable: true
|
||||
settingKey: settingKeys.serverIp
|
||||
enabled: !deviceIsWorking
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Port")
|
||||
}
|
||||
SAKTextField {
|
||||
id: portTextField
|
||||
settingKey: settingKeys.serverPort
|
||||
enabled: !deviceIsWorking
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Clients")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: clientsComboBox
|
||||
model: clients
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Message")
|
||||
visible: showWebSocketInfo
|
||||
}
|
||||
SAKComboBox {
|
||||
id: messageComboBox
|
||||
model: ["Bin", "Text"]
|
||||
visible: showWebSocketInfo
|
||||
settingKey: settingKeys.messageType
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Item { Layout.fillHeight: true }
|
||||
}
|
||||
@ -1,213 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
import QtCore
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
signal invokeEdit()
|
||||
signal invokeAppend()
|
||||
signal itemsChanged()
|
||||
|
||||
property int currentRowIndex: -1
|
||||
property alias tableMode: tableView.model
|
||||
property alias tableHeaders: headerRepeater.model
|
||||
property var fillWidthColumns: []
|
||||
property var showColumns: []
|
||||
|
||||
readonly property int cellPadding: 4
|
||||
property string itemsKey: ""
|
||||
property SAKTabelModelTool tabelModelTool: null
|
||||
|
||||
onWidthChanged: tableView.forceLayout()
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
RowLayout {
|
||||
id: headerRowLayout
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
Repeater {
|
||||
id: headerRepeater
|
||||
SAKLabel {
|
||||
text: modelData
|
||||
padding: cellPadding
|
||||
font.bold: true
|
||||
Layout.fillWidth: {
|
||||
for (var i = 0; i < fillWidthColumns.length; i++) {
|
||||
if (index === fillWidthColumns[i]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
visible: {
|
||||
for (var i = 0; i < showColumns.length; i++) {
|
||||
if (index === showColumns[i]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
clip: true
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
TableView {
|
||||
id: tableView
|
||||
anchors.fill: parent
|
||||
contentWidth: -1
|
||||
delegate: Item {
|
||||
implicitHeight: 40
|
||||
clip: true
|
||||
SAKLabel {
|
||||
text: display
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: cellPadding
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: currentRowIndex = row
|
||||
onDoubleClicked: root.invokeEdit()
|
||||
}
|
||||
}
|
||||
columnWidthProvider: function (index) {
|
||||
var children = headerRowLayout.children
|
||||
if (children) {
|
||||
var item = children[index]
|
||||
if (item && item.visible) {
|
||||
return item.width
|
||||
}
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Item { Layout.fillWidth: true }
|
||||
Repeater {
|
||||
model: [
|
||||
qsTr("Edit"),
|
||||
qsTr("Delete"),
|
||||
qsTr("Clear"),
|
||||
qsTr("Import"),
|
||||
qsTr("Export"),
|
||||
qsTr("Append")
|
||||
]
|
||||
SAKButton {
|
||||
text: modelData
|
||||
onClicked: {
|
||||
if (index === 0) {
|
||||
if (currentRowIndex == -1) {
|
||||
noSelectionMessageDialog.open()
|
||||
} else {
|
||||
root.invokeEdit()
|
||||
}
|
||||
} else if (index === 1) {
|
||||
if (currentRowIndex == -1) {
|
||||
noSelectionMessageDialog.open()
|
||||
} else {
|
||||
removeConfimMessageDialog.open()
|
||||
}
|
||||
} else if (index === 2) {
|
||||
clearMessageDialog.open()
|
||||
} else if (index === 3) {
|
||||
fileDialog.fileMode = FileDialog.OpenFile
|
||||
fileDialog.open()
|
||||
} else if (index === 4) {
|
||||
fileDialog.fileMode = FileDialog.SaveFile
|
||||
fileDialog.open()
|
||||
} else if (index === 5) {
|
||||
root.invokeAppend()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
currentFolder: StandardPaths.writableLocation(StandardPaths.DesktopLocation)
|
||||
nameFilters: ["Json file (*.json)", "All files (*)"]
|
||||
onAccepted: {
|
||||
if (fileMode === FileDialog.SaveFile) {
|
||||
sakInterface.tableModel2jsonFile(tableMode, selectedFile)
|
||||
} else {
|
||||
sakInterface.jsonFile2tableModel(tableMode, selectedFile)
|
||||
root.itemsChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: clearMessageDialog
|
||||
title: qsTr("Clear Items")
|
||||
text: qsTr("The items will be clear, please confirm the operaion.")
|
||||
informativeText: qsTr("The items will be clear and it will be remove from the settings file. You can backup the items by \"Export\" operation.")
|
||||
buttons: MessageDialog.Ok | MessageDialog.Cancel
|
||||
onAccepted: {
|
||||
sakInterface.clearTableModel(tableMode)
|
||||
currentRowIndex = -1
|
||||
root.itemsChanged()
|
||||
}
|
||||
onRejected: {}
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: removeConfimMessageDialog
|
||||
title: qsTr("Remove a Item")
|
||||
text: qsTr("The item will be removed, please confirm the operation.")
|
||||
buttons: MessageDialog.Ok | MessageDialog.Cancel
|
||||
onAccepted: {
|
||||
sakInterface.removeTableModelRow(tableMode, currentRowIndex)
|
||||
currentRowIndex = -1
|
||||
root.itemsChanged()
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: noSelectionMessageDialog
|
||||
title: qsTr("Please Select an Item")
|
||||
text: qsTr("Please select an item fist, the operaion need you to specify an item.")
|
||||
buttons: MessageDialog.Ok
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (itemsKey === "") {
|
||||
return
|
||||
}
|
||||
|
||||
if (!tabelModelTool) {
|
||||
return
|
||||
}
|
||||
|
||||
var hexString = sakSettings.value(itemsKey)
|
||||
var jsonString = sakInterface.hexString2String(hexString);
|
||||
try {
|
||||
var jsonArray = JSON.parse(jsonString)
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
|
||||
if (jsonArray) {
|
||||
for (var i = 0; i < jsonArray.length; i++) {
|
||||
var item = jsonArray[i]
|
||||
tabelModelTool.addItem(JSON.stringify(item), -1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,218 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
Layout.minimumWidth: 250
|
||||
Layout.fillHeight: true
|
||||
Layout.rowSpan: 2
|
||||
|
||||
property SAKCommunicator communicator: null
|
||||
property var controllerComponent: null
|
||||
property alias deviceControllerLoader: controllerLoader
|
||||
property int outputFormat: outputFormatComboBox.currentValue
|
||||
property int inputFormat: inputFormatComboBox.currentValue
|
||||
property bool devIsWorking: communicator ? communicator.isWorking : false
|
||||
|
||||
signal invokeOpenDrawer(var pageIndex)
|
||||
signal invokeOpenDevice
|
||||
signal invokeCloseDevice
|
||||
signal invokeSend
|
||||
signal invokeClearOutput
|
||||
|
||||
onDevIsWorkingChanged: {
|
||||
if (!devIsWorking) {
|
||||
intervalComboBox.currentIndex = 0
|
||||
cycleSendingTimer.stop()
|
||||
}
|
||||
}
|
||||
|
||||
// background: Rectangle {
|
||||
// radius: 8
|
||||
// layer.enabled: true
|
||||
// layer.effect: DropShadow {
|
||||
// samples: 16
|
||||
// radius: 8
|
||||
// }
|
||||
// }
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string outputFormat: groupName + "/outputFormat"
|
||||
readonly property string inputFormat: groupName + "/inputFormat"
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: cycleSendingTimer
|
||||
running: false
|
||||
repeat: true
|
||||
onTriggered: root.invokeSend()
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: inputTextFormatListModel
|
||||
ListElement {
|
||||
text: "Hex"
|
||||
value: SAKDataStructure.TextFormatHex
|
||||
}
|
||||
ListElement {
|
||||
text: "Ascii"
|
||||
value: SAKDataStructure.TextFormatAscii
|
||||
}
|
||||
ListElement {
|
||||
text: "Utf8"
|
||||
value: SAKDataStructure.TextFormatUtf8
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: contentGridLayout
|
||||
anchors.fill: parent
|
||||
columns: 2
|
||||
anchors.rightMargin: 6
|
||||
anchors.leftMargin: 6
|
||||
Item {
|
||||
Layout.minimumHeight: 2
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
Loader {
|
||||
id: controllerLoader
|
||||
Layout.fillWidth: true
|
||||
sourceComponent: controllerComponent
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
SAKButton {
|
||||
text: qsTr("Conf")
|
||||
Layout.fillWidth: true
|
||||
onClicked: root.invokeOpenDrawer(0)
|
||||
}
|
||||
SAKButton {
|
||||
text: communicator ? (communicator.isWorking ? qsTr("Close") : qsTr("Open")) : "--"
|
||||
Layout.fillWidth: true
|
||||
onClicked: {
|
||||
if (communicator) {
|
||||
if (communicator.isWorking) {
|
||||
invokeCloseDevice()
|
||||
} else {
|
||||
invokeOpenDevice()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAKGroupBox {
|
||||
title: qsTr("Output settings")
|
||||
Layout.fillWidth: true
|
||||
visible: false
|
||||
GridLayout {
|
||||
anchors.fill: parent
|
||||
columns: 2
|
||||
SAKLabel {
|
||||
text: qsTr("Outut format")
|
||||
}
|
||||
SAKTextFormatComboBox {
|
||||
id: outputFormatComboBox
|
||||
Layout.fillWidth: true
|
||||
settingKey: settingKeys.outputFormat
|
||||
}
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
SAKButton {
|
||||
text: qsTr("Conf")
|
||||
Layout.fillWidth: true
|
||||
onClicked: root.invokeOpenDrawer(1)
|
||||
}
|
||||
SAKButton {
|
||||
text: qsTr("Clear")
|
||||
Layout.fillWidth: true
|
||||
onClicked: root.invokeClearOutput()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Label {
|
||||
width: 1
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
SAKGroupBox {
|
||||
title: qsTr("Input settings")
|
||||
Layout.fillWidth: true
|
||||
visible: false
|
||||
GridLayout {
|
||||
anchors.fill: parent
|
||||
columns: 2
|
||||
SAKLabel {
|
||||
text: qsTr("Timer sending")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: intervalComboBox
|
||||
enabled: communicator ? communicator.isWorking : false
|
||||
model: [qsTr(
|
||||
"Disable"), 20, 40, 60, 80, 100, 200, 400, 600, 800, 1000, 2000, 4000, 6000, 8000, 10000]
|
||||
Layout.fillWidth: true
|
||||
|
||||
onActivated: {
|
||||
if (intervalComboBox.currentIndex === 0) {
|
||||
cycleSendingTimer.stop()
|
||||
} else {
|
||||
var interval = Number(intervalComboBox.currentText)
|
||||
cycleSendingTimer.interval = interval
|
||||
cycleSendingTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Input format")
|
||||
}
|
||||
SAKComboBox {
|
||||
id: inputFormatComboBox
|
||||
model: inputTextFormatListModel
|
||||
textRole: "text"
|
||||
valueRole: "value"
|
||||
Layout.fillWidth: true
|
||||
settingKey: settingKeys.inputFormat
|
||||
}
|
||||
Grid {
|
||||
id: btGrid
|
||||
spacing: contentGridLayout.columnSpacing
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
Repeater {
|
||||
model: [qsTr("Conf"), qsTr("Send")]
|
||||
SAKButton {
|
||||
text: modelData
|
||||
//width: (parent.width - contentGridLayout.columnSpacing)/2
|
||||
enabled: {
|
||||
if (index === 0) {
|
||||
return true
|
||||
} else {
|
||||
return communicator ? communicator.isWorking : false
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (index === 0) {
|
||||
root.invokeOpenDrawer(2)
|
||||
} else {
|
||||
root.invokeSend()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.minimumHeight: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,96 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../common"
|
||||
|
||||
SAKPopup {
|
||||
id: root
|
||||
background: SAKPane{}
|
||||
|
||||
property alias txMasker: devicePageDrawerDevice.txMasker
|
||||
property alias rxMasker: devicePageDrawerDevice.rxMasker
|
||||
property alias analyzer: devicePageDrawerDevice.analyzer
|
||||
property alias storer: devicePageDrawerOutput.storer
|
||||
|
||||
property alias showWrap: devicePageDrawerOutput.showWrap
|
||||
property alias showDate: devicePageDrawerOutput.showDate
|
||||
property alias showTime: devicePageDrawerOutput.showTime
|
||||
property alias showMs: devicePageDrawerOutput.showMs
|
||||
property alias showTx: devicePageDrawerOutput.showTx
|
||||
property alias showRx: devicePageDrawerOutput.showRx
|
||||
|
||||
property alias prefix: devicePageDrawerIntput.prefix
|
||||
property alias suffix: devicePageDrawerIntput.suffix
|
||||
property alias escapeCharacter: devicePageDrawerIntput.escapeCharacter
|
||||
|
||||
property alias crcType: devicePageDrawerIntput.crcType
|
||||
property alias crcStartIndex: devicePageDrawerIntput.crcStartIndex
|
||||
property alias crcEndIndex: devicePageDrawerIntput.crcEndIndex
|
||||
property alias crcEnable: devicePageDrawerIntput.crcEnable
|
||||
property int offset: 0
|
||||
property alias inputEscapeCharacter: devicePageDrawerIntput.escapeCharacter
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
TabBar {
|
||||
id: tabBar
|
||||
Layout.fillWidth: true
|
||||
Repeater {
|
||||
model: [qsTr("Device"), qsTr("Output"), qsTr("Input")]
|
||||
TabButton {
|
||||
text: modelData
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
StackLayout {
|
||||
currentIndex: tabBar.currentIndex
|
||||
ToolBoxDrawerDevice {
|
||||
id: devicePageDrawerDevice
|
||||
}
|
||||
ToolBoxDrawerOutput {
|
||||
id: devicePageDrawerOutput
|
||||
}
|
||||
ToolBoxDrawerInput {
|
||||
id: devicePageDrawerIntput
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onOffsetChanged: {
|
||||
devicePageDrawer.x = mainWindow.width - mainWindowPane.anchors.margins - offset
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: drawerAnimation
|
||||
from: 0
|
||||
to: devicePageDrawer.width
|
||||
duration: 256
|
||||
target: devicePageDrawer
|
||||
properties: "offset"
|
||||
}
|
||||
|
||||
Overlay.modal: Rectangle {
|
||||
color: "#00000000"
|
||||
Rectangle {
|
||||
radius: 8
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: mainWindowPane.anchors.margins
|
||||
anchors.rightMargin: mainWindowPane.anchors.margins
|
||||
anchors.topMargin: mainWindowPane.anchors.margins + titleBar.height
|
||||
anchors.bottomMargin: mainWindowPane.anchors.margins
|
||||
color: Material.backgroundDimColor
|
||||
}
|
||||
}
|
||||
|
||||
function customOpen(pageIndex) {
|
||||
tabBar.currentIndex = pageIndex
|
||||
devicePageDrawer.x = mainWindow.width - mainWindowPane.anchors.margins
|
||||
open()
|
||||
drawerAnimation.start()
|
||||
}
|
||||
|
||||
function setDocument(doc) {
|
||||
devicePageDrawerOutput.setDocument(doc)
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKPane {
|
||||
id: root
|
||||
property alias txMasker: maskerGroupBox.txMasker
|
||||
property alias rxMasker: maskerGroupBox.rxMasker
|
||||
property alias analyzer: analyzerGroupBox.analyzer
|
||||
ScrollView {
|
||||
anchors.fill: parent
|
||||
ColumnLayout {
|
||||
width: root.width
|
||||
ToolBoxDrawerDeviceMasker {
|
||||
id: maskerGroupBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
ToolBoxDrawerDeviceAnalyzer {
|
||||
id: analyzerGroupBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,116 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
id: analyzerGroupBox
|
||||
title: qsTr("Analyzer")
|
||||
|
||||
property SAKAnalyzerTool analyzer: null
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
|
||||
readonly property string analyzerEnable: "analyzerEnable"
|
||||
readonly property string analyzerFrameLengthIsFixed: "analyzerFrameLengthIsFixed"
|
||||
readonly property string analyzerFrameLength: "analyzerFrameLength"
|
||||
readonly property string analyzerFrameSeparationMark: "analyzerFrameSeparationMark"
|
||||
readonly property string analyzerMaxTempBytes: "analyzerMaxTempBytes"
|
||||
}
|
||||
|
||||
SAKHexRegularExpressionValidator{ id:hexREV }
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
SAKCheckBox {
|
||||
id: enableCheckBox
|
||||
text: qsTr("Enable frame analyzer")
|
||||
settingKey: settingKeys.analyzerEnable
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
onClicked: setAnalyzerEnable(enableCheckBox.checked)
|
||||
Component.onCompleted: setAnalyzerEnable(enableCheckBox.checked)
|
||||
|
||||
function setAnalyzerEnable(enable) {
|
||||
if (analyzer) {
|
||||
analyzer.enable = enable
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKCheckBox {
|
||||
id: fixsakCheckBox
|
||||
text: qsTr("Fixed frame length")
|
||||
settingKey: settingKeys.analyzerFrameLengthIsFixed
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
onClicked: setAnalyzerFixed(fixsakCheckBox.checked)
|
||||
Component.onCompleted: setAnalyzerFixed(fixsakCheckBox.checked)
|
||||
|
||||
function setAnalyzerFixed(fixed) {
|
||||
if (analyzer) {
|
||||
analyzer.setFixed(fixed)
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Frame bytes")
|
||||
}
|
||||
SAKTextField {
|
||||
id: frameBytesTextField
|
||||
settingKey: settingKeys.analyzerFrameLength
|
||||
Layout.fillWidth: true
|
||||
maximumLength: 4
|
||||
onTextEdited: setAnalyzerFrameBytes(frameBytesTextField.text)
|
||||
Component.onCompleted: setAnalyzerFrameBytes(frameBytesTextField.text)
|
||||
|
||||
function setAnalyzerFrameBytes(frameBytes) {
|
||||
if (analyzer) {
|
||||
analyzer.setFrameBytes(parseInt(frameBytes))
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Separation mark")
|
||||
}
|
||||
SAKTextField {
|
||||
id: separationMarkTextField
|
||||
settingKey: settingKeys.analyzerFrameSeparationMark
|
||||
validator: hexREV
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: setAnalyzerSeparationMark(separationMarkTextField.text)
|
||||
Component.onCompleted: setAnalyzerSeparationMark(separationMarkTextField.text)
|
||||
|
||||
function setAnalyzerSeparationMark(mark) {
|
||||
if (analyzer) {
|
||||
var cookedMark = sakInterface.string2array(
|
||||
separationMarkTextField.text,
|
||||
SAKDataStructure.TextFormatHex)
|
||||
analyzer.setSeparationMark(cookedMark)
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Max temp bytes")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: maxTempBytesTextField
|
||||
settingKey: settingKeys.analyzerMaxTempBytes
|
||||
value: 1024
|
||||
editable: true
|
||||
from: 1
|
||||
to: 10240
|
||||
Layout.fillWidth: true
|
||||
|
||||
function setAnalyzerMaxTempBytes(maxBytes) {
|
||||
if (analyzer) {
|
||||
var cookedMaxBytes = parseInt(maxBytes)
|
||||
analyzer.setMaxTempBytes(cookedMaxBytes)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,88 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
id: maskerGroupBox
|
||||
title: qsTr("Masker")
|
||||
padding: 8
|
||||
|
||||
property SAKMaskerTool rxMasker: null
|
||||
property SAKMaskerTool txMasker: null
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string maskerRxEnable: "maskerRxEnable"
|
||||
readonly property string maskerRxMask: "maskerRxMask"
|
||||
readonly property string maskerTxEnable: "maskerTxEnable"
|
||||
readonly property string maskerTxMask: "maskerTxMask"
|
||||
}
|
||||
|
||||
SAKHexRegularExpressionValidator{ id:hexREV }
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
|
||||
SAKCheckBox {
|
||||
id: rxMaskerCheckBox
|
||||
text: qsTr("Enable reading masker")
|
||||
settingKey: settingKeys.maskerRxEnable
|
||||
Layout.columnSpan: 2
|
||||
onClicked: setMaskerEnable(rxMaskerCheckBox.checked, rxMasker)
|
||||
Component.onCompleted: setMaskerEnable(rxMaskerCheckBox.checked, rxMasker)
|
||||
}
|
||||
|
||||
SAKCheckBox {
|
||||
id: txMaskerCheckBox
|
||||
text: qsTr("Enable writing masker")
|
||||
settingKey: settingKeys.maskerTxEnable
|
||||
Layout.columnSpan: 2
|
||||
onClicked: setMaskerEnable(txMaskerCheckBox.checked, txMasker)
|
||||
Component.onCompleted: setMaskerEnable(txMaskerCheckBox.checked, txMasker)
|
||||
}
|
||||
|
||||
SAKLabel {
|
||||
text: qsTr("Reading mask")
|
||||
}
|
||||
|
||||
SAKTextField {
|
||||
id: rxMaskerField
|
||||
validator: hexREV
|
||||
maximumLength: 2
|
||||
settingKey: settingKeys.maskerRxMask
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: setMaskerMask(rxMaskerField.text, rxMasker)
|
||||
Component.onCompleted: setMaskerMask(rxMaskerField.text, rxMasker)
|
||||
}
|
||||
|
||||
SAKLabel {
|
||||
text: qsTr("Writing mask")
|
||||
}
|
||||
SAKTextField {
|
||||
id: txMaskerField
|
||||
validator: hexREV
|
||||
maximumLength: 2
|
||||
settingKey: settingKeys.maskerTxMask
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: setMaskerMask(txMaskerField.text, txMasker)
|
||||
Component.onCompleted: setMaskerMask(txMaskerField.text, txMasker)
|
||||
}
|
||||
}
|
||||
|
||||
function setMaskerEnable(enable, masker) {
|
||||
if (masker) {
|
||||
masker.enable = enable
|
||||
}
|
||||
}
|
||||
|
||||
function setMaskerMask(mask, masker) {
|
||||
if (masker) {
|
||||
var cookedMask = parseInt(mask, 16)
|
||||
masker.setMaskCode(cookedMask)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../common"
|
||||
|
||||
ScrollView {
|
||||
id: root
|
||||
contentWidth: -1
|
||||
|
||||
property alias prefix: preprocessorGroupBox.prefix
|
||||
property alias suffix: preprocessorGroupBox.suffix
|
||||
property alias escapeCharacter: preprocessorGroupBox.escapeCharacter
|
||||
|
||||
property alias crcType: crcGroupBox.crcType
|
||||
property alias crcStartIndex: crcGroupBox.crcStartIndex
|
||||
property alias crcEndIndex: crcGroupBox.crcEndIndex
|
||||
property alias crcEnable: crcGroupBox.crcEnable
|
||||
|
||||
ColumnLayout {
|
||||
width: root.width
|
||||
ToolBoxDrawerInputPreprocessor {
|
||||
id: preprocessorGroupBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
ToolBoxDrawerInputCrc {
|
||||
id: crcGroupBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
id: root
|
||||
title: qsTr("CRC Calculator")
|
||||
|
||||
property alias crcType: crcTypeComboBox.currentValue
|
||||
property alias crcStartIndex: startIndexSpinBox.value
|
||||
property alias crcEndIndex: endIndexSpinBox.value
|
||||
property alias crcEnable: appendCrcCheckbox.checked
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string inputCrcType: groupName + "/inputCrcType"
|
||||
readonly property string inputCrcStartIndex: groupName + "/inputCrcStartIndex"
|
||||
readonly property string inputCrcEndIndex: groupName + "/inputCrcEndIndex"
|
||||
readonly property string inputCrcAppendEnable: groupName + "/inputCrcAppendEnable"
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
|
||||
SAKLabel {
|
||||
text: qsTr("CRC type")
|
||||
}
|
||||
SAKCrcComboBox {
|
||||
id: crcTypeComboBox
|
||||
settingKey: settingKeys.inputCrcType
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Start index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: startIndexSpinBox
|
||||
settingKey: settingKeys.inputCrcStartIndex
|
||||
editable: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("End index(from tail)")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: endIndexSpinBox
|
||||
settingKey: settingKeys.inputCrcEndIndex
|
||||
editable: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKCheckBox {
|
||||
id: appendCrcCheckbox
|
||||
text: qsTr("Append CRC(before suffix)");
|
||||
settingKey: settingKeys.inputCrcAppendEnable
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("The start index is start from header, the first byte is 0. The end index is from tail, the last byte is 0. If parameters are set error, all bytes inputed will be calculated.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
title: qsTr("File sending")
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
property string inputFileSendingFrameLength: groupName + "/inputFileSendingFrameLength"
|
||||
property string inputFileSendingFrameInterval: groupName + "/inputFileSendingFrameInterval"
|
||||
property string inputFileSendingFileName: groupName + "/inputFileSendingFileName"
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
SAKLabel {
|
||||
text: qsTr("Frame length(byte)")
|
||||
}
|
||||
SAKSpinBox {
|
||||
settingKey: settingKeys.inputFileSendingFrameLength
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Frame interval(ms)")
|
||||
}
|
||||
SAKSpinBox {
|
||||
settingKey: settingKeys.inputFileSendingFrameInterval
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKButton {
|
||||
text: qsTr("SelectFile")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKButton {
|
||||
text: qsTr("StartSending");
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKTextField {
|
||||
settingKey: settingKeys.inputFileSendingFileName
|
||||
placeholderText: qsTr("File name")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
EDProgressBar{
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
}
|
||||
} // SAKGroupBox
|
||||
@ -1,51 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
id: root
|
||||
title: qsTr("Data preprocessor")
|
||||
|
||||
property alias prefix: prefixComboBox.currentValue
|
||||
property alias suffix: suffixComboBox.currentValue
|
||||
property alias escapeCharacter: escapeCharacterComboBox.currentValue
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string inputPreprocessorPrefix: groupName + "/inputPreprocessorPrefix"
|
||||
readonly property string inputPreprocessorSuffix: groupName + "/inputPreprocessorSuffix"
|
||||
readonly property string inputPreprocessorEscapeCharacter: groupName + "/inputPreprocessorEscapeCharacter"
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
SAKLabel {
|
||||
text: qsTr("Prefix")
|
||||
}
|
||||
SAKRNComboBox {
|
||||
id: prefixComboBox
|
||||
settingKey: settingKeys.inputPreprocessorPrefix
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Suffix")
|
||||
}
|
||||
SAKRNComboBox {
|
||||
id: suffixComboBox
|
||||
settingKey: settingKeys.inputPreprocessorSuffix
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Escape character")
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: escapeCharacterComboBox
|
||||
settingKey: settingKeys.inputPreprocessorEscapeCharacter
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
} // GroupBox
|
||||
@ -1,41 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
ScrollView {
|
||||
id: root
|
||||
|
||||
property alias dataPreprocessor: dataPreprocessorGroupBox
|
||||
property alias storer: storerGroupBox.storer
|
||||
|
||||
property alias showWrap: dataPreprocessorGroupBox.showWrap
|
||||
property alias showDate: dataPreprocessorGroupBox.showDate
|
||||
property alias showTime: dataPreprocessorGroupBox.showTime
|
||||
property alias showMs: dataPreprocessorGroupBox.showMs
|
||||
property alias showTx: dataPreprocessorGroupBox.showTx
|
||||
property alias showRx: dataPreprocessorGroupBox.showRx
|
||||
|
||||
ColumnLayout {
|
||||
width: root.width
|
||||
ToolBoxDrawerOutputPreprocessor {
|
||||
id: dataPreprocessorGroupBox
|
||||
Layout.fillWidth: true
|
||||
visible: false
|
||||
}
|
||||
ToolBoxDrawerOutputStorer {
|
||||
id: storerGroupBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
ToolBoxDrawerOutputHighlighter {
|
||||
id: highlighterGroupBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
function setDocument(doc) {
|
||||
highlighterGroupBox.setDocument(doc)
|
||||
}
|
||||
}
|
||||
@ -1,117 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
id: root
|
||||
title: qsTr("Highlighter")
|
||||
Layout.fillWidth: true
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string highlighterArrayName: "highlighter"
|
||||
readonly property string highlighterKeyWord: "highlighterKeyWord"
|
||||
}
|
||||
|
||||
SAKHighlighter { id: highlighter }
|
||||
|
||||
GridLayout {
|
||||
anchors.fill: parent
|
||||
columns: 2
|
||||
SAKTextField {
|
||||
id: keyWordTextField
|
||||
placeholderText: qsTr("Key word")
|
||||
Layout.fillWidth: true
|
||||
Keys.onPressed: function func(event) {
|
||||
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
||||
appendKeyWord()
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKButton {
|
||||
text: qsTr("Append")
|
||||
onClicked: appendKeyWord()
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Double click to delete key word")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
Flow {
|
||||
id: keyWordFlow
|
||||
spacing: 4
|
||||
Layout.fillWidth: true
|
||||
Repeater {
|
||||
model: ListModel { id: keyWordListModel }
|
||||
SAKLabel {
|
||||
text: keyWord
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onDoubleClicked: {
|
||||
highlighter.removeKeyWord(keyWord)
|
||||
settingPop(index)
|
||||
keyWordListModel.remove(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
// var keyWords = sakSettings.sakArrayValues(groupName, settingKeys.highlighterArrayName, settingKeys.highlighterKeyWord)
|
||||
// for (var i = 0; i < keyWords.length; i++) {
|
||||
// keyWordListModel.append({keyWord: keyWords[i]})
|
||||
// }
|
||||
|
||||
// highlighter.setKeyWords(keyWords)
|
||||
}
|
||||
|
||||
function setDocument(doc) {
|
||||
highlighter.setDoc(doc)
|
||||
}
|
||||
|
||||
function isKeyWordExist(keyWord) {
|
||||
for (var i = 0; i < keyWordListModel.count; i++) {
|
||||
if (keyWordListModel.get(i).keyWord === keyWord) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
function keyWords() {
|
||||
var kws = []
|
||||
for (var i = 0; i < keyWordListModel.count; i++) {
|
||||
kws.push(keyWordListModel.get(i).keyWord)
|
||||
}
|
||||
return kws
|
||||
}
|
||||
|
||||
function setKeyWords() {
|
||||
var kws = keyWords()
|
||||
highlighter.setKeyWords(kws)
|
||||
sakSettings.edSetArrayValues(groupName, settingKeys.highlighterArrayName, settingKeys.highlighterKeyWord, kws)
|
||||
}
|
||||
|
||||
function settingPop(index) {
|
||||
var kws = keyWords()
|
||||
kws.splice(index, 1)
|
||||
sakSettings.edRemove(groupName, settingKeys.highlighterKeyWord)
|
||||
if (kws.length) {
|
||||
sakSettings.edSetArrayValues(groupName, settingKeys.highlighterKeyWord, kws)
|
||||
}
|
||||
}
|
||||
|
||||
function appendKeyWord() {
|
||||
if (!isKeyWordExist(keyWordTextField.text.trim())) {
|
||||
keyWordListModel.append({keyWord: keyWordTextField.text.trim()})
|
||||
setKeyWords()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
id: root
|
||||
title: qsTr("Preprocessor")
|
||||
Layout.fillWidth: true
|
||||
|
||||
property bool showWrap: true
|
||||
property bool showDate: true
|
||||
property bool showTime: true
|
||||
property bool showMs: true
|
||||
property bool showTx: true
|
||||
property bool showRx: true
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string outputShowRx: groupName + "/outputShowRx"
|
||||
readonly property string outputShowTx: groupName + "/outputShowTx"
|
||||
readonly property string outputShowDate: groupName + "/outputShowDate"
|
||||
readonly property string outputShowTime: groupName + "/outputShowTime"
|
||||
readonly property string outputShowMs: groupName + "/outputShowMs"
|
||||
readonly property string outputShowWrap: groupName + "/outputShowWrap"
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Repeater {
|
||||
model: [
|
||||
qsTr("Show read bytes"),
|
||||
qsTr("Show written bytes"),
|
||||
qsTr("Show date information"),
|
||||
qsTr("Show time information"),
|
||||
qsTr("Show ms information"),
|
||||
qsTr("Show wrap")
|
||||
]
|
||||
SAKCheckBox {
|
||||
text: modelData
|
||||
settingKey: {
|
||||
if (index === 0) {
|
||||
return settingKeys.outputShowRx
|
||||
} else if (index === 1) {
|
||||
return settingKeys.outputShowTx
|
||||
} else if (index === 2) {
|
||||
return settingKeys.outputShowDate
|
||||
} else if (index === 3) {
|
||||
return settingKeys.outputShowTime
|
||||
} else if (index === 4) {
|
||||
return settingKeys.outputShowMs
|
||||
} else if (index === 5) {
|
||||
return settingKeys.outputShowWrap
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (index === 0) {
|
||||
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})
|
||||
} else if (index === 3) {
|
||||
showTime = Qt.binding(function(){return checked})
|
||||
} else if (index === 4) {
|
||||
showMs = Qt.binding(function(){return checked})
|
||||
} else if (index === 5) {
|
||||
showWrap = Qt.binding(function(){return checked})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // SAKGroupBox
|
||||
@ -1,109 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKGroupBox {
|
||||
id: storerGroupBox
|
||||
title: qsTr("Storer")
|
||||
|
||||
property SAKStorerTool storer: null
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
|
||||
readonly property string storerFileName: groupName + "/storerFileName"
|
||||
readonly property string storerEnable: groupName + "/storerEnable"
|
||||
readonly property string storerSaveDate: groupName + "/storerSaveDate"
|
||||
readonly property string storerSaveTime: groupName + "/storerSaveTime"
|
||||
readonly property string storerSaveMs: groupName + "/storerSaveMs"
|
||||
readonly property string storerTextFormat: groupName + "/storerTextFormat"
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
Repeater {
|
||||
model: [
|
||||
[qsTr("Enable data storer"), settingKeys.storerEnable],
|
||||
[qsTr("Save date information"), settingKeys.storerSaveDate],
|
||||
[qsTr("Save time information"), settingKeys.storerSaveTime],
|
||||
[qsTr("Save ms information"), settingKeys.storerSaveMs],
|
||||
]
|
||||
SAKCheckBox {
|
||||
text: modelData[0]
|
||||
settingKey: modelData[1]
|
||||
Layout.columnSpan: 2
|
||||
onClicked: updateStorParameters(index, checked)
|
||||
Component.onCompleted: updateStorParameters(index, checked)
|
||||
|
||||
function updateStorParameters(parameterIndex, checked) {
|
||||
if (storer) {
|
||||
if (parameterIndex === 0) {
|
||||
storer.enable = checked
|
||||
} else if (parameterIndex === 1) {
|
||||
storer.saveDate = checked
|
||||
} else if (parameterIndex === 2) {
|
||||
storer.saveTime = checked
|
||||
} else if (parameterIndex === 3) {
|
||||
storer.saveMs = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAKLabel {
|
||||
text: qsTr("Text format")
|
||||
}
|
||||
SAKTextFormatComboBox {
|
||||
id: textFormatComboBox
|
||||
settingKey: settingKeys.storerTextFormat
|
||||
Layout.fillWidth: true
|
||||
onActivated: setStorerTextFormat()
|
||||
Component.onCompleted: setStorerTextFormat()
|
||||
|
||||
function setStorerTextFormat() {
|
||||
if (storer) {
|
||||
//storer.sa setFormat(currentValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAKButton {
|
||||
text: qsTr("Select")
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
onClicked: fileDialog.open()
|
||||
}
|
||||
SAKTextField {
|
||||
id: fileNameTextField
|
||||
settingKey: settingKeys.storerFileName
|
||||
Layout.columnSpan: 2
|
||||
Layout.fillWidth: true
|
||||
onTextEdited: setStorerFileName()
|
||||
Component.onCompleted: setStorerFileName()
|
||||
|
||||
function setStorerFileName() {
|
||||
if (storer) {
|
||||
storer.fileName = fileNameTextField.text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
fileMode: FileDialog.SaveFile
|
||||
nameFilters: [qsTr("Text files (*.txt)"), qsTr("All files (*)")]
|
||||
onAccepted: {
|
||||
if (storer) {
|
||||
fileNameTextField.text = currentFile
|
||||
storer.setPath(currentFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
} // SAKGroupBox
|
||||
@ -1,88 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
//padding: 0
|
||||
property alias communicator: ioPage.communicationTool
|
||||
property alias emitterTool: emitterPage.emitterTool
|
||||
property alias responserTool: responserPage.responserTool
|
||||
property alias presotrerTool: prestorePage.presotrerTool
|
||||
property alias outputFormat: ioPage.outputFormat
|
||||
property alias inputFormat: ioPage.inputFormat
|
||||
property alias inputText: ioPage.inputText
|
||||
property alias analyzer: ioPage.analyzer
|
||||
|
||||
property alias showWrap: ioPage.showWrap
|
||||
property alias showDate: ioPage.showDate
|
||||
property alias showTime: ioPage.showTime
|
||||
property alias showMs: ioPage.showMs
|
||||
property alias showTx: ioPage.showTx
|
||||
property alias showRx: ioPage.showRx
|
||||
property alias textVar: ioPage.textVar
|
||||
|
||||
signal invokeOpenDrawer(var pageIndex)
|
||||
signal invokeSend
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
TabBar {
|
||||
id: pageTabBar
|
||||
Layout.fillWidth: true
|
||||
Repeater {
|
||||
model: [qsTr("I/O"), qsTr("Emitter"), qsTr("Responser"), qsTr("PresetData")]
|
||||
TabButton {
|
||||
text: modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKHorizontalLine {
|
||||
autoScale: false
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
StackLayout {
|
||||
id: pageStackLayout
|
||||
currentIndex: pageTabBar.currentIndex
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
ToolBoxReadWriteInputOutput {
|
||||
id: ioPage
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
onInvokeSend: root.invokeSend()
|
||||
onInvokeOpenDrawer: function func(pageIndex) {
|
||||
root.invokeOpenDrawer(pageIndex)
|
||||
}
|
||||
}
|
||||
ToolBoxReadWriteEmitter {
|
||||
id: emitterPage
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
ToolBoxReadWriteResponser {
|
||||
id: responserPage
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
ToolBoxReadWritePrestorer {
|
||||
id: prestorePage
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clearOutput() {
|
||||
ioPage.clearOutput()
|
||||
}
|
||||
|
||||
function appendHisroty(text, format) {
|
||||
ioPage.appendHisroty(text, format)
|
||||
}
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property SAKEmitterTool emitterTool: null
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string items: groupName + "/emitter/items"
|
||||
}
|
||||
|
||||
ToolBoxCommonTableView {
|
||||
anchors.fill: parent
|
||||
tableMode: emitterTool ? emitterTool.tableModel : null
|
||||
tableHeaders: emitterTool ? emitterTool.headers : []
|
||||
fillWidthColumns: [11]
|
||||
showColumns: [0, 1, 11]
|
||||
tabelModelTool: root.emitterTool
|
||||
itemsKey: settingKeys.items
|
||||
onInvokeAppend: {
|
||||
var parameters = emitterTool.itemContext(-1)
|
||||
editorPopup.setParameters(parameters)
|
||||
editorPopup.index = -1
|
||||
editorPopup.open()
|
||||
}
|
||||
onInvokeEdit: {
|
||||
var parameters = emitterTool.itemContext(currentRowIndex)
|
||||
editorPopup.setParameters(parameters)
|
||||
editorPopup.index = currentRowIndex
|
||||
editorPopup.open()
|
||||
}
|
||||
onItemsChanged: updateSettings()
|
||||
}
|
||||
|
||||
ToolBoxReadWriteEmitterPopup {
|
||||
id: editorPopup
|
||||
onRejected: close()
|
||||
onAccepted: {
|
||||
close()
|
||||
var parameters = getParameters()
|
||||
emitterTool.addItem(JSON.stringify(parameters), index)
|
||||
|
||||
updateSettings()
|
||||
}
|
||||
|
||||
property int index: -1
|
||||
}
|
||||
|
||||
// Component.onCompleted: {
|
||||
// var hexString = sakSettings.value(settingKeys.items)
|
||||
// var jsonString = sakInterface.hexString2String(hexString);
|
||||
// var jsonArray = JSON.parse(jsonString)
|
||||
// if (jsonArray) {
|
||||
// for (var i = 0; i < jsonArray.length; i++) {
|
||||
// var item = jsonArray[i]
|
||||
// emitterTool.addItem(JSON.stringify(item), -1)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
function updateSettings() {
|
||||
sakSettings.edRemove(settingKeys.group, settingKeys.array)
|
||||
var items = emitterTool.itemsContext()
|
||||
if (items.length) {
|
||||
var itemStringList = []
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i]
|
||||
var itemString = JSON.stringify(item)
|
||||
var itemStringHex = sakInterface.string2hexString(itemString)
|
||||
itemStringList.push(itemStringHex)
|
||||
}
|
||||
|
||||
sakSettings.edSetArrayValues(settingKeys.group,
|
||||
settingKeys.array,
|
||||
settingKeys.key,
|
||||
itemStringList)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,194 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKPopup {
|
||||
id: root
|
||||
|
||||
readonly property string itemEnable: emitterTool.itemEnable
|
||||
readonly property string itemDescription: emitterTool.itemDescription
|
||||
readonly property string itemEscapeCharacter: emitterTool.itemEscapeCharacter
|
||||
readonly property string itemTextFormat: emitterTool.itemTextFormat
|
||||
readonly property string itemPrefix: emitterTool.itemPrefix
|
||||
readonly property string itemSuffix: emitterTool.itemSuffix
|
||||
readonly property string itemInterval: emitterTool.itemInterval
|
||||
readonly property string itemText: emitterTool.itemText
|
||||
readonly property string itemCrcEnable: emitterTool.itemCrcEnable
|
||||
readonly property string itemCrcAlgorithm: emitterTool.itemCrcAlgorithm
|
||||
readonly property string itemCrcStartIndex: emitterTool.itemCrcStartIndex
|
||||
readonly property string itemCrcEndIndex: emitterTool.itemCrcEndIndex
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
GridLayout {
|
||||
Layout.fillWidth: true
|
||||
columns: 2
|
||||
SAKCheckBox {
|
||||
id: itemEnableCheckBox
|
||||
text: qsTr("Enable the item")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Description")
|
||||
}
|
||||
SAKTextField {
|
||||
id: itemDescriptionTextField
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item text format")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKTextFormatComboBox {
|
||||
id: itemTextFormatComboBox
|
||||
Layout.fillWidth: true
|
||||
onActivated: itemTextTextField.clear()
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item escape")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemEscapeCharacterComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item prefix")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemPrefixComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item suffix")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemSuffixComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item interval")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: itemIntervalSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item text")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKTextField {
|
||||
id: itemTextTextField
|
||||
validator: itemTextFormatComboBox.currentValidator
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 200
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKCheckBox {
|
||||
id: itemCrcEnableCheckBox
|
||||
text: qsTr("Append CRC data")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC arithmetic")
|
||||
}
|
||||
SAKCrcComboBox {
|
||||
id: itemCrcArithmeticComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC start index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: itemCrcStartIndexSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC end index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: itemCrcEndIndexSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 8
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
Repeater {
|
||||
model: [qsTr("Cancle"), qsTr("Apply")]
|
||||
SAKButton {
|
||||
text: modelData
|
||||
width: Math.round((parent.width - parent.spacing)/2)
|
||||
onClicked: {
|
||||
if (index === 0) {
|
||||
root.rejected()
|
||||
} else {
|
||||
root.accepted()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setParameters(parameters) {
|
||||
if (parameters) {
|
||||
itemEnableCheckBox.checked = parameters[itemEnable]
|
||||
itemDescriptionTextField.text = parameters[itemDescription]
|
||||
var ret = itemTextFormatComboBox.indexOfValue(parameters[itemTextFormat])
|
||||
if (ret >= 0) {
|
||||
itemTextFormatComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemEscapeCharacterComboBox.indexOfValue(parameters[itemEscapeCharacter])
|
||||
if (ret >= 0) {
|
||||
itemEscapeCharacterComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemPrefixComboBox.indexOfValue(parameters[itemPrefix])
|
||||
if (ret >= 0) {
|
||||
itemPrefixComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemSuffixComboBox.indexOfValue(parameters[itemSuffix])
|
||||
if (ret >= 0) {
|
||||
itemSuffixComboBox.currentIndex = ret
|
||||
}
|
||||
itemIntervalSpinBox.value = parameters[itemInterval]
|
||||
itemTextTextField.text = parameters[itemText]
|
||||
|
||||
itemCrcEnableCheckBox.checked = parameters[itemCrcEnable]
|
||||
ret = itemCrcArithmeticComboBox.indexOfValue(parameters[itemCrcAlgorithm])
|
||||
if (ret >= 0) {
|
||||
itemCrcArithmeticComboBox.currentIndex = ret
|
||||
}
|
||||
itemCrcStartIndexSpinBox.value = parameters[itemCrcStartIndex]
|
||||
itemCrcEndIndexSpinBox.value = parameters[itemCrcEndIndex]
|
||||
}
|
||||
}
|
||||
|
||||
function getParameters() {
|
||||
var parameters = {}
|
||||
parameters[itemEnable] = itemEnableCheckBox.checked
|
||||
parameters[itemDescription] = itemDescriptionTextField.text
|
||||
parameters[itemEscapeCharacter] = itemEscapeCharacterComboBox.currentValue
|
||||
parameters[itemTextFormat] = itemTextFormatComboBox.currentValue
|
||||
parameters[itemPrefix] = itemPrefixComboBox.currentValue
|
||||
parameters[itemSuffix] = itemSuffixComboBox.currentValue
|
||||
parameters[itemTextFormat] = itemTextFormatComboBox.currentValue
|
||||
parameters[itemInterval] = itemIntervalSpinBox.value
|
||||
parameters[itemText] = itemTextTextField.text
|
||||
|
||||
parameters[itemCrcEnable] = itemCrcEnableCheckBox.checked
|
||||
parameters[itemCrcAlgorithm] = itemCrcArithmeticComboBox.currentValue
|
||||
parameters[itemCrcStartIndex] = itemCrcStartIndexSpinBox.value
|
||||
parameters[itemCrcEndIndex] = itemCrcEndIndexSpinBox.value
|
||||
return parameters
|
||||
}
|
||||
}
|
||||
@ -1,356 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property SAKBaseTool communicationTool: null
|
||||
property SAKAnalyzerTool analyzer: null
|
||||
|
||||
property int outputFormat: outputTextFormatComboBox.currentValue
|
||||
property int inputFormat: inputTextFormatComboBox.currentValue
|
||||
property string inputText: inputComboBox.editText
|
||||
property var textVar: outputTextArea.textDocument
|
||||
|
||||
property bool showWrap: true
|
||||
property bool showDate: true
|
||||
property bool showTime: true
|
||||
property bool showMs: true
|
||||
property bool showTx: true
|
||||
property bool showRx: true
|
||||
|
||||
readonly property string rxColor: "red"
|
||||
readonly property string txColor: "blue"
|
||||
|
||||
signal invokeOpenDrawer(var pageIndex)
|
||||
signal invokeSend
|
||||
|
||||
onInputFormatChanged: inputComboBox.editText = ""
|
||||
|
||||
QtObject {
|
||||
id: keysObj
|
||||
readonly property string itemGroup: groupName + "History"
|
||||
readonly property string itemArray: "item"
|
||||
readonly property string itemAll: "itemAll"
|
||||
readonly property string itemText: "text"
|
||||
readonly property string itemFormat: "format"
|
||||
readonly property string itemCurrentIndex: groupName + "inputCurrentIndex"
|
||||
}
|
||||
|
||||
ButtonGroup {
|
||||
id: txTxButtonGroup
|
||||
}
|
||||
|
||||
Item {
|
||||
id: outputPane
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: inputPane.top
|
||||
anchors.margins: 4
|
||||
ColumnLayout {
|
||||
spacing: 0
|
||||
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"]]
|
||||
SAKCheckBox {
|
||||
id: cbCheckBox
|
||||
text: modelData[0]
|
||||
checked: true
|
||||
settingKey: modelData[1]
|
||||
visible: index !== 5
|
||||
Component.onCompleted: {
|
||||
if (index === 0) {
|
||||
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
|
||||
})
|
||||
} else if (index === 3) {
|
||||
showTime = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
} else if (index === 4) {
|
||||
showMs = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
} else if (index === 5) {
|
||||
showWrap = Qt.binding(function () {
|
||||
return checked
|
||||
})
|
||||
}
|
||||
|
||||
if (index === 0 || index === 1) {
|
||||
checked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKTextFormatComboBox {
|
||||
id: outputTextFormatComboBox
|
||||
tips: qsTr("Output text format")
|
||||
settingKey: groupName + "outputTextFromat"
|
||||
}
|
||||
SAKButton {
|
||||
icon.source: "qrc:/resources/icon/IconClear.svg"
|
||||
onClicked: outputTextArea.clear()
|
||||
}
|
||||
SAKButton {
|
||||
icon.source: "qrc:/resources/icon/IconSettings.svg"
|
||||
onClicked: root.invokeOpenDrawer(1)
|
||||
}
|
||||
}
|
||||
SAKPane {
|
||||
padding: 0
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
ScrollView {
|
||||
padding: 0
|
||||
anchors.fill: parent
|
||||
SAKTextArea {
|
||||
padding: 0
|
||||
id: outputTextArea
|
||||
width: parent.width
|
||||
background: Rectangle {
|
||||
color: Material.background
|
||||
}
|
||||
selectByMouse: true
|
||||
textFormat: Text.RichText
|
||||
wrapMode: showWrap ? Text.WrapAnywhere : Text.NoWrap
|
||||
Component.onCompleted: {
|
||||
var textDoc = outputTextArea.textDocument
|
||||
sakInterface.setMaximumBlockCount(textDoc, 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKHorizontalLine {
|
||||
anchors.bottom: inputPane.top
|
||||
}
|
||||
Item {
|
||||
id: inputPane
|
||||
height: inputPaneColumnLayout.height
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: 4
|
||||
ColumnLayout {
|
||||
id: inputPaneColumnLayout
|
||||
spacing: 0
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
SAKComboBox {
|
||||
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]
|
||||
onActivated: {
|
||||
if (intervalComboBox.currentIndex === 0) {
|
||||
cycleSendingTimer.stop()
|
||||
} else {
|
||||
var interval = Number(intervalComboBox.currentText)
|
||||
cycleSendingTimer.interval = interval
|
||||
cycleSendingTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKTextFormatComboBox {
|
||||
id: inputTextFormatComboBox
|
||||
tips: qsTr("Input text format")
|
||||
settingKey: groupName + "/inputTextFormat"
|
||||
}
|
||||
SAKComboBox {
|
||||
id: inputComboBox
|
||||
Layout.fillWidth: true
|
||||
textRole: keysObj.itemText
|
||||
valueRole: keysObj.itemFormat
|
||||
editable: true
|
||||
validator: inputTextFormatComboBox.currentValidator
|
||||
useValueRole: false
|
||||
model: ListModel {
|
||||
id: hisrotyListModel
|
||||
}
|
||||
onActivated: {
|
||||
sakSettings.setValue(keysObj.itemCurrentIndex, currentIndex)
|
||||
var ret = inputTextFormatComboBox.indexOfValue(currentValue)
|
||||
if (ret >= 0) {
|
||||
inputTextFormatComboBox.currentIndex = ret
|
||||
editText = currentText
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
// }
|
||||
}
|
||||
}
|
||||
SAKButton {
|
||||
icon.source: "qrc:/resources/icon/IconList.svg"
|
||||
onClicked: menu.resetMenu()
|
||||
Menu {
|
||||
id: menu
|
||||
Repeater {
|
||||
id: menuRepeater
|
||||
MenuItem {
|
||||
text: modelData
|
||||
onTriggered: presotrerTool.send(index)
|
||||
}
|
||||
}
|
||||
|
||||
function resetMenu() {
|
||||
menuRepeater.model = presotrerTool.descriptions
|
||||
menu.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
SAKButton {
|
||||
icon.source: "qrc:/resources/icon/IconSettings.svg"
|
||||
onClicked: root.invokeOpenDrawer(2)
|
||||
}
|
||||
SAKButton {
|
||||
id: sendButton
|
||||
text: qsTr("Send")
|
||||
onClicked: root.invokeSend()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: uselessObject
|
||||
signal bytesInputted(var flag, var bytes)
|
||||
signal bytesOutputted(var flag, var bytes)
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: cycleSendingTimer
|
||||
running: false
|
||||
repeat: true
|
||||
onTriggered: root.invokeSend()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: communicationTool
|
||||
|
||||
function onBytesWritten(inputedBytes, to) {
|
||||
if (showTx) {
|
||||
var str = cookedBytes(flag, inputedBytes, false)
|
||||
outputTextArea.append(str)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: analyzer
|
||||
|
||||
function onBytesOutputted(flag, outputBytes) {
|
||||
if (showRx) {
|
||||
var str = cookedBytes(flag, outputBytes, true)
|
||||
outputTextArea.append(str)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function appendHisroty(text, format) {
|
||||
var count = hisrotyListModel.count
|
||||
for (var i = 0; i < count; i++) {
|
||||
if (i == 10) {
|
||||
return
|
||||
}
|
||||
|
||||
var item = hisrotyListModel.get(i)
|
||||
if (item[keysObj.itemText] === text) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
item = {}
|
||||
item[keysObj.itemText] = text
|
||||
item[keysObj.itemFormat] = format
|
||||
hisrotyListModel.append(item)
|
||||
inputComboBox.editText = text
|
||||
|
||||
sakSettings.edRemove(keysObj.itemGroup, keysObj.itemArray)
|
||||
var values = []
|
||||
count = hisrotyListModel.count
|
||||
for (i = 0; i < count; i++) {
|
||||
item = hisrotyListModel.get(i)
|
||||
var str = JSON.stringify(item)
|
||||
var strHex = sakInterface.string2hexString(str)
|
||||
values.push(sakInterface.string2hexString(str))
|
||||
}
|
||||
sakSettings.edSetArrayValues(keysObj.itemGroup, keysObj.itemArray, keysObj.itemAll, values)
|
||||
}
|
||||
|
||||
function clearOutput() {
|
||||
outputTextArea.clear()
|
||||
}
|
||||
|
||||
function cookedBytes(flag, bytes, isRx) {
|
||||
var dateTimeInfo = ""
|
||||
if (showDate && showTime) {
|
||||
if (showMs) {
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd hh:mm:ss.zzz ")
|
||||
} else {
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd hh:mm:ss ")
|
||||
}
|
||||
} else if (showDate) {
|
||||
dateTimeInfo = sakInterface.dateTimeString("yyyy-MM-dd ")
|
||||
} else if (showTime) {
|
||||
if (showMs) {
|
||||
dateTimeInfo = sakInterface.dateTimeString("hh:mm:ss.zzz ")
|
||||
} else {
|
||||
dateTimeInfo = sakInterface.dateTimeString("hh:mm:ss ")
|
||||
}
|
||||
}
|
||||
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)
|
||||
|
||||
var cookedString = "[" + dateTimeInfo + " " + flagInfo + "] "
|
||||
cookedString = String("<font color=silver>%1</font>").arg(cookedString)
|
||||
var bytesString = sakInterface.arrayToString(bytes, outputFormat)
|
||||
cookedString += bytesString
|
||||
|
||||
return cookedString
|
||||
}
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property SAKPrestorerTool presotrerTool: null
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string items: groupName + "/prestorer/items"
|
||||
}
|
||||
|
||||
ToolBoxCommonTableView {
|
||||
anchors.fill: parent
|
||||
tableMode: presotrerTool ? presotrerTool.tableModel : null
|
||||
tableHeaders: presotrerTool ? presotrerTool.headers : []
|
||||
fillWidthColumns: [9]
|
||||
showColumns: [0, 9]
|
||||
tabelModelTool: root.presotrerTool
|
||||
itemsKey: settingKeys.items
|
||||
onInvokeAppend: {
|
||||
var parameters = presotrerTool.itemContext(-1)
|
||||
editorPopup.setParameters(parameters)
|
||||
editorPopup.index = -1
|
||||
editorPopup.open()
|
||||
}
|
||||
onInvokeEdit: {
|
||||
var parameters = presotrerTool.itemContext(currentRowIndex)
|
||||
editorPopup.setParameters(parameters)
|
||||
editorPopup.index = currentRowIndex
|
||||
editorPopup.open()
|
||||
}
|
||||
onItemsChanged: updateSettings()
|
||||
}
|
||||
|
||||
ToolBoxReadWritePrestorerPopup {
|
||||
id: editorPopup
|
||||
onRejected: close()
|
||||
onAccepted: {
|
||||
close()
|
||||
var parameters = getParameters()
|
||||
presotrerTool.addItem(JSON.stringify(parameters), index)
|
||||
|
||||
updateSettings()
|
||||
}
|
||||
|
||||
property int index: -1
|
||||
}
|
||||
|
||||
// Component.onCompleted: {
|
||||
// var hexString = sakSettings.value(settingKeys.items)
|
||||
// var jsonString = sakInterface.hexString2String(hexString);
|
||||
// var jsonArray = JSON.parse(jsonString)
|
||||
// if (jsonArray) {
|
||||
// for (var i = 0; i < jsonArray.length; i++) {
|
||||
// var item = jsonArray[i]
|
||||
// presotrerTool.addItem(JSON.stringify(item), -1)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
function updateSettings() {
|
||||
sakSettings.edRemove(settingKeys.group, settingKeys.array)
|
||||
var items = presotrerTool.itemsContext()
|
||||
if (items.length) {
|
||||
var itemStringList = []
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i]
|
||||
var itemString = JSON.stringify(item)
|
||||
var itemStringHex = sakInterface.string2hexString(itemString)
|
||||
itemStringList.push(itemStringHex)
|
||||
}
|
||||
|
||||
sakSettings.edSetArrayValues(settingKeys.group,
|
||||
settingKeys.array,
|
||||
settingKeys.key,
|
||||
itemStringList)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,174 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
SAKPopup {
|
||||
id: root
|
||||
|
||||
readonly property string itemDescription: emitterTool.itemDescription
|
||||
readonly property string itemEscapeCharacter: emitterTool.itemEscapeCharacter
|
||||
readonly property string itemTextFormat: emitterTool.itemTextFormat
|
||||
readonly property string itemPrefix: emitterTool.itemPrefix
|
||||
readonly property string itemSuffix: emitterTool.itemSuffix
|
||||
readonly property string itemText: emitterTool.itemText
|
||||
readonly property string itemCrcEnable: emitterTool.itemCrcEnable
|
||||
readonly property string itemCrcAlgorithm: emitterTool.itemCrcAlgorithm
|
||||
readonly property string itemCrcStartIndex: emitterTool.itemCrcStartIndex
|
||||
readonly property string itemCrcEndIndex: emitterTool.itemCrcEndIndex
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
GridLayout {
|
||||
Layout.fillWidth: true
|
||||
columns: 2
|
||||
SAKLabel {
|
||||
text: qsTr("Description")
|
||||
}
|
||||
SAKTextField {
|
||||
id: itemDescriptionTextField
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item text format")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKTextFormatComboBox {
|
||||
id: itemTextFormatComboBox
|
||||
Layout.fillWidth: true
|
||||
onActivated: itemTextTextField.clear()
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item escape")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemEscapeCharacterComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item prefix")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemPrefixComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item suffix")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemSuffixComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item text")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKTextField {
|
||||
id: itemTextTextField
|
||||
validator: itemTextFormatComboBox.currentValidator
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 200
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKCheckBox {
|
||||
id: itemCrcEnableCheckBox
|
||||
text: qsTr("Append CRC data")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC arithmetic")
|
||||
}
|
||||
SAKCrcComboBox {
|
||||
id: itemCrcArithmeticComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC start index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: itemCrcStartIndexSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC end index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: itemCrcEndIndexSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 8
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
Repeater {
|
||||
model: [qsTr("Cancle"), qsTr("Apply")]
|
||||
SAKButton {
|
||||
text: modelData
|
||||
width: Math.round((parent.width - parent.spacing)/2)
|
||||
onClicked: {
|
||||
if (index === 0) {
|
||||
root.rejected()
|
||||
} else {
|
||||
root.accepted()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setParameters(parameters) {
|
||||
if (parameters) {
|
||||
itemDescriptionTextField.text = parameters[itemDescription]
|
||||
var ret = itemTextFormatComboBox.indexOfValue(parameters[itemTextFormat])
|
||||
if (ret >= 0) {
|
||||
itemTextFormatComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemEscapeCharacterComboBox.indexOfValue(parameters[itemEscapeCharacter])
|
||||
if (ret >= 0) {
|
||||
itemEscapeCharacterComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemPrefixComboBox.indexOfValue(parameters[itemPrefix])
|
||||
if (ret >= 0) {
|
||||
itemPrefixComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemSuffixComboBox.indexOfValue(parameters[itemSuffix])
|
||||
if (ret >= 0) {
|
||||
itemSuffixComboBox.currentIndex = ret
|
||||
}
|
||||
itemTextTextField.text = parameters[itemText]
|
||||
|
||||
itemCrcEnableCheckBox.checked = parameters[itemCrcEnable]
|
||||
ret = itemCrcArithmeticComboBox.indexOfValue(parameters[itemCrcAlgorithm])
|
||||
if (ret >= 0) {
|
||||
itemCrcArithmeticComboBox.currentIndex = ret
|
||||
}
|
||||
itemCrcStartIndexSpinBox.value = parameters[itemCrcStartIndex]
|
||||
itemCrcEndIndexSpinBox.value = parameters[itemCrcEndIndex]
|
||||
}
|
||||
}
|
||||
|
||||
function getParameters() {
|
||||
var parameters = {}
|
||||
parameters[itemDescription] = itemDescriptionTextField.text
|
||||
parameters[itemEscapeCharacter] = itemEscapeCharacterComboBox.currentValue
|
||||
parameters[itemTextFormat] = itemTextFormatComboBox.currentValue
|
||||
parameters[itemPrefix] = itemPrefixComboBox.currentValue
|
||||
parameters[itemSuffix] = itemSuffixComboBox.currentValue
|
||||
parameters[itemTextFormat] = itemTextFormatComboBox.currentValue
|
||||
parameters[itemText] = itemTextTextField.text
|
||||
|
||||
parameters[itemCrcEnable] = itemCrcEnableCheckBox.checked
|
||||
parameters[itemCrcAlgorithm] = itemCrcArithmeticComboBox.currentValue
|
||||
parameters[itemCrcStartIndex] = itemCrcStartIndexSpinBox.value
|
||||
parameters[itemCrcEndIndex] = itemCrcEndIndexSpinBox.value
|
||||
return parameters
|
||||
}
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SAK.Custom
|
||||
import "../common"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property SAKResponserTool responserTool: null
|
||||
|
||||
QtObject {
|
||||
id: settingKeys
|
||||
readonly property string items: groupName + "/responser/items"
|
||||
}
|
||||
|
||||
ToolBoxCommonTableView {
|
||||
id: tableView
|
||||
anchors.fill: parent
|
||||
tableMode: responserTool ? responserTool.tableModel : null
|
||||
tableHeaders: responserTool ? responserTool.headers : []
|
||||
fillWidthColumns: [11, 21]
|
||||
showColumns: [0, 1, 2, 11, 21]
|
||||
tabelModelTool: root.responserTool
|
||||
itemsKey: settingKeys.items
|
||||
onInvokeAppend: {
|
||||
var parameters = responserTool.itemContext(-1)
|
||||
editorPopup.setParameters(parameters)
|
||||
editorPopup.index = -1
|
||||
editorPopup.open()
|
||||
}
|
||||
onInvokeEdit: {
|
||||
var parameters = responserTool.itemContext(currentRowIndex)
|
||||
editorPopup.setParameters(parameters)
|
||||
editorPopup.index = currentRowIndex
|
||||
editorPopup.open()
|
||||
}
|
||||
onItemsChanged: updateSettings()
|
||||
}
|
||||
|
||||
ToolBoxReadWriteResponserPopup {
|
||||
id: editorPopup
|
||||
onRejected: close()
|
||||
onAccepted: {
|
||||
close()
|
||||
var parameters = getParameters()
|
||||
responserTool.addItem(JSON.stringify(parameters), index)
|
||||
|
||||
updateSettings()
|
||||
}
|
||||
|
||||
property int index: -1
|
||||
}
|
||||
|
||||
// Component.onCompleted: {
|
||||
// var hexString = sakSettings.value(settingKeys.items)
|
||||
// var jsonString = sakInterface.hexString2String(hexString);
|
||||
// var jsonArray = JSON.parse(jsonString)
|
||||
// if (jsonArray) {
|
||||
// for (var i = 0; i < jsonArray.length; i++) {
|
||||
// var item = jsonArray[i]
|
||||
// responserTool.addItem(JSON.stringify(item), -1)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
function updateSettings() {
|
||||
sakSettings.edRemove(settingKeys.group, settingKeys.array)
|
||||
var items = responserTool.itemsContext()
|
||||
if (items.length) {
|
||||
var itemStringList = []
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i]
|
||||
var itemString = JSON.stringify(item)
|
||||
var itemStringHex = sakInterface.string2hexString(itemString)
|
||||
itemStringList.push(itemStringHex)
|
||||
}
|
||||
|
||||
sakSettings.edSetArrayValues(settingKeys.group,
|
||||
settingKeys.array,
|
||||
settingKeys.key,
|
||||
itemStringList)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,311 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import "../common"
|
||||
|
||||
SAKPopup {
|
||||
id: root
|
||||
|
||||
readonly property string itemEnable: responserTool.itemEnable
|
||||
readonly property string itemDescription: responserTool.itemDescription
|
||||
readonly property string itemOption: responserTool.itemOption
|
||||
|
||||
readonly property string itemReferenceEscapeCharacter: responserTool.itemReferenceEscapeCharacter
|
||||
readonly property string itemReferenceTextFormat: responserTool.itemReferenceTextFormat
|
||||
readonly property string itemReferencePrefix: responserTool.itemReferencePrefix
|
||||
readonly property string itemReferenceSuffix: responserTool.itemReferenceSuffix
|
||||
readonly property string itemReferenceInterval: "itemReferenceInterval"
|
||||
readonly property string itemReferenceText: responserTool.itemReferenceText
|
||||
readonly property string itemReferenceCrcEnable: responserTool.itemReferenceCrcEnable
|
||||
readonly property string itemReferenceCrcAlgorithm: responserTool.itemReferenceCrcAlgorithm
|
||||
readonly property string itemReferenceCrcStartIndex: responserTool.itemReferenceCrcStartIndex
|
||||
readonly property string itemReferenceCrcEndIndex: responserTool.itemReferenceCrcEndIndex
|
||||
|
||||
readonly property string itemResponseEscapeCharacter: responserTool.itemResponseEscapeCharacter
|
||||
readonly property string itemResponseTextFormat: responserTool.itemResponseTextFormat
|
||||
readonly property string itemResponsePrefix: responserTool.itemResponsePrefix
|
||||
readonly property string itemResponseSuffix: responserTool.itemResponseSuffix
|
||||
readonly property string itemResponseInterval: responserTool.itemResponseDelay
|
||||
readonly property string itemResponseText: responserTool.itemResponseText
|
||||
readonly property string itemResponseCrcEnable: responserTool.itemResponseCrcEnable
|
||||
readonly property string itemResponseCrcAlgorithm: responserTool.itemResponseCrcAlgorithm
|
||||
readonly property string itemResponseCrcStartIndex: responserTool.itemResponseCrcStartIndex
|
||||
readonly property string itemResponseCrcEndIndex: responserTool.itemResponseCrcEndIndex
|
||||
|
||||
readonly property string itemEscapeCharacter: parameterIndex === 0 ? itemReferenceEscapeCharacter : itemResponseEscapeCharacter
|
||||
readonly property string itemTextFormat: parameterIndex === 0 ? itemReferenceTextFormat : itemResponseTextFormat
|
||||
readonly property string itemPrefix: (parameterIndex
|
||||
=== 0 ? itemReferencePrefix : itemResponsePrefix)
|
||||
readonly property string itemSuffix: parameterIndex
|
||||
=== 0 ? itemReferenceSuffix : itemResponseSuffix
|
||||
readonly property string itemInterval: parameterIndex
|
||||
=== 0 ? itemReferenceInterval : itemResponseInterval
|
||||
readonly property string itemText: parameterIndex === 0 ? itemReferenceText : itemResponseText
|
||||
readonly property string itemCrcEnable: parameterIndex
|
||||
=== 0 ? itemReferenceCrcEnable : itemResponseCrcEnable
|
||||
readonly property string itemCrcAlgorithm: parameterIndex === 0 ? itemReferenceCrcAlgorithm : itemResponseCrcAlgorithm
|
||||
readonly property string itemCrcStartIndex: parameterIndex === 0 ? itemReferenceCrcStartIndex : itemResponseCrcStartIndex
|
||||
readonly property string itemCrcEndIndex: parameterIndex === 0 ? itemReferenceCrcEndIndex : itemResponseCrcEndIndex
|
||||
|
||||
property int parameterIndex: 0
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
GridLayout {
|
||||
Layout.fillWidth: true
|
||||
columns: 4
|
||||
columnSpacing: 8
|
||||
SAKCheckBox {
|
||||
id: itemEnableCheckBox
|
||||
text: qsTr("Enable the item")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 4
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Description")
|
||||
}
|
||||
SAKTextField {
|
||||
id: itemDescriptionTextField
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Response options")
|
||||
}
|
||||
SAKResponseOptionsComboBox {
|
||||
id: itemOptionComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKHorizontalLine {
|
||||
autoScale: false
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 4
|
||||
}
|
||||
RowLayout {
|
||||
spacing: 8
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 4
|
||||
Repeater {
|
||||
id: itemRepeter
|
||||
model: [qsTr("Reference"), qsTr("Response")]
|
||||
GroupBox {
|
||||
title: modelData
|
||||
Layout.fillWidth: true
|
||||
GridLayout {
|
||||
anchors.fill: parent
|
||||
columns: 2
|
||||
SAKLabel {
|
||||
text: qsTr("Text format")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKTextFormatComboBox {
|
||||
id: itemTextFormatComboBox
|
||||
Layout.fillWidth: true
|
||||
onActivated: itemTextTextField.clear()
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item escape")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemEscapeCharacterComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item prefix")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemPrefixComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item suffix")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKEscComboBox {
|
||||
id: itemSuffixComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item interval")
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: itemIntervalSpinBox
|
||||
enabled: index === 1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("Item text")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKTextField {
|
||||
id: itemTextTextField
|
||||
validator: itemTextFormatComboBox.currentValidator
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 300
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKCheckBox {
|
||||
id: itemCrcEnableCheckBox
|
||||
text: qsTr("Append CRC data")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC arithmetic")
|
||||
}
|
||||
SAKCrcComboBox {
|
||||
id: itemCrcArithmeticComboBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC start index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: itemCrcStartIndexSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
SAKLabel {
|
||||
text: qsTr("CRC end index")
|
||||
}
|
||||
SAKSpinBox {
|
||||
id: itemCrcEndIndexSpinBox
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
function setParameters(parameters) {
|
||||
var ret = itemTextFormatComboBox.indexOfValue(
|
||||
parameters[itemTextFormat])
|
||||
if (ret >= 0) {
|
||||
itemTextFormatComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemEscapeCharacterComboBox.indexOfValue(
|
||||
parameters[itemEscapeCharacter])
|
||||
if (ret >= 0) {
|
||||
itemEscapeCharacterComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemPrefixComboBox.indexOfValue(
|
||||
parameters[itemPrefix])
|
||||
if (ret >= 0) {
|
||||
itemPrefixComboBox.currentIndex = ret
|
||||
}
|
||||
ret = itemSuffixComboBox.indexOfValue(
|
||||
parameters[itemSuffix])
|
||||
if (ret >= 0) {
|
||||
itemSuffixComboBox.currentIndex = ret
|
||||
}
|
||||
itemIntervalSpinBox.value
|
||||
= parameters[itemInterval] ? parameters[itemInterval] : 1000
|
||||
itemTextTextField.text = parameters[itemText]
|
||||
|
||||
itemCrcEnableCheckBox.checked = parameters[itemCrcEnable]
|
||||
ret = itemCrcArithmeticComboBox.indexOfValue(
|
||||
parameters[itemCrcAlgorithm])
|
||||
if (ret >= 0) {
|
||||
itemCrcArithmeticComboBox.currentIndex = ret
|
||||
}
|
||||
itemCrcStartIndexSpinBox.value = parameters[itemCrcStartIndex]
|
||||
itemCrcEndIndexSpinBox.value = parameters[itemCrcEndIndex]
|
||||
}
|
||||
|
||||
function getParameters() {
|
||||
var parameters = {}
|
||||
parameters[itemEscapeCharacter]
|
||||
= itemEscapeCharacterComboBox.currentValue
|
||||
parameters[itemTextFormat] = itemTextFormatComboBox.currentValue
|
||||
parameters[itemPrefix] = itemPrefixComboBox.currentValue
|
||||
parameters[itemSuffix] = itemSuffixComboBox.currentValue
|
||||
parameters[itemInterval] = itemIntervalSpinBox.value
|
||||
parameters[itemText] = itemTextTextField.text
|
||||
|
||||
parameters[itemCrcEnable] = itemCrcEnableCheckBox.checked
|
||||
parameters[itemCrcAlgorithm] = itemCrcArithmeticComboBox.currentValue
|
||||
parameters[itemCrcStartIndex] = itemCrcStartIndexSpinBox.value
|
||||
parameters[itemCrcEndIndex] = itemCrcEndIndexSpinBox.value
|
||||
|
||||
return parameters
|
||||
}
|
||||
}
|
||||
|
||||
function setParameters(parameters, index) {
|
||||
parameterIndex = index
|
||||
var item = itemRepeter.itemAt(index)
|
||||
if (item) {
|
||||
item.setParameters(parameters)
|
||||
}
|
||||
}
|
||||
|
||||
function getParameters(index) {
|
||||
parameterIndex = index
|
||||
var item = itemRepeter.itemAt(index)
|
||||
if (item) {
|
||||
return item.getParameters()
|
||||
}
|
||||
|
||||
return {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
spacing: 8
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 4
|
||||
Repeater {
|
||||
model: [qsTr("Cancle"), qsTr("Apply")]
|
||||
SAKButton {
|
||||
text: modelData
|
||||
width: Math.round((parent.width - parent.spacing) / 2)
|
||||
onClicked: {
|
||||
if (index === 0) {
|
||||
root.rejected()
|
||||
} else {
|
||||
root.accepted()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setParameters(parameters) {
|
||||
if (parameters) {
|
||||
itemEnableCheckBox.checked = parameters[itemEnable]
|
||||
itemDescriptionTextField.text = parameters[itemDescription]
|
||||
var ret = itemOptionComboBox.indexOfValue(parameters[itemOption])
|
||||
if (ret >= 0) {
|
||||
itemOptionComboBox.currentIndex = ret
|
||||
}
|
||||
|
||||
itemRepeter.setParameters(parameters, 0)
|
||||
itemRepeter.setParameters(parameters, 1)
|
||||
}
|
||||
|
||||
console.info("Set parameters:", JSON.stringify(parameters))
|
||||
}
|
||||
|
||||
function getParameters() {
|
||||
var parameters = {}
|
||||
parameters[itemEnable] = itemEnableCheckBox.checked
|
||||
parameters[itemDescription] = itemDescriptionTextField.text
|
||||
parameters[itemOption] = itemOptionComboBox.currentValue
|
||||
|
||||
var reference = itemRepeter.getParameters(0)
|
||||
var response = itemRepeter.getParameters(1)
|
||||
var referenceKeys = Object.keys(reference)
|
||||
var responseKeys = Object.keys(response)
|
||||
|
||||
for (var i = 0; i < referenceKeys.length; i++) {
|
||||
parameters[referenceKeys[i]] = reference[referenceKeys[i]]
|
||||
}
|
||||
for (i = 0; i < responseKeys.length; i++) {
|
||||
parameters[responseKeys[i]] = response[responseKeys[i]]
|
||||
}
|
||||
|
||||
console.info("Get parameters:", JSON.stringify(parameters))
|
||||
return parameters
|
||||
}
|
||||
}
|
||||
@ -1,83 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qml/MainWindow.qml</file>
|
||||
<file>qml/MainWindowTitleBar.qml</file>
|
||||
<file>qml/MainWindowToolBar.qml</file>
|
||||
<file>qml/toolbox/ToolBox.qml</file>
|
||||
<file>qml/toolbox/ToolBoxCommonClient.qml</file>
|
||||
<file>qml/toolbox/ToolBoxCommonCrcParameters.qml</file>
|
||||
<file>qml/toolbox/ToolBoxCommonServer.qml</file>
|
||||
<file>qml/toolbox/ToolBoxCommonTableView.qml</file>
|
||||
<file>qml/toolbox/ToolBoxController.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawer.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerDevice.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerDeviceAnalyzer.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerDeviceMasker.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerInput.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerInputCrc.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerInputFileSendding.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerInputPreprocessor.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerOutput.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerOutputHighlighter.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerOutputPreprocessor.qml</file>
|
||||
<file>qml/toolbox/ToolBoxDrawerOutputStorer.qml</file>
|
||||
<file>qml/toolbox/ToolBoxReadWrite.qml</file>
|
||||
<file>qml/toolbox/ToolBoxReadWriteEmitter.qml</file>
|
||||
<file>qml/toolbox/ToolBoxReadWriteEmitterPopup.qml</file>
|
||||
<file>qml/toolbox/ToolBoxReadWriteInputOutput.qml</file>
|
||||
<file>qml/toolbox/ToolBoxReadWritePrestorer.qml</file>
|
||||
<file>qml/toolbox/ToolBoxReadWritePrestorerPopup.qml</file>
|
||||
<file>qml/toolbox/ToolBoxReadWriteResponser.qml</file>
|
||||
<file>qml/toolbox/ToolBoxReadWriteResponserPopup.qml</file>
|
||||
<file>qml/common/SAKAsciiRegularExpressionValidator.qml</file>
|
||||
<file>qml/common/SAKBinRegularExpressionValidator.qml</file>
|
||||
<file>qml/common/SAKBleComboBox.qml</file>
|
||||
<file>qml/common/SAKButton.qml</file>
|
||||
<file>qml/common/SAKCheckBox.qml</file>
|
||||
<file>qml/common/SAKComboBox.qml</file>
|
||||
<file>qml/common/SAKCrcComboBox.qml</file>
|
||||
<file>qml/common/SAKDecRegularExpressionValidator.qml</file>
|
||||
<file>qml/common/SAKEscComboBox.qml</file>
|
||||
<file>qml/common/SAKFontFamiliesComboBox.qml</file>
|
||||
<file>qml/common/SAKGroupBox.qml</file>
|
||||
<file>qml/common/SAKHexRegularExpressionValidator.qml</file>
|
||||
<file>qml/common/SAKHorizontalLine.qml</file>
|
||||
<file>qml/common/SAKIpComboBox.qml</file>
|
||||
<file>qml/common/SAKLabel.qml</file>
|
||||
<file>qml/common/SAKMaterialColors.qml</file>
|
||||
<file>qml/common/SAKOctRegularExpressionValidator.qml</file>
|
||||
<file>qml/common/SAKPane.qml</file>
|
||||
<file>qml/common/SAKPopup.qml</file>
|
||||
<file>qml/common/SAKProgressBar.qml</file>
|
||||
<file>qml/common/SAKResponseOptionsComboBox.qml</file>
|
||||
<file>qml/common/SAKRNComboBox.qml</file>
|
||||
<file>qml/common/SAKSpinBox.qml</file>
|
||||
<file>qml/common/SAKText.qml</file>
|
||||
<file>qml/common/SAKTextArea.qml</file>
|
||||
<file>qml/common/SAKTextField.qml</file>
|
||||
<file>qml/common/SAKTextFormatComboBox.qml</file>
|
||||
<file>qml/common/SAKToolButton.qml</file>
|
||||
<file>qml/common/SAKVerticalLine.qml</file>
|
||||
<file>qml/MainWindowToolBarItem.qml</file>
|
||||
<file>qml/MainWindowPages.qml</file>
|
||||
<file>qml/pages/SerialPortPage.qml</file>
|
||||
<file>qml/pages/SerialPortPageController.qml</file>
|
||||
<file>qml/pages/TcpClientPage.qml</file>
|
||||
<file>qml/pages/TcpClientPageController.qml</file>
|
||||
<file>qml/pages/TcpServerPage.qml</file>
|
||||
<file>qml/pages/TcpServerPageController.qml</file>
|
||||
<file>qml/pages/UdpClientPage.qml</file>
|
||||
<file>qml/pages/UdpClientPageController.qml</file>
|
||||
<file>qml/pages/UdpServerPage.qml</file>
|
||||
<file>qml/pages/UdpServerPageController.qml</file>
|
||||
<file>qml/pages/WebSocketClientPage.qml</file>
|
||||
<file>qml/pages/WebSocketClientPageController.qml</file>
|
||||
<file>qml/pages/WebSocketServerPage.qml</file>
|
||||
<file>qml/pages/WebSocketServerPageController.qml</file>
|
||||
<file>qml/pages/BleCentralPage.qml</file>
|
||||
<file>qml/pages/BleCentralPageController.qml</file>
|
||||
<file>qml/pages/AboutPage.qml</file>
|
||||
<file>qml/pages/SettingsPage.qml</file>
|
||||
<file>qml/pages/BasePage.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@ -1,56 +0,0 @@
|
||||
find_package(Qt6 REQUIRED COMPONENTS Qml QuickControls2)
|
||||
|
||||
file(
|
||||
GLOB
|
||||
EASY_DEBUG_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/common/common/*.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/common/common/*.cc"
|
||||
"${CMAKE_SOURCE_DIR}/src/common/commonui/sakhighlighter.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/common/commonui/sakhighlighter.cc"
|
||||
"${CMAKE_SOURCE_DIR}/src/toolbox/toolbox/*.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/toolbox/toolbox/*.cc"
|
||||
"${CMAKE_SOURCE_DIR}/src/tools/tools/*.hh"
|
||||
"${CMAKE_SOURCE_DIR}/src/tools/tools/*.cc"
|
||||
"${CMAKE_SOURCE_DIR}/src/log/log/*.hh"
|
||||
"${CMAKE_SOURCE_DIR}/src/log/log/*.cc"
|
||||
"${CMAKE_SOURCE_DIR}/src/easydebug/*.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/easydebug/*.cc"
|
||||
"${CMAKE_SOURCE_DIR}/qtswissarmyknifeqml.qrc"
|
||||
"${CMAKE_SOURCE_DIR}/qtswissarmyknife.qrc")
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND EASY_DEBUG_SOURCES "${CMAKE_SOURCE_DIR}/windows.rc")
|
||||
endif()
|
||||
|
||||
set(EASY_DEBUG_APP_SOURCES ${EASY_DEBUG_SOURCES})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sak/EasyDebug")
|
||||
|
||||
if(SAK_IMPORT_MODULE_BLUETOOTH)
|
||||
message(STATUS "EasyDebug: Bluetooth is supportted")
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src/optional/bluetooth)
|
||||
set(EASY_DEBUG_BLUETOOTH_SOURCES
|
||||
${CMAKE_SOURCE_DIR}/src/optional/bluetooth/sakblecentraltool.h
|
||||
${CMAKE_SOURCE_DIR}/src/optional/bluetooth/sakblecentraltool.cc
|
||||
${CMAKE_SOURCE_DIR}/src/optional/bluetooth/sakblescanner.h
|
||||
${CMAKE_SOURCE_DIR}/src/optional/bluetooth/sakblescanner.cc)
|
||||
list(APPEND EASY_DEBUG_APP_SOURCES ${EASY_DEBUG_BLUETOOTH_SOURCES})
|
||||
endif()
|
||||
|
||||
sak_add_executable(EasyDebug ${EASY_DEBUG_APP_SOURCES})
|
||||
sak_set_target_properties(EasyDebug)
|
||||
sak_auto_execute_windeployqt(EasyDebug)
|
||||
|
||||
target_link_libraries(
|
||||
EasyDebug
|
||||
PRIVATE glog::glog
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Qml
|
||||
Qt${QT_VERSION_MAJOR}::SerialPort
|
||||
Qt${QT_VERSION_MAJOR}::QuickControls2
|
||||
Qt${QT_VERSION_MAJOR}::WebSockets
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
if(SAK_IMPORT_MODULE_BLUETOOTH)
|
||||
target_link_libraries(EasyDebug PRIVATE Qt${QT_VERSION_MAJOR}::Bluetooth)
|
||||
endif()
|
||||
@ -1,23 +0,0 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2023 Qsaker(qsaker@foxmail.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of QtSwissArmyKnife project.
|
||||
*
|
||||
* QtSwissArmyKnife is licensed according to the terms in the file LICENCE in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#include "sak.h"
|
||||
#include "sakguiapplication.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
qputenv("QT_QUICK_CONTROLS_MATERIAL_VARIANT", "Dense");
|
||||
const QString appName = QString("EasyDebug");
|
||||
sakDoSomethingBeforeAppCreated(argv, appName);
|
||||
|
||||
SAKGuiApplication app(argc, argv);
|
||||
int ret = app.exec();
|
||||
|
||||
sakDoSomethingAfterAppExited();
|
||||
return ret;
|
||||
}
|
||||
@ -1,102 +0,0 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2023 Qsaker(qsaker@foxmail.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of QtSwissArmyKnife project.
|
||||
*
|
||||
* QtSwissArmyKnife is licensed according to the terms in the file LICENCE in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#include "sakguiapplication.h"
|
||||
|
||||
#include <QQmlContext>
|
||||
#include <QQuickStyle>
|
||||
|
||||
#include "sakanalyzertool.h"
|
||||
#include "sakbasetool.h"
|
||||
#include "sakcrcinterface.h"
|
||||
#include "sakdatastructure.h"
|
||||
#include "sakemittertool.h"
|
||||
#include "sakhighlighter.h"
|
||||
#include "sakinterface.h"
|
||||
#include "sakmaskertool.h"
|
||||
#include "saknetworkinterfacescanner.h"
|
||||
#include "sakprestorertool.h"
|
||||
#include "sakresponsertool.h"
|
||||
#include "sakserialportscanner.h"
|
||||
#include "sakserialporttool.h"
|
||||
#include "saksettings.h"
|
||||
#include "sakstorertool.h"
|
||||
#include "saktablemodeltool.h"
|
||||
#include "saktcpclienttool.h"
|
||||
#include "saktcpservertool.h"
|
||||
#include "saktoolbox.h"
|
||||
#include "saktoolfactory.h"
|
||||
#include "saktranslator.h"
|
||||
#include "sakudpclienttool.h"
|
||||
#include "sakudpservertool.h"
|
||||
#include "sakwebsocketclienttool.h"
|
||||
#include "sakwebsocketservertool.h"
|
||||
|
||||
#ifdef SAK_IMPORT_MODULE_BLUETOOTH
|
||||
#include "sakblecentraltool.h"
|
||||
#include "sakblescanner.h"
|
||||
#endif
|
||||
|
||||
SAKGuiApplication::SAKGuiApplication(int argc, char* argv[])
|
||||
: QGuiApplication(argc, argv)
|
||||
{
|
||||
QQuickStyle::setStyle("Material");
|
||||
|
||||
auto sakCrc = new SAKCrcInterface(this);
|
||||
auto sakInterface = new SAKInterface(this);
|
||||
auto sakDataStructure = new SAKDataStructure(this);
|
||||
|
||||
auto sakI18n = SAKTranslator::instance();
|
||||
auto sakSettings = SAKSettings::instance();
|
||||
|
||||
QString language = SAKSettings::instance()->language();
|
||||
SAKTranslator::instance()->setupLanguage(language);
|
||||
|
||||
const QString reason = "Uncreatable type!";
|
||||
qmlRegisterType<SAKToolBox>("SAK.Custom", 1, 0, "SAKToolBox");
|
||||
qmlRegisterType<SAKSettings>("SAK.Custom", 1, 0, "SAKSettings");
|
||||
#ifdef SAK_IMPORT_MODULE_BLUETOOTH
|
||||
qmlRegisterType<SAKBleScanner>("SAK.Custom", 1, 0, "SAKBleScanner");
|
||||
#endif
|
||||
qmlRegisterType<SAKHighlighter>("SAK.Custom", 1, 0, "SAKHighlighter");
|
||||
qmlRegisterType<SAKCrcInterface>("SAK.Custom", 1, 0, "SAKCrcInterface");
|
||||
qmlRegisterType<SAKSerialPortScanner>("SAK.Custom", 1, 0, "SAKSerialPortScanner");
|
||||
qmlRegisterType<SAKNetworkInterfaceScanner>("SAK.Custom", 1, 0, "SAKNetworkInterfaceScanner");
|
||||
|
||||
// clang-format off
|
||||
qmlRegisterUncreatableType<SAKBaseTool>("SAK.Custom", 1, 0, "SAKBaseTool", reason);
|
||||
qmlRegisterUncreatableType<SAKInterface>("SAK.Custom", 1, 0, "SAKInterface", reason);
|
||||
qmlRegisterUncreatableType<SAKMaskerTool>("SAK.Custom", 1, 0, "SAKMaskerTool", reason);
|
||||
qmlRegisterUncreatableType<SAKStorerTool>("SAK.Custom", 1, 0, "SAKStorerTool", reason);
|
||||
qmlRegisterUncreatableType<SAKEmitterTool>("SAK.Custom", 1, 0, "SAKEmitterTool", reason);
|
||||
qmlRegisterUncreatableType<SAKToolFactory>("SAK.Custom", 1, 0, "SAKToolsFactory", reason);
|
||||
qmlRegisterUncreatableType<SAKAnalyzerTool>("SAK.Custom", 1, 0, "SAKAnalyzerTool", reason);
|
||||
qmlRegisterUncreatableType<SAKPrestorerTool>("SAK.Custom", 1, 0, "SAKPrestorerTool", reason);
|
||||
qmlRegisterUncreatableType<SAKResponserTool>("SAK.Custom", 1, 0, "SAKResponserTool", reason);
|
||||
qmlRegisterUncreatableType<SAKUdpClientTool>("SAK.Custom", 1, 0, "SAKUdpClientTool", reason);
|
||||
qmlRegisterUncreatableType<SAKUdpServerTool>("SAK.Custom", 1, 0, "SAKUdpServerTool", reason);
|
||||
qmlRegisterUncreatableType<SAKTcpClientTool>("SAK.Custom", 1, 0, "SAKTcpClientTool", reason);
|
||||
qmlRegisterUncreatableType<SAKTcpServerTool>("SAK.Custom", 1, 0, "SAKTcpServerTool", reason);
|
||||
qmlRegisterUncreatableType<SAKDataStructure>("SAK.Custom", 1, 0, "SAKDataStructure", reason);
|
||||
#ifdef SAK_IMPORT_MODULE_BLUETOOTH
|
||||
qmlRegisterUncreatableType<SAKBleCentralTool>("SAK.Custom", 1, 0, "SAKBleCentralTool", reason);
|
||||
#endif
|
||||
qmlRegisterUncreatableType<SAKSerialPortTool>("SAK.Custom", 1, 0, "SAKSerialport", reason);
|
||||
qmlRegisterUncreatableType<SAKTableModelTool>("SAK.Custom", 1, 0, "SAKTabelModelTool", reason);
|
||||
qmlRegisterUncreatableType<SAKCommunicationTool>("SAK.Custom", 1, 0, "SAKCommunicator", reason);
|
||||
qmlRegisterUncreatableType<SAKWebSocketServerTool>("SAK.Custom", 1, 0, "SAKWebSocketServerTool", reason);
|
||||
qmlRegisterUncreatableType<SAKWebSocketClientTool>("SAK.Custom", 1, 0, "SAKWebSocketClientTool", reason);
|
||||
// clang-format on
|
||||
|
||||
mQmlAppEngine.rootContext()->setContextProperty("sakCrc", sakCrc);
|
||||
mQmlAppEngine.rootContext()->setContextProperty("sakI18n", sakI18n);
|
||||
mQmlAppEngine.rootContext()->setContextProperty("sakSettings", sakSettings);
|
||||
mQmlAppEngine.rootContext()->setContextProperty("sakInterface", sakInterface);
|
||||
mQmlAppEngine.rootContext()->setContextProperty("sakDataStructure", sakDataStructure);
|
||||
mQmlAppEngine.load("qrc:/qml/MainWindow.qml");
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2023 Qsaker(qsaker@foxmail.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of QtSwissArmyKnife project.
|
||||
*
|
||||
* QtSwissArmyKnife is licensed according to the terms in the file LICENCE in the root of the source
|
||||
* code directory.
|
||||
**************************************************************************************************/
|
||||
#ifndef SAKGUIAPPLICATION_H
|
||||
#define SAKGUIAPPLICATION_H
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
|
||||
class SAKGuiApplication : public QGuiApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SAKGuiApplication(int argc, char *argv[]);
|
||||
|
||||
private:
|
||||
QQmlApplicationEngine mQmlAppEngine;
|
||||
};
|
||||
|
||||
#endif // SAKGUIAPPLICATION_H
|
||||
Loading…
Reference in New Issue
Block a user