~mzanetti/+junk/ubtd

« back to all changes in this revision

Viewing changes to app/Main.qml

  • Committer: Michael Zanetti
  • Date: 2016-08-21 10:28:36 UTC
  • Revision ID: michael.zanetti@canonical.com-20160821102836-mam1manqthov2um9
improve!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import QtQuick 2.4
2
2
import QtQuick.Layouts 1.1
3
3
import Ubuntu.Components 1.3
 
4
import Ubuntu.Components.ListItems 1.3
4
5
import Ubuntu.Content 1.3
5
6
import ubtd 1.0
6
7
 
26
27
        ColumnLayout {
27
28
            spacing: units.gu(1)
28
29
            anchors {
29
 
                margins: units.gu(2)
30
30
                fill: parent
31
31
                topMargin: mainPage.header.height + units.gu(1)
32
32
            }
33
33
 
34
 
            Label {
35
 
                id: label
36
 
                text: i18n.tr("Waiting for incoming file...")
37
 
                fontSize: "large"
38
 
                Layout.fillWidth: true
39
 
                wrapMode: Text.WordWrap
40
 
            }
41
 
            Label {
42
 
                text: i18n.tr("Send a file via Bluetooth to your Ubuntu phone")
43
 
                fontSize: "x-small"
44
 
                Layout.fillWidth: true
45
 
                wrapMode: Text.WordWrap
46
 
            }
 
34
            Column {
 
35
                Layout.fillWidth: true
 
36
                Layout.preferredHeight: childrenRect.height
 
37
                spacing: units.gu(1)
 
38
 
 
39
                ColumnLayout {
 
40
                    width: parent.width - units.gu(4)
 
41
                    anchors.horizontalCenter: parent.horizontalCenter
 
42
 
 
43
                    Label {
 
44
                        id: label
 
45
                        text: i18n.tr("Your Ubuntu device is now ready to receive files via Bluetooth...")
 
46
                        fontSize: "large"
 
47
                        Layout.fillWidth: true
 
48
                        wrapMode: Text.WordWrap
 
49
                    }
 
50
                    Label {
 
51
                        text: i18n.tr("Send a file via Bluetooth to your Ubuntu phone. It will appear in the list below.")
 
52
                        fontSize: "x-small"
 
53
                        Layout.fillWidth: true
 
54
                        wrapMode: Text.WordWrap
 
55
                    }
 
56
                }
 
57
                ThinDivider {
 
58
 
 
59
                }
 
60
                Label {
 
61
                    text: i18n.tr("Transfers:")
 
62
                    anchors { left: parent.left; right: parent.right; margins: units.gu(2) }
 
63
                }
 
64
            }
 
65
 
47
66
            ListView {
48
67
                Layout.fillHeight: true
49
68
                Layout.fillWidth: true
 
69
                clip: true
50
70
 
51
71
                model: obexd
52
72
 
57
77
                        pageStack.push(pickerPageComponent, {contentType: listItem.contentType, filePath: model.filePath + "/" + model.filename})
58
78
                    }
59
79
 
 
80
                    leadingActions: ListItemActions {
 
81
                        actions: [
 
82
                            Action {
 
83
                                iconName: "delete"
 
84
                                onTriggered: obexd.deleteFile(index)
 
85
                            }
 
86
                        ]
 
87
                    }
 
88
 
60
89
                    property var contentType: null
61
90
 
62
91
                    RowLayout {
63
 
                        anchors { fill: parent; margins: units.gu(1) }
 
92
                        anchors { fill: parent; leftMargin: units.gu(2); rightMargin: units.gu(2); topMargin: units.gu(1); bottomMargin: units.gu(1) }
64
93
 
65
94
 
66
95
                        Item {
67
96
                            Layout.fillHeight: true
68
97
                            Layout.preferredWidth: height
69
98
 
70
 
                            Image {
71
 
                                id: transferredImage
 
99
                            UbuntuShape {
72
100
                                anchors.fill: parent
73
 
                                source: model.status === Transfer.StatusComplete ? "file://" + filePath + "/" + filename : ""
74
 
                                fillMode: Image.PreserveAspectFit
 
101
                                aspect: UbuntuShape.DropShadow
 
102
                                sourceFillMode: Image.PreserveAspectCrop
 
103
                                source: Image {
 
104
                                    id: transferredImage
 
105
                                    source: model.status === Transfer.StatusComplete ? "file://" + filePath + "/" + filename : ""
 
106
                                }
75
107
                            }
 
108
 
76
109
                            Icon {
77
110
                                anchors.fill: parent
78
111
                                visible: status !== Transfer.StatusComplete || transferredImage.status === Image.Error
132
165
                            UbuntuShape {
133
166
                                Layout.fillWidth: true
134
167
                                Layout.preferredHeight: units.dp(5)
 
168
                                visible: status == Transfer.StatusActive
135
169
                                UbuntuShape {
136
170
                                    anchors.fill: parent
137
171
                                    color: UbuntuColors.blue
149
183
                                    case Transfer.StatusSuspended:
150
184
                                        return "Paused"
151
185
                                    case Transfer.StatusComplete:
152
 
                                        return "Complete";
 
186
                                        return "Completed (" + Qt.formatDateTime(date) + ")";
153
187
                                    case Transfer.StatusError:
154
188
                                        return "Failed";
155
189
                                    }