massive qml controls replacement (#114)

This commit is contained in:
Evgenii Alekseev 2016-09-28 13:50:57 +03:00
parent 8aa6d0c626
commit 80c994bce0
11 changed files with 439 additions and 527 deletions

View File

@ -0,0 +1,55 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
Row {
height: implicitHeight
width: parent.width
property alias currentIndex: comboBox.currentIndex
property alias editable: comboBox.editable
property alias editText: comboBox.editText
property alias model: comboBox.model
property alias text: label.text
property string value
signal valueEdited(string newValue)
QtControls.Label {
id: label
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
QtControls.ComboBox {
id: comboBox
width: parent.width * 3 / 5
textRole: 'label'
onCurrentIndexChanged: valueEdited(comboBox.model[comboBox.currentIndex]['name'])
Component.onCompleted: {
var total = comboBox.model.length
for (var i = 0; i < total; i++) {
if (comboBox.model[i]["name"] == value)
comboBox.currentIndex = i
}
}
}
}

View File

@ -0,0 +1,47 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
Row {
height: implicitHeight
width: parent.width
property alias text: label.text
property alias value: spinBox.value
property alias maximumValue: spinBox.maximumValue
property alias minimumValue: spinBox.minimumValue
property alias stepSize: spinBox.stepSize
signal valueEdited(int newValue)
QtControls.Label {
id: label
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
QtControls.SpinBox {
id: spinBox
width: parent.width * 3 / 5
onEditingFinished: valueEdited(spinBox.value)
}
}

View File

@ -0,0 +1,43 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
Row {
height: implicitHeight
width: parent.width
property alias text: label.text
property alias value: textField.text
signal valueEdited(string newValue)
QtControls.Label {
id: label
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
QtControls.TextField {
id: textField
width: parent.width * 3 / 5
onEditingFinished: valueEdited(textField.text)
}
}

View File

@ -50,11 +50,11 @@ Item {
property alias cfg_width: widgetWidth.value
property alias cfg_interval: update.value
property alias cfg_queueLimit: queueLimit.value
property string cfg_tempUnits: tempUnits.currentText
property alias cfg_customTime: customTime.text
property alias cfg_customUptime: customUptime.text
property alias cfg_acOnline: acOnline.text
property alias cfg_acOffline: acOffline.text
property string cfg_tempUnits: tempUnits.value
property alias cfg_customTime: customTime.value
property alias cfg_customUptime: customUptime.value
property alias cfg_acOnline: acOnline.value
property alias cfg_acOffline: acOffline.value
Column {
@ -96,209 +96,101 @@ Item {
text: i18n("Optimize subscription")
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Widget height, px")
}
QtControls.SpinBox {
id: widgetHeight
width: parent.width * 3 / 5
minimumValue: 0
maximumValue: 4096
stepSize: 50
value: plasmoid.configuration.height
}
IntegerSelector {
id: widgetHeight
maximumValue: 4096
minimumValue: 0
stepSize: 50
text: i18n("Widget height, px")
value: plasmoid.configuration.height
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Widget width, px")
}
QtControls.SpinBox {
id: widgetWidth
width: parent.width * 3 / 5
minimumValue: 0
maximumValue: 4096
stepSize: 50
value: plasmoid.configuration.width
}
IntegerSelector {
id: widgetWidth
maximumValue: 4096
minimumValue: 0
stepSize: 50
text: i18n("Widget width, px")
value: plasmoid.configuration.width
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Time interval")
}
QtControls.SpinBox {
id: update
width: parent.width * 3 / 5
minimumValue: 1000
maximumValue: 10000
stepSize: 500
value: plasmoid.configuration.interval
}
IntegerSelector {
id: update
maximumValue: 10000
minimumValue: 1000
stepSize: 500
text: i18n("Time interval")
value: plasmoid.configuration.interval
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Messages queue limit")
}
QtControls.SpinBox {
id: queueLimit
width: parent.width * 3 / 5
minimumValue: 0
maximumValue: 99
stepSize: 1
value: plasmoid.configuration.queueLimit
}
IntegerSelector {
id: queueLimit
maximumValue: 99
minimumValue: 0
stepSize: 1
text: i18n("Messages queue limit")
value: plasmoid.configuration.queueLimit
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Temperature units")
}
QtControls.ComboBox {
id: tempUnits
width: parent.width * 3 / 5
textRole: "label"
model: [
{
'label': i18n("Celsius"),
'name': "Celsius"
},
{
'label': i18n("Fahrenheit"),
'name': "Fahrenheit"
},
{
'label': i18n("Kelvin"),
'name': "Kelvin"
},
{
'label': i18n("Reaumur"),
'name': "Reaumur"
},
{
'label': i18n("cm^-1"),
'name': "cm^-1"
},
{
'label': i18n("kJ/mol"),
'name': "kJ/mol"
},
{
'label': i18n("kcal/mol"),
'name': "kcal/mol"
}
]
onCurrentIndexChanged: cfg_tempUnits = model[currentIndex]["name"]
Component.onCompleted: {
if (debug) console.debug()
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.tempUnits) {
if (debug) console.info("Found", model[i]["name"], "on", i)
tempUnits.currentIndex = i
}
}
ComboBoxSelector {
id: tempUnits
model: [
{
'label': i18n("Celsius"),
'name': "Celsius"
},
{
'label': i18n("Fahrenheit"),
'name': "Fahrenheit"
},
{
'label': i18n("Kelvin"),
'name': "Kelvin"
},
{
'label': i18n("Reaumur"),
'name': "Reaumur"
},
{
'label': i18n("cm^-1"),
'name': "cm^-1"
},
{
'label': i18n("kJ/mol"),
'name': "kJ/mol"
},
{
'label': i18n("kcal/mol"),
'name': "kcal/mol"
}
}
]
text: i18n("Temperature units")
value: plasmoid.configuration.tempUnits
onValueEdited: cfg_tempUnits = newValue
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Custom time format")
}
QtControls.TextField {
id: customTime
width: parent.width * 3 / 5
text: plasmoid.configuration.customTime
}
LineSelector {
id: customTime
text: i18n("Custom time format")
value: plasmoid.configuration.customTime
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Custom uptime format")
}
QtControls.TextField {
id: customUptime
width: parent.width * 3 / 5
text: plasmoid.configuration.customUptime
}
LineSelector {
id: customUptime
text: i18n("Custom uptime format")
value: plasmoid.configuration.customUptime
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("AC online tag")
}
QtControls.TextField {
id: acOnline
width: parent.width * 3 / 5
text: plasmoid.configuration.acOnline
}
LineSelector {
id: acOnline
text: i18n("AC online tag")
value: plasmoid.configuration.acOnline
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("AC offline tag")
}
QtControls.TextField {
id: acOffline
width: parent.width * 3 / 5
text: plasmoid.configuration.acOffline
}
LineSelector {
id: acOffline
text: i18n("AC offline tag")
value: plasmoid.configuration.acOffline
}
Row {

View File

@ -46,11 +46,11 @@ Item {
property alias cfg_fontFamily: selectFont.text
property alias cfg_fontSize: fontSize.value
property string cfg_fontWeight: fontWeight.currentText
property string cfg_fontStyle: fontStyle.currentText
property string cfg_fontWeight: fontWeight.value
property string cfg_fontStyle: fontStyle.value
property alias cfg_fontColor: selectColor.text
property alias cfg_textStyleColor: selectStyleColor.text
property string cfg_textStyle: textStyle.currentText
property string cfg_textStyle: textStyle.value
Column {
@ -78,110 +78,59 @@ Item {
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font size")
}
QtControls.SpinBox {
id: fontSize
width: parent.width * 2 / 3
minimumValue: 8
maximumValue: 32
stepSize: 1
value: plasmoid.configuration.fontSize
}
IntegerSelector {
id: fontSize
maximumValue: 32
minimumValue: 8
stepSize: 1
text: i18n("Font size")
value: plasmoid.configuration.fontSize
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font weight")
}
QtControls.ComboBox {
id: fontWeight
width: parent.width * 2 / 3
textRole: "label"
model: [
{
'label': i18n("light"),
'name': "light"
},
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("demi bold"),
'name': "demibold"
},
{
'label': i18n("bold"),
'name': "bold"
},
{
'label': i18n("black"),
'name': "black"
}
]
onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
Component.onCompleted: {
if (debug) console.debug()
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.fontWeight) {
if (debug) console.info("Found", model[i]["name"], "on", i)
fontWeight.currentIndex = i
}
}
ComboBoxSelector {
id: fontWeight
model: [
{
'label': i18n("light"),
'name': "light"
},
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("demi bold"),
'name': "demibold"
},
{
'label': i18n("bold"),
'name': "bold"
},
{
'label': i18n("black"),
'name': "black"
}
}
]
text: i18n("Font weight")
value: plasmoid.configuration.fontWeight
onValueEdited: cfg_fontWeight = newValue
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font style")
}
QtControls.ComboBox {
id: fontStyle
width: parent.width * 2 / 3
textRole: "label"
model: [
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("italic"),
'name': "italic"
}
]
onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
Component.onCompleted: {
if (debug) console.debug()
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.fontStyle) {
if (debug) console.info("Found", model[i]["name"], "on", i)
fontStyle.currentIndex = i
}
}
ComboBoxSelector {
id: fontStyle
model: [
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("italic"),
'name': "italic"
}
}
]
text: i18n("Font style")
value: plasmoid.configuration.fontStyle
onValueEdited: cfg_fontStyle = newValue
}
Row {
@ -207,49 +156,29 @@ Item {
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Style")
}
QtControls.ComboBox {
id: textStyle
width: parent.width * 2 / 3
textRole: "label"
model: [
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("outline"),
'name': "outline"
},
{
'label': i18n("raised"),
'name': "raised"
},
{
'label': i18n("sunken"),
'name': "sunken"
}
]
onCurrentIndexChanged: cfg_textStyle = model[currentIndex]["name"]
Component.onCompleted: {
if (debug) console.debug()
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.textStyle) {
if (debug) console.info("Found", model[i]["name"], "on", i)
textStyle.currentIndex = i
}
}
ComboBoxSelector {
id: textStyle
model: [
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("outline"),
'name': "outline"
},
{
'label': i18n("raised"),
'name': "raised"
},
{
'label': i18n("sunken"),
'name': "sunken"
}
}
]
text: i18n("Style")
value: plasmoid.configuration.textStyle
onValueEdited: cfg_textStyle = newValue
}
Row {

View File

@ -52,21 +52,10 @@ Item {
height: implicitHeight
width: parent.width
title: i18n("ACPI")
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("ACPI path")
}
QtControls.TextField {
width: parent.width * 3 / 5
text: cfg_dataengine["ACPIPATH"]
onEditingFinished: cfg_dataengine["ACPIPATH"] = text
}
LineSelector {
text: i18n("ACPI path")
value: cfg_dataengine["ACPIPATH"]
onValueEdited: cfg_dataengine["ACPIPATH"] = newValue
}
}
@ -74,30 +63,28 @@ Item {
height: implicitHeight
width: parent.width
title: i18n("GPU")
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("GPU device")
}
QtControls.ComboBox {
id: gpuDev
width: parent.width * 3 / 5
model: ["auto", "disable", "ati", "nvidia"]
Component.onCompleted: {
if (debug) console.debug()
for (var i=0; i<model.length; i++) {
if (model[i] == cfg_dataengine["GPUDEV"]) {
if (debug) console.info("Found", model[i], "on", i)
currentIndex = i
}
}
ComboBoxSelector {
model: [
{
'label': "auto",
'name': "auto"
},
{
'label': "disable",
'name': "disable"
},
{
'label': "ati",
'name': "ati"
},
{
'label': "nvidia",
'name': "nvidia"
}
}
]
text: i18n("GPU device")
value: cfg_dataengine["GPUDEV"]
onValueEdited: cfg_dataengine["GPUDEV"] = newValue
}
}
@ -108,37 +95,17 @@ Item {
Column {
height: implicitHeight
width: parent.width
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("HDD")
}
QtControls.ComboBox {
id: hdd
width: parent.width * 3 / 5
}
ComboBoxSelector {
id: hdd
text: i18n("HDD")
value: cfg_dataengine["HDDDEV"]
onValueEdited: cfg_dataengine["HDDDEV"] = newValue
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("hddtemp cmd")
}
QtControls.TextField {
width: parent.width * 3 / 5
text: cfg_dataengine["HDDTEMPCMD"]
onEditingFinished: cfg_dataengine["HDDTEMPCMD"] = text
}
LineSelector {
text: i18n("hddtemp cmd")
value: cfg_dataengine["HDDTEMPCMD"]
onValueEdited: cfg_dataengine["HDDTEMPCMD"] = newValue
}
}
}
@ -150,107 +117,93 @@ Item {
Column {
height: implicitHeight
width: parent.width
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Player data symbols")
}
QtControls.SpinBox {
width: parent.width * 3 / 5
minimumValue: 1
maximumValue: 100
stepSize: 1
value: cfg_dataengine["PLAYERSYMBOLS"]
onEditingFinished: cfg_dataengine["PLAYERSYMBOLS"] = value
}
IntegerSelector {
maximumValue: 100
minimumValue: 1
stepSize: 1
text: i18n("Player data symbols")
value: cfg_dataengine["PLAYERSYMBOLS"]
onValueEdited: cfg_dataengine["PLAYERSYMBOLS"] = newValue
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Music player")
}
QtControls.ComboBox {
id: player
width: parent.width * 3 / 5
model: ["disable", "mpris", "mpd"]
Component.onCompleted: {
if (debug) console.debug()
for (var i=0; i<model.length; i++) {
if (model[i] == cfg_dataengine["PLAYER"]) {
if (debug) console.info("Found", model[i], "on", i)
player.currentIndex = i
}
}
ComboBoxSelector {
model: [
{
'label': "disable",
'name': "disable"
},
{
'label': "mpris",
'name': "mpris"
},
{
'label': "mpd",
'name': "mpd"
}
}
]
text: i18n("Music player")
value: cfg_dataengine["PLAYER"]
onValueEdited: cfg_dataengine["PLAYER"] = newValue
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("MPRIS player name")
}
QtControls.ComboBox {
id: mpris
width: parent.width * 3 / 5
editable: true
model: ["auto", "amarok", "audacious", "clementine", "deadbeef",
"vlc", "qmmp", "xmms2", cfg_dataengine["MPRIS"]]
currentIndex: model.length - 1
}
ComboBoxSelector {
id: mpris
editable: true
model: [
{
'label': 'auto',
'name': 'auto'
},
{
'label': 'amarok',
'name': 'amarok'
},
{
'label': 'audacious',
'name': 'audacious'
},
{
'label': 'clementine',
'name': 'clementine'
},
{
'label': 'deadbeef',
'name': 'deadbeef'
},
{
'label': 'vlc',
'name': 'vlc'
},
{
'label': 'qmmp',
'name': 'qmmp'
},
{
'label': 'xmms2',
'name': 'xmms2'
},
{
'label': cfg_dataengine["MPRIS"],
'name': cfg_dataengine["MPRIS"]
}
]
text: i18n("MPRIS player name")
currentIndex: model.length - 1
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("MPD address")
}
QtControls.TextField {
width: parent.width * 3 / 5
text: cfg_dataengine["MPDADDRESS"]
onEditingFinished: cfg_dataengine["MPDADDRESS"] = text
}
LineSelector {
text: i18n("MPD address")
value: cfg_dataengine["MPDADDRESS"]
onValueEdited: cfg_dataengine["MPDADDRESS"] = newValue
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("MPD port")
}
QtControls.SpinBox {
width: parent.width * 3 / 5
minimumValue: 1000
maximumValue: 65535
stepSize: 1
value: cfg_dataengine["MPDPORT"]
onEditingFinished: cfg_dataengine["MPDPORT"] = value
}
IntegerSelector {
maximumValue: 65535
minimumValue: 1000
stepSize: 1
text: i18n("MPD port")
value: cfg_dataengine["MPDPORT"]
onValueEdited: cfg_dataengine["MPDPORT"] = newValue
}
}
}
@ -342,21 +295,13 @@ Item {
// update hdd model
hdd.model = awKeys.getHddDevices()
for (var i=0; i<hdd.model.length; i++) {
if (hdd.model[i] == cfg_dataengine["HDDDEV"]) {
if (debug) console.info("Found", hdd.model[i], "on", i)
hdd.currentIndex = i
}
}
hdd.onCompleted
}
Component.onDestruction: {
if (debug) console.debug()
cfg_dataengine["GPUDEV"] = gpuDev.currentText
cfg_dataengine["HDDDEV"] = hdd.currentText
cfg_dataengine["PLAYER"] = player.currentText
cfg_dataengine["MPRIS"] = mpris.currentText
cfg_dataengine["MPRIS"] = mpris.editText
awConfig.writeDataEngineConfiguration(cfg_dataengine)
}
}

View File

@ -1,3 +1,6 @@
singleton general 1.0 general.qml
BugReport ./BugReport.qml
CheckBoxSelector ./CheckBoxSelector.qml
ComboBoxSelector ./ComboBoxSelector.qml
IntegerSelector ./IntegerSelector.qml
LineSelector ./LineSelector.qml

View File

@ -67,24 +67,13 @@ Item {
text: i18n("CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make needed checkbox checked.")
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Number of values for tooltips")
}
QtControls.SpinBox {
id: tooltipNumber
width: parent.width * 3 / 5
minimumValue: 50
maximumValue: 1000
stepSize: 25
value: plasmoid.configuration.tooltipNumber
}
IntegerSelector {
id: tooltipNumber
maximumValue: 1000
minimumValue: 50
stepSize: 25
text: i18n("Number of values for tooltips")
value: plasmoid.configuration.tooltipNumber
}
QtControls.GroupBox {

View File

@ -153,12 +153,21 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
}
QStringList AWKeys::getHddDevices() const
QVariantList AWKeys::getHddDevices() const
{
QStringList devices = m_keyOperator->devices(QString("hdd"));
QStringList hddDevices = m_keyOperator->devices(QString("hdd"));
// required by selector in the UI
devices.insert(0, QString("disable"));
devices.insert(0, QString("auto"));
hddDevices.insert(0, QString("disable"));
hddDevices.insert(0, QString("auto"));
// build model
QVariantList devices;
for (auto device : hddDevices) {
QVariantMap model;
model[QString("label")] = device;
model[QString("name")] = device;
devices.append(model);
}
return devices;
}

View File

@ -51,7 +51,7 @@ public:
// keys
Q_INVOKABLE QStringList dictKeys(const bool sorted = false,
const QString regexp = QString()) const;
Q_INVOKABLE QStringList getHddDevices() const;
Q_INVOKABLE QVariantList getHddDevices() const;
// values
Q_INVOKABLE QString infoByKey(QString key) const;
Q_INVOKABLE QString valueByKey(QString key) const;

View File

@ -72,7 +72,7 @@ void TestAWKeys::cleanupTestCase()
void TestAWKeys::test_hddDevices()
{
QVERIFY(!plugin->getHddDevices().isEmpty());
QVERIFY(plugin->getHddDevices().count() > 2);
}