This commit is contained in:
LubuWest 2019-06-25 20:59:10 +02:00
commit d48847d183
135 changed files with 8879 additions and 3693 deletions

View file

@ -32,37 +32,27 @@
import QtQuick 2.5
import QtQuick.LocalStorage 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
//import QtQuick.Controls 2.3
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
import "qrc:/qml/newsqml"
import "qrc:/qml/contactqml"
import "qrc:/qml/photoqml"
import "qrc:/qml/calendarqml"
import "qrc:/qml/configqml"
TabView{
StackView{
id:root
property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsAndroid.qml");return tmp.createObject(root)}
//IntentReceiver{}
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 globaloptions: ({}) //Service.readGlobaloptions(db)
property var contactlist: []
property real mm: Screen.pixelDensity
property real mm: osSettings.osType=="Android"?Screen.pixelDensity:Screen.pixelDensity*1.5
signal messageSignal(var friend)
signal fotoSignal(var username, var friend)
signal directmessageSignal(var friend)
signal newsSignal(var news)
signal newstypeSignal(var type)
signal friendsSignal(var username)
signal contactdetailsSignal(var contact)
signal eventSignal(var contact)
@ -75,8 +65,8 @@ TabView{
property bool imagePicking: false
onLoginChanged:{
if(login==""){root.currentIndex=4}
else{
if(login==""){root.push("qrc:/qml/configqml/AccountPage.qml")}
else{root.push(rootStackItem)
newstab.newstabstatus=login.newsViewType;
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts})}
@ -121,7 +111,7 @@ TabView{
newstab.active=true;
if (newstab.newstabstatus!=login.newsViewType){
newstab.newstabstatus=login.newsViewType;
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,0,function(dbnews){
newsSignal(dbnews)
})}
else{
@ -140,64 +130,273 @@ TabView{
event.accepted = true
}}
style: TabViewStyle {
frameOverlap: 1
tab: Rectangle {
color: styleData.selected?"sky blue":"light blue"
//border.color: "light grey"
implicitWidth: root.width/5
implicitHeight: 5*mm
Text { id: text
anchors.centerIn: parent
text: styleData.title
color: "black"
font.family: fontAwesome.name
font.pixelSize: 3*mm
Drawer{
id: leftDrawer
width: 0.66* root.width
height: root.height
edge: Qt.LeftEdge
position: 1.0
Column{
x:mm
width:parent.width-mm
Label{
text: login.hasOwnProperty("username")?login.username:""
font.pixelSize: 4*mm
width: parent.width
height: 6*mm
}
}
frame: Rectangle { color: "light grey" }
tabsAlignment:Qt.AlignHCenter
}
// Label{
// text:login.hasOwnProperty("server")?"@"+login.server:""
// font.pixelSize: 5*mm
// width: parent.width
// }
Label{
text: "\uf021 " + qsTr("Refresh")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("refresh")
// updatenews.setDatabase();
// updatenews.login();
// updatenews.startsync();
}
}
}
Label{
text: "\uf1da " + qsTr("Timeline")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("timeline")
}
}
}
Label{
text: "\uf086 " + qsTr("Conversations")
width: parent.width
font.pixelSize: 4*mm
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("conversation")
}
}
}
Label{
text: "\uf005 " + qsTr("Favorites")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("favorites")
}
}
}
Label{
text: "\uf0ec " + qsTr("Replies")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("replies")
}
}
}
Label{
text: "\uf0ac " + qsTr("Public Timeline")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("publictimeline")
}
}
}
Label{
text: "\uf0c0 " + qsTr("Group news")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("groupnews")
}
}
}
Label{
text: "\uf002 " + qsTr("Search")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("search")
}
}
}
Label{
text: "\uf085 "+ qsTr("Settings")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked: {root.push("qrc:qml/configqml/ConfigPage.qml");
leftDrawer.close()
}
}
}
Label{
text: "\uf2bb " + qsTr("Accounts")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked: {root.push("qrc:qml/configqml/AccountPage.qml");
leftDrawer.close()
}
}
}
Label{
Tab{
title: "\uf03a"
id: newstab
property string newstabstatus
property var conversation:[]
property var contactposts:[]
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: "\uf073"
id: calendartab
property string calendartabstatus:"Events"
source: (root.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
text: "\uf08b " +qsTr("Quit")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
Service.cleanNews(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
})
}
}
}
}
}
Tab{
title:"\uf085"
id: configtab
source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":""
}
Item{
id:rootStackItem
//anchors.fill:parent
states: State {
name: "fullscreen";
PropertyChanges { target: bar; height:0 }
PropertyChanges { target: rootstack; height:parent.height }
}
transitions: Transition {
PropertyAnimation { properties: "height";
easing.type: Easing.InOutQuad
duration: 1000
}
}
TabBar {
id: bar
width: parent.width
height: 7*mm
position:TabBar.Footer
anchors.top: rootstack.bottom
onCurrentIndexChanged: rootstack.currentIndex=bar.currentIndex
TabButton {
text: "\uf03a"
font.pixelSize: 3*mm
height: 6*mm
}
TabButton {
text: "\uf0c0"
font.pixelSize: 3*mm
height: 6*mm
}
TabButton {
text: "\uf03e"
font.pixelSize: 3*mm
height: 6*mm
}
TabButton {
text: "\uf073"
font.pixelSize: 3*mm
height: 6*mm
}
}
StackLayout{
id:rootstack
width:parent.width
height: parent.height-7*mm
currentIndex:bar.currentIndex
Loader{
id: newstab
Layout.fillWidth:true
Layout.fillHeight: true
property string newstabstatus
property var conversation:[]
property var contactposts:[]
source:(rootstack.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
}
Loader{
id: friendstab
Layout.fillWidth:true
Layout.fillHeight: true
source: (rootstack.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":""
}
Loader{
id: fotostab
property string phototabstatus:"Images"
Layout.fillWidth:true
Layout.fillHeight: true
source: (rootstack.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
}
Loader{
id: calendartab
property string calendartabstatus:"Events"
Layout.fillWidth:true
Layout.fillHeight: true
source: (rootstack.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
}
}
Component.onCompleted: {
Service.readGlobaloptions(db,function(go){globaloptions=go})
//print(xhr.networktype);
//print(xhr.networktype());
if(osSettings.osType=="Android"){
var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root);
} else if (osSettings.osType=="Linux"){
var component = Qt.createComponent("qrc:/qml/genericqml/LinuxSync.qml");
var LinuxSyncQml = component.createObject(root);
}
}
}
}