This repository has been archived on 2021-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
ui/qml/main.qml

109 lines
2.1 KiB
QML
Raw Normal View History

2018-10-23 18:52:13 +00:00
import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
2018-10-28 02:49:14 +00:00
import "fonts/Twemoji.js" as T
2018-10-23 18:52:13 +00:00
import "widgets"
Item {
width: 525
height: 500
id: root
2018-10-28 02:49:14 +00:00
FontAwesome {
id: awesome
resource: "qrc:/qml/fonts/fontawesome.ttf"
}
function parse(text, size) {
T.twemoji.base = "qrc:/qml/fonts/twemoji/"
T.twemoji.ext = ".png"
T.twemoji.size = "72x72"
T.twemoji.className = "\" height=\""+size+"\" width=\""+size
return T.twemoji.parse(text)
}
function restoreEmoji(text) {
var re = /<img src="qrc:\/qml\/fonts\/twemoji\/72x72\/([^"]*?)\.png" width="10" height="10" \/>/g
var arr
var newtext = text
while (arr = re.exec(text)) {
var pieces = arr[1].split("-")
var replacement = ""
for (var i = 0; i < pieces.length; i++) {
replacement += T.twemoji.convert.fromCodePoint(pieces[i])
}
newtext = newtext.replace(arr[0], replacement)
}
return newtext
}
2018-10-23 18:52:13 +00:00
RowLayout {
anchors.fill: parent
spacing: 0
Rectangle { // THE LEFT PANE WITH TOOLS AND CONTACTS
2018-10-25 00:13:03 +00:00
color: "#D2C0DD"
2018-10-23 18:52:13 +00:00
Layout.fillHeight: true
Layout.minimumWidth: 200
Layout.maximumWidth: 200
ContactList{
anchors.fill: parent
}
}
Rectangle { // THE RIGHT PANE WHERE THE MESSAGES GO
color: "#EEEEFF"
Layout.fillWidth: true
Layout.fillHeight: true
MessageList{
anchors.fill: parent
}
}
}
PropertyAnimation { id: anmPopup; easing.type: Easing.InQuart; duration: 7000; target: popup; property: "opacity"; to: 0; }
Rectangle {
id: popup
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 20
width: lblPopup.width + 30
height: lblPopup.height + 8
color: "#000000"
opacity: 0.5
radius: 15
visible: false
Label {
id: lblPopup
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 18
color: "#FFFFFF"
}
}
Connections {
target: gcd
onInvokePopup: function(str) {
lblPopup.text = str
popup.opacity = 0.5
popup.visible = true
anmPopup.restart()
}
}
}