Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit bfeddfdb authored by Stephan Kulow's avatar Stephan Kulow

merge in the branch that renamed KSystemTray to KSystemTrayIcon

and made it derived from QSystemTrayIcon (which is no longer a
widget). I put some #warnings in where code is too heavily bound
to that assumption 

svn path=/trunk/KDE/kdemultimedia/juk/; revision=565761
parents 382d567d 41629c76
......@@ -151,7 +151,7 @@ void PassiveInfo::leaveEvent(QEvent *)
// public methods
////////////////////////////////////////////////////////////////////////////////
SystemTray::SystemTray(QWidget *parent) : KSystemTray(parent),
SystemTray::SystemTray(QWidget *parent) : KSystemTrayIcon(parent),
m_popup(0),
m_fadeTimer(0),
m_fade(true)
......@@ -166,10 +166,10 @@ SystemTray::SystemTray(QWidget *parent) : KSystemTray(parent),
m_playPix = createPixmap("player_play");
m_pausePix = createPixmap("player_pause");
m_forwardPix = loadIcon("player_end");
m_backPix = loadIcon("player_start");
m_forwardPix = loadIcon("player_end").pixmap();
m_backPix = loadIcon("player_start").pixmap();
setPixmap(m_appPix);
setIcon(m_appPix);
setToolTip();
......@@ -228,7 +228,7 @@ void SystemTray::slotPlay()
QPixmap cover = PlayerManager::instance()->playingFile().coverInfo()->pixmap(CoverInfo::Thumbnail);
setPixmap(m_playPix);
setIcon(m_playPix);
setToolTip(PlayerManager::instance()->playingString(), cover);
createPopup();
}
......@@ -252,7 +252,7 @@ void SystemTray::slotPopupLargeCover()
void SystemTray::slotStop()
{
setPixmap(m_appPix);
setIcon(m_appPix);
setToolTip();
delete m_popup;
......@@ -373,7 +373,8 @@ void SystemTray::createPopup()
m_fade = true;
m_step = 0;
m_popup = new PassiveInfo(this);
#warning FIXME: this won't be associated with the systray any longer
m_popup = new PassiveInfo(0);
connect(m_popup, SIGNAL(destroyed()), SLOT(slotPopupDestroyed()));
connect(m_popup, SIGNAL(timeExpired()), SLOT(slotFadeOut()));
......@@ -428,7 +429,8 @@ bool SystemTray::buttonsToLeft() const
{
// The following code was nicked from kpassivepopup.cpp
NETWinInfo ni(QX11Info::display(), winId(), QX11Info::appRootWindow(),
#warning the systray is no longer a widget
NETWinInfo ni(QX11Info::display(), /* winId() */ 0, QX11Info::appRootWindow(),
NET::WMIconGeometry | NET::WMKDESystemTrayWinFor);
NETRect frame, win;
ni.kdeGeometry(frame, win);
......@@ -442,7 +444,7 @@ bool SystemTray::buttonsToLeft() const
QPixmap SystemTray::createPixmap(const QString &pixName)
{
QImage bgImage = m_appPix.toImage(); // Probably 22x22
QImage bgImage = m_appPix.pixmap().toImage(); // Probably 22x22
QImage fgImage = SmallIcon(pixName).toImage(); // Should be 16x16
KIconEffect::semiTransparent(bgImage);
......@@ -525,10 +527,8 @@ QColor SystemTray::interpolateColor(int step, int steps)
void SystemTray::setToolTip(const QString &tip, const QPixmap &cover)
{
QToolTip::remove(this);
if(tip.isNull())
KSystemTray::setToolTip( i18n("JuK"));
KSystemTrayIcon::setToolTip( i18n("JuK"));
else {
QPixmap myCover = cover;
if(cover.isNull())
......@@ -546,7 +546,7 @@ void SystemTray::setToolTip(const QString &tip, const QPixmap &cover)
QString("<img valign=\"middle\" src=\"tipCover\""),
QString("<nobr>%1</nobr>").arg(tip), i18n("JuK"));
KSystemTray::setToolTip( html);
KSystemTrayIcon::setToolTip( html);
}
}
......@@ -580,23 +580,15 @@ void SystemTray::wheelEvent(QWheelEvent *e)
/*
* Reimplemented this in order to use the middle mouse button
*/
void SystemTray::mousePressEvent(QMouseEvent *e)
void SystemTray::slotActivated(QSystemTrayIcon::ActivationReason reason)
{
switch(e->button()) {
case Qt::LeftButton:
case Qt::RightButton:
default:
KSystemTray::mousePressEvent(e);
break;
case Qt::MidButton:
if(!rect().contains(e->pos()))
return;
if (reason != MiddleClick)
return;
if(action("pause")->isEnabled())
action("pause")->trigger();
else
action("play")->trigger();
break;
}
}
/*
......
......@@ -18,7 +18,7 @@
#ifndef SYSTEMTRAY_H
#define SYSTEMTRAY_H
#include <ksystemtray.h>
#include <ksystemtrayicon.h>
#include <kpassivepopup.h>
#include <q3valuevector.h>
......@@ -28,6 +28,7 @@
#include <QMouseEvent>
#include <QWheelEvent>
#include <QEvent>
#include <QIcon>
class FlickerFreeLabel;
class QTimer;
......@@ -66,7 +67,7 @@ private:
bool m_justDie;
};
class SystemTray : public KSystemTray
class SystemTray : public KSystemTrayIcon
{
Q_OBJECT
......@@ -84,7 +85,8 @@ private:
virtual void wheelEvent(QWheelEvent *e);
void createPopup();
void setToolTip(const QString &tip = QString::null, const QPixmap &cover = QPixmap());
void mousePressEvent(QMouseEvent *e);
void slotActivated(QSystemTrayIcon::ActivationReason reason);
void ousePressEvent(QMouseEvent *e);
QPixmap createPixmap(const QString &pixName);
// Returns true if the popup will need to have its buttons on the left
......@@ -109,7 +111,7 @@ private:
private slots:
void slotPlay();
void slotTogglePopup();
void slotPause() { setPixmap(m_pausePix); }
void slotPause() { setIcon(m_pausePix); }
void slotStop();
void slotPopupDestroyed();
void slotNextStep(); ///< This is the fading routine.
......@@ -125,7 +127,7 @@ private:
QPixmap m_currentPix;
QPixmap m_backPix;
QPixmap m_forwardPix;
QPixmap m_appPix;
QIcon m_appPix;
QColor m_startColor, m_endColor;
PassiveInfo *m_popup;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment