Don't use dpi foo but percentage of screen height
This commit is contained in:
parent
5950b778ce
commit
f19e50d6f5
|
@ -3,16 +3,15 @@ import QtQuick.Window 2.2
|
|||
|
||||
Rectangle {
|
||||
id: root
|
||||
property int dpi: Screen.pixelDensity*25.4
|
||||
|
||||
width: 3.7 * dpi
|
||||
height: 1 * dpi
|
||||
width: Screen.width * 0.2
|
||||
height: Screen.height * 0.1
|
||||
|
||||
signal dismissed()
|
||||
|
||||
signal invoked()
|
||||
|
||||
function update(nTitle, bBody, nImage, nAppIcon, color, textColor)
|
||||
function update(nTitle, bBody, nImage, nAppIcon, color, textColor, isUpdate)
|
||||
{
|
||||
title.text = nTitle
|
||||
title.color = textColor
|
||||
|
@ -24,12 +23,16 @@ Rectangle {
|
|||
|
||||
|
||||
var id = window.id
|
||||
var space = (id + 1) * dpi * 0.025
|
||||
var space = (id + 1) * height * 0.025
|
||||
|
||||
window.y = space + (space + height) * id
|
||||
animation.target = window
|
||||
animation.from = Screen.desktopAvailableWidth
|
||||
animation.to = Screen.desktopAvailableWidth - width
|
||||
animation.start()
|
||||
if (!isUpdate) {
|
||||
animation.start()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -54,7 +57,7 @@ Rectangle {
|
|||
height: 14
|
||||
color: "#000000"
|
||||
|
||||
text: qsTr("Title")
|
||||
text: "Title"
|
||||
font.pointSize: 10
|
||||
font.bold: true
|
||||
anchors.right: closeButton.left
|
||||
|
@ -68,7 +71,7 @@ Rectangle {
|
|||
Text {
|
||||
id: body
|
||||
color: "#000000"
|
||||
text: qsTr("Body")
|
||||
text: "Body"
|
||||
font.pointSize: 10
|
||||
anchors.right: appIcon.left
|
||||
anchors.rightMargin: 5
|
||||
|
@ -79,7 +82,7 @@ Rectangle {
|
|||
anchors.left: image.right
|
||||
anchors.leftMargin: 5
|
||||
wrapMode: Text.WordWrap
|
||||
maximumLineCount: 4
|
||||
maximumLineCount: root.height / font.pointSize
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
|
||||
}
|
||||
|
|
|
@ -74,13 +74,6 @@ NotifyWidget::~NotifyWidget()
|
|||
}
|
||||
|
||||
void NotifyWidget::display(const Notification ¬ification)
|
||||
{
|
||||
update(notification);
|
||||
snoreDebug(SNORE_DEBUG) << notification.id();
|
||||
show();
|
||||
}
|
||||
|
||||
void NotifyWidget::update(const Notification ¬ification)
|
||||
{
|
||||
snoreDebug(SNORE_DEBUG) << m_id << notification.id();
|
||||
m_notification = notification;
|
||||
|
@ -100,9 +93,13 @@ void NotifyWidget::update(const Notification ¬ification)
|
|||
Q_ARG(QVariant, QUrl::fromLocalFile(notification.icon().localUrl())),
|
||||
Q_ARG(QVariant, QUrl::fromLocalFile(notification.application().icon().localUrl())),
|
||||
Q_ARG(QVariant, color),
|
||||
Q_ARG(QVariant, textColor));
|
||||
Q_ARG(QVariant, textColor),
|
||||
Q_ARG(QVariant, notification.isUpdate()));
|
||||
snoreDebug(SNORE_DEBUG) << notification.id();
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
bool NotifyWidget::acquire()
|
||||
{
|
||||
bool out = false;
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
~NotifyWidget();
|
||||
|
||||
void display(const Snore::Notification ¬ification);
|
||||
void update(const Snore::Notification ¬ification);
|
||||
|
||||
bool acquire();
|
||||
bool release();
|
||||
|
|
|
@ -46,7 +46,7 @@ void SnoreNotifier::slotNotify(Snore::Notification notification)
|
|||
NotifyWidget *w = m_widgets[notification.old().hints().privateValue(this, "id").toInt()];
|
||||
if (w->isVisible() && w->notification().isValid() && w->notification().id() == notification.old().id()) {
|
||||
snoreDebug(SNORE_DEBUG) << "replacing notification" << w->notification().id() << notification.id();
|
||||
w->update(notification);
|
||||
w->display(notification);
|
||||
notification.hints().setPrivateValue(this, "id", w->id());
|
||||
startTimeout(notification);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue