mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-25 06:36:53 -05:00
Set emoji font declaration global for all app
This commit is contained in:
parent
0a5b3508da
commit
54c8e26fee
retroshare-qml-app/src
@ -1,18 +1,15 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.0
|
||||||
import "emoji.js" as EmojiJSON
|
import "emoji.js" as EmojiJSON
|
||||||
//import "../../fonts/."
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: emojiPicker
|
id: emojiPicker
|
||||||
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
|
||||||
|
|
||||||
FontLoader { id: emojiFont; source: "/fonts/OpenSansEmoji.ttf" }
|
property var rootFontName: theme.emojiFontName
|
||||||
property var supportedEmojiFonts: ["Android Emoji"]
|
|
||||||
property var rootFontName: emojiFont.name
|
|
||||||
|
|
||||||
//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){
|
||||||
@ -38,22 +35,6 @@ Rectangle {
|
|||||||
strAppnd += selectedEmoji
|
strAppnd += selectedEmoji
|
||||||
|
|
||||||
textArea.insert(textArea.cursorPosition, strAppnd)
|
textArea.insert(textArea.cursorPosition, strAppnd)
|
||||||
}
|
|
||||||
|
|
||||||
// If native emoji font exists use it, else use RS emoji font
|
|
||||||
function selectFont ()
|
|
||||||
{
|
|
||||||
var fontFamilies = Qt.fontFamilies()
|
|
||||||
return fontFamilies.some(function (f)
|
|
||||||
{
|
|
||||||
if (supportedEmojiFonts.indexOf(f) !== -1)
|
|
||||||
{
|
|
||||||
console.log("Compatible native emoji font found: " +f)
|
|
||||||
rootFontName = f
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//parses JSON, publishes button handlers and inits textArea
|
//parses JSON, publishes button handlers and inits textArea
|
||||||
@ -143,7 +124,6 @@ Rectangle {
|
|||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
selectFont()
|
|
||||||
completedHandler()
|
completedHandler()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -558,4 +558,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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user