• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kopete/kopete

kanimatedsystemtrayicon.cpp

Go to the documentation of this file.
00001 /*
00002     kanimatedsystemtrayicon.cpp  -  System Tray Icon that can play movies
00003                     Designed for Kopete but usable anywhere
00004 
00005     Copyright (c) 2007      by Charles Connell <charles@connells.org>
00006 
00007     Kopete    (c) 2002-2007 by the Kopete developers  <kopete-devel@kde.org>
00008 
00009     *************************************************************************
00010     *                                                                       *
00011     * This program is free software; you can redistribute it and/or modify  *
00012     * it under the terms of the GNU General Public License as published by  *
00013     * the Free Software Foundation; either version 2 of the License, or     *
00014     * (at your option) any later version.                                   *
00015     *                                                                       *
00016     *************************************************************************
00017 */
00018 
00019 #include "kanimatedsystemtrayicon.h"
00020 
00021 #include <QMovie>
00022 
00023 class KAnimatedSystemTrayIcon::Private 
00024 {
00025     public:
00026         Private (const QString& m)
00027         {
00028             movie = new QMovie (m);
00029         }
00030         
00031         Private (QMovie * m = 0)
00032         {
00033             movie = m;
00034         }
00035 
00036         ~Private ()
00037         {
00038             delete movie;
00039         }
00040         
00041         QMovie * movie; 
00042 };
00043 
00044 KAnimatedSystemTrayIcon::KAnimatedSystemTrayIcon(QWidget *parent)
00045     : KSystemTrayIcon(parent)
00046 {
00047     d = new Private(0);
00048 }
00049 
00050 KAnimatedSystemTrayIcon::KAnimatedSystemTrayIcon(const QString &movie, QWidget *parent)
00051     : KSystemTrayIcon(parent),
00052     d ( new Private (movie))
00053 {
00054 
00055 }
00056 
00057 KAnimatedSystemTrayIcon::KAnimatedSystemTrayIcon(QMovie* movie, QWidget *parent)
00058     : KSystemTrayIcon(parent),
00059     d ( new Private (movie))
00060 {
00061     
00062 }
00063 
00064 KAnimatedSystemTrayIcon::~KAnimatedSystemTrayIcon()
00065 {
00066     delete d;
00067 }
00068 
00069 void KAnimatedSystemTrayIcon::setMovie (QMovie* m)
00070 {
00071     delete d->movie;
00072     d->movie = m;
00073 }
00074 
00075 const QMovie * KAnimatedSystemTrayIcon::movie () const
00076 {
00077     return d->movie;
00078 }
00079 
00080 void KAnimatedSystemTrayIcon::startMovie()
00081 {
00082     if (d->movie){
00083         connect (d->movie, SIGNAL(frameChanged(int)), this, SLOT (slotNewFrame()));
00084         d->movie->setCacheMode (QMovie::CacheAll);
00085         d->movie->start();      
00086     }
00087 }
00088 
00089 void KAnimatedSystemTrayIcon::stopMovie()
00090 {
00091     if (d->movie){
00092         d->movie->stop();
00093     }
00094 }
00095 
00096 bool KAnimatedSystemTrayIcon::isPlaying() const
00097 {
00098     if (!d->movie)
00099         return false;
00100 
00101     if (d->movie->state() == QMovie::Running)
00102         return true;
00103     else
00104         return false;
00105 }
00106 
00107 void KAnimatedSystemTrayIcon::slotNewFrame()
00108 {
00109     setIcon (QIcon (d->movie->currentPixmap()));
00110 }

kopete/kopete

Skip menu "kopete/kopete"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal