Skip to content
This repository has been archived by the owner on Jan 2, 2018. It is now read-only.

Patch fancy dialogs #219

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
70 changes: 61 additions & 9 deletions src/client/UI/Conversations/Conversation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ WAPage {
if(status == PageStatus.Deactivating){
chat_text.visible = false
sendMediaWindow.opacity = 0
emojiComponent.visible = false
emojiComponent.ready = false
}
else if(status == PageStatus.Activating){
chat_text.visible = true
Expand Down Expand Up @@ -742,6 +744,8 @@ WAPage {
onSendButtonClicked:{
//consoleDebug("SEND CLICKED");
sendMediaWindow.opacity = 0
emojiComponent.visible = false
emojiComponent.ready = false

showSendButton=true;
forceFocusToChatText()
Expand Down Expand Up @@ -821,10 +825,21 @@ WAPage {
}
}

onInputPanelChanged: conv_items.positionViewAtEnd()
onSoftwareInputPanelVisibleChanged: {
if (emojiComponent.ready && !chat_text.softwareInputPanelVisible) {
consoleDebug("emojiComponent.ready: " + emojiComponent.ready)
emojiComponent.open(chat_text)

}
else {
emojiComponent.accept()
}
}

onActiveFocusChanged: {
lastPosition = chat_text.cursorPosition
emojiComponent.visible = false
emojiComponent.ready = false
//consoleDebug("LAST POSITION: " + lastPosition)
conv_items.positionViewAtEnd()
showSendButton = chat_text.focus || input_button_holder_area.focus || emoji_button.focus
Expand All @@ -846,12 +861,12 @@ WAPage {

SendMedia {
id: sendMediaWindow
height: appWindow.inPortrait? 180 : 100
height: 80
width: parent.width
opacity: 0
visible: opacity!=0
anchors.bottom: parent.bottom
anchors.bottomMargin: 90
anchors.bottomMargin: 72

Behavior on opacity {
NumberAnimation { duration: 200 }
Expand Down Expand Up @@ -896,7 +911,7 @@ WAPage {
anchors.bottom: parent.bottom
anchors.left: parent.left
width: parent.width
height: blockedContacts.indexOf(jid)==-1 && showSendButton ? 72 : 0
height: blockedContacts.indexOf(jid)==-1 && showSendButton ? (emojiComponent.height + 72) : 0
color: theme.inverted? "#1A1A1A" : "white"
clip: true

Expand Down Expand Up @@ -937,13 +952,40 @@ WAPage {
}
}

Button {
WAButton
{
id: emoji_button
width:50
height:50
iconSource: "../common/images/emoji/32/E415.png"
anchors.left: parent.left
anchors.leftMargin: 16
anchors.top: parent.top
anchors.topMargin: 8
checked: emojiComponent.visible
onClicked: {
sendMediaWindow.opacity = 0
emojiComponent.ready = !emojiComponent.ready
if (!emojiComponent.ready)
forceFocusToChatText()

showSendButton=true;
}
onPressAndHold: {
sendMediaWindow.opacity = 0
emojiDialog.openDialog(chat_text);
showSendButton=true;
}
}

WAButton {
id: media_button
anchors.left: emoji_button.right
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenter: emoji_button.verticalCenter
width: 50
height: width
checked: sendMediaWindow.visible
iconSource: theme.inverted ? "../common/images/attachment-white.png" : "../common/images/attachment.png"

onClicked: {
Expand All @@ -954,18 +996,28 @@ WAPage {
}
}

Button
WAButton
{
id:send_button
platformStyle: ButtonStyle { inverted: true }
width:160
height:50
text: qsTr("Send")
anchors.right: parent.right
anchors.rightMargin: 16
y: 10
anchors.verticalCenter: emoji_button.verticalCenter
onClicked: sendButtonClicked();
}

EmojiComponent{
id: emojiComponent
property bool ready: false
height: emojiComponent.visible? (appWindow.inPortrait? 378 : 176) : 0
width: parent.width
anchors.bottom: parent.bottom
inverted: theme.inverted
backspaceButton: true
visible: false
}

}

Expand Down
67 changes: 33 additions & 34 deletions src/client/UI/Conversations/SendMedia.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,42 +27,53 @@ Item {

signal selected(string value)

BorderImage {
Rectangle {
id: panel
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
source: theme.inverted? "../common/images/back2.png" : "../common/images/back1.png"
border { left: 22; right: 22; bottom: 22; top: 22; }
smooth: true
color: theme.inverted? "#1A1A1A" : "white"

Rectangle {
height: 1
width: parent.width
x:0; y:0
color: "gray"
opacity: 0.4
}

MouseArea {
anchors.fill: parent
//onClicked: selected("nothing")
}

GridView {
ListView {
anchors.fill: parent
cellWidth: 100
cellHeight: 76
anchors.topMargin: 12
anchors.leftMargin: appWindow.inPortrait? 26 : 14
interactive: false
orientation: ListView.Horizontal
clip: true

model: ListModel {
ListElement { name: "Picture"; value: "pic"; usable: true;}
ListElement { name: "Picture2"; value: "campic"; usable: true;}
ListElement { name: "Video"; value: "vid"; usable: true;}
ListElement { name: "Video2"; value: "camvid"; usable: true;}
ListElement { name: "Audio"; value: "audio"; usable: true;}
ListElement { name: "Audio2"; value: "rec"; usable: false;}
ListElement { name: "Location"; value: "location"; usable: true;}
ListElement { name: "Contact"; value: "vcard"; usable: true;}
ListElement { name: "Picture"; value: "pic"; usable: true;}
ListElement { name: "Picture2"; value: "campic"; usable: true;}
ListElement { name: "Video"; value: "vid"; usable: true;}
ListElement { name: "Video2"; value: "camvid"; usable: true;}
ListElement { name: "Audio"; value: "audio"; usable: true;}
ListElement { name: "Audio2"; value: "rec"; usable: false;}
ListElement { name: "Location"; value: "location"; usable: true;}
ListElement { name: "Contact"; value: "vcard"; usable: true;}
}

delegate: Item {
width: 100
height: 76
width: 64
height: 80

Rectangle {
id: background
anchors.centerIn: parent
width: 64
height: 64
visible: mouseArea.pressed && usable

color: "lightgray"
}

Image {
id: image
Expand All @@ -74,18 +85,6 @@ Item {
opacity: usable? 1 : 0.5
}

/*Label {
anchors.centerIn: rec
height: 32
width: 152
color: "white"
font.pixelSize: 14
text: fileName
wrapMode: Text.WrapAnywhere
horizontalAlignment : Text.AlignHCenter
verticalAlignment : Text.AlignVCenter
}*/

MouseArea {
id: mouseArea
anchors.fill: parent
Expand Down
101 changes: 101 additions & 0 deletions src/client/UI/EmojiDialog/Components/EmojiView.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import "../js/emojihelper.js" as EmojiHelper;
import "../../common/js/Global.js"as Helpers;
import "../../common/js/settings.js" as MySettings;
import QtQuick 1.1
import com.nokia.meego 1.0

GridView{
id: emojiView

property int start;
property int end;

property bool showRecent: false
property int recentCount: 0

property bool inverted: true

signal selected(string code)

visible:true
clip: true
cellWidth: 60
cellHeight: 60

model: ListModel { id: emojiModel }

Component {
id: emojiDelegate
Rectangle {
width: 59
height: 59
color: emojiArea.pressed ? "#27a01b":(inverted?"#3c3c3b":"lightgray")

Image {
id: emojiImage
anchors.centerIn: parent
width: 32
height: 32
smooth: false
cache: true
asynchronous: true
source: emote
}

MouseArea {
id: emojiArea
anchors.fill: parent
onClicked: emojiView.selected(code)
}
}

}

delegate: emojiDelegate

function get32(code){
var c = ""+code;
return "../../common/images/emoji/32/"+c+".png";
}

function loadRecentEmoji(){
var emojilist= MySettings.getSetting("RecentEmoji", "")

var emoji = []
if (emojilist!="")
emoji = emojilist.split(',')
recentCount = emoji.length

while (emoji.length > 0)
{
var code = emoji.pop()
emojiModel.append({"emote":get32(code), "code":code});
}
}

function loadEmojiPage() {
var myend = end+1
for (var i=start; i<myend; i++)
{
var code = Helpers.emoji_code[i]
emojiModel.append({"emote":get32(code), "code":code})
}
}

function load() {
var oldY = emojiView.contentY
emojiModel.clear()
if (showRecent)
loadRecentEmoji()
else
loadEmojiPage()

visible = true
emojiView.contentY = oldY
}

function hide() {
visible = false
}
}

Loading