Changeset View
Changeset View
Standalone View
Standalone View
Modules/energy/package/contents/ui/main.qml
| Show All 10 Lines | |||||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
| 12 | * GNU General Public License for more details. * | 12 | * GNU General Public License for more details. * | ||
| 13 | * * | 13 | * * | ||
| 14 | * You should have received a copy of the GNU General Public License * | 14 | * You should have received a copy of the GNU General Public License * | ||
| 15 | * along with this program; if not, write to the * | 15 | * along with this program; if not, write to the * | ||
| 16 | * Free Software Foundation, Inc., * | 16 | * Free Software Foundation, Inc., * | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * | ||
| 18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
| 19 | 19 | | |||
| 20 | import QtQuick 2.2 | 20 | import QtQuick 2.5 | ||
broulik: and also getting rid of QQC1 | |||||
| 21 | import QtQuick.Controls 1.3 | 21 | import QtQuick.Controls 2.5 | ||
I might be too aggressive here, what would be the best version to set here ? meven: I might be too aggressive here, what would be the best version to set here ? | |||||
ngraham: 2.5 is always a safe bet. | |||||
| 22 | import QtQuick.Controls 2.0 as QQC2 | | |||
| 23 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 | ||
| 23 | import org.kde.kirigami 2.5 as Kirigami | ||||
| 24 | 24 | | |||
| 25 | import org.kde.kquickcontrolsaddons 2.0 | 25 | import org.kde.kquickcontrolsaddons 2.0 | ||
| 26 | import org.kde.kinfocenter.energy.private 1.0 | 26 | import org.kde.kinfocenter.energy.private 1.0 | ||
| 27 | 27 | | |||
| 28 | //We need units from it | | |||
| 29 | import org.kde.plasma.core 2.0 as PlasmaCore | 28 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
broulik: A goal is to get rid of these plasma imports, too | |||||
Now that you've imported Kirigami, you can use Kirigami.Units and drop the PlasmaCore import filipf: Now that you've imported Kirigami, you can use Kirigami.Units and drop the PlasmaCore import | |||||
| 30 | import org.kde.plasma.extras 2.0 as PlasmaExtras | | |||
| 31 | 29 | | |||
| 32 | import org.kde.plasma.workspace.components 2.0 as WorkspaceComponents | 30 | import org.kde.plasma.workspace.components 2.0 as WorkspaceComponents | ||
| 33 | 31 | | |||
| 34 | Item { | 32 | Item { | ||
| 35 | id: root | 33 | id: root | ||
| 36 | property QtObject currentBattery: null | 34 | property QtObject currentBattery: null | ||
| 37 | property string currentUdi: "" | 35 | property string currentUdi: "" | ||
| 38 | property bool compact: (root.width / units.gridUnit) < 25 | 36 | property bool compact: (root.width / units.gridUnit) < 25 | ||
| 39 | 37 | | |||
| 40 | onCurrentBatteryChanged: { | 38 | onCurrentBatteryChanged: { | ||
| 41 | if (!currentBattery) { | 39 | if (!currentBattery) { | ||
| 42 | currentBattery = kcm.batteries.get(0) | 40 | currentBattery = kcm.batteries.get(0) | ||
| 43 | currentUdi = kcm.batteries.udi(0) | 41 | currentUdi = kcm.batteries.udi(0) | ||
| 44 | } | 42 | } | ||
| 45 | } | 43 | } | ||
| 46 | 44 | | |||
| 47 | SystemPalette { id: sysPal; colorGroup: SystemPalette.Active } | | |||
| 48 | | ||||
| 49 | property bool showWakeUps: true | 45 | property bool showWakeUps: true | ||
filipf: there is trailing space in this row | |||||
| 50 | property int historyType: HistoryModel.ChargeType | 46 | property int historyType: HistoryModel.ChargeType | ||
| 51 | 47 | | |||
| 52 | readonly property var details: [ | 48 | readonly property var details: [ | ||
| 53 | { | 49 | { | ||
| 54 | title: i18n("Battery"), | 50 | title: i18n("Battery"), | ||
| 55 | data: [ | 51 | data: [ | ||
| 56 | {label: i18n("Rechargeable"), value: "rechargeable"}, | 52 | {label: i18n("Rechargeable"), value: "rechargeable"}, | ||
| 57 | {label: i18n("Charge state"), value: "chargeState", modifier: "chargeState"} | 53 | {label: i18n("Charge state"), value: "chargeState", modifier: "chargeState"} | ||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 89 | function modifier_chargeState(value) { | |||
| 99 | } | 95 | } | ||
| 100 | } | 96 | } | ||
| 101 | 97 | | |||
| 102 | Component.onCompleted: { | 98 | Component.onCompleted: { | ||
| 103 | currentBattery = kcm.batteries.get(0) | 99 | currentBattery = kcm.batteries.get(0) | ||
| 104 | currentUdi = kcm.batteries.udi(0) | 100 | currentUdi = kcm.batteries.udi(0) | ||
| 105 | } | 101 | } | ||
| 106 | 102 | | |||
| 107 | implicitWidth: units.gridUnit * 25 | 103 | implicitWidth: units.gridUnit * 30 | ||
| 108 | implicitHeight: !!currentBattery ? units.gridUnit * 25 : units.gridUnit * 12 | 104 | implicitHeight: !!currentBattery ? units.gridUnit * 30 : units.gridUnit * 12 | ||
| 109 | 105 | | |||
| 110 | SystemPalette { | 106 | readonly property var timespanComboChoices: [i18n("Last hour"),i18n("Last 2 hours"),i18n("Last 12 hours"),i18n("Last 24 hours"),i18n("Last 48 hours"), i18n("Last 7 days")] | ||
| 111 | id: syspal | 107 | readonly property var timespanComboDurations: [3600, 7200, 43200, 86400, 172800, 604800] | ||
| 112 | } | | |||
| 113 | 108 | | |||
| 114 | ScrollView { | 109 | Kirigami.ScrollablePage { | ||
| 115 | id: scrollView | | |||
| 116 | anchors.fill: parent | 110 | anchors.fill: parent | ||
| 117 | 111 | | |||
| 118 | horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff | | |||
| 119 | | ||||
| 120 | ColumnLayout { | 112 | ColumnLayout { | ||
| 121 | id: column | 113 | id: column | ||
| 122 | | ||||
| 123 | width: scrollView.viewport.width | | |||
| 124 | spacing: units.largeSpacing | | |||
| 125 | | ||||
| 126 | ScrollView { | 114 | ScrollView { | ||
| 127 | id: tabView | 115 | id: tabView | ||
| 128 | Layout.fillWidth: true | 116 | Layout.fillWidth: true | ||
| 129 | Layout.minimumHeight: units.gridUnit * 3 | 117 | Layout.minimumHeight: units.gridUnit * 3 | ||
| 130 | Layout.maximumHeight: Layout.minimumHeight | 118 | Layout.maximumHeight: Layout.minimumHeight | ||
| 131 | | ||||
| 132 | frameVisible: true | | |||
| 133 | visible: kcm.batteries.count > 1 | 119 | visible: kcm.batteries.count > 1 | ||
| 134 | 120 | | |||
| 135 | verticalScrollBarPolicy: Qt.ScrollBarAlwaysOff | | |||
| 136 | | ||||
| 137 | Row { | 121 | Row { | ||
| 122 | spacing: Kirigami.Units.smallSpacing | ||||
| 138 | Repeater { | 123 | Repeater { | ||
| 139 | model: kcm.batteries | 124 | model: kcm.batteries | ||
| 140 | 125 | | |||
| 141 | Button { | 126 | Button { | ||
| 142 | id: button | 127 | id: button | ||
| 143 | width: height | 128 | width: height | ||
| 144 | height: tabView.viewport.height | 129 | height: tabView.height | ||
| 145 | checked: model.battery == root.currentBattery | 130 | checked: model.battery == root.currentBattery | ||
| 146 | checkable: true | 131 | checkable: true | ||
| 147 | onClicked: { | 132 | onClicked: { | ||
| 148 | root.currentUdi = model.udi | 133 | root.currentUdi = model.udi | ||
| 149 | root.currentBattery = model.battery | 134 | root.currentBattery = model.battery | ||
| 150 | // override checked property | 135 | // override checked property | ||
| 151 | checked = Qt.binding(function() { | 136 | checked = Qt.binding(function() { | ||
| 152 | return model.battery == root.currentBattery | 137 | return model.battery == root.currentBattery | ||
| Show All 26 Lines | 154 | batteryType: { | |||
| 179 | } | 164 | } | ||
| 180 | } | 165 | } | ||
| 181 | percent: model.battery.chargePercent | 166 | percent: model.battery.chargePercent | ||
| 182 | //pluggedIn: model.battery.chargeState === 1 // Makes it hard to see | 167 | //pluggedIn: model.battery.chargeState === 1 // Makes it hard to see | ||
| 183 | } | 168 | } | ||
| 184 | 169 | | |||
| 185 | ProgressBar { // TODO make progress bar not eat mouse events | 170 | ProgressBar { // TODO make progress bar not eat mouse events | ||
| 186 | Layout.fillWidth: true | 171 | Layout.fillWidth: true | ||
| 187 | minimumValue: 0 | 172 | from: 0 | ||
| 188 | maximumValue: 100 | 173 | to: 100 | ||
| 189 | value: model.battery.chargePercent | 174 | value: model.battery.chargePercent | ||
| 190 | enabled: button.checked ? false : true | 175 | enabled: button.checked ? false : true | ||
| 191 | } | 176 | } | ||
| 192 | } | 177 | } | ||
| 193 | } | 178 | } | ||
| 194 | } | 179 | } | ||
| 195 | } | 180 | } | ||
| 196 | } | 181 | } | ||
| Show All 30 Lines | 188 | GridLayout { | |||
| 227 | 212 | | |||
| 228 | Item { | 213 | Item { | ||
| 229 | Layout.fillWidth: true | 214 | Layout.fillWidth: true | ||
| 230 | } | 215 | } | ||
| 231 | 216 | | |||
| 232 | ComboBox { | 217 | ComboBox { | ||
| 233 | id: timespanCombo | 218 | id: timespanCombo | ||
| 234 | Layout.minimumWidth: units.gridUnit * 6 | 219 | Layout.minimumWidth: units.gridUnit * 6 | ||
| 235 | model: [ | 220 | model: timespanComboChoices | ||
| 236 | {text: i18n("Last hour"), value: 3600}, | | |||
| 237 | {text: i18n("Last 2 hours"), value: 7200}, | | |||
| 238 | {text: i18n("Last 12 hours"), value: 43200}, | | |||
| 239 | {text: i18n("Last 24 hours"), value: 86400}, | | |||
| 240 | {text: i18n("Last 48 hours"), value: 172800}, | | |||
| 241 | {text: i18n("Last 7 days"), value: 604800} | | |||
| 242 | ] | | |||
| 243 | Accessible.name: i18n("Timespan") | 221 | Accessible.name: i18n("Timespan") | ||
| 244 | Accessible.description: i18n("Timespan of data to display") | 222 | Accessible.description: i18n("Timespan of data to display") | ||
| 245 | } | 223 | } | ||
| 246 | 224 | | |||
| 247 | Button { | 225 | Button { | ||
| 248 | iconName: "view-refresh" | 226 | icon.name: "view-refresh" | ||
| 249 | tooltip: i18n("Refresh") | 227 | hoverEnabled: true | ||
| 250 | Accessible.name: tooltip | 228 | ToolTip.text: i18n("Refresh") | ||
| 229 | ToolTip.visible: hovered | ||||
| 230 | ToolTip.delay: Kirigami.Units.toolTipDelay | ||||
| 231 | Accessible.name: ToolTip.text | ||||
| 251 | onClicked: history.refresh() | 232 | onClicked: history.refresh() | ||
| 252 | } | 233 | } | ||
| 253 | } | 234 | } | ||
| 254 | 235 | | |||
| 255 | HistoryModel { | 236 | HistoryModel { | ||
| 256 | id: history | 237 | id: history | ||
| 257 | duration: timespanCombo.model[timespanCombo.currentIndex].value | 238 | duration: timespanComboDurations[timespanCombo.currentIndex] | ||
| 258 | device: currentUdi | 239 | device: currentUdi | ||
| 259 | type: root.historyType | 240 | type: root.historyType | ||
| 260 | } | 241 | } | ||
| 261 | 242 | | |||
| 262 | Graph { | 243 | Graph { | ||
| 263 | id: graph | 244 | id: graph | ||
| 264 | Layout.fillWidth: true | 245 | Layout.fillWidth: true | ||
| 265 | Layout.minimumHeight: column.width / 3 | 246 | Layout.minimumHeight: column.width / 3 | ||
| Show All 15 Lines | 254 | yMax: { | |||
| 281 | } else { | 262 | } else { | ||
| 282 | return 100; | 263 | return 100; | ||
| 283 | } | 264 | } | ||
| 284 | } | 265 | } | ||
| 285 | yStep: root.historyType == HistoryModel.RateType ? 10 : 20 | 266 | yStep: root.historyType == HistoryModel.RateType ? 10 : 20 | ||
| 286 | visible: history.count > 1 | 267 | visible: history.count > 1 | ||
| 287 | } | 268 | } | ||
| 288 | 269 | | |||
| 289 | QQC2.Label { | 270 | Kirigami.InlineMessage { | ||
| 290 | Layout.fillWidth: true | 271 | Layout.fillWidth: true | ||
| 291 | Layout.minimumHeight: column.width / 3 | 272 | showCloseButton: true | ||
| 292 | Layout.maximumHeight: column.width / 3 | | |||
| 293 | horizontalAlignment: Text.AlignHCenter | | |||
| 294 | verticalAlignment: Text.AlignVCenter | | |||
| 295 | text: i18n("This type of history is currently not available for this device.") | 273 | text: i18n("This type of history is currently not available for this device.") | ||
| 296 | wrapMode: Text.WordWrap | | |||
| 297 | visible: !graph.visible | 274 | visible: !graph.visible | ||
| 298 | } | 275 | } | ||
| 299 | } | 276 | } | ||
| 300 | 277 | | |||
| 301 | ColumnLayout { | 278 | ColumnLayout { | ||
| 302 | Layout.fillWidth: true | 279 | Layout.fillWidth: true | ||
| 303 | spacing: units.smallSpacing | 280 | spacing: units.smallSpacing | ||
| 304 | visible: showWakeUps && kcm.wakeUps.count > 0 | 281 | visible: showWakeUps && kcm.wakeUps.count > 0 | ||
| 305 | 282 | | |||
| 306 | RowLayout { | 283 | RowLayout { | ||
| 307 | Layout.fillWidth: true | 284 | Layout.fillWidth: true | ||
| 308 | PlasmaExtras.Heading { | 285 | Kirigami.Heading { | ||
| 309 | Layout.fillWidth: true | 286 | Layout.fillWidth: true | ||
| 310 | Layout.columnSpan: 2 | 287 | Layout.columnSpan: 2 | ||
| 311 | color: sysPal.text | | |||
| 312 | level: 4 | 288 | level: 4 | ||
| 313 | text: i18n("Application Energy Consumption") | 289 | text: i18n("Application Energy Consumption") | ||
| 314 | } | 290 | } | ||
| 315 | } | 291 | } | ||
| 316 | 292 | | |||
| 317 | GridLayout { | 293 | GridLayout { | ||
| 318 | id: wakeUpsGrid | 294 | id: wakeUpsGrid | ||
| 319 | Layout.fillWidth: true | 295 | Layout.fillWidth: true | ||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 328 | RowLayout { | |||
| 361 | 337 | | |||
| 362 | ColumnLayout { | 338 | ColumnLayout { | ||
| 363 | Layout.fillWidth: true | 339 | Layout.fillWidth: true | ||
| 364 | spacing: 0 | 340 | spacing: 0 | ||
| 365 | 341 | | |||
| 366 | RowLayout { | 342 | RowLayout { | ||
| 367 | Layout.fillWidth: true | 343 | Layout.fillWidth: true | ||
| 368 | 344 | | |||
| 369 | QQC2.Label { | 345 | Label { | ||
| 370 | Layout.fillWidth: true | 346 | Layout.fillWidth: true | ||
| 371 | elide: Text.ElideRight | 347 | elide: Text.ElideRight | ||
| 372 | text: model.prettyName || model.name | 348 | text: model.prettyName || model.name | ||
| 373 | } | 349 | } | ||
| 374 | 350 | | |||
| 375 | /*Label { | 351 | /*Label { | ||
| 376 | text: i18n("System Service") | 352 | text: i18n("System Service") | ||
| 377 | visible: !model.userSpace | 353 | visible: !model.userSpace | ||
| 378 | opacity: 0.6 | 354 | opacity: 0.6 | ||
| 379 | }*/ | 355 | }*/ | ||
| 380 | } | 356 | } | ||
| 381 | 357 | | |||
| 382 | ProgressBar { | 358 | ProgressBar { | ||
| 383 | Layout.fillWidth: true | 359 | Layout.fillWidth: true | ||
| 384 | minimumValue: 0 | 360 | from: 0 | ||
| 385 | maximumValue: 100 | 361 | to: 100 | ||
| 386 | value: model.wakeUps / kcm.wakeUps.total * 100 | 362 | value: model.wakeUps / kcm.wakeUps.total * 100 | ||
| 387 | } | 363 | } | ||
| 388 | } | 364 | } | ||
| 389 | } | 365 | } | ||
| 390 | } | 366 | } | ||
| 391 | } | 367 | } | ||
| 392 | } | 368 | } | ||
| 393 | } | 369 | } | ||
| 394 | 370 | | |||
| 395 | Rectangle { | 371 | Rectangle { | ||
| 396 | Layout.fillWidth: true | 372 | Layout.fillWidth: true | ||
| 397 | height: 1 | 373 | height: 1 | ||
| 398 | color: "#ccc" // FIXME palette | 374 | color: Kirigami.Theme.textColor // FIXME palette | ||
| 399 | //Layout.topMargin: (compact ? units.gridUnit * 2 : 0) | 375 | //Layout.topMargin: (compact ? units.gridUnit * 2 : 0) | ||
| 400 | visible: wakeUpsGrid.visible | 376 | visible: wakeUpsGrid.visible | ||
| 401 | } | 377 | } | ||
| 402 | 378 | | |||
| 403 | ColumnLayout { | 379 | ColumnLayout { | ||
| 404 | id: detailsColumn | 380 | id: detailsColumn | ||
| 405 | property int legendWidth: 10 | | |||
| 406 | 381 | | |||
| 407 | Layout.fillWidth: true | 382 | Layout.fillWidth: true | ||
| 408 | spacing: 0 | | |||
| 409 | visible: !!currentBattery | 383 | visible: !!currentBattery | ||
| 410 | 384 | | |||
| 411 | Repeater { | 385 | Repeater { | ||
| 386 | id: titleRepeater | ||||
| 412 | model: root.details | 387 | model: root.details | ||
| 388 | property list<Kirigami.FormLayout> layouts | ||||
| 413 | 389 | | |||
| 414 | ColumnLayout { | 390 | delegate: Kirigami.FormLayout { | ||
| 415 | spacing: 0//units.smallSpacing | 391 | id: currentLayout | ||
| 416 | 392 | | |||
| 417 | PlasmaExtras.Heading { | 393 | Component.onCompleted: { | ||
| 418 | level: 4 | 394 | // ensure that all visible FormLayout share the same set of twinFormLayouts | ||
| 419 | color: sysPal.text | 395 | titleRepeater.layouts.push(currentLayout); | ||
| 396 | for (var i = 0, length = titleRepeater.layouts.length; i < length; ++i) { | ||||
| 397 | titleRepeater.layouts[i].twinFormLayouts = titleRepeater.layouts; | ||||
| 398 | } | ||||
| 399 | } | ||||
| 400 | | ||||
| 401 | Kirigami.Heading { | ||||
| 420 | text: modelData.title | 402 | text: modelData.title | ||
| 403 | Kirigami.FormData.isSection: true | ||||
| 404 | level: 2 | ||||
| 421 | // HACK hide section header if all labels are invisible | 405 | // HACK hide section header if all labels are invisible | ||
| 422 | visible: { | 406 | visible: { | ||
| 423 | for (var i = 0, length = detailsRepeater.count; i < length; ++i) { | 407 | for (var i = 0, length = detailsRepeater.count; i < length; ++i) { | ||
| 424 | var item = detailsRepeater.itemAt(i) | 408 | var item = detailsRepeater.itemAt(i) | ||
| 425 | if (item && item.visible) { | 409 | if (item && item.visible) { | ||
| 426 | return true | 410 | return true | ||
| 427 | } | 411 | } | ||
| 428 | } | 412 | } | ||
| 429 | 413 | | |||
| 430 | return false | 414 | return false | ||
| 431 | } | 415 | } | ||
| 432 | } | 416 | } | ||
| 433 | 417 | | |||
| 434 | Repeater { | 418 | Repeater { | ||
| 435 | id: detailsRepeater | 419 | id: detailsRepeater | ||
| 436 | model: modelData.data || [] | 420 | model: modelData.data || [] | ||
| 437 | 421 | | |||
| 438 | RowLayout { | 422 | Label { | ||
filipf: trailing space her as well, as well as in the preceding row | |||||
| 439 | Layout.fillWidth: true | | |||
| 440 | spacing: units.smallSpacing * 2 | | |||
| 441 | visible: valueLabel.text !== "" | | |||
| 442 | | ||||
| 443 | QQC2.Label { | | |||
| 444 | Layout.minimumWidth: detailsColumn.legendWidth + units.gridUnit | | |||
| 445 | horizontalAlignment: Text.AlignRight | | |||
| 446 | text: i18n("%1:", modelData.label) | | |||
| 447 | wrapMode: Text.NoWrap | | |||
| 448 | opacity: 0.8 | | |||
| 449 | onPaintedWidthChanged: { | | |||
| 450 | if (paintedWidth > detailsColumn.legendWidth) { | | |||
| 451 | detailsColumn.legendWidth = paintedWidth | | |||
| 452 | } | | |||
| 453 | } | | |||
| 454 | } | | |||
| 455 | | ||||
| 456 | QQC2.Label { | | |||
| 457 | id: valueLabel | 423 | id: valueLabel | ||
| 458 | Layout.fillWidth: true | 424 | Kirigami.FormData.label: i18n("%1:", modelData.label) | ||
| 459 | text: { | 425 | text: { | ||
| 460 | var value = currentBattery[modelData.value] | 426 | var value = currentBattery[modelData.value] | ||
| 461 | 427 | | |||
| 462 | if (typeof value === "boolean") { | 428 | if (typeof value === "boolean") { | ||
| 463 | if (value) { | 429 | if (value) { | ||
| 464 | return i18n("Yes") | 430 | return i18n("Yes") | ||
| 465 | } else { | 431 | } else { | ||
| 466 | return i18n("No") | 432 | return i18n("No") | ||
| 467 | } | 433 | } | ||
| 468 | } | 434 | } | ||
| 469 | 435 | | |||
| 470 | if (!value) { | 436 | if (!value) { | ||
broulik: Shouldn't be neccessary as it's `QQC2.Label` | |||||
For breeze dark this makes the label, dark gray on a dark background. See before screenshot. Could it be a breeze dark bug ? meven: For breeze dark this makes the label, dark gray on a dark background. See before screenshot. | |||||
| 471 | return "" | 437 | return "" | ||
| 472 | } | 438 | } | ||
| 473 | 439 | | |||
| 474 | var precision = modelData.precision | 440 | var precision = modelData.precision | ||
| 475 | if (typeof precision === "number") { // round to decimals | 441 | if (typeof precision === "number") { // round to decimals | ||
| 476 | value = Number(value).toLocaleString(Qt.locale(), "f", precision) | 442 | value = Number(value).toLocaleString(Qt.locale(), "f", precision) | ||
| 477 | } | 443 | } | ||
| 478 | 444 | | |||
| 479 | if (modelData.modifier && root["modifier_" + modelData.modifier]) { | 445 | if (modelData.modifier && root["modifier_" + modelData.modifier]) { | ||
| 480 | value = root["modifier_" + modelData.modifier](value) | 446 | value = root["modifier_" + modelData.modifier](value) | ||
| 481 | } | 447 | } | ||
| 482 | 448 | | |||
| 483 | if (modelData.unit) { | 449 | if (modelData.unit) { | ||
| 484 | value = i18nc("%1 is value, %2 is unit", "%1 %2", value, modelData.unit) | 450 | value = i18nc("%1 is value, %2 is unit", "%1 %2", value, modelData.unit) | ||
| 485 | } | 451 | } | ||
| 486 | 452 | | |||
| 487 | return value | 453 | return value | ||
| 488 | } | 454 | } | ||
| 455 | visible: valueLabel.text !== "" | ||||
| 489 | } | 456 | } | ||
| 490 | } | 457 | } | ||
| 491 | } | 458 | } | ||
| 492 | } | 459 | } | ||
| 493 | } | 460 | } | ||
| 494 | } | 461 | } | ||
| 495 | } | 462 | | ||
| 496 | } | 463 | } | ||
| 497 | } | 464 | } | ||
and also getting rid of QQC1