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

View file

@ -65,7 +65,7 @@ Page{
var useritems="";
for (var i=0;i<accountPage.users.length;i++){
useritems=useritems+"MenuItem{font.pixelSize: 3*mm; text:'"+accountPage.users[i].username+
useritems=useritems+"MenuItem{font.pixelSize: 3*mm;width:accountPage.width*2/3; text:'"+accountPage.users[i].username+
"'; onTriggered: {Service.readConfig(db,function(obj){
userButton.text=obj.username;
servername.text=obj.server;
@ -191,7 +191,7 @@ Page{
text: "\uf234"
font.pixelSize: 3*mm
onClicked: {
configStack.push({item:"qrc:/qml/configqml/RegisterPage.qml",properties:{url:servername.text+"/register?nickname="+username.getText(0,username.length)}})
root.push("qrc:/qml/configqml/RegisterPage.qml",{url:servername.text+"/register?nickname="+username.getText(0,username.length)})
}
}
@ -217,6 +217,7 @@ Page{
width: imagestoreFlickable.width
height: imagestoreFlickable.height
font.pixelSize:3*mm
text: (osSettings.osType=="Android") && (filesystem.fileexist("/storage/emulated/0/Pictures/"))?"/storage/emulated/0/Pictures/":""
wrapMode: TextEdit.NoWrap
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable)
}
@ -405,6 +406,7 @@ Page{
Button{
id:closeButton
height: 8*mm
width: 5*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
@ -428,7 +430,7 @@ Page{
}
Component.onCompleted: {
try{Helperjs.readData(db,"config","",function(storedUsers){
try{Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
})
@ -445,13 +447,8 @@ Page{
//messageIntervalSlider.value=obj.timerInterval;
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
},"isActive",0)
})
// Service.readGlobaloptions(db,function(go){
// if (root.globaloptions.showWebsiteForLinks!="false"){showwebsiteCheckbox.checked=true}
// })
}
catch (e){print(e)
})}
catch (e){print(e)
// Helperjs.friendicaWebRequest("https://dir.friendica.social/servers/surprise",accountPage,function(html){
// print(html);
// var bpos=html.indexOf("base ");

View file

@ -118,6 +118,25 @@ Page{
}
CheckBox{
id: nsfwCheckbox
x: 4*mm
y: 33.5*mm
font.pixelSize: 3*mm
//width:5*mm
text: qsTr("Hide #nsfw?")
checked:(globaloptions["hide_nsfw"]==1)?true:false
onClicked: {
toggle();
if(nsfwCheckbox.checked==true){
Service.updateglobaloptions(root.db,"hide_nsfw",0);nsfwCheckbox.checked=false;
}
else{
Service.updateglobaloptions(root.db,"hide_nsfw",1);nsfwCheckbox.checked=true;
}
}
}
Rectangle{color: "light grey"; x: 4*mm; y: 13.5*mm; width: 9*mm; height: 5*mm;
radius: 0.5*mm
TextEdit{id:maxNewsText;
@ -132,7 +151,6 @@ Page{
}
}
}
Rectangle{
x: 4*mm; y:23.5*mm; width: parent.width - 14*mm; height: 5*mm;
color:"light grey"

View file

@ -38,29 +38,30 @@ Rectangle{
color:"white"
//border.color: "light grey"
property alias url:htmlview.url
width:root.width-5*mm
height:root.height-12*mm
// width:root.width-5*mm
// height:root.height-12*mm
WebView {id:htmlview;
height:parent.height-7*mm
width:parent.width
y:7*mm
MouseArea {anchors.fill:parent;
onClicked:{
//print(url)
}
}
// MouseArea {
// anchors.fill:parent;
// onClicked:{
// //print(url)
// }
// }
//onLoadingChanged: print(loadProgress)
}
Button{
id:closeButton
height:8*mm
height:6*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
font.pixelSize: 3*mm
onClicked:{configStack.pop()}
onClicked:{root.pop()}
}
}

View file

@ -44,15 +44,21 @@ Rectangle {
y:1
color: "white"
// function showContactdetails(contact){
// var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
// if(contact.isFriend){
// friendsTabView.currentIndex=1;
// var contactDetails = component.createObject(friendstab,{"contact": contact})
// }
// else{friendsTabView.currentIndex=2;
// var contactDetails = component.createObject(friendstab,{"contact": contact})
// }
// }
function showContactdetails(contact){
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
if(contact.isFriend){
friendsTabView.currentIndex=1;
var contactDetails = component.createObject(friendstab,{"contact": contact})
}
else{friendsTabView.currentIndex=2;
var contactDetails = component.createObject(friendstab,{"contact": contact})
}
rootstack.currentIndex=0;
bar.currentIndex=0;
root.contactdetailsSignal(contact)
}
function showProfile(callback){
@ -103,6 +109,7 @@ Rectangle {
currentIndex: friendsbar.currentIndex
signal contactsSignal(var contact)
signal groupsSignal(var username)
onCurrentIndexChanged:{
if (currentIndex==1){
contactsSignal("")
@ -147,6 +154,7 @@ Rectangle {
Layout.fillWidth:true
Layout.fillHeight: true
property int currentContact: 0
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
@ -209,6 +217,7 @@ Rectangle {
height:friendsGridTab.height-updateFriendsButton.height-2*mm
clip: true
spacing: 2
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
@ -269,6 +278,7 @@ Rectangle {
width:contactsGridTab.width-2*mm
height:contactsGridTab.height-cleanButton.height-2*mm
clip: true
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
@ -315,7 +325,7 @@ Rectangle {
Connections{
target:xhr
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
onSuccess:{print("gruppe "+data);
onSuccess:{
Newsjs.requestGroups(root.login,root.db,root,function(){
showGroups(root.login.username)});
}

View file

@ -116,7 +116,8 @@ Item {
if (userdata[0]){
userdata[0].name=Qt.atob(userdata[0].name);
userdata[0].description=Qt.atob(userdata[0].description)
groupModel.append({"groupmember":userdata[0]
//groupModel.append({"groupmember":userdata[0]
groupModel.append({"contact":userdata[0]
})}
},"id",groupmembers[user])
} //catch(e){}
@ -132,53 +133,53 @@ Item {
anchors.topMargin: mm
opacity: 0
Component {
id:groupMember
Rectangle{
width:parent.width
height:6*mm
Rectangle{id:memberrectangle
border.color: "#EEEEEE"
border.width: 1
width:parent.width-12*mm
height:6*mm
Image {
id: memberImage
x:1
y:1
width: 5*mm
height:5*mm
source:(groupmember.isFriend==1)? "file://"+groupmember.profile_image :groupmember.profile_image_url
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pixelSize: 3*mm
anchors.left: memberImage.right
anchors.margins: 1*mm
width:parent.width-1
text:groupmember.name
}
MouseArea{
anchors.fill: parent
onClicked:{
// root.currentIndex=1;
// friendstab.active=true;
// Component {
// id:groupMember
// Rectangle{
// width:parent.width
// height:6*mm
// Rectangle{id:memberrectangle
// border.color: "#EEEEEE"
// border.width: 1
// width:parent.width-12*mm
// height:6*mm
// Image {
// id: memberImage
// x:1
// y:1
// width: 5*mm
// height:5*mm
// source:(groupmember.isFriend==1)? "file://"+groupmember.profile_image :groupmember.profile_image_url
// onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
// }
// Text{
// font.pixelSize: 3*mm
// anchors.left: memberImage.right
// anchors.margins: 1*mm
// width:parent.width-1
// text:groupmember.name
// }
// MouseArea{
// anchors.fill: parent
// onClicked:{
//// root.currentIndex=1;
//// friendstab.active=true;
//// root.contactdetailsSignal(groupmember)
// root.currentIndex=0;
// root.contactdetailsSignal(groupmember)
root.currentIndex=0;
root.contactdetailsSignal(groupmember)
}
}
// BlueButton{
// anchors.left: memberrectangle.right
// anchors.margins: 1*mm
// text: "\uf056"
// onClicked:{
// groupModel.remove(index)
// }
// }
}
}
}
// }
// }
// // BlueButton{
// // anchors.left: memberrectangle.right
// // anchors.margins: 1*mm
// // text: "\uf056"
// // onClicked:{
// // groupModel.remove(index)
// // }
// // }
// }
// }
// }
ListView{
id: groupListView
@ -189,7 +190,8 @@ Item {
clip: true
spacing: 2
model: groupModel
delegate: groupMember
delegate: ContactComponent { }// groupMember
function processContactSelection(contactobject){showContactdetails(contactobject)}
}
ListModel{id: groupModel}

View file

@ -120,6 +120,7 @@ StackView{
})}
}
else if (newstab.conversation.length>0){newstab.conversation=[]}
else if (root.depth>1){root.pop()}
else{Service.cleanNews(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})

View file

@ -0,0 +1,93 @@
// 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.0
import QtQuick.Controls 2.4
import "qrc:/qml/genericqml"
Item {
id: contactComponent
height: 8*mm
width: parent.width
property var createdAtDate: new Date(contact.created_at)
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
Rectangle {
id: wrapper
width:parent.width
height: 8*mm
border.color: "grey"
color:"white"
Image {
id: photoImage
x:0.5*mm
y:0.5*mm
width: 7*mm
height:7*mm
source:((contact.profile_image!="") && (typeof(contact.profile_image)=="string"))? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: {if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}}
}
Column{
width: wrapper.width-8*mm
anchors.left: photoImage.right
anchors.margins: 1*mm
spacing: mm
Label {
id: namelabel
width: wrapper.width-4
height: 3*mm
text: contact.name
elide:Text.ElideRight
color: "#303030"
font.pixelSize: 3*mm
}
Label {
id: screennamelabel
width: wrapper.width-8*mm
height: 2.5*mm
text: "@"+contact.screen_name
elide:Text.ElideRight
color: "#303030"
font.pixelSize: 2.5*mm
}
}
MouseArea{
anchors.fill: parent
onClicked:{
contactComponent.ListView.view.processContactSelection(contact)
// rootstack.currentIndex=0;
// bar.currentIndex=0;
// root.contactdetailsSignal(contact)
}
}
}
}

View file

@ -50,6 +50,7 @@ Rectangle {
ListView {
id: conversationView
property string viewtype: "conversation"
x:3*mm
y:8*mm
width: conversationList.width-4*mm

View file

@ -47,6 +47,7 @@ Rectangle{
id:messageSend
visible:(newsSwipeview.stacktype!="Notifications")?true:false
property string parentId: ""
property bool textfocus: false
//property var parentObject:({})
property bool conversation: false
property string reply_to_user:""
@ -55,21 +56,23 @@ Rectangle{
//property int directmessage: 0;
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 var contact_allow:login.hasOwnProperty("permissions")?login.permissions[0]:[]
property var contact_deny:login.hasOwnProperty("permissions")?login.permissions[1]:[]
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
onReply_to_userChanged: {
if (reply_to_user!=""){
receiverLabel.visible=true
}
}
// onReply_to_userChanged: {
// if (reply_to_user!=""){
// print("reply "+reply_to_user)
// //receiverLabel.visible=true
// receiverLabel.text=reply_to_user
// }
// }
function directmessagePrepare(friend){
messageSend.state="active";
reply_to_user=friend.screen_name;
receiverLabel.text=qsTr("to:")+ " "+ friend.screen_name;
receiverLabel.text=friend.screen_name;
}
@ -94,9 +97,10 @@ Rectangle{
function attachImage(url){
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
imageAttachment.source=url.toString();
// var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
// url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
// url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
}
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
@ -114,7 +118,12 @@ Rectangle{
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))};
if (attachImageURL.length>0) {for (var image in attachImageURL){xhr.setImageFileParam("media", attachImageURL[image] )}};
if (attachImageURL.length>0) {
for (var image in attachImageURL){
xhr.setImageFileParam("media", attachImageURL[image]);
xhr.setImageFileParam("angle", rotator.angle.toString());
}
};
xhr.post();
}
@ -137,35 +146,24 @@ Rectangle{
if (newsitemobject!=""){
messageSend.state="conversation"
reply_to_user=newsitemobject.user.screen_name;
receiverLabel.text=qsTr("to:")+ " "+ newsitemobject.user.screen_name;
parentId=newsitemobject.id
} else {
messageSend.state=""
reply_to_user="";
receiverLabel.text=qsTr("to:");
parentId="";
bodyField.text="";
attachImageURLs.pop();
try{imageAttachment.destroy()}catch(e){}
imageAttachment.source=""
}
}
function contactmenu(letter){
Newsjs.listFriends(login,db,function(contacts){
var contactitems="";
contactModel.clear();
for (var i=0;i<contacts.length;i++){
if(Helperjs.getCount(db,login,"contacts","screen_name",contacts[i].screen_name)>1){
contacts[i].screen_name=contacts[i].screen_name+"+"+contacts[i].cid
}
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+
"'; onTriggered:{if (newsSwipeview.stacktype=='DirectMessages'){reply_to_user='"+
contacts[i].screen_name+"'} else {bodyField.insert("+
bodyField.cursorPosition+",' "+contacts[i].screen_name.substring(1)+" ');bodyField.cursorPosition=bodyField.cursorPosition+"+contacts[i].screen_name.length+"}}}"
//}
contactModel.append({"contact":contacts[i]})
}
var menuString="import QtQuick.Controls 2.4; Menu {width:40*mm; font.pixelSize: 3*mm; "+contactitems+"}";
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput");
if (contacts.length>0){contactlistObject.popup()}
contactSelector.visible=true
},letter);
}
// Flickable{
@ -179,18 +177,47 @@ Rectangle{
spacing: 0.5*mm
width: parent.width
height: 10*mm//implicitHeight
Label{
id:receiverLabel
x: 0.5*mm
width: parent.width-mm
font.pixelSize: 3*mm
text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
MouseArea{
anchors.fill: parent
onClicked:{}
// Row{
// x: 0.5*mm
// Label{
// id:toLabel
// width: 7*mm
// height: 6*mm
// topPadding: 1.5* mm
// font.pixelSize: 3*mm
// text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:"):""
// visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
// }
TextArea{
id:receiverLabel
//x: 8*mm
width: messageColumn.width//-8*mm
font.pixelSize: 3*mm
placeholderText:qsTr("to:")
text: ""//newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
//onLengthChanged: contactmenu(text)
//onPreeditTextChanged: contactmenu(text)
// onActiveFocusChanged:{
// if (activeFocus==true){contactmenu("")}
// }
onTextChanged: {
//print (text)
contactmenu(text)}
// MouseArea{
// anchors.fill: parent
// onClicked:{print("receiverlabel")
// if(newsSwipeview.stacktype=="DirectMessages"){
// contactmenu();
// }}
// }
}
}
// }
TextField {
id: titleField
x: 0.5*mm
@ -203,16 +230,16 @@ Rectangle{
}
}
Rectangle{
color: "white"
radius: 0.5*mm
x:mm
width: parent.width-2*mm
height:Math.max(bodyField.contentHeight+4*mm,10*mm)
TextArea {
id: bodyField
property string contactprefix:""
anchors.fill: parent
font.pixelSize: 3*mm
font.family: "Noto Sans"
@ -226,26 +253,103 @@ Rectangle{
if (activeFocus==true){
if (conversation==true){
setParent(conversationModel.get(0).newsitemobject);
messageSend.state="conversation"
} else{
messageSend.state="active"
messageSend.state="conversation";
conversationView.contentY=conversationView.contentY+20*mm
} else if (textfocus==false){
messageSend.state="active";
newsView.positionViewAtBeginning();
}
}
}
onTextChanged:{
if (text!=""){
//print(getText(bodyField.cursorPosition-2,bodyField.cursorPosition) +" preedit: "+ preeditText+cursorPosition);
var regex1 = /@[a-z]/;var regex2 = /![a-z]/;
//print(text.substring(cursorPosition-2,cursorPosition));
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
if (regex1.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)+preeditText) || regex2.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)+preeditText)){
var letter=(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)).match(/[a-z]/);
contactmenu(letter)
}
}}
var plaintext=getText(0,cursorPosition)
//print(plaintext+plaintext.lastIndexOf("@",cursorPosition)+getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition) +" preedit: "+ preeditText+cursorPosition);
var regex1 = /@[a-z]+/;var regex2 = /![a-z]+/;var regex3 = /\s/;
//print(text.substring(cursorPosition-2,cursorPosition));
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
if (regex1.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText)){
var letter=(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)).match(/[a-z]+/);
contactprefix="@";
contactmenu(letter.toString())
} else if( regex2.test(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) ){
var letter=(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)).match(/[a-z]+/);
contactprefix="!";
contactmenu(letter.toString())
}else {contactSelector.visible=false}
}else{contactSelector.visible=false}
}
}
}
ListView{
id:contactSelector
visible: false
z:3
x:8*mm
width: parent.width-9*mm
height: messageSend.height/2
model:contactModel
function processContactSelection(contact){
if(Helperjs.getCount(db,login,"contacts","screen_name",contact.screen_name)>1){
contact.screen_name=contact.screen_name+"+"+contacts.cid
}
if (newsSwipeview.stacktype=='DirectMessages'){
receiverLabel.text=contact.screen_name;
reply_to_user=contact.screen_name
} else {
bodyField.remove(bodyField.getText(0,bodyField.cursorPosition).lastIndexOf(bodyField.contactprefix,bodyField.cursorPosition),bodyField.cursorPosition);
bodyField.insert(bodyField.cursorPosition, bodyField.contactprefix+contact.screen_name+" ");
bodyField.cursorPosition=bodyField.cursorPosition+contact.screen_name.length+1
}
//receiverLabel.text=contact.screen_name;
contactSelector.visible=false
}
delegate: ContactComponent { }
}
ListModel{id:contactModel}
Item{
id:imageAttachment;
property alias source:realimage.source
//property alias angle:rotator.angle
visible: source!=""
width: 45*mm
height: 45*mm;
MouseArea{
anchors.fill: parent
onClicked: {
attachImageURLs.splice(attachImageURLs.indexOf(source),1);
imageAttachment.source=""
}
}
Image{id:realimage
source:"";
x:2*mm;
width: 45*mm;
height: source==""?0:45*mm;
fillMode: Image.PreserveAspectFit;
transform: Rotation {id:rotator; origin.x: 22.5*mm; origin.y: 22.5*mm; angle: 0}
}
Rectangle{
width: 5*mm
height: 5*mm
visible: imageAttachment.source!=""
anchors.bottom: imageAttachment.bottom
anchors.right: imageAttachment.right
color: "black"
opacity: 0.5
Text{anchors.centerIn:parent;text: "\uf01e";color: "white"}
MouseArea{
anchors.fill:parent;
onClicked:{
rotator.angle+=90;
}
}
}
}
// Row{
// spacing: 2
@ -341,13 +445,16 @@ Rectangle{
width: 7*mm
text: "\uf057"
onClicked: {
bodyField.text="";
messageSend.state="";
permissionDialog.visible=false;
receiverLabel.visible=false;
reply_to_user="";
attachImage("");
attachImageURLs.pop();
if (textfocus==true){messageSend.destroy()}
else{
bodyField.text="";
messageSend.state="";
permissionDialog.visible=false;
receiverLabel.visible=false;
reply_to_user="";
attachImage("");
attachImageURLs.pop();
}
}
}
MButton {
@ -382,6 +489,7 @@ Rectangle{
root.directmessageSignal.connect(directmessagePrepare);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
if (textfocus==true){bodyField.forceActiveFocus()}
}
states: [ State {
@ -398,6 +506,9 @@ Rectangle{
PropertyChanges {
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
}
// PropertyChanges {
// target: toLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
// }
},
State {
name: "conversation"
@ -422,6 +533,23 @@ Rectangle{
// PropertyChanges {
// target: messageSend; parentId: conversationModel.get(0).newsitemobject.status_id
// }
} ]
},
State {
name: "reply"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:false
}
PropertyChanges {
target: bodyField; placeholderText:"";focus:true
}
}
]
}
//}

View file

@ -152,7 +152,40 @@ StackView{
newsView.anchors.topMargin=mm
}
Connections{
function getOldNews(){
var currentTime= new Date();
try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 }
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
if(newstab.newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
// else if(newstab.newstabstatus=="Contact"){
// Newsjs.newsfromdb(root.db,root.login, function(news){
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
// newsWorker.sendMessage(msg);
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
else if (newstab.newstabstatus=="Notifications"){}
else{
//newsStack.appendNews=true;
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
xhr.get()
}
}
Connections{
target:xhr
onError:{
Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
@ -375,39 +408,11 @@ StackView{
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{anchors.fill:parent
MouseArea{
anchors.fill:parent
onClicked:{
var currentTime= new Date();
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
if(newstab.newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
// else if(newstab.newstabstatus=="Contact"){
// Newsjs.newsfromdb(root.db,root.login, function(news){
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
// newsWorker.sendMessage(msg);
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
else if (newstab.newstabstatus=="Notifications"){}
else{
//newsStack.appendNews=true;
xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);
xhr.get()
}}
getOldNews();
}
}
}
}
@ -425,6 +430,8 @@ StackView{
id: newsView
property real oldContentY:0
property bool viewdragged: false
property bool viewdraggedpositive: false
property string viewtype: "news"
anchors.fill: parent
anchors.margins: mm
//anchors.topMargin: 6*mm
@ -440,7 +447,10 @@ StackView{
onDragEnded: {
if(verticalOvershoot<-5*mm){
viewdragged=true
}
}
else if (verticalOvershoot>5*mm){
viewdraggedpositive=true
}
else{
if((contentY-oldContentY)>15*mm){
swipeIndicator.visible=false;
@ -460,24 +470,25 @@ StackView{
if (viewdragged){
var onlynew=true;
newsBusy.running=true;
viewdragged=false
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news";
if (newsSwipeview.stacktype=="Home"){
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
if (currentlastnews>lastnewsid){
if(newstab.newstabstatus=="Timeline"){
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)};
}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
lastnewsid=lastid;
showNews(news)});
}
if (newsSwipeview.stacktype=="Home"){
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
if (currentlastnews>lastnewsid){
if(newstab.newstabstatus=="Timeline"){
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)};
}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
lastnewsid=lastid;
showNews(news)});
}
} else {
Service.updateView(newstab.newstabstatus)
}
@ -492,9 +503,16 @@ StackView{
else if (newsSwipeview.stacktype=="Replies"){
Service.updateView("Replies")
}
viewdragged=false
}}
}
}
onViewdraggedpositiveChanged: {
if (viewdraggedpositive){
getOldNews();
viewdraggedpositive=false
}
}
}
ListModel{id: newsModel}
@ -554,7 +572,7 @@ StackView{
// showNews(root.news)
// }
//else{
newstab.newstabstatus=login.newsViewType;
login.hasOwnProperty("newsViewType")?newstab.newstabstatus=login.newsViewType:"Conversations"
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;

View file

@ -59,10 +59,8 @@ Item {
// }
Timer {id:contacttimer; interval: 50; running: false; repeat: false
onTriggered: {//print("Contacttimer "+JSON.stringify(root.news));
onTriggered: {
// downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now()
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
Newsjs.storeNews(login,db,root.news,root)

View file

@ -29,63 +29,39 @@
// 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 QtMultimedia 5.8
//import QtMultimedia 5.8
import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
//import QtQuick.Controls 2.4
//import QtQuick.Controls.Styles 1.4
Rectangle{
color:"black"
//border.color: "light grey"
width:newscolumn.width;
height:newscolumn.width/4*3//video.hasVideo?newscolumn.width/4*3:10*mm
property alias source:video.source
width:newscolumn.width/2;
height:newscolumn.width/3//video.hasVideo?newscolumn.width/4*3:10*mm
property var attachment:({})
Text{
id:noticeText
text:"\uf144";
color:"light grey"
width:parent.width
font.pixelSize: parent.height/2
x:parent.width/2-parent.height/4
x: (parent.width-contentWidth)/2
y:parent.height/5
visible: video.playbackState!=MediaPlayer.PlayingState
//visible: video.playbackState!=MediaPlayer.PlayingState
}
Video {id:video;
anchors.fill:parent
property string mimetype:""
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString}
fillMode: Image.PreserveAspectFit;
autoLoad: false
audioRole: MediaPlayer.VideoRole
MouseArea {anchors.fill:parent;
onClicked:{if(video.playbackState!=MediaPlayer.PlayingState){
video.play()} else{video.pause()}
MouseArea {anchors.fill:parent;
onClicked:{
if(attachment.mimetype=="video/youtube"){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsYplayer.qml");
var videoQml = component.createObject(root,{"ytcode":attachment.url,"mimetype":attachment.mimetype});
} else {
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideoLarge.qml");
var videoQml = component.createObject(root,{"source": attachment.url,"mimetype": attachment.mimetype});
}
}
}
ProgressBar{
id: videoProgress
width: parent.width
height: 2*mm
anchors.top: video.bottom
z:2
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.position/video.duration
}
ProgressBar{
id: videoBuffer
width: parent.width
height: 2*mm
anchors.top: video.bottom
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.bufferProgress
style:ProgressBarStyle{
progress: Rectangle{
color:"light grey"
}
}
}
// Slider{ id: videoSlider
// width: parent.width
// height: 3*mm

View file

@ -0,0 +1,111 @@
// 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 QtMultimedia 5.8
import QtQuick 2.9
import QtQuick.Controls 2.4
//import QtQuick.Controls.Styles 1.4
Rectangle{
id:newsvideofullscreen
color:"black"
//border.color: "light grey"
width:root.width;
height:root.height
property alias source:video.source
Text{
id:noticeText
text:""
color:"light grey"
width:parent.width/2
wrapMode: Text.Wrap
font.pixelSize: 3*mm
x:parent.width/2-parent.height/4
y:parent.height/5
visible: video.playbackState!=MediaPlayer.PlayingState
}
Video {id:video;
anchors.fill:parent
property string mimetype:""
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString;}
fillMode: Image.PreserveAspectFit;
autoLoad: true
autoPlay: true
audioRole: MediaPlayer.VideoRole
MouseArea {
anchors.fill:parent;
onClicked:{
newsvideofullscreen.destroy();
}
}
}
ProgressBar{
id: videoProgress
width: parent.width
height: 2*mm
anchors.bottom: video.bottom
z:2
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.position/video.duration
MouseArea {
anchors.fill:parent;
onClicked:{
if(video.playbackState!=MediaPlayer.PlayingState){
video.play()} else{video.pause()
}
}
}
}
ProgressBar{
id: videoBuffer
width: parent.width
height: 2*mm
anchors.bottom: video.bottom
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.bufferProgress
// style:ProgressBarStyle{
// progress: Rectangle{
// color:"light grey"
// }
// }
}
// Slider{ id: videoSlider
// width: parent.width
// height: 3*mm
// anchors.top: video.bottom
// visible:video.playbackState!=MediaPlayer.StoppedState && video.seekable
// value: video.position/video.duration
// onPressed:video.seek(value*video.duration)
// }
}

View file

@ -33,19 +33,23 @@
import QtQuick 2.8
import "qrc:/js/helper.js" as Helperjs
//import QtWebView 1.1
import QtWebView 1.1
Rectangle{
color:"transparent"
width:newscolumn.width;
height:newscolumn.width/4*3
property string url:""//htmlview.text
id:newsYplayer
color:"black"
width:root.width;
height:root.height
property string url:""
property string ytcode:""
WebView {
id: webView
anchors.fill: parent
z:1
opacity: 0
url: "qrc:///content/player.html?" + currentVideo.vId
url: root.osSettings.osType=="Android"?"https://youtube.com/watch?v="+ytcode:"qrc:/js/yplayer.html?" + ytcode
Behavior on opacity { NumberAnimation { duration: 200 } }
@ -59,42 +63,13 @@ Rectangle{
case WebView.LoadStoppedStatus:
break
case WebView.LoadFailedStatus:
topInfo.text = "Failed to load the requested video"
print("Failed to load the requested video" + url)
break
}
opacity = 0
}
onTitleChanged: {
currentVideo.status = 1 * title
if (title == videoStatus.paused || title == videoStatus.ready)
panel.state = "list"
else if (title == videoStatus.playing)
panel.state = "hidden"
if (title==2){newsYplayer.destroy()}
}
}
Text{id:htmlview
textFormat:Text.RichText
}
// WebView {id:htmlview;
// anchors.fill: parent
// }
Component.onCompleted:{
// Helperjs.friendicaWebRequest(url,parent,function(document){
// print(document);
//// var metas = document.getElementsByTagName('meta'); //get all the meta tag elements
//// //iterate through them
//// for (i=0; i<metas.length; i++) {
//// if (metas[i].getAttribute("name") == "keywords") {
//// print(metas[i].getAttribute("content"));
//// }
//// else if (metas[i].getAttribute("name") == "description") {
//// console.log(metas[i].getAttribute("content"));
//// }
//// }
// //print(html);
// htmlview.text=""
// })
}
}

View file

@ -147,7 +147,7 @@ Item {
width:parent.width
spacing:mm
clip:true
height: Math.min(implicitHeight,3/4*root.height)
height: newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
MouseArea{
width: newsitem.width-8*mm-2
height: itemMessage.height
@ -188,9 +188,10 @@ Item {
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
var linkQml = component.createObject(messageColumn,{"url":newsitemobject.attachmentList[attachments].url});
}
else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
else {
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
//var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
var videoQml = component.createObject(messageColumn,{"attachment":newsitemobject.attachmentList[attachments]});
}
}
}
@ -201,7 +202,7 @@ Item {
width: newsitem.width-8*mm-2
height:5*mm
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
visible: messageColumn.implicitHeight>3/4*root.height//itemMessage.implicitHeight>3/4*root.height
visible: messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
text:"\uf078"
fontColor:"grey"
border.color: "transparent"
@ -412,7 +413,10 @@ Item {
onTriggered: {
var directmessage=0;
if (newsitemobject.messagetype==1){ directmessage=1}
replySignal(newsitemobject)
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
var conversation;newsitem.ListView.view.viewtype=="conversation"?true:false;
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
//replySignal(newsitemobject)
//newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage});
}
}

View file

@ -254,8 +254,22 @@ function updateImage(){
y: 10*mm
width: root.width/2;
height: 5*mm;
font.pixelSize: 3*mm
editable:true
model: albumModel
// delegate: ItemDelegate {
// width: album.width
// contentItem: Text {
// //text: modelData
// color: "white"
// font: album.font
// font.pixelSize: album.font.pixelSize
// elide: Text.ElideRight
// verticalAlignment: Text.AlignVCenter
// }
// //highlighted: album.highlightedIndex === index
// }
onAccepted: {
if (find(currentText) === -1) {
albumModel.append({text: editText})

View file

@ -116,7 +116,7 @@ StackView{
else{
try {photogroupModel.clear()}catch (e){print(e)}
if (friend){
Imagejs.newRequestFriendsAlbumPictures(root.login,friend,fotorectangle,function(albums,remoteAuthBool){
Imagejs.newRequestFriendsAlbumPictures(login,friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true,'friend':friend}
photoWorker.sendMessage(msg);
@ -125,7 +125,7 @@ StackView{
}
else {
Helperjs.readField("album", root.db, "imageData",login.username,function(albums){
Helperjs.readField("album", db, "imageData",login.username,function(albums){
if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg);
@ -261,7 +261,7 @@ StackView{
text:qsTr("More")
}
MouseArea{anchors.fill:parent
onClicked:{print(photogroupModel.get(0).foreignPicture);
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){