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 {
|
Rectangle {
|
||||||
id: emojiButton
|
id: emojiButton
|
||||||
|
|
||||||
|
property var fontName
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: emojiText
|
id: emojiText
|
||||||
@ -11,6 +12,7 @@ Rectangle {
|
|||||||
text: qsTr(eCatText)
|
text: qsTr(eCatText)
|
||||||
font.pixelSize: emojiButton.width - 8
|
font.pixelSize: emojiButton.width - 8
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
font.family: fontName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ Rectangle {
|
|||||||
id: emojiCategoryButton
|
id: emojiCategoryButton
|
||||||
property string categoryName
|
property string categoryName
|
||||||
|
|
||||||
|
property var fontName
|
||||||
|
|
||||||
|
|
||||||
function completedHandler() {
|
function completedHandler() {
|
||||||
categoryName = eCatName
|
categoryName = eCatName
|
||||||
@ -38,6 +40,7 @@ Rectangle {
|
|||||||
text: qsTr(eCatText)
|
text: qsTr(eCatText)
|
||||||
font.pixelSize: emojiCategoryButton.width - 8
|
font.pixelSize: emojiCategoryButton.width - 8
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
font.family: fontName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,9 @@ Rectangle {
|
|||||||
property EmojiCategoryButton currSelEmojiButton
|
property EmojiCategoryButton currSelEmojiButton
|
||||||
property variant emojiParsedJson
|
property variant emojiParsedJson
|
||||||
property int buttonWidth: 40
|
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
|
//displays all Emoji of one categroy by modifying the ListModel of emojiGrid
|
||||||
function categoryChangedHandler (newCategoryName){
|
function categoryChangedHandler (newCategoryName){
|
||||||
@ -33,7 +35,7 @@ Rectangle {
|
|||||||
strAppnd += selectedEmoji
|
strAppnd += selectedEmoji
|
||||||
|
|
||||||
textArea.insert(textArea.cursorPosition, strAppnd)
|
textArea.insert(textArea.cursorPosition, strAppnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
//parses JSON, publishes button handlers and inits textArea
|
//parses JSON, publishes button handlers and inits textArea
|
||||||
function completedHandler() {
|
function completedHandler() {
|
||||||
@ -63,7 +65,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//all emoji of one category
|
//all emoji of one category
|
||||||
ListModel {
|
ListModel {
|
||||||
id: emojiByCategory
|
id: emojiByCategory
|
||||||
@ -81,6 +82,7 @@ Rectangle {
|
|||||||
width: buttonWidth
|
width: buttonWidth
|
||||||
height: buttonWidth
|
height: buttonWidth
|
||||||
color: emojiPicker.color
|
color: emojiPicker.color
|
||||||
|
fontName: rootFontName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +114,7 @@ Rectangle {
|
|||||||
width: buttonWidth
|
width: buttonWidth
|
||||||
height: buttonWidth
|
height: buttonWidth
|
||||||
color: emojiPicker.color
|
color: emojiPicker.color
|
||||||
|
fontName: rootFontName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,6 +122,9 @@ Rectangle {
|
|||||||
id: emojiCategoryButtons
|
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()
|
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/mouth8.png</file>
|
||||||
<file>icons/faces/male64/mouth9.png</file>
|
<file>icons/faces/male64/mouth9.png</file>
|
||||||
<file>components/Faces.qml</file>
|
<file>components/Faces.qml</file>
|
||||||
|
<file>fonts/OpenSansEmoji.ttf</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
Reference in New Issue
Block a user