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

0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.7
0005 import QtQuick.Window 2.2
0006 import QtQuick.Controls 2.0
0007 import QtQuick.Layouts 1.3
0008 import "helpers"
0009 import "menus"
0010 import "../modules"
0011 import "../constants" 1.0
0012 
0013 KSPage {
0014     title: SkyMapLite.clickedObjectLite.translatedName + " - " + tabBar.currentItem.text
0015     Item {
0016         anchors.fill: parent
0017 
0018         TabBar {
0019             id: tabBar
0020             property bool isTab: true
0021             spacing: 20
0022             currentIndex: detailsSwipeView.currentIndex
0023             anchors {
0024                 top: parent.top
0025                 left: parent.left
0026                 right: parent.right
0027             }
0028             background: Rectangle {
0029                 anchors.fill: parent
0030                 color: Num.sysPalette.base
0031             }
0032 
0033             KSTabButton {
0034                 text: xi18n("General")
0035             }
0036 
0037             KSTabButton {
0038                 text: xi18n("Position")
0039             }
0040 
0041             KSTabButton {
0042                 Component.onCompleted: {
0043                     var oldParent = parent
0044                     parent = Qt.binding(function() { return DetailDialogLite.isLinksOn ? oldParent : null })
0045                 }
0046 
0047                 text: xi18n("Links")
0048             }
0049 
0050             KSTabButton {
0051                 Component.onCompleted: {
0052                     var oldParent = parent
0053                     parent = Qt.binding(function() { return DetailDialogLite.isLogOn ? oldParent : null })
0054                 }
0055                 text: xi18n("Log")
0056             }
0057         }
0058 
0059         SwipeView {
0060             id: detailsSwipeView
0061             anchors {
0062                 top:tabBar.bottom
0063                 topMargin: 10
0064                 left: parent.left
0065                 right: parent.right
0066                 bottom: parent.bottom
0067             }
0068 
0069             currentIndex: tabBar.currentIndex
0070             clip: true
0071 
0072             Pane {
0073                 clip: true
0074 
0075                 background: Rectangle {
0076                     anchors.fill: parent
0077                     color: Num.sysPalette.base
0078                 }
0079 
0080                 Flickable {
0081                     anchors.fill: parent
0082                     ScrollBar.vertical: ScrollBar { }
0083                     flickableDirection: Flickable.VerticalFlick
0084 
0085                     contentHeight: generalCol.height
0086 
0087                     Column {
0088                         id: generalCol
0089                         width: parent.width
0090                         spacing: 15
0091 
0092                         KSText {
0093                             text: DetailDialogLite.name
0094                             font.pointSize: 16
0095                             width: parent.width
0096                             wrapMode: Text.Wrap
0097                             horizontalAlignment: Text.AlignHCenter
0098                         }
0099 
0100                         Image {
0101                             source: DetailDialogLite.thumbnail
0102                             anchors.horizontalCenter: parent.horizontalCenter
0103                         }
0104 
0105                         KSText {
0106                             text: DetailDialogLite.typeInConstellation
0107                             anchors.horizontalCenter: parent.horizontalCenter
0108                             font.pointSize: 12
0109                         }
0110 
0111                         Column {
0112                             id: telescopesCol
0113                             width: parent.width
0114                             property var telescopeControls: []
0115 
0116                             Connections {
0117                                 target: ClientManagerLite
0118                                 onTelescopeAdded: {
0119                                     var controls = Qt.createComponent("helpers/TelescopeControl.qml")
0120                                     var controlsObj = controls.createObject(telescopesCol)
0121                                     controlsObj.telescope = newTelescope
0122                                     telescopesCol.telescopeControls.push(controlsObj)
0123 
0124                                 }
0125 
0126                                 onTelescopeRemoved: {
0127                                     for(var i = 0; i < telescopesCol.telescopeControls.length; ++i) {
0128                                         if(telescopesCol.telescopeControls[i].telescope == delTelescope) {
0129                                             telescopesCol.telescopeControls[i].parent = null
0130                                             telescopesCol.telescopeControls[i].destroy()
0131                                         }
0132                                     }
0133                                 }
0134                             }
0135                         }
0136 
0137                         DetailsItem {
0138                             label: xi18n("Magnitude")
0139                             value: DetailDialogLite.magnitude
0140                         }
0141 
0142                         DetailsItem {
0143                             label: xi18n("Distance")
0144                             value: DetailDialogLite.distance
0145                         }
0146 
0147                         DetailsItem {
0148                             label: xi18n("B - V Index")
0149                             value: DetailDialogLite.BVindex
0150                         }
0151 
0152                         DetailsItem {
0153                             label: xi18n("Size")
0154                             value: DetailDialogLite.angSize
0155                         }
0156 
0157                         DetailsItem {
0158                             label: xi18n("Illumination")
0159                             value: DetailDialogLite.illumination
0160                         }
0161 
0162                         DetailsItem {
0163                             label: xi18n("Perihelion")
0164                             value: DetailDialogLite.perihelion
0165                         }
0166 
0167                         DetailsItem {
0168                             label: xi18n("OrbitID")
0169                             value: DetailDialogLite.orbitID
0170                         }
0171 
0172                         DetailsItem {
0173                             label: xi18n("NEO")
0174                             value: DetailDialogLite.NEO
0175                         }
0176 
0177                         DetailsItem {
0178                             label: xi18n("Diameter")
0179                             value: DetailDialogLite.diameter
0180                         }
0181 
0182                         DetailsItem {
0183                             label: xi18n("Rotation period")
0184                             value: DetailDialogLite.rotation
0185                         }
0186 
0187                         DetailsItem {
0188                             label: xi18n("EarthMOID")
0189                             value: DetailDialogLite.earthMOID
0190                         }
0191 
0192                         DetailsItem {
0193                             label: xi18n("OrbitClass")
0194                             value: DetailDialogLite.orbitClass
0195                         }
0196 
0197                         DetailsItem {
0198                             label: xi18n("Albedo")
0199                             value: DetailDialogLite.albedo
0200                         }
0201 
0202                         DetailsItem {
0203                             label: xi18n("Dimensions")
0204                             value: DetailDialogLite.dimensions
0205                         }
0206 
0207                         DetailsItem {
0208                             label: xi18n("Period")
0209                             value: DetailDialogLite.period
0210                         }
0211                     }
0212                 }
0213             }
0214 
0215             Pane {
0216                 clip: true
0217 
0218                 background: Rectangle {
0219                     anchors.fill: parent
0220                     color: Num.sysPalette.base
0221                 }
0222 
0223                 Flickable {
0224                     anchors.fill: parent
0225                     ScrollBar.vertical: ScrollBar { }
0226                     flickableDirection: Flickable.VerticalFlick
0227 
0228                     contentHeight: coordinatesCol.height
0229 
0230                     Column {
0231                         id: coordinatesCol
0232                         width: parent.width
0233                         spacing: 15
0234 
0235                         KSText {
0236                             text: xi18n("Coordinates")
0237                             font {
0238                                 pointSize: 16
0239                             }
0240                             anchors.horizontalCenter: parent.horizontalCenter
0241                         }
0242 
0243                         DetailsItem {
0244                             label: DetailDialogLite.RALabel
0245                             value: DetailDialogLite.RA
0246                         }
0247 
0248                         DetailsItem {
0249                             label: DetailDialogLite.decLabel
0250                             value: DetailDialogLite.dec
0251                         }
0252 
0253                         DetailsItem {
0254                             label: xi18n("RA (J2000.0)")
0255                             value: DetailDialogLite.RA0
0256                         }
0257 
0258                         DetailsItem {
0259                             label: xi18n("Dec (J2000.0)")
0260                             value: DetailDialogLite.dec0
0261                         }
0262 
0263                         DetailsItem {
0264                             label: xi18n("Azimuth")
0265                             value: DetailDialogLite.az
0266                         }
0267 
0268                         DetailsItem {
0269                             label: xi18n("Altitude")
0270                             value: DetailDialogLite.alt
0271                         }
0272 
0273                         DetailsItem {
0274                             label: xi18n("Hour angle")
0275                             value: DetailDialogLite.HA
0276                         }
0277 
0278                         DetailsItem {
0279                             label: xi18n("Airmass")
0280                             value: DetailDialogLite.airmass
0281                         }
0282 
0283                         KSText {
0284                             text: xi18n("Rise/Set/Transit")
0285                             font {
0286                                 pointSize: 16
0287                             }
0288                             anchors.horizontalCenter: parent.horizontalCenter
0289                         }
0290 
0291                         DetailsItem {
0292                             label: xi18n("Rise time")
0293                             value: DetailDialogLite.timeRise
0294                         }
0295 
0296                         DetailsItem {
0297                             label: xi18n("Transit time")
0298                             value: DetailDialogLite.timeTransit
0299                         }
0300 
0301                         DetailsItem {
0302                             label: xi18n("Set time")
0303                             value: DetailDialogLite.timeSet
0304                         }
0305 
0306                         DetailsItem {
0307                             label: xi18n("Azimuth at rise")
0308                             value: DetailDialogLite.azRise
0309                         }
0310 
0311                         DetailsItem {
0312                             label: xi18n("Azimuth at transit")
0313                             value: DetailDialogLite.altTransit
0314                         }
0315 
0316                         DetailsItem {
0317                             label: xi18n("Azimuth at set")
0318                             value: DetailDialogLite.azSet
0319                         }
0320                     }
0321                 }
0322             }
0323 
0324             Pane {
0325                 parent: DetailDialogLite.isLinksOn ? detailsSwipeView : null
0326                 clip: true
0327                 id: links
0328 
0329                 background: Rectangle {
0330                     anchors.fill: parent
0331                     color: Num.sysPalette.base
0332                 }
0333 
0334                 GridLayout {
0335                     id: linkCol
0336                     rowSpacing: 15
0337                     anchors {
0338                         top: parent.top
0339                         left: parent.left
0340                         right: parent.right
0341                         bottom: addInfoLandscape.top
0342                     }
0343 
0344                     flow: window.isPortrait ? GridLayout.TopToBottom : GridLayout.LeftToRight
0345 
0346                     ColumnLayout {
0347                         id: infoCol
0348 
0349                         Layout.fillWidth: true
0350                         Layout.fillHeight: true
0351                         Layout.minimumWidth: parent.width/2
0352 
0353                         spacing: 10
0354 
0355                         KSText {
0356                             id: infoLabel
0357                             text: xi18n("Information Links")
0358 
0359                             font.pointSize: 16
0360                             anchors.horizontalCenter: parent.horizontalCenter
0361                         }
0362 
0363                         Rectangle {
0364                             id: infoSeparator
0365                             Layout.fillWidth: true
0366                             height: 1
0367                             color: "grey"
0368                         }
0369 
0370                         KSListView {
0371                             Layout.fillHeight: true
0372                             Layout.fillWidth: true
0373 
0374                             model: DetailDialogLite.infoTitleList
0375 
0376                             onClicked: {
0377                                 detailsLinkMenu.openForInfo(index)
0378                             }
0379                         }
0380                     }
0381 
0382                     ColumnLayout {
0383                         id: imgCol
0384 
0385                         Layout.fillWidth: true
0386                         Layout.fillHeight: true
0387                         Layout.minimumWidth: parent.width/2
0388 
0389                         spacing: 10
0390 
0391                         KSText {
0392                             id: imgLabel
0393                             text: xi18n("Image Links")
0394 
0395                             font.pointSize: 16
0396                             anchors.horizontalCenter: parent.horizontalCenter
0397                         }
0398 
0399                         Rectangle {
0400                             id: imgSeparator
0401                             Layout.fillWidth: true
0402                             height: 1
0403                             color: "grey"
0404                         }
0405 
0406                         KSListView {
0407                             Layout.fillHeight: true
0408                             Layout.fillWidth: true
0409 
0410                             model: DetailDialogLite.imageTitleList
0411 
0412                             onClicked: {
0413                                 detailsLinkMenu.openForImage(index)
0414                             }
0415                         }
0416                     }
0417                 }
0418 
0419                 Button {
0420                     id: addInfoLandscape
0421                     text: xi18n("Add Link")
0422 
0423                     anchors.bottom: parent.bottom
0424 
0425                     onClicked: {
0426                         detailsAddLink.openAdd()
0427                     }
0428                 }
0429             }
0430 
0431             Pane {
0432                 parent: DetailDialogLite.isLogOn ? detailsSwipeView : null
0433                 clip: true
0434 
0435                 background: Rectangle {
0436                     anchors.fill: parent
0437                     color: Num.sysPalette.base
0438                 }
0439 
0440                 Flickable {
0441                     anchors.fill: parent
0442                     ScrollBar.vertical: ScrollBar { }
0443                     flickableDirection: Flickable.VerticalFlick
0444 
0445                     contentHeight: logCol.height
0446 
0447                     Column {
0448                         id: logCol
0449                         width: parent.width
0450                         spacing: 15
0451 
0452                         KSText {
0453                             text: xi18n("Log")
0454                             font {
0455                                 pointSize: 16
0456                             }
0457                             anchors.horizontalCenter: parent.horizontalCenter
0458                         }
0459 
0460                         TextArea {
0461                             id: logArea
0462                             placeholderText: i18n("Record here observation logs and/or data on %1.", SkyMapLite.clickedObjectLite.getTranslatedName())
0463                             padding: 5
0464                             width: parent.width
0465                             wrapMode: TextArea.Wrap
0466                             text: DetailDialogLite.userLog
0467 
0468                             Connections {
0469                                 target: DetailDialogLite
0470                                 onUserLogChanged: {
0471                                     logArea.text = DetailDialogLite.userLog
0472                                 }
0473                             }
0474 
0475                             onEditingFinished: {
0476                                 DetailDialogLite.saveLogData(text)
0477                             }
0478 
0479                             background: Rectangle {
0480                                 implicitWidth: parent.width
0481                                 implicitHeight: 40
0482                                 border{
0483                                     color: Num.sysPalette.base
0484                                     width: 2
0485                                 }
0486                             }
0487                         }
0488                     }
0489                 }
0490             }
0491         }
0492     }
0493 }
0494 
0495 
0496