Added scrollbars for lists and text fields. Added saving to the path settings for configuration files and the current language. Various UI improvements
This commit is contained in:
@@ -53,7 +53,8 @@ ItemDelegate {
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: control.pressed ? Palette.pressedButtonColor :
|
||||
control.hovered ? Palette.hoveredButtonColor : Palette.buttonColor
|
||||
color: control.pressed || control.highlighted ?
|
||||
Palette.pressedButtonColor : control.hovered ?
|
||||
Palette.hoveredButtonColor : Palette.buttonColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,22 +5,36 @@ import Utils 1.0
|
||||
|
||||
ScrollBar {
|
||||
id: control
|
||||
size: 0.3
|
||||
position: 0.2
|
||||
active: true
|
||||
orientation: Qt.Vertical
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: 2
|
||||
visible: control.policy !== ScrollBar.AlwaysOff
|
||||
minimumSize: orientation == Qt.Horizontal ? height / width : width / height
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: 12
|
||||
implicitHeight: 100
|
||||
radius: width / 2
|
||||
color: Palette.alternativeBackgroundColor
|
||||
// Hide the ScrollBar when it's not needed.
|
||||
opacity: control.policy === ScrollBar.AlwaysOn || (control.active && control.size < 1.0) ? 0.75 : 0
|
||||
implicitWidth: control.interactive ? 6 : 2
|
||||
implicitHeight: control.interactive ? 6 : 2
|
||||
|
||||
// Animate the changes in opacity (default duration is 250 ms).
|
||||
Behavior on opacity {
|
||||
NumberAnimation {}
|
||||
radius: width / 2
|
||||
color: control.pressed ? Palette.alternativeBackgroundColor : Qt.lighter(Palette.alternativeBackgroundColor, 1.1)
|
||||
opacity: 0.0
|
||||
|
||||
states: State {
|
||||
name: "active"
|
||||
when: control.policy === ScrollBar.AlwaysOn || (control.active && control.size < 1.0)
|
||||
PropertyChanges { target: control.contentItem; opacity: 0.75 }
|
||||
}
|
||||
|
||||
transitions: Transition {
|
||||
from: "active"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 450 }
|
||||
NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
40
qml/Controls/ScrollIndicator.qml
Normal file
40
qml/Controls/ScrollIndicator.qml
Normal file
@@ -0,0 +1,40 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import Utils 1.0
|
||||
|
||||
ScrollIndicator {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: 2
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: 2
|
||||
implicitHeight: 2
|
||||
|
||||
color: Palette.alternativeBackgroundColor
|
||||
visible: control.size < 1.0
|
||||
opacity: 0.0
|
||||
|
||||
states: State {
|
||||
name: "active"
|
||||
when: control.active
|
||||
PropertyChanges { target: control.contentItem; opacity: 0.75 }
|
||||
}
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "active"
|
||||
SequentialAnimation {
|
||||
PauseAnimation { duration: 450 }
|
||||
NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -22,3 +22,4 @@ DialogHeader 1.0 DialogHeader.qml
|
||||
DialogBackground 1.0 DialogBackground.qml
|
||||
BusyIndicator 1.0 BusyIndicator.qml
|
||||
MenuItemDelegate 1.0 MenuItemDelegate.qml
|
||||
ScrollIndicator 1.0 ScrollIndicator.qml
|
||||
|
||||
@@ -71,6 +71,8 @@ ApplicationWindow {
|
||||
|
||||
ListView {
|
||||
id: menuView
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
property var menuModel: [
|
||||
{"text": qsTr("AKB monitor"), "icon": "qrc:/Icons/akb-monitor.svg"},
|
||||
@@ -87,6 +89,7 @@ ApplicationWindow {
|
||||
width: ListView.view.width
|
||||
text: menuView.menuModel[modelData].text
|
||||
icon.source: menuView.menuModel[modelData].icon
|
||||
highlighted: ListView.isCurrentItem
|
||||
minimized: pane.minimized
|
||||
onClicked: menuView.currentIndex = index
|
||||
}
|
||||
@@ -291,7 +294,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
Layout.preferredWidth: languagesLayout.implicitWidth
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredHeight: languagesLayout.implicitHeight
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,6 +334,7 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
Screens.DebugInformationScreen {
|
||||
id: debugScreen
|
||||
}
|
||||
|
||||
Screens.BmsServiceScreen {
|
||||
@@ -351,6 +355,8 @@ ApplicationWindow {
|
||||
serialLabel.text = "-"
|
||||
firmwareLabel.text = "-"
|
||||
}
|
||||
|
||||
debugScreen.printMessage(BmsInterface.getConnectedPortName(), true)
|
||||
}
|
||||
|
||||
onMessageDialog: {
|
||||
@@ -494,5 +500,6 @@ ApplicationWindow {
|
||||
|
||||
Component.onCompleted: {
|
||||
connectionDialog.open()
|
||||
Qt.callLater(debugScreen.printMessage, qsTr("Tool started"), true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,9 +332,16 @@ Item {
|
||||
|
||||
onVisibleChanged: getValues()
|
||||
|
||||
Timer {
|
||||
id: refreshValuesTimer
|
||||
interval: 5000
|
||||
onTriggered: getValues()
|
||||
}
|
||||
|
||||
function getValues() {
|
||||
if (BmsInterface.isPortConnected() && visible) {
|
||||
BmsInterface.commands().getValues()
|
||||
refreshValuesTimer.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,12 +12,20 @@ ColumnLayout {
|
||||
Keys.onEnterPressed: sendButton.clicked()
|
||||
|
||||
Controls.Frame {
|
||||
ScrollView {
|
||||
Flickable {
|
||||
id: outputFlickable
|
||||
clip: true
|
||||
anchors.fill: parent
|
||||
Controls.TextArea {
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
TextArea.flickable: Controls.TextArea {
|
||||
id: outputArea
|
||||
}
|
||||
|
||||
ScrollBar.horizontal: Controls.ScrollBar {}
|
||||
ScrollBar.vertical: Controls.ScrollBar {}
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
@@ -58,6 +66,9 @@ ColumnLayout {
|
||||
|
||||
Connections {
|
||||
target: BmsInterface.commands()
|
||||
onPrintReceived: outputArea.append(str)
|
||||
onPrintReceived: {
|
||||
outputArea.append(str)
|
||||
outputArea.cursorPosition = outputArea.length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Dialogs 1.2
|
||||
import Qt.labs.settings 1.1
|
||||
|
||||
import Controls 1.0 as Controls
|
||||
import Cubo 1.0
|
||||
@@ -20,6 +21,7 @@ RowLayout {
|
||||
id: settingsFlickable
|
||||
clip: true
|
||||
contentHeight: configLayout.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
ColumnLayout {
|
||||
id: configLayout
|
||||
@@ -587,9 +589,17 @@ RowLayout {
|
||||
folder: shortcuts.documents
|
||||
nameFilters: [ qsTr("Configuration files (*.xml)"), qsTr("All files (*)") ]
|
||||
onAccepted: {
|
||||
BmsInterface.bmsConfig().loadXml(loadFileDialog.fileUrl.toString().replace(/^(file:\/{3})/, ""), "bmsConfiguration")
|
||||
let result = BmsInterface.bmsConfig().loadXml(loadFileDialog.fileUrl.toString().replace(/^(file:\/{3})/, ""), "bmsConfiguration")
|
||||
if (!result) {
|
||||
BmsInterface.emitStatusMessage(BmsInterface.bmsConfig().xmlStatus(), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Settings {
|
||||
category: "loadConfiguration"
|
||||
property alias folder: loadFileDialog.folder
|
||||
}
|
||||
}
|
||||
|
||||
Controls.OutlineButton {
|
||||
@@ -604,15 +614,23 @@ RowLayout {
|
||||
folder: shortcuts.documents
|
||||
nameFilters: [ qsTr("Configuration files (*.xml)"), qsTr("All files (*)") ]
|
||||
onAccepted: {
|
||||
BmsInterface.bmsConfig().saveXml(saveFileDialog.fileUrl.toString().replace(/^(file:\/{3})/, ""), "bmsConfiguration")
|
||||
let result = BmsInterface.bmsConfig().saveXml(saveFileDialog.fileUrl.toString().replace(/^(file:\/{3})/, ""), "bmsConfiguration")
|
||||
if (!result) {
|
||||
BmsInterface.emitStatusMessage(BmsInterface.bmsConfig().xmlStatus(), false)
|
||||
} else {
|
||||
BmsInterface.emitStatusMessage(qsTr("BMS configuration saved to file"), true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Settings {
|
||||
category: "saveConfiguration"
|
||||
property alias folder: saveFileDialog.folder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: Controls.ScrollBar {
|
||||
// policy: ScrollBar.AlwaysOn
|
||||
}
|
||||
ScrollBar.vertical: Controls.ScrollBar {}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
@@ -658,7 +676,10 @@ RowLayout {
|
||||
|
||||
Controls.LinkLabel {
|
||||
text: qsTr("Current sensor value \"0\"")
|
||||
onClicked: settingsFlickable.contentY = zeroSensorSettingsFrame.mapToItem(settingsFlickable.contentItem, 0, 0).y
|
||||
onClicked: {
|
||||
settingsFlickable.contentY = zeroSensorSettingsFrame.mapToItem(settingsFlickable.contentItem, 0, 0).y
|
||||
settingsFlickable.returnToBounds()
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
@@ -123,6 +124,7 @@ Item {
|
||||
|
||||
header: cellListHeader
|
||||
delegate: cellListDelegate
|
||||
ScrollBar.vertical: Controls.ScrollBar {}
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
@@ -145,6 +147,7 @@ Item {
|
||||
|
||||
header: cellListHeader
|
||||
delegate: cellListDelegate
|
||||
ScrollBar.vertical: Controls.ScrollBar {}
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
@@ -182,9 +185,16 @@ Item {
|
||||
|
||||
onVisibleChanged: getValues()
|
||||
|
||||
Timer {
|
||||
id: refreshValuesTimer
|
||||
interval: 5000
|
||||
onTriggered: getValues()
|
||||
}
|
||||
|
||||
function getValues() {
|
||||
if (BmsInterface.isPortConnected() && visible) {
|
||||
BmsInterface.commands().getCells()
|
||||
refreshValuesTimer.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,27 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
import Controls 1.0 as Controls
|
||||
import Cubo 1.0
|
||||
import Utils 1.0
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 20
|
||||
|
||||
Controls.Frame {
|
||||
ScrollView {
|
||||
Flickable {
|
||||
id: outputFlickable
|
||||
clip: true
|
||||
anchors.fill: parent
|
||||
Controls.TextArea {
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
TextArea.flickable: Controls.TextArea {
|
||||
id: outputArea
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
|
||||
ScrollBar.horizontal: Controls.ScrollBar { }
|
||||
ScrollBar.vertical: Controls.ScrollBar { }
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
@@ -27,9 +37,27 @@ ColumnLayout {
|
||||
|
||||
Connections {
|
||||
target: BmsInterface
|
||||
onStatusMessage: printMessage(msg, isGood)
|
||||
}
|
||||
|
||||
onStatusMessage: {
|
||||
outputArea.append(msg)
|
||||
function printMessage(msg, isGood) {
|
||||
var message = ""
|
||||
|
||||
if (!isGood) {
|
||||
message += "<font color=\"" + Palette.invalidColor + "\">"
|
||||
}
|
||||
|
||||
message += new Date().toLocaleString(Qt.locale("en-US"), "dd.MM.yyyy hh:mm:ss") + ": " + msg
|
||||
|
||||
if (!isGood) {
|
||||
message += "</font>"
|
||||
}
|
||||
|
||||
message += "<br>"
|
||||
|
||||
outputArea.insert(outputArea.length, message)
|
||||
outputArea.cursorPosition = outputArea.length
|
||||
|
||||
outputFlickable.contentX = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtCharts 2.3
|
||||
|
||||
@@ -169,6 +170,8 @@ ColumnLayout {
|
||||
model: seriesCount
|
||||
delegate: legendDelegate
|
||||
visible: !horizontalLegend
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
ScrollBar.vertical: Controls.ScrollBar {}
|
||||
|
||||
property Controls.ChartView chartItem: chart
|
||||
|
||||
|
||||
@@ -38,5 +38,6 @@
|
||||
<file>Utils/MathHelper.qml</file>
|
||||
<file>Controls/BusyIndicator.qml</file>
|
||||
<file>Controls/MenuItemDelegate.qml</file>
|
||||
<file>Controls/ScrollIndicator.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user