Browse Source

Merge branch 'pr1610'

pull/1613/head
tux3 10 years ago
parent
commit
9d84462c65
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
  1. 12
      src/widget/systemtrayicon.cpp
  2. 7
      src/widget/widget.cpp

12
src/widget/systemtrayicon.cpp

@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
#include <QMenu>
#include <QFile>
#include <QDebug>
#include <QPainter>
#include <QBitmap>
#include "src/misc/settings.h"
SystemTrayIcon::SystemTrayIcon()
@ -388,6 +390,16 @@ void SystemTrayIcon::setIcon(QIcon &icon) @@ -388,6 +390,16 @@ void SystemTrayIcon::setIcon(QIcon &icon)
#endif
else if (backendType == SystrayBackendType::Qt)
{
#ifdef Q_OS_MAC
// Since Qt doesn't render SVG tray icons for OSX
// we are forced to do this sort of a workaround!
QPixmap quirk(64, 64);
quirk.fill(Qt::transparent);
QPainter quirker(&quirk);
icon.paint(&quirker, 0, 0, 64, 64);
icon = QIcon(quirk);
#endif
qtIcon->setIcon(icon);
}
}

7
src/widget/widget.cpp

@ -301,7 +301,7 @@ void Widget::updateIcons() @@ -301,7 +301,7 @@ void Widget::updateIcons()
if (ico.isNull())
{
QString color = Settings::getInstance().getLightTrayIcon() ? "light" : "dark";
ico = QIcon(":img/taskbar/" + color + "/taskbar_" + status + ".svg");
ico = QIcon(":/img/taskbar/" + color + "/taskbar_" + status + ".svg");
}
setWindowIcon(ico);
@ -489,6 +489,11 @@ void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason) @@ -489,6 +489,11 @@ void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason)
{
case QSystemTrayIcon::Trigger:
{
#if defined(Q_OS_MAC)
// We don't want to raise/minimize a window on icon click in OS X
break;
#endif
if (isHidden())
{
show();

Loading…
Cancel
Save