mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-09 09:00:18 +08:00
添加chatGPT帮忙写的通知推送
This commit is contained in:
26
src/utils/utils.cpp
Normal file
26
src/utils/utils.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "utils.h"
|
||||
|
||||
Utils::Utils()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//这个函数是chatGPT写的
|
||||
void Utils::sendNotification(QString icon,QString title,QString body)
|
||||
{
|
||||
QDBusInterface iface("org.freedesktop.Notifications",
|
||||
"/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications");
|
||||
|
||||
QVariantList args;
|
||||
args << QCoreApplication::applicationName() // the name of the application
|
||||
<< (uint)0 // replaces the previous notification with the same ID
|
||||
<< icon // the application icon of the notification
|
||||
<< title // the title of the notification
|
||||
<< body // the body of the notification
|
||||
<< QStringList() // no actions
|
||||
<< QVariantMap() // no hints
|
||||
<< -1; // no timeout
|
||||
|
||||
iface.callWithArgumentList(QDBus::AutoDetect, "Notify", args);
|
||||
}
|
||||
Reference in New Issue
Block a user