Warning, /education/kstars/kstars/kstarslite/qml/dialogs/LocationDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.6
0005 import QtQuick.Window 2.2
0006 import QtQuick.Layouts 1.1
0007 import QtQuick.Controls 2.0
0008 import QtQuick.Controls.Material 2.0
0009 import QtQuick.Controls.Universal 2.0
0010 import "../constants" 1.0
0011 import "../modules"
0012 
0013 KSPage {
0014     title: xi18n("Set Geolocation")
0015 
0016     function filterCities() {
0017         LocationDialogLite.filterCity(cityFilter.text, provinceFilter.text, countryFilter.text)
0018     }
0019 
0020     onVisibleChanged: {
0021         filterCities()
0022     }
0023 
0024     ColumnLayout {
0025         id: locationColumn
0026         spacing: 5 * Num.dp
0027         anchors{
0028             fill: parent
0029             bottomMargin: 15 * Num.dp
0030         }
0031 
0032         Flow {
0033             anchors {
0034                 left: parent.left
0035                 right: parent.right
0036             }
0037 
0038             KSLabel {
0039                 text: xi18n("Current Location: ")
0040             }
0041 
0042             KSLabel {
0043                 text: LocationDialogLite.currentLocation
0044             }
0045         }
0046 
0047         Rectangle {
0048             Layout.fillWidth: true
0049             height: 1
0050             color: "grey"
0051         }
0052 
0053         GridLayout {
0054             Layout.fillWidth: true
0055             Layout.fillHeight: true
0056 
0057             flow: window.isPortrait ? GridLayout.TopToBottom : GridLayout.LeftToRight
0058 
0059             RowLayout {
0060                 Layout.fillWidth: true
0061                 Layout.fillHeight: true
0062                 KSLabel {
0063                     text: xi18n("City filter: ")
0064                 }
0065                 KSTextField {
0066                     id: cityFilter
0067                     Layout.fillWidth: true
0068                     onTextChanged: {
0069                         filterCities()
0070                     }
0071                 }
0072             }
0073 
0074             RowLayout {
0075                 Layout.fillWidth: true
0076                 Layout.fillHeight: true
0077                 KSLabel {
0078                     text: xi18n("Province filter: ")
0079                 }
0080 
0081                 KSTextField {
0082                     id: provinceFilter
0083                     Layout.fillWidth: true
0084                     onTextChanged: {
0085                         filterCities()
0086                     }
0087                 }
0088             }
0089 
0090             RowLayout {
0091                 Layout.fillWidth: true
0092                 Layout.fillHeight: true
0093                 KSLabel {
0094                     text: xi18n("Country filter: ")
0095                 }
0096                 KSTextField {
0097                     id: countryFilter
0098                     Layout.fillWidth: true
0099                     onTextChanged: {
0100                         filterCities()
0101                     }
0102                 }
0103             }
0104         }
0105 
0106         KSListView {
0107             model: CitiesModel
0108             textRole: "display"
0109 
0110             Layout.fillWidth: true
0111             Layout.fillHeight: true
0112 
0113             checkCurrent: true
0114             currentIndex: LocationDialogLite.currLocIndex
0115             onClickCheck: false
0116 
0117             onClicked: {
0118                 locationsGeoMenu.openMenu(text)
0119             }
0120         }
0121 
0122         Button {
0123             anchors {
0124                 bottom: parent.bottom
0125             }
0126 
0127             text: xi18n("Add Location")
0128             onClicked: {
0129                 locationEdit.openAdd()
0130             }
0131         }
0132 
0133         Button {
0134             anchors {
0135                 bottom: parent.bottom
0136                 right: parent.right
0137             }
0138 
0139             text: xi18n("Set from GPS")
0140             onClicked: {
0141                 locationEdit.setAutomaticallyFromGPS()
0142             }
0143         }
0144     }
0145 }