Install sys tray icons
This commit is contained in:
@@ -151,6 +151,11 @@
|
||||
96. 25% larger items in playqueue. Incrases covers from 32px to 40px
|
||||
97. Fix replay-gain scanner if file name, or path, contains non-latin1
|
||||
characters.
|
||||
98. Instal Ubuntu mono sys-tray icons to
|
||||
$prefix/share/icons/ubuntu-mono-dark/apps/22/cantata-panel.svg and
|
||||
$prefix/share/icons/ubuntu-mono-light/apps/22/cantata-panel.svg.
|
||||
But only if compiled for Ubuntu, or -DINSTALL_UBUNTU_ICONS=ON is passed to
|
||||
cmake.
|
||||
|
||||
1.3.4
|
||||
-----
|
||||
|
||||
@@ -97,15 +97,11 @@ void TrayItem::setup()
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_MAC
|
||||
QString iconFile=CANTATA_SYS_ICONS_DIR+QIcon::themeName()+QLatin1String("/systray.svg");
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
trayItem = new KStatusNotifierItem(this);
|
||||
trayItem->setCategory(KStatusNotifierItem::ApplicationStatus);
|
||||
trayItem->setTitle(i18n("Cantata"));
|
||||
trayItem->setIconByName(!iconFile.isEmpty() && QFile::exists(iconFile) ? iconFile : QLatin1String("cantata"));
|
||||
trayItem->setIconByName(QIcon::hasThemeIcon("cantata-panel") ? QLatin1String("cantata-panel") : QLatin1String("cantata"));
|
||||
trayItem->setToolTip("cantata", i18n("Cantata"), QString());
|
||||
|
||||
trayItemMenu = new KMenu(0);
|
||||
@@ -140,13 +136,7 @@ void TrayItem::setup()
|
||||
trayItemMenu->addSeparator();
|
||||
trayItemMenu->addAction(mw->quitAction);
|
||||
trayItem->setContextMenu(trayItemMenu);
|
||||
Icon icon;
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_MAC
|
||||
if (QFile::exists(iconFile)) {
|
||||
icon.addFile(iconFile);
|
||||
}
|
||||
#endif
|
||||
trayItem->setIcon(icon.isNull() || icon.pixmap(16, 16).isNull() ? Icons::self()->appIcon : icon);
|
||||
trayItem->setIcon(QIcon::hasThemeIcon("cantata-panel") ? Icon("cantata-panel") : Icons::self()->appIcon);
|
||||
trayItem->setToolTip(i18n("Cantata"));
|
||||
trayItem->show();
|
||||
connect(trayItem, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayItemClicked(QSystemTrayIcon::ActivationReason)));
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
if (WIN32 OR APPLE)
|
||||
install(FILES cantata.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/icons)
|
||||
else (WIN32 OR APPLE)
|
||||
macro (update_iconcache)
|
||||
macro (update_iconcache ICON_THEME)
|
||||
# Update mtime of hicolor icon theme dir.
|
||||
# We don't always have touch command (e.g. on Windows), so instead create
|
||||
# and delete a temporary file in the theme dir.
|
||||
install(CODE "
|
||||
set(DESTDIR_VALUE \"\$ENV{DESTDIR}\")
|
||||
if (NOT DESTDIR_VALUE)
|
||||
file(WRITE \"${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/temp.txt\" \"update\")
|
||||
file(REMOVE \"${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/temp.txt\")
|
||||
file(WRITE \"${CMAKE_INSTALL_PREFIX}/share/icons/${ICON_THEME}/temp.txt\" \"update\")
|
||||
file(REMOVE \"${CMAKE_INSTALL_PREFIX}/share/icons/${ICON_THEME}/temp.txt\")
|
||||
endif (NOT DESTDIR_VALUE)
|
||||
")
|
||||
endmacro (update_iconcache)
|
||||
@@ -25,10 +25,28 @@
|
||||
install(FILES cantata48.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps RENAME cantata.png)
|
||||
install(FILES cantata64.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/64x64/apps RENAME cantata.png)
|
||||
|
||||
install(FILES trayicon-mono-dark.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${CMAKE_PROJECT_NAME}/icons/ubuntu-mono-light RENAME systray.svg)
|
||||
install(FILES trayicon-mono-light.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${CMAKE_PROJECT_NAME}/icons/ubuntu-mono-dark RENAME systray.svg)
|
||||
update_iconcache(hicolor)
|
||||
|
||||
if (EXISTS /etc/lsb-release)
|
||||
file(READ "/etc/lsb-release" LSB_RELEASE_CONTENTS)
|
||||
string(REGEX MATCH "DISTRIB_ID=Ubuntu" IS_UBUNTU ${LSB_RELEASE_CONTENTS})
|
||||
if (IS_UBUNTU)
|
||||
set(INSTALL_UBUNTU_ICONS_DEFAULT ON)
|
||||
else(IS_UBUNTU)
|
||||
set(INSTALL_UBUNTU_ICONS_DEFAULT OFF)
|
||||
endif(IS_UBUNTU)
|
||||
else(EXISTS /etc/lsb-release)
|
||||
set(INSTALL_UBUNTU_ICONS_DEFAULT OFF)
|
||||
endif(EXISTS /etc/lsb-release)
|
||||
option(INSTALL_UBUNTU_ICONS "Install the Ubuntu themed monochrome panel icons" ${INSTALL_UBUNTU_ICONS_DEFAULT})
|
||||
|
||||
if (INSTALL_UBUNTU_ICONS)
|
||||
install(FILES trayicon-mono-dark.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/ubuntu-mono-light/apps/22 RENAME cantata-panel.svg)
|
||||
install(FILES trayicon-mono-light.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/ubuntu-mono-dark/apps/22 RENAME cantata-panel.svg)
|
||||
update_iconcache(ubuntu-mono-light)
|
||||
update_iconcache(ubuntu-mono-dark)
|
||||
endif (INSTALL_UBUNTU_ICONS)
|
||||
|
||||
update_iconcache()
|
||||
endif (WIN32 OR APPLE)
|
||||
#endif (ENABLE_KDE_SUPPORT)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user