Commits

Santiago Payà Miralta committed 461c770

Consolidation and more from knobtviker http://talk.maemo.org/showpost.php?p=1209168&postcount=493

Comments (0)

Files changed (20)

             msgType:model.type
             state_status:model.status
 
+	Rectangle {
+		height: 1
+		width: parent.width-30
+		anchors.horizontalCenter: parent.horizontalCenter
+		anchors.bottom: parent.bottom		
+		color: theme.inverted?"#cfd2d4":"black"
+	}
+
         }
     }
 
             id:no_data
 
             Label{
+
+
                 anchors.centerIn: parent;
                 text:"No conversations yet"
                 font.pointSize: 20
             clip:true
         }
     }
-}
+}

UI/Conversation.qml

 
         anchors.bottom: input_separator.top
         anchors.top: top_bar.bottom
-        anchors.bottomMargin: 10
+        //anchors.bottomMargin: 10
         anchors.topMargin: 5
         width:parent.width
         delegate: myDelegate
         model: conv_data
         spacing: 15
         clip: true
+	height: parent.height-1-input_holder.height-top_bar.height-10
+	//onModelChanged: conv_items.positionViewAtEnd;
 
     }
 
-    Separator{
+    Rectangle{
         id:input_separator
 
-        bottom_margin: 1
-        top_margin: 0
+        //bottom_margin: 1
+        //top_margin: 0
         anchors.bottom: input_holder.top
         width:parent.width
-        visible: !appWindow.stealth && !theme.inverted
+	height: 1
+	color: "gray"
+        visible: true //!appWindow.stealth && !theme.inverted
     }
 
     Timer {

UI/SpeechBubble.qml

             name: "sending"
             PropertyChanges {
                 target: status
-                source: "pics/indicators/sending.png"
+                source: "pics/indicators/sending_msg.png"
             }
         },
         State {
             name: "pending"
             PropertyChanges {
                 target: status
-                source: "pics/indicators/pending.png"
+                source: "pics/indicators/pending_msg.png"
             }
         },
         State {
             name: "delivered"
             PropertyChanges {
                 target: status
-                source: "pics/indicators/delivered.png"
+                source: "pics/indicators/delivered_msg.png"
             }
         }
     ]
     {
         id:realBubble
         radius: 5
-        width:parent.width-60
-        height: parent.height
+        width:  sizefy(msg_text.text.length) //parent.width-60
+	height: parent.height
         color: "transparent" //appWindow.stealth?"transparent":(from_me?"#cfd2d4":"#42b6f2");
         //opacity:theme.inverted?0.7:1
 
+	function sizefy (len) {
+		var result = 0;
+
+		var biggestText = Math.max(sender_name.text.length,msg_date.text.length);
+
+		var maxText = Math.max(len,biggestText)
+
+		
+		if (len > 20) {
+			result = bubble.width-60
+		} else {
+			result = msg_text.paintedWidth*maxText
+			
+		}
+		if (msg_date.text.length > msg_text.text.length)
+			result = msg_date.paintedWidth*maxText; 
+		
+		return result;	
+	}
+
         anchors.right: from_me?this.right:parent.right
         anchors.left: !from_me?this.left:parent.left
         anchors.rightMargin: 5
         anchors.leftMargin: 5
 
-		Image { id: img1; anchors.top:parent.top; anchors.left:parent.left; source: "pics/"+(from_me?"white":"blue")+"-1.png"; }
-		Image { id: img2; anchors.top:parent.top; anchors.left:img1.right; source: "pics/"+(from_me?"white":"blue")+"-2.png"; 
-				width:parent.width-img1.width-img3.width; height:img1.height; smooth: true }
-		Image { id: img3; anchors.top:parent.top; anchors.right:parent.right; source: "pics/"+(from_me?"white":"blue")+"-3.png"; }
-		Image { id: img4; anchors.top:img1.bottom; anchors.left:parent.left; source: "pics/"+(from_me?"white":"blue")+"-4.png";
-				height:parent.height-img1.height-img6.height }
-		Image { id: img5; anchors.top:img3.bottom; anchors.right:parent.right; source: "pics/"+(from_me?"white":"blue")+"-5.png"; 
-				height:img4.height}
-		Image { id: img6; anchors.bottom:parent.bottom; anchors.left:parent.left; source: "pics/"+(from_me?"white":"blue")+"-6.png"; }
-		Image { id: img7; anchors.bottom:parent.bottom; anchors.left:img6.right; source: "pics/"+(from_me?"white":"blue")+"-7.png"; 
-				width:img2.width; height:img6.height; smooth: true }
-		Image { id: img8; anchors.bottom:parent.bottom; anchors.right:parent.right; source: "pics/"+(from_me?"white":"blue")+"-8.png"; }
-		Image { id: imgC; anchors.top:img1.bottom; anchors.topMargin:0; anchors.left:img1.right; source: "pics/"+(from_me?"white":"blue")+"-c.png"; 
-				width:img2.width; height:img4.height; smooth: true}
+        Image { id: img1; anchors.top:parent.top; anchors.left:parent.left; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-1.png"; }
+        Image { id: img2; anchors.top:parent.top; anchors.left:img1.right; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-2.png";
+                        width:parent.width-img1.width-img3.width; height:img1.height; smooth: true }
+        Image { id: img3; anchors.top:parent.top; anchors.right:parent.right; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-3.png"; }
+        Image { id: img4; anchors.top:img1.bottom; anchors.left:parent.left; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-4.png";
+                        height:parent.height-img1.height-img6.height }
+        Image { id: img5; anchors.top:img3.bottom; anchors.right:parent.right; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-5.png";
+                        height:img4.height}
+        Image { id: img6; anchors.bottom:parent.bottom; anchors.left:parent.left; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-6.png"; }
+        Image { id: img7; anchors.bottom:parent.bottom; anchors.left:img6.right; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-7.png";
+                        width:img2.width; height:img6.height; smooth: true }
+        Image { id: img8; anchors.bottom:parent.bottom; anchors.right:parent.right; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-8.png"; }
+        Image { id: imgC; anchors.top:img1.bottom; anchors.topMargin:0; anchors.left:img1.right; source: "pics/"+(from_me?"white":(theme.inverted?"green":"blue"))+"-c.png";
+                        width:img2.width; height:img4.height; smooth: true}
 
 
 
             height:parent.height
             width:parent.width
 
-			Rectangle {
-				id: margin1; height: from_me? 4 : 14
-				width: parent.width; color: "transparent"
-			}
+            Rectangle {
+                id: margin1; height: from_me? 4 : 14
+                width: parent.width; color: "transparent"
+            }
 
             Label{
                 id:sender_name
             }
             Label{
                 id:msg_text
-                text:message;
+                text: linkify(message);
                 color:appWindow.stealth?colorPicker.color:(from_me?"black":"white")
                 width:parent.width - 20
                 wrapMode: "WrapAtWordBoundaryOrAnywhere"
                 anchors.left: parent.left
                 anchors.leftMargin: 10
-				horizontalAlignment: from_me? Text.AlignLeft : Text.AlignRight
+		horizontalAlignment: from_me? Text.AlignLeft : Text.AlignRight
+		
+
+		function linkify(inputText) {
+    			var replacedText, replacePattern1, replacePattern2, replacePattern3;
+
+    			//URLs starting with http://, https://, or ftp://
+    			replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
+    			replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');
+
+    			//URLs starting with "www." (without // before it, or it'd re-link the ones done above).
+    			replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
+    			replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');
+
+    			//Change email addresses to mailto:: links.
+    			replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
+    			replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');
+
+    			return replacedText
+		}
+		onLinkActivated: Qt.openUrlExternally(link)
             }
 
             /*Separator{
                 id:msg_date
                 color:appWindow.stealth?colorPicker.color:(from_me?"black":"white")
                 text: date
-				width:parent.width - 20
+                width:parent.width - 20
                 anchors.left: parent.left
-				anchors.leftMargin: 10
+                anchors.leftMargin: 10
                 font.pixelSize: 15
-				horizontalAlignment: from_me? Text.AlignLeft : Text.AlignRight
-				opacity: 0.7
+                horizontalAlignment: from_me? Text.AlignLeft : Text.AlignRight
+                opacity: 0.7
             }
 
-			Rectangle {
-				id: margin2; height: from_me? 8 : 0
-				width: parent.width; color: "transparent"
-			}
+            Rectangle {
+                id: margin2; height: from_me? 8 : 0
+                width: parent.width; color: "transparent"
+            }
 
 
         }

UI/UserStatus.qml

 
 
             if(container.state != "online" && container.state!="typing"){
-                 lastSeenOn = Qt.formatDateTime(d,"hh:mm ap dd.MM.yyyy");
+                 lastSeenOn = Qt.formatDateTime(d,"hh:mm dd.MM.yyyy");
                  container.state="offline"
             }
         }
         else{
-             lastSeenOn = Qt.formatDateTime(d,"hh:mm ap dd.MM.yyyy");
+             lastSeenOn = Qt.formatDateTime(d,"hh:mm dd.MM.yyyy");
              container.state="offline"
         }
 

UI/pics/SpeechBubble.qml

+// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 
+import QtQuick 1.1 
+import com.nokia.meego 1.0
+
+Rectangle {
+
+    id: bubble
+
+    property string picture;
+    property string message;
+    property bool from_me;
+    property string date;
+    property string name;
+    property int msg_id;
+    property string state_status;
+
+    state: state_status;
+
+
+
+    width: parent.width
+    height:msg_text.height+10+msg_date.height+sender_name.height;
+    color:"transparent"
+
+    states: [
+        State {
+            name: "sending"
+            PropertyChanges {
+                target: status
+                source: "pics/indicators/sending.png"
+            }
+        },
+        State {
+            name: "pending"
+            PropertyChanges {
+                target: status
+                source: "pics/indicators/pending.png"
+            }
+        },
+        State {
+            name: "delivered"
+            PropertyChanges {
+                target: status
+                source: "pics/indicators/delivered.png"
+            }
+        }
+    ]
+
+    Column{
+        visible: !from_me
+        width:80;
+        height:80;
+        anchors.right: realBubble.left
+        anchors.top: realBubble.top
+        anchors.rightMargin: 15
+
+        Rectangle{
+
+            height:parent.width
+            width:parent.width
+            color:"transparent"
+            Image{
+                id:sender_picture
+                width:parent.width
+                height:parent.height
+                fillMode: Image.PreserveAspectFit
+                opacity:appWindow.stealth?0.2:1
+                Component.onCompleted: {
+                    if(!from_me)
+                        sender_picture.source=picture
+                }
+            }
+        }
+    }
+
+
+    Rectangle
+    {
+        id:realBubble
+        radius: 5
+        width:parent.width-150
+        height: parent.height
+        color: appWindow.stealth?"transparent":(from_me?(theme.inverted?"#69de4a":"#cfd2d4"):(theme.inverted?"#27a01b":"#42b6f2"));
+        opacity:theme.inverted?0.9:1
+
+        anchors.right: from_me?this.right:parent.right
+        anchors.left: !from_me?this.left:parent.left
+        anchors.rightMargin: 5
+        anchors.leftMargin: 5
+
+        Image {
+            id: status
+            visible: from_me
+            anchors.right: parent.right
+            anchors.rightMargin: 5
+            anchors.top:parent.top
+            anchors.topMargin: 5
+
+        }
+        Column{
+            id:content
+            //anchors.fill: parent;
+            height:parent.height
+            width:parent.width
+
+            Label{
+                id:sender_name
+                width:parent.width;
+                color:appWindow.stealth?colorPicker.color:(from_me?"black":"white")
+                text:from_me?"You":name
+                font.pixelSize: 20
+                font.bold: true
+                anchors.left: parent.left
+                anchors.leftMargin: 5
+
+            }
+            Label{
+                    id:msg_text
+                    text:linkify(message);
+                    color:appWindow.stealth?colorPicker.color:(from_me?"black":"white")
+                    width:parent.width - 5
+                    wrapMode: "WrapAtWordBoundaryOrAnywhere"
+                    anchors.left: parent.left
+                    anchors.leftMargin: 5
+		textFormat: Text.RichText
+
+		function linkify(inputText) {
+    			var replacedText, replacePattern1, replacePattern2, replacePattern3;
+
+    			//URLs starting with http://, https://, or ftp://
+    			replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
+    			replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');
+
+    			//URLs starting with "www." (without // before it, or it'd re-link the ones done above).
+    			replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
+    			replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');
+
+    			//Change email addresses to mailto:: links.
+    			replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
+    			replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');
+
+    			return replacedText
+		}
+		
+	
+		onLinkActivated: Qt.openUrlExternally(link);
+
+            }
+
+            Separator{
+                top_margin: 5;
+                bottom_margin: 2;
+                visible:!appWindow.stealth
+            }
+
+            Label{
+                id:colorPicker
+                visible:false
+            }
+
+            Label{
+                    id:msg_date
+
+                    color:appWindow.stealth?colorPicker.color:(from_me?"black":"white")
+                    text: date
+                    anchors.right: parent.right
+                    anchors.rightMargin: 5
+                    font.pixelSize: 15
+            }
+
+        }
+
+    }
+
+
+}

UI/pics/green-1.png

Added
New image

UI/pics/green-2.png

Added
New image

UI/pics/green-3.png

Added
New image

UI/pics/green-4.png

Added
New image

UI/pics/green-5.png

Added
New image

UI/pics/green-6.png

Added
New image

UI/pics/green-7.png

Added
New image

UI/pics/green-8.png

Added
New image

UI/pics/green-c.png

Added
New image

UI/pics/indicators/delivered.png

Old
Old image
New
New image

UI/pics/indicators/delivered_msg.png

Added
New image

UI/pics/indicators/pending.png

Old
Old image
New
New image

UI/pics/indicators/pending_msg.png

Added
New image

UI/pics/indicators/sending.png

Old
Old image
New
New image

UI/pics/indicators/sending_msg.png

Added
New image