linux fixes
This commit is contained in:
parent
4d92fb8afc
commit
fd37a449b0
|
@ -27,8 +27,9 @@
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
NotifyWidget::NotifyWidget(int pos,QWidget *parent) :
|
NotifyWidget::NotifyWidget(int pos,QWidget *parent) :
|
||||||
QWidget(parent, Qt::SplashScreen | Qt::WindowStaysOnTopHint),
|
QWidget(parent, Qt::Popup | Qt::WindowStaysOnTopHint),
|
||||||
ui(new Ui::NotifyWidget),
|
ui(new Ui::NotifyWidget),
|
||||||
|
m_moveTimer(new QTimer(this)),
|
||||||
m_desktop(QDesktopWidget().availableGeometry()),
|
m_desktop(QDesktopWidget().availableGeometry()),
|
||||||
m_id(pos),
|
m_id(pos),
|
||||||
m_mem(QString("SnoreNotifyWidget%1").arg(QString::number(m_id))),
|
m_mem(QString("SnoreNotifyWidget%1").arg(QString::number(m_id))),
|
||||||
|
@ -62,6 +63,11 @@ NotifyWidget::NotifyWidget(int pos,QWidget *parent) :
|
||||||
|
|
||||||
m_dest = QPoint(m_desktop.topRight().x() - width(), m_desktop.topRight().y() + m_scaler->scaledY(10) + (m_scaler->scaledY(10) + height()) * pos);
|
m_dest = QPoint(m_desktop.topRight().x() - width(), m_desktop.topRight().y() + m_scaler->scaledY(10) + (m_scaler->scaledY(10) + height()) * pos);
|
||||||
m_start = QPoint(m_desktop.topRight().x(), m_dest.y());
|
m_start = QPoint(m_desktop.topRight().x(), m_dest.y());
|
||||||
|
snoreDebug( SNORE_DEBUG ) << m_dest << m_start << size();
|
||||||
|
|
||||||
|
m_moveTimer->setInterval(2);
|
||||||
|
connect( m_moveTimer, SIGNAL(timeout()), this, SLOT(slotMove()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyWidget::~NotifyWidget()
|
NotifyWidget::~NotifyWidget()
|
||||||
|
@ -72,20 +78,19 @@ NotifyWidget::~NotifyWidget()
|
||||||
|
|
||||||
void NotifyWidget::display(const Notification ¬ification)
|
void NotifyWidget::display(const Notification ¬ification)
|
||||||
{
|
{
|
||||||
update(notification);
|
update(notification);
|
||||||
|
m_dist = 0;
|
||||||
|
m_moveTimer->start();
|
||||||
|
snoreDebug( SNORE_DEBUG ) << notification.id();
|
||||||
move(m_start);
|
move(m_start);
|
||||||
show();
|
show();
|
||||||
m_moveTimer = new QTimer(this);
|
|
||||||
m_moveTimer->setInterval(2);
|
|
||||||
connect( m_moveTimer, SIGNAL(timeout()), this, SLOT(slotMove()));
|
|
||||||
m_moveTimer->start();
|
|
||||||
snoreDebug( SNORE_DEBUG ) << notification;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyWidget::update(const Notification ¬ification)
|
void NotifyWidget::update(const Notification ¬ification)
|
||||||
{
|
{
|
||||||
m_notification = notification;
|
m_notification = notification;
|
||||||
|
snoreDebug( SNORE_DEBUG ) << notification.id();
|
||||||
ui->titel->setText(notification.title());
|
ui->titel->setText(notification.title());
|
||||||
ui->body->setText(notification.text());
|
ui->body->setText(notification.text());
|
||||||
|
|
||||||
|
@ -132,6 +137,7 @@ bool NotifyWidget::release()
|
||||||
out = true;
|
out = true;
|
||||||
}
|
}
|
||||||
m_mem.unlock();
|
m_mem.unlock();
|
||||||
|
hide();
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -148,23 +154,22 @@ int NotifyWidget::id()
|
||||||
|
|
||||||
void NotifyWidget::slotMove()
|
void NotifyWidget::slotMove()
|
||||||
{
|
{
|
||||||
move(pos().x()-1, pos().y());
|
QPoint dest(m_start.x() - m_dist++, m_start.y());
|
||||||
if(m_dest == pos())
|
move(dest);
|
||||||
|
if(m_dist >= width())
|
||||||
{
|
{
|
||||||
m_moveTimer->deleteLater();
|
m_moveTimer->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyWidget::on_closeButton_clicked()
|
void NotifyWidget::on_closeButton_clicked()
|
||||||
{
|
{
|
||||||
emit dismissed();
|
emit dismissed();
|
||||||
hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyWidget::mousePressEvent(QMouseEvent *)
|
void NotifyWidget::mousePressEvent(QMouseEvent *)
|
||||||
{
|
{
|
||||||
emit invoked();
|
emit invoked();
|
||||||
hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyWidget::setPalette(const QImage &img)
|
void NotifyWidget::setPalette(const QImage &img)
|
||||||
|
@ -198,3 +203,8 @@ void NotifyWidget::setPalette(const QImage &img)
|
||||||
ui->body->setPalette(p);
|
ui->body->setPalette(p);
|
||||||
ui->titel->setPalette(p);
|
ui->titel->setPalette(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotifyWidget::on_body_linkActivated(const QString &link)
|
||||||
|
{
|
||||||
|
snoreDebug( SNORE_DEBUG ) << link;
|
||||||
|
}
|
||||||
|
|
|
@ -60,6 +60,8 @@ private slots:
|
||||||
|
|
||||||
void on_closeButton_clicked();
|
void on_closeButton_clicked();
|
||||||
|
|
||||||
|
void on_body_linkActivated(const QString &link);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *e);
|
void mousePressEvent(QMouseEvent *e);
|
||||||
|
|
||||||
|
@ -72,6 +74,7 @@ private:
|
||||||
QTimer *m_moveTimer;
|
QTimer *m_moveTimer;
|
||||||
QPoint m_dest;
|
QPoint m_dest;
|
||||||
QPoint m_start;
|
QPoint m_start;
|
||||||
|
int m_dist;
|
||||||
QRect m_desktop;
|
QRect m_desktop;
|
||||||
TomahawkUtils::DpiScaler *m_scaler;
|
TomahawkUtils::DpiScaler *m_scaler;
|
||||||
Snore::Notification m_notification;
|
Snore::Notification m_notification;
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
@ -185,9 +185,6 @@
|
||||||
<property name="indent">
|
<property name="indent">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
Loading…
Reference in New Issue