mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge branch 'qml_app_emoji_font' into GSoC2017-evaluation-II
This commit is contained in:
commit
83f886075d
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
retroshare-qml-app/src/fonts/OpenSansEmoji.ttf
Normal file
BIN
retroshare-qml-app/src/fonts/OpenSansEmoji.ttf
Normal file
Binary file not shown.
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user