Changeset View
Changeset View
Standalone View
Standalone View
applets/systemmonitor/common/contents/ui/ConfigGeneral.qml
Show All 11 Lines | |||||
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 Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.5 | 19 | import QtQuick 2.5 | ||
20 | import QtQuick.Controls 1.4 as QQC1 | 20 | import QtQuick.Controls 2.5 | ||
ngraham: `import QtQuick.Controls 2.5 as QQC2` | |||||
21 | import QtQuick.Controls 2.5 as QQC2 | | |||
22 | import QtQuick.Layouts 1.3 | 21 | import QtQuick.Layouts 1.3 | ||
23 | 22 | | |||
24 | import org.kde.kirigami 2.5 as Kirigami | 23 | import org.kde.kirigami 2.5 as Kirigami | ||
25 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
26 | 25 | | |||
27 | 26 | | |||
28 | Item { | 27 | Item { | ||
29 | id: iconsPage | 28 | id: iconsPage | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | |||||
114 | } | 113 | } | ||
115 | 114 | | |||
116 | Kirigami.FormLayout { | 115 | Kirigami.FormLayout { | ||
117 | id: formLayout | 116 | id: formLayout | ||
118 | 117 | | |||
119 | anchors.left: parent.left | 118 | anchors.left: parent.left | ||
120 | anchors.right: parent.right | 119 | anchors.right: parent.right | ||
121 | 120 | | |||
122 | // QQC2 SpinBox doesn't cleanly support non-integer values, which can be | 121 | SpinBox { | ||
123 | // worked around, but the code is messy and the user experience is | | |||
124 | // somewhat poor. So for now, we stick with the QQC1 SpinBox | | |||
125 | QQC1.SpinBox { | | |||
126 | id: updateIntervalSpinBox | 122 | id: updateIntervalSpinBox | ||
127 | | ||||
128 | Kirigami.FormData.label: i18n("Update interval:") | 123 | Kirigami.FormData.label: i18n("Update interval:") | ||
129 | decimals: 1 | 124 | from: 100 | ||
130 | suffix: i18ncp("Suffix for spinbox (seconds)", " second", | 125 | stepSize: 100 | ||
131 | " seconds") | 126 | to: 1000000 | ||
ngraham: Add `editable: true` and an appropriate `valueFromText` converter | |||||
132 | maximumValue: 1000 | 127 | textFromValue: function(value) { | ||
133 | stepSize: 0.1 | 128 | var seconds = value / 1000 | ||
134 | onValueChanged: cfg_updateInterval = value * 1000 | 129 | return i18n("%1 seconds", seconds.toFixed(1)) | ||
135 | Component.onCompleted: value = cfg_updateInterval / 1000 | 130 | } | ||
131 | value: cfg_updateInterval | ||||
132 | onValueModified: cfg_updateInterval = value | ||||
136 | } | 133 | } | ||
137 | | ||||
138 | 134 | | |||
Please keep this the same as before i18ncp("Suffix for spinbox (seconds)", "second", "%1 secconds", seconds.toFixed(1)); davidedmundson: Please keep this the same as before
i18ncp("Suffix for spinbox (seconds)", "second", "%1… | |||||
139 | Item { | 135 | Item { | ||
140 | Kirigami.FormData.isSection: true | 136 | Kirigami.FormData.isSection: true | ||
141 | } | 137 | } | ||
142 | 138 | | |||
143 | 139 | | |||
144 | ColumnLayout { | 140 | ColumnLayout { | ||
145 | id: dataSourcesColumn | 141 | id: dataSourcesColumn | ||
146 | Kirigami.FormData.label: i18n("Show:") | 142 | Kirigami.FormData.label: i18n("Show:") | ||
147 | Kirigami.FormData.buddyFor: children[1] // 0 is the Repeater | 143 | Kirigami.FormData.buddyFor: children[1] // 0 is the Repeater | ||
148 | 144 | | |||
149 | Repeater { | 145 | Repeater { | ||
150 | id: repeater | 146 | id: repeater | ||
151 | model: sourcesModel | 147 | model: sourcesModel | ||
152 | QQC2.CheckBox { | 148 | CheckBox { | ||
153 | id: checkBox | 149 | id: checkBox | ||
154 | text: model.friendlyName | 150 | text: model.friendlyName | ||
155 | property string source: model.source | 151 | property string source: model.source | ||
156 | onCheckedChanged: { | 152 | onCheckedChanged: { | ||
157 | if (checked) { | 153 | if (checked) { | ||
158 | if (cfg_sources.indexOf(model.source) == -1) { | 154 | if (cfg_sources.indexOf(model.source) == -1) { | ||
159 | cfg_sources.push(model.source); | 155 | cfg_sources.push(model.source); | ||
160 | } | 156 | } | ||
Show All 13 Lines |
import QtQuick.Controls 2.5 as QQC2