From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/plugins/nowlistening/nowlisteningplugin.h | 111 +++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 kopete/plugins/nowlistening/nowlisteningplugin.h (limited to 'kopete/plugins/nowlistening/nowlisteningplugin.h') diff --git a/kopete/plugins/nowlistening/nowlisteningplugin.h b/kopete/plugins/nowlistening/nowlisteningplugin.h new file mode 100644 index 00000000..7a608fd2 --- /dev/null +++ b/kopete/plugins/nowlistening/nowlisteningplugin.h @@ -0,0 +1,111 @@ +/* + nowlisteningplugin.h + + Kopete Now Listening To plugin + + Copyright (c) 2002,2003,2004 by Will Stephenson + Copyright (c) 2005 by Michaël Larouche + + Kopete (c) 2002-2005 by the Kopete developers + + ************************************************************************* + * * + * 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 NOWLISTENINGPLUGIN_H +#define NOWLISTENINGPLUGIN_H + + +#include "kopeteplugin.h" +#include + +namespace Kopete { class ChatSession; class Message; } + +class NLMediaPlayer; +class QStringList; + +/** + * @author Will Stephenson + * @author Michaël Larouche + */ +class NowListeningPlugin : public Kopete::Plugin +{ + Q_OBJECT + +friend class NowListeningGUIClient; + + public: + NowListeningPlugin( QObject *parent, const char *name, const QStringList &args ); + virtual ~NowListeningPlugin(); + static NowListeningPlugin* plugin(); + + public slots: + void slotMediaCommand( const QString &, Kopete::ChatSession *theChat ); + void slotOutgoingMessage(Kopete::Message&); + void slotAdvertCurrentMusic(); + + protected: + /** + * Constructs a string containing the track information. + * @param update Whether the players must update their data. It can be + * useful to set it to false if one already has called + * update somewhere else, for instance in newTrackPlaying(). + */ + QString mediaPlayerAdvert(bool update = true); + /** + * @internal Build the message for @ref mediaPlayerAdvert + * @param message Reference to the messsage, because return QString cause data loss. + * @param player Pointer to the current Media Player. + * Used to get the information about the current track playing. + * @param update Whether the players must update their data. It can be + * useful to set it to false if one already has called + * update somewhere else, for instance in newTrackPlaying(). + */ + void buildTrackMessage(QString &message, NLMediaPlayer *player, bool update); + /** + * @return true if one of the players has changed track since the last message. + */ + bool newTrackPlaying(void) const; + /** + * Creates the string for a single player + * @p player - the media player we're using + * @p in - the source format string + * @p bool - is this call within a set of brackets for conditional expansion? + */ + QString substDepthFirst( NLMediaPlayer *player, QString in, bool inBrackets) const; + /** + * Sends a message to a single chat + */ + void advertiseToChat( Kopete::ChatSession* theChat, QString message ); + /** + * Update the currentMedia pointer on config change. + */ + void updateCurrentMediaPlayer(); + + protected slots: + /** + * Reacts to a new chat starting and adds actions to its GUI + */ + void slotNewKMM( Kopete::ChatSession* ); + + /** + * Reacts to the plugin's settings changed signal, originating from the KCModule dispatcher + */ + void slotSettingsChanged(); + + private: + class Private; + Private *d; + + static NowListeningPlugin* pluginStatic_; +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: -- cgit v1.2.1