~stefan-schwarzburg/qreator/qreator-qml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem
import Ubuntu.Components.Popups 0.1
import QtGraphicalEffects 1.0
import QtQuick.LocalStorage 2.0

import "qrcodes"
import "qreator"

import "js/qreator.js" as Qreator


MainView {
    // We defint objectName for functional testing purposes
    // (autopilot-qt5)
    objectName: "mainView"
    id: root

    width: units.gu(50)
    height: units.gu(75)
    
    property real pageSpacing: units.gu(6)
   
    // every QR code datatype canvas connects to this signal
    signal updateCanvas

    PageStack {
        id: pageStack
        anchors {
            fill: parent
            topMargin: header.height
        }
        PageRoot {id: pageRoot }        
        // QR code datatypes
        PageQrText {id: pageQrText}
        PageQrUrl {id: pageQrUrl}
        PageQrWifi {id: pageQrWifi}
        PageQrBusinessCard {id: pageQrBusinessCard}
        // Additional Pages
        PageSettings {id: pageSettings}
        PageAbout {id: pageAbout}
        PageColorTheme {id: pageColorTheme}
        PageHistory{id: pageHistory}
        // setup
        Component.onCompleted: push(pageRoot)
    }
    
    // global models
    ListModel {id: colorThemeModel}
    ListModel {id: dotThemeModel}
    ListModel {id: qrcodeDatatypeModel}

    Component.onCompleted: {
        i18n.domain = "qreator"

        // initialize the listmodels
        Qreator.initializeColorModel(colorThemeModel)
        Qreator.initializeDotThemeModel(dotThemeModel)
    }

    // Fake header until MainView includes it
    PageHeader {
        id: header
        width: parent.width
        text: i18n.tr("Qreator")
        //height: contentHeight // + root.margins
        anchors {
            left: parent.left
            right: parent.right
            top: parent.top
       }
    }

    Component {
        id: qrcodetoolbar
        //Item {
            ToolbarActions {
                        Action {
                            text: i18n.tr("Edit")
                            iconSource: Qt.resolvedUrl("img/about.png")
                            //onTriggered: pageStack.push(pageAbout)
                        }
                        Action {
                            text: i18n.tr("Save")
                            iconSource: Qt.resolvedUrl("img/history.png")
                            //onTriggered: pageStack.push(pageHistory)
                        }
                        Action {
                            text: i18n.tr("Share")
                            iconSource: Qt.resolvedUrl("img/settings.png")
                            //onTriggered: pageStack.push(pageSettings)
                        }
                    }
        //}
    }
}