-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImpactView.qml
More file actions
202 lines (158 loc) · 5.06 KB
/
ImpactView.qml
File metadata and controls
202 lines (158 loc) · 5.06 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import QtQuick
import QtQuick.Layouts
import qmlcomponents
ColumnLayout {
id: root
spacing: TibiaStyle.marginRelated
signal requestGaugeContextMenu()
signal requestGraphContextMenu()
property string abbreviation: "dps"
property alias caption: captionText.text
property alias gaugeVisible: gaugeView.visible
property alias impactSum: sumText.text
property real impactPerSecond: 0.0
property alias impactPerSecondString: impactPerSecondText.text
property alias maxImpactPerSecond: maxImpactPerSecondText.text
property alias allTimeMaxImpact: allTimeMaxImpactText.text
property real targetImpactPerSecond: 0.0
property alias targetImpactPerSecondString: targetImpactPerSecondText.text
property alias graphVisible: graphView.visible
property alias graphYMax: graph.yMax
property alias graphValues: graph.values
property bool showSessionValues: false;
ColumnLayout {
id: defaultView
Layout.fillWidth: true
spacing: TibiaStyle.marginRelated
TibiaText {
id: captionText
Layout.fillWidth: true
styleType: "WhiteCaption"
wrapMode: Text.Wrap
} //TibiaText
RowLayout {
spacing: TibiaStyle.marginNarrow
TibiaText {
text: qsTrId("impact_total_label")
} //TibiaText
TibiaText {
id: sumText
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
} //TibiaText
} //RowLayout
RowLayout {
spacing: TibiaStyle.marginNarrow
TibiaText {
text: qsTrId("impact_" + root.abbreviation.toLowerCase() + "_abbreviation_label") + ":"
} //TibiaText
TibiaText {
id: impactPerSecondText
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
} //TibiaText
visible: !gaugeView.visible
} //RowLayout
RowLayout {
spacing: TibiaStyle.marginNarrow
TibiaText {
text: qsTrId("impact_max_label") + qsTrId("impact_" + root.abbreviation.toLowerCase() + "_abbreviation_label") + ":"
} //TibiaText
TibiaText {
id: maxImpactPerSecondText
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
} //TibiaText
} //RowLayout
RowLayout {
spacing: TibiaStyle.marginNarrow
TibiaText {
text: qsTrId("impact_all_time_max") + ":"
} //TibiaText
TibiaText {
id: allTimeMaxImpactText
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
} //TibiaText
} //RowLayout
} //ColumnLayout
Item {
id: gaugeView
Layout.preferredHeight: gaugeLayout.height
Layout.fillWidth: true
ColumnLayout {
id: gaugeLayout
anchors { left: parent.left; right: parent.right }
spacing: TibiaStyle.marginRelated
TibiaHorizontalSeparator {
Layout.fillWidth: true
//Layout.bottomMargin: TibiaStyle.marginNarrow - parent.spacing
} //TibiaHorizontalSeparator
RowLayout {
spacing: TibiaStyle.marginNarrow
TibiaText {
text: qsTrId("impact_target_label") + qsTrId("impact_" + root.abbreviation.toLowerCase() + "_abbreviation_label") + ":"
} //TibiaText
TibiaText {
id: targetImpactPerSecondText
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
} //TibiaText
} //RowLayout
TibiaGauge {
id: gauge
Layout.fillWidth: true
targetValue: root.targetImpactPerSecond
targetValueString: root.targetImpactPerSecondString
currentValue: root.impactPerSecond
currentValueString: root.impactPerSecondString
} //TibiaGauge
RowLayout {
spacing: TibiaStyle.marginNarrow
TibiaText {
text: qsTrId("impact_" + root.abbreviation.toLowerCase() + "_abbreviation_label") + ":"
} //TibiaText
TibiaText {
Layout.fillWidth: true
horizontalAlignment: Text.AlignRight
text: root.impactPerSecondString
} //TibiaText
} //RowLayout
} //ColumnLayout
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: root.requestGaugeContextMenu()
} //MouseArea
} //Item
Item {
id: graphView
Layout.preferredHeight: graphLayout.height
Layout.fillWidth: true
ColumnLayout {
id: graphLayout
anchors { left: parent.left; right: parent.right }
spacing: TibiaStyle.marginRelated
TibiaHorizontalSeparator {
Layout.fillWidth: true
Layout.bottomMargin: TibiaStyle.marginNarrow - parent.spacing
} //TibiaHorizontalSeparator
TibiaGraph {
id: graph
Layout.fillWidth: true
xLabel: qsTrId("minutes")
yLabel: qsTrId("impact_" + root.abbreviation.toLowerCase() + "_abbreviation_label")
xMin: showSessionValues ? -60 : -4
xMax: 0
yMin: 0
yMax: 1
values: []
} // TibiaGraph
} //ColumnLayout
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: root.requestGraphContextMenu()
} //MouseArea
} //Item
} //ColumnLayout