-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathToolTableEditorDialog.qml
112 lines (96 loc) · 3.09 KB
/
ToolTableEditorDialog.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import QtQuick 2.0
import QtQuick.Dialogs 1.2
/****************************************************************************
**
** Copyright (C) 2017 Alexander Rössler
** License: LGPL version 2.1
**
** This file is part of QtQuickVcp.
**
** All rights reserved. This program and the accompanying materials
** are made available under the terms of the GNU Lesser General Public License
** (LGPL) version 2.1 which accompanies this distribution, and is available at
** http://www.gnu.org/licenses/lgpl-2.1.html
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** Contributors:
** Alexander Rössler <alexander AT roessler DOT systems>
**
****************************************************************************/
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
import QtQuick.Window 2.0
Dialog
{
property alias core: editor.core
property alias status: editor.status
property alias command: editor.command
property alias helper: editor.helper
property alias width: container.implicitWidth
property alias height: container.implicitHeight
id: root
title: qsTr("Tool Table Editor")
QtObject {
id: d
readonly property bool ready: status.synced && command.connected
}
onVisibleChanged: {
if (!visible && editor.modified) {
editor.resetModifications();
}
}
contentItem: Item {
id: container
ColumnLayout {
anchors.fill: parent
anchors.margins: Screen.pixelDensity
enabled: d.ready
ToolTableEditor {
id: editor
Layout.fillHeight: true
Layout.fillWidth: true
}
RowLayout {
Layout.fillWidth: true
Label {
text: editor.errored ? qsTr("Error in tool table.") : (editor.modified ? qsTr("Tool table has modifications.") : "")
}
Item {
Layout.fillWidth: true
}
Button {
text: qsTr("Add Row")
iconName: "list-add"
onClicked: editor.addRow()
}
Button {
text: qsTr("Remove Row")
iconName: "list-remove"
enabled: editor.itemSelected
onClicked: editor.removeRow()
}
Button {
text: qsTr("Reset Modifications")
iconName: "view-refresh"
enabled: editor.modified
onClicked: editor.resetModifications()
}
Button {
text: qsTr("Update Tool Table")
iconName: "dialog-ok-apply"
enabled: !editor.errored && editor.modified
onClicked: editor.updateToolTable()
}
Button {
text: qsTr("Close")
iconName: "dialog-close"
onClicked: root.close()
}
}
}
}
}