Kstars

SkyMapLiteWrapper.qml
1 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <[email protected]>
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 
4 import QtQuick 2.6
5 import QtQuick.Controls 2.0
6 
7 import "../constants" 1.0
8 import "helpers"
9 import "tutorial"
10 
11 Item {
12  id: skyMapLiteItem
13  visible: isLoaded
14  property alias notification: notification
15 
16  Rectangle {
17  id: skyMapLiteWrapper
18  objectName: "skyMapLiteWrapper"
19  width: parent.width
20  height: parent.height
21  color: KStarsLite.getColor("SkyColor")
22 
23  Connections {
24  target: colorSchemePopup
25  onColorSchemeChanged: {
26  skyMapLiteWrapper.color = KStarsLite.getColor("SkyColor")
27  }
28  }
29 
30  Connections {
31  target: stackView
32  onCurrentItemChanged: {
33  if(stackView.currentItem != initPage) {
34  //Workaround to make animation on push from / and pop to initPage faster
35  //skyMapLiteWrapper.anchors.fill = null
36  skyMapLiteWrapper.width = 0
37  skyMapLiteWrapper.height = 0
38  skyMapLite.visible = false
39  }
40  }
41  onBusyChanged: {
42  if(stackView.currentItem == initPage) {
43  skyMapLite.visible = true
44  skyMapLiteWrapper.width = Qt.binding(function() {return skyMapLite.width})
45  skyMapLiteWrapper.height = Qt.binding(function() {return skyMapLite.height})
46  }
47  }
48  }
49 
50  Button {
51  z: 1
52  visible: SkyMapLite.centerLocked
53  anchors {
54  right: parent.right
55  top: parent.top
56  margins: 25
57  }
58  onClicked: {
59  SkyMapLite.centerLocked = false
60  }
61  onPressedChanged: {
62  if(pressed)
63  lockBG.color = "#D40000"
64  else
65  lockBG.color = "red"
66  }
67 
68  background: Rectangle {
69  id: lockBG
70  color: "red"
71  implicitWidth: 100
72  implicitHeight: 70
73  radius: 4
74  border.width: 3
75  border.color: "#AA0000"
76  }
77 
78  Image {
79  source: "../images/lock-closed.png"
80  anchors.centerIn: parent
81  }
82  }
83 
84  Button {
85  z: 1
86  id: exitAutomaticMode
87  visible: SkyMapLite.automaticMode
88  anchors {
89  left: parent.left
90  top: parent.top
91  margins: 25
92  }
93 
94  Image {
95  source: "../images/back.png"
96  anchors.centerIn: parent
97  }
98 
99  onClicked: {
100  SkyMapLite.automaticMode = false
101  }
102  }
103 
104  /** Circle that appears after user taps on screen **/
105  Rectangle {
106  id: tapCircle
107  z: 1
108  width: 20 * Num.dp
109  radius: width*0.5
110  height: width
111  color: "grey"
112  opacity: 0
113 
114  Connections {
115  target: SkyMapLite
116  onPosClicked: {
117  tapCircle.x = pos.x - tapCircle.width * 0.5
118  tapCircle.y = pos.y - tapCircle.height * 0.5
119  tapAnimation.start()
120  }
121  onPointLiteChanged: {
122  contextMenu.openPoint()
123  }
124 
125  onObjectLiteChanged: {
126  contextMenu.openObject()
127  }
128  }
129 
130  SequentialAnimation on opacity {
131  id: tapAnimation
132  OpacityAnimator { from: 0; to: 0.8; duration: 100 }
133  OpacityAnimator { from: 0.8; to: 0; duration: 400 }
134  }
135  }
136  }
137 
138  TopMenu {
139  id: topMenu
140  }
141 
142  //Step 3 - Top Menu
143  TutorialStep3 {
144  anchors {
145  top: topMenu.bottom
146  }
147  }
148 
149  PassiveNotification {
150  z: 2
151  height: 10
152  id: notification
153  visible: true
154  anchors {
155  bottom: bottomMenu.top
156  horizontalCenter: parent.horizontalCenter
157  }
158 
159  Connections {
160  target: KStarsLite
161  onNotificationMessage: {
162  skyMapLite.notification.showNotification(msg)
163  }
164  }
165  }
166 
167  BottomMenu {
168  id: bottomMenu
169  }
170 
171  //Step 4 - Bottom Menu
172  TutorialStep4 {
173  anchors{
174  bottom: bottomMenu.top
175  }
176  }
177 }
QTextStream & right(QTextStream &stream)
bool centerLocked
true if SkyMapLite is centered on an object and only pinch-to-zoom needs to be available
Definition: skymaplite.h:74
This class loads QML files and connects SkyMapLite and KStarsData Unlike KStars class it is not a mai...
Definition: kstarslite.h:46
Q_INVOKABLE QColor getColor(QString name)
returns color with key name from current color scheme
Definition: kstarslite.cpp:405
QTextStream & left(QTextStream &stream)
QTextStream & left(QTextStream &s)
QTextStream & right(QTextStream &s)
Item for displaying sky objects; also handles user interaction events.
Definition: skymaplite.h:58
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.