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

@ -29,9 +29,10 @@
// 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 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick 2.11
import QtQuick.Controls 2.4
//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
@ -69,14 +70,37 @@ Rectangle {
callback(profile)
}
TabView{
TabBar {
id: friendsbar
width: parent.width
height: 9*mm
position:TabBar.Header
currentIndex: 1
TabButton {
text: qsTr("Me")
font.pixelSize: 2*mm
}
TabButton {
text: qsTr("Friends")
font.pixelSize: 2*mm
}
TabButton {
text: qsTr("Contacts")
font.pixelSize: 2*mm
}
TabButton {
text: qsTr("Groups")
font.pixelSize: 2*mm
}
}
StackLayout{
id:friendsTabView
tabPosition: Qt.TopEdge
//anchors.fill: parent
x:mm
y:mm
width: root.width-2*mm
height: root.height-10*mm
currentIndex: 1
y:10*mm
width: parent.width-2*mm
height: parent.height-10*mm
currentIndex: friendsbar.currentIndex
signal contactsSignal(var contact)
signal groupsSignal(var username)
onCurrentIndexChanged:{
@ -88,27 +112,28 @@ Rectangle {
}
else if (currentIndex==3){groupsSignal(root.login.username)}
}
style: TabViewStyle {
frameOverlap: 1
tab: Rectangle {
color: "white"
implicitWidth: root.width/4-2*mm
implicitHeight: 4*mm
Text { id: text
anchors.centerIn: parent
text: styleData.title
color: "dark grey"
font.pixelSize:2.5*mm
font.bold: styleData.selected
}
}
frame: Rectangle { color: "light grey" }
tabsAlignment:Qt.AlignHCenter
}
// style: TabViewStyle {
// frameOverlap: 1
// tab: Rectangle {
// color: "white"
// implicitWidth: root.width/4-2*mm
// implicitHeight: 4*mm
// Text { id: text
// anchors.centerIn: parent
// text: styleData.title
// color: "dark grey"
// font.pixelSize:2.5*mm
// font.bold: styleData.selected
// }
// }
// frame: Rectangle { color: "light grey" }
// tabsAlignment:Qt.AlignHCenter
// }
Tab{
Item{
id:profileGridTab
title: qsTr("Me")
Layout.fillWidth:true
Layout.fillHeight: true
Component.onCompleted:{
showProfile(function(profile){
var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml");
@ -117,11 +142,11 @@ Rectangle {
}
}
Tab{
title: qsTr("Friends")
Rectangle{
Item{
id: friendsGridTab
property int currentContact:0
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){
@ -140,17 +165,21 @@ Rectangle {
onDownloaded:{
if(type=="contactlist"){
//print(url+" "+filename+" "+i)
currentContact=i+1;
if(currentContact==root.newContacts.length){showFriends(root.login.username)}
friendsGridTab.currentContact=i+1;
if(friendsGridTab.currentContact==root.newContacts.length){
friendsGridTab.showFriends(root.login.username)
}
}
}
}
BlueButton {
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";
@ -167,8 +196,8 @@ Rectangle {
anchors.top: parent.top
anchors.right:updateFriendsButton.left
anchors.rightMargin:mm
visible: (currentContact!=(root.newContacts.length))?true:false
value: currentContact/root.newContacts.length
visible: (friendsGridTab.currentContact!=(root.newContacts.length))?true:false
value: friendsGridTab.currentContact/root.newContacts.length
}
//GridView {
@ -196,13 +225,11 @@ Rectangle {
root.newContacts=[]
}
}
}
Tab{
title: qsTr("Contacts")
Rectangle{
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){
@ -213,12 +240,14 @@ Rectangle {
}
},"isFriend",0,"screen_name ASC");
}
BlueButton {
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)};
@ -252,11 +281,13 @@ Rectangle {
friendsTabView.contactsSignal.connect(showContacts);
}
}
}
Tab{
title: qsTr("Groups")
Rectangle{
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){
@ -289,16 +320,18 @@ Rectangle {
showGroups(root.login.username)});
}
}
BlueButton {
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(){
showGroups(root.login.username)})}
groupsGridTab.showGroups(root.login.username)})}
}
// BlueButton {
// id: newGroupButton
@ -351,9 +384,9 @@ Rectangle {
friendsTabView.groupsSignal.connect(showGroups);
}
}
}
}
}
Component.onCompleted: {
root.contactdetailsSignal.connect(showContactdetails);
//root.contactdetailsSignal.connect(showContactdetails);
}
}