This commit is contained in:
LubuWest 2019-12-10 21:12:32 +01:00
commit 7119d5bdf4
292 changed files with 790 additions and 16347 deletions

View file

@ -50,6 +50,7 @@ Rectangle {
ListView {
id: conversationView
property string viewtype: "conversation"
x:3*mm
y:8*mm
width: conversationList.width-4*mm

View file

@ -47,6 +47,7 @@ Rectangle{
id:messageSend
visible:(newsSwipeview.stacktype!="Notifications")?true:false
property string parentId: ""
property bool textfocus: false
//property var parentObject:({})
property bool conversation: false
property string reply_to_user:""
@ -55,21 +56,23 @@ Rectangle{
//property int directmessage: 0;
property var contacts: []
property var groups: []
property var contact_allow:login.permissions[0]
property var contact_deny:login.permissions[1]
property var group_allow:login.permissions[2]
property var group_deny:login.permissions[3]
property var contact_allow:login.hasOwnProperty("permissions")?login.permissions[0]:[]
property var contact_deny:login.hasOwnProperty("permissions")?login.permissions[1]:[]
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
onReply_to_userChanged: {
if (reply_to_user!=""){
receiverLabel.visible=true
}
}
// onReply_to_userChanged: {
// if (reply_to_user!=""){
// print("reply "+reply_to_user)
// //receiverLabel.visible=true
// receiverLabel.text=reply_to_user
// }
// }
function directmessagePrepare(friend){
messageSend.state="active";
reply_to_user=friend.screen_name;
receiverLabel.text=qsTr("to:")+ " "+ friend.screen_name;
receiverLabel.text=friend.screen_name;
}
@ -94,9 +97,10 @@ Rectangle{
function attachImage(url){
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
imageAttachment.source=url.toString();
// var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
// url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
// url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
}
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
@ -114,7 +118,12 @@ Rectangle{
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
if (attachImageURL.length>0) {for (var image in attachImageURL){xhr.setImageFileParam("media", attachImageURL[image] )}};
if (attachImageURL.length>0) {
for (var image in attachImageURL){
xhr.setImageFileParam("media", attachImageURL[image]);
xhr.setImageFileParam("angle", rotator.angle.toString());
}
};
xhr.post();
}
@ -137,35 +146,24 @@ Rectangle{
if (newsitemobject!=""){
messageSend.state="conversation"
reply_to_user=newsitemobject.user.screen_name;
receiverLabel.text=qsTr("to:")+ " "+ newsitemobject.user.screen_name;
parentId=newsitemobject.id
} else {
messageSend.state=""
reply_to_user="";
receiverLabel.text=qsTr("to:");
parentId="";
bodyField.text="";
attachImageURLs.pop();
try{imageAttachment.destroy()}catch(e){}
imageAttachment.source=""
}
}
function contactmenu(letter){
Newsjs.listFriends(login,db,function(contacts){
var contactitems="";
contactModel.clear();
for (var i=0;i<contacts.length;i++){
if(Helperjs.getCount(db,login,"contacts","screen_name",contacts[i].screen_name)>1){
contacts[i].screen_name=contacts[i].screen_name+"+"+contacts[i].cid
}
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+
"'; onTriggered:{if (newsSwipeview.stacktype=='DirectMessages'){reply_to_user='"+
contacts[i].screen_name+"'} else {bodyField.insert("+
bodyField.cursorPosition+",' "+contacts[i].screen_name.substring(1)+" ');bodyField.cursorPosition=bodyField.cursorPosition+"+contacts[i].screen_name.length+"}}}"
//}
contactModel.append({"contact":contacts[i]})
}
var menuString="import QtQuick.Controls 2.4; Menu {width:40*mm; font.pixelSize: 3*mm; "+contactitems+"}";
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput");
if (contacts.length>0){contactlistObject.popup()}
contactSelector.visible=true
},letter);
}
// Flickable{
@ -179,18 +177,47 @@ Rectangle{
spacing: 0.5*mm
width: parent.width
height: 10*mm//implicitHeight
Label{
id:receiverLabel
x: 0.5*mm
width: parent.width-mm
font.pixelSize: 3*mm
text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
MouseArea{
anchors.fill: parent
onClicked:{}
// Row{
// x: 0.5*mm
// Label{
// id:toLabel
// width: 7*mm
// height: 6*mm
// topPadding: 1.5* mm
// font.pixelSize: 3*mm
// text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:"):""
// visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
// }
TextArea{
id:receiverLabel
//x: 8*mm
width: messageColumn.width//-8*mm
font.pixelSize: 3*mm
placeholderText:qsTr("to:")
text: ""//newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
//onLengthChanged: contactmenu(text)
//onPreeditTextChanged: contactmenu(text)
// onActiveFocusChanged:{
// if (activeFocus==true){contactmenu("")}
// }
onTextChanged: {
//print (text)
contactmenu(text)}
// MouseArea{
// anchors.fill: parent
// onClicked:{print("receiverlabel")
// if(newsSwipeview.stacktype=="DirectMessages"){
// contactmenu();
// }}
// }
}
}
// }
TextField {
id: titleField
x: 0.5*mm
@ -203,16 +230,16 @@ Rectangle{
}
}
Rectangle{
color: "white"
radius: 0.5*mm
x:mm
width: parent.width-2*mm
height:Math.max(bodyField.contentHeight+4*mm,10*mm)
TextArea {
id: bodyField
property string contactprefix:""
anchors.fill: parent
font.pixelSize: 3*mm
font.family: "Noto Sans"
@ -226,26 +253,103 @@ Rectangle{
if (activeFocus==true){
if (conversation==true){
setParent(conversationModel.get(0).newsitemobject);
messageSend.state="conversation"
} else{
messageSend.state="active"
messageSend.state="conversation";
conversationView.contentY=conversationView.contentY+20*mm
} else if (textfocus==false){
messageSend.state="active";
newsView.positionViewAtBeginning();
}
}
}
onTextChanged:{
if (text!=""){
//print(getText(bodyField.cursorPosition-2,bodyField.cursorPosition) +" preedit: "+ preeditText+cursorPosition);
var regex1 = /@[a-z]/;var regex2 = /![a-z]/;
//print(text.substring(cursorPosition-2,cursorPosition));
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
if (regex1.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)+preeditText) || regex2.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)+preeditText)){
var letter=(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)).match(/[a-z]/);
contactmenu(letter)
}
}}
var plaintext=getText(0,cursorPosition)
//print(plaintext+plaintext.lastIndexOf("@",cursorPosition)+getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition) +" preedit: "+ preeditText+cursorPosition);
var regex1 = /@[a-z]+/;var regex2 = /![a-z]+/;var regex3 = /\s/;
//print(text.substring(cursorPosition-2,cursorPosition));
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
if (regex1.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText)){
var letter=(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)).match(/[a-z]+/);
contactprefix="@";
contactmenu(letter.toString())
} else if( regex2.test(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) ){
var letter=(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)).match(/[a-z]+/);
contactprefix="!";
contactmenu(letter.toString())
}else {contactSelector.visible=false}
}else{contactSelector.visible=false}
}
}
}
ListView{
id:contactSelector
visible: false
z:3
x:8*mm
width: parent.width-9*mm
height: messageSend.height/2
model:contactModel
function processContactSelection(contact){
if(Helperjs.getCount(db,login,"contacts","screen_name",contact.screen_name)>1){
contact.screen_name=contact.screen_name+"+"+contacts.cid
}
if (newsSwipeview.stacktype=='DirectMessages'){
receiverLabel.text=contact.screen_name;
reply_to_user=contact.screen_name
} else {
bodyField.remove(bodyField.getText(0,bodyField.cursorPosition).lastIndexOf(bodyField.contactprefix,bodyField.cursorPosition),bodyField.cursorPosition);
bodyField.insert(bodyField.cursorPosition, bodyField.contactprefix+contact.screen_name+" ");
bodyField.cursorPosition=bodyField.cursorPosition+contact.screen_name.length+1
}
//receiverLabel.text=contact.screen_name;
contactSelector.visible=false
}
delegate: ContactComponent { }
}
ListModel{id:contactModel}
Item{
id:imageAttachment;
property alias source:realimage.source
//property alias angle:rotator.angle
visible: source!=""
width: 45*mm
height: 45*mm;
MouseArea{
anchors.fill: parent
onClicked: {
attachImageURLs.splice(attachImageURLs.indexOf(source),1);
imageAttachment.source=""
}
}
Image{id:realimage
source:"";
x:2*mm;
width: 45*mm;
height: source==""?0:45*mm;
fillMode: Image.PreserveAspectFit;
transform: Rotation {id:rotator; origin.x: 22.5*mm; origin.y: 22.5*mm; angle: 0}
}
Rectangle{
width: 5*mm
height: 5*mm
visible: imageAttachment.source!=""
anchors.bottom: imageAttachment.bottom
anchors.right: imageAttachment.right
color: "black"
opacity: 0.5
Text{anchors.centerIn:parent;text: "\uf01e";color: "white"}
MouseArea{
anchors.fill:parent;
onClicked:{
rotator.angle+=90;
}
}
}
}
// Row{
// spacing: 2
@ -341,13 +445,16 @@ Rectangle{
width: 7*mm
text: "\uf057"
onClicked: {
bodyField.text="";
messageSend.state="";
permissionDialog.visible=false;
receiverLabel.visible=false;
reply_to_user="";
attachImage("");
attachImageURLs.pop();
if (textfocus==true){messageSend.destroy()}
else{
bodyField.text="";
messageSend.state="";
permissionDialog.visible=false;
receiverLabel.visible=false;
reply_to_user="";
attachImage("");
attachImageURLs.pop();
}
}
}
MButton {
@ -382,6 +489,7 @@ Rectangle{
root.directmessageSignal.connect(directmessagePrepare);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
if (textfocus==true){bodyField.forceActiveFocus()}
}
states: [ State {
@ -398,6 +506,9 @@ Rectangle{
PropertyChanges {
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
}
// PropertyChanges {
// target: toLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
// }
},
State {
name: "conversation"
@ -422,6 +533,23 @@ Rectangle{
// PropertyChanges {
// target: messageSend; parentId: conversationModel.get(0).newsitemobject.status_id
// }
} ]
},
State {
name: "reply"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:false
}
PropertyChanges {
target: bodyField; placeholderText:"";focus:true
}
}
]
}
//}

View file

@ -152,7 +152,40 @@ StackView{
newsView.anchors.topMargin=mm
}
Connections{
function getOldNews(){
var currentTime= new Date();
try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 }
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
if(newstab.newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
// else if(newstab.newstabstatus=="Contact"){
// Newsjs.newsfromdb(root.db,root.login, function(news){
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
// newsWorker.sendMessage(msg);
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
else if (newstab.newstabstatus=="Notifications"){}
else{
//newsStack.appendNews=true;
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
xhr.get()
}
}
Connections{
target:xhr
onError:{
Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
@ -375,39 +408,11 @@ StackView{
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{anchors.fill:parent
MouseArea{
anchors.fill:parent
onClicked:{
var currentTime= new Date();
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
if(newstab.newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
// else if(newstab.newstabstatus=="Contact"){
// Newsjs.newsfromdb(root.db,root.login, function(news){
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
// newsWorker.sendMessage(msg);
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
else if (newstab.newstabstatus=="Notifications"){}
else{
//newsStack.appendNews=true;
xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);
xhr.get()
}}
getOldNews();
}
}
}
}
@ -425,6 +430,8 @@ StackView{
id: newsView
property real oldContentY:0
property bool viewdragged: false
property bool viewdraggedpositive: false
property string viewtype: "news"
anchors.fill: parent
anchors.margins: mm
//anchors.topMargin: 6*mm
@ -440,7 +447,10 @@ StackView{
onDragEnded: {
if(verticalOvershoot<-5*mm){
viewdragged=true
}
}
else if (verticalOvershoot>5*mm){
viewdraggedpositive=true
}
else{
if((contentY-oldContentY)>15*mm){
swipeIndicator.visible=false;
@ -460,24 +470,25 @@ StackView{
if (viewdragged){
var onlynew=true;
newsBusy.running=true;
viewdragged=false
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news";
if (newsSwipeview.stacktype=="Home"){
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
if (currentlastnews>lastnewsid){
if(newstab.newstabstatus=="Timeline"){
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)};
}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
lastnewsid=lastid;
showNews(news)});
}
if (newsSwipeview.stacktype=="Home"){
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
if (currentlastnews>lastnewsid){
if(newstab.newstabstatus=="Timeline"){
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)};
}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
lastnewsid=lastid;
showNews(news)});
}
} else {
Service.updateView(newstab.newstabstatus)
}
@ -492,9 +503,16 @@ StackView{
else if (newsSwipeview.stacktype=="Replies"){
Service.updateView("Replies")
}
viewdragged=false
}}
}
}
onViewdraggedpositiveChanged: {
if (viewdraggedpositive){
getOldNews();
viewdraggedpositive=false
}
}
}
ListModel{id: newsModel}
@ -554,7 +572,7 @@ StackView{
// showNews(root.news)
// }
//else{
newstab.newstabstatus=login.newsViewType;
login.hasOwnProperty("newsViewType")?newstab.newstabstatus=login.newsViewType:"Conversations"
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;

View file

@ -59,10 +59,8 @@ Item {
// }
Timer {id:contacttimer; interval: 50; running: false; repeat: false
onTriggered: {//print("Contacttimer "+JSON.stringify(root.news));
onTriggered: {
// downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now()
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
Newsjs.storeNews(login,db,root.news,root)

View file

@ -29,63 +29,39 @@
// 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 QtMultimedia 5.8
//import QtMultimedia 5.8
import QtQuick 2.9
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
//import QtQuick.Controls 2.4
//import QtQuick.Controls.Styles 1.4
Rectangle{
color:"black"
//border.color: "light grey"
width:newscolumn.width;
height:newscolumn.width/4*3//video.hasVideo?newscolumn.width/4*3:10*mm
property alias source:video.source
width:newscolumn.width/2;
height:newscolumn.width/3//video.hasVideo?newscolumn.width/4*3:10*mm
property var attachment:({})
Text{
id:noticeText
text:"\uf144";
color:"light grey"
width:parent.width
font.pixelSize: parent.height/2
x:parent.width/2-parent.height/4
x: (parent.width-contentWidth)/2
y:parent.height/5
visible: video.playbackState!=MediaPlayer.PlayingState
//visible: video.playbackState!=MediaPlayer.PlayingState
}
Video {id:video;
anchors.fill:parent
property string mimetype:""
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString}
fillMode: Image.PreserveAspectFit;
autoLoad: false
audioRole: MediaPlayer.VideoRole
MouseArea {anchors.fill:parent;
onClicked:{if(video.playbackState!=MediaPlayer.PlayingState){
video.play()} else{video.pause()}
MouseArea {anchors.fill:parent;
onClicked:{
if(attachment.mimetype=="video/youtube"){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsYplayer.qml");
var videoQml = component.createObject(root,{"ytcode":attachment.url,"mimetype":attachment.mimetype});
} else {
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideoLarge.qml");
var videoQml = component.createObject(root,{"source": attachment.url,"mimetype": attachment.mimetype});
}
}
}
ProgressBar{
id: videoProgress
width: parent.width
height: 2*mm
anchors.top: video.bottom
z:2
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.position/video.duration
}
ProgressBar{
id: videoBuffer
width: parent.width
height: 2*mm
anchors.top: video.bottom
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.bufferProgress
style:ProgressBarStyle{
progress: Rectangle{
color:"light grey"
}
}
}
// Slider{ id: videoSlider
// width: parent.width
// height: 3*mm

View file

@ -0,0 +1,111 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 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 QtMultimedia 5.8
import QtQuick 2.9
import QtQuick.Controls 2.4
//import QtQuick.Controls.Styles 1.4
Rectangle{
id:newsvideofullscreen
color:"black"
//border.color: "light grey"
width:root.width;
height:root.height
property alias source:video.source
Text{
id:noticeText
text:""
color:"light grey"
width:parent.width/2
wrapMode: Text.Wrap
font.pixelSize: 3*mm
x:parent.width/2-parent.height/4
y:parent.height/5
visible: video.playbackState!=MediaPlayer.PlayingState
}
Video {id:video;
anchors.fill:parent
property string mimetype:""
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString;}
fillMode: Image.PreserveAspectFit;
autoLoad: true
autoPlay: true
audioRole: MediaPlayer.VideoRole
MouseArea {
anchors.fill:parent;
onClicked:{
newsvideofullscreen.destroy();
}
}
}
ProgressBar{
id: videoProgress
width: parent.width
height: 2*mm
anchors.bottom: video.bottom
z:2
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.position/video.duration
MouseArea {
anchors.fill:parent;
onClicked:{
if(video.playbackState!=MediaPlayer.PlayingState){
video.play()} else{video.pause()
}
}
}
}
ProgressBar{
id: videoBuffer
width: parent.width
height: 2*mm
anchors.bottom: video.bottom
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.bufferProgress
// style:ProgressBarStyle{
// progress: Rectangle{
// color:"light grey"
// }
// }
}
// Slider{ id: videoSlider
// width: parent.width
// height: 3*mm
// anchors.top: video.bottom
// visible:video.playbackState!=MediaPlayer.StoppedState && video.seekable
// value: video.position/video.duration
// onPressed:video.seek(value*video.duration)
// }
}

View file

@ -33,19 +33,23 @@
import QtQuick 2.8
import "qrc:/js/helper.js" as Helperjs
//import QtWebView 1.1
import QtWebView 1.1
Rectangle{
color:"transparent"
width:newscolumn.width;
height:newscolumn.width/4*3
property string url:""//htmlview.text
id:newsYplayer
color:"black"
width:root.width;
height:root.height
property string url:""
property string ytcode:""
WebView {
id: webView
anchors.fill: parent
z:1
opacity: 0
url: "qrc:///content/player.html?" + currentVideo.vId
url: root.osSettings.osType=="Android"?"https://youtube.com/watch?v="+ytcode:"qrc:/js/yplayer.html?" + ytcode
Behavior on opacity { NumberAnimation { duration: 200 } }
@ -59,42 +63,13 @@ Rectangle{
case WebView.LoadStoppedStatus:
break
case WebView.LoadFailedStatus:
topInfo.text = "Failed to load the requested video"
print("Failed to load the requested video" + url)
break
}
opacity = 0
}
onTitleChanged: {
currentVideo.status = 1 * title
if (title == videoStatus.paused || title == videoStatus.ready)
panel.state = "list"
else if (title == videoStatus.playing)
panel.state = "hidden"
if (title==2){newsYplayer.destroy()}
}
}
Text{id:htmlview
textFormat:Text.RichText
}
// WebView {id:htmlview;
// anchors.fill: parent
// }
Component.onCompleted:{
// Helperjs.friendicaWebRequest(url,parent,function(document){
// print(document);
//// var metas = document.getElementsByTagName('meta'); //get all the meta tag elements
//// //iterate through them
//// for (i=0; i<metas.length; i++) {
//// if (metas[i].getAttribute("name") == "keywords") {
//// print(metas[i].getAttribute("content"));
//// }
//// else if (metas[i].getAttribute("name") == "description") {
//// console.log(metas[i].getAttribute("content"));
//// }
//// }
// //print(html);
// htmlview.text=""
// })
}
}

View file

@ -147,7 +147,7 @@ Item {
width:parent.width
spacing:mm
clip:true
height: Math.min(implicitHeight,3/4*root.height)
height: newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
MouseArea{
width: newsitem.width-8*mm-2
height: itemMessage.height
@ -188,9 +188,10 @@ Item {
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
var linkQml = component.createObject(messageColumn,{"url":newsitemobject.attachmentList[attachments].url});
}
else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
else {
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
//var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
var videoQml = component.createObject(messageColumn,{"attachment":newsitemobject.attachmentList[attachments]});
}
}
}
@ -201,7 +202,7 @@ Item {
width: newsitem.width-8*mm-2
height:5*mm
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
visible: messageColumn.implicitHeight>3/4*root.height//itemMessage.implicitHeight>3/4*root.height
visible: messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
text:"\uf078"
fontColor:"grey"
border.color: "transparent"
@ -412,7 +413,10 @@ Item {
onTriggered: {
var directmessage=0;
if (newsitemobject.messagetype==1){ directmessage=1}
replySignal(newsitemobject)
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
var conversation;newsitem.ListView.view.viewtype=="conversation"?true:false;
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
//replySignal(newsitemobject)
//newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage});
}
}