Changeset View
Changeset View
Standalone View
Standalone View
applets/clipboard/contents/ui/BarcodePage.qml
Show All 15 Lines | |||||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | *********************************************************************/ | 18 | *********************************************************************/ | ||
19 | import QtQuick 2.0 | 19 | import QtQuick 2.0 | ||
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 | ||
21 | import org.kde.plasma.core 2.0 as PlasmaCore | 21 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
22 | import org.kde.plasma.components 2.0 as PlasmaComponents | 22 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
23 | import org.kde.kquickcontrolsaddons 2.0 | 23 | import org.kde.kquickcontrolsaddons 2.0 | ||
24 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||||
24 | 25 | | |||
25 | ColumnLayout { | 26 | ColumnLayout { | ||
26 | id: barcodeView | 27 | id: barcodeView | ||
27 | 28 | | |||
28 | property var uuid: "" | 29 | property var uuid: "" | ||
29 | property int barcodeType: 0 | 30 | property int barcodeType: 0 | ||
30 | 31 | | |||
31 | function show(uuid) { | 32 | function show(uuid) { | ||
Show All 9 Lines | |||||
41 | serviceJob.finished.connect(function (job) { | 42 | serviceJob.finished.connect(function (job) { | ||
42 | if (!job.error) { | 43 | if (!job.error) { | ||
43 | barcodePreview.image = job.result; | 44 | barcodePreview.image = job.result; | ||
44 | barcodePreview.busy = false; | 45 | barcodePreview.busy = false; | ||
45 | } | 46 | } | ||
46 | }); | 47 | }); | ||
47 | } | 48 | } | ||
48 | 49 | | |||
50 | property var header: PlasmaExtras.PlasmoidHeading { | ||||
49 | RowLayout { | 51 | RowLayout { | ||
50 | Layout.fillWidth: true | 52 | anchors.fill: parent | ||
51 | PlasmaComponents.Button { | 53 | PlasmaComponents.Button { | ||
52 | Layout.fillWidth: true | 54 | Layout.fillWidth: true | ||
53 | iconSource: "go-previous-view" | 55 | iconSource: "go-previous-view" | ||
54 | text: i18n("Return to Clipboard") | 56 | text: i18n("Return to Clipboard") | ||
55 | onClicked: stack.pop() | 57 | onClicked: stack.pop() | ||
56 | } | 58 | } | ||
57 | PlasmaComponents.ContextMenu { | 59 | PlasmaComponents.ContextMenu { | ||
58 | id: menu | 60 | id: menu | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
103 | PlasmaComponents.ToolButton { | 105 | PlasmaComponents.ToolButton { | ||
104 | id: configureButton | 106 | id: configureButton | ||
105 | checkable: true | 107 | checkable: true | ||
106 | iconSource: "configure" | 108 | iconSource: "configure" | ||
107 | tooltip: i18n("Change the barcode type") | 109 | tooltip: i18n("Change the barcode type") | ||
108 | onClicked: menu.openRelative() | 110 | onClicked: menu.openRelative() | ||
109 | } | 111 | } | ||
110 | } | 112 | } | ||
113 | } | ||||
114 | | ||||
111 | QImageItem { | 115 | QImageItem { | ||
112 | id: barcodePreview | 116 | id: barcodePreview | ||
113 | property alias busy: busyIndicator.visible | 117 | property alias busy: busyIndicator.visible | ||
114 | fillMode: QImageItem.PreserveAspectFit | 118 | fillMode: QImageItem.PreserveAspectFit | ||
115 | Layout.fillWidth: true | 119 | Layout.fillWidth: true | ||
116 | Layout.fillHeight: true | 120 | Layout.fillHeight: true | ||
121 | Layout.topMargin: units.smallSpacing | ||||
117 | onWidthChanged: barcodeView.show(barcodeView.uuid) | 122 | onWidthChanged: barcodeView.show(barcodeView.uuid) | ||
118 | onHeightChanged: barcodeView.show(barcodeView.uuid) | 123 | onHeightChanged: barcodeView.show(barcodeView.uuid) | ||
119 | PlasmaComponents.BusyIndicator { | 124 | PlasmaComponents.BusyIndicator { | ||
120 | id: busyIndicator | 125 | id: busyIndicator | ||
121 | anchors.centerIn: parent | 126 | anchors.centerIn: parent | ||
122 | } | 127 | } | ||
123 | PlasmaComponents.Label { | 128 | PlasmaComponents.Label { | ||
124 | anchors.centerIn: parent | 129 | anchors.centerIn: parent | ||
125 | text: i18n("Creating barcode failed") | 130 | text: i18n("Creating barcode failed") | ||
126 | visible: !barcodePreview.busy && barcodePreview.null | 131 | visible: !barcodePreview.busy && barcodePreview.null | ||
127 | } | 132 | } | ||
128 | } | 133 | } | ||
129 | } | 134 | } |