Friendiqa v0.3.2
This commit is contained in:
parent
8cd5905b63
commit
99ae53f624
54 changed files with 2771 additions and 437 deletions
|
@ -29,15 +29,17 @@
|
|||
// 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.7
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import "qrc:/js/service.js" as Service
|
||||
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]
|
||||
|
@ -60,6 +62,19 @@ Rectangle{
|
|||
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":""})
|
||||
}
|
||||
|
@ -74,15 +89,24 @@ Rectangle{
|
|||
target:xhr
|
||||
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
|
||||
onSuccess:{
|
||||
imageNo=imageNo+1;
|
||||
if(imageNo<imageUploadModel.count){
|
||||
uploadSelectedImage(imageNo);
|
||||
}else{
|
||||
Service.requestList(root.login,root.db, fotostab,function(obj){
|
||||
fotorectangle.newimages=obj;
|
||||
imageDialog.destroy()
|
||||
})
|
||||
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()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,35 +141,43 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("Album")
|
||||
x: 4*mm; y: 10*mm
|
||||
}
|
||||
// Text {
|
||||
// text: qsTr("Album")
|
||||
// x: 4*mm; y: 10*mm
|
||||
// }
|
||||
|
||||
Text {
|
||||
text: qsTr("Image")
|
||||
x: 4*mm; y: 17*mm
|
||||
}
|
||||
// Text {
|
||||
// text: qsTr("Image")
|
||||
// x: 4*mm; y: 17*mm
|
||||
// }
|
||||
|
||||
Text {
|
||||
text: qsTr("Description")
|
||||
x: 4*mm; y: 33*mm
|
||||
}
|
||||
// Text {
|
||||
// text: qsTr("Description")
|
||||
// x: 4*mm; y: 33*mm
|
||||
// }
|
||||
|
||||
ListView{
|
||||
id: imageUploadView
|
||||
x:23*mm
|
||||
x:3*mm //23*mm
|
||||
y:17*mm
|
||||
width: imageDialog.width-25*mm
|
||||
height: 25*mm
|
||||
width: imageDialog.width-5*mm //25*mm
|
||||
height: root.width/2 //25*mm
|
||||
model: imageUploadModel
|
||||
delegate: imageDelegate
|
||||
footer: imageFooter
|
||||
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
|
||||
}
|
||||
|
@ -153,14 +185,15 @@ Rectangle{
|
|||
Component{
|
||||
id: imageDelegate
|
||||
Rectangle{
|
||||
width:Math.max(20*mm,descriptionInput.contentWidth)
|
||||
height:20*mm
|
||||
width:root.width/2 //Math.max(20*mm,descriptionInput.contentWidth)
|
||||
height:imageUploadView.height-5*mm // 20*mm
|
||||
Image{
|
||||
id: uploadImage
|
||||
width: 20*mm
|
||||
height: 14*mm
|
||||
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:{
|
||||
|
@ -174,13 +207,19 @@ Rectangle{
|
|||
Rectangle{
|
||||
color: "light grey"
|
||||
border.color: "grey"
|
||||
x: mm; y: 15*mm; width:Math.max(20*mm, descriptionInput.contentWidth);
|
||||
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;
|
||||
TextInput {
|
||||
TextField{
|
||||
//TextInput {
|
||||
id: descriptionInput
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 3*mm
|
||||
selectByMouse: true
|
||||
text:description
|
||||
placeholderText: qsTr("Description")
|
||||
text:description!=""?description:""
|
||||
onTextChanged: imageUploadModel.set(index,{"description":descriptionInput.text});
|
||||
}
|
||||
}
|
||||
|
@ -190,13 +229,15 @@ Rectangle{
|
|||
id: imageFooter
|
||||
Image{
|
||||
id: footerImage
|
||||
width: 15*mm
|
||||
height: 15*mm
|
||||
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:{
|
||||
onClicked:{print(imagePicking)
|
||||
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");
|
||||
|
@ -207,7 +248,7 @@ Rectangle{
|
|||
}
|
||||
ComboBox{
|
||||
id: album
|
||||
x: 23*mm
|
||||
x: 3*mm
|
||||
y: 10*mm
|
||||
width: root.width/2;
|
||||
height: 5*mm;
|
||||
|
@ -225,14 +266,14 @@ Rectangle{
|
|||
|
||||
BlueButton{
|
||||
id:uploadButton
|
||||
x:4*mm; y:40*mm
|
||||
text: qsTr("Upload")
|
||||
x:4*mm; y:root.width/2+18*mm //40*mm
|
||||
text: imageId==""?qsTr("Upload"):qsTr("Change")
|
||||
onClicked:{
|
||||
//imageBusy.running=true;
|
||||
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)
|
||||
if (imageUploadModel.count>0){
|
||||
uploadSelectedImage(0)
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
@ -258,13 +299,4 @@ Rectangle{
|
|||
for (var n in attachImageURLs){attachImage(attachImageURLs[n])}
|
||||
}
|
||||
}
|
||||
// BusyIndicator{
|
||||
// id: imageBusy
|
||||
// anchors.horizontalCenter: imageUploadView.horizontalCenter
|
||||
// anchors.top:imageUploadView.top
|
||||
// anchors.topMargin: 2*mm
|
||||
// width:10*mm
|
||||
// height: 10*mm
|
||||
// running:false
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
// 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.7
|
||||
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}
|
||||
|
@ -42,6 +43,7 @@ Package {
|
|||
width: 16.5*mm; height: 16.5*mm
|
||||
z: stackItem.PathView.z
|
||||
property string hqphotolink: photoLink
|
||||
property string imageId:""
|
||||
|
||||
Rectangle {
|
||||
id: placeHolder
|
||||
|
@ -82,7 +84,12 @@ Package {
|
|||
MouseArea {
|
||||
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
|
||||
onPressAndHold:{
|
||||
var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('image','"+imageLocation+"');photoModel.remove(index)}}}";
|
||||
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()
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
// 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.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQml.Models 2.1
|
||||
import "qrc:/js/image.js" as Imagejs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
|
@ -51,6 +51,7 @@ StackView{
|
|||
property int currentimageno: 0
|
||||
property bool remoteContact: false
|
||||
|
||||
|
||||
onNewimagesChanged:{
|
||||
if(fotorectangle.newimages.length>0){
|
||||
//print("newimages "+JSON.stringify(newimages));
|
||||
|
@ -104,6 +105,7 @@ StackView{
|
|||
|
||||
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'}
|
||||
|
@ -132,9 +134,17 @@ StackView{
|
|||
}
|
||||
}
|
||||
|
||||
function deletepics(type,url ,imageId){
|
||||
Imagejs.deleteImage(db,login,type, url,filesystem,root,function(){//showFotos("")
|
||||
})
|
||||
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({
|
||||
item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{attachImageURLs:[url[0].location+url[0].filename],imageId:id,currentAlbum:url[0].album}
|
||||
})
|
||||
},"id",id)}
|
||||
}
|
||||
|
||||
function uploadUrls(urls){
|
||||
|
@ -159,7 +169,7 @@ StackView{
|
|||
anchors.right:updatePhotolist.left
|
||||
anchors.rightMargin:mm
|
||||
text:"\uf0ee"
|
||||
onClicked: {
|
||||
onClicked: {print(root.imagePicking)
|
||||
photoStack.push({item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{}});
|
||||
// var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml");
|
||||
// var imageUpload = component.createObject(fotorectangle);
|
||||
|
@ -272,6 +282,8 @@ StackView{
|
|||
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,"")}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
// 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.0
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQml.Models 2.1
|
||||
//import "qrc:/js/service.js" as Service
|
||||
|
@ -116,7 +116,7 @@ Package {
|
|||
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})
|
||||
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":name,"photoLink":obj[k].location+obj[k].filename,"imageId":obj[k].id})
|
||||
}
|
||||
}
|
||||
},"album",albumname)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue