mirror of
https://github.com/status-im/snorenotify.git
synced 2025-01-09 16:15:45 +00:00
this is ugly but it removes the dependency to kicontheme
This commit is contained in:
parent
875a3e44c3
commit
a789650460
@ -2,7 +2,4 @@
|
||||
<qresource prefix="/root">
|
||||
<file>snore.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/root/images">
|
||||
<file>freedesktop-dbus.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -1,6 +1,5 @@
|
||||
if(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND)
|
||||
message(STATUS "Adding freedesktop notification frontend")
|
||||
find_package(KF5 COMPONENTS IconThemes)
|
||||
|
||||
set( FREEDESKTOP_NOTIFICATION_FRONTEND_SRC
|
||||
freedesktopnotificationfrontend.cpp
|
||||
@ -12,10 +11,6 @@ if(QT_QTDBUS_FOUND AND WITH_FREEDESKTOP_FRONTEND)
|
||||
add_library(libsnore_frontend_freedesktop MODULE ${FREEDESKTOP_NOTIFICATION_FRONTEND_SRC} )
|
||||
target_link_libraries(libsnore_frontend_freedesktop Snore::Libsnore ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY} )
|
||||
|
||||
if(KF5_IconThemes_FOUND)
|
||||
target_link_libraries(libsnore_frontend_freedesktop KF5::IconThemes)
|
||||
endif()
|
||||
|
||||
|
||||
#install the dbus interface
|
||||
if(WITH_SNORE_DEAMON)
|
||||
|
@ -28,10 +28,8 @@
|
||||
#include <QtCore>
|
||||
#include <QtDBus>
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
|
||||
#ifdef HAVE_KDE5
|
||||
#include <KIconThemes/KIconLoader>
|
||||
#endif
|
||||
using namespace Snore;
|
||||
|
||||
Q_EXPORT_PLUGIN2(libsnore_frontend_freedesktop,FreedesktopFrontend)
|
||||
@ -103,17 +101,21 @@ uint FreedesktopFrontend::Notify(const QString &app_name, uint replaces_id,
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = Icon(":/root/images/freedesktop-dbus.png");
|
||||
icon = Icon(":/root/snore.png");
|
||||
}
|
||||
|
||||
if(!snore()->aplications().contains(app_name))
|
||||
{
|
||||
#ifdef HAVE_KDE5
|
||||
Icon appIcon(KIconLoader::global()->iconPath(app_icon, KIconLoader::Desktop));
|
||||
#else
|
||||
Q_UNUSED(app_icon);
|
||||
Icon appIcon(":/root/images/freedesktop-dbus.png");
|
||||
#endif
|
||||
qDebug() << QIcon::themeSearchPaths();
|
||||
QIcon qicon = QIcon::fromTheme(app_icon, QIcon(":/root/snore.png") );
|
||||
QSize max;
|
||||
foreach (const QSize &s, qicon.availableSizes()) {
|
||||
if(s.width()*s.height()>max.width()*max.height())
|
||||
{
|
||||
max = s;
|
||||
}
|
||||
}
|
||||
Icon appIcon( qicon.pixmap( max ).toImage());
|
||||
Alert alert("DBus Alert", appIcon);
|
||||
app = Application(app_name, appIcon);
|
||||
app.addAlert(alert);
|
||||
|
Loading…
x
Reference in New Issue
Block a user