mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-10 16:45:56 +00:00
fixed spacing, and make it possible to change screen resolution
This commit is contained in:
parent
a248773ed8
commit
ff73367efb
@ -32,7 +32,6 @@ using namespace Snore;
|
||||
NotifyWidget::NotifyWidget(int pos,QWidget *parent) :
|
||||
QDeclarativeView(QUrl("qrc:/notification.qml"), parent),
|
||||
m_moveTimer(new QTimer(this)),
|
||||
m_desktop(QDesktopWidget().availableGeometry()),
|
||||
m_id(pos),
|
||||
m_mem(QString("SnoreNotifyWidget%1").arg(QString::number(m_id))),
|
||||
m_ready(true)
|
||||
@ -65,11 +64,7 @@ NotifyWidget::NotifyWidget(int pos,QWidget *parent) :
|
||||
|
||||
|
||||
setResizeMode(QDeclarativeView::SizeRootObjectToView);
|
||||
float scale = 96.0;
|
||||
resize(width() * logicalDpiX() / scale, height() * logicalDpiY() / scale);
|
||||
|
||||
m_dest = QPoint(m_desktop.topRight().x() - width(), m_desktop.topRight().y() + 10 + 10 + height() * pos);
|
||||
m_start = QPoint(m_desktop.topRight().x(), m_dest.y());
|
||||
|
||||
m_moveTimer->setInterval(1);
|
||||
connect( m_moveTimer, SIGNAL(timeout()), this, SLOT(slotMove()));
|
||||
@ -96,6 +91,16 @@ void NotifyWidget::display(const Notification ¬ification)
|
||||
void NotifyWidget::update(const Notification ¬ification)
|
||||
{
|
||||
m_notification = notification;
|
||||
|
||||
QRect desktop = QDesktopWidget().availableGeometry();
|
||||
float scale = 96.0;
|
||||
resize(width() * logicalDpiX() / scale, height() * logicalDpiY() / scale);
|
||||
|
||||
int space = 10 * logicalDpiY() / scale;
|
||||
|
||||
m_dest = QPoint(desktop.topRight().x() - width(), desktop.topRight().y() + space + (space + height()) * m_id);
|
||||
m_start = QPoint(desktop.topRight().x(), m_dest.y());
|
||||
|
||||
QColor color = computeBackgrondColor(notification.application().icon().image());
|
||||
QRgb gray = qGray(qGray(color.rgb()) - qGray(QColor(Qt::white).rgb()));
|
||||
QColor textColor = QColor(gray, gray, gray);
|
||||
|
@ -71,7 +71,6 @@ private:
|
||||
QPoint m_dest;
|
||||
QPoint m_start;
|
||||
int m_dist;
|
||||
QRect m_desktop;
|
||||
Snore::Notification m_notification;
|
||||
|
||||
QObject *qmlNotification;
|
||||
|
Loading…
x
Reference in New Issue
Block a user