Changeset View
Changeset View
Standalone View
Standalone View
src/notifybysnore.cpp
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Line(s) | 142 | { | |||
---|---|---|---|---|---|
145 | 145 | | |||
146 | arguments << QStringLiteral("-t"); | 146 | arguments << QStringLiteral("-t"); | ||
147 | if (!notification->title().isEmpty()) { | 147 | if (!notification->title().isEmpty()) { | ||
148 | arguments << notification->title(); | 148 | arguments << notification->title(); | ||
149 | } else { | 149 | } else { | ||
150 | arguments << qApp->applicationDisplayName(); | 150 | arguments << qApp->applicationDisplayName(); | ||
151 | } | 151 | } | ||
152 | arguments << QStringLiteral("-m") << notification->text(); | 152 | arguments << QStringLiteral("-m") << notification->text(); | ||
153 | const QString iconPath = m_iconDir.path() + QLatin1Char('/') | ||||
154 | + QString::number(notification->id()) + QStringLiteral(".png"); | ||||
153 | if (!notification->pixmap().isNull()) { | 155 | if (!notification->pixmap().isNull()) { | ||
154 | auto iconPath = QString(m_iconDir.path() + QLatin1Char('/') | | |||
155 | + QString::number(notification->id()) + QStringLiteral(".png")); | | |||
156 | notification->pixmap().save(iconPath, "PNG"); | 156 | notification->pixmap().save(iconPath, "PNG"); | ||
157 | arguments << QStringLiteral("-p") << iconPath; | 157 | arguments << QStringLiteral("-p") << iconPath; | ||
158 | } else if (!qApp->windowIcon().isNull()) { | ||||
159 | QIcon app_icon = qApp->windowIcon(); | ||||
160 | // We limit the icon size to 1024x1024 as it is the highest supported by Windows | ||||
161 | QPixmap pixmap = app_icon.pixmap(1024, 1024); | ||||
162 | pixmap.save(iconPath, "PNG"); | ||||
163 | arguments << QStringLiteral("-p") << iconPath; | ||||
158 | } | 164 | } | ||
159 | arguments << QStringLiteral("-appID") << qApp->applicationName() | 165 | arguments << QStringLiteral("-appID") << qApp->applicationName() | ||
160 | << QStringLiteral("-pid") << QString::number(qApp->applicationPid()) | 166 | << QStringLiteral("-pid") << QString::number(qApp->applicationPid()) | ||
161 | << QStringLiteral("-id") << QString::number(notification->id()) | 167 | << QStringLiteral("-id") << QString::number(notification->id()) | ||
162 | << QStringLiteral("-pipename") << m_server.fullServerName(); | 168 | << QStringLiteral("-pipename") << m_server.fullServerName(); | ||
163 | 169 | | |||
164 | if (!notification->actions().isEmpty()) { | 170 | if (!notification->actions().isEmpty()) { | ||
165 | arguments << QStringLiteral("-b") << notification->actions().join(QLatin1Char(';')); | 171 | arguments << QStringLiteral("-b") << notification->actions().join(QLatin1Char(';')); | ||
Show All 37 Lines |