mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-29 15:12:21 +08:00
commit
d3e4f75254
@ -12,7 +12,7 @@ TRANSLATIONS = ./trans/spark-store_en.ts \
|
|||||||
./trans/spark-store_fr.ts\
|
./trans/spark-store_fr.ts\
|
||||||
|
|
||||||
CONFIG += link_pkgconfig
|
CONFIG += link_pkgconfig
|
||||||
PKGCONFIG += dtkwidget
|
PKGCONFIG += dtkwidget glib-2.0 gdk-pixbuf-2.0 libnotify
|
||||||
|
|
||||||
TARGET = spark-store
|
TARGET = spark-store
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
33
widget.cpp
33
widget.cpp
@ -1,3 +1,4 @@
|
|||||||
|
#include <libnotify/notify.h>
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "ui_widget.h"
|
#include "ui_widget.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -110,11 +111,13 @@ Widget::Widget(DBlurEffectWidget *parent) :
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
notify_init(tr("Spark\\ Store").toLocal8Bit());
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
{
|
{
|
||||||
|
notify_uninit();
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
qDebug()<<"exit";
|
qDebug()<<"exit";
|
||||||
DApplication::quit();
|
DApplication::quit();
|
||||||
@ -301,20 +304,32 @@ DTitlebar* Widget::getTitlebar()
|
|||||||
return ui->titlebar;
|
return ui->titlebar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NotifyNotification *_notify = nullptr;
|
||||||
|
|
||||||
void Widget::sendNotification(const QString &message, const int msTimeout, const QString &icon)
|
void Widget::sendNotification(const QString &message, const int msTimeout, const QString &icon)
|
||||||
{
|
{
|
||||||
system((QString("notify-send --icon=%1 --expire-time=%2 --app-name=").arg(icon).arg(msTimeout) +
|
if(_notify == nullptr)
|
||||||
tr("Spark\\ Store") +
|
{
|
||||||
" '" + message + "'"
|
_notify = notify_notification_new(tr("Spark\\ Store").toLocal8Bit(), message.toLocal8Bit(), icon.toLocal8Bit());
|
||||||
).toUtf8());
|
notify_notification_set_timeout(_notify, msTimeout);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
notify_notification_update(_notify, tr("Spark\\ Store").toLocal8Bit(), message.toLocal8Bit(), icon.toLocal8Bit());
|
||||||
|
|
||||||
|
notify_notification_show(_notify, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::sendNotification(const char *message, const int msTimeout, const QString &icon)
|
void Widget::sendNotification(const char *message, const int msTimeout, const QString &icon)
|
||||||
{
|
{
|
||||||
system((QString("notify-send --icon=%1 --expire-time=%2 --app-name=").arg(icon).arg(msTimeout) +
|
if(_notify == nullptr)
|
||||||
tr("Spark\\ Store") +
|
{
|
||||||
" '" + message + "'"
|
_notify = notify_notification_new(tr("Spark\\ Store").toLocal8Bit(), message, icon.toLocal8Bit());
|
||||||
).toUtf8());
|
notify_notification_set_timeout(_notify, msTimeout);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
notify_notification_update(_notify, tr("Spark\\ Store").toLocal8Bit(), message, icon.toLocal8Bit());
|
||||||
|
|
||||||
|
notify_notification_show(_notify, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::updateUI()
|
void Widget::updateUI()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user