summaryrefslogtreecommitdiffstats
path: root/juk/systemtray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'juk/systemtray.cpp')
-rw-r--r--juk/systemtray.cpp172
1 files changed, 86 insertions, 86 deletions
diff --git a/juk/systemtray.cpp b/juk/systemtray.cpp
index 1691bc91..40cdd082 100644
--- a/juk/systemtray.cpp
+++ b/juk/systemtray.cpp
@@ -24,15 +24,15 @@
#include <kglobalsettings.h>
#include <kdebug.h>
-#include <qvbox.h>
-#include <qtimer.h>
-#include <qcolor.h>
-#include <qpushbutton.h>
-#include <qtooltip.h>
-#include <qpainter.h>
-#include <qvaluevector.h>
-#include <qstylesheet.h>
-#include <qpalette.h>
+#include <tqvbox.h>
+#include <tqtimer.h>
+#include <tqcolor.h>
+#include <tqpushbutton.h>
+#include <tqtooltip.h>
+#include <tqpainter.h>
+#include <tqvaluevector.h>
+#include <tqstylesheet.h>
+#include <tqpalette.h>
#include <netwm.h>
@@ -45,59 +45,59 @@
using namespace ActionCollection;
-static bool copyImage(QImage &dest, QImage &src, int x, int y);
+static bool copyImage(TQImage &dest, TQImage &src, int x, int y);
class FlickerFreeLabel : public QLabel
{
public:
- FlickerFreeLabel(const QString &text, QWidget *parent, const char *name = 0) :
- QLabel(text, parent, name)
+ FlickerFreeLabel(const TQString &text, TQWidget *parent, const char *name = 0) :
+ TQLabel(text, parent, name)
{
m_textColor = paletteForegroundColor();
m_bgColor = parentWidget()->paletteBackgroundColor();
setBackgroundMode(NoBackground);
}
- QColor textColor() const
+ TQColor textColor() const
{
return m_textColor;
}
- QColor backgroundColor() const
+ TQColor backgroundColor() const
{
return m_bgColor;
}
protected:
- virtual void drawContents(QPainter *p)
+ virtual void drawContents(TQPainter *p)
{
// We want to intercept the drawContents call and draw on a pixmap
// instead of the window to keep flicker to an absolute minimum.
// Since Qt doesn't refresh the background, we need to do so
// ourselves.
- QPixmap pix(size());
- QPainter pixPainter(&pix);
+ TQPixmap pix(size());
+ TQPainter pixPainter(&pix);
pixPainter.fillRect(rect(), m_bgColor);
- QLabel::drawContents(&pixPainter);
+ TQLabel::drawContents(&pixPainter);
- bitBlt(p->device(), QPoint(0, 0), &pix, rect(), CopyROP);
+ bitBlt(p->device(), TQPoint(0, 0), &pix, rect(), CopyROP);
}
private:
- QColor m_textColor;
- QColor m_bgColor;
+ TQColor m_textColor;
+ TQColor m_bgColor;
};
-PassiveInfo::PassiveInfo(QWidget *parent, const char *name) :
- KPassivePopup(parent, name), m_timer(new QTimer), m_justDie(false)
+PassiveInfo::PassiveInfo(TQWidget *parent, const char *name) :
+ KPassivePopup(parent, name), m_timer(new TQTimer), m_justDie(false)
{
// I'm so sick and tired of KPassivePopup screwing this up
// that I'll just handle the timeout myself, thank you very much.
KPassivePopup::setTimeout(0);
- connect(m_timer, SIGNAL(timeout()), SLOT(timerExpired()));
+ connect(m_timer, TQT_SIGNAL(timeout()), TQT_SLOT(timerExpired()));
}
void PassiveInfo::setTimeout(int delay)
@@ -121,13 +121,13 @@ void PassiveInfo::timerExpired()
emit timeExpired();
}
-void PassiveInfo::enterEvent(QEvent *)
+void PassiveInfo::enterEvent(TQEvent *)
{
m_timer->stop();
emit mouseEntered();
}
-void PassiveInfo::leaveEvent(QEvent *)
+void PassiveInfo::leaveEvent(TQEvent *)
{
m_justDie = true;
m_timer->start(50);
@@ -137,7 +137,7 @@ void PassiveInfo::leaveEvent(QEvent *)
// public methods
////////////////////////////////////////////////////////////////////////////////
-SystemTray::SystemTray(QWidget *parent, const char *name) : KSystemTray(parent, name),
+SystemTray::SystemTray(TQWidget *parent, const char *name) : KSystemTray(parent, name),
m_popup(0),
m_fadeTimer(0),
m_fade(true)
@@ -163,13 +163,13 @@ SystemTray::SystemTray(QWidget *parent, const char *name) : KSystemTray(parent,
// bindings dialog.
new KAction(i18n("Redisplay Popup"), KShortcut(), this,
- SLOT(slotPlay()), actions(), "showPopup");
+ TQT_SLOT(slotPlay()), actions(), "showPopup");
KPopupMenu *cm = contextMenu();
- connect(PlayerManager::instance(), SIGNAL(signalPlay()), this, SLOT(slotPlay()));
- connect(PlayerManager::instance(), SIGNAL(signalPause()), this, SLOT(slotPause()));
- connect(PlayerManager::instance(), SIGNAL(signalStop()), this, SLOT(slotStop()));
+ connect(PlayerManager::instance(), TQT_SIGNAL(signalPlay()), this, TQT_SLOT(slotPlay()));
+ connect(PlayerManager::instance(), TQT_SIGNAL(signalPause()), this, TQT_SLOT(slotPause()));
+ connect(PlayerManager::instance(), TQT_SIGNAL(signalStop()), this, TQT_SLOT(slotStop()));
action("play")->plug(cm);
action("pause")->plug(cm);
@@ -189,8 +189,8 @@ SystemTray::SystemTray(QWidget *parent, const char *name) : KSystemTray(parent,
action("togglePopups")->plug(cm);
- m_fadeTimer = new QTimer(this, "systrayFadeTimer");
- connect(m_fadeTimer, SIGNAL(timeout()), SLOT(slotNextStep()));
+ m_fadeTimer = new TQTimer(this, "systrayFadeTimer");
+ connect(m_fadeTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotNextStep()));
if(PlayerManager::instance()->playing())
slotPlay();
@@ -212,7 +212,7 @@ void SystemTray::slotPlay()
if(!PlayerManager::instance()->playing())
return;
- QPixmap cover = PlayerManager::instance()->playingFile().coverInfo()->pixmap(CoverInfo::Thumbnail);
+ TQPixmap cover = PlayerManager::instance()->playingFile().coverInfo()->pixmap(CoverInfo::Thumbnail);
setPixmap(m_playPix);
setToolTip(PlayerManager::instance()->playingString(), cover);
@@ -253,7 +253,7 @@ void SystemTray::slotPopupDestroyed()
void SystemTray::slotNextStep()
{
- QColor result;
+ TQColor result;
++m_step;
@@ -278,8 +278,8 @@ void SystemTray::slotFadeOut()
m_startColor = m_labels[0]->textColor();
m_endColor = m_labels[0]->backgroundColor();
- connect(this, SIGNAL(fadeDone()), m_popup, SLOT(hide()));
- connect(m_popup, SIGNAL(mouseEntered()), this, SLOT(slotMouseInPopup()));
+ connect(this, TQT_SIGNAL(fadeDone()), m_popup, TQT_SLOT(hide()));
+ connect(m_popup, TQT_SIGNAL(mouseEntered()), this, TQT_SLOT(slotMouseInPopup()));
m_fadeTimer->start(1500 / STEPS);
}
@@ -289,7 +289,7 @@ void SystemTray::slotFadeOut()
void SystemTray::slotMouseInPopup()
{
m_endColor = m_labels[0]->textColor();
- disconnect(SIGNAL(fadeDone()));
+ disconnect(TQT_SIGNAL(fadeDone()));
m_step = STEPS - 1; // Simulate end of fade to solid text
slotNextStep();
@@ -299,9 +299,9 @@ void SystemTray::slotMouseInPopup()
// private methods
////////////////////////////////////////////////////////////////////////////////
-QVBox *SystemTray::createPopupLayout(QWidget *parent, const FileHandle &file)
+TQVBox *SystemTray::createPopupLayout(TQWidget *parent, const FileHandle &file)
{
- QVBox *infoBox = 0;
+ TQVBox *infoBox = 0;
if(buttonsToLeft()) {
@@ -310,7 +310,7 @@ QVBox *SystemTray::createPopupLayout(QWidget *parent, const FileHandle &file)
createButtonBox(parent);
addSeparatorLine(parent);
- infoBox = new QVBox(parent);
+ infoBox = new TQVBox(parent);
// Another line, and the cover, if there's a cover, and if
// it's selected to be shown
@@ -329,7 +329,7 @@ QVBox *SystemTray::createPopupLayout(QWidget *parent, const FileHandle &file)
addSeparatorLine(parent);
}
- infoBox = new QVBox(parent);
+ infoBox = new TQVBox(parent);
addSeparatorLine(parent);
createButtonBox(parent);
@@ -360,13 +360,13 @@ void SystemTray::createPopup()
m_step = 0;
m_popup = new PassiveInfo(this);
- connect(m_popup, SIGNAL(destroyed()), SLOT(slotPopupDestroyed()));
- connect(m_popup, SIGNAL(timeExpired()), SLOT(slotFadeOut()));
+ connect(m_popup, TQT_SIGNAL(destroyed()), TQT_SLOT(slotPopupDestroyed()));
+ connect(m_popup, TQT_SIGNAL(timeExpired()), TQT_SLOT(slotFadeOut()));
- QHBox *box = new QHBox(m_popup, "popupMainLayout");
+ TQHBox *box = new TQHBox(m_popup, "popupMainLayout");
box->setSpacing(15); // Add space between text and buttons
- QVBox *infoBox = createPopupLayout(box, playingFile);
+ TQVBox *infoBox = createPopupLayout(box, playingFile);
for(unsigned i = 0; i < m_labels.capacity(); ++i) {
m_labels[i] = new FlickerFreeLabel(" ", infoBox);
@@ -384,17 +384,17 @@ void SystemTray::createPopup()
int labelCount = 0;
- QString title = QStyleSheet::escape(playingInfo->title());
- m_labels[labelCount++]->setText(QString("<qt><nobr><h2>%1</h2></nobr><qt>").arg(title));
+ TQString title = TQStyleSheet::escape(playingInfo->title());
+ m_labels[labelCount++]->setText(TQString("<qt><nobr><h2>%1</h2></nobr><qt>").arg(title));
if(!playingInfo->artist().isEmpty())
m_labels[labelCount++]->setText(playingInfo->artist());
if(!playingInfo->album().isEmpty()) {
- QString album = QStyleSheet::escape(playingInfo->album());
- QString s = playingInfo->year() > 0
- ? QString("<qt><nobr>%1 (%2)</nobr></qt>").arg(album).arg(playingInfo->year())
- : QString("<qt><nobr>%1</nobr></qt>").arg(album);
+ TQString album = TQStyleSheet::escape(playingInfo->album());
+ TQString s = playingInfo->year() > 0
+ ? TQString("<qt><nobr>%1 (%2)</nobr></qt>").arg(album).arg(playingInfo->year())
+ : TQString("<qt><nobr>%1</nobr></qt>").arg(album);
m_labels[labelCount++]->setText(s);
}
@@ -417,20 +417,20 @@ bool SystemTray::buttonsToLeft() const
NETRect frame, win;
ni.kdeGeometry(frame, win);
- QRect bounds = KGlobalSettings::desktopGeometry(QPoint(win.pos.x, win.pos.y));
+ TQRect bounds = KGlobalSettings::desktopGeometry(TQPoint(win.pos.x, win.pos.y));
// This seems to accurately guess what side of the icon that
// KPassivePopup will popup on.
return(win.pos.x < bounds.center().x());
}
-QPixmap SystemTray::createPixmap(const QString &pixName)
+TQPixmap SystemTray::createPixmap(const TQString &pixName)
{
- QPixmap bgPix = m_appPix;
- QPixmap fgPix = SmallIcon(pixName);
+ TQPixmap bgPix = m_appPix;
+ TQPixmap fgPix = SmallIcon(pixName);
- QImage bgImage = bgPix.convertToImage(); // Probably 22x22
- QImage fgImage = fgPix.convertToImage(); // Should be 16x16
+ TQImage bgImage = bgPix.convertToImage(); // Probably 22x22
+ TQImage fgImage = fgPix.convertToImage(); // Should be 16x16
KIconEffect::semiTransparent(bgImage);
copyImage(bgImage, fgImage, (bgImage.width() - fgImage.width()) / 2,
@@ -440,19 +440,19 @@ QPixmap SystemTray::createPixmap(const QString &pixName)
return bgPix;
}
-void SystemTray::createButtonBox(QWidget *parent)
+void SystemTray::createButtonBox(TQWidget *parent)
{
- QVBox *buttonBox = new QVBox(parent);
+ TQVBox *buttonBox = new TQVBox(parent);
buttonBox->setSpacing(3);
- QPushButton *forwardButton = new QPushButton(m_forwardPix, 0, buttonBox, "popup_forward");
+ TQPushButton *forwardButton = new TQPushButton(m_forwardPix, 0, buttonBox, "popup_forward");
forwardButton->setFlat(true);
- connect(forwardButton, SIGNAL(clicked()), SLOT(slotForward()));
+ connect(forwardButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotForward()));
- QPushButton *backButton = new QPushButton(m_backPix, 0, buttonBox, "popup_back");
+ TQPushButton *backButton = new TQPushButton(m_backPix, 0, buttonBox, "popup_back");
backButton->setFlat(true);
- connect(backButton, SIGNAL(clicked()), SLOT(slotBack()));
+ connect(backButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotBack()));
}
/**
@@ -472,10 +472,10 @@ void SystemTray::slotForward()
m_fade = false;
}
-void SystemTray::addSeparatorLine(QWidget *parent)
+void SystemTray::addSeparatorLine(TQWidget *parent)
{
- QFrame *line = new QFrame(parent);
- line->setFrameShape(QFrame::VLine);
+ TQFrame *line = new TQFrame(parent);
+ line->setFrameShape(TQFrame::VLine);
// Cover art takes up 80 pixels, make sure we take up at least 80 pixels
// even if we don't show the cover art for consistency.
@@ -483,18 +483,18 @@ void SystemTray::addSeparatorLine(QWidget *parent)
line->setMinimumHeight(80);
}
-void SystemTray::addCoverButton(QWidget *parent, const QPixmap &cover)
+void SystemTray::addCoverButton(TQWidget *parent, const TQPixmap &cover)
{
- QPushButton *coverButton = new QPushButton(parent);
+ TQPushButton *coverButton = new TQPushButton(parent);
coverButton->setPixmap(cover);
coverButton->setFixedSize(cover.size());
coverButton->setFlat(true);
- connect(coverButton, SIGNAL(clicked()), this, SLOT(slotPopupLargeCover()));
+ connect(coverButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotPopupLargeCover()));
}
-QColor SystemTray::interpolateColor(int step, int steps)
+TQColor SystemTray::interpolateColor(int step, int steps)
{
if(step < 0)
return m_startColor;
@@ -504,41 +504,41 @@ QColor SystemTray::interpolateColor(int step, int steps)
// TODO: Perhaps the algorithm here could be better? For example, it might
// make sense to go rather quickly from start to end and then slow down
// the progression.
- return QColor(
+ return TQColor(
(step * m_endColor.red() + (steps - step) * m_startColor.red()) / steps,
(step * m_endColor.green() + (steps - step) * m_startColor.green()) / steps,
(step * m_endColor.blue() + (steps - step) * m_startColor.blue()) / steps
);
}
-void SystemTray::setToolTip(const QString &tip, const QPixmap &cover)
+void SystemTray::setToolTip(const TQString &tip, const TQPixmap &cover)
{
- QToolTip::remove(this);
+ TQToolTip::remove(this);
if(tip.isNull())
- QToolTip::add(this, i18n("JuK"));
+ TQToolTip::add(this, i18n("JuK"));
else {
- QPixmap myCover = cover;
+ TQPixmap myCover = cover;
if(cover.isNull())
myCover = DesktopIcon("juk");
- QImage coverImage = myCover.convertToImage();
+ TQImage coverImage = myCover.convertToImage();
if(coverImage.size().width() > 32 || coverImage.size().height() > 32)
coverImage = coverImage.smoothScale(32, 32);
- QMimeSourceFactory::defaultFactory()->setImage("tipCover", coverImage);
+ TQMimeSourceFactory::defaultFactory()->setImage("tipCover", coverImage);
- QString html = i18n("%1 is Cover Art, %2 is the playing track, %3 is the appname",
+ TQString html = i18n("%1 is Cover Art, %2 is the playing track, %3 is the appname",
"<center><table cellspacing=\"2\"><tr><td valign=\"middle\">%1</td>"
"<td valign=\"middle\">%2</td></tr></table><em>%3</em></center>");
html = html.arg("<img valign=\"middle\" src=\"tipCover\"");
- html = html.arg(QString("<nobr>%1</nobr>").arg(tip), i18n("JuK"));
+ html = html.arg(TQString("<nobr>%1</nobr>").arg(tip), i18n("JuK"));
- QToolTip::add(this, html);
+ TQToolTip::add(this, html);
}
}
-void SystemTray::wheelEvent(QWheelEvent *e)
+void SystemTray::wheelEvent(TQWheelEvent *e)
{
if(e->orientation() == Horizontal)
return;
@@ -568,7 +568,7 @@ void SystemTray::wheelEvent(QWheelEvent *e)
/*
* Reimplemented this in order to use the middle mouse button
*/
-void SystemTray::mousePressEvent(QMouseEvent *e)
+void SystemTray::mousePressEvent(TQMouseEvent *e)
{
switch(e->button()) {
case LeftButton:
@@ -590,10 +590,10 @@ void SystemTray::mousePressEvent(QMouseEvent *e)
/*
* This function copies the entirety of src into dest, starting in
* dest at x and y. This function exists because I was unable to find
- * a function like it in either QImage or kdefx
+ * a function like it in either TQImage or kdefx
*/
-static bool copyImage(QImage &dest, QImage &src, int x, int y)
+static bool copyImage(TQImage &dest, TQImage &src, int x, int y)
{
if(dest.depth() != src.depth())
return false;
@@ -605,7 +605,7 @@ static bool copyImage(QImage &dest, QImage &src, int x, int y)
// We want to use KIconEffect::overlay to do this, since it handles
// alpha, but the images need to be the same size. We can handle that.
- QImage large_src(dest);
+ TQImage large_src(dest);
// It would perhaps be better to create large_src based on a size, but
// this is the easiest way to make a new image with the same depth, size,