Friendiqa v0.2.1
This commit is contained in:
parent
c85f857afe
commit
ee50729e0d
45 changed files with 580 additions and 146 deletions
|
@ -171,7 +171,7 @@ StackView{
|
|||
onEditingFinished:{
|
||||
Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){
|
||||
var screennametest=JSON.parse(obj);
|
||||
if (screennametest.status.error){
|
||||
if (screennametest.hasOwnProperty('status')){
|
||||
Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground);
|
||||
configBackground.registeredUser=false;
|
||||
}else{configBackground.registeredUser=true}
|
||||
|
@ -226,7 +226,7 @@ StackView{
|
|||
Text{
|
||||
id: newsTypeField
|
||||
anchors.fill: parent
|
||||
text:"Timeline"
|
||||
text:"Conversations"
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
|
@ -289,7 +289,7 @@ StackView{
|
|||
var credentials=JSON.parse(obj);
|
||||
if (credentials.hasOwnProperty('status')){
|
||||
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)
|
||||
}
|
||||
}
|
||||
else{
|
||||
filesystem.Directory=userconfig.imagestore;
|
||||
filesystem.makeDir("contacts");
|
||||
|
@ -332,7 +332,7 @@ StackView{
|
|||
password.text="";
|
||||
imagestore.text="";
|
||||
maxNews.value=0;
|
||||
newsTypeField.text="Timeline";
|
||||
newsTypeField.text="Conversations";
|
||||
messageIntervalSlider.value=0;
|
||||
userButton.text=qsTr("User");
|
||||
Helperjs.readData(db,"config","",function(storedUsers){
|
||||
|
@ -354,7 +354,7 @@ StackView{
|
|||
password.text=""
|
||||
imagestore.text=""
|
||||
maxNews.value=0
|
||||
newsTypeField.text="Timeline"
|
||||
newsTypeField.text="Conversations"
|
||||
messageIntervalSlider.value=0
|
||||
userButton.text=qsTr("User")
|
||||
}
|
||||
|
|
|
@ -37,4 +37,7 @@ QtObject{
|
|||
property int backKey: Qt.Key_Back
|
||||
//property string attachImageDir:filesystem.cameraPath+"/"
|
||||
property string imagePickQml: "ImagePicker"
|
||||
property string imagePicker:'import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
imagePickQml+'{multiple : true;onReady: {attachImageURLs.push(imageUrl);'+
|
||||
'attachImage(imageUrl)}}'
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ Rectangle {
|
|||
Text{
|
||||
id:profiletextfield
|
||||
x:2*mm
|
||||
y:3.5*mm
|
||||
y:4.5*mm
|
||||
width:parent.width-2.5*mm
|
||||
wrapMode: Text.Wrap
|
||||
font.pixelSize: 3*mm
|
||||
|
|
|
@ -57,6 +57,7 @@ TabView{
|
|||
signal friendsSignal(var username)
|
||||
signal contactdetailsSignal(var contact)
|
||||
signal eventSignal(var contact)
|
||||
signal uploadSignal(var urls)
|
||||
|
||||
property var news:[]
|
||||
property var newContacts:[]
|
||||
|
@ -161,7 +162,7 @@ TabView{
|
|||
title: "\uf03a"
|
||||
id: newstab
|
||||
property string newstabstatus
|
||||
property var conversation
|
||||
property var conversation:[]
|
||||
source:(root.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
|
||||
}
|
||||
Tab{
|
||||
|
@ -188,4 +189,11 @@ TabView{
|
|||
id: configtab
|
||||
source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":""
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
osSettings.imagePickQml+'{multiple : true; onReady: {'+
|
||||
'if(imageUrls.length==1){root.currentIndex=0;newstab.active=true;root.uploadSignal(imageUrls)} else{'+
|
||||
' root.currentIndex=2;fotostab.active=true;'+
|
||||
'root.uploadSignal(imageUrls)};}}',root,"imagePicker");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,6 @@ Item {
|
|||
target: SystemDispatcher
|
||||
onDispatched: {
|
||||
if (type === m_CHOSEN_MESSAGE) {
|
||||
//imageUrls = message.imageUrls;
|
||||
//imageUrl = imageUrls[0];
|
||||
var h=[];
|
||||
for (var n in message.imageUrls){
|
||||
h.push("file://"+ decodeURIComponent(message.imageUrls[n]).substring(5))
|
||||
|
@ -54,6 +52,7 @@ Item {
|
|||
|
||||
Component.onCompleted: {
|
||||
SystemDispatcher.loadClass("androidnative.ImagePicker");
|
||||
if (root.currentIndex==0){SystemDispatcher.setInitialized();}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ Flickable{
|
|||
id: cancelButton
|
||||
text: "\uf057"
|
||||
onClicked: {newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop()}
|
||||
newsStack.pop(null)}
|
||||
}
|
||||
BlueButton {
|
||||
id: sendButton
|
||||
|
@ -220,10 +220,11 @@ Flickable{
|
|||
if (directmessage==0){
|
||||
statusUpdate(title,body,messageSend.parentId,attachImageURLs)}
|
||||
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
|
||||
newstab.newstabstatus=login.newsViewType; newsStack.pop()
|
||||
newstab.newstabstatus=login.newsViewType; newsStack.pop(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Component.onCompleted: if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ import "qrc:/js/news.js" as Newsjs
|
|||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
//import AndroidNative 1.0
|
||||
|
||||
Item {
|
||||
Connections{
|
||||
target:newstab
|
||||
|
@ -44,18 +46,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
// Connections{
|
||||
// target:root
|
||||
// onCurrentContactChanged:{
|
||||
// if (root.newContacts.length>0){
|
||||
// if(root.currentContact<root.newContacts.length){
|
||||
// downloadNotice.text= qsTr("Download profile image for ")+ root.newContacts[root.currentContact].name;
|
||||
// //print(root.newContacts[root.currentContact].name)
|
||||
// }
|
||||
// }else{downloadNotice.text=""}
|
||||
// }
|
||||
// }
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
// onError:{if (data=="contact"){downloadNotice.text=root.newContacts[root.currentContact].name+"... Error!"}}
|
||||
|
@ -63,6 +53,8 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
|
@ -123,7 +115,11 @@ Item {
|
|||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
|
||||
}
|
||||
|
||||
|
||||
function sendUrls(urls){
|
||||
if((urls.length==1)&&(newsStack.depth<2)){
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
|
||||
}
|
||||
}
|
||||
|
||||
StackView{
|
||||
id: newsStack
|
||||
|
@ -131,6 +127,7 @@ Item {
|
|||
property int conversationIndex: 0
|
||||
|
||||
initialItem:Rectangle {
|
||||
id:newslistRectangle
|
||||
y:1
|
||||
color: "white"
|
||||
|
||||
|
@ -340,12 +337,23 @@ Item {
|
|||
root.messageSignal.connect(onFriendsMessages);
|
||||
root.directmessageSignal.connect(onDirectMessage);
|
||||
root.newsSignal.connect(showNews);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
if(root.news.length>0){showNews(root.news)}
|
||||
else{ newstab.newstabstatus=login.newsViewType;
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
|
||||
//print("imageUrls "+JSON.stringify(imageUrls)+" newsstack.depth:"+newsStack.depth);
|
||||
//newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:[imageUrl]}})
|
||||
// var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
// osSettings.imagePickQml+'{multiple : true; onReady: {'+
|
||||
// 'if(imageUrls.length==1){root.currentIndex=0;newstab.active=true;root.uploadSignal(imageUrls)} else{'+
|
||||
// ' root.currentIndex=2;fotostab.active=true;'+
|
||||
// 'root.uploadSignal(imageUrls)};}}',newstab,"imagePicker");
|
||||
//SystemDispatcher.setInitialized();
|
||||
if(root.news.length>0){showNews(root.news)}
|
||||
else{ newstab.newstabstatus=login.newsViewType;
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
}
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,15 +34,15 @@ import QtQuick.Controls 1.4
|
|||
import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Item {
|
||||
id: newsitem
|
||||
width: parent.width
|
||||
height:toprow.height+friendicaActivities.height+controlrow.height+1//Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
|
||||
property int itemindex: index
|
||||
|
||||
property string attending: ""
|
||||
property int itemindex: index
|
||||
onAttendingChanged: {attendLabel.visible=true;
|
||||
attendLabel.text= qsTr("attending: ")+ qsTr(attending)}
|
||||
|
||||
|
@ -145,8 +145,9 @@ Item {
|
|||
textFormat: Text.RichText
|
||||
text:Qt.atob(newsitemobject.statusnet_html)
|
||||
width: newsitem.width-8*mm-2
|
||||
height: implicitHeight
|
||||
height: Math.min(implicitHeight,3/4*root.height)
|
||||
wrapMode: Text.Wrap
|
||||
clip:true
|
||||
onLinkActivated:{
|
||||
Qt.openUrlExternally(link)}
|
||||
Component.onCompleted:{
|
||||
|
@ -159,6 +160,29 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
width: newsitem.width-8*mm-2
|
||||
height:10*mm
|
||||
anchors.bottom: itemMessage.bottom
|
||||
visible: itemMessage.implicitHeight>3/4*root.height
|
||||
text:"\uf078"
|
||||
fontColor:"grey"
|
||||
border.color: "transparent"
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: "transparent" }
|
||||
GradientStop { position: 0.5; color: "white" }
|
||||
}
|
||||
radius:0
|
||||
onClicked: {
|
||||
if (text=="\uf078"){
|
||||
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
|
||||
} else {
|
||||
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
|
||||
text="\uf078";
|
||||
newsView.positionViewAtIndex(index,ListView.Beginning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,12 +64,10 @@ Rectangle{
|
|||
imageUploadModel.append({"imageUrl":url,"description":""})
|
||||
}
|
||||
|
||||
z:2
|
||||
border.color: "grey"
|
||||
width: parent.width-4*mm
|
||||
height:parent.height-12*mm
|
||||
x:2*mm
|
||||
y:10*mm
|
||||
//border.color: "grey"
|
||||
y:1
|
||||
width:root.width-mm
|
||||
height:root.height-5*mm
|
||||
property string directory: ""
|
||||
|
||||
Connections{
|
||||
|
@ -95,8 +93,12 @@ Rectangle{
|
|||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
spacing: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"
|
||||
|
@ -109,7 +111,9 @@ Rectangle{
|
|||
BlueButton{
|
||||
id:closeButton
|
||||
text: "\uf057"
|
||||
onClicked:{imageDialog.destroy()}
|
||||
onClicked:{photoStack.pop();
|
||||
//imageDialog.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,6 +254,9 @@ Rectangle{
|
|||
albumModel.append({"text":storedAlbums[n]})}
|
||||
})}
|
||||
catch (e){print(e)}
|
||||
if(attachImageURLs.length>0){
|
||||
for (var n in attachImageURLs){attachImage(attachImageURLs[n])}
|
||||
}
|
||||
}
|
||||
// BusyIndicator{
|
||||
// id: imageBusy
|
||||
|
|
|
@ -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,"")}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue