Merge branch 'qml_app_emoji_font' into GSoC2017-evaluation-II

This commit is contained in:
Angela Mazzurco 2017-08-03 16:48:37 +02:00
commit 83f886075d
6 changed files with 49 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import QtQuick.Controls.Styles 1.2
Rectangle {
id: emojiButton
property var fontName
Text {
id: emojiText
@ -11,6 +12,7 @@ Rectangle {
text: qsTr(eCatText)
font.pixelSize: emojiButton.width - 8
anchors.centerIn: parent
font.family: fontName
}

View File

@ -5,6 +5,8 @@ Rectangle {
id: emojiCategoryButton
property string categoryName
property var fontName
function completedHandler() {
categoryName = eCatName
@ -38,6 +40,7 @@ Rectangle {
text: qsTr(eCatText)
font.pixelSize: emojiCategoryButton.width - 8
anchors.centerIn: parent
font.family: fontName
}

View File

@ -7,7 +7,9 @@ Rectangle {
property EmojiCategoryButton currSelEmojiButton
property variant emojiParsedJson
property int buttonWidth: 40
property TextArea textArea
property TextArea textArea
property var rootFontName: theme.emojiFontName
//displays all Emoji of one categroy by modifying the ListModel of emojiGrid
function categoryChangedHandler (newCategoryName){
@ -33,7 +35,7 @@ Rectangle {
strAppnd += selectedEmoji
textArea.insert(textArea.cursorPosition, strAppnd)
}
}
//parses JSON, publishes button handlers and inits textArea
function completedHandler() {
@ -63,7 +65,6 @@ Rectangle {
}
}
//all emoji of one category
ListModel {
id: emojiByCategory
@ -81,6 +82,7 @@ Rectangle {
width: buttonWidth
height: buttonWidth
color: emojiPicker.color
fontName: rootFontName
}
}
@ -112,6 +114,7 @@ Rectangle {
width: buttonWidth
height: buttonWidth
color: emojiPicker.color
fontName: rootFontName
}
}
@ -119,6 +122,9 @@ Rectangle {
id: emojiCategoryButtons
}
Component.onCompleted: completedHandler()
Component.onCompleted:
{
completedHandler()
}
}

Binary file not shown.

View File

@ -585,4 +585,37 @@ ApplicationWindow
onTriggered: linkCopiedPopup.close()
}
}
FontLoader { id: emojiFont; source: "/fonts/OpenSansEmoji.ttf" }
QtObject
{
id: theme
property var emojiFontName: emojiFont.name
property var supportedEmojiFonts: ["Android Emoji"]
property var rootFontName: emojiFont.name
// If native emoji font exists use it, else use RS emoji font
function selectFont ()
{
var fontFamilies = Qt.fontFamilies()
fontFamilies.some(function (f)
{
if (supportedEmojiFonts.indexOf(f) !== -1)
{
emojiFontName = f
return true
}
return false
})
}
Component.onCompleted:
{
selectFont()
}
}
}

View File

@ -743,5 +743,6 @@
<file>icons/faces/male64/mouth8.png</file>
<file>icons/faces/male64/mouth9.png</file>
<file>components/Faces.qml</file>
<file>fonts/OpenSansEmoji.ttf</file>
</qresource>
</RCC>