From: Muki Date: Tue, 15 May 2012 21:03:35 +0000 (+0200) Subject: New GUI X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=4b7d3c9a2ffcba5ec4f6479dccb09d6b16988773;hp=7f0e071fbec9953213b41b6298a419c921850fa8;p=ubi New GUI --- diff --git a/graphics/back-old.svg b/graphics/back-old.svg new file mode 100644 index 0000000..e9d2170 --- /dev/null +++ b/graphics/back-old.svg @@ -0,0 +1,72 @@ + + + +image/svg+xml + + + + + + + + + + + \ No newline at end of file diff --git a/graphics/back.svg b/graphics/back.svg index e9d2170..90d973e 100644 --- a/graphics/back.svg +++ b/graphics/back.svg @@ -19,17 +19,14 @@ xml:space="preserve" id="svg2" inkscape:version="0.48.3.1 r9886" - sodipodi:docname="back.svg">image/svg+xml - - - - - - - + id="DO_NOT_EDIT_-_BOUNDING_BOX"> + + + + + + + - + width="30" + height="30" + id="rect15" /> + \ No newline at end of file diff --git a/graphics/close_stop.svg b/graphics/close_stop.svg new file mode 100644 index 0000000..b8ba5a5 --- /dev/null +++ b/graphics/close_stop.svg @@ -0,0 +1,84 @@ + + + +image/svg+xml + + + + + + + + + + + + + \ No newline at end of file diff --git a/graphics/delete.svg b/graphics/delete.svg new file mode 100644 index 0000000..2421502 --- /dev/null +++ b/graphics/delete.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + diff --git a/graphics/document-big.svg b/graphics/document-big.svg new file mode 100644 index 0000000..62e500d --- /dev/null +++ b/graphics/document-big.svg @@ -0,0 +1,81 @@ + + + +image/svg+xml + + + + + \ No newline at end of file diff --git a/graphics/document.svg b/graphics/document.svg index d3b8296..bb628e9 100644 --- a/graphics/document.svg +++ b/graphics/document.svg @@ -1,29 +1,76 @@ - - - - - - - - - - - - - - + + + +image/svg+xml + + + + + + + + + + \ No newline at end of file diff --git a/graphics/download.svg b/graphics/download.svg new file mode 100644 index 0000000..81b23d1 --- /dev/null +++ b/graphics/download.svg @@ -0,0 +1,84 @@ + + + +image/svg+xml + + + + + + + + + + + + + \ No newline at end of file diff --git a/graphics/folder-big.svg b/graphics/folder-big.svg new file mode 100644 index 0000000..d237210 --- /dev/null +++ b/graphics/folder-big.svg @@ -0,0 +1,86 @@ + + + +image/svg+xml + + + + + + + + + + \ No newline at end of file diff --git a/graphics/folder.svg b/graphics/folder.svg index 960a178..913fc55 100644 --- a/graphics/folder.svg +++ b/graphics/folder.svg @@ -20,7 +20,7 @@ id="svg2" inkscape:version="0.48.3.1 r9886" sodipodi:docname="folder.svg" - inkscape:export-filename="/home/mkiol/dev/Qt/ubi/qml/ubi/images/files.png" + inkscape:export-filename="/home/mkiol/dev/Qt/ubi/qml/ubi/images/folder-small.png" inkscape:export-xdpi="120" inkscape:export-ydpi="120"> + + +image/svg+xml + + + + + \ No newline at end of file diff --git a/graphics/music.svg b/graphics/music.svg new file mode 100644 index 0000000..51b72b6 --- /dev/null +++ b/graphics/music.svg @@ -0,0 +1,76 @@ + + + +image/svg+xml + + + + + + + + + + \ No newline at end of file diff --git a/graphics/options.svg b/graphics/options.svg new file mode 100644 index 0000000..e34f2bd --- /dev/null +++ b/graphics/options.svg @@ -0,0 +1,81 @@ + + + +image/svg+xml + + + + + + + + + + + \ No newline at end of file diff --git a/graphics/photos-big.svg b/graphics/photos-big.svg new file mode 100644 index 0000000..c6a0d9f --- /dev/null +++ b/graphics/photos-big.svg @@ -0,0 +1,81 @@ + + + +image/svg+xml + + + + + \ No newline at end of file diff --git a/graphics/photos.svg b/graphics/photos.svg index 3d8f26c..3c1caa5 100644 --- a/graphics/photos.svg +++ b/graphics/photos.svg @@ -20,9 +20,9 @@ id="svg2" inkscape:version="0.48.3.1 r9886" sodipodi:docname="photos.svg" - inkscape:export-filename="/home/mkiol/dev/Qt/ubi/qml/ubi/images/photo.png" - inkscape:export-xdpi="150" - inkscape:export-ydpi="150">image/svg+xml + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/graphics/qtg_fr_pushbutton_normal.svg b/graphics/qtg_fr_pushbutton_normal.svg new file mode 100644 index 0000000..7af33d6 --- /dev/null +++ b/graphics/qtg_fr_pushbutton_normal.svg @@ -0,0 +1,110 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/graphics/qtg_fr_pushbutton_pressed.svg b/graphics/qtg_fr_pushbutton_pressed.svg new file mode 100644 index 0000000..d2a1a18 --- /dev/null +++ b/graphics/qtg_fr_pushbutton_pressed.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/graphics/qtg_fr_tab_passive_normal.svg b/graphics/qtg_fr_tab_passive_normal.svg new file mode 100644 index 0000000..2fa2661 --- /dev/null +++ b/graphics/qtg_fr_tab_passive_normal.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/graphics/qtg_fr_tooltip_inverse.svg b/graphics/qtg_fr_tooltip_inverse.svg new file mode 100644 index 0000000..da242fa --- /dev/null +++ b/graphics/qtg_fr_tooltip_inverse.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/graphics/qtg_graf_magnifier_mask.svg b/graphics/qtg_graf_magnifier_mask.svg new file mode 100644 index 0000000..f1641e0 --- /dev/null +++ b/graphics/qtg_graf_magnifier_mask.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/graphics/qtg_graf_switchbutton_track.svg b/graphics/qtg_graf_switchbutton_track.svg new file mode 100644 index 0000000..61335e5 --- /dev/null +++ b/graphics/qtg_graf_switchbutton_track.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/graphics/qtg_graf_switchbutton_track_inverse.svg b/graphics/qtg_graf_switchbutton_track_inverse.svg new file mode 100644 index 0000000..a41075b --- /dev/null +++ b/graphics/qtg_graf_switchbutton_track_inverse.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/graphics/refresh.svg b/graphics/refresh.svg new file mode 100644 index 0000000..3121a23 --- /dev/null +++ b/graphics/refresh.svg @@ -0,0 +1,76 @@ + + + +image/svg+xml + + + + + + + + + + \ No newline at end of file diff --git a/graphics/sync.svg b/graphics/sync.svg new file mode 100644 index 0000000..a59f9f5 --- /dev/null +++ b/graphics/sync.svg @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + diff --git a/graphics/up.svg b/graphics/up.svg new file mode 100644 index 0000000..e474a1e --- /dev/null +++ b/graphics/up.svg @@ -0,0 +1,91 @@ + + + +image/svg+xml + + + + + + + + + + + \ No newline at end of file diff --git a/graphics/upload.svg b/graphics/upload.svg new file mode 100644 index 0000000..af5814b --- /dev/null +++ b/graphics/upload.svg @@ -0,0 +1,84 @@ + + + +image/svg+xml + + + + + + + + + + + + + \ No newline at end of file diff --git a/graphics/video-big.svg b/graphics/video-big.svg new file mode 100644 index 0000000..f410b07 --- /dev/null +++ b/graphics/video-big.svg @@ -0,0 +1,81 @@ + + + +image/svg+xml + + + + + \ No newline at end of file diff --git a/graphics/video.svg b/graphics/video.svg new file mode 100644 index 0000000..1f7f36e --- /dev/null +++ b/graphics/video.svg @@ -0,0 +1,76 @@ + + + +image/svg+xml + + + + + + + + + + \ No newline at end of file diff --git a/qml/ubi/AccountPage.qml b/qml/ubi/AccountPage.qml index b5901b8..6065bb7 100644 --- a/qml/ubi/AccountPage.qml +++ b/qml/ubi/AccountPage.qml @@ -9,6 +9,7 @@ Page { title: qsTr("Account") property variant secrets + property alias taskMenu: taskMenu Component.onCompleted: init() @@ -52,11 +53,11 @@ Page { //console.log("onErr"); mask.state = "idle"; if(status==401) { - tip.show(qsTr("Authorization failed!")); + tip.show(qsTr("Ubuntu One authorization has failed. Try once again or check login settings.")); } else if(status==0) { - tip.show(qsTr("Unable to connect!")); + tip.show(qsTr("Unable to connect. Check internet connection.")); } else { - tip.show(qsTr("Error: ")+status); + tip.show(qsTr("Unknown error: ")+status); } pageStack.pop(); } @@ -64,8 +65,9 @@ Page { Flickable { width: root.width height: root.height - contentHeight: content.height+Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN - y: Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN + + contentHeight: content.height+Const.TOP_BAR_HEIGHT+Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN + y: Const.TOP_BAR_HEIGHT Column { id: content @@ -156,4 +158,16 @@ Page { Spacer{} } } + + TaskMenu { + z: 200 + id: taskMenu + menuHeight: menuFixed.height+4*Const.DEFAULT_MARGIN + + menuDynamic: _menuDyn + Flow { + y: root.height-taskMenu.menuHeight-Const.SYSTEM_BAR_HEIGHT+1*Const.DEFAULT_MARGIN + id: _menuDyn + } + } } diff --git a/qml/ubi/DownloadArea.qml b/qml/ubi/DownloadArea.qml index 79fabca..62554a6 100644 --- a/qml/ubi/DownloadArea.qml +++ b/qml/ubi/DownloadArea.qml @@ -7,25 +7,38 @@ Item { property int count: 0 - height: taskView.height + /*Rectangle { + anchors.fill: parent + color: "red" + }*/ + + height: taskView.height+Const.DEFAULT_MARGIN function addTask(type,filename) { //emptyLabel.visible = Utils.emptyQuee(); //emptyLabel.visible = false; + //console.log("1. taskView.childrens.length: "+taskView.children.length); + //console.log("1. taskView.height: "+taskView.height); var comp = Qt.createComponent("components/Bar.qml"); + //var obj = comp.createObject(taskView,{"width": root.width}); var obj = comp.createObject(taskView); if (obj==null) { console.log("Error creating object"); } else { root.count++; - obj.width = root.width + //obj.width = root.width obj.label = filename; + obj.cancel.connect(function(file) { + Utils.cancelFile(file); + }); if(type=="download") obj.isDownload = true; if(type=="upload") obj.isUpload = true; } + //console.log("2. taskView.childrens.length: "+taskView.children.length); + //console.log("2. taskView.height: "+taskView.height); } function setProgress(filename, progress) @@ -33,8 +46,10 @@ Item { var l = taskView.children.length; for(var i=0;i=0) { + path = path.substr(ind+1); + } + if(path=="") path = "/"; + + return path; + } + + MouseArea { + anchors.fill: parent + } + + Rectangle { + id: fileSelector + + anchors.left: root.left; anchors.right: root.right + anchors.top: root.top + + height: parent.height + + property string currentFilePath: folderModel.folder + property bool load: true + property string folder: folderModel.folder + + color: Const.DEFAULT_DIALOG_BACKGROUND_COLOR + + function setFolder(folder) { + folderAnimation.folderToChange = folder; + folderAnimation.start(); + } + + Rectangle { + id: pathController + width: parent.width + height: currentFolderButton.height+2*Const.DEFAULT_MARGIN + anchors.top: parent.top + z: 1 + color: Const.LIGHT_AUBERGINE_COLOR + + ButtonResizable { + id: currentFolderButton + anchors.margins: Const.DEFAULT_MARGIN + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + text: fixPath(folderModel.folder) + width: pathController.width-folderUpButton.width-cancelButton.width-4*Const.DEFAULT_MARGIN + height: folderUpButton.height + onClicked: root.folderSelected(folderModel.folder) + disabled: !root.folderOnly + } + Button { + id: folderUpButton + anchors.margins: Const.DEFAULT_MARGIN + anchors.right: cancelButton.left + anchors.verticalCenter: parent.verticalCenter + label: "up" + iconSource: "images/up.png" + onButtonClicked: fileSelector.setFolder(folderModel.parentFolder); + + } + Button { + id: cancelButton + anchors.margins: Const.DEFAULT_MARGIN + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + label: "cancel" + iconSource: "images/close.png" + onButtonClicked: { + root.close(); + mask.state = "idle"; + } + } + + } + + Shadow { + y: pathController.height + z: 1 + } + + Rectangle { + id: folderModelContainer + width: parent.width + anchors.top: pathController.bottom; + anchors.bottom: parent.bottom + color: Const.TRANSPARENT + + FolderListModel { + id: folderModel + //folder: "/" + nameFilters: root.folderOnly ? [""] : ["*"] + } + + Component { + id: folderModelDelegate + + FileSmall { + id: file + width: root.width + visible: root.folderOnly? folderModel.isFolder(index) : true + text: fileName + isDirectory: folderModel.isFolder(index) + onClicked: { + if(isDirectory) + fileSelector.setFolder(filePath); + else + root.fileSelected(folderModel.folder,text) + } + + Component.onCompleted: { + var ind = text.lastIndexOf("."); + var ext = ""; + if(ind>=0) ext = text.substr(ind+1); + if(ext=="jpg" || ext=="JPG" || ext=="Jpg" || + ext=="jpeg" || ext=="JPEG" || ext=="Jpeg" || + ext=="gif" || ext=="GIF" || ext=="Gif" || + ext=="svg" || ext=="SVG" || ext=="Svg" || + ext=="png" || ext=="PNG" || ext=="Png") { + isPhoto = true; + } + if(ext=="mp3" || ext=="MP3" || ext=="Mp3" || + ext=="wma" || ext=="WMA" || ext=="Wma" || + ext=="wav" || ext=="WAV" || ext=="Wav" || + ext=="ogg" || ext=="OGG" || ext=="Ogg" || + ext=="acc" || ext=="ACC" || ext=="Acc" || + ext=="flac" || ext=="FLAC" || ext=="Flac") { + isMusic = true; + } + if(ext=="avi" || ext=="AVI" || ext=="Avi" || + ext=="mp4" || ext=="MP4" || ext=="Mp4" || + ext=="mpg" || ext=="MPG" || ext=="Mpg" || + ext=="mkv" || ext=="MKV" || ext=="Mkv" || + ext=="flv" || ext=="FLV" || ext=="Flv" || + ext=="3gp" || ext=="3GP") { + isVideo = true; + } + } + } + } + + ListView { + id: folderModelView + + anchors { + fill: parent; + } + + model: folderModel + delegate: folderModelDelegate + + SequentialAnimation { + id: folderAnimation + + property string folderToChange + + PropertyAnimation { target: folderModelView; property: "opacity"; to: 0; duration: 100 } + PropertyAction { target: folderModel; property: "folder"; value: folderAnimation.folderToChange } + PropertyAnimation { target: folderModelView; property: "opacity"; to: 1.0; duration: 100 } + } + } + + } + } +} + diff --git a/qml/ubi/FilesPage.qml b/qml/ubi/FilesPage.qml index 72f1f42..ebbf02e 100644 --- a/qml/ubi/FilesPage.qml +++ b/qml/ubi/FilesPage.qml @@ -16,44 +16,11 @@ Page { property string path property string name - menu: [ - [qsTr("Upload file"),false], - [qsTr("Rename"),false], - [qsTr("Delete"),false], - [qsTr("New folder"),false], - [qsTr("Refresh"),false] - ] - - function menuFun(id) { - if(id==qsTr("Upload file")) { - mask.state = "dialog"; - fileSelector.open(); - } - if(id==qsTr("Refresh")) { - init(root.properties); - } - if(id==qsTr("Rename")) { - if(root.path=="/") { - tip.show(qsTr("Root folder can't be renamed!")); - } else { - dialogRename.open(); - } - } - if(id==qsTr("Delete")) { - if(root.path=="/") { - tip.show(qsTr("Root folder can't be deleted!")); - } else { - dialogDelete.open(); - } - } - if(id==qsTr("New folder")) { - dialogNew.open(); - } - } + property alias taskMenu: taskMenu function init(prop) { - if(mask.state!="defocused") { + if(mask.state!="defocused" && mask.state!="dialog") { mask.state = "busy"; } if(root.properties && !prop) { @@ -90,13 +57,14 @@ Page { //console.log("onErr"); mask.state = "idle"; if(status==401) { - tip.show(qsTr("Authorization failed!")); + tip.show(qsTr("Ubuntu One authorization has failed. Try once again or check login settings.")); } else if(status==0) { - tip.show(qsTr("Unable to connect!")); + tip.show(qsTr("Unable to connect. Check internet connection.")); } else { - tip.show(qsTr("Error: ")+status); + tip.show(qsTr("Unknown error: ")+status); } pageStack.pop(); + initPage.hide() } @@ -113,9 +81,9 @@ Page { //console.log("onErrRenamed"); mask.state = "idle"; if(status==401) { - tip.show(qsTr("Authorization failed!")); + tip.show(qsTr("Ubuntu One authorization has failed. Try once again or check login settings.")); } else { - tip.show(qsTr("Error: ")+status); + tip.show(qsTr("Unknown error: ")+status); } } @@ -156,7 +124,7 @@ Page { } object.isDirectory = nodes[i].kind == "directory"; object.properties = nodes[i]; - object.width = root.width; + //object.width = root.width; //object.height = 50; if(object.isDirectory) { /*if(!nodes[i].has_children) { @@ -175,26 +143,54 @@ Page { pageStack.currentPage.init(prop); }); + // extension ind = object.name.lastIndexOf("."); var ext = ""; if(ind>=0) ext = object.name.substr(ind+1); if(ext=="jpg" || ext=="JPG" || ext=="Jpg" || ext=="jpeg" || ext=="JPEG" || ext=="Jpeg" || ext=="gif" || ext=="GIF" || ext=="Gif" || + ext=="svg" || ext=="SVG" || ext=="Svg" || ext=="png" || ext=="PNG" || ext=="Png") { object.isPhoto = true; } + if(ext=="mp3" || ext=="MP3" || ext=="Mp3" || + ext=="wma" || ext=="WMA" || ext=="Wma" || + ext=="wav" || ext=="WAV" || ext=="Wav" || + ext=="ogg" || ext=="OGG" || ext=="Ogg" || + ext=="acc" || ext=="ACC" || ext=="Acc" || + ext=="m4a" || ext=="M4A" || ext=="M4a" || + ext=="flac" || ext=="FLAC" || ext=="Flac") { + object.isMusic = true; + } + if(ext=="avi" || ext=="AVI" || ext=="Avi" || + ext=="mp4" || ext=="MP4" || ext=="Mp4" || + ext=="mpg" || ext=="MPG" || ext=="Mpg" || + ext=="mkv" || ext=="MKV" || ext=="Mkv" || + ext=="flv" || ext=="FLV" || ext=="Flv" || + ext=="m4v" || ext=="M4V" || ext=="M4v" || + ext=="3gp" || ext=="3GP") { + object.isVideo = true; + } } } - if(mask.state!="defocused") { + if(mask.state!="defocused" && mask.state!="dialog") { mask.state = "idle"; } - if(files.children.length==0) { + /*if(files.children.length==0) { + empty.visible = true; + } else { + empty.visible = false; + }*/ + + if(l==0) { empty.visible = true; } else { empty.visible = false; } + + initPage.hide() } Connections { @@ -206,15 +202,12 @@ Page { id: flickable width: parent.width height: parent.height - contentHeight: files.height+Const.SYSTEM_BAR_HEIGHT+2*Const.TEXT_MARGIN - //y: Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN - y: Const.SYSTEM_BAR_HEIGHT+Const.DEFAULT_MARGIN + contentHeight: files.height+Const.TOP_BAR_HEIGHT+Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN + y: Const.TOP_BAR_HEIGHT contentWidth: parent.width Column { id: files - //spacing: Const.DEFAULT_MARGIN - //x: Const.TEXT_MARGIN add: Transition { NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad } } @@ -231,7 +224,7 @@ Page { visible: false } - FileSelector { + /*FileSelector { id: fileSelector z: 200 folder: Utils.lastFolder()=="" ? Const.DEFAULT_FOLDER : Utils.lastFolder() @@ -246,6 +239,21 @@ Page { U1.uploadFile(secrets,root,path,file,folder,Utils); } + }*/ + + FileDialog { + id: fileSelector + z: 200 + hidden: true + folder: Utils.lastFolder()=="" ? Const.DEFAULT_FOLDER : Utils.lastFolder() + folderOnly: false + onFileSelected: { + mask.state = "idle"; + fileSelector.close(); + Utils.setLastFolder(folder); + var path = content_path+"/"+file; + U1.uploadFile(secrets,root,path,file,folder,Utils); + } } function getParentPath(path) { @@ -298,13 +306,11 @@ Page { text: qsTr("Delete folder?") onOpened: mask.state = "dialog" onClosed: { - mask.state = "idle"; if(ok) { mask.state = "busy"; U1.deleteFile(secrets,properties.resource_path,root,Utils); } } - onCanceled: mask.state = "idle" } DialogInput { @@ -316,7 +322,6 @@ Page { onOpened: { reset(); Utils.setOrientation("auto"); - mask.state = "dialog"; } onClosed: { mask.state = "idle"; @@ -334,7 +339,6 @@ Page { } onCanceled: { Utils.setOrientation(root.orientation); - mask.state = "idle"; } } @@ -347,10 +351,8 @@ Page { onOpened: { reset(); Utils.setOrientation("auto"); - mask.state = "dialog"; } onClosed: { - mask.state = "idle"; Utils.setOrientation(root.orientation); var r = trim(resp); if(r!="") { @@ -369,7 +371,106 @@ Page { } onCanceled: { Utils.setOrientation(root.orientation); - mask.state = "idle"; + } + } + + /*[qsTr("Upload file"),false], + [qsTr("Rename"),false], + [qsTr("Delete"),false], + [qsTr("New folder"),false], + [qsTr("Refresh"),false] + function menuFun(id) { + if(id==qsTr("Upload file")) { + mask.state = "dialog"; + fileSelector.open(); + } + if(id==qsTr("Refresh")) { + init(root.properties); + } + if(id==qsTr("Rename")) { + if(root.path=="/") { + tip.show(qsTr("Root folder can't be renamed!")); + } else { + dialogRename.open(); + } + } + if(id==qsTr("Delete")) { + if(root.path=="/") { + tip.show(qsTr("Root folder can't be deleted!")); + } else { + dialogDelete.open(); + } + } + if(id==qsTr("New folder")) { + dialogNew.open(); + } + } +*/ + + TaskMenu { + z: 200 + id: taskMenu + + contexMenu: true + menuDynamic: _menuDyn + menuHeight: menuDynamic.height+menuFixed.height+7*Const.DEFAULT_MARGIN + + Flow { + id: _menuDyn + + y: root.height-taskMenu.menuHeight-Const.SYSTEM_BAR_HEIGHT+2*Const.DEFAULT_MARGIN + x: Const.DEFAULT_MARGIN + + width: parent.width-2*Const.DEFAULT_MARGIN + spacing: Const.DEFAULT_MARGIN + + Button { + label: qsTr("Upload file"); + onButtonClicked: { + taskMenu.close(); + fileSelector.open(); + } + } + + Button { + label: qsTr("Rename"); + onButtonClicked: { + taskMenu.close(); + if(root.path=="/") { + tip.show(qsTr("Root folder cannot be renamed.")); + } else { + dialogRename.open(); + } + } + } + + Button { + label: qsTr("Delete"); + onButtonClicked: { + taskMenu.close(); + if(root.path=="/") { + tip.show(qsTr("Root folder cannot be deleted.")); + } else { + dialogDelete.open(); + } + } + } + + Button { + label: qsTr("New folder"); + onButtonClicked: { + taskMenu.close(); + dialogNew.open(); + } + } + + Button { + label: qsTr("Refresh"); + onButtonClicked: { + taskMenu.close(); + init(root.properties); + } + } } } } diff --git a/qml/ubi/InitPage.qml b/qml/ubi/InitPage.qml index 755df06..9803d27 100644 --- a/qml/ubi/InitPage.qml +++ b/qml/ubi/InitPage.qml @@ -3,22 +3,17 @@ import "UIConstants.js" as Const import "u1.js" as U1 import "components" -Rectangle { +Showable { id: root - color: Const.DEFAULT_BACKGROUND_COLOR - state: "opened" - - function hide() { - root.state = "closed"; - } + hidden: false Component.onCompleted: init() function init() { if(Utils.isAuthorized()) { //title = "Hi, "+Utils.name(); - login(); + //login(); } else { pageStack.initialPage = "LoginPage.qml"; hide(); @@ -26,13 +21,15 @@ Rectangle { } function login() { - var secrets = { + /*var secrets = { token: Utils.token(), secret: Utils.tokenSecret(), consumer_key : Utils.customerKey(), consumer_secret: Utils.customerSecret() }; U1.getRootNode(secrets,root); + */ + pageStack.currentPage.init(); } function onRespRootNode(resp) { @@ -42,84 +39,72 @@ Rectangle { function onErr(status) { hide() if(status==401) { - tip.show(qsTr("Authorization failed!")); + tip.show(qsTr("Ubuntu One authorization has failed. Try once again or check login settings.")); } else if(status==0) { - tip.show(qsTr("Unable to connect!")); + tip.show(qsTr("Unable to connect. Check internet connection.")); } else { - tip.show(qsTr("Error: ")+status); + tip.show(qsTr("Unknown error: ")+status); } } - Image { - id: pic - source: "images/ubi100.png" - width: 104; height: 70 - anchors.horizontalCenter: parent.horizontalCenter - y: (root.height-height)/3 - } - - Text { - id: loading - anchors.top: pic.bottom - anchors.margins: Const.TEXT_MARGIN - anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: 25 - color: "white" - text: "Loading..." + MouseArea { + anchors.fill: parent } - Image { - id: icon - width: 64 - height: 64 - anchors.top: loading.bottom - anchors.margins: 2*Const.TEXT_MARGIN - source: "images/progress.png" - sourceSize.width: width - sourceSize.height: height - anchors.horizontalCenter: parent.horizontalCenter - Component.onCompleted: animationIcon.start() - - NumberAnimation { - id: animationIcon - target: icon - properties: "rotation" - from: 0 - to: 360 - duration: 500 - loops: Animation.Infinite + Rectangle { + id: box + + width: root.width; height: root.height + color: Const.DEFAULT_BACKGROUND_COLOR + + Column { + spacing: Const.TEXT_MARGIN + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + Image { + id: pic + source: "images/ubi100.png" + width: 104; height: 70 + anchors.horizontalCenter: parent.horizontalCenter + //y: (box.height-height)/3 + } + + Text { + id: loading + //anchors.top: pic.bottom + //anchors.margins: Const.TEXT_MARGIN + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 25 + color: "white" + text: qsTr("Connecting...") + } + + BusyIndicator { + //anchors.top: loading.bottom + //anchors.margins: 2*Const.TEXT_MARGIN + anchors.horizontalCenter: parent.horizontalCenter + running: true + } } - } - Text { - anchors.bottom: root.bottom - anchors.bottomMargin: Const.TEXT_MARGIN - anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: 18 - color: "white" - text: "ver. 0.9.2-2" - } - - MouseArea { - anchors.fill: parent - } + Text { + anchors.bottom: ver.top + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 20 + color: "white" + text: "v0.9.3-1 © 2012 Michal Kosciesza" + } - states: [ - State { - name: "opened" - //PropertyChanges { target: root; opacity: 1 } - PropertyChanges { target: root; y: 0} - }, - State { - name: "closed" - //PropertyChanges { target: root; opacity: 0 } - PropertyChanges { target: root; y: root.height } + Text { + id: ver + anchors.bottom: box.bottom + anchors.bottomMargin: 2*Const.TEXT_MARGIN + anchors.horizontalCenter: parent.horizontalCenter + font.pixelSize: 20 + color: "white" + text: "http://ubi.garage.maemo.org" } - ] - transitions: Transition { - //NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad } - NumberAnimation { properties: "y"; easing.type: Easing.InOutQuad } } - } diff --git a/qml/ubi/LoginPage.qml b/qml/ubi/LoginPage.qml index deee992..0b8b3d6 100644 --- a/qml/ubi/LoginPage.qml +++ b/qml/ubi/LoginPage.qml @@ -8,6 +8,8 @@ Page { title: qsTr("Login") orientation: "auto" + //property alias taskMenu: taskMenu + function getToken() { mask.state = "busy"; U1.getToken(user.text,pass.text,root) @@ -22,26 +24,29 @@ Page { Utils.setName(account.username); tip.show(qsTr("Logged in!")); - pageStack.initialPage = "StartPage.qml"; + //pageStack.initialPage = "StartPage.qml"; + pageStack.initialPage = "FilesPage.qml"; + pageStack.currentPage.init(); } function onErr(status) { mask.state = "idle"; //console.log("onErr"); if(status==401) { - tip.show(qsTr("Authorization failed!")); + tip.show(qsTr("Ubuntu One authorization has failed. Try once again or check login settings.")); } else if(status==0) { - tip.show(qsTr("Unable to connect!")); + tip.show(qsTr("Unable to connect. Check internet connection.")); } else { - tip.show(qsTr("Error: ")+status); + tip.show(qsTr("Unknown error: ")+status); } } Flickable { width: root.width height: root.height - contentHeight: content.height+Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN - y: Const.SYSTEM_BAR_HEIGHT+2*Const.TEXT_MARGIN + + contentHeight: content.height+Const.TOP_BAR_HEIGHT+Const.SYSTEM_BAR_HEIGHT+Const.TEXT_MARGIN + y: Const.TOP_BAR_HEIGHT Column { id: content @@ -77,4 +82,16 @@ Page { } } } + + /*TaskMenu { + z: 200 + id: taskMenu + menuHeight: menuFixed.height+4*Const.DEFAULT_MARGIN + + menuDynamic: _menuDyn + Flow { + y: root.height-taskMenu.menuHeight-Const.SYSTEM_BAR_HEIGHT+1*Const.DEFAULT_MARGIN + id: _menuDyn + } + }*/ } diff --git a/qml/ubi/Page.qml b/qml/ubi/Page.qml new file mode 100644 index 0000000..b0d3a81 --- /dev/null +++ b/qml/ubi/Page.qml @@ -0,0 +1,76 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "UIConstants.js" as Const +import "components" + +Item { + id: root + property string title: "" + property string orientation: Const.DEFAULT_ORIENTATION + property variant menu + property alias mask: _mask + + anchors.fill: parent + + Rectangle { + anchors.right: parent.right + anchors.left: parent.left + height: parent.height + y: Const.SYSTEM_BAR_HEIGHT + color: Const.DEFAULT_BACKGROUND_COLOR + } + + Mask { + id: _mask + z: 100 + anchors.fill: parent + onClicked: taskBar.close() + } + + Component.onCompleted: { + Utils.setOrientation(orientation); + //reloadMenu(); + } + + /*function reloadMenu() { + var buttons = root.menu; + + var menu = taskBar.getMenu(); + var comp = Qt.createComponent("components/Button.qml"); + + var i,l; + if(menu.children.length>0) { + l = menu.children.length; + for(i=0;i0) { + l = buttons.length; + for(i=0;i 0 ? "images/back.png" : "images/close.png" + anchors { verticalCenter: parent.verticalCenter; left: parent.left; margins: Const.DEFAULT_MARGIN } + onButtonClicked: pageStack.index > 0 ? pageStack.pop() : Qt.quit() } - ToolIcon { - id: backButton + /*Button { + id: switchButton + label: "s" + anchors { verticalCenter: parent.verticalCenter; left: minimizeButton.right; margins: Const.DEFAULT_MARGIN } + onButtonClicked: { + tip.show("ala ma kota, a kot ma Ale bardzo czesto i bardzo dobrze, oooo, tralalal!"); + } + }*/ - width: 80 - anchors { verticalCenter: parent.verticalCenter; right: parent.right } - iconSource: pageStack.index > 0 ? "images/back.png" : "images/close.png" - onClicked: pageStack.index > 0 ? pageStack.pop() : Qt.quit() - onPressAndHold: if (pageStack.index > 0) pageStack.clear() + Button { + id: downloadButton + iconSource: "images/upload.png" + anchors { verticalCenter: parent.verticalCenter; right: menuButton.left; margins: Const.DEFAULT_MARGIN } + onButtonClicked: downloadDialog.open() + opacity: downloadDialog.isActiveDownloads ? 1 : 0 + + transitions: Transition { + NumberAnimation { properties: "opacity"; duration: 600; easing.type: Easing.InOutQuad } + } + } + + Button { + id: menuButton + iconSource: "images/options.png" + anchors { verticalCenter: parent.verticalCenter; right: parent.right; margins: Const.DEFAULT_MARGIN } + onButtonClicked: pageStack.currentPage.taskMenu.open() + visible: pageStack.currentPage.taskMenu!=undefined } MouseArea { @@ -116,6 +171,32 @@ Item { z: -1 } + Rectangle { + id: mask + anchors.fill: parent + color: "black" + + MouseArea { + anchors.fill: parent + onClicked: root.clickedOnMask() + } + } + + states: [ + State { + name: "active" + PropertyChanges { target: mask; opacity: 0 } + }, + State { + name: "inactive" + PropertyChanges { target: mask; opacity: 0.6 } + } + ] + + transitions: Transition { + NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad } + } + } diff --git a/qml/ubi/TaskMenu.qml b/qml/ubi/TaskMenu.qml new file mode 100644 index 0000000..1808156 --- /dev/null +++ b/qml/ubi/TaskMenu.qml @@ -0,0 +1,71 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "components" +import "UIConstants.js" as Const + +DialogBlank { + id: root + + property alias menuHeight: root.boxHeight + + property alias menuFixed: _menuFixed + property Flow menuDynamic + + property bool contexMenu: false + + onOpened: { + mask.state = "dialog"; + } + onCanceled: { + mask.state = "idle"; + } + + Line { + id: line + anchors.top: root.menuDynamic.bottom + anchors.topMargin: Const.DEFAULT_MARGIN + width: root.width + visible: root.contexMenu + } + + Flow { + id: _menuFixed + + //y: root.height-root.menuHeight+1*Const.DEFAULT_MARGIN + + anchors.top: root.contexMenu ? line.bottom : root.menuDynamic.bottom + anchors.topMargin: Const.DEFAULT_MARGIN + + x: Const.DEFAULT_MARGIN + + width: root.width-2*Const.DEFAULT_MARGIN + spacing: Const.DEFAULT_MARGIN + + Button { + label: qsTr("Account"); + onButtonClicked: { + taskMenu.close(); + if(pageStack.currentPage.title!=qsTr("Account")) { + pageStack.push("AccountPage.qml"); + } + } + } + + Button { + label: qsTr("Settings"); + onButtonClicked: { + taskMenu.close(); + if(pageStack.currentPage.title!=qsTr("Settings")) { + pageStack.push("SettingsPage.qml"); + } + } + } + + Button { + label: qsTr("About Ubi"); + onButtonClicked: { + taskMenu.close(); + aboutDialog.open(); + } + } + } +} diff --git a/qml/ubi/TopBar.qml b/qml/ubi/TopBar.qml new file mode 100644 index 0000000..24e4b7e --- /dev/null +++ b/qml/ubi/TopBar.qml @@ -0,0 +1,100 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "components" +import "UIConstants.js" as Const + +Item { + id: root + + height: Const.TOP_BAR_HEIGHT + anchors { left: parent.left; right: parent.right; top: top.bottom } + + function hide() { + visible = false; + } + + function show() { + visible = true; + } + + Rectangle { + id: box + width: 50 + height: width + radius: 5 + color: mouseArea.pressed ? "white" : "black" + opacity: 0.2 + x: -width/2 + y: -width/2 + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: Utils.minimizeWindow() + } + } + + Rectangle { + width: box.width/2-16 + height: 2 + color: "white" + x: 8 + y: (box.width/4)-1 + } + + /*Rectangle { + width: parent.width + height: root.height + color: Const.TRANSPARENT + //color: "black" + } + + Item { + id: minimizeButton + width: 80; + height: 60 + anchors { verticalCenter: parent.verticalCenter; left: parent.left; margins: 5 } + + Rectangle { + id: background + anchors { fill: parent; margins: 6 } + color: "black" + opacity: 0.2 + radius: 10 + } + + Rectangle { + anchors { fill: parent; margins: 6 } + color: "white" + opacity: 0.5 + radius: 10 + visible: mouseArea.pressed + } + + Image { + id: icon + anchors.centerIn: parent + source: "images/minimize.png" + sourceSize.width: width + sourceSize.height: height + } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: Utils.minimizeWindow() + } + }*/ + + /*ToolIcon { + id: backButton + width: 80 + anchors { verticalCenter: parent.verticalCenter; right: parent.right; margins: 5 } + iconSource: "images/close.png" + onClicked: Qt.quit() + }*/ + +} + + + + diff --git a/qml/ubi/UIConstants.js b/qml/ubi/UIConstants.js index 1e99bf7..072ea3b 100644 --- a/qml/ubi/UIConstants.js +++ b/qml/ubi/UIConstants.js @@ -36,7 +36,8 @@ var DEFAULT_TEXT_COLOR = DEFAULT_FOREGROUND_COLOR; var DEFAULT_FOLDER = "file:///home/user/MyDocs"; -var SYSTEM_BAR_HEIGHT = 60; +var SYSTEM_BAR_HEIGHT = 70; +var TOP_BAR_HEIGHT = 10; var TEXT_MARGIN = 25; // images diff --git a/qml/ubi/components/Bar.qml b/qml/ubi/components/Bar.qml index 0b07274..ff0df97 100644 --- a/qml/ubi/components/Bar.qml +++ b/qml/ubi/components/Bar.qml @@ -7,64 +7,82 @@ Item { property string label property bool isDownload: false property bool isUpload: false - height: 32 - - Image { - id: icon - width: root.height - height: root.height - source: isDownload? "../"+Const.ICON_DOWN : (isUpload? "../"+Const.ICON_UP : "") - sourceSize.width: width - sourceSize.height: height - visible: isDownload || isUpload - } + height: button.height + //width: parent.width - Rectangle { - id: bbar + width: mainWindow.width-3*Const.DEFAULT_MARGIN - color: Const.TRANSPARENT - border.width: 2 - radius: 5 - border.color: Const.DEFAULT_FOREGROUND_COLOR - height: root.height - width: icon.visible? root.width-icon.width-5 : root.width - x: icon.visible? icon.width+5 : 0 + signal cancel(string file); - Rectangle { - id: bar - height: parent.height - width: 0 - x:0 - radius: 5 - color: Const.DEFAULT_FOREGROUND_COLOR - state: "right" - - states: [ - State { - name: "right" - }, - State { - name: "left" - }, - State { - name: "progress" - } - ] + Row { + spacing: Const.DEFAULT_MARGIN + anchors.verticalCenter: parent.verticalCenter + + Image { + id: icon + source: isDownload? "../images/download.png" : + isUpload? "../images/upload.png" : "" + visible: isDownload || isUpload + anchors.verticalCenter: parent.verticalCenter } - Text { - id: caption - font.pixelSize: 25 - anchors.centerIn: parent - //color: Const.DEFAULT_FOREGROUND_COLOR - text: root.label.length>28 ? root.label.substring(0,25)+"..." : root.label - color: "black" + Rectangle { + id: bbar + anchors.verticalCenter: parent.verticalCenter + color: Const.TRANSPARENT + border.width: 2 + //radius: 5 + border.color: Const.DEFAULT_FOREGROUND_COLOR + height: 40 + width: icon.visible? + root.width-icon.width-button.width-2*Const.DEFAULT_MARGIN : + root.width-button.width-1*Const.DEFAULT_MARGIN + //x: icon.visible? icon.width+5 : 0 + + Rectangle { + id: bar + height: parent.height + width: 0 + x:0 + color: Const.DEFAULT_FOREGROUND_COLOR + state: "right" + + states: [ + State { + name: "right" + }, + State { + name: "left" + }, + State { + name: "progress" + } + ] + } + + Text { + id: caption + font.pixelSize: 25 + anchors.centerIn: parent + //color: Const.DEFAULT_FOREGROUND_COLOR + text: root.label + width: bbar.width + elide: Text.ElideRight + horizontalAlignment: Text.AlignHCenter + color: "black" + } } + Button { + id: button + anchors.verticalCenter: parent.verticalCenter + iconSource: "images/close.png" + onButtonClicked: root.cancel(root.label) + } } function setProgres(progress) { - console.log("proggress = "+progress); + //console.log("proggress = "+progress); if(bar.state!="progress") { time.stop(); bar.state = "progress" diff --git a/qml/ubi/components/BusyIndicator.qml b/qml/ubi/components/BusyIndicator.qml new file mode 100644 index 0000000..27a2a7d --- /dev/null +++ b/qml/ubi/components/BusyIndicator.qml @@ -0,0 +1,37 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +//import "../UIConstants.js" as Const + +Image { + id: icon + + property bool running: false + + width: 64 + height: 64 + + source: "../images/progress.png" + sourceSize.width: width + sourceSize.height: height + + Component.onCompleted: { + if(running) animation.start(); + } + + onRunningChanged: { + if(running) { + animation.start(); + } else { + animation.stop(); + } + } + + NumberAnimation { + id: animation + target: icon + properties: "rotation" + from: 0 + to: 360 + duration: 500 + loops: Animation.Infinite + } +} diff --git a/qml/ubi/components/Button.qml b/qml/ubi/components/Button.qml index fd947ef..3eb5ad8 100644 --- a/qml/ubi/components/Button.qml +++ b/qml/ubi/components/Button.qml @@ -27,8 +27,9 @@ Item { Rectangle { id: box color: root.disabled ? Const.COOL_GREY_COLOR : "black" - height: textbox.height+20 - width: textbox.width<100 ? 120 : textbox.width+20 + height: root.iconSource=="" ? textbox.height+20 : icon.height+20 + //width: textbox.width<100 ? 120 : textbox.width+20 + width: root.iconSource=="" ? textbox.width+30 : icon.width+30 radius: 10 } @@ -46,8 +47,8 @@ Item { Image { id: icon - width: 40 - height: 40 + //width: 30 + //height: 30 anchors.centerIn: box source: root.iconSource == "" ? "" : "../" + root.iconSource sourceSize.width: width @@ -67,8 +68,6 @@ Item { Text { id: textbox - //x: 10 - //y: 10 font.pixelSize: root.fontSize color: root.disabled ? "gray" : "white" anchors.centerIn: box diff --git a/qml/ubi/components/ButtonGlass.qml b/qml/ubi/components/ButtonGlass.qml new file mode 100644 index 0000000..acce2c6 --- /dev/null +++ b/qml/ubi/components/ButtonGlass.qml @@ -0,0 +1,113 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "../UIConstants.js" as Const + +Item { + id: root + property string label + property bool disabled: false + property int fontSize: 30 + property int maxSize: 27 + property string iconSource + + state: mouseArea.pressed && !root.disabled ? "pressed" : "unpressed" + + width: box.width + height: box.height + + signal buttonClicked(string label) + + Rectangle { + id: shadow + width: box.width + height: box.height + color: Const.SHADOW_COLOR; + radius: 10 + visible: false + } + + Rectangle { + id: box + color: root.disabled ? Const.COOL_GREY_COLOR : "black" + height: root.iconSource=="" ? textbox.height+20 : icon.height+20 + //width: textbox.width<100 ? 120 : textbox.width+20 + width: root.iconSource=="" ? textbox.width+30 : icon.width+30 + radius: 10 + visible: false + } + + Image { + source: root.state != "pressed" ? + "../images/pushbutton_normal.png" : + "../images/pushbutton_disabled.png" + } + + Rectangle { + width: box.width + height: box.height + x: box.x + y: box.y + color: Const.WARM_GREY_COLOR + radius: 10 + //visible: root.state == "pressed" + visible: false + //border.color: "black" + //border.width: Const.SHADOW_OFFSET + } + + Image { + id: icon + //width: 30 + //height: 30 + anchors.centerIn: box + source: root.iconSource == "" ? "" : "../" + root.iconSource + sourceSize.width: width + sourceSize.height: height + } + + onLabelChanged: { + if(root.label.length>root.maxSize) { + //console.log("root.label: "+root.label) + //console.log("root.label.length: "+root.label.length) + //console.log("root.maxSize: "+root.maxSize) + textbox.text = root.label.substring(0,root.maxSize-3)+"..."; + } else { + textbox.text = root.label; + } + } + + Text { + id: textbox + font.pixelSize: root.fontSize + color: root.disabled ? "gray" : "white" + anchors.centerIn: box + visible: root.iconSource == "" + } + + MouseArea { + id: mouseArea + width: box.width + height: box.height + onClicked: root.buttonClicked(root.label) + enabled: !root.disabled + } + + states: [ + State { + name: "unpressed" + PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET} + PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET} + PropertyChanges {target: box; x: 0} + PropertyChanges {target: box; y: 0} + }, + State { + name: "pressed" + PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET} + PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET} + PropertyChanges {target: box; x: Const.SHADOW_OFFSET} + PropertyChanges {target: box; y: Const.SHADOW_OFFSET} + } + ] +} + + + diff --git a/qml/ubi/components/ButtonResizable.qml b/qml/ubi/components/ButtonResizable.qml new file mode 100644 index 0000000..e9c0270 --- /dev/null +++ b/qml/ubi/components/ButtonResizable.qml @@ -0,0 +1,91 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "../UIConstants.js" as Const + +Item { + id: root + property alias text: textbox.text + property bool disabled: false + property int fontSize: 30 + property string iconSource + + state: mouseArea.pressed && !root.disabled ? "pressed" : "unpressed" + + signal clicked(string label) + + Rectangle { + id: shadow + width: box.width + height: box.height + color: Const.SHADOW_COLOR; + radius: 10 + } + + Rectangle { + id: box + color: root.disabled ? Const.COOL_GREY_COLOR : "black" + height: root.height + width: root.width + radius: 10 + } + + Rectangle { + width: box.width + height: box.height + x: box.x + y: box.y + color: Const.WARM_GREY_COLOR + radius: 10 + visible: root.state == "pressed" + //border.color: "black" + //border.width: Const.SHADOW_OFFSET + } + + Image { + id: icon + width: 40 + height: 40 + anchors.centerIn: box + source: root.iconSource == "" ? "" : "../" + root.iconSource + sourceSize.width: width + sourceSize.height: height + } + + Text { + id: textbox + font.pixelSize: root.fontSize + elide: Text.ElideRight + color: root.disabled ? "gray" : "white" + anchors.left: box.left; anchors.right: box.right + anchors.margins: Const.DEFAULT_MARGIN + anchors.verticalCenter: box.verticalCenter + //visible: root.iconSource == "" + } + + MouseArea { + id: mouseArea + width: box.width + height: box.height + onClicked: root.clicked(root.label) + enabled: !root.disabled + } + + states: [ + State { + name: "unpressed" + PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET} + PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET} + PropertyChanges {target: box; x: 0} + PropertyChanges {target: box; y: 0} + }, + State { + name: "pressed" + PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET} + PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET} + PropertyChanges {target: box; x: Const.SHADOW_OFFSET} + PropertyChanges {target: box; y: Const.SHADOW_OFFSET} + } + ] +} + + + diff --git a/qml/ubi/components/DialogBlank.qml b/qml/ubi/components/DialogBlank.qml new file mode 100644 index 0000000..6765671 --- /dev/null +++ b/qml/ubi/components/DialogBlank.qml @@ -0,0 +1,32 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "../UIConstants.js" as Const + +DialogBox { + id: root + + property alias boxHeight: _box.height + property alias box: _box + + Rectangle { + id: _box + anchors.left: root.left; anchors.right: root.right + anchors.bottom: root.bottom + color: Const.LIGHT_AUBERGINE_COLOR + + MouseArea { + anchors.fill: parent + onClicked: { + root.canceled(); + root.close(); + } + } + } + + Rectangle { + anchors.right: root.right; anchors.left: root.left + anchors.bottom: box.top + height: Const.SHADOW_OFFSET + color: "black" + opacity: 0.5 + } +} diff --git a/qml/ubi/components/DialogBox.qml b/qml/ubi/components/DialogBox.qml index 571aaf2..b72d8aa 100644 --- a/qml/ubi/components/DialogBox.qml +++ b/qml/ubi/components/DialogBox.qml @@ -1,24 +1,34 @@ import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import "../UIConstants.js" as Const -Item { +Showable { id: root + hidden: true + //easingType: Easing.InOutBounce + anchors.left: parent.left; anchors.right: parent.right - height: parent.height - state: "closed" + height: parent.height-Const.SYSTEM_BAR_HEIGHT+Const.SHADOW_OFFSET signal opened() signal canceled() function open() { root.forceActiveFocus(); - root.state = "opened"; + root.show(); root.opened(); + topbar.hide(); + systemBar.state = "inactive"; + pageStack.currentPage.mask.state = "dialog"; } function close() { - root.state = "closed"; + if(state!="closed") { + root.hide(); + topbar.show(); + systemBar.state = "active"; + pageStack.currentPage.mask.state = "idle"; + } } MouseArea { @@ -28,23 +38,5 @@ Item { root.close(); } } - - states: [ - State { - name: "opened" - PropertyChanges { target: root; opacity: 1 } - PropertyChanges { target: root; y: 0} - }, - State { - name: "closed" - PropertyChanges { target: root; opacity: 0 } - PropertyChanges { target: root; y: root.height } - } - ] - - transitions: Transition { - NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad } - NumberAnimation { properties: "y"; easing.type: Easing.InOutQuad } - } } diff --git a/qml/ubi/components/File.qml b/qml/ubi/components/File.qml index cfeace7..55a3bd2 100644 --- a/qml/ubi/components/File.qml +++ b/qml/ubi/components/File.qml @@ -7,6 +7,8 @@ Item { property alias description: details.text property bool isDirectory: false property bool isPhoto: false + property bool isMusic: false + property bool isVideo: false property bool isPublic: false property variant properties: null property string filename: "" @@ -14,7 +16,7 @@ Item { state: mouseArea.pressed && !root.disabled ? "pressed" : "unpressed" - //width: parent.width + width: mainWindow.width height: box.height signal clicked(variant prop) @@ -68,12 +70,13 @@ Item { Image { id: icon - width: 50 - height: 50 + width: 60 + height: 60 x: Const.TEXT_MARGIN-5 source: root.isDirectory ? "../images/folder.png" : - root.isPhoto ? "../images/photo.png" : - "../images/document.png" + root.isPhoto ? "../images/photo.png" : + root.isMusic ? "../images/music.png" : + root.isVideo ? "../images/video.png" : "../images/document.png" sourceSize.width: width sourceSize.height: height anchors.verticalCenter: box.verticalCenter @@ -85,7 +88,7 @@ Item { font.pixelSize: 30 color: Const.DEFAULT_FOREGROUND_COLOR elide: Text.ElideRight - wrapMode: Text.Wrap + //wrapMode: Text.Wrap width: root.isPublic ? root.width-x-Const.TEXT_MARGIN-3*Const.DEFAULT_MARGIN-arrow.width-publicIcon.width : root.width-x-Const.TEXT_MARGIN-1*Const.DEFAULT_MARGIN-arrow.width @@ -122,7 +125,7 @@ Item { width: 30 height: 30 anchors.right: box.right - anchors.margins: Const.TEXT_MARGIN + anchors.margins: Const.DEFAULT_MARGIN source: "../images/next.png" sourceSize.width: width sourceSize.height: height diff --git a/qml/ubi/components/FileOld.qml b/qml/ubi/components/FileOld.qml deleted file mode 100644 index 8dff818..0000000 --- a/qml/ubi/components/FileOld.qml +++ /dev/null @@ -1,89 +0,0 @@ -import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 -import "../UIConstants.js" as Const - - -Item { - id: root - property alias name: label.text - property bool isDirectory: false - property variant properties: null - property string filename: "" - property int textMax: 27 - - state: mouseArea.pressed && !root.disabled ? "pressed" : "unpressed" - - width: box.width - height: box.height - - signal clicked(variant prop) - - Rectangle { - id: shadow - width: box.width - height: box.height - color: Const.SHADOW_COLOR; - radius: 10 - x: Const.SHADOW_OFFSET; - y: Const.SHADOW_OFFSET; - } - - Rectangle { - id: box - color: root.isDirectory ? "black" : "white" - height: label.height+20 - width: label.width<=100 ? 120 : label.width+20 - radius: 10 - } - - Rectangle { - width: box.width - height: box.height - x: box.x - y: box.y - color: root.isDirectory ? "white" : "black" - opacity: 0.5 - radius: 10 - visible: mouseArea.pressed - } - - Text { - id: label - x: 10 - y: 10 - font.pixelSize: 30 - color: root.isDirectory ? "white" : "black" - elide: Text.ElideLeft - anchors.centerIn: box - wrapMode: Text.Wrap - onTextChanged: { - if(text.length>root.textMax) - root.name = text.substring(0,root.textMax-3)+"..."; - } - } - - MouseArea { - id: mouseArea - width: box.width - height: box.height - onClicked: { - root.clicked(root.properties); - } - } - - states: [ - State { - name: "unpressed" - PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET} - PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET} - PropertyChanges {target: box; x: 0} - PropertyChanges {target: box; y: 0} - }, - State { - name: "pressed" - PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET} - PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET} - PropertyChanges {target: box; x: Const.SHADOW_OFFSET} - PropertyChanges {target: box; y: Const.SHADOW_OFFSET} - } - ] -} diff --git a/qml/ubi/components/FileSmall.qml b/qml/ubi/components/FileSmall.qml new file mode 100644 index 0000000..d8be3f7 --- /dev/null +++ b/qml/ubi/components/FileSmall.qml @@ -0,0 +1,67 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "../UIConstants.js" as Const + + +Item { + id: root + property alias text: label.text + property bool isDirectory: false + property bool isPhoto: false + property bool isMusic: false + property bool isVideo: false + + signal clicked() + + height: box.height + + Rectangle { + id: box + color: Const.TRANSPARENT + height: 70 + width: root.width + } + + Rectangle { + width: box.width + height: box.height + x: box.x; y: box.y + color: Const.DEFAULT_DIALOG_FOREGROUND_COLOR + opacity: 0.4 + visible: mouseArea.pressed + } + + Image { + id: icon + width: 40 + height: 40 + source: root.isDirectory ? "../images/folder-small.png" : + root.isPhoto ? "../images/photo-small.png" : + root.isMusic ? "../images/music-small.png" : + root.isVideo ? "../images/video-small.png" : "../images/document-small.png" + sourceSize.width: width + sourceSize.height: height + anchors.left: box.left; + anchors.verticalCenter: box.verticalCenter + anchors.margins: Const.TEXT_MARGIN + } + + Text { + id: label + x: 10; y: 10 + font.pixelSize: 30 + color: Const.DEFAULT_DIALOG_FOREGROUND_COLOR + elide: Text.ElideRight + anchors.left: icon.right; anchors.right: box.right + anchors.verticalCenter: box.verticalCenter + anchors.margins: Const.TEXT_MARGIN + } + + MouseArea { + id: mouseArea + width: box.width + height: box.height + onClicked: { + root.clicked(root.properties); + } + } +} diff --git a/qml/ubi/components/Mask.qml b/qml/ubi/components/Mask.qml index f34eab0..b9f68a7 100644 --- a/qml/ubi/components/Mask.qml +++ b/qml/ubi/components/Mask.qml @@ -10,9 +10,9 @@ Item { onStateChanged: { if(root.state=="busy") { - animationIcon.start(); + busy.running = true; } else { - animationIcon.stop(); + busy.running = false; } } @@ -29,25 +29,11 @@ Item { font.pixelSize: Const.DEFAULT_FONT_PIXEL_SIZE } - Image { - id: icon - width: 64 - height: 64 + BusyIndicator { + id: busy anchors.centerIn: parent - source: "../images/progress.png" - sourceSize.width: width - sourceSize.height: height + running: true visible: root.state=="busy" - - NumberAnimation { - id: animationIcon - target: icon - properties: "rotation" - from: 0 - to: 360 - duration: 500 - loops: Animation.Infinite - } } MouseArea { diff --git a/qml/ubi/components/Notification.qml b/qml/ubi/components/Notification.qml index b84c4cf..aec3d22 100644 --- a/qml/ubi/components/Notification.qml +++ b/qml/ubi/components/Notification.qml @@ -30,6 +30,7 @@ Item { anchors.centerIn: parent id: text color: Const.DEFAULT_BACKGROUND_COLOR + wrapMode: Text.WordWrap font.pixelSize: Const.DEFAULT_FONT_PIXEL_SIZE } @@ -42,6 +43,16 @@ Item { function show(_text) { text.text= _text; + time.interval = 3000; + state = "visible" + //sound.play(); + time.restart(); + } + + function show2(_text,interval) + { + text.text= _text; + time.interval = interval; state = "visible" //sound.play(); time.restart(); diff --git a/qml/ubi/components/NotificationNew.qml b/qml/ubi/components/NotificationNew.qml new file mode 100644 index 0000000..56baecb --- /dev/null +++ b/qml/ubi/components/NotificationNew.qml @@ -0,0 +1,104 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "../UIConstants.js" as Const + +Item { + id: root + + state: "invisible" + + //width: box.width + height: box.height + + Rectangle { + width: box.width + height: box.height + color: Const.SHADOW_COLOR; + radius: 5 + x: 2*Const.SHADOW_OFFSET; + y: 2*Const.SHADOW_OFFSET; + } + + Rectangle { + id: box + height: text.height+4*Const.DEFAULT_MARGIN + width: root.width + //color: Const.DEFAULT_DIALOG_FOREGROUND_COLOR + color: Const.COOL_GREY_COLOR + radius: 5 + + border.color: Const.WARM_GREY_COLOR + border.width: 1 + + Text { + id: text + anchors.centerIn: parent + anchors.margins: Const.DEFAULT_MARGIN + color: Const.DEFAULT_FOREGROUND_COLOR + wrapMode: Text.WordWrap + font.pixelSize: Const.DEFAULT_FONT_PIXEL_SIZE + width: parent.width-2*Const.DEFAULT_MARGIN + horizontalAlignment: Text.Center + } + + MouseArea { + anchors.fill: parent + onClicked: tip.state = "invisible" + } + } + + function show(_text) + { + text.text= _text; + if(_text.length > 40) { + time.interval = _text.length*100; + } else { + time.interval = 3000; + } + state = "visible" + time.restart(); + } + + function show2(_text,interval) + { + text.text= _text; + time.interval = interval; + state = "visible" + time.restart(); + } + + function hide() + { + text.text=""; + state="invisible"; + } + + Timer { + id: time + interval: 3000 + onTriggered: { + tip.state = "invisible"; + } + } + + states: [ + State { + name: "visible" + PropertyChanges { target: root; opacity: 1 } + PropertyChanges { target: root; width: mainWindow.width-2*Const.TEXT_MARGIN } + PropertyChanges { target: text; font.pixelSize: Const.DEFAULT_FONT_PIXEL_SIZE } + }, + State { + name: "invisible" + PropertyChanges { target: root; width: 0 } + PropertyChanges { target: text; font.pixelSize: 1 } + PropertyChanges { target: root; opacity: 0 } + } + ] + + transitions: Transition { + NumberAnimation { properties: "opacity"; easing.type: Easing.InOutBack } + NumberAnimation { properties: "width"; easing.type: Easing.InOutBack} + NumberAnimation { properties: "font.pixelSize"; easing.type: Easing.InOutBack} + } + +} diff --git a/qml/ubi/components/Showable.qml b/qml/ubi/components/Showable.qml new file mode 100644 index 0000000..69c7390 --- /dev/null +++ b/qml/ubi/components/Showable.qml @@ -0,0 +1,58 @@ +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +//import "../UIConstants.js" as Const + +Item { + id: root + + property bool hidden: false + property int easingType: Easing.InOutCubic + property int speed: 1 + + state: hidden ? "closed" : "opened" + //visible: !hidden + + Component.onCompleted: { + if(hidden) state = "closed"; + } + + function show() { + root.state = "opened"; + } + + function hide() { + root.state = "closed"; + } + + states: [ + State { + name: "opened" + PropertyChanges { target: root; y: 0} + PropertyChanges { target: root; visible: true } + }, + State { + name: "closed" + PropertyChanges { target: root; y: root.height } + //PropertyChanges { target: root; visible: false } + } + ] + + transitions: Transition { + NumberAnimation { properties: "y"; easing.type: root.easingType; + duration: root.speed*root.height/2; + } + } + + onStateChanged: { + if(state=="closed") time.start() + } + + Timer { + id: time + interval: root.speed*root.height/2 + onTriggered: { + //console.log("aaa"); + root.visible = false; + } + } + +} diff --git a/qml/ubi/components/ToolIcon.qml b/qml/ubi/components/ToolIcon.qml index bfc50b3..6632be4 100644 --- a/qml/ubi/components/ToolIcon.qml +++ b/qml/ubi/components/ToolIcon.qml @@ -1,22 +1,31 @@ -import QtQuick 1.0 +import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 +import "../UIConstants.js" as Const Item { id: root property string iconSource - property bool enabled: true property bool pressed: mouseArea.pressed + property string color: Const.TRANSPARENT signal clicked signal pressAndHold width: 56 height: 56 - opacity: enabled ? 1 : 0.3 Rectangle { - anchors { fill: parent; margins: 5 } - color: "gray" + id: background + anchors { fill: parent; margins: 6 } + //color: root.color + color: "black" + opacity: 0.1 + radius: 10 + } + + Rectangle { + anchors { fill: parent; margins: 6 } + color: "white" opacity: 0.5 radius: 10 visible: mouseArea.pressed @@ -24,8 +33,8 @@ Item { Image { id: icon - width: 40 - height: 40 + width: 30 + height: 30 anchors.centerIn: parent source: iconSource == "" ? "" : "../" + iconSource sourceSize.width: width diff --git a/qml/ubi/images/back-old.png b/qml/ubi/images/back-old.png new file mode 100644 index 0000000..e98f7fd Binary files /dev/null and b/qml/ubi/images/back-old.png differ diff --git a/qml/ubi/images/back.png b/qml/ubi/images/back.png index e98f7fd..31f7b77 100644 Binary files a/qml/ubi/images/back.png and b/qml/ubi/images/back.png differ diff --git a/qml/ubi/images/bg.png b/qml/ubi/images/bg.png new file mode 100644 index 0000000..fd65209 Binary files /dev/null and b/qml/ubi/images/bg.png differ diff --git a/qml/ubi/images/close-old.png b/qml/ubi/images/close-old.png new file mode 100644 index 0000000..3ab86ac Binary files /dev/null and b/qml/ubi/images/close-old.png differ diff --git a/qml/ubi/images/close.png b/qml/ubi/images/close.png index 3ab86ac..1861716 100644 Binary files a/qml/ubi/images/close.png and b/qml/ubi/images/close.png differ diff --git a/qml/ubi/images/document-small.png b/qml/ubi/images/document-small.png new file mode 100644 index 0000000..f715053 Binary files /dev/null and b/qml/ubi/images/document-small.png differ diff --git a/qml/ubi/images/document.png b/qml/ubi/images/document.png index 2fb06f2..b164388 100644 Binary files a/qml/ubi/images/document.png and b/qml/ubi/images/document.png differ diff --git a/qml/ubi/images/download-old.png b/qml/ubi/images/download-old.png new file mode 100644 index 0000000..234ba28 Binary files /dev/null and b/qml/ubi/images/download-old.png differ diff --git a/qml/ubi/images/download.png b/qml/ubi/images/download.png index 234ba28..6dcf6d3 100644 Binary files a/qml/ubi/images/download.png and b/qml/ubi/images/download.png differ diff --git a/qml/ubi/images/folder-small.png b/qml/ubi/images/folder-small.png new file mode 100644 index 0000000..f95e411 Binary files /dev/null and b/qml/ubi/images/folder-small.png differ diff --git a/qml/ubi/images/folder.png b/qml/ubi/images/folder.png index c470537..9681fe3 100644 Binary files a/qml/ubi/images/folder.png and b/qml/ubi/images/folder.png differ diff --git a/qml/ubi/images/minimize-old.png b/qml/ubi/images/minimize-old.png new file mode 100644 index 0000000..80be69b Binary files /dev/null and b/qml/ubi/images/minimize-old.png differ diff --git a/qml/ubi/images/minimize.png b/qml/ubi/images/minimize.png index 80be69b..ebbe718 100644 Binary files a/qml/ubi/images/minimize.png and b/qml/ubi/images/minimize.png differ diff --git a/qml/ubi/images/music-small.png b/qml/ubi/images/music-small.png new file mode 100644 index 0000000..ea57709 Binary files /dev/null and b/qml/ubi/images/music-small.png differ diff --git a/qml/ubi/images/music.png b/qml/ubi/images/music.png new file mode 100644 index 0000000..dda386c Binary files /dev/null and b/qml/ubi/images/music.png differ diff --git a/qml/ubi/images/options.png b/qml/ubi/images/options.png new file mode 100644 index 0000000..2e28b6e Binary files /dev/null and b/qml/ubi/images/options.png differ diff --git a/qml/ubi/images/photo-small.png b/qml/ubi/images/photo-small.png new file mode 100644 index 0000000..e92715d Binary files /dev/null and b/qml/ubi/images/photo-small.png differ diff --git a/qml/ubi/images/photo.png b/qml/ubi/images/photo.png index 60f3c8b..cf949ae 100644 Binary files a/qml/ubi/images/photo.png and b/qml/ubi/images/photo.png differ diff --git a/qml/ubi/images/pushbutton_disabled.png b/qml/ubi/images/pushbutton_disabled.png new file mode 100644 index 0000000..bf15a8c Binary files /dev/null and b/qml/ubi/images/pushbutton_disabled.png differ diff --git a/qml/ubi/images/pushbutton_normal.png b/qml/ubi/images/pushbutton_normal.png new file mode 100644 index 0000000..2476565 Binary files /dev/null and b/qml/ubi/images/pushbutton_normal.png differ diff --git a/qml/ubi/images/refresh.png b/qml/ubi/images/refresh.png index 7464c5d..14d852d 100644 Binary files a/qml/ubi/images/refresh.png and b/qml/ubi/images/refresh.png differ diff --git a/qml/ubi/images/up-old.png b/qml/ubi/images/up-old.png new file mode 100644 index 0000000..9828030 Binary files /dev/null and b/qml/ubi/images/up-old.png differ diff --git a/qml/ubi/images/up.png b/qml/ubi/images/up.png index 9828030..495bab3 100644 Binary files a/qml/ubi/images/up.png and b/qml/ubi/images/up.png differ diff --git a/qml/ubi/images/upload-old.png b/qml/ubi/images/upload-old.png new file mode 100644 index 0000000..e66dfb7 Binary files /dev/null and b/qml/ubi/images/upload-old.png differ diff --git a/qml/ubi/images/upload.png b/qml/ubi/images/upload.png index e66dfb7..35f3ab4 100644 Binary files a/qml/ubi/images/upload.png and b/qml/ubi/images/upload.png differ diff --git a/qml/ubi/images/video-small.png b/qml/ubi/images/video-small.png new file mode 100644 index 0000000..b180390 Binary files /dev/null and b/qml/ubi/images/video-small.png differ diff --git a/qml/ubi/images/video.png b/qml/ubi/images/video.png new file mode 100644 index 0000000..1451eaf Binary files /dev/null and b/qml/ubi/images/video.png differ diff --git a/qml/ubi/main.qml b/qml/ubi/main.qml index 8684481..80d0160 100644 --- a/qml/ubi/main.qml +++ b/qml/ubi/main.qml @@ -1,6 +1,5 @@ import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 import "components" -import Qt 4.7 import "UIConstants.js" as Const Rectangle { @@ -13,41 +12,104 @@ Rectangle { PageStack { id: pageStack - initialPage: Qt.resolvedUrl("StartPage.qml") + //initialPage: Qt.resolvedUrl("StartPage.qml") + initialPage: Qt.resolvedUrl("FilesPage.qml") } - SystemBar { - id: systemBar - onClicked: { - var mask = pageStack.currentPage.mask; - if(mask.state=="idle") { - taskBar.open(); - } + TopBar { + id: topbar + Component.onCompleted: { + visible = Utils.isMaemo(); + } + onVisibleChanged: { + if(visible) + visible = Utils.isMaemo(); } } - Notification { + NotificationNew { id: tip - x: (mainWindow.width-width)/2 - y: 120 + anchors.horizontalCenter: mainWindow.horizontalCenter + y: mainWindow.height-height-Const.SYSTEM_BAR_HEIGHT-Const.TEXT_MARGIN } - TaskBar { + /*TaskBar { id: taskBar - } + }*/ Connections { target: Utils - onFileDownloaded: tip.show(qsTr("File downloaded!")) - onFileUploaded: tip.show(qsTr("File uploaded!")) - onDownloadError: tip.show(qsTr("Error while downloading!")) - onUploadError: tip.show(qsTr("Error while uploading!")) - onDownloadAdded: tip.show(qsTr("File added to the queue!")) - onUploadAdded: tip.show(qsTr("File added to the queue!")) + onFileDownloaded: tip.show(qsTr("File downloaded.")) + onFileUploaded: tip.show(qsTr("File uploaded.")) + onDownloadError: tip.show(qsTr("Error while downloading.")) + onUploadError: tip.show(qsTr("Error while uploading.")) + onDownloadAdded: tip.show(qsTr("File added to the queue.")) + onUploadAdded: tip.show(qsTr("File added to the queue.")) + onOperationCanceled: tip.show(qsTr("File operation canceled.")) + } + + DialogBlank { + id: downloadDialog + z: 200 + + property bool isActiveDownloads: progressArea.count>0 + + boxHeight: progressArea.height + 3*Const.DEFAULT_MARGIN + + Connections { + target: Utils + onFileDownloadProgress: progressArea.setProgress(filename,progress) + onFileUploadProgress: progressArea.setProgress(filename,progress) + onDownloadAdded: progressArea.addTask("download",filename) + onUploadAdded: progressArea.addTask("upload",filename) + onDownloadStarted: progressArea.start(filename) + onUploadStarted: progressArea.start(filename) + onFileDownloaded: progressArea.stop(filename) + onFileUploaded: progressArea.stop(filename) + onDownloadError: progressArea.stop(filename) + onUploadError: progressArea.stop(filename) + onOperationCanceled: progressArea.stop(filename) + onFileRemovedFromQuee: progressArea.stop(filename) + } + + DownloadArea { + anchors.top: parent.box.top + anchors.topMargin: 2*Const.DEFAULT_MARGIN + anchors.margins: Const.DEFAULT_MARGIN + anchors.horizontalCenter: parent.horizontalCenter + id: progressArea + width: parent.width-3*Const.DEFAULT_MARGIN + + //onHeightChanged: console.log("height: "+height); + } + } + + DialogInfo { + id: aboutDialog + z: 200 + fontSize: 28 + iconSource: "images/ubi50.png" + textHeader: qsTr("Ubi") + + text: qsTr("

An unofficial Ubuntu One app for Maemo 5 " + +"and other Qt-enabled platforms.

" + +"

http://ubi.garage.maemo.org

" + +"

© 2012 Michal Kosciesza

") + } + + SystemBar { + id: systemBar + z: 201 + onClickedOnMask: { + aboutDialog.close(); + downloadDialog.close(); + pageStack.currentPage.taskMenu.close(); + } } Rectangle { color: "black" + z: 300 width: 1 anchors.left: parent.left anchors.top: parent.top @@ -55,6 +117,8 @@ Rectangle { } InitPage { + id: initPage + z: 301 height: mainWindow.height; width: mainWindow.width; } diff --git a/qml/ubi/u1.js b/qml/ubi/u1.js index 91bdd0e..a118cb7 100644 --- a/qml/ubi/u1.js +++ b/qml/ubi/u1.js @@ -139,6 +139,8 @@ function getFiles(secrets,rootNode,root) root.onErr(xhr.status); } else { //console.log(xhr.responseText); + //console.log(""); + //console.log(xhr.getAllResponseHeaders()); var resp = eval('('+xhr.responseText+')'); var nodes = resp.children; root.onResp(nodes); @@ -268,15 +270,15 @@ function startPublishing(secrets,resourcePath,root) function newFolder(secrets,resourcePath,root) { var url = "https://one.ubuntu.com/api/file_storage/v1"+encodeURI(resourcePath); - console.log("url: "+url); + //console.log("url: "+url); var xhr = oAuthRequest(url,secrets,"PUT"); xhr.setRequestHeader("Content-Type","application/json"); var body = '{"kind": "directory"}'; - console.log("body: "+body); + //console.log("body: "+body); xhr.onreadystatechange = function() { if(xhr.readyState===4) { if(xhr.status>=400||xhr.status===0) { - console.log("status: "+xhr.status); + //console.log("status: "+xhr.status); //console.log(xhr.responseText); root.onErrNew(xhr.status); } else { @@ -292,9 +294,10 @@ function newFolder(secrets,resourcePath,root) function deleteFile(secrets,resourcePath,root,utils) { - var url = "https://one.ubuntu.com/api/file_storage/v1"+encodeURI(resourcePath); - //console.log("url: "+url); - var auth = oAuthHeader(url,secrets,"DELETE"); + var urlA = "https://one.ubuntu.com/api/file_storage/v1"+encodeURI(resourcePath); + var url = "https://one.ubuntu.com/api/file_storage/v1"+resourcePath; + //console.log("u1.js:delete url="+url); + var auth = oAuthHeader(urlA,secrets,"DELETE"); utils.deleteFile(url,auth); } @@ -352,12 +355,15 @@ function fixFolder(path) { function getFileContent(secrets,root,path,folder,size,utils) { //var url = "https://one.ubuntu.com/api/file_storage/v1"+encodeURI(path); - var url = "https://files.one.ubuntu.com"+encodeURI(path); + + var url = "https://files.one.ubuntu.com"+path; + var urlA = "https://files.one.ubuntu.com"+encodeURI(path); + var filename = fixFilename(path); var ffolder = fixFolder(folder); //console.log("url: "+url); //console.log("ffolder: "+ffolder); - var auth = oAuthHeader(url,secrets,"GET"); + var auth = oAuthHeader(urlA,secrets,"GET"); //console.log("auth: "+auth); utils.downloadFile(ffolder,filename,url,size,auth); } @@ -366,10 +372,15 @@ function uploadFile(secrets,root,path,filename,folder,utils) { //var url = "https://one.ubuntu.com/api/file_storage/v1"+encodeURI(path); //var url = "https://files.one.ubuntu.com"+path; - var url = "https://files.one.ubuntu.com"+encodeURI(path); - //console.log(url); + + var url = "https://files.one.ubuntu.com"+path; + var urlA = "https://files.one.ubuntu.com"+encodeURI(path); + + //console.log("u1.js:uploadFile path=" + path); + //console.log("u1.js:uploadFile url=" + url); + var ffolder = fixFolder(folder); - var auth = oAuthHeader(url,secrets,"PUT"); + var auth = oAuthHeader(urlA,secrets,"PUT"); utils.uploadFile(ffolder,filename,url,auth); } diff --git a/translation.pri b/translation.pri index 03b9331..b9766d9 100644 --- a/translation.pri +++ b/translation.pri @@ -4,7 +4,9 @@ evil_hack_to_fool_lupdate { qml/ubi/DownloadArea.qml \ qml/ubi/FileSelector.qml \ qml/ubi/FilesPage.qml \ + qml/ubi/FileDialog.qml \ qml/ubi/LoginPage.qml \ + qml/ubi/InitPage.qml \ qml/ubi/main.qml \ qml/ubi/PageStack.qml \ qml/ubi/PropertiesPage.qml \ @@ -13,15 +15,20 @@ evil_hack_to_fool_lupdate { qml/ubi/StartPage.qml \ qml/ubi/SystemBar.qml \ qml/ubi/TaskBar.qml \ + qml/ubi/TopBar.qml \ + qml/ubi/TaskMenu.qml \ qml/ubi/DownloadProgressBar.qml \ qml/ubi/components/Bar.qml \ qml/ubi/components/DialogCombo.qml \ qml/ubi/components/FileOld.qml \ qml/ubi/components/Notification.qml \ + qml/ubi/components/NotificationNew.qml \ qml/ubi/components/ToolIcon.qml \ qml/ubi/components/ButtonNew.qml \ + qml/ubi/components/DialogBlank.qml \ qml/ubi/components/DialogInfo.qml \ qml/ubi/components/File.qml \ + qml/ubi/components/FileSmall.qml \ qml/ubi/components/Page.qml \ qml/ubi/components/Button.qml \ qml/ubi/components/DialogInput.qml \ diff --git a/translations/ubi.pl.qm b/translations/ubi.pl.qm index 79b90df..ccdebe2 100644 Binary files a/translations/ubi.pl.qm and b/translations/ubi.pl.qm differ diff --git a/translations/ubi.pl.ts b/translations/ubi.pl.ts index 97a8925..e43e3bb 100644 --- a/translations/ubi.pl.ts +++ b/translations/ubi.pl.ts @@ -5,11 +5,11 @@ AccountPage Authorization failed! - Autoryzacja nie powiodła się! + Autoryzacja nie powiodła się! Error: - Błąd: + Błąd: User name: @@ -29,12 +29,24 @@ Unable to connect! - Błąd połączenia! + Błąd połączenia! Used: Wykorzystano: + + Ubuntu One authorization has failed. Try once again or check login settings. + Autoryzacja w Ubuntu One nie powiodła się. Spróbuj jeszcze raz lub sprawdź ustawienia logowania. + + + Unable to connect. Check internet connection. + Nie można połączyć z siecią. Sprawadź połączenie z Internetem. + + + Unknown error: + Nieznany błąd: + DialogYesNo @@ -51,8 +63,16 @@ DownloadArea No active downloads + Brak aktywnych pobrań + + + No active downloads or uploads Brak aktywnych pobrań + + Active downloads and uploads + Aktywne pobrania + FilesPage @@ -78,11 +98,11 @@ Root folder can't be renamed! - Nie można zmienić nazwy! + Nie można zmienić nazwy! Root folder can't be deleted! - Nie można zmienić nazwy! + Nie można zmienić nazwy! Authorization failed! @@ -122,7 +142,7 @@ Unable to connect! - Błąd połączenia! + Błąd połączenia! Enter new folder name: @@ -136,6 +156,45 @@ Empty Pusty + + Root folder cannot be renamed. + Nie można zmienić nazwy głównego foldera. + + + Root folder cannot be deleted. + Nie można usunąć głównego foldera. + + + Ubuntu One authorization has failed. Try once again or check login settings. + Autoryzacja w Ubuntu One nie powiodła się. Spróbuj jeszcze raz lub sprawdź ustawienia logowania. + + + Unable to connect. Check internet connection. + Nie można połączyć z siecią. Sprawadź połączenie z Internetem. + + + Unknown error: + Nieznany błąd: + + + + InitPage + + Ubuntu One authorization has failed. Try once again or check login settings. + Autoryzacja w Ubuntu One nie powiodła się. Spróbuj jeszcze raz lub sprawdź ustawienia logowania. + + + Unable to connect. Check internet connection. + Nie można połączyć z siecią. Sprawadź połączenie z Internetem. + + + Unknown error: + Nieznany błąd: + + + Connecting... + Łączenie... + LoginPage @@ -157,11 +216,11 @@ Authorization failed! - Autoryzacja nie powiodła się! + Autoryzacja nie powiodła się! Error: - Błąd: + Błąd: Login @@ -173,7 +232,19 @@ Unable to connect! - Błąd połączenia! + Błąd połączenia! + + + Ubuntu One authorization has failed. Try once again or check login settings. + Autoryzacja w Ubuntu One nie powiodła się. Spróbuj jeszcze raz lub sprawdź ustawienia logowania. + + + Unable to connect. Check internet connection. + Nie można połączyć z siecią. Sprawadź połączenie z Internetem. + + + Unknown error: + Nieznany błąd: @@ -192,11 +263,11 @@ Authorization failed! - Autoryzacja nie powiodła się! + Autoryzacja nie powiodła się! Error: - Błąd: + Błąd: Internal error! @@ -244,7 +315,7 @@ Unable to connect! - Błąd połączenia! + Błąd połączenia! Enter new file name: @@ -282,6 +353,18 @@ Copy Skopiuj + + Ubuntu One authorization has failed. Try once again or check login settings. + Autoryzacja w Ubuntu One nie powiodła się. Spróbuj jeszcze raz lub sprawdź ustawienia logowania. + + + Unknown error: + Nieznany błąd: + + + Unable to connect. Check internet connection. + Nie można połączyć z siecią. Sprawadź połączenie z Internetem. + SettingsPage @@ -366,26 +449,77 @@ + TaskMenu + + Account + Konto + + + Settings + Ustawienia + + + About Ubi + O Ubi + + + main Error while downloading! - Błąd podczas pobierania! + Błąd podczas pobierania! Error while uploading! - Błąd podczas wysyłania! + Błąd podczas wysyłania! File downloaded! - Plik został pobrany! + Plik został pobrany! File uploaded! - Plik został wysłany! + Plik został wysłany! File added to the queue! - Plik dodany do kolejki! + Plik dodany do kolejki! + + + File operation canceled! + Operacja anulowana! + + + <b>Ubi</b> + <b>Ubi</b> + + + <p>An unofficial Ubuntu One app for Maemo 5 and other Qt-enabled platforms.</p><p><small>http://ubi.garage.maemo.org</small></p><p><small>© 2012 Michal Kosciesza</small></p> + <p>Nieoficjalna aplikacja Ubuntu One dla Maemo 5 i innych platform obsługujących Qt.</p><p><small>http://ubi.garage.maemo.org</small></p><p><small>© 2012 Michal Kosciesza</small></p> + + + File downloaded. + Plik został pobrany. + + + File uploaded. + Plik został wysłany. + + + Error while downloading. + Błąd podczas pobierania. + + + Error while uploading. + Błąd podczas wysyłania. + + + File added to the queue. + Plik dodany do kolejki. + + + File operation canceled. + Operacja anulowana. diff --git a/ubi.pro b/ubi.pro index 620d29c..c399160 100644 --- a/ubi.pro +++ b/ubi.pro @@ -43,7 +43,7 @@ SOURCES += main.cpp \ utils.cpp # evil_hack_to_fool_lupdate -#include(translation.pri) +include(translation.pri) # Please do not modify the following two lines. Required for deployment. include(qmlapplicationviewer/qmlapplicationviewer.pri) @@ -70,5 +70,5 @@ HEADERS += \ TRANSLATIONS += translations/ubi.pl.ts -RESOURCES += \ - ubi.qrc +#RESOURCES += \ +# ubi.qrc diff --git a/ubi.pro.user b/ubi.pro.user index 20ef615..af67d63 100644 --- a/ubi.pro.user +++ b/ubi.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget @@ -477,7 +477,7 @@ 2012-04-28T10:41:48 2012-05-03T18:56:53 2012-05-05T14:55:15 - 2012-05-06T15:26:36 + 2012-05-15T22:51:39 3 @@ -1064,8 +1064,8 @@ 0 1 4_7_2_m1_1_1 - 0 - s60_5_0 + 1 + s60_5_0_n97 1 Build diff --git a/ubi.zip b/ubi.zip index 229e53b..e2c24bb 100644 Binary files a/ubi.zip and b/ubi.zip differ diff --git a/utils.cpp b/utils.cpp index 5a458f2..fef0803 100644 --- a/utils.cpp +++ b/utils.cpp @@ -14,15 +14,15 @@ Utils::Utils(QmlApplicationViewer *viewer, QSettings *settings, QObject *parent) void Utils::minimizeWindow() { - #if defined(Q_WS_MAEMO_5) - // This is needed for Maemo5 to recognize minimization - QDBusConnection connection = QDBusConnection::sessionBus(); - QDBusMessage message = QDBusMessage::createSignal( - "/","com.nokia.hildon_desktop","exit_app_view"); - connection.send(message); - #else - _viewer->setWindowState(Qt::WindowMinimized); - #endif +#if defined(Q_WS_MAEMO_5) + // This is needed for Maemo5 to recognize minimization + QDBusConnection connection = QDBusConnection::sessionBus(); + QDBusMessage message = QDBusMessage::createSignal( + "/","com.nokia.hildon_desktop","exit_app_view"); + connection.send(message); +#else + _viewer->setWindowState(Qt::WindowMinimized); +#endif } void Utils::setOrientation(const QString &orientation) @@ -243,9 +243,13 @@ void Utils::downloadFinished() emit downloadError(cur_filename); } } + else if (cur_reply->error() == QNetworkReply::OperationCanceledError) + { + emit operationCanceled(cur_filename); + } else { - qDebug() << "download error"; + //qDebug() << "download error"; emit downloadError(cur_filename); } @@ -284,6 +288,8 @@ void Utils::uploadFile(const QString &folder, const QString &filename, emit uploadAdded(filename); + //qDebug() << "utils.cpp:uploadFile url=" << url; + if(isFinished){ start(); } @@ -306,12 +312,16 @@ void Utils::uploadFinished() { emit fileUploaded(cur_filename); } + else if (cur_reply->error() == QNetworkReply::OperationCanceledError) + { + emit operationCanceled(cur_filename); + } else { int httpStatus = cur_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + //QString httpStatusMessage = cur_reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString(); //QByteArray bytes = cur_reply->readAll(); - //qDebug() << "status: " << httpStatus << " " << httpStatusMessage; //qDebug() << "bytes: " << bytes; @@ -319,10 +329,9 @@ void Utils::uploadFinished() { emit fileUploaded(cur_filename); } else { - qDebug() << "upload error"; + //qDebug() << "upload error: " << httpStatus << " " << cur_reply->error() << " " << cur_reply->errorString(); emit uploadError(cur_filename); } - } cur_file->close(); @@ -351,8 +360,22 @@ void Utils::deleteFile(const QString &url, const QString &auth) QUrl _url(url); QNetworkRequest req(_url); + + /*qDebug() << "url1=" << url; + qDebug() << "url2=" << req.url().toString(); + qDebug() << "url3=" << req.url().path();*/ + //qDebug() << "auth: " << auth; req.setRawHeader("Authorization", auth.toAscii()); + + //qDebug() << "utils.cpp:uploadFile _nam=" << _nam->; + + /*QList l = req.rawHeaderList(); + QList::iterator i; + for(i=l.begin(); i!=l.end(); ++i) + qDebug() << "header=" << *i; + */ + temp_reply = _nam->deleteResource(req); connect(temp_reply,SIGNAL(finished()),this,SLOT(deleteFinished())); connect(temp_reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError))); @@ -387,3 +410,33 @@ void Utils::setClipboardText(const QString &text) _clipboard->setText(text, QClipboard::Clipboard); _clipboard->setText(text, QClipboard::Selection); } + +bool Utils::isMaemo() +{ +#if defined(Q_WS_MAEMO_5) + return true; +#endif + return false; +} + +void Utils::cancelFile(const QString & filename) +{ + //qDebug() << "Utils::cancelFile"; + if(!isFinished && cur_filename==filename) + { + cur_reply->abort(); + } + else + { + int l = quee.size(); + for(int i=0;i