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

View File

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

View File

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

View File

@ -1,3 +1,6 @@
singleton general 1.0 general.qml singleton general 1.0 general.qml
BugReport ./BugReport.qml BugReport ./BugReport.qml
CheckBoxSelector ./CheckBoxSelector.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.") text: i18n("CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make needed checkbox checked.")
} }
Row { IntegerSelector {
height: implicitHeight id: tooltipNumber
width: parent.width maximumValue: 1000
QtControls.Label { minimumValue: 50
height: parent.height stepSize: 25
width: parent.width * 2 / 5 text: i18n("Number of values for tooltips")
horizontalAlignment: Text.AlignRight value: plasmoid.configuration.tooltipNumber
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
}
} }
QtControls.GroupBox { 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 // required by selector in the UI
devices.insert(0, QString("disable")); hddDevices.insert(0, QString("disable"));
devices.insert(0, QString("auto")); 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; return devices;
} }

View File

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

View File

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