forked from lubuwest/Friendiqa
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
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue