[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: [kopete-devel] Port SystemTray to KSystemTrayIcon
From: Lukas Appelhans <l.appelhans () gmx ! de>
Date: 2008-09-15 15:23:18
Message-ID: 200809151723.18250.l.appelhans () gmx ! de
[Download RAW message or body]
Hi!
I just merged KSystemTrayIcon and KAnimatedSystemTrayIcon, so I prepared a
patch for Kopete to use KSystemTrayIcon as well...
Ok to commit?
Lukas
["kopete-ksystemtrayicon.diff" (text/x-patch)]
Index: kopete/kanimatedsystemtrayicon.h
===================================================================
--- kopete/kanimatedsystemtrayicon.h (revision 861248)
+++ kopete/kanimatedsystemtrayicon.h (working copy)
@@ -1,110 +0,0 @@
-/*
- kanimatedsystemtrayicon.cpp - System Tray Icon that can play movies
- Designed for Kopete but usable anywhere
-
- Copyright (c) 2007 by Charles Connell <charles@connells.org>
-
- Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@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 KANIMATEDSYSTEMTRAYICON_H
-#define KANIMATEDSYSTEMTRAYICON_H
-
-#include <ksystemtrayicon.h>
-
-/**
- * \brief %KDE Animated System Tray Icon class
- * Same as @see KSystemTrayIcon, but can handle movies
- * in the form of @see QMovie.
- *
- * @author Charles Connell <charles@connells.org>
- **/
-
-class QMovie;
-
-class KAnimatedSystemTrayIcon : public KSystemTrayIcon
-{
- Q_OBJECT
- public:
-
- /**
- * Construct a system tray icon.
- *
- * The parent widget @p parent has a special meaning:
- * Besides owning the tray window, the parent widget will
- * dissappear from taskbars when it is iconified while the tray
- * window is visible. This is the desired behavior. After all,
- * the tray window @p is the parent's taskbar icon.
- *
- * Furthermore, the parent widget is shown or raised respectively
- * when the user clicks on the tray window with the left mouse
- * button.
- **/
- explicit KAnimatedSystemTrayIcon ( QWidget* parent = 0 );
-
- /**
- * Same as above but allows one to define the movie by name that should
- * be used for the system tray icon.
- */
- explicit KAnimatedSystemTrayIcon ( const QString& movie, QWidget* parent = 0 );
-
- /**
- * Same as above but allows one to define the movie by QMovie that should
- * be used for the system tray icon. Memory management for the movie will
- * be handled by KAnimatedSystemTrayIcon.
- */
- explicit KAnimatedSystemTrayIcon ( QMovie* movie, QWidget* parent = 0 );
-
-
- ~KAnimatedSystemTrayIcon();
-
- /**
- * Set the movie to use. To manipulate the movie (start, stop, pause), call
- * @see movie() and make calls on the QMovie* that it returns.
- */
- void setMovie (QMovie * movie);
-
- /**
- * Get a pointer to the movie. Use this pointer to manipulate the movie
- * (start, stop, pause).
- * Will return null if no movie has been set
- */
- const QMovie * movie() const;
-
- /**
- * Is the movie playing?
- * @return Whether or not the movie is playing.
- */
- bool isPlaying () const;
-
- public slots:
- /**
- * Start the movie.
- * Will do nothing if no movie has been set.
- */
- void startMovie ();
-
- /**
- * Stop the movie
- * Will do nothing if no movie has been set.
- */
- void stopMovie ();
-
- private slots:
- void slotNewFrame();
-
- private:
- class Private;
- KAnimatedSystemTrayIcon::Private* d;
-};
-
-#endif
Index: kopete/systemtray.cpp
===================================================================
--- kopete/systemtray.cpp (revision 861248)
+++ kopete/systemtray.cpp (working copy)
@@ -55,7 +55,7 @@
}
KopeteSystemTray::KopeteSystemTray(QWidget* parent)
- : KAnimatedSystemTrayIcon(parent)
+ : KSystemTrayIcon(parent)
, mMovie(0)
{
kDebug(14010) ;
@@ -170,7 +170,7 @@
if (!movie())
setMovie( mMovie );
- startMovie();
+ mMovie->start();
}
void KopeteSystemTray::stopBlink()
Index: kopete/CMakeLists.txt
===================================================================
--- kopete/CMakeLists.txt (revision 861248)
+++ kopete/CMakeLists.txt (working copy)
@@ -53,7 +53,6 @@
${kopetecontactlist_SRCS}
main.cpp
kopeteapplication.cpp
- kanimatedsystemtrayicon.cpp
systemtray.cpp
kopetewindow.cpp
kopeteidentitystatusbaricon.cpp
Index: kopete/kanimatedsystemtrayicon.cpp
===================================================================
--- kopete/kanimatedsystemtrayicon.cpp (revision 861248)
+++ kopete/kanimatedsystemtrayicon.cpp (working copy)
@@ -1,110 +0,0 @@
-/*
- kanimatedsystemtrayicon.cpp - System Tray Icon that can play movies
- Designed for Kopete but usable anywhere
-
- Copyright (c) 2007 by Charles Connell <charles@connells.org>
-
- Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@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 "kanimatedsystemtrayicon.h"
-
-#include <QMovie>
-
-class KAnimatedSystemTrayIcon::Private
-{
- public:
- Private (const QString& m)
- {
- movie = new QMovie (m);
- }
-
- Private (QMovie * m = 0)
- {
- movie = m;
- }
-
- ~Private ()
- {
- delete movie;
- }
-
- QMovie * movie;
-};
-
-KAnimatedSystemTrayIcon::KAnimatedSystemTrayIcon(QWidget *parent)
- : KSystemTrayIcon(parent)
-{
- d = new Private(0);
-}
-
-KAnimatedSystemTrayIcon::KAnimatedSystemTrayIcon(const QString &movie, QWidget *parent)
- : KSystemTrayIcon(parent),
- d ( new Private (movie))
-{
-
-}
-
-KAnimatedSystemTrayIcon::KAnimatedSystemTrayIcon(QMovie* movie, QWidget *parent)
- : KSystemTrayIcon(parent),
- d ( new Private (movie))
-{
-
-}
-
-KAnimatedSystemTrayIcon::~KAnimatedSystemTrayIcon()
-{
- delete d;
-}
-
-void KAnimatedSystemTrayIcon::setMovie (QMovie* m)
-{
- delete d->movie;
- d->movie = m;
-}
-
-const QMovie * KAnimatedSystemTrayIcon::movie () const
-{
- return d->movie;
-}
-
-void KAnimatedSystemTrayIcon::startMovie()
-{
- if (d->movie){
- connect (d->movie, SIGNAL(frameChanged(int)), this, SLOT (slotNewFrame()));
- d->movie->setCacheMode (QMovie::CacheAll);
- d->movie->start();
- }
-}
-
-void KAnimatedSystemTrayIcon::stopMovie()
-{
- if (d->movie){
- d->movie->stop();
- }
-}
-
-bool KAnimatedSystemTrayIcon::isPlaying() const
-{
- if (!d->movie)
- return false;
-
- if (d->movie->state() == QMovie::Running)
- return true;
- else
- return false;
-}
-
-void KAnimatedSystemTrayIcon::slotNewFrame()
-{
- setIcon (QIcon (d->movie->currentPixmap()));
-}
Index: kopete/systemtray.h
===================================================================
--- kopete/systemtray.h (revision 861248)
+++ kopete/systemtray.h (working copy)
@@ -23,7 +23,7 @@
#include <QtGui/QIcon>
#include <QtGui/QMovie>
-#include "kanimatedsystemtrayicon.h"
+#include <KSystemTrayIcon>
#include "kopetemessageevent.h"
@@ -36,7 +36,7 @@
* NOTE: This class is for use ONLY in libkopete! It is not public API, and
* is NOT supposed to remain binary compatible in the future!
*/
-class KopeteSystemTray : public KAnimatedSystemTrayIcon
+class KopeteSystemTray : public KSystemTrayIcon
{
Q_OBJECT
@@ -54,7 +54,7 @@
void startBlink();
void stopBlink();
- bool isBlinking() const { return mIsBlinking || isPlaying(); }
+ bool isBlinking() const { return mIsBlinking || movie()->state() == QMovie::Running; }
Q_SIGNALS:
void aboutToShowMenu(KMenu *am);
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic