Commit 2d083b75 authored by Scott Wheeler's avatar Scott Wheeler

Remembered to add the files needed from the last commit.

svn path=/trunk/kdemultimedia/juk/; revision=196386
parent 2edae8bc
/***************************************************************************
systray.cpp - description
-------------------
copyright : (C) 2002 by Daniel Molkentin
email : molkentin@kde.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kapplication.h>
#include <kiconloader.h>
#include <kpopupmenu.h>
#include <klocale.h>
#include <qtimer.h>
#include "systemtray.h"
////////////////////////////////////////////////////////////////////////////////
// public methods
////////////////////////////////////////////////////////////////////////////////
SystemTray::SystemTray(QWidget *parent, const char *name) : KSystemTray(parent, name), blinkStatus(false)
{
blinkTimer = new QTimer(this, "blinktimer");
appPix = SmallIcon("juk");
playPix = SmallIcon("player_play");
pausePix = SmallIcon("player_pause");
setPixmap(appPix);
KPopupMenu *cm = contextMenu();
cm->insertTitle(i18n("Playing"));
cm->insertItem(playPix, i18n("Play"), this, SIGNAL(play()));
cm->insertItem(pausePix, i18n("Pause"), this, SIGNAL(pause()));
cm->insertItem(SmallIcon("player_stop"), i18n("Stop"), this, SIGNAL(stop()));
cm->insertItem(SmallIcon("player_end" ), i18n("Forward"), this, SIGNAL(forward()));
cm->insertItem(SmallIcon("player_start"), i18n("Back"), this, SIGNAL(back()));
connect(blinkTimer, SIGNAL(timeout()), this, SLOT(slotBlink()));
}
SystemTray::~SystemTray()
{
}
////////////////////////////////////////////////////////////////////////////////
// public slots
////////////////////////////////////////////////////////////////////////////////
void SystemTray::slotPlay()
{
currentPix = playPix;
blinkTimer->start(blinkInterval);
}
void SystemTray::slotPause()
{
currentPix = pausePix;
blinkTimer->start(blinkInterval);
}
void SystemTray::slotStop()
{
blinkTimer->stop();
setPixmap(appPix);
}
////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////
void SystemTray::slotBlink()
{
if(blinkStatus)
setPixmap(currentPix);
else
setPixmap(appPix);
blinkStatus = !blinkStatus;
}
#include "systemtray.moc"
/***************************************************************************
systray.cpp - description
-------------------
copyright : (C) 2002 by Daniel Molkentin,
email : molkentin@kde.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SYSTEMTRAY_H
#define SYSTEMTRAY_H
#include <ksystemtray.h>
class QTimer;
class QPimap;
class SystemTray : public KSystemTray
{
Q_OBJECT
public:
SystemTray(QWidget *parent = 0, const char* name = 0);
virtual ~SystemTray();
public slots:
void slotPlay();
void slotStop();
void slotPause();
signals:
void play();
void stop();
void pause();
void forward();
void back();
private slots:
void slotBlink();
private:
QTimer *blinkTimer;
bool blinkStatus;
QPixmap playPix;
QPixmap pausePix;
QPixmap currentPix;
QPixmap appPix;
static const int blinkInterval = 1000;
};
#endif // SYSTEMTRAY_H
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