? systray.cpp.sp
Index: cmodule.cpp
===================================================================
RCS file: /home/kde/kdemultimedia/noatun/modules/systray/cmodule.cpp,v
retrieving revision 1.19
diff -u -b -B -d -w -U5 -u -b -B -d -w -r1.19 cmodule.cpp
--- cmodule.cpp	29 May 2004 16:26:52 -0000	1.19
+++ cmodule.cpp	6 Jun 2004 15:05:03 -0000
@@ -30,12 +30,15 @@
 #include <kdialog.h>
 #include <kglobal.h>
 #include <klocale.h>
 #include <qbuttongroup.h>
 #include <qcheckbox.h>
+#include <qhbox.h>
+#include <qlabel.h>
 #include <qlayout.h>
 #include <qradiobutton.h>
+#include <qspinbox.h>
 
 #include <noatun/app.h>
 #include <noatun/pluginloader.h>
 
 YHModule::YHModule(QObject *_parent)
@@ -44,21 +47,33 @@
 	QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
 
 	tip = new QCheckBox(i18n("Show a tooltip for the current track"), this);
 	passivePopup = new QCheckBox(i18n("Announce tracks with a popup window"), this);
 	connect(passivePopup, SIGNAL(toggled(bool)), this, SLOT(slotPassivePopupChanged(bool)));
+
+        QHBox *timeoutBox = new QHBox(this);
+        timeoutBox->setSpacing(KDialog::spacingHint());
+        new QLabel(i18n("Display popup window for"), timeoutBox);
+        passivePopupTimeout = new QSpinBox(1, 60, 5, timeoutBox);
+        passivePopupTimeout->setSuffix(i18n("Seconds", " s"));
+        // fill remaining space
+        timeoutBox->setStretchFactor(new QLabel(timeoutBox), 1);
+
 	passivePopupCovers = new QCheckBox(i18n("Show covers in popup window"), this);
+        passivePopupButtons = new QCheckBox(i18n("Show buttons in popup window"), this);
 
 	icon = new QButtonGroup(1, Horizontal, i18n("State Icon Display"), this, "icon");
 	icon->setExclusive(true);
 	new QRadioButton(i18n("Blink"), icon);
 	new QRadioButton(i18n("Show"), icon);
 	new QRadioButton(i18n("None"), icon);
 
 	layout->addWidget(tip);
 	layout->addWidget(passivePopup);
+        layout->addWidget(timeoutBox);
 	layout->addWidget(passivePopupCovers);
+        layout->addWidget(passivePopupButtons);
 	layout->addWidget(icon);
 	layout->addStretch();
 
 	reopen();
 	applySettings();
@@ -70,11 +85,13 @@
 	c->setGroup("Young Hickory");
 	int iconPressed = icon->id(icon->selected());
 	c->writeEntry("icon", iconPressed);
 	c->writeEntry("tip", tip->isChecked());
 	c->writeEntry("passivePopup", passivePopup->isChecked());
+        c->writeEntry("passivePopupTimeout", passivePopupTimeout->value());
 	c->writeEntry("passivePopupCovers", passivePopupCovers->isChecked());
+        c->writeEntry("passivePopupButtons", passivePopupButtons->isChecked());
 	c->sync();
 
 	applySettings();
 }
 
@@ -83,11 +100,13 @@
 	KConfig *c = KGlobal::config();
 	c->setGroup("Young Hickory");
 	static_cast<QRadioButton *>(icon->find(c->readLongNumEntry("icon", 1)))->setChecked(true);
 	tip->setChecked(c->readBoolEntry("tip", true));
 	passivePopup->setChecked(c->readBoolEntry("passivePopup", true));
+        passivePopupTimeout->setValue(c->readNumEntry("passivePopupTimeout", 5));
 	passivePopupCovers->setChecked(c->readBoolEntry("passivePopupCovers", true));
+        passivePopupButtons->setChecked(c->readBoolEntry("passivePopupButtons", true));
 }
 
 void YHModule::applySettings()
 {
 	NoatunSystray *yh = NoatunSystray::jasonkb;
@@ -96,14 +115,18 @@
 
 	int iconPressed = icon->id(icon->selected());
 	yh->setBlink((NoatunSystray::Blink)iconPressed);
 	yh->setTip(tip->isChecked());
 	yh->setPassivePopup(passivePopup->isChecked());
+        yh->setPopupTimeout(passivePopupTimeout->value());
 	yh->setShowCovers(passivePopupCovers->isChecked());
+        yh->setShowButtons(passivePopupButtons->isChecked());
 }
 
 void YHModule::slotPassivePopupChanged(bool check)
 {
+        passivePopupTimeout->setEnabled(check);
 	passivePopupCovers->setEnabled(check);
+        passivePopupButtons->setEnabled(check);
 }
 
 #include "cmodule.moc"
Index: cmodule.h
===================================================================
RCS file: /home/kde/kdemultimedia/noatun/modules/systray/cmodule.h,v
retrieving revision 1.8
diff -u -b -B -d -w -U5 -u -b -B -d -w -r1.8 cmodule.h
--- cmodule.h	11 May 2003 12:42:43 -0000	1.8
+++ cmodule.h	6 Jun 2004 15:05:03 -0000
@@ -28,10 +28,11 @@
 
 #include <noatun/pref.h>
 
 class QCheckBox;
 class QButtonGroup;
+class QSpinBox;
 
 class YHModule : public CModule
 {
 Q_OBJECT
 
@@ -43,11 +44,13 @@
 
 private:
 	void applySettings();
 	QCheckBox *tip;
 	QCheckBox *passivePopup;
+        QSpinBox *passivePopupTimeout;
 	QCheckBox *passivePopupCovers;
+        QCheckBox *passivePopupButtons;
 	QButtonGroup *icon;
 
 private slots:
 	void slotPassivePopupChanged(bool);
 };
Index: systray.cpp
===================================================================
RCS file: /home/kde/kdemultimedia/noatun/modules/systray/systray.cpp,v
retrieving revision 1.36
diff -u -b -B -d -w -U5 -u -b -B -d -w -r1.36 systray.cpp
--- systray.cpp	29 May 2004 16:26:52 -0000	1.36
+++ systray.cpp	6 Jun 2004 15:05:03 -0000
@@ -45,13 +45,16 @@
 #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 <qtimer.h>
 #include <qtooltip.h>
+#include <qvbox.h>
 
 #include <qimage.h>
 #include <kurl.h>
 #include <kio/netaccess.h>
 #include <kdebug.h>
@@ -164,36 +167,36 @@
 
 	if(item.length()>0)
 	{
 		if(mShowCovers && QFile::exists(tmpCoverPath))
 		{
-			setTipText(i18n("<qt><nobr><b>Noatun - Playing</b></nobr><br>" \
+                        setTipText(i18n("<qt><nobr><center><b>Noatun - Playing</b></center></nobr><br>" \
 				"<nobr>%1</nobr><br>" \
 				"<nobr>Length: %2</nobr>" \
 				"<img src=\"%3\" align=right></qt>")
 				.arg(item.title(), item.lengthString(), tmpCoverPath));
 		}
 		else
 		{
-			setTipText(i18n("<qt><nobr><b>Noatun - Playing</b></nobr><br>" \
+                        setTipText(i18n("<qt><nobr><center><b>Noatun - Playing</b></center></nobr><br>" \
 				"<nobr>%1</nobr><br>" \
 				"<nobr>Length: %2</nobr></qt>")
 				.arg(item.title(), item.lengthString()));
 		}
 	}
 	else
 	{
 		if(mShowCovers && QFile::exists(tmpCoverPath))
 		{
-			setTipText(i18n("<qt><nobr><b>Noatun - Playing</b></nobr><br>" \
+                        setTipText(i18n("<qt><nobr><center><b>Noatun - Playing</b></center></nobr><br>" \
 				"<nobr>%1</nobr><br>" \
 				"<img src=\"%2\" align=right></qt>")
 				.arg(item.title(), tmpCoverPath));
 		}
 		else
 		{
-			setTipText(i18n("<qt><nobr><b>Noatun - Playing</b></nobr><br>" \
+                        setTipText(i18n("<qt><nobr><center><b>Noatun - Playing</b></center></nobr><br>" \
 				"<nobr>%1</nobr></qt>")
 				.arg(item.title()));
 		}
 	}
 }
@@ -212,18 +215,18 @@
 
 	const PlaylistItem item = napp->player()->current();
 
 	if(item.length()>0)
 	{
-		setTipText(i18n("<qt><nobr><b>Noatun - Paused</b></nobr><br>" \
+                setTipText(i18n("<qt><nobr><center><b>Noatun - Paused</b></center></nobr><br>" \
 			"<nobr>%1</nobr><br>" \
 			"<nobr>Length: %2</nobr></qt>")
 			.arg(item.title(), item.lengthString()));
 	}
 	else
 	{
-		setTipText(i18n("<qt><nobr><b>Noatun - Paused</b></nobr><br>" \
+                setTipText(i18n("<qt><nobr><center><b>Noatun - Paused</b></center></nobr><br>" \
 			"<nobr>%1</nobr></qt>").arg(item.title()));
 	}
 }
 
 void NoatunSystray::changeTray(const QString &pm)
@@ -320,10 +323,22 @@
 	mShowCovers = show;
 	if (!show)
 		removeCover();
 }
 
+void NoatunSystray::setPopupTimeout(int timeout)
+{
+        mPassivePopupTimeout = timeout * 1000;
+        if (mPassivePopup)
+                mPassivePopup->setTimeout(mPassivePopupTimeout);
+}
+
+void NoatunSystray::setShowButtons(bool show)
+{
+        mShowButtons = show;
+}
+
 void NoatunSystray::setTipText(const QString& text)
 {
 	if(text == tipText) // save the planet, save cpu cycles ;)
 		return;
 
@@ -341,14 +356,36 @@
 }
 
 void NoatunSystray::showPassivePopup()
 {
 	mPassivePopup->reparent(0L, QPoint(0,0));
-	if(mShowCovers && QFile::exists(tmpCoverPath) && !napp->player()->isStopped())
-		mPassivePopup->setView(QString::null, tipText, QPixmap(tmpCoverPath));
+
+        if (mShowButtons && !napp->player()->isStopped()) {
+                QVBox *widget = mPassivePopup->standardView(QString::null, tipText, QPixmap());
+                QHBox *box = new QHBox(mPassivePopup, "popup box");
+                box->setSpacing(15);
+
+                QPushButton *backButton
+                        = new QPushButton(action("back")->iconSet(), 0, box, "popup_back");
+                backButton->setFlat(true);
+                connect(backButton, SIGNAL(clicked()), action("back"),
+                        SLOT(activate()));
+
+                widget->reparent(box, QPoint(0, 0));
+
+                QPushButton *forwardButton
+                        = new QPushButton(action("forward")->iconSet(), 0, box,
+                                          "popup_forward");
+                forwardButton->setFlat(true);
+                connect(forwardButton, SIGNAL(clicked()), action("forward"),
+                        SLOT(activate()));
+
+                mPassivePopup->setView(box);
+        }
 	else
 		mPassivePopup->setView(QString::null, tipText);
+
 	mPassivePopup->show();
 }
 
 void NoatunSystray::setPassivePopup(bool pop)
 {
@@ -355,10 +392,11 @@
 	if(pop==(mPassivePopup!=0L))
 		return;
 	if(pop)
 	{
 		mPassivePopup = new KPassivePopup(mTray, "NoatunPassivePopup");
+                mPassivePopup->setTimeout(mPassivePopupTimeout);
 	}
 	else
 	{
 		delete mPassivePopup;
 		mPassivePopup = 0L;
Index: systray.h
===================================================================
RCS file: /home/kde/kdemultimedia/noatun/modules/systray/systray.h,v
retrieving revision 1.14
diff -u -b -B -d -w -U5 -u -b -B -d -w -r1.14 systray.h
--- systray.h	5 Dec 2003 22:15:08 -0000	1.14
+++ systray.h	6 Jun 2004 15:05:03 -0000
@@ -53,11 +53,13 @@
 	virtual void init();
 
 	void setBlink(Blink);
 	void setTip(bool);
 	void setPassivePopup(bool pop);
+        void setShowButtons(bool show);
 	void setShowCovers(bool);
+        void setPopupTimeout(int timeout);
 
 	static NoatunSystray *jasonkb;
 
 protected:
 	virtual void closeEvent(QCloseEvent *);
@@ -88,10 +90,14 @@
 	void updateCover();
 	void removeCover();
 	QString tmpCoverPath;
 	bool mShowCovers;
 
+        bool mShowButtons;
+
+        int mPassivePopupTimeout;
+
 	KAction *mBack, *mStop, *mPlay, *mForward;
 	KToggleAction *mPlaylist;
 	KPopupMenu *menu;
 	KXMLGUIFactory *factory;
 	KPassivePopup *mPassivePopup;
