Warning, /utilities/skanpage/src/qml/ExportWindow.qml is written in an unsupported language. File is not indexed.
0001 /** 0002 * SPDX-FileCopyrightText: 2015 by Kåre Särs <kare.sars@iki .fi> 0003 * SPDX-FileCopyrightText: 2021 by Alexander Stippich <a.stippich@gmx.net> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 import QtQuick 0009 import QtQuick.Controls 0010 import QtQuick.Layouts 0011 import QtQuick.Window 0012 import QtQuick.Dialogs 0013 0014 import org.kde.kirigami as Kirigami 0015 0016 import org.kde.skanpage 0017 0018 Window { 0019 id: exportWindow 0020 0021 title: i18n("Export PDF") 0022 color: Kirigami.Theme.backgroundColor 0023 0024 modality: Qt.WindowModal 0025 flags: Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint 0026 | Qt.WindowCloseButtonHint | Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint 0027 0028 minimumHeight: 300 0029 minimumWidth: 600 0030 0031 ColumnLayout { 0032 anchors.fill: parent 0033 anchors.margins: Kirigami.Units.smallSpacing 0034 spacing: Kirigami.Units.smallSpacing 0035 0036 GridLayout { 0037 Layout.fillWidth: true 0038 Layout.fillHeight: true 0039 columns: 3 0040 rowSpacing: Kirigami.Units.smallSpacing 0041 columnSpacing: Kirigami.Units.smallSpacing 0042 0043 Label { 0044 text: i18n("Title:") 0045 Layout.alignment: Qt.AlignRight 0046 } 0047 0048 TextField { 0049 id: fileTitleItem 0050 Layout.fillWidth: true 0051 text: skanpage.documentModel.name 0052 } 0053 0054 Item { 0055 width: 1 0056 height: 1 0057 } 0058 0059 Label { 0060 text: i18n("File:") 0061 Layout.alignment: Qt.AlignRight 0062 } 0063 0064 TextField { 0065 id: fileNameItem 0066 Layout.fillWidth: true 0067 text: skanpage.configuration.defaultFolder + "/" + skanpage.documentModel.fileName 0068 } 0069 0070 ToolButton { 0071 icon.name: "folder" 0072 width: height 0073 onClicked: fileNameDialog.open() 0074 } 0075 0076 Item { 0077 visible: skanpage.OCRavailable() 0078 width: 1 0079 height: 1 0080 } 0081 0082 CheckBox { 0083 id: ocrCheckBox 0084 visible: skanpage.OCRavailable() 0085 text: i18n("Enable optical character recognition (OCR)") 0086 enabled: ocrList.count > 0 0087 checked: enabled 0088 } 0089 0090 Item { 0091 visible: skanpage.OCRavailable() 0092 width: 1 0093 height: 1 0094 } 0095 0096 Item { 0097 visible: skanpage.OCRavailable() 0098 width: 1 0099 height: 1 0100 } 0101 0102 Label { 0103 visible: skanpage.OCRavailable() 0104 enabled: ocrCheckBox.checked 0105 text: i18n("Languages:") 0106 } 0107 0108 Item { 0109 visible: skanpage.OCRavailable() 0110 width: 1 0111 height: 1 0112 } 0113 0114 Item { 0115 visible: skanpage.OCRavailable() 0116 width: 1 0117 height: 1 0118 } 0119 0120 ScrollView { 0121 id: ocrScroll 0122 Layout.fillHeight: true 0123 Layout.fillWidth: true 0124 visible: skanpage.OCRavailable() 0125 enabled: ocrCheckBox.checked 0126 0127 Component.onCompleted: ocrScroll.background.visible = true 0128 0129 ListView { 0130 id: ocrList 0131 clip: true 0132 model: skanpage.languageModel 0133 0134 delegate: CheckDelegate { 0135 text: i18n("%1 [%2]", model.name, model.code) 0136 onClicked: model.use = checked 0137 width: ocrScroll.width 0138 } 0139 } 0140 } 0141 0142 Item { 0143 visible: skanpage.OCRavailable() 0144 width: 1 0145 height: 1 0146 } 0147 0148 Item { 0149 visible: skanpage.OCRavailable() 0150 width: 1 0151 height: 1 0152 } 0153 0154 Label { 0155 visible: skanpage.OCRavailable() 0156 text: i18n("If your required language is not listed, please install Tesseract's language file with your package manager.") 0157 font.italic: true 0158 wrapMode: Text.WordWrap 0159 Layout.maximumWidth: fileNameItem.width 0160 } 0161 0162 Item { 0163 visible: skanpage.OCRavailable() 0164 width: 1 0165 height: 1 0166 } 0167 0168 Item { 0169 Layout.fillHeight: true 0170 Layout.fillWidth: true 0171 Layout.columnSpan: 3 0172 } 0173 } 0174 0175 RowLayout { 0176 spacing: Kirigami.Units.smallSpacing 0177 Layout.alignment: Qt.AlignRight 0178 0179 Button { 0180 id: saveButton 0181 icon.name: "document-save" 0182 text: i18n("Save") 0183 onClicked: { 0184 skanpage.documentModel.exportPDF(fileNameItem.text, fileTitleItem.text, ocrCheckBox.checked && skanpage.OCRavailable()) 0185 exportWindow.close() 0186 } 0187 } 0188 0189 Button { 0190 action: cancelAction 0191 } 0192 } 0193 } 0194 0195 Action { 0196 id: cancelAction 0197 icon.name: "dialog-close" 0198 text: i18n("Cancel") 0199 shortcut: "Esc" 0200 onTriggered: exportWindow.close() 0201 } 0202 0203 FileDialog { 0204 id: fileNameDialog 0205 currentFolder: skanpage.configuration.defaultFolder 0206 nameFilters: skanpage.formatModel.pdfFormatFilter() 0207 onAccepted: fileNameItem.text = selectedFile 0208 } 0209 } 0210