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 | | |||
21 | import QtQuick.Controls 2.5 as QQC2 | 20 | import QtQuick.Controls 2.5 as QQC2 | ||
ngraham: `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 | QQC2.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 | editable: true | ||
133 | stepSize: 0.1 | 128 | validator: DoubleValidator { | ||
134 | onValueChanged: cfg_updateInterval = value * 1000 | 129 | bottom: spinbox.from | ||
135 | Component.onCompleted: value = cfg_updateInterval / 1000 | 130 | top: spinbox.to | ||
131 | } | ||||
132 | textFromValue: function(value) { | ||||
133 | var seconds = value / 1000 | ||||
134 | return i18n("%1 seconds", seconds.toFixed(1)) | ||||
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… | |||||
135 | } | ||||
136 | valueFromText: function(text) { | ||||
137 | return parseFloat(text) * 1000 | ||||
138 | } | ||||
139 | value: cfg_updateInterval | ||||
140 | onValueModified: cfg_updateInterval = value | ||||
136 | } | 141 | } | ||
137 | | ||||
138 | 142 | | |||
139 | Item { | 143 | Item { | ||
140 | Kirigami.FormData.isSection: true | 144 | Kirigami.FormData.isSection: true | ||
141 | } | 145 | } | ||
142 | 146 | | |||
143 | 147 | | |||
144 | ColumnLayout { | 148 | ColumnLayout { | ||
145 | id: dataSourcesColumn | 149 | id: dataSourcesColumn | ||
Show All 28 Lines |
import QtQuick.Controls 2.5 as QQC2