v0.5.3 events and indentation

This commit is contained in:
LubuWest 2020-05-24 21:14:23 +02:00
commit 18c7255b91
103 changed files with 1601 additions and 1906 deletions

View file

@ -1,6 +1,6 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
// 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
@ -36,7 +36,7 @@ Item {
id: calendarDay
width:7*mm
height: 7*mm
property int dateInt:Math.floor((Date.parse(model.date)-(new Date().getTimezoneOffset() * 60 * 1000))/86400000)
property int dateInt: Math.floor(Date.parse(model.date)/86400000) //Math.floor((Date.parse(model.date)-(new Date().getTimezoneOffset() * 60 * 1000))/86400000)
Rectangle {
id: placeHolder
color: 'lightblue'; antialiasing: true
@ -54,7 +54,7 @@ Item {
}
Rectangle {
id:eventRect
color:"black"
color:"grey"
anchors.margins: 0.5*mm
anchors.bottom: calendarDay.bottom
width: parent.width-mm
@ -64,15 +64,9 @@ Item {
MouseArea {
anchors.fill: calendarDay
onClicked: {
var eventDate=[];
var idx = eventdays.indexOf(dateInt);
while (idx != -1) {
eventDate.push(idx);
idx = eventdays.indexOf(dateInt,idx + 1)
}
var component = Qt.createComponent("qrc:/qml/calendarqml/EventList.qml");
if (component.status== Component.Ready){
var eventlist = component.createObject(calendartab,{"daylist": eventDate})}
var eventlist = component.createObject(calendartab,{"dayint": dateInt})}
}
}
}

View file

@ -1,6 +1,6 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
// 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
@ -30,7 +30,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.4
import QtQuick.Controls 2.12
import QtQml 2.2
import Qt.labs.calendar 1.0
//import QtQuick.Controls 1.2 as Oldcontrol
@ -51,7 +51,7 @@ Rectangle {
property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000
property var events:[]
property var eventdays:[]
//onEventdaysChanged: print(JSON.stringify(eventdays))
function showEvents(friend){
if(friend=="backButton"){Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
@ -94,9 +94,24 @@ Rectangle {
width: 8*mm
text:"\uf021"
onClicked: {
Service.getEvents(db,login, calendartab,function(){
showEvents("")
})}}
calBusy.running=true;
updatenews.setDatabase();
updatenews.login();
updatenews.events();
// Service.getEvents(db,login, calendartab,function(){
// showEvents("")
// })
}}
Connections{
target: updatenews
onSuccess:{
calBusy.running=false;
showEvents("")
}
}
MButton{
id: calendartabstatusButton

View file

@ -1,6 +1,6 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
// 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
@ -30,7 +30,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.4
import QtQuick.Controls 2.12
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -44,7 +44,7 @@ Rectangle{
x:mm
y:mm
property var daylist:[]
property int dayint: 0
MButton{
id:closeButton
anchors.top: parent.top
@ -71,10 +71,12 @@ Rectangle{
id: eventModel
}
Component.onCompleted:{
for (var i=0; i<daylist.length;i++){
var liststate="";if(daylist.length<2){liststate="large"}
eventModel.append({"event":events[daylist[i]],"eventstatus":liststate});
Component.onCompleted:{//print("daylist"+JSON.stringify(daylist) + dayint)
var currentevents=events.filter(event=>(dayint>=event.startday)&&(dayint<=event.endday));
for (var i=0; i<currentevents.length;i++){
var liststate="";if(currentevents.length<2){liststate="large"};
//print(JSON.stringify(events[daylist[i]]));
eventModel.append({"event":currentevents[i],"eventstatus":liststate});
}
}
@ -86,26 +88,39 @@ Rectangle{
height:eventNameText.height+eventDetailsText.height+mm
border.color: "light grey"
border.width: 1
Text {
Image {
id:profileImage
source: ((event.eventOwner.profile_image!="") && (typeof(event.eventOwner.profile_image)=="string"))? "file://"+event.eventOwner.profile_image : event.eventOwner.profile_image_url
x:1
y:1
width: 7*mm
height: 7*mm
//radius:mm
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text {
id:eventNameText
x:mm
width:parent.width
x: 8*mm
width:parent.width-8*mm
height:contentHeight
text: new Date(event.start+calendarrectangle.offsetTime).toLocaleTimeString()+": "+event.title
text: new Date(event.start).toLocaleString(Qt.locale(),Locale.NarrowFormat)+ " - " +(event.end>0?new Date(event.end).toLocaleString(Qt.locale(),Locale.NarrowFormat):" ")+": "+event.title //+calendarrectangle.offsetTime
font.pixelSize: 3*mm
wrapMode:Text.Wrap
}
Text {
id:eventDetailsText
x:mm
x:8*mm
z:4
width: parent.width
width: parent.width-8*mm
height: contentHeight
text: status==""?"":Qt.atob(event.html)
textFormat: Text.RichText
text: status==""?"":Qt.atob(event.desc) + (event.location==""?"":"<br><br>"+qsTr("Location")+": "+event.location)//Qt.atob(event.html)
anchors.top: eventNameText.bottom
font.pixelSize: 3*mm
wrapMode:Text.Wrap
onLinkActivated:{Qt.openUrlExternally(link)}
}
MouseArea{
anchors.fill: parent