Kstars

ImagePreview.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick 2.6
5import QtQuick.Window 2.2
6import "../modules"
7import "../constants" 1.0
8import QtQuick.Layouts 1.2
9import QtQuick.Controls 2.0
10import QtQuick.Dialogs 1.2 as Dialogs
11
12KSPage {
13 id: imagePreview
14 anchors.fill: parent
15 title: xi18n("Image Preview - %1", deviceName)
16
17 property string deviceName
18 property Item buttonRow: null
19
20 Item {
21 id: imgPreviewColumn
22 anchors.fill: parent
23
24 RowLayout {
25 id: saveButtons
26 anchors {
27 top: parent.top
28 left: parent.left
29 // margins: 10 * Num.dp
30 }
31 Layout.fillWidth: true
32
33 spacing: 5 * Num.dp
34
35 Button {
36 text: xi18n("Save As")
37
38 onClicked: {
40 }
41 }
42 }
43
44 Image {
45 id: image
46 Layout.fillHeight: true
47 Layout.fillWidth: true
48 fillMode: Image.PreserveAspectFit
49 anchors {
50 top: saveButtons.bottom
51 left: parent.left
52 right: parent.right
53 bottom: parent.bottom
54
55 margins: 15 * Num.dp
56 }
57 }
58
59 Connections {
60 target: ClientManagerLite
61
62 onNewINDIBLOBImage: {
63 if(imagePreview.deviceName == deviceName) {
64 image.source = "image://images/ccdPreview"
65 stackView.push(imagePreview)
66 }
67 }
68
69 onCreateINDIButton: {
70 if(imagePreview.deviceName == deviceName) {
71 if(propName == "UPLOAD_MODE") {
72 if(imagePreview.buttonRow == null) {
73 var buttonRowComp = Qt.createComponent("modules/KSButtonsSwitchRow.qml");
74 imagePreview.buttonRow = buttonRowComp.createObject(saveButtons)
75 imagePreview.buttonRow.deviceName = deviceName
76 imagePreview.buttonRow.propName = propName
77 imagePreview.buttonRow.exclusive = exclusive
78 }
79 imagePreview.buttonRow.addButton(propText, switchName, checked, enabled)
80 }
81 }
82 }
83
84 onRemoveINDIProperty: {
85 if(imagePreview.deviceName == deviceName) {
86 if(propName == "UPLOAD_MODE") {
87 if(imagePreview.buttonRow != null) {
88 imagePreview.buttonRow.destroy()
89 imagePreview.buttonRow = null
90 }
91 }
92 }
93 }
94 }
95
96 }
97}
Q_INVOKABLE bool saveDisplayImage()
saveDisplayImage
QString xi18n(const char *text, const TYPE &arg...)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.