Friendiqa v0.2.1

This commit is contained in:
LubuWest 2018-04-11 21:50:43 +02:00
commit ee50729e0d
45 changed files with 580 additions and 146 deletions

View file

@ -37,7 +37,11 @@ import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/photoqml"
import "qrc:/qml/genericqml"
Rectangle {
StackView{
id: photoStack
anchors.fill:parent
initialItem:Rectangle {
id:fotorectangle
y:1
width:root.width-mm
@ -48,15 +52,15 @@ Rectangle {
property bool remoteContact: false
onNewimagesChanged:{
if(newimages.length>0){
if(fotorectangle.newimages.length>0){
//print("newimages "+JSON.stringify(newimages));
var ownimagelist=[];
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
for (var i=0;i<newimages.length;i++){
if(albums.indexOf(newimages[i].album)==-1){
for (var i=0;i<fotorectangle.newimages.length;i++){
if(albums.indexOf(fotorectangle.newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(newimages[i].album)}
ownimagelist.push(root.login.server+"/api/friendica/photo?scale='0'&photo_id="+newimages[i].id);
filesystem.makeDir(fotorectangle.newimages[i].album)}
ownimagelist.push(root.login.server+"/api/friendica/photo?scale='0'&photo_id="+fotorectangle.newimages[i].id);
}
})
xhr.setLogin(login.username+":"+Qt.atob(login.password));
@ -69,8 +73,8 @@ Rectangle {
}
onCurrentimagenoChanged:{
if(currentimageno==newimages.length){newImagesProgress.visible=false;showFotos(root.login,"");
newimages=[];currentimageno=0}
if(fotorectangle.currentimageno==fotorectangle.newimages.length){newImagesProgress.visible=false;showFotos(root.login,"");
fotorectangle.newimages=[];fotorectangle.currentimageno=0}
// download next image
}
@ -78,17 +82,17 @@ Rectangle {
target:xhr
onDownloadedjson:{
if(type=="picturelist"){
currentimageno=currentimageno+1
fotorectangle.currentimageno=fotorectangle.currentimageno+1
Imagejs.storeImagedata(login,db,jsonObject,fotorectangle)
}
}
onDownloaded:{
if(type=="picture"){currentimageno=currentimageno+1}
if(type=="picture"){fotorectangle.currentimageno=fotorectangle.currentimageno+1}
}
onError:{if(data=="picturelist"){
var requestid=url.substring(url.lastIndexOf("=")+1);
Imagejs.dataRequest(login,requestid,db,xhr,fotorectangle)
} else {currentimageno=currentimageno+1}
} else {fotorectangle.currentimageno=fotorectangle.currentimageno+1}
}
}
// Connections{
@ -133,6 +137,10 @@ Rectangle {
})
}
function uploadUrls(urls){
photoStack.push({item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{attachImageURLs:urls}})
}
ProgressBar{
id: newImagesProgress
width: 15*mm
@ -141,7 +149,7 @@ Rectangle {
anchors.right:uploadPhoto.left
anchors.rightMargin:mm
visible: false
value: currentimageno/newimages.length
value: fotorectangle.currentimageno/fotorectangle.newimages.length
}
BlueButton{
@ -152,8 +160,9 @@ Rectangle {
anchors.rightMargin:mm
text:"\uf0ee"
onClicked: {
var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml");
var imageUpload = component.createObject(fotorectangle);
photoStack.push({item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{}});
// var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml");
// var imageUpload = component.createObject(fotorectangle);
}}
BlueButton{
@ -168,12 +177,12 @@ Rectangle {
MenuItem {
text: qsTr("All Images")
onTriggered: {
Imagejs.requestList(root.login,root.db, false, fotostab,function(obj){newimages=obj})}
Imagejs.requestList(root.login,root.db, false, fotostab,function(obj){fotorectangle.newimages=obj})}
}
MenuItem {
text: qsTr("Only new")
onTriggered: {
Imagejs.requestList(root.login,root.db, true,fotostab,function(obj){newimages=obj})}
Imagejs.requestList(root.login,root.db, true,fotostab,function(obj){fotorectangle.newimages=obj})}
}
}
onClicked: {photoupdatemenu.popup()}
@ -260,7 +269,10 @@ Rectangle {
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: { root.fotoSignal.connect(showFotos);
if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")}
Component.onCompleted: {
root.fotoSignal.connect(showFotos);
root.uploadSignal.connect(uploadUrls);
if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")}
}
}
}