Changeset View
Changeset View
Standalone View
Standalone View
kcms/nightcolor/package/contents/ui/LocationsFixedView.qml
Show All 9 Lines | |||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
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, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | *********************************************************************/ | 16 | *********************************************************************/ | ||
17 | import QtQuick 2.1 | 17 | import QtQuick 2.1 | ||
18 | import QtQuick.Layouts 1.1 | 18 | import org.kde.kirigami 2.5 as Kirigami | ||
19 | import QtQuick.Controls 1.4 as Controls | 19 | import QtQuick.Controls 2.5 as QQC2 | ||
20 | 20 | | |||
21 | GridLayout { | 21 | Kirigami.FormLayout { | ||
22 | columns: 2 | 22 | twinFormLayouts: parentLayout | ||
23 | rowSpacing: units.smallSpacing | | |||
24 | columnSpacing: units.smallSpacing | | |||
25 | enabled: activator.checked | 23 | enabled: activator.checked | ||
26 | 24 | | |||
27 | Connections { | 25 | Connections { | ||
28 | target: root | 26 | target: root | ||
29 | onReset: reset() | 27 | onReset: reset() | ||
30 | } | 28 | } | ||
31 | 29 | | |||
32 | function reset() { | 30 | function reset() { | ||
33 | latitudeFixedField.backend = cA.latitudeFixed; | 31 | latitudeFixedField.backend = cA.latitudeFixed; | ||
34 | longitudeFixedField.backend = cA.longitudeFixed; | 32 | longitudeFixedField.backend = cA.longitudeFixed; | ||
35 | } | 33 | } | ||
36 | 34 | | |||
37 | Controls.Label { | | |||
38 | text: i18n("Latitude") | | |||
39 | Layout.alignment: Qt.AlignRight | | |||
40 | } | | |||
41 | NumberField { | 35 | NumberField { | ||
42 | id: latitudeFixedField | 36 | id: latitudeFixedField | ||
37 | Kirigami.FormData.label: i18n("Latitude:") | ||||
43 | backend: cA.latitudeFixedStaged | 38 | backend: cA.latitudeFixedStaged | ||
44 | validator: DoubleValidator {bottom: -90; top: 90; decimals: 10} | 39 | validator: DoubleValidator {bottom: -90; top: 90; decimals: 10} | ||
45 | onBackendChanged: { | 40 | onBackendChanged: { | ||
46 | cA.latitudeFixedStaged = backend; | 41 | cA.latitudeFixedStaged = backend; | ||
47 | manualLocationsViewRow.change(); | 42 | manualLocationsViewItem.change(); | ||
48 | calcNeedsSave(); | 43 | calcNeedsSave(); | ||
49 | } | 44 | } | ||
50 | } | 45 | } | ||
51 | 46 | | |||
52 | Controls.Label { | | |||
53 | text: i18n("Longitude") | | |||
54 | Layout.alignment: Qt.AlignRight | | |||
55 | } | | |||
56 | NumberField { | 47 | NumberField { | ||
57 | id: longitudeFixedField | 48 | id: longitudeFixedField | ||
49 | Kirigami.FormData.label: i18n("Longitude:") | ||||
58 | backend: cA.longitudeFixedStaged | 50 | backend: cA.longitudeFixedStaged | ||
59 | validator: DoubleValidator {bottom: -180; top: 180; decimals: 10} | 51 | validator: DoubleValidator {bottom: -180; top: 180; decimals: 10} | ||
60 | onBackendChanged: { | 52 | onBackendChanged: { | ||
61 | cA.longitudeFixedStaged = backend; | 53 | cA.longitudeFixedStaged = backend; | ||
62 | manualLocationsViewRow.change(); | 54 | manualLocationsViewItem.change(); | ||
63 | calcNeedsSave(); | 55 | calcNeedsSave(); | ||
64 | } | 56 | } | ||
65 | } | 57 | } | ||
66 | Controls.Button { | 58 | | ||
67 | Layout.columnSpan: 2 | 59 | QQC2.Button { | ||
68 | Layout.alignment: Qt.AlignHCenter | | |||
69 | text: i18n("Detect location") | 60 | text: i18n("Detect location") | ||
61 | implicitWidth: longitudeFixedField.width // TODO: see if there is a smarter way for doing this | ||||
70 | onClicked: { | 62 | onClicked: { | ||
71 | latitudeFixedField.backend = locator.latitude; | 63 | latitudeFixedField.backend = locator.latitude; | ||
72 | longitudeFixedField.backend = locator.longitude; | 64 | longitudeFixedField.backend = locator.longitude; | ||
73 | } | 65 | } | ||
74 | } | 66 | } | ||
75 | } | 67 | } |