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

0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick 2.6
0005 import QtQuick.Window 2.2
0006 import "../modules"
0007 import "../constants" 1.0
0008 import QtQuick.Layouts 1.2
0009 import QtQuick.Controls 2.0
0010 import QtQuick.Dialogs 1.2 as Dialogs
0011 
0012 KSPage {
0013     id: imagePreview
0014     anchors.fill: parent
0015     title: xi18n("Image Preview - %1", deviceName)
0016 
0017     property string deviceName
0018     property Item buttonRow: null
0019 
0020     Item {
0021         id: imgPreviewColumn
0022         anchors.fill: parent
0023 
0024         RowLayout {
0025             id: saveButtons
0026             anchors {
0027                 top: parent.top
0028                 left: parent.left
0029              //   margins: 10 * Num.dp
0030             }
0031             Layout.fillWidth: true
0032 
0033             spacing: 5 * Num.dp
0034 
0035             Button {
0036                 text: xi18n("Save As")
0037 
0038                 onClicked: {
0039                     ClientManagerLite.saveDisplayImage()
0040                 }
0041             }
0042         }
0043 
0044         Image {
0045             id: image
0046             Layout.fillHeight: true
0047             Layout.fillWidth: true
0048             fillMode: Image.PreserveAspectFit
0049             anchors {
0050                 top: saveButtons.bottom
0051                 left: parent.left
0052                 right: parent.right
0053                 bottom: parent.bottom
0054 
0055                 margins: 15 * Num.dp
0056             }
0057         }
0058 
0059         Connections {
0060             target: ClientManagerLite
0061 
0062             onNewINDIBLOBImage: {
0063                 if(imagePreview.deviceName == deviceName) {
0064                     image.source = "image://images/ccdPreview"
0065                     stackView.push(imagePreview)
0066                 }
0067             }
0068 
0069             onCreateINDIButton: {
0070                 if(imagePreview.deviceName == deviceName) {
0071                     if(propName == "UPLOAD_MODE") {
0072                         if(imagePreview.buttonRow == null) {
0073                             var buttonRowComp = Qt.createComponent("modules/KSButtonsSwitchRow.qml");
0074                             imagePreview.buttonRow = buttonRowComp.createObject(saveButtons)
0075                             imagePreview.buttonRow.deviceName = deviceName
0076                             imagePreview.buttonRow.propName = propName
0077                             imagePreview.buttonRow.exclusive = exclusive
0078                         }
0079                         imagePreview.buttonRow.addButton(propText, switchName, checked, enabled)
0080                     }
0081                 }
0082             }
0083 
0084             onRemoveINDIProperty: {
0085                 if(imagePreview.deviceName == deviceName) {
0086                     if(propName == "UPLOAD_MODE") {
0087                         if(imagePreview.buttonRow != null) {
0088                             imagePreview.buttonRow.destroy()
0089                             imagePreview.buttonRow = null
0090                         }
0091                     }
0092                 }
0093             }
0094         }
0095 
0096     }
0097 }