new version with hashtags
This commit is contained in:
parent
d81ad52031
commit
56bdb80ea0
47 changed files with 1424 additions and 825 deletions
|
@ -175,7 +175,7 @@ Rectangle {
|
|||
}//Component end
|
||||
Connections{
|
||||
target:newstab
|
||||
onContactpostsChanged:{
|
||||
function onContactpostsChanged(){
|
||||
if (newstab.contactposts.length>0){profileimagesource=newstab.contactposts[0].user.profile_image_url_large}
|
||||
contactBusy.running=false;
|
||||
contactModel.clear();
|
||||
|
|
|
@ -38,15 +38,9 @@ import "qrc:/qml/newsqml"
|
|||
|
||||
Rectangle {
|
||||
id:conversationList
|
||||
// width:root.width-5*mm
|
||||
// height:root.height-12*mm
|
||||
property var news:[]
|
||||
// y:1
|
||||
// z:2
|
||||
color: "white"
|
||||
// border.color: "grey"
|
||||
// width:root.width-5*mm
|
||||
// height: conversationView.height+10*mm
|
||||
|
||||
|
||||
ListView {
|
||||
id: conversationView
|
||||
|
@ -54,11 +48,10 @@ Rectangle {
|
|||
x:3*mm
|
||||
y:8*mm
|
||||
width: conversationList.width-4*mm
|
||||
//height: contentHeight
|
||||
height:conversationList.height-10*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
footer: MessageSend{conversation:true}//footerReply
|
||||
footer: MessageSend{conversation:true}
|
||||
model: conversationModel
|
||||
delegate: Newsitem{}
|
||||
}
|
||||
|
@ -75,89 +68,17 @@ Rectangle {
|
|||
Connections{
|
||||
target:newstab
|
||||
onConversationChanged:{
|
||||
//if(newsitem.itemindex==newsStack.conversationIndex){
|
||||
if(newstab.conversation.length==0){
|
||||
newsStack.pop()
|
||||
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
|
||||
//conversationList.destroy(); conversationsymbol.color="grey"
|
||||
} else { conversationBusy.running=false;
|
||||
conversationModel.clear();
|
||||
var currentTime= new Date();
|
||||
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation, 'method':'conversation', 'options':globaloptions};
|
||||
conversationWorker.sendMessage(msg)
|
||||
//conversationsymbol.color="grey"
|
||||
}
|
||||
//}
|
||||
if(newstab.conversation.length==0){
|
||||
newsStack.pop()
|
||||
} else { conversationBusy.running=false;
|
||||
conversationModel.clear();
|
||||
var currentTime= new Date();
|
||||
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation, 'method':'conversation', 'options':globaloptions};
|
||||
conversationWorker.sendMessage(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Component { id:footerReply
|
||||
// Rectangle{
|
||||
// border.color: "#EEEEEE"
|
||||
// border.width: 1
|
||||
// color:"lightgrey"
|
||||
// width:conversationView.width
|
||||
// height:Math.max(replyText.contentHeight+2*mm,6*mm)
|
||||
// Rectangle{
|
||||
// color: "white"
|
||||
// radius:0.5*mm
|
||||
// anchors.left: parent.left
|
||||
// anchors.leftMargin:mm
|
||||
// anchors.top:parent.top
|
||||
// anchors.topMargin: 0.5*mm
|
||||
// width:parent.width-12*mm
|
||||
// height:Math.max( replyText.contentHeight,5*mm)
|
||||
|
||||
// TextInput {
|
||||
// id: replyText
|
||||
// font.pixelSize: 3*mm
|
||||
// wrapMode: Text.Wrap
|
||||
// anchors.fill: parent
|
||||
// selectByMouse: true
|
||||
// onHeightChanged: conversationView.contentY+=4.5*mm
|
||||
// }
|
||||
// }
|
||||
|
||||
// Button {
|
||||
// id: sendButton
|
||||
// height: 8*mm
|
||||
// width:8*mm
|
||||
// text: "\uf1d9"
|
||||
// anchors.right: parent.right
|
||||
// anchors.rightMargin:mm
|
||||
// anchors.top:parent.top
|
||||
// anchors.topMargin: 0.5*mm
|
||||
// //color:"white"
|
||||
// onClicked: { try{
|
||||
// var body=replyText.getText(0,replyText.length);
|
||||
// newsBusy.running=true;
|
||||
// replyText.text=""
|
||||
// xhr.clearParams();
|
||||
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
// if (conversationModel.get(0).newsitemobject.messagetype==0){
|
||||
|
||||
// //xhr.url= login.server + "/api/statuses/update.json";
|
||||
// xhr.setUrl(login.server);
|
||||
// xhr.setApi("/api/statuses/update");
|
||||
// xhr.setParam("source", "Friendiqa");
|
||||
// xhr.setParam("status", body);
|
||||
// xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.id)}
|
||||
// else {//xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
// xhr.setUrl(login.server);
|
||||
// xhr.setApi("/api/direct_messages/new");
|
||||
// xhr.setParam("text", body);
|
||||
// xhr.setParam("screen_name",conversationModel.get(conversationModel.count-1).newsitemobject.screen_name);
|
||||
// xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.id)
|
||||
// }
|
||||
// xhr.post();
|
||||
// } catch(e){Helperjs.showMessage("Error",e.toString(),root)}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
ListModel{id: conversationModel}
|
||||
|
||||
WorkerScript {
|
||||
|
@ -176,11 +97,7 @@ Rectangle {
|
|||
text: "\uf057"
|
||||
onClicked: {
|
||||
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
|
||||
|
||||
newstab.conversation=[];
|
||||
//newsStack.pop()
|
||||
//conversationList.destroy();
|
||||
//conversationsymbol.color="grey"
|
||||
newstab.conversation=[];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,13 +61,6 @@ Rectangle{
|
|||
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!=""){
|
||||
// print("reply "+reply_to_user)
|
||||
// //receiverLabel.visible=true
|
||||
// receiverLabel.text=reply_to_user
|
||||
// }
|
||||
// }
|
||||
|
||||
function directmessagePrepare(friend){
|
||||
messageSend.state="active";
|
||||
|
@ -98,9 +91,6 @@ Rectangle{
|
|||
|
||||
function attachImage(url){
|
||||
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) {
|
||||
|
@ -125,6 +115,7 @@ Rectangle{
|
|||
}
|
||||
};
|
||||
xhr.post();
|
||||
Newsjs.storeHashtags(login,db,status,root)
|
||||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
|
@ -166,6 +157,16 @@ Rectangle{
|
|||
contactSelector.visible=true
|
||||
},letter);
|
||||
}
|
||||
|
||||
function hashtagmenu(){//print("letter "+letter)
|
||||
Newsjs.listHashtags(login,db,function(tags){
|
||||
tagModel.clear();
|
||||
for (var i=0;i<tags.length;i++){
|
||||
tagModel.append({"tag":tags[i]})
|
||||
}
|
||||
tagSelector.visible=true
|
||||
});
|
||||
}
|
||||
// Flickable{
|
||||
// anchors.fill: parent
|
||||
// contentHeight: messageColumn.height
|
||||
|
@ -177,46 +178,16 @@ Rectangle{
|
|||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
height: 10*mm//implicitHeight
|
||||
|
||||
// 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();
|
||||
|
||||
// }}
|
||||
// }
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
TextArea{
|
||||
id:receiverLabel
|
||||
width: messageColumn.width//-8*mm
|
||||
font.pixelSize: 3*mm
|
||||
placeholderText:qsTr("to:")
|
||||
text: ""
|
||||
visible:false
|
||||
onTextChanged: {
|
||||
if (text!=""){contactmenu(text)} else {var receiver=getText(0,cursorPosition);contactmenu(receiver+preeditText)}}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: titleField
|
||||
|
@ -309,6 +280,24 @@ Rectangle{
|
|||
}
|
||||
ListModel{id:contactModel}
|
||||
|
||||
ListView{
|
||||
id: tagSelector
|
||||
visible: false
|
||||
z:3
|
||||
x:8*mm
|
||||
width: parent.width-9*mm
|
||||
height: messageSend.height/2
|
||||
model:tagModel
|
||||
clip: true
|
||||
spacing: 0
|
||||
function processTagSelection(hashtag){
|
||||
bodyField.insert(bodyField.cursorPosition, hashtag+" ");
|
||||
bodyField.cursorPosition=bodyField.cursorPosition+hashtag.length+1
|
||||
tagSelector.visible=false
|
||||
}
|
||||
delegate: MButton {text:tag;onClicked: tagSelector.processTagSelection(tag)}
|
||||
}
|
||||
ListModel{id:tagModel}
|
||||
|
||||
Item{
|
||||
id:imageAttachment;
|
||||
|
@ -351,54 +340,6 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
// Row{
|
||||
// spacing: 2
|
||||
// width: parent.width
|
||||
// CheckBox{
|
||||
// id:dmCheckbox
|
||||
// text:"DM"
|
||||
// enabled: false
|
||||
// checked: (directmessage==1)?true:false
|
||||
// onClicked:{
|
||||
// if(dmCheckbox.checkedState==Qt.Checked){directmessage=1}
|
||||
// else if(dmCheckbox.checkedState==Qt.Unchecked){directmessage=0}
|
||||
// }
|
||||
// }
|
||||
|
||||
// Button{
|
||||
// text:"\uf0c1"
|
||||
// height:8*mm
|
||||
// onClicked: {
|
||||
// if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
|
||||
// else{urlTextEdit.text="";
|
||||
// urlRectangle.visible=true}}
|
||||
// }
|
||||
// }
|
||||
// Rectangle{
|
||||
// id:urlRectangle
|
||||
// height: 7*mm //parent.height
|
||||
// width:parent.width-2*mm
|
||||
// visible:false
|
||||
// TextField{
|
||||
// id:urlTextEdit
|
||||
// width:parent.width-7*mm
|
||||
// height:parent.height
|
||||
// }
|
||||
// Button{
|
||||
// anchors.left:urlTextEdit.right
|
||||
// anchors.leftMargin:mm
|
||||
// height:8*mm
|
||||
// text:"\u2713"
|
||||
// onClicked: {if(urlTextEdit.text!=""){
|
||||
// var start = bodyField.selectionStart;
|
||||
// var text=bodyField.selectedText
|
||||
// if(text.lastIndexOf(".jpg")>-1 || text.lastIndexOf(".jpeg")>-1 || text.lastIndexOf(".png")>-1){text="<img src="+text+">"}
|
||||
// text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
|
||||
// bodyField.remove(start,bodyField.selectionEnd);
|
||||
// bodyField.insert(start,text);}
|
||||
// urlRectangle.visible=false}
|
||||
// }
|
||||
// }
|
||||
Row{
|
||||
id:buttonRow
|
||||
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
|
||||
|
@ -440,6 +381,14 @@ Rectangle{
|
|||
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:hastagButton
|
||||
text: "\uf292"
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: cancelButton
|
||||
height: 6*mm
|
||||
|
@ -483,8 +432,6 @@ Rectangle{
|
|||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||
}
|
||||
Component.onCompleted:{
|
||||
//parentId=conversationModel.get(conversationModel.count-1).newsitemobject.id
|
||||
//if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
|
||||
newsStack.replySignal.connect(setParent);
|
||||
root.directmessageSignal.connect(directmessagePrepare);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
|
@ -492,48 +439,34 @@ Rectangle{
|
|||
if (textfocus==true){bodyField.forceActiveFocus()}
|
||||
}
|
||||
|
||||
states: [ State {
|
||||
name: "active"
|
||||
PropertyChanges {
|
||||
target: messageColumn; height: implicitHeight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")//true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||
}
|
||||
// PropertyChanges {
|
||||
// target: toLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||
// }
|
||||
},
|
||||
State {
|
||||
name: "conversation"
|
||||
PropertyChanges {
|
||||
target: messageColumn; height: implicitHeight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
}
|
||||
|
||||
// PropertyChanges {
|
||||
// target: receiverLabel; visible:true; text:qsTr("to")+": "+ conversationModel.get(0).newsitemobject.user.name
|
||||
// }
|
||||
|
||||
// PropertyChanges {
|
||||
// target: messageSend; reply_to_user: conversationModel.get(0).newsitemobject.user.screen_name
|
||||
// }
|
||||
|
||||
// PropertyChanges {
|
||||
// target: messageSend; parentId: conversationModel.get(0).newsitemobject.status_id
|
||||
// }
|
||||
},
|
||||
states: [
|
||||
State {
|
||||
name: "active"
|
||||
PropertyChanges {
|
||||
target: messageColumn; height: implicitHeight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")//true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "conversation"
|
||||
PropertyChanges {
|
||||
target: messageColumn; height: implicitHeight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
}
|
||||
},
|
||||
|
||||
State {
|
||||
name: "reply"
|
||||
|
@ -552,4 +485,3 @@ Rectangle{
|
|||
}
|
||||
]
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -172,11 +172,6 @@ StackView{
|
|||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", '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;
|
||||
|
@ -186,11 +181,11 @@ StackView{
|
|||
}
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{
|
||||
function onError(data,url,api,code){
|
||||
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
|
||||
newsBusy.running=false;
|
||||
}
|
||||
onSuccess:{
|
||||
function onSuccess(data,api){
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
Service.processNews(api,data)
|
||||
replySignal("")
|
||||
|
@ -198,7 +193,7 @@ StackView{
|
|||
}
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
onTriggered: {"replytimer triggered";
|
||||
newsBusy.running=true;
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||
|
@ -360,6 +355,7 @@ StackView{
|
|||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running: false
|
||||
}
|
||||
Rectangle{
|
||||
id:downloadNotice
|
||||
|
|
|
@ -29,10 +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 QtMultimedia 5.8
|
||||
import QtQuick 2.9
|
||||
//import QtQuick.Controls 2.4
|
||||
//import QtQuick.Controls.Styles 1.4
|
||||
|
||||
Rectangle{
|
||||
color:"black"
|
||||
|
@ -48,28 +45,15 @@ Rectangle{
|
|||
font.pixelSize: parent.height/2
|
||||
x: (parent.width-contentWidth)/2
|
||||
y:parent.height/5
|
||||
//visible: video.playbackState!=MediaPlayer.PlayingState
|
||||
}
|
||||
|
||||
MouseArea {anchors.fill:parent;
|
||||
onClicked:{
|
||||
if(attachment.mimetype=="video/youtube"){
|
||||
root.push("qrc:/qml/newsqml/NewsYplayer.qml",{"ytcode":attachment.url,"mimetype":attachment.mimetype});
|
||||
// var component = Qt.createComponent("qrc:/qml/newsqml/NewsYplayer.qml");
|
||||
// var videoQml = component.createObject(root,{"ytcode":attachment.url,"mimetype":attachment.mimetype});
|
||||
} else {
|
||||
root.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": attachment.url,"mimetype": attachment.mimetype});
|
||||
// var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideoLarge.qml");
|
||||
// var videoQml = component.createObject(root,{"source": attachment.url,"mimetype": attachment.mimetype});
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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)
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
import QtMultimedia 5.8
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.12
|
||||
//import QtQuick.Controls.Styles 1.4
|
||||
|
||||
Rectangle{
|
||||
id:newsvideofullscreen
|
||||
|
@ -65,7 +64,6 @@ Rectangle{
|
|||
anchors.fill:parent;
|
||||
onClicked:{
|
||||
root.pop()
|
||||
//newsvideofullscreen.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,11 +93,6 @@ Rectangle{
|
|||
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
|
||||
|
|
|
@ -69,10 +69,7 @@ Rectangle{
|
|||
opacity = 0
|
||||
}
|
||||
onTitleChanged: {
|
||||
if (title==2){
|
||||
root.pop();
|
||||
//newsYplayer.destroy(
|
||||
}
|
||||
if (title==2){root.pop()}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import "qrc:/qml/genericqml"
|
|||
|
||||
Item {
|
||||
id: newsitem
|
||||
width: parent.width
|
||||
width: newsView.width //parent.width
|
||||
height:toprow.height+friendicaActivities.height+controlrow.height+conversationColumn.height+1//Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
|
||||
property int itemindex: index
|
||||
property var newsitemobject:model.newsitemobject
|
||||
|
@ -54,9 +54,7 @@ Item {
|
|||
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
|
||||
}
|
||||
|
||||
function findTags(fulltext){
|
||||
return fulltext.match(/\s+[#]+[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+/g)
|
||||
}
|
||||
|
||||
|
||||
function pushConversation(){
|
||||
if (model.newsitemobject.hasOwnProperty("currentconversation")){
|
||||
|
@ -73,17 +71,10 @@ Item {
|
|||
height:newsitem.height-1
|
||||
color: "white"//(newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
||||
|
||||
// Row{id:toprow
|
||||
// Column {
|
||||
// id: authorcolumn
|
||||
// width: 8*mm
|
||||
|
||||
|
||||
// }
|
||||
Column {
|
||||
id:toprow //newscolumn
|
||||
width: newsitemobject.hasOwnProperty("indent")?newsitem.width-(newsitem.width/20 *newsitemobject.indent):newsitem.width//-8*mm
|
||||
x:newsitemobject.hasOwnProperty("indent")?newsitem.width/20*newsitemobject.indent:0
|
||||
width: newsitemobject.hasOwnProperty("indent")?newsitem.width-(newsitem.width/20 *(newsitemobject.indent+1)):newsitem.width//-8*mm
|
||||
x:newsitemobject.hasOwnProperty("indent")?newsitem.width/20*(newsitemobject.indent):0
|
||||
Item{
|
||||
height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm)
|
||||
width: parent.width
|
||||
|
@ -100,7 +91,6 @@ Item {
|
|||
width: 7*mm
|
||||
height: 7*mm
|
||||
//radius:mm
|
||||
|
||||
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Flow{
|
||||
|
@ -140,140 +130,117 @@ Item {
|
|||
horizontalAlignment: Label.AlignRight
|
||||
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
|
||||
}catch(e){" "}
|
||||
}
|
||||
|
||||
// Label {
|
||||
// id:newscountLabel
|
||||
// visible:((newstabstatus=="Conversations")&&(newsitemobject.newscount>1))?true:false
|
||||
// color: "grey"
|
||||
// height:3.5*mm
|
||||
// font.pixelSize: 1.5*mm
|
||||
// font.bold: true
|
||||
// horizontalAlignment: Label.AlignRight
|
||||
// text: try {(newsitemobject.newscount-1)+qsTr(" comments") }catch(e){" "}
|
||||
// MouseArea{
|
||||
// anchors.fill:parent
|
||||
// onClicked: {
|
||||
// pushConversation();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Column{ id: messageColumn
|
||||
// //anchors.top:topFlow.bottom
|
||||
// width:parent.width
|
||||
// spacing:mm
|
||||
// clip:true
|
||||
// height: newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
|
||||
MouseArea{
|
||||
width: toprow.width-2
|
||||
height: itemMessage.height
|
||||
onPressAndHold: {
|
||||
pushConversation();
|
||||
}
|
||||
Text {
|
||||
color: "#404040"
|
||||
linkColor: "light green"
|
||||
id: itemMessage
|
||||
textFormat: Text.RichText
|
||||
font.family: "Noto Sans"
|
||||
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
|
||||
MouseArea{
|
||||
width: toprow.width-2
|
||||
height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
|
||||
//height: implicitHeight
|
||||
wrapMode: Text.Wrap
|
||||
clip:true
|
||||
onLinkActivated:{
|
||||
Qt.openUrlExternally(link)}
|
||||
Component.onCompleted:{
|
||||
if (newsitemobject.messagetype==0){
|
||||
var hashtags=[];
|
||||
hashtags=findTags(newsitemobject.text);
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
|
||||
for (var tags in hashtags){
|
||||
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
|
||||
}}
|
||||
height: itemMessage.height
|
||||
onPressAndHold: {
|
||||
pushConversation();
|
||||
}
|
||||
Text {
|
||||
color: "#404040"
|
||||
linkColor: "light green"
|
||||
id: itemMessage
|
||||
textFormat: Text.RichText
|
||||
font.family: "Noto Sans"
|
||||
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
|
||||
width: toprow.width-2
|
||||
height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
|
||||
//height: implicitHeight
|
||||
wrapMode: Text.Wrap
|
||||
clip:true
|
||||
onLinkActivated:{
|
||||
Qt.openUrlExternally(link)}
|
||||
Component.onCompleted:{
|
||||
if (newsitemobject.messagetype==0){
|
||||
var hashtags=[];
|
||||
hashtags=Newsjs.findTags(newsitemobject.text);
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
|
||||
for (var tags in hashtags){
|
||||
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
|
||||
}}
|
||||
|
||||
if (newsitemobject.attachmentList.length>0){
|
||||
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
||||
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
||||
var imageQml = component.createObject(toprow,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
}
|
||||
else if(newsitemobject.attachmentList[attachments].mimetype=="text/html"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
|
||||
var linkQml = component.createObject(toprow,{"url":newsitemobject.attachmentList[attachments].url});
|
||||
}
|
||||
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(toprow,{"attachment":newsitemobject.attachmentList[attachments]});
|
||||
if (newsitemobject.attachmentList.length>0){
|
||||
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
||||
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
||||
var imageQml = component.createObject(toprow,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
}
|
||||
else if(newsitemobject.attachmentList[attachments].mimetype=="text/html"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
|
||||
var linkQml = component.createObject(toprow,{"url":newsitemobject.attachmentList[attachments].url});
|
||||
}
|
||||
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(toprow,{"attachment":newsitemobject.attachmentList[attachments]});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newsitemobject.hasOwnProperty("lastcomment")){
|
||||
var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml");
|
||||
var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1});
|
||||
if (newsitemobject.hasOwnProperty("lastcomment")){
|
||||
var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml");
|
||||
var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1});
|
||||
|
||||
var commentComponent = Qt.createComponent("qrc:/qml/newsqml/Newsitem.qml");
|
||||
var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment});
|
||||
var commentComponent = Qt.createComponent("qrc:/qml/newsqml/Newsitem.qml");
|
||||
var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment});
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
//}
|
||||
BlueButton{
|
||||
width: newsitem.width-8*mm-2
|
||||
height:5*mm
|
||||
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
|
||||
visible: itemMessage.implicitHeight>3/4*root.height || newsitemobject.nsfw//messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
|
||||
text:"\uf078"
|
||||
fontColor:"grey"
|
||||
border.color: "transparent"
|
||||
color:"white"
|
||||
BlueButton{
|
||||
width: newsitem.width-8*mm-2
|
||||
height:5*mm
|
||||
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
|
||||
visible: itemMessage.implicitHeight>3/4*root.height || newsitemobject.nsfw//messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
|
||||
text:"\uf078"
|
||||
fontColor:"grey"
|
||||
border.color: "transparent"
|
||||
color:"white"
|
||||
// gradient: Gradient {
|
||||
// GradientStop { position: 0.0; color: "transparent" }
|
||||
// GradientStop { position: 0.5; color: "white" }
|
||||
// }
|
||||
radius:0
|
||||
onClicked: {
|
||||
if (text=="\uf078"){
|
||||
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
|
||||
} else {
|
||||
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
|
||||
text="\uf078";
|
||||
newsView.positionViewAtIndex(index,ListView.Beginning);
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
radius:0
|
||||
onClicked: {
|
||||
if (text=="\uf078"){
|
||||
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
|
||||
} else {
|
||||
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
|
||||
text="\uf078";
|
||||
newsView.positionViewAtIndex(index,ListView.Beginning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Flow{
|
||||
id:friendicaActivities
|
||||
anchors.top:toprow.bottom
|
||||
width:parent.width
|
||||
spacing:mm
|
||||
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.likeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.dislikeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
|
||||
}
|
||||
}
|
||||
// Bottom row for activities
|
||||
Flow{
|
||||
id:friendicaActivities
|
||||
anchors.top:toprow.bottom
|
||||
width:parent.width
|
||||
spacing:mm
|
||||
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.likeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.dislikeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
|
@ -309,6 +276,8 @@ Item {
|
|||
text: (newsitemobject.friendica_activities_view.self.attending)?(qsTr("Attending: ")+ qsTr(newsitemobject.friendica_activities_view.self.attending)):""
|
||||
}
|
||||
}
|
||||
|
||||
//Bottom row for buttons
|
||||
Row{id:controlrow
|
||||
anchors.top:friendicaActivities.bottom
|
||||
height: 4*mm
|
||||
|
@ -385,9 +354,9 @@ Item {
|
|||
}
|
||||
checked:(newsitemobject.favorited>0)
|
||||
onClicked:{
|
||||
if(favoritedCheckbox.checkedState==Qt.Checked){
|
||||
if(favoritedCheckbox.checkState==Qt.Checked){
|
||||
Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1}
|
||||
else if(favoritedCheckbox.checkedState==Qt.Unchecked){
|
||||
else if(favoritedCheckbox.checkState==Qt.Unchecked){
|
||||
Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0}
|
||||
}
|
||||
}
|
||||
|
@ -408,29 +377,6 @@ Item {
|
|||
anchors.fill:parent
|
||||
onClicked: {newsmenu.popup()}}
|
||||
}
|
||||
// Rectangle{
|
||||
// width: 10*mm
|
||||
// height: 4*mm
|
||||
// visible:(newsitemobject.messagetype!==2)&&(newstab.newstabstatus!="Conversation")
|
||||
// color:"transparent"
|
||||
// Text{
|
||||
// id:conversationsymbol
|
||||
// color: "grey"
|
||||
// anchors.centerIn: parent
|
||||
// font.pixelSize: 2.5*mm
|
||||
// font.family: fontAwesome.name
|
||||
// text: "\uf086"
|
||||
// }
|
||||
// MouseArea{
|
||||
// anchors.fill:parent
|
||||
// onClicked:{
|
||||
// if (newsitemobject.hasOwnProperty("currentconversation")){newsStack.push("qrc:/qml/newsqml/Conversation.qml",{"news": newsitemobject.currentconversation})}
|
||||
// else{newsStack.push("qrc:/qml/newsqml/Conversation.qml")};
|
||||
// showConversation(index,newsitemobject)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
Menu {
|
||||
|
@ -450,8 +396,6 @@ Item {
|
|||
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});
|
||||
}
|
||||
}
|
||||
Action {
|
||||
|
@ -511,6 +455,14 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Show height")
|
||||
onTriggered: {
|
||||
Helperjs.showMessage("Height",itemMessage.height + "toprow: "+ toprow.height,root)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//MenuItem{
|
||||
// text:qsTr("Show on website")
|
||||
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
|
||||
|
@ -519,8 +471,8 @@ Item {
|
|||
Column{
|
||||
id:conversationColumn
|
||||
anchors.top:controlrow.bottom
|
||||
anchors.right: parent.right
|
||||
width: newsitem.width-5*mm
|
||||
//anchors.right: parent.right
|
||||
width: newsitem.width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.11
|
||||
//import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/smiley.js" as Smileyjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
@ -88,25 +87,7 @@ Rectangle{
|
|||
anchors.topMargin: 1*mm
|
||||
width: smileyDialog.width-2*mm
|
||||
height: smileyDialog.height-7*mm
|
||||
// style: TabViewStyle {
|
||||
// frameOverlap: 1
|
||||
// tab: Rectangle {
|
||||
// color: "white"
|
||||
// implicitWidth: smileyTabView.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
|
||||
// }
|
||||
|
||||
Rectangle{
|
||||
Rectangle{
|
||||
id: htmlGridTab
|
||||
GridView {
|
||||
id:htmlView
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue