diff --git a/kstars/kstarslite/qml/constants/qmldir b/kstars/kstarslite/qml/constants/qmldir index f430ddb9e..36670f4b0 100644 --- a/kstars/kstarslite/qml/constants/qmldir +++ b/kstars/kstarslite/qml/constants/qmldir @@ -1 +1 @@ -singleton num 1.0 Constants.qml +singleton Num 1.0 Constants.qml diff --git a/kstars/kstarslite/qml/dialogs/DetailsDialog.qml b/kstars/kstarslite/qml/dialogs/DetailsDialog.qml index 3d61575af..729035fdc 100644 --- a/kstars/kstarslite/qml/dialogs/DetailsDialog.qml +++ b/kstars/kstarslite/qml/dialogs/DetailsDialog.qml @@ -1,503 +1,503 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 import "helpers" import "menus" import "../modules" import "../constants" 1.0 KSPage { title: SkyMapLite.clickedObjectLite.translatedName + " - " + tabBar.currentItem.text Item { anchors.fill: parent TabBar { id: tabBar property bool isTab: true spacing: 20 currentIndex: detailsSwipeView.currentIndex anchors { top: parent.top left: parent.left right: parent.right } background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } KSTabButton { text: xi18n("General") } KSTabButton { text: xi18n("Position") } KSTabButton { Component.onCompleted: { var oldParent = parent parent = Qt.binding(function() { return DetailDialogLite.isLinksOn ? oldParent : null }) } text: xi18n("Links") } KSTabButton { Component.onCompleted: { var oldParent = parent parent = Qt.binding(function() { return DetailDialogLite.isLogOn ? oldParent : null }) } text: xi18n("Log") } } SwipeView { id: detailsSwipeView anchors { top:tabBar.bottom topMargin: 10 left: parent.left right: parent.right bottom: parent.bottom } currentIndex: tabBar.currentIndex clip: true Pane { clip: true background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } Flickable { anchors.fill: parent ScrollBar.vertical: ScrollBar { } flickableDirection: Flickable.VerticalFlick contentHeight: generalCol.height Column { id: generalCol width: parent.width spacing: 15 KSText { text: DetailDialogLite.name font.pointSize: 16 width: parent.width wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter } Image { source: DetailDialogLite.thumbnail anchors.horizontalCenter: parent.horizontalCenter } KSText { text: DetailDialogLite.typeInConstellation anchors.horizontalCenter: parent.horizontalCenter font.pointSize: 12 } Column { id: telescopesCol width: parent.width property var telescopeControls: [] Connections { target: ClientManagerLite onTelescopeAdded: { var controls = Qt.createComponent("helpers/TelescopeControl.qml") var controlsObj = controls.createObject(telescopesCol) controlsObj.telescope = newTelescope telescopesCol.telescopeControls.push(controlsObj) } onTelescopeRemoved: { for(var i = 0; i < telescopesCol.telescopeControls.length; ++i) { if(telescopesCol.telescopeControls[i].telescope == delTelescope) { telescopesCol.telescopeControls[i].parent = null telescopesCol.telescopeControls[i].destroy() } } } } } DetailsItem { label: xi18n("Magnitude") value: DetailDialogLite.magnitude } DetailsItem { label: xi18n("Distance") value: DetailDialogLite.distance } DetailsItem { label: xi18n("B - V Index") value: DetailDialogLite.BVindex } DetailsItem { label: xi18n("Size") value: DetailDialogLite.angSize } DetailsItem { label: xi18n("Illumination") value: DetailDialogLite.illumination } DetailsItem { label: xi18n("Perihelion") value: DetailDialogLite.perihelion } DetailsItem { label: xi18n("OrbitID") value: DetailDialogLite.orbitID } DetailsItem { label: xi18n("NEO") value: DetailDialogLite.NEO } DetailsItem { label: xi18n("Diameter") value: DetailDialogLite.diameter } DetailsItem { label: xi18n("Rotation period") value: DetailDialogLite.rotation } DetailsItem { label: xi18n("EarthMOID") value: DetailDialogLite.earthMOID } DetailsItem { label: xi18n("OrbitClass") value: DetailDialogLite.orbitClass } DetailsItem { label: xi18n("Albedo") value: DetailDialogLite.albedo } DetailsItem { label: xi18n("Dimensions") value: DetailDialogLite.dimensions } DetailsItem { label: xi18n("Period") value: DetailDialogLite.period } } } } Pane { clip: true background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } Flickable { anchors.fill: parent ScrollBar.vertical: ScrollBar { } flickableDirection: Flickable.VerticalFlick contentHeight: coordinatesCol.height Column { id: coordinatesCol width: parent.width spacing: 15 KSText { text: xi18n("Coordinates") font { pointSize: 16 } anchors.horizontalCenter: parent.horizontalCenter } DetailsItem { label: DetailDialogLite.RALabel value: DetailDialogLite.RA } DetailsItem { label: DetailDialogLite.decLabel value: DetailDialogLite.dec } DetailsItem { label: xi18n("RA (J2000.0)") value: DetailDialogLite.RA0 } DetailsItem { label: xi18n("Dec (J2000.0)") value: DetailDialogLite.dec0 } DetailsItem { label: xi18n("Azimuth") value: DetailDialogLite.az } DetailsItem { label: xi18n("Altitude") value: DetailDialogLite.alt } DetailsItem { label: xi18n("Hour angle") value: DetailDialogLite.HA } DetailsItem { label: xi18n("Airmass") value: DetailDialogLite.airmass } KSText { text: xi18n("Rise/Set/Transit") font { pointSize: 16 } anchors.horizontalCenter: parent.horizontalCenter } DetailsItem { label: xi18n("Rise time") value: DetailDialogLite.timeRise } DetailsItem { label: xi18n("Transit time") value: DetailDialogLite.timeTransit } DetailsItem { label: xi18n("Set time") value: DetailDialogLite.timeSet } DetailsItem { label: xi18n("Azimuth at rise") value: DetailDialogLite.azRise } DetailsItem { label: xi18n("Azimuth at transit") value: DetailDialogLite.altTransit } DetailsItem { label: xi18n("Azimuth at set") value: DetailDialogLite.azSet } } } } Pane { parent: DetailDialogLite.isLinksOn ? detailsSwipeView : null clip: true id: links background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } GridLayout { id: linkCol rowSpacing: 15 anchors { top: parent.top left: parent.left right: parent.right bottom: addInfoLandscape.top } flow: window.isPortrait ? GridLayout.TopToBottom : GridLayout.LeftToRight ColumnLayout { id: infoCol Layout.fillWidth: true Layout.fillHeight: true Layout.minimumWidth: parent.width/2 spacing: 10 KSText { id: infoLabel text: xi18n("Information Links") font.pointSize: 16 anchors.horizontalCenter: parent.horizontalCenter } Rectangle { id: infoSeparator Layout.fillWidth: true height: 1 color: "grey" } KSListView { Layout.fillHeight: true Layout.fillWidth: true model: DetailDialogLite.infoTitleList onClicked: { detailsLinkMenu.openForInfo(index) } } } ColumnLayout { id: imgCol Layout.fillWidth: true Layout.fillHeight: true Layout.minimumWidth: parent.width/2 spacing: 10 KSText { id: imgLabel text: xi18n("Image Links") font.pointSize: 16 anchors.horizontalCenter: parent.horizontalCenter } Rectangle { id: imgSeparator Layout.fillWidth: true height: 1 color: "grey" } KSListView { Layout.fillHeight: true Layout.fillWidth: true model: DetailDialogLite.imageTitleList onClicked: { detailsLinkMenu.openForImage(index) } } } } Button { id: addInfoLandscape text: xi18n("Add Link") anchors.bottom: parent.bottom onClicked: { detailsAddLink.openAdd() } } } Pane { parent: DetailDialogLite.isLogOn ? detailsSwipeView : null clip: true background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } Flickable { anchors.fill: parent ScrollBar.vertical: ScrollBar { } flickableDirection: Flickable.VerticalFlick contentHeight: logCol.height Column { id: logCol width: parent.width spacing: 15 KSText { text: xi18n("Log") font { pointSize: 16 } anchors.horizontalCenter: parent.horizontalCenter } TextArea { id: logArea placeholderText: i18n("Record here observation logs and/or data on %1.", SkyMapLite.clickedObjectLite.getTranslatedName()) padding: 5 width: parent.width wrapMode: TextArea.Wrap text: DetailDialogLite.userLog Connections { target: DetailDialogLite onUserLogChanged: { logArea.text = DetailDialogLite.userLog } } onEditingFinished: { DetailDialogLite.saveLogData(text) } background: Rectangle { implicitWidth: parent.width implicitHeight: 40 border{ - color: num.sysPalette.base + color: Num.sysPalette.base width: 2 } } } } } } } } } diff --git a/kstars/kstarslite/qml/dialogs/FindDialog.qml b/kstars/kstarslite/qml/dialogs/FindDialog.qml index 0bb2d005a..1b08be042 100644 --- a/kstars/kstarslite/qml/dialogs/FindDialog.qml +++ b/kstars/kstarslite/qml/dialogs/FindDialog.qml @@ -1,122 +1,122 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Universal 2.0 import "../constants" 1.0 import "../modules" KSPage { title: xi18n("Find an Object") onVisibleChanged: { if(visible) { typeChoose.currentIndex = 0 searchQuery.text = "" } } ColumnLayout { id: findColumn anchors.fill: parent - spacing: 5 * num.dp + spacing: 5 * Num.dp anchors{ bottom: parent.bottom - bottomMargin: 15 * num.dp + bottomMargin: 15 * Num.dp } RowLayout { anchors { left: parent.left right: parent.right } KSLabel { text: xi18n("Filter by name: ") } KSTextField { id: searchQuery Layout.fillWidth: true onTextChanged: { FindDialogLite.filterList(text) } } } RowLayout { anchors { left: parent.left right: parent.right } KSLabel { text: "Filter by type: " } Item { //Spacer - Layout.minimumWidth: 30 * num.dp + Layout.minimumWidth: 30 * Num.dp Layout.fillWidth: true } ComboBox { id: typeChoose model: FindDialogLite.filterModel Layout.fillWidth: true //Init list with objects when everything is loaded Connections { target: window onLoaded: { if(isLoaded) FindDialogLite.filterByType(typeChoose.currentIndex) } } onCurrentIndexChanged: { if(isLoaded) FindDialogLite.filterByType(currentIndex) } } } KSListView { model: SortModel textRole: "name" Layout.fillWidth: true Layout.fillHeight: true onClicked: { stackView.replace(null, initPage) FindDialogLite.selectObject(index) } } RowLayout { KSButton { id: searchInInternet enabled: searchQuery.text.length > 0 && FindDialogLite.isResolveEnabled text: "Search in internet" onClicked: { FindDialogLite.resolveInInternet(searchQuery.text) } } KSButton { text: "Cancel" onClicked: { stackView.pop() } } } } } diff --git a/kstars/kstarslite/qml/dialogs/LocationDialog.qml b/kstars/kstarslite/qml/dialogs/LocationDialog.qml index 7a4ebc250..da3232787 100644 --- a/kstars/kstarslite/qml/dialogs/LocationDialog.qml +++ b/kstars/kstarslite/qml/dialogs/LocationDialog.qml @@ -1,152 +1,152 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Universal 2.0 import "../constants" 1.0 import "../modules" KSPage { title: xi18n("Set Geolocation") function filterCities() { LocationDialogLite.filterCity(cityFilter.text, provinceFilter.text, countryFilter.text) } onVisibleChanged: { filterCities() } ColumnLayout { id: locationColumn - spacing: 5 * num.dp + spacing: 5 * Num.dp anchors{ fill: parent - bottomMargin: 15 * num.dp + bottomMargin: 15 * Num.dp } Flow { anchors { left: parent.left right: parent.right } KSLabel { text: xi18n("Current Location: ") } KSLabel { text: LocationDialogLite.currentLocation } } Rectangle { Layout.fillWidth: true height: 1 color: "grey" } GridLayout { Layout.fillWidth: true Layout.fillHeight: true flow: window.isPortrait ? GridLayout.TopToBottom : GridLayout.LeftToRight RowLayout { Layout.fillWidth: true Layout.fillHeight: true KSLabel { text: xi18n("City filter: ") } KSTextField { id: cityFilter Layout.fillWidth: true onTextChanged: { filterCities() } } } RowLayout { Layout.fillWidth: true Layout.fillHeight: true KSLabel { text: xi18n("Province filter: ") } KSTextField { id: provinceFilter Layout.fillWidth: true onTextChanged: { filterCities() } } } RowLayout { Layout.fillWidth: true Layout.fillHeight: true KSLabel { text: xi18n("Country filter: ") } KSTextField { id: countryFilter Layout.fillWidth: true onTextChanged: { filterCities() } } } } KSListView { model: CitiesModel textRole: "display" Layout.fillWidth: true Layout.fillHeight: true checkCurrent: true currentIndex: LocationDialogLite.currLocIndex onClickCheck: false onClicked: { locationsGeoMenu.openMenu(text) } } Button { anchors { bottom: parent.bottom } text: "Add Location" onClicked: { locationEdit.openAdd() } } Button { anchors { bottom: parent.bottom right: parent.right } text: "Set from GPS" onClicked: { locationEdit.setAutomaticallyFromGPS() } } } } diff --git a/kstars/kstarslite/qml/dialogs/helpers/LocationLoading.qml b/kstars/kstarslite/qml/dialogs/helpers/LocationLoading.qml index 1dd8f3134..65f15c00b 100644 --- a/kstars/kstarslite/qml/dialogs/helpers/LocationLoading.qml +++ b/kstars/kstarslite/qml/dialogs/helpers/LocationLoading.qml @@ -1,59 +1,59 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.7 import QtQuick.Layouts 1.1 import "../../constants" 1.0 import "../../modules" import QtPositioning 5.2 Popup { x: (window.width - width) / 2 y: window.height / 6 focus: true modal: true background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } ColumnLayout { id: aboutDialog focus: true width: Math.min(window.width, window.height) / 3 * 2 Column { id: loadingColumn width: parent.width BusyIndicator { anchors.horizontalCenter: parent.horizontalCenter } KSLabel { id: fetchText width: parent.width wrapMode: Label.Wrap horizontalAlignment: Label.AlignHCenter text: locationEdit.loadingText } Button { anchors.horizontalCenter: parent.horizontalCenter text: xi18n("Cancel") onClicked: { close() } } } } } diff --git a/kstars/kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml b/kstars/kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml index c6873ae6b..991410667 100644 --- a/kstars/kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml +++ b/kstars/kstarslite/qml/dialogs/menus/DetailsLinkMenu.qml @@ -1,67 +1,67 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.7 import QtQuick.Layouts 1.1 import "../../constants" 1.0 import "../../modules/" import "../../modules/helpers" Menu { modal: true transformOrigin: Menu.Center padding: 5 property int itemIndex: -1 property bool isImage: false background: Rectangle { implicitWidth: 200 - color: num.sysPalette.base + color: Num.sysPalette.base radius: 5 } function openForImage(index) { isImage = true itemIndex = index open(); } function openForInfo(index) { isImage = false itemIndex = index open(); } KSMenuItem { text: xi18n("View resource") onTriggered: { if(isImage) { Qt.openUrlExternally(DetailDialogLite.getImageURL(itemIndex)); } else { Qt.openUrlExternally(DetailDialogLite.getInfoURL(itemIndex)); } } } KSMenuItem { text: xi18n("Edit") onTriggered: { detailsAddLink.openEdit(itemIndex, isImage) } } KSMenuItem { text: xi18n("Delete") onTriggered: { DetailDialogLite.removeLink(itemIndex, isImage) } } } diff --git a/kstars/kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml b/kstars/kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml index c3df2cf88..9647a47a1 100644 --- a/kstars/kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml +++ b/kstars/kstarslite/qml/dialogs/menus/LocationsGeoMenu.qml @@ -1,96 +1,96 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.7 import QtQuick.Layouts 1.1 import "../../constants" 1.0 import "../../modules/" import "../../modules/helpers" Menu { id: locationsMenu modal: true transformOrigin: Menu.Center padding: 0 property string locName property bool isReadOnly background: Rectangle { implicitWidth: 200 - color: num.sysPalette.base + color: Num.sysPalette.base radius: 5 } function openMenu(name) { locName = name isReadOnly = LocationDialogLite.isReadOnly(name) open() } Column { width: parent.width spacing: 10 KSLabel { id: name text: locName wrapMode: Label.WrapAtWordBoundaryOrAnywhere width: parent.width font.pointSize: 12 anchors { left: parent.left leftMargin: 10 } } Rectangle { color: "grey" width: parent.width - 10 height: 1 anchors { horizontalCenter: parent.horizontalCenter } } } KSMenuItem { text: xi18n("Set as my location") onTriggered: { if(LocationDialogLite.setLocation(locName)) { notification.showNotification(xi18n("Set " + locName + " as current location")) } else { notification.showNotification(xi18n("Couldn't set " + locName + " as current location")) } locationDialog.filterCities() } } KSMenuItem { text: isReadOnly ? xi18n("View") : xi18n("Edit") onTriggered: { if(isReadOnly) { locationEdit.openEdit(locName, true) } else { locationEdit.openEdit(locName, false) } } } KSMenuItem { enabled: !isReadOnly text: xi18n("Delete") onTriggered: { LocationDialogLite.deleteCity(locName) notification.showNotification(xi18n("Deleted location " + locName)) locationDialog.filterCities() } } } diff --git a/kstars/kstarslite/qml/indi/DevicePanel.qml b/kstars/kstarslite/qml/indi/DevicePanel.qml index e81ab692f..fcc96c39a 100644 --- a/kstars/kstarslite/qml/indi/DevicePanel.qml +++ b/kstars/kstarslite/qml/indi/DevicePanel.qml @@ -1,185 +1,185 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.8 import QtQuick.Window 2.2 import "../modules" import "../constants" 1.0 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.0 KSPage { id: devicesPage title: devicesPage.deviceName + " - " + tabBar.currentItem.text property string deviceName property ImagePreview imagePreview: null ColumnLayout { anchors.fill: parent Item { anchors { left: parent.left right: parent.right } height: tabBar.height KSTabBarArrow { imgSource: "../images/left-arrow.png" tabBar: tabBar state: { if(!tabBar.contentItem.atXBeginning) { return "Visible" } else { return "Invisible" } } anchors { left: parent.left top: parent.top bottom: parent.bottom } } KSTabBarArrow { imgSource: "../images/right-arrow.png" tabBar: tabBar state: { if(!tabBar.contentItem.atXEnd) { return "Visible" } else { return "Invisible" } } anchors { right: parent.right top: parent.top bottom: parent.bottom } flickSpeed: -1000 } TabBar { id: tabBar Layout.fillHeight: true anchors { left: parent.left right: parent.right } clip: true spacing: 20 Component.onCompleted: { contentItem.flickDeceleration = 1000 } background: Rectangle { - color: num.sysPalette.base + color: Num.sysPalette.base } } } SwipeView { id: deviceSwipeView Layout.fillHeight: true Layout.fillWidth: true currentIndex: tabBar.currentIndex clip: true property var groups: [] property var properties: [] property var tabs: [] onCurrentIndexChanged: { tabBar.currentIndex = currentIndex } Connections { target: ClientManagerLite onNewINDIProperty: { if(devicesPage.deviceName === deviceName) { if(deviceSwipeView.groups.indexOf(groupName) == -1) { deviceSwipeView.groups.push(groupName) var newTabComp = Qt.createComponent("../modules/KSTab.qml"); var newTab = newTabComp.createObject(deviceSwipeView) newTab.title = groupName var columnForTab = Qt.createQmlObject('import QtQuick 2.7 import QtQuick.Layouts 1.3 Column { spacing: 5 }', newTab.contentItem) newTab.rootItem = columnForTab var tabButton = Qt.createQmlObject('import QtQuick 2.7; import QtQuick.Controls 2.0 import "../modules" KSTabButton {}', tabBar); tabButton.text = groupName if(tabBar.count == 1) { //Without notifying about adding first item to tabBar title of devicesPage won't be updated tabBar.currentItemChanged() } deviceSwipeView.tabs.push(newTab) if(groupName == "Motion Control") { var component = Qt.createComponent("modules/MotionControl.qml"); var motionControl = component.createObject(newTab) motionControl.deviceName = deviceName } } if(groupName != "Motion Control") { for(var i = 0; i < deviceSwipeView.tabs.length; ++i) { var tab = deviceSwipeView.tabs[i] if(tab.title === groupName) { var propComp = Qt.createComponent("modules/Property.qml"); var property = propComp.createObject(tab.rootItem) property.propName = propName property.label = label property.deviceName = deviceName property.parentTab = tab if(propName == "CCD_EXPOSURE" && devicesPage.imagePreview == null) { var imgPreviewComp = Qt.createComponent("ImagePreview.qml"); devicesPage.imagePreview = imgPreviewComp.createObject(window) devicesPage.imagePreview.deviceName = devicesPage.deviceName } } } } } } onRemoveINDIProperty: { for(var i = 0; i < deviceSwipeView.tabs.length; ++i) { var tab = deviceSwipeView.tabs[i] if(tab.title === groupName && groupName != "Motion Control") { var contentItem = deviceSwipeView.tabs[i].rootItem for(var c = 0; c < contentItem.children.length; ++c) { if(contentItem.children[c].propName === propName) { contentItem.children[c].destroy() } } if(contentItem.children.length == 0) { var groups = deviceSwipeView.groups groups.splice(groups.indexOf(groupName), 1) tab.destroy() } /*if(propName == "CCD_EXPOSURE" && devicesPage.imagePreview != null) { imgPreview.destroy() }*/ } } } } } } } diff --git a/kstars/kstarslite/qml/indi/INDIControlPanel.qml b/kstars/kstarslite/qml/indi/INDIControlPanel.qml index 6c39fb0aa..496cde370 100644 --- a/kstars/kstarslite/qml/indi/INDIControlPanel.qml +++ b/kstars/kstarslite/qml/indi/INDIControlPanel.qml @@ -1,312 +1,312 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.2 import Qt.labs.settings 1.0 import "../modules" import "../constants" 1.0 KSPage { id: indiPage objectName: "indiControlPanel" title: "INDI Control Panel" property bool connected: ClientManagerLite.connected property alias webMStatusText: webMStatusLabel.text property alias webMStatusTextVisible: webMStatusLabel.visible property alias webMActiveProfileText: webMActiveProfileLabel.text property alias webMActiveProfileLayoutVisible: webMActiveProfileLayout.visible property alias webMBrowserButtonVisible: webMBrowserButton.visible property alias webMProfileListVisible: webMProfileList.visible function connectIndiServer() { indiServerConnectButton.clicked() } Component.onCompleted: { // Debug purposes ClientManagerLite.setHost("localhost", 7624) } onConnectedChanged: { if (!indiPage.connected) { for (var i = 0; i < devicesModel.count; ++i) { devicesModel.get(i).panel.destroy() stackView.pop(indiPage) } devicesModel.clear() notification.showNotification("Disconnected from the server") } } ColumnLayout { anchors.fill: parent id: cPanelColumn - spacing: 5 * num.dp + spacing: 5 * Num.dp ColumnLayout { visible: !indiPage.connected anchors { left: parent.left right: parent.right } KSLabel { text: xi18n("IP Address or Hostname") } RowLayout { anchors { left: parent.left right: parent.right } KSTextField { id: ipHost placeholderText: xi18n("xxx.xxx.xxx.xxx") Layout.alignment: Qt.AlignHCenter Layout.maximumWidth: parent.width*0.8 Layout.fillWidth: true //text: ClientManagerLite.lastUsedServer text: "localhost" Settings { property alias text : ipHost.text } } } KSLabel { text: xi18n("Web Manager Port") } RowLayout { anchors { left: parent.left right: parent.right } KSTextField { id: portWebManager placeholderText: xi18n("xxxx") Layout.alignment: Qt.AlignHCenter Layout.maximumWidth: parent.width*0.2 Layout.fillWidth: true //text: ClientManagerLite.lastUsedWebManagerPort text: "8624" Settings { property alias text : portWebManager.text } } Button { id: webMConnectButton text: xi18n("Get Status") onClicked: { ClientManagerLite.getWebManagerProfiles(ipHost.text, parseInt(portWebManager.text)); Qt.inputMethod.hide() } } } KSLabel { id: webMStatusLabel text: xi18n("Web Manager Status:") visible: false } RowLayout { id: webMActiveProfileLayout visible: false KSLabel { id: webMActiveProfileLabel text: xi18n("Active Profile:") } Button { id: webMStopButton text: xi18n("Stop") onClicked: { ClientManagerLite.stopWebManagerProfile(); } } } ListView { id: webMProfileList model: webMProfileModel highlightFollowsCurrentItem: false width: parent.width height: childrenRect.height visible: false delegate: RowLayout { height: webMConnectButton.height Rectangle { width: webMStatusLabel.width height: webMConnectButton.height KSLabel { text: xi18n("Profile:")+" "+modelData } } Button { height: webMConnectButton.height text: xi18n("Start") onClicked: { ClientManagerLite.startWebManagerProfile(modelData); } } } } // ListView Button { id: webMBrowserButton text: xi18n("Manage Profiles") visible: false onClicked: { Qt.openUrlExternally("http://"+ipHost.text+":"+portWebManager.text) } } KSLabel { text: xi18n("Server Port") } RowLayout { anchors { left: parent.left right: parent.right } KSTextField { id: portHost placeholderText: xi18n("INDI Server Port") Layout.alignment: Qt.AlignHCenter Layout.maximumWidth: parent.width*0.2 Layout.fillWidth: true //text: ClientManagerLite.lastUsedPort text: "7624" Settings { property alias text : portHost.text } } Button { id: indiServerConnectButton text: indiPage.connected ? xi18n("Disconnect") : xi18n("Connect") onClicked: { if (!indiPage.connected) { if(ClientManagerLite.setHost(ipHost.text, parseInt(portHost.text))) { notification.showNotification(xi18n("Successfully connected to the server")) } else { notification.showNotification(xi18n("Couldn't connect to the server")) } } else { ClientManagerLite.disconnectHost() } Qt.inputMethod.hide() } } } } KSLabel { id: connectedTo visible: indiPage.connected text: xi18n("Connected to ") + ClientManagerLite.connectedHost } ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true visible: indiPage.connected Rectangle { Layout.fillWidth: true - height: 1 * num.dp + height: 1 * Num.dp color: "gray" } KSLabel { id: devicesLabel text: xi18n("Available Devices") } ListModel { id: devicesModel } Connections { target: ClientManagerLite onNewINDIDevice: { var component = Qt.createComponent(Qt.resolvedUrl("./DevicePanel.qml")); var devicePanel = component.createObject(window); devicePanel.deviceName = deviceName devicesModel.append({ name: deviceName, panel: devicePanel }) } onRemoveINDIDevice: { for (i = 0; i < devicesModel.count; ++i) { if(devicesModel.get(i).name == deviceName) { devicesModel.panel.destroy() devicesModel.remove(i) } } } onNewINDIMessage: { notification.showNotification(message) } } } KSListView { id: devicesPage Layout.fillHeight: true Layout.fillWidth: true model: devicesModel textRole: "name" onClicked: { stackView.push(devicesModel.get(currentIndex).panel) } } KSButton { id: disconnectINDI visible: indiPage.connected text: xi18n("Disconnect INDI"); onClicked: { ClientManagerLite.disconnectHost(); } } } } diff --git a/kstars/kstarslite/qml/indi/ImagePreview.qml b/kstars/kstarslite/qml/indi/ImagePreview.qml index cc497a9e0..abefdaea8 100644 --- a/kstars/kstarslite/qml/indi/ImagePreview.qml +++ b/kstars/kstarslite/qml/indi/ImagePreview.qml @@ -1,104 +1,104 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Window 2.2 import "../modules" import "../constants" 1.0 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.0 import QtQuick.Dialogs 1.2 as Dialogs KSPage { id: imagePreview anchors.fill: parent title: "Image Preview - " + deviceName property string deviceName property Item buttonRow: null Item { id: imgPreviewColumn anchors.fill: parent RowLayout { id: saveButtons anchors { top: parent.top left: parent.left - // margins: 10 * num.dp + // margins: 10 * Num.dp } Layout.fillWidth: true - spacing: 5 * num.dp + spacing: 5 * Num.dp Button { text: "Save As" onClicked: { ClientManagerLite.saveDisplayImage() } } } Image { id: image Layout.fillHeight: true Layout.fillWidth: true fillMode: Image.PreserveAspectFit anchors { top: saveButtons.bottom left: parent.left right: parent.right bottom: parent.bottom - margins: 15 * num.dp + margins: 15 * Num.dp } } Connections { target: ClientManagerLite onNewINDIBLOBImage: { if(imagePreview.deviceName == deviceName) { image.source = "image://images/ccdPreview" stackView.push(imagePreview) } } onCreateINDIButton: { if(imagePreview.deviceName == deviceName) { if(propName == "UPLOAD_MODE") { if(imagePreview.buttonRow == null) { var buttonRowComp = Qt.createComponent("modules/KSButtonsSwitchRow.qml"); imagePreview.buttonRow = buttonRowComp.createObject(saveButtons) imagePreview.buttonRow.deviceName = deviceName imagePreview.buttonRow.propName = propName imagePreview.buttonRow.exclusive = exclusive } imagePreview.buttonRow.addButton(propText, switchName, checked, enabled) } } } onRemoveINDIProperty: { if(imagePreview.deviceName == deviceName) { if(propName == "UPLOAD_MODE") { if(imagePreview.buttonRow != null) { imagePreview.buttonRow.destroy() imagePreview.buttonRow = null } } } } } } } diff --git a/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml b/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml index 183638197..c90e109e2 100644 --- a/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml +++ b/kstars/kstarslite/qml/indi/modules/KSButtonsSwitchRow.qml @@ -1,72 +1,72 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Controls 1.4 import QtQuick.Window 2.2 import "../../constants" 1.0 import QtQuick.Layouts 1.2 Flow { id:buttonsRow property bool checkBox: false property string propName: "" property string deviceName: "" property bool exclusive: false Layout.fillWidth: true - spacing: 10 * num.dp + spacing: 10 * Num.dp Connections { target: ClientManagerLite onNewINDISwitch: { if(buttonsRow.deviceName == deviceName) { if(buttonsRow.propName == propName) { for(var i = 0; i < children.length; ++i) { if(children[i].switchName == switchName) { children[i].checked = isOn } } } } } } function addButton(propText, switchName, initChecked, enabled) { var buttonComp = Qt.createComponent("KSButtonSwitch.qml"); var button = buttonComp.createObject(this) button.text = propText button.switchName = switchName button.parentRow = this button.checked = initChecked button.enabled = enabled } function addCheckBox(propText, switchName, initChecked, enabled) { var checkBoxComp = Qt.createComponent("KSCheckBox.qml"); var checkBox = checkBoxComp.createObject(this) checkBox.text = propText checkBox.switchName = switchName checkBox.parentRow = this checkBox.checked = initChecked checkBox.enabled = enabled } function sendNewSwitch(switchName, button) { ClientManagerLite.sendNewINDISwitch(deviceName,propName,switchName) if(exclusive && button != null) { for(var i = 0; i < children.length; ++i) { if(children[i] !== button) { children[i].checked = false } } } } } diff --git a/kstars/kstarslite/qml/indi/modules/KSINDIText.qml b/kstars/kstarslite/qml/indi/modules/KSINDIText.qml index da1e10948..7e39b555b 100644 --- a/kstars/kstarslite/qml/indi/modules/KSINDIText.qml +++ b/kstars/kstarslite/qml/indi/modules/KSINDIText.qml @@ -1,56 +1,56 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.2 import "../../constants" 1.0 import "../../modules" Column { id: columnTextProp Layout.fillHeight: true Layout.fillWidth: true - spacing: 5 * num.dp + spacing: 5 * Num.dp property string propLabel: "" KSLabel { text: propLabel } Rectangle { id: separator - height: num.dp - color: num.sysPalette.light + height: Num.dp + color: Num.sysPalette.light width: parent.width } function addField(isNumber, deviceName, propName, fieldName, propText, writable) { var textItem if(writable) { var textComp = Qt.createComponent("KSINDITextField.qml"); textItem = textComp.createObject(this) textItem.deviceName = deviceName textItem.propName = propName textItem.fieldName = fieldName textItem.textField.text = propText textItem.isNumber = isNumber } else { textItem = Qt.createQmlObject('import QtQuick 2.6 import QtQuick.Layouts 1.2 import "../../constants" 1.0 import "../../modules" KSText { }', this) textItem.text = propText } //textItem.anchors.top = separator.bottom } } diff --git a/kstars/kstarslite/qml/indi/modules/KSINDITextField.qml b/kstars/kstarslite/qml/indi/modules/KSINDITextField.qml index 313a3464c..f4dd309d8 100644 --- a/kstars/kstarslite/qml/indi/modules/KSINDITextField.qml +++ b/kstars/kstarslite/qml/indi/modules/KSINDITextField.qml @@ -1,75 +1,75 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.0 import "../../constants" 1.0 import "../../modules" Flow { id: textRow - spacing: 5 * num.dp + spacing: 5 * Num.dp anchors { left: parent.left right: parent.right } property Item textField: field property bool isNumber: true // false - text, true - number property string deviceName property string propName property string fieldName KSTextField { id: field } Button { text: xi18n("Set") onClicked: { if(isNumber) { ClientManagerLite.sendNewINDINumber(deviceName, propName, fieldName, field.text) } else { ClientManagerLite.sendNewINDIText(deviceName, propName, fieldName, field.text) } Qt.inputMethod.hide() } } Connections { target: ClientManagerLite onNewINDINumber: { if(isNumber) { if(textRow.deviceName == deviceName) { if(textRow.propName == propName) { if(textRow.fieldName == numberName) { field.text = value } } } } } onNewINDIText: { if(!isNumber) { if(textRow.deviceName == deviceName) { if(textRow.propName == propName) { if(textRow.fieldName == fieldName) { field.text = text } } } } } } } diff --git a/kstars/kstarslite/qml/indi/modules/Led.qml b/kstars/kstarslite/qml/indi/modules/Led.qml index a762d7ab6..8666e1545 100644 --- a/kstars/kstarslite/qml/indi/modules/Led.qml +++ b/kstars/kstarslite/qml/indi/modules/Led.qml @@ -1,33 +1,33 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import "../../constants" 1.0 Image { property string color: "grey" - width: 16 * num.dp - height: 16 * num.dp - sourceSize.height: 16 * num.dp - sourceSize.width: 16 * num.dp + width: 16 * Num.dp + height: 16 * Num.dp + sourceSize.height: 16 * Num.dp + sourceSize.width: 16 * Num.dp - source: "images/" + num.density + "/grey.png" + source: "images/" + Num.density + "/grey.png" onColorChanged: { if(color == "red") { - source = "images/" + num.density + "/red.png" + source = "images/" + Num.density + "/red.png" } else if(color == "green") { - source = "images/" + num.density + "/green.png" + source = "images/" + Num.density + "/green.png" } else if(color == "yellow") { - source = "images/" + num.density + "/yellow.png" + source = "images/" + Num.density + "/yellow.png" } else if(color == "grey") { - source = "images/" + num.density + "/grey.png" + source = "images/" + Num.density + "/grey.png" } } } diff --git a/kstars/kstarslite/qml/indi/modules/MotionControl.qml b/kstars/kstarslite/qml/indi/modules/MotionControl.qml index 92d40eeab..c2009d8ac 100644 --- a/kstars/kstarslite/qml/indi/modules/MotionControl.qml +++ b/kstars/kstarslite/qml/indi/modules/MotionControl.qml @@ -1,308 +1,308 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.0 import TelescopeLiteEnums 1.0 import "../../constants" 1.0 import "../../modules" ColumnLayout { id: motionCColumn anchors { fill: parent - margins: num.marginsKStab + margins: Num.marginsKStab } - spacing: 5 * num.dp + spacing: 5 * Num.dp enabled: buttonsEnabled property string deviceName property var telescope: ClientManagerLite.getTelescope(deviceName) property bool buttonsEnabled: telescope.isConnected() Connections { target: ClientManagerLite onDeviceConnected: { if(motionCColumn.deviceName == deviceName) { buttonsEnabled = isConnected } } onTelescopeAdded: { if(newTelescope.getDeviceName() === motionCColumn.deviceName) { telescope = newTelescope } } } //Row 1 RowLayout { Layout.fillHeight: true anchors { left: parent.left right: parent.right } Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false onPressedChanged: { if(telescope) { if(pressed) { telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START) telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START) } else { telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP) telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP) } } } text: xi18n("NW") } Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false onPressedChanged: { if(telescope) { if(pressed) { telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START) } else { telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP) } } } text: xi18n("N") } Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false onPressedChanged: { if(telescope) { if(pressed) { telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START) telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START) } else { telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP) telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP) } } } text: xi18n("NE") } } //Row 2 RowLayout { Layout.fillHeight: true Layout.fillWidth: true Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false onPressedChanged: { if(telescope) { if(pressed) { telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START) } else { telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP) } } } text: xi18n("W") } Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false onPressedChanged: { if(telescope) { telescope.abort(); } } text: xi18n("Stop") } Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false onPressedChanged: { if(telescope) { if(pressed) { telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START) } else { telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP) } } } text: xi18n("E") } } //Row 3 RowLayout { Layout.fillHeight: true Layout.fillWidth: true Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false onPressedChanged: { if(telescope) { if(pressed) { telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START) telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START) } else { telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP) telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP) } } } text: xi18n("SW") } Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false text: xi18n("S") onPressedChanged: { if(telescope) { if(pressed) { telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START) } else { telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP) } } } } Button { Layout.fillHeight: true Layout.fillWidth: true activeFocusOnTab: false onPressedChanged: { if(telescope) { if(pressed) { telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START) telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START) } else { telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP) telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP) } } } text: xi18n("SE") } } //Slewing RowLayout { id: slewingRateRow Layout.fillHeight: true Layout.fillWidth: true Button { id: decreaseSlew height: motionCColumn.height * 0.15 Layout.fillWidth: true activeFocusOnTab: false enabled: telescope.slewDecreasable Connections { target: telescope onSlewDecreasableChanged: { decreaseSlew.enabled = telescope.slewDecreasable } } onClicked: { if(telescope) { telescope.decreaseSlewRate() } } text: xi18n("-") } KSText { height: parent.height * 0.15 Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter text: xi18n("Slew rate: " + telescope.slewRateLabel) } Button { id: increaseSlew height: motionCColumn.height * 0.15 Layout.fillWidth: true activeFocusOnTab: false enabled: telescope.slewIncreasable Connections { target: telescope onSlewIncreasableChanged: { increaseSlew.enabled = telescope.slewIncreasable } } onClicked: { if(telescope) { telescope.increaseSlewRate() } } text: xi18n("+") } } } diff --git a/kstars/kstarslite/qml/indi/modules/Property.qml b/kstars/kstarslite/qml/indi/modules/Property.qml index bdc1b738f..cb6172051 100644 --- a/kstars/kstarslite/qml/indi/modules/Property.qml +++ b/kstars/kstarslite/qml/indi/modules/Property.qml @@ -1,142 +1,142 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.0 import "../../constants" import TelescopeLiteEnums 1.0 ColumnLayout { id: columnProp Layout.fillHeight: true width: parentTab == null ? 0 : parentTab.width property string deviceName: "" property string propName: "" property string label: "" property Item parentTab property ComboBox comboBox: null property Flow buttonRow: null KSLed { id: led deviceName: columnProp.deviceName propName: columnProp.propName label: columnProp.label Component.onCompleted: { syncLEDProperty() } } Rectangle { id: separator - height: num.dp + height: Num.dp color: "grey" Layout.fillWidth: true } Connections { target: ClientManagerLite onNewLEDState: { if(columnProp.deviceName == deviceName) { if(columnProp.propName == propName) { led.syncLEDProperty() } } } onCreateINDIButton: { if(columnProp.deviceName == deviceName) { if(columnProp.propName == propName) { if(buttonRow == null) { var buttonRowComp = Qt.createComponent("KSButtonsSwitchRow.qml"); buttonRow = buttonRowComp.createObject(columnProp) buttonRow.deviceName = deviceName buttonRow.propName = propName buttonRow.exclusive = exclusive buttonRow.width = Qt.binding(function() { return parentTab.width }) } buttonRow.addButton(propText, switchName, checked, enabled) } } } onCreateINDIRadio: { if(columnProp.deviceName == deviceName) { if(columnProp.propName == propName) { if(buttonRow == null) { var buttonRowComp = Qt.createComponent("KSButtonsSwitchRow.qml"); buttonRow = buttonRowComp.createObject(columnProp) buttonRow.deviceName = deviceName buttonRow.propName = propName buttonRow.exclusive = exclusive buttonRow.checkBox = true buttonRow.width = Qt.binding(function() { return parentTab.width }) } buttonRow.addCheckBox(propText, switchName, checked, enabled) } } } onCreateINDIMenu: { if(columnProp.deviceName == deviceName) { if(columnProp.propName == propName) { if(comboBox == null) { var CBoxComponent = Qt.createComponent("KSComboBox.qml"); comboBox = CBoxComponent.createObject(columnProp) comboBox.deviceName = deviceName comboBox.propName = propName comboBox.textRole = "text" } comboBox.model.append({"text": switchLabel, "name": switchName}) if(isSelected) { comboBox.currentIndex = comboBox.model.length - 1 } } } } onCreateINDIText: { if(columnProp.deviceName == deviceName) { if(columnProp.propName == propName) { var indiTextComp = Qt.createComponent("KSINDIText.qml"); var indiText = indiTextComp.createObject(columnProp) indiText.addField(false, deviceName, propName, fieldName, propText, write) indiText.propLabel = propLabel //indiText.width = Qt.binding(function() { return parentTab.width }) } } } onCreateINDINumber: { if(columnProp.deviceName == deviceName) { if(columnProp.propName == propName) { var indiNumComp = Qt.createComponent("KSINDIText.qml"); var indiNum = indiNumComp.createObject(columnProp) indiNum.addField(true, deviceName, propName, numberName, propText, write) indiNum.propLabel = propLabel } } } onCreateINDILight: { if(columnProp.deviceName == deviceName) { if(columnProp.propName == propName) { var lightComp = Qt.createComponent("KSLed.qml") var light = lightComp.createObject(columnProp) light.deviceName = deviceName light.propName = propName light.label = label light.name = name light.syncLEDLight() } } } } } diff --git a/kstars/kstarslite/qml/main.qml b/kstars/kstarslite/qml/main.qml index 0b786ccdc..1e9a7120d 100644 --- a/kstars/kstarslite/qml/main.qml +++ b/kstars/kstarslite/qml/main.qml @@ -1,540 +1,540 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 import QtQuick.Window 2.2 as Window import QtQuick.Layouts 1.1 import "modules" import "modules/helpers" import "modules/popups" import "modules/menus" import "modules/tutorial" import "dialogs" import "dialogs/menus" import "dialogs/helpers" import "constants" 1.0 import "indi" ApplicationWindow { id: window objectName: "window" width: Window.Screen.desktopAvailableWidth height: Window.Screen.desktopAvailableHeight visible: true //Application properties property bool isLoaded: false property bool isPortrait: width < height ? true: false property bool isSkyMapVisible: stackView.currentItem == initPage signal loaded(); onIsLoadedChanged: { if(isLoaded) { loaded() if(KStarsLite.runTutorial) tutorialPopup.open() } } header: ToolBar { id: toolBar Material.foreground: "white" height: stackView.currentItem != initPage ? backButton.height : 0 visible: stackView.currentItem != initPage /*background: Rectangle { anchors.fill: parent - color: num.sysPalette.dark + color: Num.sysPalette.dark }*/ Behavior on height { NumberAnimation { duration: 200 easing.type: Easing.InOutQuad } } Row { id: toolRow spacing: 20 height: parent.height width: parent.width ToolButton { id: backButton contentItem: Image { fillMode: Image.Pad horizontalAlignment: Image.AlignHCenter verticalAlignment: Image.AlignVCenter source: "images/back.png" } onClicked: { if(stackView.depth != 1) stackView.pop() } } KSLabel { id: titleLabel text: stackView.currentItem.title font.pixelSize: 20 width: parent.width - backButton.width - toolRow.spacing //To allow ellision of the text elide: Label.ElideRight wrapMode: Label.Wrap maximumLineCount: 1 anchors.verticalCenter: parent.verticalCenter } } } Splash { z:1 anchors.fill:parent onTimeout: { isLoaded = true } } StackView { visible: isLoaded id: stackView anchors.fill: parent initialItem: initPage } PassiveNotification { z: 2 id: notification Connections { target: KStarsLite onNotificationMessage: { notification.showNotification(msg) } } } Units { id: units } //Dialogs FindDialog { id: findDialog } //Details DetailsDialog { id: detailsDialog } DetailsAddLink { id: detailsAddLink } DetailsLinkMenu { id: detailsLinkMenu x: (window.width - width)/2 y: (window.height - height)/2 } //Location LocationDialog { id: locationDialog } LocationEdit { id: locationEdit } LocationLoading { id: locationLoading } //Pages INDIControlPanel { id: indiControlPanel } Page { id: initPage title: "Sky Map" padding: 0 Rectangle { anchors.fill: parent color: "black" //Color scheme } } SkyMapLiteWrapper { /*The reason SkyMapLite is a not a child of initPage is that it can't handle properly change of opacity. Each time we go from / to initPage this component is made invisible / visible and skyMapLiteWrapper is anchored to fill null / parent*/ id: skyMapLite anchors.fill: parent } //Popups TimePage { id: timePage } ColorSchemePopup { id: colorSchemePopup x: (window.width - width)/2 y: (window.height - height)/2 } ProjectionsPopup { id: projPopup x: (window.width - width)/2 y: (window.height - height)/2 } FOVPopup { id: fovPopup x: (window.width - width)/2 y: (window.height - height)/2 } TutorialPopup { id: tutorialPopup x: (window.width - width)/2 y: (window.height - height)/2 } TutorialExitPopup { id: tutorialExitPopup x: (window.width - width)/2 y: (window.height - height)/2 } //Menus ContextMenu { id: contextMenu x: (window.width - width)/2 y: (window.height - height)/2 } LocationsGeoMenu { id: locationsGeoMenu x: (window.width - width)/2 y: (window.height - height)/2 } Drawer { id: globalDrawer objectName: "globalDrawer" width: Math.min(window.width, window.height) / 4 * 2 height: window.height //Disable drawer while loading dragMargin: isLoaded ? Qt.styleHints.startDragDistance : -Qt.styleHints.startDragDistance background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } onOpened: { contextDrawer.close() } Image { id: drawerBanner source: "images/kstars.png" fillMode: Image.PreserveAspectFit anchors { left: parent.left top: parent.top right: parent.right } } ListView { clip: true id: pagesList anchors { left: parent.left top: drawerBanner.bottom right: parent.right bottom: parent.bottom } delegate: ItemDelegate { id: globalDrawerControl Rectangle { anchors { horizontalCenter: parent.horizontalCenter bottom: parent.bottom } width: parent.width - 10 color: "#E8E8E8" height: 1 } contentItem: KSText { rightPadding: globalDrawerControl.spacing text: globalDrawerControl.text font: globalDrawerControl.font elide: Text.ElideRight visible: globalDrawerControl.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } width: parent.width text: model.objID.title onClicked: { if(stackView.currentItem != model.objID) { if(model.objID != initPage) { stackView.replace(null, [initPage, model.objID]) } else { stackView.replace(null, initPage) } globalDrawer.close() } } } property ListModel drawerModel : ListModel { //Trick to enable storing of object ids Component.onCompleted: { append({objID: initPage}); append({objID: indiControlPanel}); append({objID: findDialog}); append({objID: locationDialog}); } } model: drawerModel ScrollIndicator.vertical: ScrollIndicator { } } } //Study mode property bool step1: false property bool step2: false property bool step3: false property bool step4: false property bool step5: false function askExitTutorial() { tutorialExitPopup.open() } function exitTutorial() { KStarsLite.runTutorial = false tutorialPopup.close() step1 = false step2 = false step3 = false step4 = false step5 = false } //Step 1 - Global Drawer TutorialStep1 { } //Step 2 - Context Drawer TutorialStep2 { } //Step 5 - Location TutorialStep5 { } Drawer { id: contextDrawer objectName: "contextDrawer" width: Math.min(window.width, window.height) / 4 * 2 height: window.height //Disable drawer while loading and if SkyMapLite is not visible dragMargin: isSkyMapVisible && isLoaded ? Qt.styleHints.startDragDistance + 15 : -Qt.styleHints.startDragDistance edge: Qt.RightEdge background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } onOpened: { globalDrawer.close() } KSLabel { id: contextTitle anchors { top: parent.top left: parent.left margins: 10 } font.pointSize: 14 text: stackView.currentItem.title } ListView { id: contextList anchors { left: parent.left top: contextTitle.bottom right: parent.right bottom: parent.bottom topMargin: 15 } model: drawerModel delegate: ItemDelegate { id: contextDrawerControl Rectangle { anchors { horizontalCenter: parent.horizontalCenter bottom: parent.bottom } width: parent.width - 10 color: "#E8E8E8" height: 1 } width: parent.width text: model.title onClicked: { if(model.type == "popup") { objID.open() } contextDrawer.close() } contentItem: KSText { rightPadding: contextDrawerControl.spacing text: contextDrawerControl.text font: contextDrawerControl.font elide: Text.ElideRight visible: contextDrawerControl.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } property ListModel drawerModel : ListModel { //Trick to enable storing of object ids Component.onCompleted: { append({title: xi18n("Projection systems"), objID: projPopup, type: "popup"}); append({title: xi18n("Color Schemes"), objID: colorSchemePopup, type: "popup"}); append({title: xi18n("FOV Symbols"), objID: fovPopup, type: "popup"}); } } ScrollIndicator.vertical: ScrollIndicator { } } ColumnLayout { anchors { left: parent.left right: parent.right bottom: parent.bottom } RowLayout { id: magnitudeRow anchors { leftMargin: 10 left: parent.left rightMargin: 10 right: parent.right } property color magnitudeColor: colorSchemePopup.currentCScheme == "cs_night" ? "white" : "black" Rectangle { anchors{ left: parent.left bottom: smallestMag.bottom } width: 24 height: 24 radius: width * 0.5 color: magnitudeRow.magnitudeColor } Rectangle { anchors{ horizontalCenter: parent.horizontalCenter bottom: smallestMag.bottom } width: 16 height: 16 radius: width * 0.5 color: magnitudeRow.magnitudeColor } Rectangle { id: smallestMag anchors { right: parent.right verticalCenter: parent.bottom } width: 8 height: 8 radius: width * 0.5 color: magnitudeRow.magnitudeColor } } Slider { id: magSlider anchors { left: parent.left right: parent.right } from: 1.18778 to: 5.75954 value: SkyMapLite.magLim onValueChanged: { SkyMapLite.magLim = value } } } } //Handle back button Connections { target: window onClosing: { if (Qt.platform.os == "android") { if(stackView.depth > 1) { close.accepted = false; stackView.pop() } } } } } diff --git a/kstars/kstarslite/qml/modules/BottomMenu.qml b/kstars/kstarslite/qml/modules/BottomMenu.qml index 7f6ffb738..ff7c33b97 100644 --- a/kstars/kstarslite/qml/modules/BottomMenu.qml +++ b/kstars/kstarslite/qml/modules/BottomMenu.qml @@ -1,327 +1,327 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.7 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Universal 2.0 import QtQuick.Window 2.2 import "../constants" 1.0 import "helpers" ColumnLayout { id: bottomMenu objectName: "bottomMenu" property int padding: 10 property double openOffset: bottomMenu.height - bottomBar.background.radius //Hide bottom round corners property double closedOffset: arrowUp.height + padding property string prevState property bool isWindowWidthSmall: window.width < menuGrid.maxWidth //Hide on slew Connections { target: SkyMapLite onSlewingChanged: { if(SkyMapLite.slewing || skyMapLite.automaticMode) { prevState = state state = "hidden" } else { state = prevState } } } state: "closed" property alias state : bottomMenu.state spacing: padding x: (parent.width - width)/2 Layout.fillHeight: true states: [ State { name: "open" PropertyChanges { target: bottomMenu y: parent.height - openOffset } }, State { name: "closed" PropertyChanges { target: bottomMenu y: parent.height - closedOffset } }, State { name: "hidden" PropertyChanges { target: bottomMenu y: parent.height } } ] transitions: [ Transition { to: "open" PropertyAnimation { target: bottomMenu properties: "y"; duration: 300 } }, Transition { to: "closed" PropertyAnimation { target: bottomMenu properties: "y"; duration: 300 } }, Transition { to: "hidden" PropertyAnimation { target: bottomMenu properties: "y"; duration: 200 } } ] Image { id: arrowUp anchors { horizontalCenter: parent.horizontalCenter } state: "open" source: "../images/arrow.png" rotation: { if(bottomMenu.state == "closed") return 0 else if(bottomMenu.state == "open") return 180 return rotation //If it state is "hidden" return current rotation } mirror: true // Make sure that arrows in both menus look symmetric MouseArea { objectName: "arrowUpMouseArea" anchors.fill: parent onPressed: { bottomMenu.state = bottomMenu.state == "closed" ? "open" : "closed" } function manualPress() { onPressed(1); } } Behavior on rotation { RotationAnimation { duration: 200; direction: RotationAnimation.Counterclockwise } } } Pane { id: bottomBar anchors.horizontalCenter: parent.horizontalCenter background: Rectangle { id: menuRect - color: num.sysPalette.base + color: Num.sysPalette.base border { width: 1 - color: num.sysPalette.light + color: Num.sysPalette.light } radius: 10 } GridLayout { id: menuGrid property double maxWidth: {width} // We make menuGrid smaller when window width is less than this value onWidthChanged: { if(width > maxWidth) maxWidth = width } anchors { bottom: parent.bottom bottomMargin: menuRect.radius/2 // Center vertically menuGrid in background rectangle } rows: isWindowWidthSmall ? 2 : 1 flow: isWindowWidthSmall ? GridLayout.TopToBottom : GridLayout.LeftToRight Layout.fillWidth: true RowLayout { Layout.fillHeight: true Layout.fillWidth: true anchors { left: parent.left right: parent.right } BottomMenuButton { id: goBackwards iconSrc: "../../images/media-skip-backward.png" onClicked: { KStarsLite.slotStepBackward() } } BottomMenuButton { id: startTimer state: SimClock.isActive() ? "on" : "off" states: [ State { name: "on" PropertyChanges { target: startTimer iconSrc: "../../images/media-playback-pause.png" } }, State { name: "off" PropertyChanges { target: startTimer iconSrc: "../../images/media-playback-start.png" } } ] onClicked: { KStarsLite.slotToggleTimer() if(SimClock.isActive()) { startTimer.state = "on" } else { startTimer.state = "off" } } Connections { target: window onIsSkyMapVisibleChanged: { if(!isSkyMapVisible && SimClock.isActive()) { KStarsLite.slotToggleTimer() startTimer.state = "off" } } } } BottomMenuButton { iconSrc: "../../images/media-skip-forward.png" onClicked: { KStarsLite.slotStepForward() } } RowLayout { anchors.right: parent.right BottomMenuButton { onClicked: { stackView.push(timePage) } visible: isWindowWidthSmall iconSrc: "../../images/appointment-new.png" } Rectangle { id: separatorSearchSmall height: decreaseUnitLandscape.height*0.75 - color: num.sysPalette.shadow + color: Num.sysPalette.shadow width: 1 visible: isWindowWidthSmall } BottomMenuButton { onClicked: { stackView.push(findDialog) } visible: isWindowWidthSmall iconSrc: "../../images/edit-find.png" } } } RowLayout { id: secondRow Layout.fillHeight: true Layout.fillWidth: true BottomMenuButton { onClicked: { timeSpinBox.decreaseTimeUnit() } visible: isWindowWidthSmall iconSrc: "../../images/arrow-down.png" } TimeSpinBox { id: timeSpinBox } BottomMenuButton { id: increaseUnit onClicked: { timeSpinBox.increaseTimeUnit() } iconSrc: "../../images/arrow-up.png" } BottomMenuButton { id: decreaseUnitLandscape onClicked: { timeSpinBox.decreaseTimeUnit() } visible: !isWindowWidthSmall iconSrc: "../../images/arrow-down.png" } Rectangle { id: separator height: decreaseUnitLandscape.height*0.75 - color: num.sysPalette.shadow + color: Num.sysPalette.shadow width: 1 visible: !isWindowWidthSmall } BottomMenuButton { onClicked: { stackView.push(timePage) } visible: !isWindowWidthSmall iconSrc: "../../images/appointment-new.png" } Rectangle { id: separatorSearchLarge height: decreaseUnitLandscape.height*0.75 - color: num.sysPalette.shadow + color: Num.sysPalette.shadow width: 1 visible: !isWindowWidthSmall } BottomMenuButton { onClicked: { stackView.push(findDialog) } visible: !isWindowWidthSmall iconSrc: "../../images/edit-find.png" } } } } } diff --git a/kstars/kstarslite/qml/modules/KSLabel.qml b/kstars/kstarslite/qml/modules/KSLabel.qml index e04c47395..5203e0fea 100644 --- a/kstars/kstarslite/qml/modules/KSLabel.qml +++ b/kstars/kstarslite/qml/modules/KSLabel.qml @@ -1,7 +1,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 import "../constants/" 1.0 Label { - color: num.sysPalette.text + color: Num.sysPalette.text } diff --git a/kstars/kstarslite/qml/modules/KSListView.qml b/kstars/kstarslite/qml/modules/KSListView.qml index d6a604031..a6c72b19e 100644 --- a/kstars/kstarslite/qml/modules/KSListView.qml +++ b/kstars/kstarslite/qml/modules/KSListView.qml @@ -1,165 +1,165 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import "../constants/" 1.0 ListView { id: listView clip: true property bool checkCurrent: false property bool checkable: false property bool onClickCheck: true //true if the item should be be mapped with a blue rectangle when clicked property int maxWidth: 0 property bool modelIsChanged: false implicitWidth: maxWidth //To skip the case when contentItem.height equals to 99000+ implicitHeight: contentItem.height >= window.height ? window.height : contentItem.height //For some reason we can't use num constant inside states so we wrap sysPalette as property - property SystemPalette sysPalette: num.sysPalette + property SystemPalette sysPalette: Num.sysPalette onCountChanged: { for(var child in listView.contentItem.children) { var childWidth = listView.contentItem.children[child].textWidth if(childWidth == undefined) childWidth = 0 maxWidth = maxWidth > childWidth ? maxWidth : childWidth } } ScrollIndicator.vertical: ScrollIndicator { } property string textRole: "" signal clicked(var text, var index, var checked) property bool modelIsArray: false onModelChanged: { modelIsArray = !model ? model.constructor === Array : false } delegate: Rectangle { id: delegateRect width: parent.width height: objName.contentHeight + 30 property int textWidth: objRow.width + objRow.anchors.leftMargin*2 property bool checked: false property string visibleText: objName.text color: sysPalette.base border { - color: num.sysPalette.light//"#becad5" + color: Num.sysPalette.light//"#becad5" width: 1 } Behavior on color { ColorAnimation { duration: 200 } } states: [ State { name: "hovered" PropertyChanges { target: delegateRect color: sysPalette.highlight //"#d0e8fa" } PropertyChanges { target: objName color: sysPalette.highlightedText //"#31363b" } }, State { name: "selected" PropertyChanges { target: delegateRect color: sysPalette.button//"#2196F3" } PropertyChanges { target: objName color: sysPalette.buttonText//"#eff0fa" } }, State { name: "default" PropertyChanges { target: delegateRect color: sysPalette.base//"white" } PropertyChanges { target: objName color: sysPalette.text//"black" } } ] MouseArea { id: delMouseArea anchors.fill: parent hoverEnabled: true function hoveredColor() { if(pressed) { delegateRect.state = "selected" } else { if(containsMouse) { delegateRect.state = "hovered" } else { delegateRect.state = "default" } } } onContainsMouseChanged: { hoveredColor() } onPressedChanged: { hoveredColor() } onClicked: { if(onClickCheck) listView.currentIndex = model.index if(checkable) delegateRect.checked = !delegateRect.checked listView.clicked(objName.text, model.index, delegateRect.checked) } } RowLayout { id: objRow anchors { verticalCenter: parent.verticalCenter left: parent.left leftMargin: 20 } Rectangle { visible: (checkCurrent && listView.currentIndex == model.index) || (checkable && delegateRect.checked) color: objName.color //"#2173f3" width: height height: objName.font.pixelSize/2 radius: width * 0.5 } KSText { id: objName text: textRole == "" ? modelData : listView.modelIsArray ? modelData[textRole] : model[textRole] wrapMode: Text.WrapAnywhere Behavior on color { ColorAnimation { duration: 200 } } } } } } diff --git a/kstars/kstarslite/qml/modules/KSPage.qml b/kstars/kstarslite/qml/modules/KSPage.qml index ad50eabe7..c1d3ceb5b 100644 --- a/kstars/kstarslite/qml/modules/KSPage.qml +++ b/kstars/kstarslite/qml/modules/KSPage.qml @@ -1,27 +1,27 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Universal 2.0 import "../constants" 1.0 Pane { property string title: "" visible: false background: Rectangle { // anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } } diff --git a/kstars/kstarslite/qml/modules/KSTab.qml b/kstars/kstarslite/qml/modules/KSTab.qml index e706cd43b..ab325ad15 100644 --- a/kstars/kstarslite/qml/modules/KSTab.qml +++ b/kstars/kstarslite/qml/modules/KSTab.qml @@ -1,46 +1,46 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.0 import "../constants" 1.0 Pane { id: tab property string title: "" clip: true property Item flickableItem: flickable padding: 0 background: Rectangle { - color: num.sysPalette.base + color: Num.sysPalette.base } //contentItem is already used by Pane so be it rootItem property Item rootItem onRootItemChanged: { if(rootItem.parent != flickable.contentItem) rootItem.parent = flickable.contentItem } Flickable { id: flickable anchors{ fill: parent - margins: num.marginsKStab + margins: Num.marginsKStab } ScrollBar.vertical: ScrollBar { id: scrollBar } flickableDirection: Flickable.VerticalFlick contentWidth: rootItem != undefined ? rootItem.width : 0 contentHeight: rootItem != undefined ? rootItem.height : 0 flickableChildren: rootItem } } diff --git a/kstars/kstarslite/qml/modules/KSText.qml b/kstars/kstarslite/qml/modules/KSText.qml index 26257a0b7..d4f12dc54 100644 --- a/kstars/kstarslite/qml/modules/KSText.qml +++ b/kstars/kstarslite/qml/modules/KSText.qml @@ -1,7 +1,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 import "../constants/" 1.0 Text { - color: num.sysPalette.text + color: Num.sysPalette.text } diff --git a/kstars/kstarslite/qml/modules/KSTextField.qml b/kstars/kstarslite/qml/modules/KSTextField.qml index ab58cb083..981d17f9e 100644 --- a/kstars/kstarslite/qml/modules/KSTextField.qml +++ b/kstars/kstarslite/qml/modules/KSTextField.qml @@ -1,18 +1,18 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 import "../constants/" 1.0 TextField { id: control - color: num.sysPalette.text - selectedTextColor: num.sysPalette.highlightedText - selectionColor: num.sysPalette.highlight + color: Num.sysPalette.text + selectedTextColor: Num.sysPalette.highlightedText + selectionColor: Num.sysPalette.highlight background: Rectangle { y: control.height - height - control.bottomPadding / 2 implicitWidth: 120 height: control.activeFocus ? 2 : 1 - color: control.activeFocus ? num.sysPalette.text : num.sysPalette.dark + color: control.activeFocus ? Num.sysPalette.text : Num.sysPalette.dark } } diff --git a/kstars/kstarslite/qml/modules/SkyMapLiteWrapper.qml b/kstars/kstarslite/qml/modules/SkyMapLiteWrapper.qml index ab825cbee..40d0de525 100644 --- a/kstars/kstarslite/qml/modules/SkyMapLiteWrapper.qml +++ b/kstars/kstarslite/qml/modules/SkyMapLiteWrapper.qml @@ -1,163 +1,163 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Controls 2.0 import "../constants" 1.0 import "tutorial" Item { id: skyMapLiteItem visible: isLoaded Rectangle { id: skyMapLiteWrapper objectName: "skyMapLiteWrapper" width: parent.width height: parent.height color: KStarsLite.getColor("SkyColor") Connections { target: colorSchemePopup onColorSchemeChanged: { skyMapLiteWrapper.color = KStarsLite.getColor("SkyColor") } } Connections { target: stackView onCurrentItemChanged: { if(stackView.currentItem != initPage) { //Workaround to make animation on push from / and pop to initPage faster //skyMapLiteWrapper.anchors.fill = null skyMapLiteWrapper.width = 0 skyMapLiteWrapper.height = 0 skyMapLite.visible = false } } onBusyChanged: { if(stackView.currentItem == initPage) { skyMapLite.visible = true skyMapLiteWrapper.width = Qt.binding(function() {return skyMapLite.width}) skyMapLiteWrapper.height = Qt.binding(function() {return skyMapLite.height}) } } } Button { z: 1 visible: SkyMapLite.centerLocked anchors { right: parent.right top: parent.top margins: 25 } onClicked: { SkyMapLite.centerLocked = false } onPressedChanged: { if(pressed) lockBG.color = "#D40000" else lockBG.color = "red" } background: Rectangle { id: lockBG color: "red" implicitWidth: 100 implicitHeight: 70 radius: 4 border.width: 3 border.color: "#AA0000" } Image { source: "../images/lock-closed.png" anchors.centerIn: parent } } Button { z: 1 id: exitAutomaticMode visible: SkyMapLite.automaticMode anchors { left: parent.left top: parent.top margins: 25 } Image { source: "../images/back.png" anchors.centerIn: parent } onClicked: { SkyMapLite.automaticMode = false } } /** Circle that appears after user taps on screen **/ Rectangle { id: tapCircle z: 1 - width: 20 * num.dp + width: 20 * Num.dp radius: width*0.5 height: width color: "grey" opacity: 0 Connections { target: SkyMapLite onPosClicked: { tapCircle.x = pos.x - tapCircle.width * 0.5 tapCircle.y = pos.y - tapCircle.height * 0.5 tapAnimation.start() } onPointLiteChanged: { contextMenu.openPoint() } onObjectLiteChanged: { contextMenu.openObject() } } SequentialAnimation on opacity { id: tapAnimation OpacityAnimator { from: 0; to: 0.8; duration: 100 } OpacityAnimator { from: 0.8; to: 0; duration: 400 } } } } TopMenu { id: topMenu } //Step 3 - Top Menu TutorialStep3 { anchors { top: topMenu.bottom } } BottomMenu { id: bottomMenu } //Step 4 - Bottom Menu TutorialStep4 { anchors{ bottom: bottomMenu.top } } } diff --git a/kstars/kstarslite/qml/modules/Splash.qml b/kstars/kstarslite/qml/modules/Splash.qml index 9d5620949..30e4bfe55 100644 --- a/kstars/kstarslite/qml/modules/Splash.qml +++ b/kstars/kstarslite/qml/modules/Splash.qml @@ -1,113 +1,113 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Window 2.2 import "../constants" //Rectangle - to allow z-index ordering (for some reason it doesn't work with plain Item) Rectangle { id: splash signal timeout state: "Inivisble" Image { id: splashBG source: "../images/splash_bg.jpeg" anchors { fill: parent } fillMode: Image.PreserveAspectCrop - width: sourceSize.width/num.pixelRatio - height: sourceSize.height/num.pixelRatio + width: sourceSize.width/Num.pixelRatio + height: sourceSize.height/Num.pixelRatio Image { id: kdeLogo source: "../images/kde-logo.png" anchors { right: parent.right top: parent.top margins: 15 } } Image { id: splashLogo source: "../images/splash.png" anchors.centerIn: parent } Text { id: progress color: "#999" anchors { bottom: parent.bottom horizontalCenter: parent.horizontalCenter margins: 5 } } } Connections { target: KStarsData onProgressText: { progress.text = text } } Connections { target: KStarsLite onShowSplash: { splash.state = "Visible" } onDataLoadFinished: { splash.timeout() splash.state = "Invisible" } } states: [ State{ name: "Visible" PropertyChanges{target: splash; opacity: 1.0} PropertyChanges{target: splash; visible: true} }, State{ name:"Invisible" PropertyChanges{target: splash; opacity: 0.0} PropertyChanges{target: splash; visible: false} } ] transitions: [ Transition { from: "Visible" to: "Invisible" SequentialAnimation{ NumberAnimation { target: splash property: "opacity" duration: 800 easing.type: Easing.InOutQuad } NumberAnimation { target: splash property: "visible" duration: 0 } } } ] } diff --git a/kstars/kstarslite/qml/modules/TimePage.qml b/kstars/kstarslite/qml/modules/TimePage.qml index a5b91455b..f17f16165 100644 --- a/kstars/kstarslite/qml/modules/TimePage.qml +++ b/kstars/kstarslite/qml/modules/TimePage.qml @@ -1,580 +1,580 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.6 import QtQuick.Layouts 1.1 import Qt.labs.calendar 1.0 import "../constants" 1.0 KSPage { //Change it to Popup when it will become more stable id: timePopup title: xi18n("Set Time") property date currentDate: new Date() property int userYear: tumblerYear.model[tumblerYear.currentIndex] property int userMonth: tumblerMonth.currentIndex property int userDay: tumblerDay.currentIndex + 1 property int userHour: tumblerHour.currentIndex property int userMinutes: tumblerMinute.currentIndex //property int userWeek: signal updateCalendar() signal updateTumblers() function range(start, end) { var list = []; for (var i = start; i <= end; i++) { list.push(i); } return list } function getWeekNumber(year,month,day) { var d = new Date(year,month,day); d.setHours(0,0,0); // Set to nearest Thursday: current date + 4 - current day number // Make Sunday's day number 7 d.setDate(d.getDate() + 4 - (d.getDay()||7)); // Get first day of year var yearStart = new Date(d.getFullYear(),0,1); // Calculate full weeks to nearest Thursday var weekNo = Math.ceil(( ( (d - yearStart) / 86400000) + 1)/7) // Return array of year and week number return weekNo; } function weeksInYear(year) { var d = new Date(year, 11, 31); var week = getWeekNumber(d)[1]; return week == 1? getWeekNumber(d.setDate(24))[1] : week; } function daysInMonth(month, year) { return new Date(year, month, 0).getDate(); } function setCurrentDate() { currentDate = new Date() tumblerYear.setYear(currentDate.getFullYear()) tumblerMonth.setMonth(currentDate.getMonth()) tumblerDay.setDay(currentDate.getDate()) tumblerHour.setHour(currentDate.getHours()) tumblerMinute.setMinute(currentDate.getMinutes()) tumblerWeek.setWeek(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()) } GridLayout { anchors.centerIn: parent id: timeGrid columnSpacing: 10 flow: !window.isPortrait ? GridLayout.LeftToRight : GridLayout.TopToBottom ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true spacing: 0 RowLayout { anchors { left: parent.left right: parent.right } Button { text: "<" anchors{ left: parent.left verticalCenter: parent.verticalCenter } onClicked: { if(userMonth - 1 == -1) { tumblerMonth.setMonth(11) tumblerYear.setYear(userYear - 1) } else { tumblerMonth.setMonth(userMonth - 1) } } } KSText { font.pointSize: 14 text: Qt.locale().standaloneMonthName(userMonth) + " " + monthGrid.year anchors.centerIn: parent } Button { text: ">" anchors{ verticalCenter: parent.verticalCenter right: parent.right } onClicked: { if(userMonth + 1 == 12) { tumblerMonth.setMonth(0) tumblerYear.setYear(userYear + 1) } else { tumblerMonth.setMonth(userMonth + 1) } } } } GridLayout { id: calendar columns: 2 /*Layout.fillHeight: true Layout.fillWidth: true*/ Layout.minimumHeight: 150 Layout.minimumWidth: 150 /*Layout.maximumHeight: 250 Layout.maximumWidth: 250*/ DayOfWeekRow { Layout.column: 1 Layout.fillWidth: true } WeekNumberColumn { id: weeks month: monthGrid.month year: monthGrid.year locale: monthGrid.locale Layout.fillHeight: true } MonthGrid { id: monthGrid spacing: 0 month: userMonth year: userYear property int day: userDay Layout.fillWidth: true Layout.fillHeight: true delegate: Rectangle { id: rect height: 30 width: 30 color: "#00FFFFFF" - property color highlightColor: num.sysPalette.highlight + property color highlightColor: Num.sysPalette.highlight property int selectedDay // Initialize with userDay Connections { target: timePopup onUserDayChanged: { if(timePopup.userDay == model.day && model.month === monthGrid.month) rect.color = highlightColor else rect.color = "#00FFFFFF" } } border { width: 1 color: "#DCDCDC" } KSText { anchors.centerIn: parent horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter opacity: model.month === monthGrid.month ? 1 : 0.5 text: model.day font: monthGrid.font } MouseArea { anchors.fill: parent onClicked: { if(model.month != monthGrid.month) { monthGrid.month = model.month userMonth = model.month } else { rect.color = highlightColor userDay = model.day } updateTumblers() } } } } } } ColumnLayout { id: tumblersCol GridLayout { id: tumblersGrid //FIX IT: Didn't find a better way to make tumblers smaller property int tumblerWidth: 35 property int tumblerHeight: 50 Layout.fillWidth: true flow: window.isPortrait ? Flow.LeftToRight : Flow.TopToBottom GroupBox { id: dateGB Layout.fillWidth: true RowLayout { anchors { left: parent.left right: parent.right } Layout.fillWidth: true ColumnLayout { KSLabel { id:labelYear text: "Year" } Tumbler { id: tumblerYear implicitHeight: tumblersGrid.tumblerHeight implicitWidth: tumblersGrid.tumblerWidth model: range(1616,2500) anchors.horizontalCenter: labelYear.horizontalCenter property bool setByCalendar: false Connections { target: timePopup onUpdateTumblers: { tumblerYear.setByCalendar = true tumblerYear.setYear(userYear) } } Component.onCompleted: { setYear(currentDate.getFullYear()) } onCurrentIndexChanged: { if(!setByCalendar) { //userDate.setFullYear(model[currentIndex]) updateCalendar() } setByCalendar = false tumblerMonth.checkDays() } function setYear(year) { var index = model.indexOf(year) if(index != -1) currentIndex = index } } } ColumnLayout { Layout.fillHeight: true KSLabel { id:labelMonth text: "Month" } Tumbler { id: tumblerMonth model: range(1,12) implicitHeight: tumblersGrid.tumblerHeight implicitWidth: tumblersGrid.tumblerWidth anchors.horizontalCenter: labelMonth.horizontalCenter property bool setByCalendar: false //implicitWidth: labelMonth.width Component.onCompleted: { setMonth(currentDate.getMonth()) } Connections { target: timePopup onUpdateTumblers: { tumblerMonth.setByCalendar = true tumblerMonth.setMonth(userMonth)//userDate.getMonth()) } } onCurrentIndexChanged: { userMonth = currentIndex checkDays() } //Called whenever we change month or year. Handles number of days in month function rangeDays() { var month = currentIndex+1 var year = tumblerYear.model[tumblerYear.currentIndex] return range(1,daysInMonth(month,year)) } function setMonth(month) { if(month >= 0 && month <= 11) currentIndex = month } function checkDays() { tumblerDay.changeModel(rangeDays()) } } } ColumnLayout { visible: false KSLabel { id:labelWeek text: "Week" } Tumbler { id: tumblerWeek model: range(1,52) anchors.horizontalCenter: labelWeek.horizontalCenter implicitHeight: tumblersGrid.tumblerHeight implicitWidth: tumblersGrid.tumblerWidth property bool setByCalendar: false onCurrentIndexChanged: { if(!setByCalendar) { //Start counting weeks from the beginning of year /*var day = userDay day.setMonth(0) day.setDate(1) day.setDate((currentIndex+1)*7) tumblerMonth.setMonth(day.getMonth()) tumblerDay.setDay(day.getDate()) userDate = day updateCalendar()*/ } setByCalendar = false } Connections { target: timePopup onUpdateTumblers: { tumblerWeek.setByCalendar = true tumblerWeek.setWeek(userYear, userMonth + 1, userDay) } } function setWeek(year, month, day) { currentIndex = getWeekNumber(year, month, day) - 1 } } } ColumnLayout { KSLabel { id:labelDay text: "Day" } Tumbler { id: tumblerDay implicitHeight: tumblersGrid.tumblerHeight implicitWidth: tumblersGrid.tumblerWidth anchors.horizontalCenter: labelDay.horizontalCenter model: range(1,daysInMonth(currentDate.getMonth() + 1,currentDate.getFullYear())) property bool setByCalendar: false function changeModel(newModel) { var prevIndex = currentIndex if(!model || model.length !== newModel.length) { model = newModel if(prevIndex >= 0 && prevIndex < model.length) currentIndex = prevIndex } } Connections { target: timePopup onUpdateTumblers: { tumblerDay.setByCalendar = true tumblerDay.setDay(userDay) } } onCurrentIndexChanged: { userDay = currentIndex + 1 } Component.onCompleted: { setDay(currentDate.getDate()) } function setDay(day) { if(day > 0 && day <= model.length) currentIndex = day - 1 } } } } } RowLayout { anchors { left: parent.left right: parent.right } Button { visible: !window.isPortrait anchors { left: parent.left bottom: parent.bottom } onClicked: { setCurrentDate() } text: "Now" } GroupBox { id: timeGB anchors.right: parent.right RowLayout { Layout.fillWidth: true ColumnLayout { KSLabel { id: labelHour text: "Hour" } Tumbler { id: tumblerHour model: 24 implicitHeight: tumblersGrid.tumblerHeight implicitWidth: tumblersGrid.tumblerWidth anchors.horizontalCenter: labelHour.horizontalCenter delegate: KSText { text: modelData < 10 ? "0" + modelData : modelData font: tumblerHour.font horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter opacity: 1.0 - Math.abs(Tumbler.displacement) / (tumblerHour.visibleItemCount / 2) } Component.onCompleted: { setHour(currentDate.getHours()) } function setHour(hour) { currentIndex = hour } } } ColumnLayout { KSLabel { id:labelMinute text: "Min." } Tumbler { id: tumblerMinute model: 60 implicitHeight: tumblersGrid.tumblerHeight implicitWidth: tumblersGrid.tumblerWidth anchors.horizontalCenter: labelMinute.horizontalCenter delegate: KSText { text: modelData < 10 ? "0" + modelData : modelData font: tumblerHour.font horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter opacity: 1.0 - Math.abs(Tumbler.displacement) / (tumblerHour.visibleItemCount / 2) } Component.onCompleted: { setMinute(currentDate.getMinutes()) } function setMinute(minutes) { currentIndex = minutes } } } } } } } RowLayout { //height: childrenRect.height Layout.fillWidth: true anchors { left: parent.left right: parent.right } Button { visible: window.isPortrait anchors { left: parent.left } onClicked: { setCurrentDate() console.log(Projector) } text: "Now" } Button { visible: !window.isPortrait text: "Ok" anchors { left: parent.left } onClicked: { var date = new Date(userYear, userMonth, userDay, userHour, userMinutes) KStarsLite.slotSetTime(date) notification.showNotification("Setting time to " + date) stackView.pop() } } Row { anchors.right: parent.right spacing: 5 Button { visible: window.isPortrait text: "Ok" onClicked: { var date = new Date(userYear, userMonth, userDay, userHour, userMinutes) KStarsLite.slotSetTime(date) notification.showNotification("Setting time to " + date) stackView.pop() } } Button { text: "Cancel" onClicked: { stackView.pop() } } } } } } } diff --git a/kstars/kstarslite/qml/modules/TopMenu.qml b/kstars/kstarslite/qml/modules/TopMenu.qml index 41e74b387..944ec0954 100644 --- a/kstars/kstarslite/qml/modules/TopMenu.qml +++ b/kstars/kstarslite/qml/modules/TopMenu.qml @@ -1,306 +1,306 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.7 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Universal 2.0 import QtQuick.Window 2.2 import "../constants" 1.0 import "helpers" import KStarsLiteEnums 1.0 ColumnLayout { id: topMenu objectName: "topMenu" property int padding: 10 property double openOffset: -topBar.background.radius //Hide top round corners property double closedOffset: -topBar.height // Hide top bar when closed property string prevState Connections { target: SkyMapLite onSlewingChanged: { if(SkyMapLite.slewing || skyMapLite.automaticMode) { prevState = state state = "hidden" } else { state = prevState } } } state: "closed" property alias state : topMenu.state spacing: padding x: (parent.width - width)/2 Layout.fillHeight: true width: parent.width < menuFlow.childrenWidth ? parent.width : menuFlow.childrenWidth states: [ State { name: "open" PropertyChanges { target: topMenu y: openOffset } }, State { name: "closed" PropertyChanges { target: topMenu y: closedOffset } }, State { name: "hidden" PropertyChanges { target: topMenu y: -topMenu.height } } ] transitions: [ Transition { to: "open" PropertyAnimation { target: topMenu properties: "y"; duration: 300 } }, Transition { to: "closed" PropertyAnimation { target: topMenu properties: "y"; duration: 300 } }, Transition { to: "hidden" PropertyAnimation { target: topMenu properties: "y"; duration: 200 } } ] Pane { id: topBar anchors.horizontalCenter: parent.horizontalCenter implicitWidth: parent.width Layout.fillHeight: true background: Rectangle { id: menuRect - color: num.sysPalette.base + color: Num.sysPalette.base border { width: 2 - color: num.sysPalette.light + color: Num.sysPalette.light } radius: 10 } Flow { id: menuFlow spacing: 5 width: parent.width property double childrenWidth: 0 Component.onCompleted: { if(Qt.platform.os == "android") { //Automatic mode is available only for Android var columnForTab = Qt.createQmlObject('import QtQuick 2.7 import "helpers" TopMenuButton { id: autoModeButton iconSrc: "../../images/kstars_automode.png" title: "Automatic mode" titlePlural: false visible: Qt.platform.os == "android" toggled: SkyMapLite.automaticMode onClicked: { SkyMapLite.automaticMode = !SkyMapLite.automaticMode } }', menuFlow) } for(var i = 0; i < children.length; ++i) { childrenWidth += children[i].width + spacing } childrenWidth += topBar.padding*2 //Account for topBar padding to have enough space for all elements } anchors { top: parent.top topMargin: menuRect.radius/2 // Center vertically menuGrid in background rectangle } Layout.fillHeight: true TopMenuButton { iconSrc: "../../images/kstars_stars.png" title: "Stars" toggled: KStarsLite.isToggled(ObjectsToToggle.Stars) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.Stars, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_deepsky.png" title: "DeepSky Objects" toggled: KStarsLite.isToggled(ObjectsToToggle.DeepSky) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.DeepSky, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_planets.png" title: "Solar System" titlePlural: false toggled: KStarsLite.isToggled(ObjectsToToggle.Planets) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.Planets, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_supernovae.png" title: "Supernovae" toggled: KStarsLite.isToggled(ObjectsToToggle.Supernovae) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.Supernovae, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_satellites.png" title: "Satellites" toggled: KStarsLite.isToggled(ObjectsToToggle.Satellites) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.Satellites, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_clines.png" title: "Constellation Lines" toggled: KStarsLite.isToggled(ObjectsToToggle.CLines) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.CLines, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_cnames.png" title: "Constellation Names" toggled: KStarsLite.isToggled(ObjectsToToggle.CNames) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.CNames, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_constellationart.png" title: "Constellation Art" titlePlural: false toggled: KStarsLite.isToggled(ObjectsToToggle.ConstellationArt) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.ConstellationArt, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_cbound.png" title: "Constellation Bounds" toggled: KStarsLite.isToggled(ObjectsToToggle.CBounds) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.CBounds, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_mw.png" title: "Milky Way" titlePlural: false toggled: KStarsLite.isToggled(ObjectsToToggle.MilkyWay) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.MilkyWay, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_grid.png" title: "Equatorial Grid" titlePlural: false toggled: KStarsLite.isToggled(ObjectsToToggle.EquatorialGrid) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.EquatorialGrid, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_hgrid.png" title: "Horizontal Grid" titlePlural: false toggled: KStarsLite.isToggled(ObjectsToToggle.HorizontalGrid) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.HorizontalGrid, toggled) } } TopMenuButton { iconSrc: "../../images/kstars_horizon.png" title: "Horizon" titlePlural: false toggled: KStarsLite.isToggled(ObjectsToToggle.Ground) onClicked: { KStarsLite.toggleObjects(ObjectsToToggle.Ground, toggled) } } } } Image { id: arrowDown anchors { horizontalCenter: parent.horizontalCenter } state: "open" source: "../images/arrow.png" rotation: { if(topMenu.state == "closed") return 180 else if(topMenu.state == "open") return 0 return rotation //If it state is "hidden" return current rotation } MouseArea { objectName: "arrowDownMouseArea" anchors.fill: parent onPressed: { topMenu.state = topMenu.state == "closed" ? "open" : "closed" } function manualPress() { onPressed(1); } } Behavior on rotation { RotationAnimation { duration: 200; direction: RotationAnimation.Counterclockwise } } } } diff --git a/kstars/kstarslite/qml/modules/helpers/BottomMenuButton.qml b/kstars/kstarslite/qml/modules/helpers/BottomMenuButton.qml index 1d0062f2b..a0ff430e4 100644 --- a/kstars/kstarslite/qml/modules/helpers/BottomMenuButton.qml +++ b/kstars/kstarslite/qml/modules/helpers/BottomMenuButton.qml @@ -1,59 +1,59 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.7 import QtQuick.Controls 2.0 import "../../constants/" 1.0 AbstractButton { id: button property string iconSrc: "" width: icon.width + 5 height: icon.height + 5 Image { id: icon source: iconSrc - width: sourceSize.width/num.pixelRatio - height: sourceSize.height/num.pixelRatio + width: sourceSize.width/Num.pixelRatio + height: sourceSize.height/Num.pixelRatio anchors.centerIn: iconRect } background: Rectangle { id: iconRect radius: 5 anchors { //centerIn: parent fill: parent } color: "black" border { - color: num.sysPalette.light + color: Num.sysPalette.light width: 1 } } onDownChanged: { if(down) opacity = 0.6 else opacity = 1 } onPressed: { opacity = 0.6 } onReleased: { opacity = 1 } Behavior on opacity { OpacityAnimator { duration: 100 } } } diff --git a/kstars/kstarslite/qml/modules/helpers/KSMenuItem.qml b/kstars/kstarslite/qml/modules/helpers/KSMenuItem.qml index 50c1713b4..a7f34e7c5 100644 --- a/kstars/kstarslite/qml/modules/helpers/KSMenuItem.qml +++ b/kstars/kstarslite/qml/modules/helpers/KSMenuItem.qml @@ -1,39 +1,39 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.7 import QtQuick.Controls 2.0 import "../../constants/" 1.0 MenuItem { id: menuItem onVisibleChanged: { //Height stays the same when visible is changed so we update height manually height = visible ? implicitHeight : 0 } contentItem: Text { text: menuItem.text font: menuItem.font - color: num.sysPalette.text + color: Num.sysPalette.text opacity: enabled ? 1.0 : 0.3 } Rectangle { width: parent.width - 10 height: 1 - color: num.sysPalette.light + color: Num.sysPalette.light anchors { bottom: parent.bottom bottomMargin: 5 horizontalCenter: parent.horizontalCenter } } } diff --git a/kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml b/kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml index ab5c495bb..d73056d01 100644 --- a/kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml +++ b/kstars/kstarslite/qml/modules/helpers/PassiveNotification.qml @@ -1,156 +1,156 @@ /* * Copyright 2015 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.5 import QtQuick.Controls 2.0 as Controls import QtQuick.Layouts 1.2 import QtGraphicalEffects 1.0 import "../../constants" 1.0 import "../../modules" MouseArea { id: root z: 9999 width: background.width height: background.height opacity: 0 enabled: appearAnimation.appear anchors { horizontalCenter: parent.horizontalCenter bottom: parent.bottom bottomMargin: units.gridUnit * 4 } function showNotification(message, timeout, actionText, callBack) { if (!message) { return; } appearAnimation.running = false; appearAnimation.appear = true; appearAnimation.running = true; if (timeout == "short") { timer.interval = 1000; } else if (timeout == "long") { timer.interval = 4500; } else if (timeout > 0) { timer.interval = timeout; } else { timer.interval = 3000; } messageLabel.text = message ? message : ""; actionButton.text = actionText ? actionText : ""; actionButton.callBack = callBack ? callBack : ""; timer.restart(); } function hideNotification() { appearAnimation.running = false; appearAnimation.appear = false; appearAnimation.running = true; } onClicked: { appearAnimation.appear = false; appearAnimation.running = true; } transform: Translate { id: transform y: root.height } Timer { id: timer interval: 4000 onTriggered: { appearAnimation.appear = false; appearAnimation.running = true; } } ParallelAnimation { id: appearAnimation property bool appear: true NumberAnimation { target: root properties: "opacity" to: appearAnimation.appear ? 1 : 0 duration: units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: transform properties: "y" to: appearAnimation.appear ? 0 : background.height duration: units.longDuration easing.type: appearAnimation.appear ? Easing.OutQuad : Easing.InQuad } } Item { id: background width: backgroundRect.width + units.gridUnit height: backgroundRect.height + units.gridUnit Rectangle { id: backgroundRect anchors.centerIn: parent radius: units.smallSpacing - color: num.sysPalette.base - border.color: num.sysPalette.light + color: Num.sysPalette.base + border.color: Num.sysPalette.light border.width: 1 opacity: 0.6 width: mainLayout.width + Math.round((height - mainLayout.height)) height: Math.max(mainLayout.height + units.smallSpacing*2, units.gridUnit*2) } RowLayout { id: mainLayout anchors.centerIn: parent KSLabel { id: messageLabel width: Math.min(root.parent.width - units.largeSpacing*2, implicitWidth) } Controls.Button { id: actionButton property var callBack visible: text != "" onClicked: { appearAnimation.appear = false; appearAnimation.running = true; if (callBack) { callBack(); } } } } layer.enabled: true layer.effect: DropShadow { horizontalOffset: 0 verticalOffset: 0 radius: units.gridUnit samples: 32 - color: num.sysPalette.shadow//Qt.rgba(0, 0, 0, 0.5) + color: Num.sysPalette.shadow//Qt.rgba(0, 0, 0, 0.5) } } } diff --git a/kstars/kstarslite/qml/modules/helpers/TimeSpinBox.qml b/kstars/kstarslite/qml/modules/helpers/TimeSpinBox.qml index 8eef469f8..2f814ea26 100644 --- a/kstars/kstarslite/qml/modules/helpers/TimeSpinBox.qml +++ b/kstars/kstarslite/qml/modules/helpers/TimeSpinBox.qml @@ -1,309 +1,309 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.6 import "../../constants" 1.0 SpinBox { id: control from: -41 to: 41 anchors.verticalCenter: parent.verticalCenter editable: false background: Rectangle { implicitWidth: 160 - color: num.sysPalette.base + color: Num.sysPalette.base } contentItem: Text { z: 2 text: control.textFromValue(control.value, control.locale) anchors.verticalCenter: parent.verticalCenter font: control.font - color: num.sysPalette.text + color: Num.sysPalette.text horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter } property int spacingg: 0 Connections { target: up onPressed: { console.log(up.pressed) } } up.indicator: Rectangle { z: 0 x: control.mirrored ? -spacingg : parent.width - width + spacingg anchors.verticalCenter: parent.verticalCenter implicitWidth: 37 implicitHeight: 37 - color: up.pressed || !enabled ? num.sysPalette.light : num.sysPalette.base - border.color: up.pressed || !enabled ? num.sysPalette.base : num.sysPalette.light + color: up.pressed || !enabled ? Num.sysPalette.light : Num.sysPalette.base + border.color: up.pressed || !enabled ? Num.sysPalette.base : Num.sysPalette.light radius: 5 Text { z: 1 text: "+" font.pixelSize: control.font.pixelSize * 2 - color: up.pressed || !enabled ? num.sysPalette.dark : num.sysPalette.text + color: up.pressed || !enabled ? Num.sysPalette.dark : Num.sysPalette.text anchors.fill: parent fontSizeMode: Text.Fit horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } } down.indicator: Rectangle { z: 0 x: control.mirrored ? parent.width - width + spacingg : -spacingg anchors.verticalCenter: parent.verticalCenter implicitWidth: 37 implicitHeight: 37 - color: down.pressed || !enabled ? num.sysPalette.light : num.sysPalette.base - border.color: down.pressed || !enabled ? num.sysPalette.base : num.sysPalette.light + color: down.pressed || !enabled ? Num.sysPalette.light : Num.sysPalette.base + border.color: down.pressed || !enabled ? Num.sysPalette.base : Num.sysPalette.light radius: 5 Text { text: "-" font.pixelSize: control.font.pixelSize * 2 - color: down.pressed || !enabled ? num.sysPalette.dark : num.sysPalette.text + color: down.pressed || !enabled ? Num.sysPalette.dark : Num.sysPalette.text anchors.fill: parent fontSizeMode: Text.Fit horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } } property bool daysOnly: false onDaysOnlyChanged: { setDaysOnly() } Component.onCompleted: { setDaysOnly() } property double secs_per_day: 86400.0 property double sidereal_year: 31558149.77 property double tropical_year: 31556925.19 property var timeString: [] property var timeScale: [] //TimeUnit control property int unitValue: 1 property int allunits: 8 property int dayunits: 5 property int minUnitValue property int maxUnitValue property var unitStep: [] function setDaysOnly() { var i = 0; //index for timeScale values timeScale[0] = 0.0 if(!daysOnly) { timeScale[1] = 0.1; // 0.1 sec timeScale[2] = 0.25; // 0.25 sec timeScale[3] = 0.5; // 0.5 sec timeScale[4] = 1.0; // 1 sec (real-time) timeScale[5] = 2.0; // 2 sec timeScale[6] = 5.0; // 5 sec timeScale[7] = 10.0; // 10 sec timeScale[8] = 20.0; // 20 sec timeScale[9] = 30.0; // 30 sec timeScale[10] = 60.0; // 1 min timeScale[11] = 120.0; // 2 min timeScale[12] = 300.0; // 5 min timeScale[13] = 600.0; // 10 min timeScale[14] = 900.0; // 15 min timeScale[15] = 1800.0; // 30 min timeScale[16] = 3600.0; // 1 hr timeScale[17] = 7200.0; // 2 hr timeScale[18] = 10800.0; // 3 hr timeScale[19] = 21600.0; // 6 hr timeScale[20] = 43200.0; // 12 hr i = 20; } timeScale[i+1] = 86164.1; // 23 hr 56 min timeScale[i+2] = secs_per_day; // 1 day timeScale[i+3] = 2.*secs_per_day; // 2 days timeScale[i+4] = 3.*secs_per_day; // 3 days timeScale[i+5] = 5.*secs_per_day; // 5 days timeScale[i+6] = 7.*secs_per_day; // 1 week timeScale[i+7] = 14.*secs_per_day; //2 weeks timeScale[i+8] = 21.*secs_per_day; //3 weeks //Months aren't a simple measurement of time; I'll just use fractions of a year timeScale[i+9] = sidereal_year/12.0; // 1 month timeScale[i+10] = sidereal_year/6.0; // 2 months timeScale[i+11] = 0.25*sidereal_year; // 3 months timeScale[i+12] = sidereal_year/3.0; // 4 months timeScale[i+13] = 0.5*sidereal_year; // 6 months timeScale[i+14] = 0.75*sidereal_year; // 9 months timeScale[i+15] = sidereal_year; // 1 year timeScale[i+16] = 2.0*sidereal_year; // 2 years timeScale[i+17] = 3.0*sidereal_year; // 3 years timeScale[i+18] = 5.0*sidereal_year; // 5 years timeScale[i+19] = 10.0*sidereal_year; // 10 years timeScale[i+20] = 25.0*sidereal_year; // 25 years timeScale[i+21] = 50.0*sidereal_year; // 50 years timeScale[i+22] = 100.0*sidereal_year; // 100 years timeString = [] if ( ! daysOnly ) { timeString.push( "0 " + i18np( "seconds", "secs" )); timeString.push( "0.1 " + i18np( "seconds", "secs" )); timeString.push( "0.25 " + i18np( "seconds", "secs" )); timeString.push( "0.5 " + i18np( "seconds", "secs" )); timeString.push( "1 " + i18np( "second", "sec" )); timeString.push( "2 " + i18np( "seconds", "secs" )); timeString.push( "5 " + i18np( "seconds", "secs" )); timeString.push( "10 " + i18np( "seconds", "secs" )); timeString.push( "20 " + i18np( "seconds", "secs" )); timeString.push( "30 " + i18np( "seconds", "secs" )); timeString.push( "1 " + i18np( "minute", "min" )); timeString.push( "2 " + i18np( "minutes", "mins" )); timeString.push( "5 " + i18np( "minutes", "mins" )); timeString.push( "10 " + i18np( "minutes", "mins" )); timeString.push( "15 " + i18np( "minutes", "mins" )); timeString.push( "30 " + i18np( "minutes", "mins" )); timeString.push( "1 " +xi18n( "hour" )); timeString.push( "2 " + i18np( "hours", "hrs" )); timeString.push( "3 " + i18np( "hours", "hrs" )); timeString.push( "6 " + i18np( "hours", "hrs" )); timeString.push( "12 " + i18np( "hours", "hrs" )); } else { timeString.push( "0 " +xi18n( "days" )); } timeString.push( "1 " + i18np( "sidereal day", "sid day" )); timeString.push( "1 " +xi18n( "day" )); timeString.push( "2 " +xi18n( "days" )); timeString.push( "3 " +xi18n( "days" )); timeString.push( "5 " +xi18n( "days" )); timeString.push( "1 " +xi18n( "week" )); timeString.push( "2 " + i18np( "weeks", "wks" )); timeString.push( "3 " + i18np( "weeks", "wks" )); timeString.push( "1 " +xi18n( "month" )); timeString.push( "2 " + i18np( "months", "mths" )); timeString.push( "3 " + i18np( "months", "mths" )); timeString.push( "4 " + i18np( "months", "mths" )); timeString.push( "6 " + i18np( "months", "mths" )); timeString.push( "9 " + i18np( "months", "mths" )); timeString.push( "1 " + xi18n( "year" )); timeString.push( "2 " + i18np( "years", "yrs" )); timeString.push( "3 " + i18np( "years", "yrs" )); timeString.push( "5 " + i18np( "years", "yrs" )); timeString.push( "10 " + i18np( "years", "yrs" )); timeString.push( "25 " + i18np( "years", "yrs" )); timeString.push( "50 " + i18np( "years", "yrs" )); timeString.push( "100 " + i18np( "years", "yrs" )); if ( !daysOnly ) { from = -41 to = 41 } else { from = -21 to = 21 } if ( daysOnly ) { minUnitValue = 1-dayunits maxUnitValue = dayunits-1 unitValue = 1 // Start out with days units unitStep[0] = 0; unitStep[1] = 1; unitStep[2] = 5; unitStep[3] = 8; unitStep[4] = 14; } else { minUnitValue = 1-allunits maxUnitValue = allunits-1 unitValue = 1 // Start out with seconds units unitStep[0] = 0; unitStep[1] = 4; unitStep[2] = 10; unitStep[3] = 16; unitStep[4] = 21; unitStep[5] = 25; unitStep[6] = 28; unitStep[7] = 34; } value = 4 } function increaseTimeUnit() { if(unitValue < maxUnitValue) { unitValue = unitValue + 1 value = getUnitValue() } } function decreaseTimeUnit() { if(unitValue > minUnitValue) { unitValue = unitValue - 1 value = getUnitValue() } } function getUnitValue() { var uval; if ( unitValue >= 0 ) uval = unitStep[ unitValue ]; else uval = -1*unitStep[ Math.abs( unitValue ) ]; return uval; } function unitValueFromNum( val ) { if ( val >= 0 ) return unitStep[ val ]; else return -1*unitStep[ Math.abs( val ) ]; } function getTimeScale() { return value > 0 ? timeScale[ value ] : -1.*timeScale[ Math.abs(value) ]; } function reportChange() { console.log("Reporting new timestep value: " + getTimeScale()) KStarsLite.scaleChanged( getTimeScale() ) } textFromValue: function(value) { var result var posval = Math.abs( value ) if ( posval > timeString.length - 1 ) posval = 4; result = timeString[ posval ]; if ( value < 0 ) { result = '-' + result; } reportChange() return result; } valueFromText: function(text) { for (var i = 0; i < timeString.length; ++i) { if (text === timeString[i]) return i if (text.substring(1) === timeString[i]) return -1*i } return 0 } } diff --git a/kstars/kstarslite/qml/modules/helpers/TopMenuButton.qml b/kstars/kstarslite/qml/modules/helpers/TopMenuButton.qml index ffbccaf6b..f341bbd7d 100644 --- a/kstars/kstarslite/qml/modules/helpers/TopMenuButton.qml +++ b/kstars/kstarslite/qml/modules/helpers/TopMenuButton.qml @@ -1,101 +1,101 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.6 import QtQuick.Controls 2.0 import QtGraphicalEffects 1.0 import "../../constants/" 1.0 AbstractButton { id: button property string iconSrc: "" width: icon.width + 5 height: icon.height + 5 property bool toggled: false opacity: toggled ? 1 : 0.3 property string title: " " property bool titlePlural: true onClicked: { toggled = !toggled } onToggledChanged: { if(isLoaded) { //Disable while loading if(toggled) { if(titlePlural) { notification.showNotification(xi18n("%1 are toggled on", title)) } else { notification.showNotification(xi18n("%1 is toggled on", title)) } } else { if(titlePlural) { notification.showNotification(xi18n("%1 are toggled off", title)) } else { notification.showNotification(xi18n("%1 is toggled off", title)) } } } } DropShadow { anchors.fill: iconRect radius: 8.0 samples: 16 horizontalOffset: 0 verticalOffset: 0 color: "#000000" source: iconRect opacity: pressed ? 1 : 0 Behavior on opacity { OpacityAnimator { duration: 100 } } } Image { id: icon source: iconSrc - width: sourceSize.width/num.pixelRatio //FIX /num.pixelRatio we don't need it here! - height: sourceSize.height/num.pixelRatio + width: sourceSize.width/Num.pixelRatio //FIX /Num.pixelRatio we don't need it here! + height: sourceSize.height/Num.pixelRatio anchors.centerIn: iconRect } background: Rectangle { id: iconRect radius: 5 anchors { fill: parent } color: "black" border { - color: toggled ? num.sysPalette.highlight : "grey" + color: toggled ? Num.sysPalette.highlight : "grey" width: 1 } } onDownChanged: { /*if(down) opacity = 0.6 else opacity = 1*/ } onPressed: { //opacity = 0.6 } onReleased: { //opacity = 1 } Behavior on opacity { OpacityAnimator { duration: 100 } } } diff --git a/kstars/kstarslite/qml/modules/menus/ContextMenu.qml b/kstars/kstarslite/qml/modules/menus/ContextMenu.qml index 4ec896d23..15d08366d 100644 --- a/kstars/kstarslite/qml/modules/menus/ContextMenu.qml +++ b/kstars/kstarslite/qml/modules/menus/ContextMenu.qml @@ -1,146 +1,146 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.7 import QtQuick.Layouts 1.1 import "../../constants" 1.0 import "../helpers" import "../../modules" Menu { id: contextMenu modal: true transformOrigin: Menu.Center padding: 5 background: Rectangle { implicitWidth: 200 - color: num.sysPalette.base + color: Num.sysPalette.base radius: 5 } property bool isPoint: false function openPoint() { isPoint = true open() } function openObject() { isPoint = false open() } Column { width: parent.width spacing: 10 KSLabel { id: objectName text: isPoint ? xi18n("Empty Sky") : SkyMapLite.clickedObjectLite.translatedName wrapMode: Label.WrapAtWordBoundaryOrAnywhere width: parent.width font.pointSize: 12 anchors { left: parent.left leftMargin: 10 } } Rectangle { - color: num.sysPalette.light + color: Num.sysPalette.light width: parent.width - 10 height: 1 anchors { horizontalCenter: parent.horizontalCenter } } } KSMenuItem { text: xi18n("Center and Track") onTriggered: { contextMenu.close() SkyMapLite.slotCenter() SkyMapLite.centerLocked = true } } KSMenuItem { visible: !isPoint text: xi18n("Details") onTriggered: stackView.push(detailsDialog) } Item { id: hSpacer height: telescopeCol.isTelescope ? 15 : 0 } ColumnLayout { id: telescopeCol width: parent.width spacing: 10 /*If we don't set height to 0 when telescope is not connected there will be some blank space in the bottom of menu*/ height: isTelescope ? implicitHeight : 0 property bool isTelescope: telescope == null ? false : true property var telescope: null Connections { target: ClientManagerLite onTelescopeAdded: { if(!telescopeCol.isTelescope) { telescopeCol.telescope = newTelescope telescopeName.text = newTelescope.deviceName } } onTelescopeRemoved: { telescopeCol.telescope = null } } KSText { id: telescopeName visible: telescopeCol.isTelescope wrapMode: Text.Wrap font.pointSize: 12 anchors { left: parent.left leftMargin: 10 } } Rectangle { - color: num.sysPalette.light + color: Num.sysPalette.light visible: telescopeCol.isTelescope width: parent.width - 10 height: 1 anchors { horizontalCenter: parent.horizontalCenter } } } KSMenuItem { visible: telescopeCol.isTelescope text: xi18n("Slew") onTriggered: telescopeCol.telescope.slew(SkyMapLite.clickedObjectLite) } KSMenuItem { visible: telescopeCol.isTelescope text: xi18n("Sync") onTriggered: telescopeCol.telescope.sync(SkyMapLite.clickedObjectLite) } } diff --git a/kstars/kstarslite/qml/modules/popups/ColorSchemePopup.qml b/kstars/kstarslite/qml/modules/popups/ColorSchemePopup.qml index b83021148..bf2876241 100644 --- a/kstars/kstarslite/qml/modules/popups/ColorSchemePopup.qml +++ b/kstars/kstarslite/qml/modules/popups/ColorSchemePopup.qml @@ -1,95 +1,95 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.6 import QtQuick.Layouts 1.1 import "../../constants" 1.0 import "../../modules" import QtQuick.Controls.Material 2.0 Popup { //Change it to Popup when it will become more stable id: colorSPopup focus: true modal: true height: parent.height > colorsList.implicitHeight ? colorsList.implicitHeight : parent.height signal colorSchemeChanged() property string currentCScheme: colorsModel.get(colorsList.currentIndex).scheme onCurrentCSchemeChanged: { updateTheme(currentCScheme) } function updateTheme(colorScheme) { if ( Qt.platform.os == "android" ) { if ( colorScheme == "cs_night") { window.Material.theme = Material.Dark //On Android we want to have dark theme only for cs_night } else { window.Material.theme = Material.Light //Light theme for all other color schemes as on Android they are light } } else { window.Material.theme = Material.Dark //Dark theme is suitable for all color themes } } function formatColorScheme(schemeName) { return schemeName.substring(3) + ".colors" } background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } KSListView { id: colorsList anchors.centerIn: parent checkCurrent: true model: ListModel { id: colorsModel Component.onCompleted: { append({ name: xi18n("Classic"), scheme: "cs_classic" }); append({ name: xi18n("Star Chart"), scheme: "cs_chart" }); append({ name: xi18n("Night Vision"), scheme: "cs_night" }); append({ name: xi18n("Moonless Night"), scheme: "cs_moonless-night" }); } } Connections { target: KStarsLite onDataLoadFinished: { //Set current index to current scheme color var colorScheme = KStarsData.colorSchemeName() for(var i = 0; i < colorsList.model.count; ++i) { if(formatColorScheme(colorsList.model.get(i).scheme) == colorScheme) { colorsList.currentIndex = i //KStarsLite.loadColorScheme(colorScheme) } } } } onClicked: { var item = colorsModel.get(colorsList.currentIndex) KStarsLite.loadColorScheme(formatColorScheme(item.scheme)); notification.showNotification("Set color scheme to " + item.name) colorSchemeChanged() close() } textRole: "name" } } diff --git a/kstars/kstarslite/qml/modules/popups/FOVPopup.qml b/kstars/kstarslite/qml/modules/popups/FOVPopup.qml index a22b41cf0..a10706e58 100644 --- a/kstars/kstarslite/qml/modules/popups/FOVPopup.qml +++ b/kstars/kstarslite/qml/modules/popups/FOVPopup.qml @@ -1,42 +1,42 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.6 import QtQuick.Layouts 1.1 import "../../constants" 1.0 import "../../modules" import KStarsLiteEnums 1.0 Popup { id: fovPopup focus: true modal: true width: fovList.implicitWidth height: parent.height > fovList.implicitHeight ? fovList.implicitHeight : parent.height background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } KSListView { id: fovList anchors { fill: parent centerIn: parent } checkable: true model: SkyMapLite.FOVSymbols onClicked: { SkyMapLite.setFOVVisible(index, checked) } } } diff --git a/kstars/kstarslite/qml/modules/popups/ProjectionsPopup.qml b/kstars/kstarslite/qml/modules/popups/ProjectionsPopup.qml index 28842bce3..8d811da1b 100644 --- a/kstars/kstarslite/qml/modules/popups/ProjectionsPopup.qml +++ b/kstars/kstarslite/qml/modules/popups/ProjectionsPopup.qml @@ -1,67 +1,67 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick.Controls 2.0 import QtQuick 2.6 import QtQuick.Layouts 1.1 import "../../constants" 1.0 import "../../modules" import KStarsLiteEnums 1.0 Popup { id: projPopup focus: true modal: true width: projList.implicitWidth height: parent.height > projList.implicitHeight ? projList.implicitHeight : parent.height background: Rectangle { anchors.fill: parent - color: num.sysPalette.base + color: Num.sysPalette.base } KSListView { id: projList anchors { fill: parent centerIn: parent } checkCurrent: true model: ListModel { id: projModel Component.onCompleted: { projModel.append({ name: xi18n("Lambert (Default)"), proj: Projection.Lambert }); projModel.append({ name: xi18n("Azimuthal Equidistant"), proj: Projection.AzimuthalEquidistant }); projModel.append({ name: xi18n("Orthographic"), proj: Projection.Orthographic }); projModel.append({ name: xi18n("Equirectangular"), proj: Projection.Equirectangular }); projModel.append({ name: xi18n("Stereographic"), proj: Projection.Stereographic }); projModel.append({ name: xi18n("Gnomonic"), proj: Projection.Gnomonic }); //Initialize projector for(var i = 0; i < projList.model.count; ++i) { if(projList.model.get(i).proj == SkyMapLite.projType()) { projList.currentIndex = i } } } } onClicked: { var item = projModel.get(projList.currentIndex) KStarsLite.setProjection(item.proj) notification.showNotification("Set projection system to " + item.name) close() } textRole: "name" } } diff --git a/kstars/kstarslite/qml/modules/tutorial/TutorialPopup.qml b/kstars/kstarslite/qml/modules/tutorial/TutorialPopup.qml index 366680216..5ecaf215d 100644 --- a/kstars/kstarslite/qml/modules/tutorial/TutorialPopup.qml +++ b/kstars/kstarslite/qml/modules/tutorial/TutorialPopup.qml @@ -1,81 +1,81 @@ // Copyright (C) 2016 Artem Fedoskin /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Universal 2.0 import QtQuick.Window 2.2 as Window import QtQuick.Layouts 1.1 import "../../constants" 1.0 import "../../modules" Popup { id: studyMode contentWidth: parent.width * 0.75 focus: true modal: true background: Rectangle { - color: num.sysPalette.base + color: Num.sysPalette.base } Column { id: studyCol width: parent.width height: childrenRect.height KSLabel { width: parent.width wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter text: xi18n("Welcome to KStars Lite!") font.pointSize: 20 } KSText { width: parent.width wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter text: xi18n("KStars Lite is a free, open source, cross-platform Astronomy Software designed for mobile devices.") } KSText { width: parent.width wrapMode: Text.Wrap horizontalAlignment: Text.AlignHCenter text: xi18n("A quick tutorial will introduce you to main functions of KStars Lite") } Flow { property int buttonWidth: children[0].width + children[1].width + spacing * 2 width: parent.width > buttonWidth ? buttonWidth : parent.width spacing: 5 anchors.horizontalCenter: parent.horizontalCenter Button { text: xi18n("Close") onClicked: askExitTutorial() } Button { text: xi18n("Start tutorial") onClicked: { studyMode.close() step1 = true } } } } }