mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-15 09:27:09 -05:00
Set emoji font declaration global for all app
This commit is contained in:
parent
0a5b3508da
commit
54c8e26fee
@ -1,18 +1,15 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import "emoji.js" as EmojiJSON
|
||||
//import "../../fonts/."
|
||||
|
||||
Rectangle {
|
||||
id: emojiPicker
|
||||
property EmojiCategoryButton currSelEmojiButton
|
||||
property variant emojiParsedJson
|
||||
property int buttonWidth: 40
|
||||
property TextArea textArea
|
||||
property TextArea textArea
|
||||
|
||||
FontLoader { id: emojiFont; source: "/fonts/OpenSansEmoji.ttf" }
|
||||
property var supportedEmojiFonts: ["Android Emoji"]
|
||||
property var rootFontName: emojiFont.name
|
||||
property var rootFontName: theme.emojiFontName
|
||||
|
||||
//displays all Emoji of one categroy by modifying the ListModel of emojiGrid
|
||||
function categoryChangedHandler (newCategoryName){
|
||||
@ -38,22 +35,6 @@ Rectangle {
|
||||
strAppnd += selectedEmoji
|
||||
|
||||
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
|
||||
@ -143,7 +124,6 @@ Rectangle {
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
selectFont()
|
||||
completedHandler()
|
||||
}
|
||||
}
|
||||
|
@ -558,4 +558,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()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user