Fetch the repository succeeded.
This action will force synchronization from zjzdy/Offline-small-search, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2
import QtMultimedia 5.5
Rectangle {
id: rectangle2
width: 720
height: 1280
property var cropPoints: {"topLeft": Qt.point(0, 0)};
color: "#f6f6f6"
property real a_max: Math.max(width,height)
property real a_min: Math.min(width,height)
property real a_pd: 0
property real a_sqrt: Math.min(Math.sqrt(a_max/1280*a_min/720),a_pd/12)
property int currentCamera: 0
property var cameras: QtMultimedia.availableCameras
z: 0
Item {
z: 2
anchors.fill: parent
visible: cameras.length === 0
Text {
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr("未找到摄像头,点击屏幕任意位置进入剪裁页面,请在剪裁页面自行导入图片.")
wrapMode: Text.Wrap
font.pixelSize: 100*rectangle2.a_sqrt
}
MouseArea {
anchors.fill: parent
onClicked: {
main_widget.show_crop()
}
}
}
VideoOutput {
id: vo
anchors.fill: parent
anchors.bottomMargin: rectangle2.height/10
source: Camera {
id: camera
captureMode: Camera.CaptureStillImage
flash.mode: Camera.FlashOff
focus {
id: cfocus
focusMode: Camera.FocusMacro + Camera.FocusContinuous
focusPointMode: Camera.FocusPointCustom
customFocusPoint: Qt.point(0.5, 0.5)
}
imageCapture {
onImageSaved: {
camera.unlock()
main_widget.show_crop("file:///"+path)
}
onCaptureFailed: {
fail_messageDialog.open()
}
}
}
autoOrientation: true
fillMode: VideoOutput.Stretch
MouseArea {
anchors.fill: parent
onClicked: {
cfocus.customFocusPoint = Qt.point(mouseX/vo.width, mouseY/vo.height)
camera.searchAndLock()
}
}
}
MessageDialog {
id: fail_messageDialog
title: qsTr("拍照错误")
text: qsTr("拍照失败,是否需要在剪裁页面自行导入图片?")
standardButtons: StandardButton.Yes | StandardButton.No
onYes: main_widget.show_crop()
}
Item {
id: bar
anchors.fill: parent
anchors.topMargin: rectangle2.height/10*9
Image {
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
opacity: 0.6
visible: cameras.length > 1
width: height
source: "qrc:/image/icon_refresh.png"
MouseArea {
anchors.fill: parent
onClicked: {
currentCamera++
if(currentCamera > cameras.length)
currentCamera = 0
camera.deviceId = cameras[currentCamera].deviceId
}
}
}
Image {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.bottom: parent.bottom
width: height
opacity:0.6
visible: cameras.length > 0
source: "qrc:/image/icon_camera.png"
MouseArea {
anchors.fill: parent
onClicked: {
console.log(main_widget.get_data_dir()+"/tmp.jpg")
camera.imageCapture.captureToLocation(main_widget.get_data_dir()+"/tmp.jpg")
}
}
}
Image {
id: flash_i
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
opacity: 0.6
visible: cameras.length > 1
width: height
source: flash ? "qrc:/image/icon_flash.png" : "qrc:/image/icon_flash_off.png"
property bool flash: false
MouseArea {
anchors.fill: parent
onClicked: {
parent.flash = !parent.flash
camera.flash.mode = parent.flash ? Camera.FlashOn : Camera.FlashOff
}
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。