Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.2
- import QtQuick.Controls 1.2
- import QtQuick.Layouts 1.1
- import QtQuick.Controls.Styles 1.2
- import QtMultimedia 5.2
- Rectangle {
- width: 100
- height: 62
- property int bottomMargin: 10
- property int columnSpacing: 50
- gradient: Gradient {
- GradientStop {
- position: 0.00;
- color: "#000000";
- }
- GradientStop {
- position: 1.00;
- color: "#b9b3b3";
- }
- }
- BusyIndicator {
- id : busyInd
- }
- function uploadImage(path)
- {
- console.log("UPLOAD IMAGE");
- var fileName = path//propertyInWhichYouStoredImagePath;
- if (fileName == "") {
- notification.show(qsTr("No Image Exists"));
- return;
- }
- busyInd.running = true;
- var fileObject = {
- objectType: "objects.image",
- name: fileName,
- localPath: fileName
- }
- var reply = enginioClient.create(fileObject);
- reply.finished.connect(function() {
- var uploadData = {
- file: { fileName: fileName },
- targetFileProperty: {
- objectType: "objects.image",
- id: reply.data.id,
- propertyName: "file"
- },
- };
- var uploadReply = enginioClient.uploadFile(uploadData, fileName);
- uploadReply.finished.connect(function() {
- var tmp = enginioModel.query;
- enginioModel.query = null;
- enginioModel.query = tmp;
- busyInd.running = false;
- notification.show(qsTr("Saved to Cloud"));
- })
- })
- }
- Image {
- id: photoPreview
- width: 200
- height:200
- }
- Camera {
- id: camera
- imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
- exposure {
- exposureCompensation: -1.0
- exposureMode: Camera.ExposurePortrait
- }
- flash.mode: Camera.FlashRedEyeReduction
- imageCapture {
- onImageCaptured: {
- photoPreview.source = preview // Show the preview in an Image
- }
- onImageSaved:
- {
- console.log("Image Capture Changed " + camera.imageCapture.capturedImagePath);
- uploadImage(camera.imageCapture.capturedImagePath);
- }
- }
- }
- VideoOutput {
- source: camera
- anchors.fill: parent
- focus : visible // to receive focus and capture key events when visible
- MouseArea {
- anchors.fill: parent;
- onClicked: camera.imageCapture.capture();
- onDoubleClicked: camera.imageCapture.captureToLocation()
- }
- }
- NotificationMessage {
- id: notification
- anchors.centerIn: parent
- width: 0.5 * parent.width
- height: 0.5 * width
- onCustomSignal: {
- console.log("Notification closed")
- }
- }
- ToolBar {
- id: bottomToolbar
- anchors.bottom: parent.bottom
- anchors.bottomMargin: bottomMargin
- width: parent.width
- RowLayout {
- anchors.horizontalCenter: parent.horizontalCenter
- spacing: columnSpacing
- ToolButton {
- iconSource: "qrc:/images/arrow_left.png"
- onClicked: {
- pageStack.pop();
- }
- }
- }
- style: ToolBarStyle {
- background: Item {
- visible: false
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement