Friendiqa v0.3.2
This commit is contained in:
parent
8cd5905b63
commit
99ae53f624
54 changed files with 2771 additions and 437 deletions
|
@ -148,7 +148,7 @@ Rectangle{
|
|||
else{urlTextEdit.text="";
|
||||
urlRectangle.visible=true}}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:urlRectangle
|
||||
height: 7*mm //parent.height
|
||||
|
@ -189,9 +189,10 @@ Rectangle{
|
|||
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn)
|
||||
}
|
||||
else{
|
||||
// root.imagePicking=true;
|
||||
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
|
||||
'attachImage(imageUrl)}}',messageSend,"imagePicker");
|
||||
'attachImage(imageUrl)}}',root,"imagePicker");
|
||||
imagePicker.pickImage()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
// 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 2.9
|
||||
AnimatedImage {id:gif;
|
||||
width:newscolumn.width;
|
||||
property string mimetype:""
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
// 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 2.3
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls 2.3 as QC2
|
||||
//import QtQuick.Controls.Styles 2.3
|
||||
import QtQuick.Dialogs 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
|
@ -50,7 +51,7 @@ Item {
|
|||
Connections{
|
||||
target:xhr
|
||||
onError:{
|
||||
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
|
||||
Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
|
||||
}
|
||||
onSuccess:{
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
|
@ -85,9 +86,9 @@ Item {
|
|||
var currentTime= new Date();
|
||||
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
|
||||
//print("appendnews "+newsStack.appendNews +JSON.stringify(newsToShow))
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'appendnews':newsStack.appendNews};
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews};
|
||||
newsWorker.sendMessage(msg);
|
||||
newsStack.appendNews=false
|
||||
//newsStack.appendNews=false
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,13 +127,14 @@ Item {
|
|||
if (term!=""){
|
||||
newstab.newstabstatus="Search";
|
||||
newsBusy.running=true;
|
||||
newsStack.updateMethodNews="refresh";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/search");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("q",term)
|
||||
xhr.get();}
|
||||
newsSearch.visible=false;
|
||||
//newsSearch.visible=false;
|
||||
newsView.anchors.topMargin=7*mm
|
||||
}
|
||||
|
||||
|
@ -151,21 +153,21 @@ Item {
|
|||
|
||||
function onDirectMessage(friend){
|
||||
newstab.newstabstatus="SendMessage"
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": friend,"directmessage":1,"login":root.login});
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
|
||||
}
|
||||
|
||||
function sendUrls(urls){
|
||||
function sendUrls(urls){print(root.currentIndex==0);
|
||||
if((urls.length==1)&&(newsStack.depth<2)){
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"attachImageURLs":urls})
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"attachImageURLs":urls}})
|
||||
}
|
||||
}
|
||||
|
||||
function sendtext(text){
|
||||
if(text&&(newsStack.depth<2)){
|
||||
if (text.subject=="undefined"){text.subject=""}
|
||||
if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1){
|
||||
if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".gif")>-1){
|
||||
text.plaintext="<a href="+text.plaintext+"><img src="+text.plaintext+"></a>"}
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"bodyMessage":text.subject+"\n"+text.plaintext})
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"bodyMessage":text.subject+"\n"+text.plaintext}})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +175,7 @@ Item {
|
|||
id: newsStack
|
||||
anchors.fill:parent
|
||||
property int conversationIndex: 0
|
||||
property bool appendNews: false
|
||||
property string updateMethodNews: "refresh"
|
||||
property var allchats: ({})
|
||||
initialItem:Rectangle {
|
||||
id:newslistRectangle
|
||||
|
@ -187,10 +189,10 @@ Item {
|
|||
text: qsTr(newstab.newstabstatus)
|
||||
onClicked: {newstabmenu.popup(2*mm,6*mm)}
|
||||
|
||||
Menu{id:newstabmenu
|
||||
QC2.Menu{id:newstabmenu
|
||||
width: 40*mm
|
||||
|
||||
delegate:MenuItem{
|
||||
delegate:QC2.MenuItem{
|
||||
contentItem: Text{
|
||||
font.pixelSize: 3.5*mm
|
||||
text:parent.text
|
||||
|
@ -201,57 +203,66 @@ Item {
|
|||
border.color: "grey"
|
||||
}
|
||||
}
|
||||
Action {
|
||||
QC2.Action {
|
||||
text: qsTr("Timeline")
|
||||
onTriggered: {
|
||||
newstab.newstabstatus="Timeline";
|
||||
newsModel.clear();
|
||||
//newsModel.clear();
|
||||
try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)}}
|
||||
}
|
||||
Action {
|
||||
QC2.Action {
|
||||
text: qsTr("Conversations")
|
||||
onTriggered:{
|
||||
newsModel.clear();
|
||||
//newsModel.clear();
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
|
||||
}
|
||||
}
|
||||
Action {
|
||||
QC2.Action {
|
||||
text: qsTr("Favorites")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Favorites";
|
||||
Service.updateView("Favorites")
|
||||
}
|
||||
}
|
||||
Action {
|
||||
QC2.Action {
|
||||
text: qsTr("Public timeline")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Public Timeline";
|
||||
Service.updateView("Public Timeline")
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
QC2.Action {
|
||||
text: qsTr("Direct Messages")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Direct Messages";
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
}
|
||||
Action {
|
||||
QC2.Action {
|
||||
text: qsTr("Notifications")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Notifications";
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
}
|
||||
Action {
|
||||
QC2.Action {
|
||||
|
||||
text: qsTr("Group news")
|
||||
onTriggered:Service.showGroups();
|
||||
onTriggered:
|
||||
{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
Service.showGroups();
|
||||
}
|
||||
}
|
||||
Action {
|
||||
QC2.Action {
|
||||
text: qsTr("Quit")
|
||||
onTriggered:{
|
||||
Service.cleanNews(root.db,function(){
|
||||
|
@ -273,13 +284,17 @@ Item {
|
|||
id: searchButton
|
||||
text: "\uf002"
|
||||
onClicked: {
|
||||
if (newsSearch.visible==false){
|
||||
//if (newsSearch.visible==false){
|
||||
newsView.anchors.topMargin=18*mm;
|
||||
newsSearch.visible=true}
|
||||
else{
|
||||
newsSearch.visible=false;
|
||||
newsView.anchors.topMargin=7*mm;
|
||||
}
|
||||
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
|
||||
var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm});
|
||||
//searchItem.forceActiveFocus()
|
||||
|
||||
// newsSearch.visible=true}
|
||||
//else{
|
||||
// newsSearch.visible=false;
|
||||
// newsView.anchors.topMargin=7*mm;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,6 +324,9 @@ Item {
|
|||
id: update
|
||||
text: "\uf021"
|
||||
onClicked: {
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
root.contactLoadType="news";
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
|
@ -354,18 +372,19 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id: newsSearch
|
||||
color: "#FFFAFA"
|
||||
y:8*mm
|
||||
width:root.width
|
||||
height: 8*mm
|
||||
visible:false
|
||||
Search{
|
||||
anchors.fill: parent
|
||||
anchors.margins: mm
|
||||
}
|
||||
}
|
||||
// Rectangle{
|
||||
// id: newsSearch
|
||||
// color: "#FFFAFA"
|
||||
// y:8*mm
|
||||
// width:root.width
|
||||
// height: 8*mm
|
||||
// //visible:false
|
||||
// Search{
|
||||
// anchors.fill: parent
|
||||
// anchors.margins: mm
|
||||
// }
|
||||
// }
|
||||
|
||||
ListView {
|
||||
id: newsView
|
||||
anchors.fill: parent
|
||||
|
@ -378,11 +397,12 @@ Item {
|
|||
model: newsModel
|
||||
delegate: Newsitem{}
|
||||
//onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing");
|
||||
onDragEnded:{if(contentY<-5*mm){//print("refreshing");
|
||||
onDragEnded:{if(contentY<-5*mm){
|
||||
root.contactLoadType="news";
|
||||
var onlynew=true;
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}}
|
||||
//Component.onCompleted: currentIndex=count
|
||||
}
|
||||
|
||||
ListModel{id: newsModel}
|
||||
|
@ -436,7 +456,9 @@ Item {
|
|||
if(root.news.length>0){showNews(root.news)}
|
||||
else{ newstab.newstabstatus=login.newsViewType;
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){
|
||||
showNews(dbnews);
|
||||
})}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
97
source-android/qml/newsqml/NewsVideo.qml
Normal file
97
source-android/qml/newsqml/NewsVideo.qml
Normal file
|
@ -0,0 +1,97 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/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 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
Rectangle{
|
||||
color:"black"
|
||||
//border.color: "light grey"
|
||||
width:newscolumn.width;
|
||||
height:video.hasVideo?newscolumn.width/4*3:10*mm
|
||||
property alias source:video.source
|
||||
Text{
|
||||
id:noticeText
|
||||
text:"\uf144";
|
||||
color:"light grey"
|
||||
width:parent.width
|
||||
font.pixelSize: parent.height/2
|
||||
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: false
|
||||
audioRole: MediaPlayer.VideoRole
|
||||
MouseArea {anchors.fill:parent;
|
||||
onClicked:{if(video.playbackState!=MediaPlayer.PlayingState){
|
||||
video.play()} else{video.pause()}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
// anchors.top: video.bottom
|
||||
// visible:video.playbackState!=MediaPlayer.StoppedState && video.seekable
|
||||
// value: video.position/video.duration
|
||||
// onPressed:video.seek(value*video.duration)
|
||||
// }
|
||||
}
|
|
@ -163,7 +163,7 @@ Item {
|
|||
linkColor: "light green"
|
||||
id: itemMessage
|
||||
textFormat: Text.RichText
|
||||
text: newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
|
||||
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
|
||||
width: newsitem.width-8*mm-2
|
||||
height: implicitHeight
|
||||
wrapMode: Text.Wrap
|
||||
|
@ -181,10 +181,17 @@ Item {
|
|||
}}
|
||||
|
||||
if (newsitemobject.attachmentList.length>0){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
||||
|
||||
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
||||
var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
}
|
||||
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
||||
var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
} else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
|
||||
var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue