Warning, /education/kstars/kstars/kstarslite/qml/modules/menus/ContextMenu.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003
0004 import QtQuick.Controls 2.0
0005 import QtQuick 2.7
0006 import QtQuick.Layouts 1.1
0007 import "../../constants" 1.0
0008 import "../helpers"
0009 import "../../modules"
0010
0011 Menu {
0012 id: contextMenu
0013 modal: true
0014 transformOrigin: Menu.Center
0015 padding: 5
0016 background: Rectangle {
0017 implicitWidth: 200
0018 color: Num.sysPalette.base
0019 radius: 5
0020 }
0021
0022 property bool isPoint: false
0023
0024 function openPoint() {
0025 isPoint = true
0026 open()
0027 }
0028
0029 function openObject() {
0030 isPoint = false
0031 open()
0032 }
0033
0034 Column {
0035 width: parent.width
0036 spacing: 10
0037
0038 KSLabel {
0039 id: objectName
0040 text: isPoint ? xi18n("Empty Sky") : SkyMapLite.clickedObjectLite.translatedName
0041 wrapMode: Label.WrapAtWordBoundaryOrAnywhere
0042 width: parent.width
0043 font.pointSize: 12
0044 anchors {
0045 left: parent.left
0046 leftMargin: 10
0047 }
0048 }
0049
0050 Rectangle {
0051 color: Num.sysPalette.light
0052 width: parent.width - 10
0053 height: 1
0054 anchors {
0055 horizontalCenter: parent.horizontalCenter
0056 }
0057 }
0058 }
0059
0060 KSMenuItem {
0061 text: xi18n("Center and Track")
0062 onTriggered: {
0063 contextMenu.close()
0064 SkyMapLite.slotCenter()
0065 SkyMapLite.centerLocked = true
0066 }
0067 }
0068
0069 KSMenuItem {
0070 visible: !isPoint
0071 text: xi18n("Details")
0072 onTriggered: stackView.push(detailsDialog)
0073 }
0074
0075 Item {
0076 id: hSpacer
0077 height: telescopeCol.isTelescope ? 15 : 0
0078 }
0079
0080 ColumnLayout {
0081 id: telescopeCol
0082 width: parent.width
0083 spacing: 10
0084 /*If we don't set height to 0 when telescope is not connected there will be some blank space in the bottom
0085 of menu*/
0086 height: isTelescope ? implicitHeight : 0
0087
0088 property bool isTelescope: telescope == null ? false : true
0089 property var telescope: null
0090
0091 Connections {
0092 target: ClientManagerLite
0093
0094 onTelescopeAdded: {
0095 if(!telescopeCol.isTelescope) {
0096 telescopeCol.telescope = newTelescope
0097 telescopeName.text = newTelescope.deviceName
0098 }
0099 }
0100
0101 onTelescopeRemoved: {
0102 telescopeCol.telescope = null
0103 }
0104 }
0105
0106 KSText {
0107 id: telescopeName
0108 visible: telescopeCol.isTelescope
0109 wrapMode: Text.Wrap
0110 font.pointSize: 12
0111 anchors {
0112 left: parent.left
0113 leftMargin: 10
0114 }
0115 }
0116
0117 Rectangle {
0118 color: Num.sysPalette.light
0119 visible: telescopeCol.isTelescope
0120 width: parent.width - 10
0121 height: 1
0122 anchors {
0123 horizontalCenter: parent.horizontalCenter
0124 }
0125 }
0126 }
0127
0128 KSMenuItem {
0129 visible: telescopeCol.isTelescope
0130 text: xi18n("Slew")
0131 onTriggered: telescopeCol.telescope.slew(SkyMapLite.clickedObjectLite)
0132 }
0133
0134 KSMenuItem {
0135 visible: telescopeCol.isTelescope
0136 text: xi18n("Sync")
0137 onTriggered: telescopeCol.telescope.sync(SkyMapLite.clickedObjectLite)
0138 }
0139 }