This commit is contained in:
LubuWest 2019-12-10 21:12:32 +01:00
commit 7119d5bdf4
292 changed files with 790 additions and 16347 deletions

1
source-android/qml/photoqml Symbolic link
View file

@ -0,0 +1 @@
./../../source-linux/qml/photoqml/

View file

@ -1,306 +0,0 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.5
import QtQuick.Controls 2.4
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/image.js" as Imagejs
import "qrc:/qml/genericqml"
Rectangle{
id:imageDialog
property var attachImageURLs: []
property string imageId: ""
property string currentAlbum:""
property var contacts: []
property var groups: []
property var contact_allow:login.permissions[0]
property var contact_deny:login.permissions[1]
property var group_allow:login.permissions[2]
property var group_deny:login.permissions[3]
property int imageNo: 0
function uploadSelectedImage(inumber){
xhr.url= login.server + "/api/friendica/photo/create.json";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("desc",imageUploadModel.get(inumber).description);
xhr.setParam("album", album.currentText);
//if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
//if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
//if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
//if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
xhr.setImageFileParam("media", imageUploadModel.get(inumber).imageUrl );
xhr.post();
}
function updateImage(){
xhr.url= login.server + "/api/friendica/photo/update.json";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("desc",imageUploadModel.get(0).description);
xhr.setParam("album", currentAlbum);
xhr.setParam("album_new", album.currentText);
xhr.setParam("photo_id", imageId);
xhr.post();
}
function attachImage(url){
imageUploadModel.append({"imageUrl":url,"description":""})
}
//border.color: "grey"
y:1
width:root.width-mm
height:root.height-5*mm
property string directory: ""
Connections{
target:xhr
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
onSuccess:{
if (imageId==""){
imageNo=imageNo+1;
if(imageNo<imageUploadModel.count){
uploadSelectedImage(imageNo);
}else{
Imagejs.requestList(login,db, true,root,function(obj){
fotorectangle.newimages=obj;
imageDialog.destroy()
})
}} else{
Imagejs.updateImage(db,login,"image",filesystem,imageId,root,function(){
Imagejs.requestList(login,db, true,root,function(obj){
fotorectangle.newimages=obj;
fotoSignal(login,"backButton");
//photoStack.pop()
})
})
}
}
}
Row{
id:buttonRow
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
spacing:5*mm
Text{
font.pixelSize: 3.5*mm
font.bold: true
text:qsTr("Upload to album")
}
// BlueButton{
// id:permButton
// text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
// onClicked: {
// var component = Qt.createComponent("qrc:/qml/genericqml/PermissionDialog.qml");
// var permissions = component.createObject(imageDialog,{"x":mm,"y":40*mm});
// }
// }
Button{
id:closeButton
height: 8*mm
text: "\uf057"
font.pixelSize: 3*mm
onClicked:{photoStack.pop();
//imageDialog.destroy()
}
}
}
// Text {
// text: qsTr("Album")
// x: 4*mm; y: 10*mm
// }
// Text {
// text: qsTr("Image")
// x: 4*mm; y: 17*mm
// }
// Text {
// text: qsTr("Description")
// x: 4*mm; y: 33*mm
// }
ListView{
id: imageUploadView
x:3*mm //23*mm
y:17*mm
width: imageDialog.width-5*mm //25*mm
height: root.width/2 //25*mm
model: imageUploadModel
delegate: imageDelegate
footer: imageId==""?imageFooter:null
clip:true
orientation: ListView.Horizontal
spacing: mm
}
BusyIndicator{
id: uploadBusy
running: false
anchors.horizontalCenter: imageUploadView.horizontalCenter
anchors.top:imageUploadView.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
}
ListModel{
id: imageUploadModel
}
Component{
id: imageDelegate
Rectangle{
width:root.width/2 //Math.max(20*mm,descriptionInput.contentWidth)
height:imageUploadView.height-5*mm // 20*mm
Image{
id: uploadImage
width: root.width/2-mm //20*mm
height: imageUploadView.height-6*mm//height: 14*mm
fillMode: Image.PreserveAspectFit
source:imageUrl
onVisibleChanged: descriptionInput.focus=true;
MouseArea{
anchors.fill: parent
onClicked:{
imageUploadModel.remove(index)
// attachImageURLs.splice(attachImageURLs.indexOf(imageUrl,1))
// attachImage(imageUrl)
}
}
}
Rectangle{
color: "light grey"
border.color: "grey"
anchors.top: uploadImage.bottom
anchors.topMargin: mm
//x: mm; y: 15*mm;
width: root.width/2-mm //Math.max(root.width/2-mm, descriptionInput.contentWidth);
height: 5*mm;
TextField{
//TextInput {
id: descriptionInput
anchors.fill: parent
font.pixelSize: 3*mm
selectByMouse: true
placeholderText: qsTr("Description")
text:description!=""?description:""
onTextChanged: imageUploadModel.set(index,{"description":descriptionInput.text});
}
}
}
}
Component{
id: imageFooter
Image{
id: footerImage
height: root.width/4
width: root.width/4 //15*mm
//15*mm
fillMode: Image.PreserveAspectFit
source:"qrc:/images/addImage.png"
MouseArea{
anchors.fill: parent
onClicked:{
imagePicking=true;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
'attachImage(imageUrl)}}',imageDialog,"imagePicker");
imagePicker.pickImage()
}
}
}
}
ComboBox{
id: album
x: 3*mm
y: 10*mm
width: root.width/2;
height: 5*mm;
editable:true
model: albumModel
onAccepted: {
if (find(currentText) === -1) {
albumModel.append({text: editText})
currentIndex = find(editText)
}
}
}
ListModel{id:albumModel}
Button{
id:uploadButton
height: 8*mm
x:4*mm; y:root.width/2+18*mm //40*mm
text: imageId==""?qsTr("Upload"):qsTr("Change")
font.pixelSize: 3*mm
onClicked:{
if(album.currentText==""){Helperjs.showMessage(qsTr("Error"),qsTr(" No album name given"), imageDialog)}
else if (imageId!=""){uploadBusy.running=true; updateImage()}
else{newimageProgress.visible=true;
if (imageUploadModel.count>0){
uploadSelectedImage(0)
}}
}
}
ProgressBar{
id: newimageProgress
width: 15*mm
height: buttonRow.height
anchors.top: parent.top
anchors.right:buttonRow.left
anchors.rightMargin:mm
visible: false
value: imageNo/imageUploadModel.count
}
Component.onCompleted:{
albumModel.append({"text":""});
try{Helperjs.readField("album",db,"imageData",login.username,function(storedAlbums){
for (var n in storedAlbums){
albumModel.append({"text":storedAlbums[n]})}
})}
catch (e){print(e)}
if(attachImageURLs.length>0){
for (var n in attachImageURLs){attachImage(attachImageURLs[n])}
}
}
}

View file

@ -1,148 +0,0 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.5
import QtQuick.Controls 1.2
import "qrc:/qml/photoqml"
Package {
Item { id: stackItem; Package.name: 'stack'; z: stackItem.PathView.z;width:16.5*mm;height:16.5*mm}
Item { id: listItem; Package.name: 'list'; width: root.width-1*mm; height: root.height-8*mm; }
Item { id: gridItem; Package.name: 'grid';}
Item {
id: photoWrapper
width: 16.5*mm; height: 16.5*mm
z: stackItem.PathView.z
property string hqphotolink: photoLink
property string imageId:""
Rectangle {
id: placeHolder
color: 'lightblue'; antialiasing: true
anchors.fill:parent
}
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
Image {
id: realImage;
visible: (albumWrapper.state != '')||(index==0)
width: photoWrapper.width; height: photoWrapper.height
antialiasing: true;
asynchronous: true
autoTransform:true
cache: false
fillMode: Image.PreserveAspectFit;
source: (albumWrapper.state == '')&&(index>0)?"":imageLocation
}
Rectangle{
id:phototextRectangle
color:"black"
z:3
opacity: 0.5
width:phototext.contentWidth
height: phototext.contentHeight
anchors.bottom: photoWrapper.bottom
}
Text {
id:phototext
z:4
text: photoDescription.trim()
width:15*mm
anchors.bottom: photoWrapper.bottom
color: "white"
font.pixelSize: 2*mm
wrapMode:Text.Wrap
}
MouseArea {
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
onPressAndHold:{
var menuString="import QtQuick 2.5;import QtQuick.Controls 1.4; "+
"Menu {MenuItem {text:qsTr('Delete on client and server'); onTriggered: {"+
"changeimage('delete','image','"+imageLocation+"');photoModel.remove(index)}}"+
"MenuItem {text:qsTr('Move to album'); onTriggered: {"+
"changeimage('update','image','"+imageId+"');}}"+
"}";
var imagemenuObject=Qt.createQmlObject(menuString,photoWrapper,"imagemenuOutput")
imagemenuObject.popup()
}
onClicked: {
if (albumWrapper.state == 'inGrid') {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'fullscreen';
listItem.ListView.view.currentIndex=index
} else {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'inGrid'
}
}
}
PinchArea {
id:imagePinch
pinch.target: realImage
anchors.fill: realImage
pinch.minimumScale: 0.1
pinch.maximumScale: 10
enabled: false
}
// onStateChanged: print("State"+photoWrapper.state+index)
states: [
State {
name: 'stacked'; when: albumWrapper.state == ''
ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm }
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
PropertyChanges { target: phototext; opacity: 0.0 }
PropertyChanges { target: phototextRectangle; opacity: 0.0 }
},
State {
name: 'inGrid'; when: albumWrapper.state == 'inGrid'
ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;}
PropertyChanges { target: phototext; opacity: 1.0 }
PropertyChanges { target: phototextRectangle; opacity: 0.5 }
PropertyChanges { target: placeHolder; opacity: 1.0 }
},
State {
name: 'fullscreen'; when: albumWrapper.state == 'fullscreen'
ParentChange {
target: photoWrapper; parent: listItem; x: 1; y: 1;
width: root.width-mm; height: root.height-8*mm
}
PropertyChanges { target: placeHolder; opacity: 0.0 }
PropertyChanges { target: realImage; source: photoWrapper.hqphotolink}
PropertyChanges { target: phototext; anchors.bottom: realImage.bottom}
PropertyChanges { target: phototext; width:realImage.width }
PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom }
PropertyChanges { target: imagePinch; enabled:true}
// PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) }
}
]
}
}

View file

@ -1,305 +0,0 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.5
import QtQuick.Controls 2.4
import QtQml.Models 2.1
import "qrc:/js/image.js" as Imagejs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/photoqml"
import "qrc:/qml/genericqml"
StackView{
id: photoStack
//anchors.fill:parent
initialItem:Rectangle {
id:fotorectangle
anchors.fill:parent
// y:1
// width:root.width-mm
// height:root.height-5*mm
color: '#fff'
property var newimages:[]
property int currentimageno: 0
property bool remoteContact: false
onNewimagesChanged:{
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<fotorectangle.newimages.length;i++){
if(albums.indexOf(fotorectangle.newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
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));
xhr.setImagedir(login.imagestore);
xhr.setFilelist(ownimagelist);
xhr.setDownloadtype("picturelist");
xhr.getlist();
newImagesProgress.visible=true
}
}
onCurrentimagenoChanged:{
if(fotorectangle.currentimageno==fotorectangle.newimages.length){newImagesProgress.visible=false;showFotos(root.login,"");
fotorectangle.newimages=[];fotorectangle.currentimageno=0}
// download next image
}
Connections{
target:xhr
onDownloadedjson:{
if(type=="picturelist"){
fotorectangle.currentimageno=fotorectangle.currentimageno+1
Imagejs.storeImagedata(login,db,jsonObject,fotorectangle)
}
}
onDownloaded:{
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 {fotorectangle.currentimageno=fotorectangle.currentimageno+1}
}
}
// Connections{
// target:filesystem
// onError:{print("Error deleting");
// }
// onSuccess:print("Success deleting");
// }
function showFotos(login,friend){
if(friend=="backButton"){
if (photoStack.depth>1){photoStack.pop()}
if(!albumgridview.currentItem){root.currentIndex=0}
if(albumgridview.currentItem.state=='fullscreen'){
albumgridview.currentItem.state = 'inGrid'}
else if (albumgridview.currentItem.state == 'inGrid'){albumgridview.currentItem.state=''}
else{root.currentIndex=0}
}
else{
try {photogroupModel.clear()}catch (e){print(e)}
if (friend){
Imagejs.newRequestFriendsAlbumPictures(root.login,friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true,'friend':friend}
photoWorker.sendMessage(msg);
})
phototabstatusButton.text=friend.screen_name+qsTr("\'s images")
}
else {
Helperjs.readField("album", root.db, "imageData",login.username,function(albums){
if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg);
}
})
}
}
}
function deletepics(method, type,id){
if(method=="delete"){Imagejs.deleteImage(db,login,type, id,filesystem,root,function(){//showFotos("")
})}
}
function updatepic(method,type,id){
if(method=="update"){
Helperjs.readData(db,"imageData",login.username,function(url){
photoStack.push(
"qrc:/qml/photoqml/ImageUploadDialog.qml",{"attachImageURLs":[url[0].location+url[0].filename],"imageId":id,"currentAlbum":url[0].album}
)
},"id",id)}
}
function uploadUrls(urls){
photoStack.push("qrc:/qml/photoqml/ImageUploadDialog.qml",{"attachImageURLs":urls})
}
ProgressBar{
id: newImagesProgress
width: 15*mm
height: updatePhotolist.height
anchors.top: parent.top
anchors.right:uploadPhoto.left
anchors.rightMargin:mm
visible: false
value: fotorectangle.currentimageno/fotorectangle.newimages.length
}
MButton{
id: uploadPhoto
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
height: 6*mm
width: 8*mm
text:"\uf0ee"
onClicked: {
photoStack.push("qrc:/qml/photoqml/ImageUploadDialog.qml");
// var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml");
// var imageUpload = component.createObject(fotorectangle);
}}
MButton{
id: updatePhotolist
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
height: 6*mm
width: 8*mm
text:"\uf0ed"
Menu {
id:photoupdatemenu
width:40*mm
MenuItem {
text: qsTr("All Images")
font.pixelSize: 3*mm
onTriggered: {
Imagejs.requestList(root.login,root.db, false, fotostab,function(obj){fotorectangle.newimages=obj})}
}
MenuItem {
text: qsTr("Only new")
font.pixelSize: 3*mm
onTriggered: {
Imagejs.requestList(root.login,root.db, true,fotostab,function(obj){fotorectangle.newimages=obj})}
}
}
onClicked: {photoupdatemenu.popup()}
}
MButton{
id: phototabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
height: 6*mm
width: Math.max(10*mm,implicitWidth)
text: fotostab.phototabstatus=="Images"?qsTr("Own Images"):fotostab.phototabstatus
Menu {
id:phototabmenu
width: 40*mm
MenuItem {
text: qsTr("Own Images")
font.pixelSize: 3*mm
onTriggered: {
fotostab.phototabstatus="Images";
// phototabstatusButton.text=qsTr("Own images");
showFotos(root.login,"")}
}
}
onClicked: {phototabmenu.popup()}
}
DelegateModel{
id: visualphotoModel
delegate: PhotogroupComponent{}
model: photogroupModel
}
ListModel{
id: photogroupModel
}
GridView {
id: albumgridview
cellWidth: 17*mm
cellHeight: 17*mm
x: mm;y:8*mm
width: parent.width-2*mm; height: parent.height-9*mm
clip: true
model: visualphotoModel.parts.album
footer:Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:12*mm
height:6*mm
Text{
font.pixelSize: 1.5*mm
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{anchors.fill:parent
onClicked:{print(photogroupModel.get(0).foreignPicture);
var lastalbum_id=photogroupModel.count-1;
if(photogroupModel.get(photogroupModel.count-1).foreignPicture==true){
Imagejs.newRequestFriendsAlbumPictures(login,photogroupModel.get(0).friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true,'friend':photogroupModel.get(0).friend}
photoWorker.sendMessage(msg)
})
}
else{Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
photoWorker.sendMessage(msg)})}
}}}
}
Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
ListView { width: parent.width; height:parent.height; model: visualphotoModel.parts.browser; interactive: false }
MButton {
id: backButton
height: 6*mm
width: 8*mm
text: "\uf057"
x: parent.width - backButton.width - 3*mm
y: -backButton.height - 4*mm
z:2
onClicked: {photoBackground.opacity=0}
}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: {
root.fotoSignal.connect(showFotos);
root.uploadSignal.connect(uploadUrls);
root.changeimage.connect(deletepics);
root.changeimage.connect(updatepic);
if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")}
}
}
}

View file

@ -1,155 +0,0 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.5
import QtQuick.Controls 1.3
import QtQml.Models 2.1
//import "qrc:/js/service.js" as Service
import "qrc:/js/image.js" as Imagejs
import "qrc:/js/helper.js" as Helperjs
Package {
Item {
Package.name: 'browser'
GridView {
id: photosGridView; model: visualModel.parts.grid; width: albumgridview.width; height: albumgridview.height;y:albumgridview.y
cellWidth: 16.5*mm; cellHeight: 16.5*mm; interactive: false//anchors.margins:2*mm
onCurrentIndexChanged: photosListView.positionViewAtIndex(currentIndex, ListView.Contain)
}
}
Item {
Package.name: 'fullscreen'
ListView {
id: photosListView; model: visualModel.parts.list; orientation: Qt.Horizontal
width: albumgridview.width; height: albumgridview.height; //y:albumgridview.y
//width: parent.width; height: parent.height;
interactive: false
onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain)
highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
}
}
Item {
Package.name: 'album'
id: albumWrapper; width: 16.5*mm; height: 16.5*mm
DelegateModel {
id: visualModel; delegate: PhotoComponent { }
model: photoModel
}
PathView {
id: photosPathView;
model: visualModel.parts.stack;
pathItemCount: 1
anchors.centerIn: parent;
path: Path {
PathAttribute { name: 'z'; value: 9999.0 }
PathLine { x: 1; y: 1 }
PathAttribute { name: 'z'; value: 0.0 }
}
}
Rectangle{
color:"black"
opacity: 0.5
width:albumtext.contentWidth
height: albumtext.contentHeight
anchors.bottom: albumWrapper.bottom
}
Text {
id:albumtext
text: albumname
width:albumWrapper.width-1*mm
height: albumtext.contentHeight
wrapMode:Text.Wrap
color: "white"
font.family: "Monospace"
font.pixelSize: 2*mm
anchors.bottom: albumWrapper.bottom
}
ListModel{
id: photoModel
}
Component.onCompleted:{
try {photoModel.clear()}catch (e){print(e)}
if(foreignPicture){
Imagejs.newRequestFriendsPictures(login,albumlink,friend,photoStack.remoteContact,remoteauth,root,function(obj){
if (obj) {
for (var k=0;k<obj.length;k++){
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link})
}
}
})}
else{
Helperjs.readData(db,"imageData",root.login.username,function(obj){
if (obj) {
for (var k=0;k<obj.length;k++){
if(typeof(obj[k].desc)=="string" && obj[k].desc!=""){var name=obj[k].desc}else{var name=obj[k].filename}
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":name,"photoLink":obj[k].location+obj[k].filename,"imageId":obj[k].id})
}
}
},"album",albumname)}
}
MouseArea {
anchors.fill: parent
onPressAndHold:{
var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('album',albumname);photogroupModel.remove(index)}}}";
var albummenuObject=Qt.createQmlObject(menuString,albumWrapper,"albummenuOutput")
albummenuObject.popup()
}
onClicked: albumWrapper.state = 'inGrid'
}
states: [
State {
name: 'inGrid'
PropertyChanges { target: photosGridView; interactive: true }
PropertyChanges { target: photoBackground; opacity: 1 }
PropertyChanges { target: backButton; onClicked: albumWrapper.state = ''; y: 6 }
},
State {
name: 'fullscreen'; extend: 'inGrid'
PropertyChanges { target: photosGridView; interactive: false }
PropertyChanges { target: photosListView; interactive: true }
PropertyChanges { target: photoBackground; opacity: 1 }
PropertyChanges { target: backButton;onClicked:{
albumWrapper.state = 'inGrid'}
}
}
]
} //album Ende
} //Package Ende
//item Ende