From 285c58830246d2b761dd70370687b1de546e0ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 29 May 2022 22:24:23 +0200 Subject: [PATCH] Add support for green and blue circles in yaml These are used in default.yaml to mean ...something. More emojis can be added later, should it be needed. --- QrwEmoticons/QrwEmoticons.pri | 15 +++++++++++++++ main.cpp | 8 ++++++++ systray.pro | 1 + window.cpp | 10 ++++++++++ 4 files changed, 34 insertions(+) create mode 100644 QrwEmoticons/QrwEmoticons.pri diff --git a/QrwEmoticons/QrwEmoticons.pri b/QrwEmoticons/QrwEmoticons.pri new file mode 100644 index 0000000..84e129d --- /dev/null +++ b/QrwEmoticons/QrwEmoticons.pri @@ -0,0 +1,15 @@ +QT += gui widgets svg xml + +INCLUDEPATH += $$PWD/include + +# Removed all emojis but openmoji and circles + +QMAKE_PRE_LINK += \ + cd $$PWD/lib && qmake && make; \ + cd $$PWD/plugin-openmoji && qmake && make + +LIBS += \ + -L$$PWD/lib \ + -lQrwEmoticons \ + -L$$PWD/plugin-openmoji \ + -lemoticons_openmoji diff --git a/main.cpp b/main.cpp index 4994848..2472109 100644 --- a/main.cpp +++ b/main.cpp @@ -49,6 +49,7 @@ ****************************************************************************/ #include +#include #ifndef QT_NO_SYSTEMTRAYICON @@ -56,9 +57,16 @@ #include "window.h" #include "lima.h" +#ifndef QT_NO_EMOTICONS +Q_IMPORT_PLUGIN(EmoticonOpenmojiPlugin) +#endif + int main(int argc, char *argv[]) { Q_INIT_RESOURCE(systray); +#ifndef QT_NO_EMOTICONS + Q_INIT_RESOURCE(emoticons_openmoji); +#endif #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); diff --git a/systray.pro b/systray.pro index 7e96b65..2d455eb 100644 --- a/systray.pro +++ b/systray.pro @@ -20,6 +20,7 @@ DISTFILES += \ LICENSE include(QSourceHighlite/QSourceHighlite.pri) +include(QrwEmoticons/QrwEmoticons.pri) # Enabling qtermwidget requires GPL-v2 license #CONFIG += gpl_licensed diff --git a/window.cpp b/window.cpp index a52a0c2..5907be4 100644 --- a/window.cpp +++ b/window.cpp @@ -96,6 +96,10 @@ using namespace QSourceHighlite; #endif +#ifndef QT_NO_EMOTICONS +#include +#endif + //! [0] Window::Window() { @@ -279,7 +283,13 @@ void Window::yamlEditor(QString instanceName, QString yamlFile, bool create) topLayout->addWidget(label); topLayout->addWidget(createName); +#ifndef QT_NO_EMOTICONS + QrwEmoticonsTextEdit *textEdit = new QrwEmoticonsTextEdit( this ); + textEdit->emoticons()->setProvider("openmoji", false); + createYAML = textEdit; +#else createYAML = new QTextEdit("lima"); +#endif QFont font("monospace"); font.setStyleHint(QFont::Monospace); font.setPointSize(10);