diff options
Diffstat (limited to 'noatun/modules/systray/systray.cpp')
-rw-r--r-- | noatun/modules/systray/systray.cpp | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/noatun/modules/systray/systray.cpp b/noatun/modules/systray/systray.cpp index c93080ca..2493bdbc 100644 --- a/noatun/modules/systray/systray.cpp +++ b/noatun/modules/systray/systray.cpp @@ -40,21 +40,21 @@ #include <kaction.h> #include <kconfig.h> -#include <qfile.h> +#include <tqfile.h> #include <kglobal.h> #include <kiconloader.h> #include <klocale.h> #include <kpassivepopup.h> #include <kpixmapeffect.h> #include <kstdaction.h> -#include <qbitmap.h> -#include <qhbox.h> -#include <qpainter.h> -#include <qpushbutton.h> -#include <qtooltip.h> -#include <qvbox.h> - -#include <qimage.h> +#include <tqbitmap.h> +#include <tqhbox.h> +#include <tqpainter.h> +#include <tqpushbutton.h> +#include <tqtooltip.h> +#include <tqvbox.h> + +#include <tqimage.h> #include <kurl.h> #include <kio/netaccess.h> #include <kdebug.h> @@ -72,15 +72,15 @@ const int COVER_MAXH = 128; class PassivePopup : public KPassivePopup { public: - PassivePopup(QWidget *parent = 0, const char *name = 0) : KPassivePopup(parent, name) {} + PassivePopup(TQWidget *parent = 0, const char *name = 0) : KPassivePopup(parent, name) {} protected: - virtual void enterEvent(QEvent *) + virtual void enterEvent(TQEvent *) { setTimeout(3000000); // Make timeout damn near infinite } - virtual void leaveEvent(QEvent *) + virtual void leaveEvent(TQEvent *) { setTimeout(250); // Close quickly } @@ -100,9 +100,9 @@ NoatunSystray::NoatunSystray() : KMainWindow(0, "NoatunSystray"), Plugin(), removeCover(); // make sure any old temp cover is gone - KStdAction::quit(napp, SLOT(quit()), actionCollection()); - KStdAction::open(napp, SLOT(fileOpen()), actionCollection()); - KStdAction::preferences(napp, SLOT(preferences()), actionCollection()); + KStdAction::quit(napp, TQT_SLOT(quit()), actionCollection()); + KStdAction::open(napp, TQT_SLOT(fileOpen()), actionCollection()); + KStdAction::preferences(napp, TQT_SLOT(preferences()), actionCollection()); NoatunStdAction::back(actionCollection(), "back"); NoatunStdAction::stop(actionCollection(), "stop"); NoatunStdAction::playpause(actionCollection(), "play"); @@ -117,18 +117,18 @@ NoatunSystray::NoatunSystray() : KMainWindow(0, "NoatunSystray"), Plugin(), mTray = new KitSystemTray("tray", this); mTray->show(); - trayBase = renderIcon(BASEICON, QString::null); + trayBase = renderIcon(BASEICON, TQString::null); trayStatus = renderIcon(BASEICON, "player_stop"); mTray->changeTitle(*trayBase, i18n("Noatun")); showingTrayStatus = false; - mBlinkTimer = new QTimer(this); - connect(mBlinkTimer, SIGNAL(timeout()), this, SLOT(slotBlinkTimer())); + mBlinkTimer = new TQTimer(this); + connect(mBlinkTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotBlinkTimer())); - connect(napp->player(), SIGNAL(playing()), this, SLOT(slotPlayPause())); - connect(napp->player(), SIGNAL(paused()), this, SLOT(slotPlayPause())); - connect(napp->player(), SIGNAL(stopped()), this, SLOT(slotStopped())); + connect(napp->player(), TQT_SIGNAL(playing()), this, TQT_SLOT(slotPlayPause())); + connect(napp->player(), TQT_SIGNAL(paused()), this, TQT_SLOT(slotPlayPause())); + connect(napp->player(), TQT_SIGNAL(stopped()), this, TQT_SLOT(slotStopped())); //napp->player()->handleButtons(); } @@ -146,7 +146,7 @@ NoatunSystray::~NoatunSystray() void NoatunSystray::init() { YHModule *cmod = new YHModule(this); - connect(cmod, SIGNAL(saved()), this, SLOT(slotLoadSettings())); + connect(cmod, TQT_SIGNAL(saved()), this, TQT_SLOT(slotLoadSettings())); slotLoadSettings(); } @@ -165,9 +165,9 @@ void NoatunSystray::slotLoadSettings() if(c->tip()) - QToolTip::add(mTray, tipText); + TQToolTip::add(mTray, tipText); else - QToolTip::remove(mTray); + TQToolTip::remove(mTray); if (!c->passivePopupCovers()) removeCover(); @@ -184,7 +184,7 @@ void NoatunSystray::slotLoadSettings() } -void NoatunSystray::closeEvent(QCloseEvent*) +void NoatunSystray::closeEvent(TQCloseEvent*) { //kdDebug(66666) << k_funcinfo << "Called." << endl; disconnect(napp->player(), 0, 0, 0); @@ -194,7 +194,7 @@ void NoatunSystray::closeEvent(QCloseEvent*) void NoatunSystray::slotPlayPause() { - QString status; + TQString status; if(napp->player()->isPaused()) { @@ -208,26 +208,26 @@ void NoatunSystray::slotPlayPause() } const PlaylistItem item = napp->player()->current(); - QString s; + TQString s; if(!item.isProperty("title")) { // No metadata - s = QString("<nobr>%1</nobr>").arg(item.title()); + s = TQString("<nobr>%1</nobr>").arg(item.title()); } else { - s = QString("<h2><nobr>%1</nobr></h2>").arg(item.property("title")); + s = TQString("<h2><nobr>%1</nobr></h2>").arg(item.property("title")); if(item.isProperty("author")) - s += QString("<nobr>%1</nobr><br>").arg(item.property("author")); + s += TQString("<nobr>%1</nobr><br>").arg(item.property("author")); if(item.isProperty("album")) { if(item.isProperty("date")) - s += QString("<nobr>%1 (%2)</nobr><br>").arg(item.property("album")).arg(item.property("date")); + s += TQString("<nobr>%1 (%2)</nobr><br>").arg(item.property("album")).arg(item.property("date")); else - s += QString("<nobr>%1</nobr><br>").arg(item.property("album")); + s += TQString("<nobr>%1</nobr><br>").arg(item.property("album")); } } @@ -235,18 +235,18 @@ void NoatunSystray::slotPlayPause() if (YHConfig::self()->passivePopupCovers()) updateCover(); - if(YHConfig::self()->passivePopupCovers() && QFile::exists(tmpCoverPath)) + if(YHConfig::self()->passivePopupCovers() && TQFile::exists(tmpCoverPath)) { // QT always adds an empty line after the table so we add en empty line before the // table to get equal spacing on top and bottom - setTipText(QString("<qt><br><table cellspacing=0 cellpadding=0><tr>" \ + setTipText(TQString("<qt><br><table cellspacing=0 cellpadding=0><tr>" \ "<td align=center valign=center><h4><nobr>%1</nobr></h4>%2</td>" \ "<td valign=center><img src='%3'></td>" \ "</qt></tr></table>").arg(status).arg(s).arg(tmpCoverPath)); } else { - setTipText(QString("<qt><center><h4><nobr>%1</nobr></h4>%2</center></qt>").arg(status).arg(s)); + setTipText(TQString("<qt><center><h4><nobr>%1</nobr></h4>%2</center></qt>").arg(status).arg(s)); } } @@ -256,12 +256,12 @@ void NoatunSystray::slotStopped() if(!napp->player()->current()) return; changeTray("player_stop"); - setTipText(QString("<qt><nobr><h4>%1</h4></nobr></qt>").arg(i18n("Noatun - Stopped"))); + setTipText(TQString("<qt><nobr><h4>%1</h4></nobr></qt>").arg(i18n("Noatun - Stopped"))); } -void NoatunSystray::changeTray(const QString &pm) +void NoatunSystray::changeTray(const TQString &pm) { delete trayStatus; trayStatus = renderIcon(BASEICON, pm); @@ -297,19 +297,19 @@ void NoatunSystray::slotBlinkTimer() void NoatunSystray::updateCover() { //kdDebug(66666) << k_funcinfo << endl; - QString dir = napp->player()->current().url().directory(); - QString cover; + TQString dir = napp->player()->current().url().directory(); + TQString cover; // TODO: Maybe make these filenames configurable? - if(QFile::exists(dir + "/folder.png")) + if(TQFile::exists(dir + "/folder.png")) cover = dir + "/folder.png"; - else if(QFile::exists(dir + "/.folder.png")) + else if(TQFile::exists(dir + "/.folder.png")) cover = dir + "/.folder.png"; - else if(QFile::exists(dir + "/cover.png")) + else if(TQFile::exists(dir + "/cover.png")) cover = dir + "/cover.png"; - else if(QFile::exists(dir + "/cover.jpg")) + else if(TQFile::exists(dir + "/cover.jpg")) cover = dir + "/cover.jpg"; - else if(QFile::exists(dir + "/cover.jpeg")) + else if(TQFile::exists(dir + "/cover.jpeg")) cover = dir + "/cover.jpeg"; else // no cover { @@ -318,9 +318,9 @@ void NoatunSystray::updateCover() return; } - QString title = napp->player()->current().title(); + TQString title = napp->player()->current().title(); - QImage previmg; + TQImage previmg; previmg.load(tmpCoverPath); if(previmg.text("Title") != title) @@ -328,13 +328,13 @@ void NoatunSystray::updateCover() /*kdDebug(66666) << k_funcinfo << "Creating new temp cover for '" << cover << "'" << endl;*/ - QImage src; - QImage tmpimg; + TQImage src; + TQImage tmpimg; if(src.load(cover)) { if(src.width() >= COVER_MAXW || src.height() >= COVER_MAXH) - tmpimg = src.scale(COVER_MAXW, COVER_MAXH, QImage::ScaleMin); + tmpimg = src.scale(COVER_MAXW, COVER_MAXH, TQImage::ScaleMin); else tmpimg = src; @@ -351,12 +351,12 @@ void NoatunSystray::updateCover() void NoatunSystray::removeCover() { - if(QFile::exists(tmpCoverPath)) + if(TQFile::exists(tmpCoverPath)) KIO::NetAccess::del(KURL(tmpCoverPath), this); } -void NoatunSystray::setTipText(const QString& text) +void NoatunSystray::setTipText(const TQString& text) { if(text == tipText) // save the planet, save cpu cycles ;) return; @@ -364,10 +364,10 @@ void NoatunSystray::setTipText(const QString& text) YHConfig *c = YHConfig::self(); if(c->passivePopup()) - QTimer::singleShot(0, this, SLOT(showPassivePopup())); + TQTimer::singleShot(0, this, TQT_SLOT(showPassivePopup())); if(c->tip()) - QToolTip::add(mTray, tipText); + TQToolTip::add(mTray, tipText); } @@ -379,12 +379,12 @@ void NoatunSystray::showPassivePopup() return; } - mPassivePopup->reparent(0L, QPoint(0,0)); + mPassivePopup->reparent(0L, TQPoint(0,0)); if (YHConfig::self()->passivePopupButtons() && !napp->player()->isStopped()) { - QVBox *widget = mPassivePopup->standardView(QString::null, tipText, QPixmap()); - QHBox *box = new QHBox(mPassivePopup, "popupbox"); + TQVBox *widget = mPassivePopup->standardView(TQString::null, tipText, TQPixmap()); + TQHBox *box = new TQHBox(mPassivePopup, "popupbox"); box->setSpacing(8); @@ -394,52 +394,52 @@ void NoatunSystray::showPassivePopup() 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)); if(win.pos.x < bounds.center().x()) { // Buttons to the left - QVBox *buttonBox = new QVBox(box); + TQVBox *buttonBox = new TQVBox(box); buttonBox->setSpacing(3); - QPushButton *forwardButton = new QPushButton(action("forward")->iconSet(), 0, buttonBox, "popup_forward"); + TQPushButton *forwardButton = new TQPushButton(action("forward")->iconSet(), 0, buttonBox, "popup_forward"); forwardButton->setFlat(true); - connect(forwardButton, SIGNAL(clicked()), action("forward"), SLOT(activate())); + connect(forwardButton, TQT_SIGNAL(clicked()), action("forward"), TQT_SLOT(activate())); - QPushButton *backButton = new QPushButton(action("back")->iconSet(), 0, buttonBox, "popup_back"); + TQPushButton *backButton = new TQPushButton(action("back")->iconSet(), 0, buttonBox, "popup_back"); backButton->setFlat(true); - connect(backButton, SIGNAL(clicked()), action("back"), SLOT(activate())); + connect(backButton, TQT_SIGNAL(clicked()), action("back"), TQT_SLOT(activate())); - QFrame *line = new QFrame(box); - line->setFrameShape(QFrame::VLine); + TQFrame *line = new TQFrame(box); + line->setFrameShape(TQFrame::VLine); - widget->reparent(box, QPoint(0, 0)); + widget->reparent(box, TQPoint(0, 0)); } else { // Buttons to the right - widget->reparent(box, QPoint(0, 0)); + widget->reparent(box, TQPoint(0, 0)); - QFrame *line = new QFrame(box); - line->setFrameShape(QFrame::VLine); + TQFrame *line = new TQFrame(box); + line->setFrameShape(TQFrame::VLine); - QVBox *buttonBox = new QVBox(box); + TQVBox *buttonBox = new TQVBox(box); buttonBox->setSpacing(3); - QPushButton *forwardButton = new QPushButton(action("forward")->iconSet(), 0, buttonBox, "popup_forward"); + TQPushButton *forwardButton = new TQPushButton(action("forward")->iconSet(), 0, buttonBox, "popup_forward"); forwardButton->setFlat(true); - connect(forwardButton, SIGNAL(clicked()), action("forward"), SLOT(activate())); + connect(forwardButton, TQT_SIGNAL(clicked()), action("forward"), TQT_SLOT(activate())); - QPushButton *backButton = new QPushButton(action("back")->iconSet(), 0, buttonBox, "popup_back"); + TQPushButton *backButton = new TQPushButton(action("back")->iconSet(), 0, buttonBox, "popup_back"); backButton->setFlat(true); - connect(backButton, SIGNAL(clicked()), action("back"), SLOT(activate())); + connect(backButton, TQT_SIGNAL(clicked()), action("back"), TQT_SLOT(activate())); } mPassivePopup->setView(box); } else { - mPassivePopup->setView(QString::null, tipText); + mPassivePopup->setView(TQString::null, tipText); } mPassivePopup->setTimeout(YHConfig::self()->passivePopupTimeout()*1000); @@ -447,17 +447,17 @@ void NoatunSystray::showPassivePopup() } -QPixmap *NoatunSystray::renderIcon(const QString& baseIcon, const QString &overlayIcon) const +TQPixmap *NoatunSystray::renderIcon(const TQString& baseIcon, const TQString &overlayIcon) const { - QPixmap *base = new QPixmap(KSystemTray::loadIcon(baseIcon)); + TQPixmap *base = new TQPixmap(KSystemTray::loadIcon(baseIcon)); if(!(overlayIcon.isNull())) // otherwise leave the base as-is { - QPixmap overlay = KSystemTray::loadIcon(overlayIcon); + TQPixmap overlay = KSystemTray::loadIcon(overlayIcon); if(!overlay.isNull()) { // draw the overlay on top of it - QPainter p(base); + TQPainter p(base); p.drawPixmap(0, 0, overlay); } } |