Use mono system tray icon underUnity if icon theme is ubuntu-mono-light or ubuntu-mono-dark.

This commit is contained in:
craig.p.drummond
2014-01-30 19:26:37 +00:00
committed by craig.p.drummond
parent 1f3c1bca21
commit 109ad2bc01
4 changed files with 34 additions and 2 deletions

View File

@@ -108,6 +108,8 @@
64. Fix searches containing more than 4 words.
65. Use stretch header class from Clementine for table style views.
66. Dont change tray icon to play state - consistent with other apps.
67. Use mono system tray icon underUnity if icon theme is ubuntu-mono-light or
ubuntu-mono-dark.
1.2.2
-----

View File

@@ -36,6 +36,7 @@
#include "icons.h"
#include "song.h"
#include "stdactions.h"
#include "utils.h"
class VolumeSliderEventHandler : public QObject
{
@@ -74,6 +75,7 @@ TrayItem::TrayItem(MainWindow *p)
{
}
#include <QDebug>
void TrayItem::setup()
{
if (!Settings::self()->useSystemTray()) {
@@ -92,11 +94,27 @@ void TrayItem::setup()
if (trayItem) {
return;
}
Icon icon;
#if !defined Q_OS_WIN32 && !defined Q_OS_MAC
if (Utils::Unity==Utils::currentDe()) {
if (QLatin1String("ubuntu-mono-dark")==QIcon::themeName()) {
icon.addFile(":trayicon-mono-light");
} else if (QLatin1String("ubuntu-mono-light")==QIcon::themeName()) {
icon.addFile(":trayicon-mono-dark");
}
}
#endif
#ifdef ENABLE_KDE_SUPPORT
trayItem = new KStatusNotifierItem(this);
trayItem->setCategory(KStatusNotifierItem::ApplicationStatus);
trayItem->setTitle(i18n("Cantata"));
trayItem->setIconByName("cantata");
if (icon.isNull()) {
trayItem->setIconByName("cantata");
} else {
trayItem->setIconByPixmap(icon);
}
trayItem->setToolTip("cantata", i18n("Cantata"), QString());
trayItemMenu = new KMenu(0);
@@ -131,7 +149,7 @@ void TrayItem::setup()
trayItemMenu->addSeparator();
trayItemMenu->addAction(mw->quitAction);
trayItem->setContextMenu(trayItemMenu);
trayItem->setIcon(Icons::self()->appIcon);
trayItem->setIcon(icon.isNull() ? Icons::self()->appIcon : icon);
trayItem->setToolTip(i18n("Cantata"));
trayItem->show();
connect(trayItem, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayItemClicked(QSystemTrayIcon::ActivationReason)));

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" fill="#3c3c3c">
<g id="g2987" transform="matrix(.90823 0 0 .90823 7.2087 5.7018)">
<path id="path58" d="m68.922 24c-2.3928 5.214-1.0894 11.253-2.1097 16.771l-2.0768 27.175c-14.023-6.2639-35.29 3.1797-32.358 14.489 1.1296 10.923 22.818 16.97 35.239 9.5647 11.614-7.2551 7.5155-18.867 9.0737-28.288l1.4472-25.436c6.0508 5.665 14.618 13.627 7.0845 20.535-5.211 2.9891-0.62147 10.073 6.177 7.1799 11.531-6.012 11.731-18.782 2.675-25.939-6.728-5.345-14.503-10.198-21.912-15.149-0.926-0.313-2.022-1.775-3.24-0.903z"/>
<path id="path3090" d="m63.775 3.0296c-34.271 0-62.055 27.784-62.055 62.055s27.784 62.055 62.055 62.055 62.055-27.784 62.055-62.055-27.784-62.055-62.055-62.055zm0 108.6c-25.704 0-46.541-20.837-46.541-46.541s20.837-46.541 46.541-46.541 46.541 20.837 46.541 46.541-20.837 46.541-46.541 46.541z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 881 B

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" fill="#dfdbd2">
<g id="g2987" transform="matrix(.90823 0 0 .90823 7.2087 5.7018)">
<path id="path58" d="m68.922 24c-2.3928 5.214-1.0894 11.253-2.1097 16.771l-2.0768 27.175c-14.023-6.2639-35.29 3.1797-32.358 14.489 1.1296 10.923 22.818 16.97 35.239 9.5647 11.614-7.2551 7.5155-18.867 9.0737-28.288l1.4472-25.436c6.0508 5.665 14.618 13.627 7.0845 20.535-5.211 2.9891-0.62147 10.073 6.177 7.1799 11.531-6.012 11.731-18.782 2.675-25.939-6.728-5.345-14.503-10.198-21.912-15.149-0.926-0.313-2.022-1.775-3.24-0.903z"/>
<path id="path3090" d="m63.775 3.0296c-34.271 0-62.055 27.784-62.055 62.055s27.784 62.055 62.055 62.055 62.055-27.784 62.055-62.055-27.784-62.055-62.055-62.055zm0 108.6c-25.704 0-46.541-20.837-46.541-46.541s20.837-46.541 46.541-46.541 46.541 20.837 46.541 46.541-20.837 46.541-46.541 46.541z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 881 B