update WWW
[ubi] / qml / ubi / main.qml
1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "components"
3 import "UIConstants.js" as Const
4
5 Rectangle {
6     id: mainWindow
7
8     width: 480
9     height: 800
10
11     color: Const.DEFAULT_BACKGROUND_COLOR
12
13     PageStack {
14         id: pageStack
15         //initialPage: Qt.resolvedUrl("StartPage.qml")
16         initialPage: Qt.resolvedUrl("FilesPage.qml")
17     }
18
19     TopBar {
20         id: topbar
21         /*Component.onCompleted: {
22             //visible = Utils.isMaemo();
23         }
24         onVisibleChanged: {
25             if(visible)
26                 visible = Utils.isMaemo();
27         }*/
28     }
29
30     NotificationNew {
31         id: tip
32         z: 201
33         anchors.horizontalCenter: mainWindow.horizontalCenter
34         y: mainWindow.height-height-Const.SYSTEM_BAR_HEIGHT-Const.TEXT_MARGIN
35     }
36
37     /*TaskBar {
38         id: taskBar
39     }*/
40
41     Connections {
42         target: Utils
43         onFileDownloaded: tip.show(qsTr("File downloaded."))
44         onFileUploaded: tip.show(qsTr("File uploaded."))
45         onDownloadError: tip.show(qsTr("Error while downloading."))
46         onUploadError: tip.show(qsTr("Error while uploading."))
47         onDownloadAdded: tip.show(qsTr("File added to the queue."))
48         onUploadAdded: tip.show(qsTr("File added to the queue."))
49         onOperationCanceled: tip.show(qsTr("File operation canceled."))
50     }
51
52     DialogBlank {
53         id: downloadDialog
54         z: 200
55
56         property bool isActiveDownloads: progressArea.count>0
57
58         boxHeight: progressArea.height + 3*Const.DEFAULT_MARGIN
59
60         Connections {
61             target: Utils
62             onFileDownloadProgress: progressArea.setProgress(filename,progress)
63             onFileUploadProgress: progressArea.setProgress(filename,progress)
64             onDownloadAdded: progressArea.addTask("download",filename)
65             onUploadAdded: progressArea.addTask("upload",filename)
66             onDownloadStarted: progressArea.start(filename)
67             onUploadStarted: progressArea.start(filename)
68             onFileDownloaded: progressArea.stop(filename)
69             onFileUploaded: progressArea.stop(filename)
70             onDownloadError: progressArea.stop(filename)
71             onUploadError: progressArea.stop(filename)
72             onOperationCanceled: progressArea.stop(filename)
73             onFileRemovedFromQuee: progressArea.stop(filename)
74         }
75
76         DownloadArea {
77             anchors.top: parent.box.top
78             anchors.topMargin: 2*Const.DEFAULT_MARGIN
79             anchors.margins: Const.DEFAULT_MARGIN
80             anchors.horizontalCenter: parent.horizontalCenter
81             id: progressArea
82             width: parent.width-3*Const.DEFAULT_MARGIN
83
84             //onHeightChanged: console.log("height: "+height);
85         }
86     }
87
88     DialogInfo {
89         id: aboutDialog
90         z: 200
91         fontSize: 28
92         iconSource: "images/ubi50.png"
93         textHeader: qsTr("<b>Ubi</b>")
94
95         text: qsTr("<p>An unofficial Ubuntu One app for Maemo 5 "
96               +"and other Qt-enabled platforms.</p>"
97               +"<p><small>http://ubi.garage.maemo.org</small></p>"
98               +"<p><small>© 2012 Michal Kosciesza</small></p>")
99     }
100
101     SystemBar {
102         id: systemBar
103         z: 201
104         onClickedOnMask: {
105             aboutDialog.close();
106             downloadDialog.close();
107             pageStack.currentPage.taskMenu.close();
108         }
109     }
110
111     Rectangle {
112         color: "black"
113         z: 300
114         width: 1
115         anchors.left: parent.left
116         anchors.top: parent.top
117         anchors.bottom: parent.bottom
118     }
119
120     InitPage {
121         id: initPage
122         z: 301
123         height: mainWindow.height;
124         width: mainWindow.width;
125     }
126
127 }