Changeset View
Changeset View
Standalone View
Standalone View
kcms/nightcolor/package/contents/ui/LocationsFixedView.qml
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2017 Roman Gilg <subdiff@gmail.com> | ||||
3 | | ||||
4 | This program is free software; you can redistribute it and/or modify | ||||
5 | it under the terms of the GNU General Public License as published by | ||||
6 | the Free Software Foundation; either version 2 of the License, or | ||||
7 | (at your option) any later version. | ||||
8 | | ||||
9 | This program is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | GNU General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU General Public License | ||||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
16 | *********************************************************************/ | ||||
17 | import QtQuick 2.1 | ||||
18 | import QtQuick.Layouts 1.1 | ||||
19 | import QtQuick.Controls 1.4 as Controls | ||||
20 | | ||||
21 | GridLayout { | ||||
22 | columns: 2 | ||||
23 | rowSpacing: units.smallSpacing | ||||
24 | columnSpacing: units.smallSpacing | ||||
25 | enabled: activator.checked | ||||
26 | | ||||
27 | Connections { | ||||
28 | target: root | ||||
29 | onReset: reset() | ||||
30 | } | ||||
31 | | ||||
32 | function reset() { | ||||
33 | latitudeFixedField.backend = cA.latitudeFixed; | ||||
34 | longitudeFixedField.backend = cA.longitudeFixed; | ||||
35 | } | ||||
36 | | ||||
37 | Controls.Label { | ||||
38 | text: i18n("Latitude") | ||||
39 | Layout.alignment: Qt.AlignRight | ||||
40 | } | ||||
41 | NumberField { | ||||
42 | id: latitudeFixedField | ||||
43 | backend: cA.latitudeFixedStaged | ||||
44 | validator: DoubleValidator {bottom: -90; top: 90; decimals: 10} | ||||
45 | onBackendChanged: { | ||||
46 | cA.latitudeFixedStaged = backend; | ||||
47 | manualLocationsViewRow.change(); | ||||
48 | calcNeedsSave(); | ||||
49 | } | ||||
50 | } | ||||
51 | | ||||
52 | Controls.Label { | ||||
53 | text: i18n("Longitude") | ||||
54 | Layout.alignment: Qt.AlignRight | ||||
55 | } | ||||
56 | NumberField { | ||||
57 | id: longitudeFixedField | ||||
58 | backend: cA.longitudeFixedStaged | ||||
59 | validator: DoubleValidator {bottom: -180; top: 180; decimals: 10} | ||||
60 | onBackendChanged: { | ||||
61 | cA.longitudeFixedStaged = backend; | ||||
62 | manualLocationsViewRow.change(); | ||||
63 | calcNeedsSave(); | ||||
64 | } | ||||
65 | } | ||||
66 | Controls.Button { | ||||
67 | Layout.columnSpan: 2 | ||||
68 | Layout.alignment: Qt.AlignHCenter | ||||
69 | text: i18n("Detect location") | ||||
70 | onClicked: { | ||||
71 | latitudeFixedField.backend = locator.latitude; | ||||
72 | longitudeFixedField.backend = locator.longitude; | ||||
73 | } | ||||
74 | } | ||||
75 | } |