mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-09 16:15:45 +00:00
Use different font for itegrated backend on windows 8 and 10
This commit is contained in:
parent
029a633515
commit
8262ad85fc
@ -4,13 +4,12 @@ import QtQuick.Window 2.2
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
signal dismissed()
|
||||
signal invoked()
|
||||
|
||||
width: body.font.pixelSize * 30
|
||||
height: body.font.pixelSize * 9
|
||||
|
||||
signal dismissed()
|
||||
|
||||
signal invoked()
|
||||
|
||||
function update(nTitle, bBody, nImage, nAppIcon, color, textColor, isUpdate)
|
||||
{
|
||||
title.text = nTitle
|
||||
@ -21,12 +20,14 @@ Rectangle {
|
||||
image.source = nImage
|
||||
root.color = color
|
||||
|
||||
|
||||
if (!isUpdate) {
|
||||
var corner = window.corner
|
||||
var id = window.id
|
||||
var space = (id + 1) * height * 0.025
|
||||
|
||||
console.debug(snoreFont)
|
||||
console.debug(body.font.family)
|
||||
|
||||
animation.target = window
|
||||
|
||||
window.y = space + (space + height) * id
|
||||
@ -79,6 +80,7 @@ Rectangle {
|
||||
anchors.left: image.right
|
||||
anchors.leftMargin: 5
|
||||
textFormat: Text.RichText
|
||||
font.family: snoreFont
|
||||
}
|
||||
|
||||
Text {
|
||||
@ -98,7 +100,7 @@ Rectangle {
|
||||
maximumLineCount: height / font.pixelSize - 1
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
textFormat: Text.RichText
|
||||
|
||||
font.family: snoreFont
|
||||
}
|
||||
|
||||
|
||||
@ -146,5 +148,4 @@ Rectangle {
|
||||
onClicked: root.dismissed()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
using namespace Snore;
|
||||
|
||||
NotifyWidget::NotifyWidget(int pos, const SnoreNotifier *parent) :
|
||||
QQuickView(QUrl::fromEncoded("qrc:/notification.qml")),
|
||||
m_id(pos),
|
||||
m_parent(parent),
|
||||
m_mem(QLatin1String("SnoreNotifyWidget_rev") + QString::number(SHARED_MEM_TYPE_REV()) + QLatin1String("_id") + QString::number(m_id)),
|
||||
@ -32,7 +31,22 @@ NotifyWidget::NotifyWidget(int pos, const SnoreNotifier *parent) :
|
||||
{
|
||||
rootContext()->setContextProperty(QLatin1String("window"), this);
|
||||
rootContext()->setContextProperty(QLatin1String("utils"), new Utils(this));
|
||||
m_qmlNotification = rootObject();
|
||||
|
||||
QString font;
|
||||
switch(QSysInfo::windowsVersion()){
|
||||
case QSysInfo::WV_WINDOWS8:
|
||||
font = QLatin1String("Segoe UI Symbol");
|
||||
break;
|
||||
#if QT_VERSION_CHECK(5,5,0)
|
||||
case QSysInfo::WV_10_0:
|
||||
font = QLatin1String("Segoe UI Emoji");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
font = qApp->font().family();
|
||||
}
|
||||
rootContext()->setContextProperty(QLatin1String("snoreFont"), font);
|
||||
setSource(QUrl::fromEncoded("qrc:/notification.qml"));
|
||||
|
||||
setFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowDoesNotAcceptFocus
|
||||
#ifdef Q_OS_MAC
|
||||
@ -63,8 +77,8 @@ NotifyWidget::NotifyWidget(int pos, const SnoreNotifier *parent) :
|
||||
|
||||
setResizeMode(QQuickView::SizeViewToRootObject);
|
||||
|
||||
connect(m_qmlNotification, SIGNAL(invoked()), this, SLOT(slotInvoked()));
|
||||
connect(m_qmlNotification, SIGNAL(dismissed()), this, SLOT(slotDismissed()));
|
||||
connect(rootObject(), SIGNAL(invoked()), this, SLOT(slotInvoked()));
|
||||
connect(rootObject(), SIGNAL(dismissed()), this, SLOT(slotDismissed()));
|
||||
}
|
||||
|
||||
NotifyWidget::~NotifyWidget()
|
||||
@ -86,7 +100,7 @@ void NotifyWidget::display(const Notification ¬ification)
|
||||
}
|
||||
QRgb gray = qGray(qGray(color.rgb()) - qGray(QColor(Qt::white).rgb()));
|
||||
QColor textColor = QColor(gray, gray, gray);
|
||||
QMetaObject::invokeMethod(m_qmlNotification, "update", Qt::QueuedConnection,
|
||||
QMetaObject::invokeMethod(rootObject(), "update", Qt::QueuedConnection,
|
||||
Q_ARG(QVariant, notification.title(Utils::ALL_MARKUP)),
|
||||
Q_ARG(QVariant, notification.text(Utils::ALL_MARKUP)),
|
||||
Q_ARG(QVariant, QUrl::fromLocalFile(notification.icon().localUrl())),
|
||||
|
@ -72,7 +72,6 @@ private:
|
||||
QColor computeBackgrondColor(const QImage &img);
|
||||
|
||||
Snore::Notification m_notification;
|
||||
QObject *m_qmlNotification;
|
||||
int m_id;
|
||||
const SnoreNotifier *m_parent;
|
||||
QSharedMemory m_mem;
|
||||
|
@ -26,7 +26,6 @@ SnoreNotifierSettings::SnoreNotifierSettings(SnorePlugin *snore, QWidget *parent
|
||||
PluginSettingsWidget(snore, parent),
|
||||
m_comboBox(new QComboBox)
|
||||
{
|
||||
|
||||
m_comboBox->addItem(tr("TopLeftCorner"), Qt::TopLeftCorner);
|
||||
m_comboBox->addItem(tr("TopRightCorner"), Qt::TopRightCorner);
|
||||
m_comboBox->addItem(tr("BottomLeftCorner"), Qt::BottomLeftCorner);
|
||||
|
Loading…
x
Reference in New Issue
Block a user