fixed spacing, and make it possible to change screen resolution

This commit is contained in:
Patrick von Reth 2014-07-03 14:39:36 +02:00
parent a248773ed8
commit ff73367efb
2 changed files with 10 additions and 6 deletions

View File

@ -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 &notification)
void NotifyWidget::update(const Notification &notification)
{
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);

View File

@ -71,7 +71,6 @@ private:
QPoint m_dest;
QPoint m_start;
int m_dist;
QRect m_desktop;
Snore::Notification m_notification;
QObject *qmlNotification;