version v0.6

This commit is contained in:
LubuWest 2021-05-12 21:41:34 +02:00
commit 8482bde3ed
86 changed files with 7064 additions and 3208 deletions

View file

@ -47,41 +47,41 @@ Rectangle {
height:groupListView.height
ListView {
id: contactView
x:mm
y:6*mm
width: contactlistRectangle.width-2*mm
height: contactlistRectangle.height-10*mm
clip: true
spacing: 0
model: contactModel
delegate: listContact
}
id: contactView
x:mm
y:6*mm
width: contactlistRectangle.width-2*mm
height: contactlistRectangle.height-10*mm
clip: true
spacing: 0
model: contactModel
delegate: listContact
}
ListModel{id: contactModel}
ListModel{id: contactModel}
Component { id:listContact
Rectangle{
border.color: "#EEEEEE"
border.width: 1
radius:0.5*mm
width:contactView.width
height:6*mm
Image {
id: contactImage
x:1
y:1
width: 5*mm
height:5*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pixelSize: 3*mm
anchors.left: contactImage.right
anchors.margins: 1*mm
text:Qt.atob(contact.name)
}
Component { id:listContact
Rectangle{
border.color: "#EEEEEE"
border.width: 1
radius:0.5*mm
width:contactView.width
height:6*mm
Image {
id: contactImage
x:1
y:1
width: 5*mm
height:5*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pointSize: osSettings.bigFontSize
anchors.left: contactImage.right
anchors.margins: 1*mm
text:Qt.atob(contact.name)
}
Text {
id:selected
anchors.right:parent.right
@ -91,40 +91,38 @@ Rectangle {
width: 5*mm
anchors.top: parent.top
color: "green"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
}
MouseArea{
MouseArea{
anchors.fill: parent
onClicked:{
if(selected.visible==true){
contacts.splice(Helperjs.inArray(contacts,"id",contact.id),1);
selected.visible=false
}
else{
contacts.push(contact);
selected.visible=true;
}
}
}
contacts.splice(Helperjs.inArray(contacts,"id",contact.id),1);
selected.visible=false
}
else{
contacts.push(contact);
selected.visible=true;
}
}
}
}
}
}
MButton {
id: closeButton
height:6* mm
width: 8*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
//color:"white"
text: "\uf057"
onClicked: {
groupModelAppend(contacts,function(){
contactlistRectangle.destroy()
});
}
MButton {
id: closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
//color:"white"
text: "\uf057"
onClicked: {
groupModelAppend(contacts,function(){
contactlistRectangle.destroy()
});
}
}
Component.onCompleted: {

View file

@ -0,0 +1,96 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 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.11
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
//import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Item{
id: contactsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
function showContacts(contact){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
}
MButton {
id: cleanButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
onClicked: {
Service.cleanContacts(root.login,root.db,function(){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
})
}
}
ListView {
id: contactsView
x:mm
y:cleanButton.height+2*mm
width:contactsGridTab.width-2*mm
height:contactsGridTab.height-cleanButton.height-2*mm
spacing: 2
clip: true
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: contactsModel
delegate: ContactComponent { }
}
ListModel{id: contactsModel}
Component.onCompleted: {
friendsTabView.contactsSignal.connect(showContacts);
showContacts()
}
}

View file

@ -0,0 +1,159 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 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.11
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Item{
id: friendsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
property int currentContact: 0
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.readData(root.db,"friendshiprequests",login.username,function(friendrequestsobject){
for (var i=0;i<friendrequestsobject.length;i++){//print(Qt.atob(friendrequestsobject[i].note));
if (friendrequestsobject[i].note!=null){
friendrequestsobject[i].description=Qt.atob(friendrequestsobject[i].note);}
else{friendrequestsobject[i].description=""}
friendrequestsobject[i].name=Qt.atob(friendrequestsobject[i].display_name);
friendrequestsobject[i].screen_name=friendrequestsobject[i].usernamef;
friendrequestsobject[i].location="";
friendrequestsobject[i].profile_image=friendrequestsobject[i].avatar_static;
friendrequestsobject[i].profile_image_url=friendrequestsobject[i].avatar;
friendrequestsobject[i].curIndex=friendsModel.count;
friendsModel.append({"contact":friendrequestsobject[i],"contactType":qsTr("Friend Requests")});
}
});
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
for (var i=0;i<friendsobject.length;i++){
if(friendsobject[i].description!=""){
friendsobject[i].description=Qt.atob(friendsobject[i].description);}
friendsobject[i].name=Qt.atob(friendsobject[i].name);
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid
}
friendsModel.append({"contact":friendsobject[i],"contactType":qsTr("Friends")});
}
},"isFriend",1,"screen_name ASC");
}
Connections{
target:xhr
function onDownloaded(type,url,filename,i){
if(type=="contactlist"){
//print(url+" "+filename+" "+i)
friendsGridTab.currentContact=i+1;
if(friendsGridTab.currentContact==root.newContacts.length){
friendsGridTab.showFriends(root.login.username)
}
}
}
}
MButton {
id: updateFriendsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
onClicked: {
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){});
updatenews.setDatabase();
updatenews.login();
updatenews.friendrequests();
//root.contactLoadType="friends";
Newsjs.requestFriends(root.login,db,root,function(nc){
root.newContacts=nc
root.onNewContactsChanged(nc);
})
}
}
ProgressBar{
id: newContactsProgress
width: 15*mm
height: updateFriendsButton.height
anchors.top: parent.top
anchors.right:updateFriendsButton.left
anchors.rightMargin:mm
visible: (friendsGridTab.currentContact!=(root.newContacts.length))?true:false
value: friendsGridTab.currentContact/root.newContacts.length
}
Component {
id: sectionHeading
Rectangle {
width: friendsView.width
height: childrenRect.height
//color: "lightsteelblue"
required property string section
Text {
text: parent.section
font.bold: true
font.pointSize: osSettings.bigFontSize
}
}
}
//GridView {
ListView{
id: friendsView
x:mm
y:updateFriendsButton.height+mm
width:friendsGridTab.width-2*mm
height:friendsGridTab.height-(updateFriendsButton.height+5*mm)
clip: true
spacing: 2
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: friendsModel
delegate: ContactComponent { }
section.property: "contactType"
section.criteria: ViewSection.FullString
section.delegate: sectionHeading
}
ListModel{id:friendsModel}
Component.onCompleted: {
root.friendsSignal.connect(showFriends);
friendsTabView.contactsSignal.connect(showFriends);
showFriends(root.login.username);
root.newContacts=[]
}
}

View file

@ -31,7 +31,6 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
//import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
@ -45,60 +44,72 @@ Rectangle {
color: "white"
function showContactdetails(contact){
rootstack.currentIndex=0;
bar.currentIndex=0;
// rootstack.currentIndex=0;
// bar.currentIndex=0;
root.contactdetailsSignal(contact)
}
function showProfile(callback){
var profile=({});
Helperjs.readData(db,"profiles",login.username,function(profileobject){
var profilearray=[];
for (var i in profileobject){
profilearray.push(JSON.parse(Qt.atob(profileobject[i].profiledata)));
}
profile.profiles=profilearray;
});
Helperjs.readData(db,"contacts",login.username,function(owner){
profile.friendica_owner=owner[0];
},"isFriend",2);
callback(profile)
BlueButton{
x:mm
y:mm
z:2
visible: !wideScreen
fontColor: "grey"
border.color: "transparent"
text: "\uf0c9"
font.pointSize: osSettings.bigFontSize
onClicked:{
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
}
TabBar {
id: friendsbar
width: parent.width
width: osSettings.osType=="Android"?parent.width-2*osSettings.bigFontSize:parent.width
height: 9*mm
x: osSettings.osType=="Android"?2*osSettings.bigFontSize:0
visible: !wideScreen
position:TabBar.Header
currentIndex: 1
TabButton {
text: qsTr("Me")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
height: 7*mm
}
TabButton {
text: qsTr("Friends")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
height: 7*mm
}
TabButton {
text: qsTr("Contacts")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
height: 7*mm
}
TabButton {
text: qsTr("Groups")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
height: 7*mm
}
}
}
LeftDrawerLinux{
id:leftDrawer
visible: wideScreen&&rootstackView.depth<2
width: visible?osSettings.systemFontSize*15:0
height: root.height-bar.height
}
LeftDrawerAndroid{
id: leftDrawerAndroid
}
StackLayout{
id:friendsTabView
//anchors.fill: parent
x:mm
y:10*mm
width: parent.width-2*mm
height: parent.height-10*mm
width: wideScreen&&rootstackView.depth<2?parent.width-leftDrawer.width-mm:parent.width-mm//newstabitem.width/3*2:newstabitem.width
x: leftDrawer.width
y: friendsbar.visible?friendsbar.height:0
height: friendsbar.visible?parent.height-friendsbar.height-mm:parent.height-mm
currentIndex: friendsbar.currentIndex
signal contactsSignal(var contact)
signal groupsSignal(var username)
@ -113,267 +124,26 @@ Rectangle {
else if (currentIndex==3){groupsSignal(root.login.username)}
}
Item{
id:profileGridTab
Layout.fillWidth:true
Layout.fillHeight: true
Component.onCompleted:{
showProfile(function(profile){
var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml");
var profilecomp = component.createObject(profileGridTab,{"profile": profile});
});
}
}
Item{
id: friendsGridTab
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){
for (var i=0;i<friendsobject.length;i++){
friendsobject[i].description=Qt.atob(friendsobject[i].description);
friendsobject[i].name=Qt.atob(friendsobject[i].name);
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid
}
friendsModel.append({"contact":friendsobject[i]});
}
},"isFriend",1,"screen_name ASC");
}
Connections{
target:xhr
function onDownloaded(type,url,filename,i){
if(type=="contactlist"){
//print(url+" "+filename+" "+i)
friendsGridTab.currentContact=i+1;
if(friendsGridTab.currentContact==root.newContacts.length){
friendsGridTab.showFriends(root.login.username)
}
}
}
}
MButton {
id: updateFriendsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
height: 6*mm
width: 8*mm
onClicked: {
try {friendsModel.clear()} catch(e){print(e)};
//root.contactLoadType="friends";
Newsjs.requestFriends(root.login,db,root,function(nc){
root.newContacts=nc
})
}
Loader{
id: profileLoader
source:(friendsTabView.currentIndex==0)? "qrc:/qml/contactqml/ProfileTab.qml":""
}
ProgressBar{
id: newContactsProgress
width: 15*mm
height: updateFriendsButton.height
anchors.top: parent.top
anchors.right:updateFriendsButton.left
anchors.rightMargin:mm
visible: (friendsGridTab.currentContact!=(root.newContacts.length))?true:false
value: friendsGridTab.currentContact/root.newContacts.length
}
//GridView {
ListView{
id: friendsView
x:mm
y:updateFriendsButton.height+2*mm
width:friendsGridTab.width-2*mm
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 }
// }
model: friendsModel
delegate: ContactComponent { }
}
ListModel{id:friendsModel}
Component.onCompleted: {
root.friendsSignal.connect(showFriends);
friendsTabView.contactsSignal.connect(showFriends);
showFriends(root.login.username);
root.newContacts=[]
}
Loader{
id: friendsListLoader
source:(friendsTabView.currentIndex==1)? "qrc:/qml/contactqml/FriendsListTab.qml":""
}
Item{
id: contactsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
function showContacts(contact){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
}
MButton {
id: cleanButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
height: 6*mm
width: 8*mm
onClicked: {
Service.cleanContacts(root.login,root.db,function(){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
})
}
}
ListView {
id: contactsView
x:mm
y:cleanButton.height+2*mm
width:contactsGridTab.width-2*mm
height:contactsGridTab.height-cleanButton.height-2*mm
spacing: 2
clip: true
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: contactsModel
delegate: ContactComponent { }
}
ListModel{id: contactsModel}
Component.onCompleted: {
friendsTabView.contactsSignal.connect(showContacts);
}
Loader{
id: contactsListLoader
source:(friendsTabView.currentIndex==2)? "qrc:/qml/contactqml/ContactsListTab.qml":""
}
Item{
id: groupsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
function showGroups(username){
try {groupsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "groups",root.login.username,function(groupsobject){
for (var j=0;j<groupsobject.length;j++){
groupsModel.append({"group":groupsobject[j]});
}})}
function updateGroup(login,database,group){
// update groups
//var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
//var groupdata={"gid":group.id,"name":group.name,"user":group.user};
//print("Groupdata "+JSON.stringify(group));
var api="";
if (group.new){api="/api/friendica/group_create.json?name="+group.name}else{api="/api/friendica/group_update.json?gid="+group.id}
xhr.url= login.server + api;
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("gid",group.id);
xhr.setParam("name",group.name);
xhr.setParam("user", group.user);
xhr.setParam("json",group);
xhr.post();
}
Connections{
target:xhr
function onError(data,url,api,code){print(data)}//if (data=="image"){Helperjs.showMessage()}}
function onSuccess(data,api){
Newsjs.requestGroups(root.login,root.db,root,function(){
showGroups(root.login.username)});
}
}
MButton {
id: updateGroupsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
anchors.rightMargin: mm
height: 6*mm
width: 8*mm
onClicked: {
Newsjs.requestGroups(root.login,root.db,root,function(){
groupsGridTab.showGroups(root.login.username)})}
}
// BlueButton {
// id: newGroupButton
// text: "\uf234"
// anchors.top: parent.top
// anchors.topMargin: mm
// anchors.right: updateGroupsButton.left
// anchors.rightMargin: mm
// onClicked: {
// groupsModel.append({"group": {"new":true}});
// }
// }
GridView {
id: groupsView
x:mm
y:updateGroupsButton.height+2*mm
width:groupsGridTab.width-2*mm
height:groupsGridTab.height-updateGroupsButton.height-2*mm
clip: true
cellHeight: 16*mm
cellWidth: 17*mm
add: Transition {
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
}
model: groupsModel
delegate: GroupComponent {}
//footer:groupFooter
}
ListModel{
id: groupsModel
}
// Component{
// id: groupFooter
// Image{
// id: footerImage
// width: 15*mm
// height: 15*mm
// fillMode: Image.PreserveAspectFit
// source:"qrc:/images/addImage.png"
// MouseArea{
// anchors.fill: parent
// onClicked:{
// print("new group")
// var component = Qt.createComponent("qrc:/qml/contactqml/GroupComponent.qml");
// var imagedialog = component.createObject(groupsView,{"group": []});}
// }
// }
// }
Component.onCompleted: {
friendsTabView.groupsSignal.connect(showGroups);
}
Loader{
id: groupsListLoader
source:(friendsTabView.currentIndex==3)? "qrc:/qml/contactqml/GroupsListTab.qml":""
}
}
}
Component.onCompleted: {
//root.contactdetailsSignal.connect(showContactdetails);
}

View file

@ -37,6 +37,8 @@ import "qrc:/qml/genericqml"
Item {
id: groupComponent
height: 5*root.fontFactor*osSettings.bigFontSize//8*mm
width: groupComponent.ListView.view.width
property var groupmembers:[]
//property bool newGroup: false
function groupModelAppend(groupcontacts,callback){
@ -47,67 +49,62 @@ Item {
Rectangle {
id: wrapper
width: 16*mm
height: 15*mm
x:0.5*mm
y:0.5*mm
width:parent.width-mm
height: parent.height-mm
radius: 0.5*mm
border.color: "grey"
color:"white"
Image {
id: photoImage
x:1
y:1
width: 10*mm
height:10*mm
source:"qrc:/images/defaultcontact.jpg"
}
// Image {
// id: photoImage
// x:1
// y:1
// width: 10*mm
// height:10*mm
// source:"qrc:/images/defaultcontact.jpg"
// }
Rectangle{
id:namelabelRect
x: 1
y: 1
width: wrapper.width-2
height: 3.5*mm
anchors.top: photoImage.bottom
border.color: "light grey"
height: 3*root.fontFactor*osSettings.bigFontSize
//border.color: "light grey"
TextInput {
id: namelabel
anchors.fill: parent
readOnly: true
text: group.new?"":group.groupname
color: "#303030"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
}
}
MButton{
id: closeButton
visible: false
width: 8*mm
height: 6*mm
anchors.left: infobutton.right
anchors.right: parent.right
anchors.margins: mm
anchors.top: parent.top
text: "\uf057"
font.pixelSize: 3*mm
onClicked:{groupComponent.state="";
if (group.new){groupsModel.remove(index)}
}
font.pointSize: osSettings.bigFontSize
onClicked:{groupComponent.state="";
if (group.new){groupsModel.remove(index)}
}
}
MButton{
id:infobutton
width: 4*mm
height: 6*mm
//color:"transparent"
text:"?"
font.pixelSize: 3*mm
anchors.left: photoImage.right
anchors.leftMargin: mm
font.pointSize: osSettings.bigFontSize
anchors.right: parent.right
anchors.rightMargin: mm
anchors.topMargin: mm
anchors.top: parent.top
onClicked:{
groupComponent.state="large";
//if(group.new){
Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){
try {groupModel.clear()}catch (e){print(e)}
@ -124,15 +121,31 @@ Item {
} //catch(e){}
},"groupname",group.groupname);
//}
groupComponent.state="large"
}
}
Rectangle{
id: detailsrectangle
anchors.top: namelabelRect.bottom
anchors.topMargin: mm
opacity: 0
//anchors.topMargin: mm
x:mm
width: parent.width-2*mm
height:parent.height -(3*root.fontFactor*osSettings.bigFontSize+mm)
visible: false
ListView{
id: groupListView
anchors.fill: parent
anchors.margins: mm
clip: true
spacing: 2
model: groupModel
delegate: ContactComponent { }// groupMember
function processContactSelection(contactobject){showContactdetails(contactobject)}
}
ListModel{id: groupModel}
// Component {
// id:groupMember
@ -182,27 +195,13 @@ Item {
// }
// }
ListView{
id: groupListView
x:1
//anchors.top: parent.top
width: root.width-10*mm
height:groupsView.height - 24*mm
clip: true
spacing: 2
model: groupModel
delegate: ContactComponent { }// groupMember
function processContactSelection(contactobject){showContactdetails(contactobject)}
}
ListModel{id: groupModel}
Row{
anchors.top: groupListView.bottom
anchors.topMargin: mm
spacing: mm
}
// Row{
// anchors.top: groupListView.bottom
// anchors.topMargin: mm
// spacing: mm
// }
// BlueButton{
// id: addMembers
@ -258,14 +257,15 @@ Item {
states: [
State {
name: "large"
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:groupsView.width; readOnly:false}
PropertyChanges { target: namelabelRect; height: 4.5*mm}
PropertyChanges { target: groupComponent; height: groupsView.height - 6*root.fontFactor*osSettings.bigFontSize }
PropertyChanges { target: namelabel; font.pointSize: 1.2*osSettings.bigFontSize; readOnly:false}
//PropertyChanges { target: namelabelRect; height: 2*osSettings.bigFontSize}
PropertyChanges { target: closeButton; visible: true}
PropertyChanges { target: groupComponent; z: 2 }
PropertyChanges { target: wrapper; width:groupsView.width;height:groupsView.height -2*mm-1}
PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false}
PropertyChanges { target: detailsrectangle; opacity:1 }
//PropertyChanges { target: groupComponent; z: 2 }
//PropertyChanges { target: wrapper; width:groupsView.width-2*mm;height:groupsView.height -2*mm-1}
//PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
//PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false}
PropertyChanges { target: detailsrectangle; visible:true }
PropertyChanges { target: infobutton; visible: false}
}
]

View file

@ -0,0 +1,141 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 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.11
import QtQuick.Controls 2.12
//import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Item{
id: groupsGridTab
function showGroups(username){
try {groupsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "groups",root.login.username,function(groupsobject){
for (var j=0;j<groupsobject.length;j++){
groupsModel.append({"group":groupsobject[j]});
}})}
function updateGroup(login,database,group){
// update groups
//var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
//var groupdata={"gid":group.id,"name":group.name,"user":group.user};
//print("Groupdata "+JSON.stringify(group));
var api="";
if (group.new){api="/api/friendica/group_create.json?name="+group.name}else{api="/api/friendica/group_update.json?gid="+group.id}
xhr.url= login.server + api;
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("gid",group.id);
xhr.setParam("name",group.name);
xhr.setParam("user", group.user);
xhr.setParam("json",group);
xhr.post();
}
Connections{
target:xhr
function onError(data,url,api,code){print(data)}//if (data=="image"){Helperjs.showMessage()}}
function onSuccess(data,api){
if(api.startsWith("/api/friendica/group")){
Newsjs.requestGroups(root.login,root.db,root,function(){
showGroups(root.login.username)});
}
}
}
MButton {
id: updateGroupsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
anchors.rightMargin: mm
onClicked: {
Newsjs.requestGroups(root.login,root.db,root,function(){
groupsGridTab.showGroups(root.login.username)})}
}
// BlueButton {
// id: newGroupButton
// text: "\uf234"
// anchors.top: parent.top
// anchors.topMargin: mm
// anchors.right: updateGroupsButton.left
// anchors.rightMargin: mm
// onClicked: {
// groupsModel.append({"group": {"new":true}});
// }
// }
ListView {
id: groupsView
x:mm
y:updateGroupsButton.height+4*mm
width:groupsGridTab.width-2*mm
height:groupsGridTab.height-updateGroupsButton.height-2*mm
clip: true
// cellHeight: 16*mm
// cellWidth: 17*mm
// add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: groupsModel
delegate: GroupComponent {}
//footer:groupFooter
}
ListModel{
id: groupsModel
}
// Component{
// id: groupFooter
// Image{
// id: footerImage
// width: 15*mm
// height: 15*mm
// fillMode: Image.PreserveAspectFit
// source:"qrc:/images/addImage.png"
// MouseArea{
// anchors.fill: parent
// onClicked:{
// print("new group")
// var component = Qt.createComponent("qrc:/qml/contactqml/GroupComponent.qml");
// var imagedialog = component.createObject(groupsView,{"group": []});}
// }
// }
// }
Component.onCompleted: {
friendsTabView.groupsSignal.connect(showGroups);
showGroups()
}
}

View file

@ -105,16 +105,15 @@ Rectangle {
MButton {
id: update
height: 6*mm
width: 8*mm
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
text: "\uf021"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
onClicked: {
Service.requestProfile(root.login,root.db,root,function(nc){
root.newContacts=nc;
root.onNewContactsChanged(nc);
photoImage.source="";
showProfile(function(newprofile){
profile=newprofile;
@ -149,7 +148,7 @@ Rectangle {
imagePicking=true;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+
'}}',profileGridTab,"imagePicker");
'}}',profileTab,"imagePicker");
imagePicker.pickImage()
}
}
@ -172,16 +171,15 @@ Rectangle {
anchors.top: photoImage.top
anchors.right:photoImage.right
color: "white"
font.pixelSize: 4*mm
font.pointSize: 1.2*osSettings.bigFontSize
}
MButton{
id:updatebutton
height: 6*mm
width: 12*mm
width: 8*root.fontFactor*osSettings.bigFontSize
visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source
text:qsTr("Update")
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
anchors.left: photoImage.right
anchors.leftMargin: 0.5*mm
anchors.topMargin: mm
@ -199,7 +197,7 @@ Rectangle {
anchors.left: photoImage.left
wrapMode: Text.Wrap
color: "#303030"
font.pixelSize: 4*mm
font.pointSize: osSettings.bigFontSize
anchors.top: photoImage.bottom
}
@ -212,7 +210,7 @@ Rectangle {
height: 5*mm+profiletextfield.height
Text{
y:mm
font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
text:"<b>"+qsTr("profile id")+": </b> "+profileid+"<br>"
color:"black"
}
@ -222,7 +220,7 @@ Rectangle {
y:4.5*mm
width:parent.width-2.5*mm
wrapMode: Text.Wrap
font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
text:profiletext
color:"black"
}
@ -234,7 +232,7 @@ Rectangle {
id:namelabeltext
width: namelabelflickable.width
height: implicitHeight
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
textFormat:Text.RichText
wrapMode: Text.Wrap
text:"<b>"+qsTr("Description")+": </b> "+(Qt.atob(profile.friendica_owner.description))+"<br> <b>"+qsTr("Location")+":</b> "+profile.friendica_owner.location+"<br> <b>"+qsTr("Posts")+":</b> "+profile.friendica_owner.statuses_count+

View file

@ -0,0 +1,65 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 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.11
import QtQuick.Controls 2.12
//import QtQuick.Controls.Styles 1.4
//import QtQuick.Layouts 1.11
//import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Item{
id:profileTab
function showProfile(callback){
var profile=({});
Helperjs.readData(db,"profiles",login.username,function(profileobject){
var profilearray=[];
for (var i in profileobject){
profilearray.push(JSON.parse(Qt.atob(profileobject[i].profiledata)));
}
profile.profiles=profilearray;
});
Helperjs.readData(db,"contacts",login.username,function(owner){
profile.friendica_owner=owner[0];
},"isFriend",2);
callback(profile)
}
Component.onCompleted:{
showProfile(function(profile){
var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml");
var profilecomp = component.createObject(profileTab,{"profile": profile});
});
}
}