Version 0.003
This commit is contained in:
parent
9f9a9f618c
commit
10dccdcdbb
572 changed files with 3711 additions and 13631 deletions
153
source-linux/qml/friendiqa.qml
Normal file
153
source-linux/qml/friendiqa.qml
Normal file
|
@ -0,0 +1,153 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.LocalStorage 2.0
|
||||
import QtQuick.Window 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
|
||||
TabView{
|
||||
id:root
|
||||
property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsLinux.qml");return tmp.createObject(root)}
|
||||
tabPosition: Qt.BottomEdge
|
||||
width: osSettings.appWidth
|
||||
height:osSettings.appHeight
|
||||
focus:true
|
||||
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
|
||||
property var login: Service.readActiveConfig(db)
|
||||
property var contactlist: []
|
||||
property real mm: Screen.pixelDensity
|
||||
signal messageSignal(var friend)
|
||||
signal fotoSignal(var friend)
|
||||
signal directmessageSignal(var friend)
|
||||
signal newsSignal(var news)
|
||||
signal friendsSignal(var username)
|
||||
signal contactdetailsSignal(var contact)
|
||||
//currentIndex: (login=="")? 3:0
|
||||
|
||||
property var news:[]
|
||||
property var newContacts:[]
|
||||
property int currentContact: 0
|
||||
property string contactLoadType: ""
|
||||
|
||||
onLoginChanged:{
|
||||
if(login==""){root.currentIndex=3}
|
||||
else{
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
Newsjs.getCurrentContacts(login,db,function(contacts){
|
||||
contactlist=contacts})}
|
||||
}
|
||||
onNewContactsChanged:{
|
||||
if(newContacts.length>0){// download first contact image and update db
|
||||
Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])}
|
||||
else if (contactLoadType!=""){
|
||||
Service.processNews(function(){
|
||||
root.contactLoadType="";
|
||||
root.news=[];
|
||||
})}
|
||||
}
|
||||
|
||||
onCurrentContactChanged:{// download next contact image after photoplaceholder is finished saving and update db
|
||||
if(currentContact<newContacts.length){
|
||||
Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])}
|
||||
else if (contactLoadType!=""){
|
||||
Service.processNews(function(){
|
||||
root.contactLoadType="";
|
||||
root.news=[];
|
||||
root.newContacts=[];
|
||||
root.currentContact=0;
|
||||
})}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onDownloaded:{if(data=="contact"){contacttimer.stop();root.currentContact=root.currentContact+1}}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{print("Error"+data);
|
||||
if (data=="contact"){
|
||||
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
|
||||
var result;
|
||||
database.transaction( function(tx) {
|
||||
//print('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
|
||||
result = tx.executeSql('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
|
||||
root.currentContact=root.currentContact+1;contacttimer.stop()})}
|
||||
}}
|
||||
|
||||
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
|
||||
|
||||
Timer {id:contacttimer; interval: 5000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
|
||||
database.transaction( function(tx) {
|
||||
var result = tx.executeSql('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
|
||||
root.currentContact=root.currentContact+1})}
|
||||
}
|
||||
|
||||
Keys.onReleased: {
|
||||
if (event.key === osSettings.backKey) {
|
||||
if (currentIndex==0){
|
||||
newstab.active=true;
|
||||
if (newstab.newstabstatus!=login.newsViewType){
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){
|
||||
newsSignal(dbnews)
|
||||
})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){
|
||||
newsSignal(dbnews)
|
||||
})}
|
||||
}
|
||||
else{Service.cleanNews(root.db,function(){Qt.quit()})}
|
||||
}
|
||||
else if (currentIndex==2){fotoSignal("backButton")}
|
||||
else {currentIndex=0}
|
||||
event.accepted = true
|
||||
}}
|
||||
|
||||
|
||||
style: TabViewStyle {
|
||||
frameOverlap: 1
|
||||
tab: Rectangle {
|
||||
color: styleData.selected?"sky blue":"light blue"
|
||||
border.color: "light grey"
|
||||
implicitWidth: root.width/4-2*mm
|
||||
implicitHeight: 4*mm
|
||||
Text { id: text
|
||||
anchors.centerIn: parent
|
||||
text: styleData.title
|
||||
color: "black"
|
||||
font.family: fontAwesome.name
|
||||
font.pixelSize: 3*mm
|
||||
}
|
||||
}
|
||||
frame: Rectangle { color: "light grey" }
|
||||
tabsAlignment:Qt.AlignHCenter
|
||||
}
|
||||
|
||||
Tab{
|
||||
title: "\uf03a"
|
||||
id: newstab
|
||||
property string newstabstatus
|
||||
property var conversation
|
||||
source:(root.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
|
||||
}
|
||||
Tab{
|
||||
title: "\uf0c0"
|
||||
id: friendstab
|
||||
source: (root.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":""
|
||||
}
|
||||
Tab{
|
||||
title: "\uf03e"
|
||||
id: fotostab
|
||||
property string phototabstatus:"Images"
|
||||
source: (root.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
|
||||
}
|
||||
Tab{
|
||||
title:"\uf085"
|
||||
id: configtab
|
||||
source: (root.currentIndex==3)?"qrc:/qml/configqml/ConfigTab.qml":""
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue