Changeset View
Changeset View
Standalone View
Standalone View
src/notifybysnore.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | Copyright (C) 2019 Piyush Aggarwal <piyushaggarwal002@gmail.com> | 2 | Copyright (C) 2019 Piyush Aggarwal <piyushaggarwal002@gmail.com> | ||
broulik: Did you even compile this?
Also, this is the same in both branches, move it above the `if` and… | |||||
3 | 3 | | |||
4 | This program is free software; you can redistribute it and/or modify it | 4 | This program is free software; you can redistribute it and/or modify it | ||
broulik: Check for `isNull()` | |||||
5 | under the terms of the GNU Library General Public License as published by | 5 | under the terms of the GNU Library General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or (at your | 6 | the Free Software Foundation; either version 2 of the License, or (at your | ||
broulik: The explicit call to `actualSize` shouldn't be neccessary | |||||
just to be sure :) but if there's a check implemented already somewhere within QIcon, I'd happily remove it from here! brute4s99: just to be sure :)
but if there's a check implemented already somewhere within QIcon, I'd… | |||||
7 | option) any later version. | 7 | option) any later version. | ||
8 | 8 | | |||
broulik: Whitespace | |||||
9 | This program is distributed in the hope that it will be useful, but WITHOUT | 9 | This program is distributed in the hope that it will be useful, but WITHOUT | ||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||
12 | License for more details. | 12 | License for more details. | ||
13 | 13 | | |||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <https://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
▲ Show 20 Lines • Show All 128 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; | ||
sredman: Whitespace | |||||
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 | ||||
sredman: Indentation | |||||
161 | QPixmap pixmap = app_icon.pixmap(app_icon.actualSize(QSize(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 |
Did you even compile this?
Also, this is the same in both branches, move it above the if and also make it const