main.qml 1.45 KB
Newer Older
Artem Sidyakin's avatar
Artem Sidyakin committed
1 2 3 4
import QtQuick 2.11
import QtQuick.Window 2.11
import QtQuick.Layouts 1.11
import QtQuick.Controls 2.4
Artem Sidyakin's avatar
Artem Sidyakin committed
5
import io.qt.Backend 1.0
Artem Sidyakin's avatar
Artem Sidyakin committed
6 7 8 9 10 11 12 13 14

ApplicationWindow {
    id: root
    //visibility: "Maximized"
    visible: true
    width: 900
    minimumWidth: 700
    height: 500
    minimumHeight: 400
Artem Sidyakin's avatar
Artem Sidyakin committed
15
    title: qsTr("WebGL release demo")
Artem Sidyakin's avatar
Artem Sidyakin committed
16

Artem Sidyakin's avatar
Artem Sidyakin committed
17 18 19
    property int maxValue: 70 // degrees for servos (with 20 safety gap)
    property int maxSize: 60 // pixels for sliders items and button
    property string sliderColor: "transparent" // perhaps some styling will take place
Artem Sidyakin's avatar
Artem Sidyakin committed
20
    property bool cameraUpsideDown: true // if you need to rotate viewfinder to 180
Artem Sidyakin's avatar
Artem Sidyakin committed
21 22

    Backend { id: backend }
Artem Sidyakin's avatar
Artem Sidyakin committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

    header: TabBar {
        id: tabBar
        currentIndex: stck.currentIndex
        font.pixelSize: 20

        TabButton { id: tabCamera; text: qsTr("Camera") }
        TabButton { id: tabPhotos; text: qsTr("Photos") }
    }

    StackLayout {
        id: stck
        anchors.fill: parent
        currentIndex: tabBar.currentIndex

Artem Sidyakin's avatar
Artem Sidyakin committed
38 39 40
        TabCamera {}
        TabPhotos {}
    }
Artem Sidyakin's avatar
Artem Sidyakin committed
41

Artem Sidyakin's avatar
Artem Sidyakin committed
42 43 44 45 46
    MessageBox {
        id: dialogError
        title: "Some error"
        textMain: "Some error"
    }
Artem Sidyakin's avatar
Artem Sidyakin committed
47

Artem Sidyakin's avatar
Artem Sidyakin committed
48 49 50 51 52
    Connections {
        target: backend
        onSomeError: {
            dialogError.textMain = "Some error moving the camera\n" + errorMsg;
            dialogError.show();
Artem Sidyakin's avatar
Artem Sidyakin committed
53 54 55 56 57 58 59 60
        }
    }

    function getCurrentDateTime()
    {
        return new Date().toISOString().replace(/[:|.|T]/g, "-").replace("Z", "");
    }
}