1 /****************************************************************************
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 or version 3 as published by the Free
20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
22 ** following information to ensure the GNU Lesser General Public License
23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26 ** As a special exception, The Qt Company gives you certain additional
27 ** rights. These rights are described in The Qt Company LGPL Exception
28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
30 ** GNU General Public License Usage
31 ** Alternatively, this file may be used under the terms of the GNU
32 ** General Public License version 3.0 as published by the Free Software
33 ** Foundation and appearing in the file LICENSE.GPL included in the
34 ** packaging of this file. Please review the following information to
35 ** ensure the GNU General Public License version 3.0 requirements will be
36 ** met: http://www.gnu.org/copyleft/gpl.html.
40 ****************************************************************************/
47 id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 60){txt.height+10}else{60} //50+5+5
48 function handleLink(link){
49 if(link.slice(0,3) == 'app'){
50 screen.setUser(link.slice(7));
51 }else if(link.slice(0,4) == 'http'){
52 Qt.openUrlExternally(link);
55 function addTags(str){
56 var ret = str.replace(/@[a-zA-Z0-9_]+/g, '<a href="app://$&">$&</a>');//click to jump to user?
57 var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '<a href="$&">$&</a>');//surrounds http links with html link tags
61 // Strip away paranthesis
62 function userName(str) {
63 var user = str.replace(/\([\S|\s]*\)/gi, "");
68 id: moveMe; height: parent.height
71 color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1
74 id: image; x: 6; width: 48; height: 48; smooth: true
75 anchors.verticalCenter: parent.verticalCenter
77 Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != Image.Ready }
80 source: userImage; x: 1; y: 1;
81 width:48; height:48; opacity:0 ;
83 if(status==Image.Ready)
89 PropertyChanges { target: realImage ; opacity:1 }
91 transitions: Transition { NumberAnimation { target: realImage; property: "opacity"; duration: 200 } }
94 Text { id:txt; y:4; x: 56
95 text: '<html><style type="text/css">a:link {color:"#aaccaa"}; a:visited {color:"#336633"}</style>'
96 + '<a href="app://@'+userName(name)+'"><b>'+userName(name) + "</b></a> from " +source
97 + "<br /><b>" + statusText + "</b></html>";
98 textFormat: Qt.RichText
99 color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap
100 anchors.left: image.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6
101 onLinkActivated: wrapper.handleLink(link)