diff options
Diffstat (limited to 'kopete/plugins/nowlistening/nowlisteningplugin.cpp')
-rw-r--r-- | kopete/plugins/nowlistening/nowlisteningplugin.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/kopete/plugins/nowlistening/nowlisteningplugin.cpp b/kopete/plugins/nowlistening/nowlisteningplugin.cpp index e28316be..4c286b0f 100644 --- a/kopete/plugins/nowlistening/nowlisteningplugin.cpp +++ b/kopete/plugins/nowlistening/nowlisteningplugin.cpp @@ -18,9 +18,9 @@ ************************************************************************* */ -#include <qtimer.h> -#include <qstringlist.h> -#include <qregexp.h> +#include <tqtimer.h> +#include <tqstringlist.h> +#include <tqregexp.h> #include <kdebug.h> #include <kgenericfactory.h> @@ -59,7 +59,7 @@ public: {} // abstracted media player interfaces - QPtrList<NLMediaPlayer> m_mediaPlayerList; + TQPtrList<NLMediaPlayer> m_mediaPlayerList; NLMediaPlayer *m_currentMediaPlayer; // Needed for DCOP interprocess communication @@ -69,16 +69,16 @@ public: // Used when using automatic advertising to know who has already gotten // the music information - QStringList m_musicSentTo; + TQStringList m_musicSentTo; // Used when advertising to status message. - QTimer *advertTimer; + TQTimer *advertTimer; }; typedef KGenericFactory<NowListeningPlugin> NowListeningPluginFactory; K_EXPORT_COMPONENT_FACTORY( kopete_nowlistening, NowListeningPluginFactory( "kopete_nowlistening" ) ) -NowListeningPlugin::NowListeningPlugin( QObject *parent, const char* name, const QStringList& /*args*/ ) +NowListeningPlugin::NowListeningPlugin( TQObject *parent, const char* name, const TQStringList& /*args*/ ) : Kopete::Plugin( NowListeningPluginFactory::instance(), parent, name ) { if ( pluginStatic_ ) @@ -91,18 +91,18 @@ NowListeningPlugin::NowListeningPlugin( QObject *parent, const char* name, const kdDebug(14307) << k_funcinfo << endl; // Connection for the "/media" command (always needed) - connect( Kopete::ChatSessionManager::self(), SIGNAL( - chatSessionCreated( Kopete::ChatSession * )) , SLOT( slotNewKMM( + connect( Kopete::ChatSessionManager::self(), TQT_SIGNAL( + chatSessionCreated( Kopete::ChatSession * )) , TQT_SLOT( slotNewKMM( Kopete::ChatSession * ) ) ); // If autoadvertising is on... connect(Kopete::ChatSessionManager::self(), - SIGNAL(aboutToSend(Kopete::Message&)), + TQT_SIGNAL(aboutToSend(Kopete::Message&)), this, - SLOT(slotOutgoingMessage(Kopete::Message&))); + TQT_SLOT(slotOutgoingMessage(Kopete::Message&))); - QValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions(); - for (QValueListIterator<Kopete::ChatSession*> it= sessions.begin(); it!=sessions.end() ; ++it) + TQValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions(); + for (TQValueListIterator<Kopete::ChatSession*> it= sessions.begin(); it!=sessions.end() ; ++it) slotNewKMM( *it ); // get a pointer to the dcop client @@ -130,16 +130,16 @@ NowListeningPlugin::NowListeningPlugin( QObject *parent, const char* name, const Kopete::CommandHandler::commandHandler()->registerCommand( this, "media", - SLOT( slotMediaCommand( const QString &, Kopete::ChatSession * ) ), + TQT_SLOT( slotMediaCommand( const TQString &, Kopete::ChatSession * ) ), i18n("USAGE: /media - Displays information on current song"), 0 ); - connect ( this , SIGNAL( settingsChanged() ) , this , SLOT( slotSettingsChanged() ) ); + connect ( this , TQT_SIGNAL( settingsChanged() ) , this , TQT_SLOT( slotSettingsChanged() ) ); // Advert the accounts with the current listened track. - d->advertTimer = new QTimer(this); - connect(d->advertTimer, SIGNAL( timeout() ), this, SLOT( slotAdvertCurrentMusic() ) ); + d->advertTimer = new TQTimer(this); + connect(d->advertTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotAdvertCurrentMusic() ) ); d->advertTimer->start(5000); // Update every 5 seconds } @@ -162,9 +162,9 @@ NowListeningPlugin* NowListeningPlugin::plugin() return pluginStatic_ ; } -void NowListeningPlugin::slotMediaCommand( const QString &args, Kopete::ChatSession *theChat ) +void NowListeningPlugin::slotMediaCommand( const TQString &args, Kopete::ChatSession *theChat ) { - QString advert = mediaPlayerAdvert(); + TQString advert = mediaPlayerAdvert(); if ( advert.isEmpty() ) { // Catch no players/no track playing message case: @@ -189,14 +189,14 @@ void NowListeningPlugin::slotOutgoingMessage(Kopete::Message& msg) if(!NowListeningConfig::self()->chatAdvertising()) return; - QString originalBody = msg.plainBody(); + TQString originalBody = msg.plainBody(); // If it is a /media message, don't process it if(originalBody.startsWith(NowListeningConfig::self()->header())) return; // What will be sent - QString newBody; + TQString newBody; // Getting the list of contacts the message will be sent to to determine if at least // one of them has never gotten the current music information. @@ -204,7 +204,7 @@ void NowListeningPlugin::slotOutgoingMessage(Kopete::Message& msg) bool mustSendAnyway = false; for( Kopete::Contact *c = dest.first() ; c ; c = dest.next() ) { - const QString& cId = c->contactId(); + const TQString& cId = c->contactId(); if( 0 == d->m_musicSentTo.contains( cId ) ) { mustSendAnyway = true; @@ -220,7 +220,7 @@ void NowListeningPlugin::slotOutgoingMessage(Kopete::Message& msg) // has changed since it was last sent. if ( mustSendAnyway || newTrack ) { - QString advert = mediaPlayerAdvert(false); // false since newTrackPlaying() did the update + TQString advert = mediaPlayerAdvert(false); // false since newTrackPlaying() did the update if( !advert.isEmpty() ) newBody = originalBody + "<br>" + advert; @@ -252,9 +252,9 @@ void NowListeningPlugin::slotAdvertCurrentMusic() // This slot is called every 5 seconds, so we check if we have a new track playing. if( newTrackPlaying() ) { - QString advert; + TQString advert; - QPtrList<Kopete::Account> accountsList = Kopete::AccountManager::self()->accounts(); + TQPtrList<Kopete::Account> accountsList = Kopete::AccountManager::self()->accounts(); for( Kopete::Account* a = accountsList.first(); a; a = accountsList.next() ) { /* @@ -266,7 +266,7 @@ void NowListeningPlugin::slotAdvertCurrentMusic() */ if( a->protocol()->pluginId() == "MSNProtocol" && !NowListeningConfig::self()->appendStatusAdvertising() ) { - QString track, artist, album, mediaList; + TQString track, artist, album, mediaList; bool isPlaying=false; if( NowListeningConfig::self()->useSpecifiedMediaPlayer() && d->m_currentMediaPlayer ) @@ -298,7 +298,7 @@ void NowListeningPlugin::slotAdvertCurrentMusic() // KDE4 TODO: Use the new status message framework, and remove this "hack". if( isPlaying ) { - advert = QString("[Music]%1").arg(mediaList); + advert = TQString("[Music]%1").arg(mediaList); } } @@ -308,21 +308,21 @@ void NowListeningPlugin::slotAdvertCurrentMusic() { // Check for the now listening message in parenthesis, // include the header to not override other messages in parenthesis. - QRegExp statusSong( QString(" \\(%1.*\\)$").arg( NowListeningConfig::header()) ); + TQRegExp statusSong( TQString(" \\(%1.*\\)$").arg( NowListeningConfig::header()) ); // HACK: Don't keep appending the now listened song. Replace it in the status message. advert = a->myself()->property( Kopete::Global::Properties::self()->awayMessage() ).value().toString(); // Remove the braces when they are no listened song. - QString mediaAdvert = mediaPlayerAdvert(false); + TQString mediaAdvert = mediaPlayerAdvert(false); if(!mediaAdvert.isEmpty()) { if(statusSong.search(advert) != -1) { - advert = advert.replace(statusSong, QString(" (%1)").arg(mediaPlayerAdvert(false)) ); + advert = advert.replace(statusSong, TQString(" (%1)").arg(mediaPlayerAdvert(false)) ); } else { - advert += QString(" (%1)").arg( mediaPlayerAdvert(false) ); + advert += TQString(" (%1)").arg( mediaPlayerAdvert(false) ); } } else @@ -341,10 +341,10 @@ void NowListeningPlugin::slotAdvertCurrentMusic() } } -QString NowListeningPlugin::mediaPlayerAdvert(bool update) +TQString NowListeningPlugin::mediaPlayerAdvert(bool update) { // generate message for all players - QString message; + TQString message; if( NowListeningConfig::self()->useSpecifiedMediaPlayer() && d->m_currentMediaPlayer != 0L ) { @@ -363,9 +363,9 @@ QString NowListeningPlugin::mediaPlayerAdvert(bool update) return message; } -void NowListeningPlugin::buildTrackMessage(QString &message, NLMediaPlayer *player, bool update) +void NowListeningPlugin::buildTrackMessage(TQString &message, NLMediaPlayer *player, bool update) { - QString perTrack = NowListeningConfig::self()->perTrack(); + TQString perTrack = NowListeningConfig::self()->perTrack(); if(update) player->update(); @@ -401,17 +401,17 @@ bool NowListeningPlugin::newTrackPlaying(void) const return false; } -QString NowListeningPlugin::substDepthFirst( NLMediaPlayer *player, - QString in, bool inBrackets ) const +TQString NowListeningPlugin::substDepthFirst( NLMediaPlayer *player, + TQString in, bool inBrackets ) const { - QString track = player->track(); - QString artist = player->artist(); - QString album = player->album(); - QString playerName = player->name(); + TQString track = player->track(); + TQString artist = player->artist(); + TQString album = player->album(); + TQString playerName = player->name(); for ( unsigned int i = 0; i < in.length(); i++ ) { - QChar c = in.at( i ); + TQChar c = in.at( i ); //kdDebug(14307) << "Now working on:" << in << " char is: " << c << endl; if ( c == '(' ) { @@ -420,7 +420,7 @@ QString NowListeningPlugin::substDepthFirst( NLMediaPlayer *player, //kdDebug(14307) << "Looking for ')'" << endl; for ( unsigned int j = i + 1; j < in.length(); j++ ) { - QChar d = in.at( j ); + TQChar d = in.at( j ); //kdDebug(14307) << "Got " << d << endl; if ( d == '(' ) depth++; @@ -430,7 +430,7 @@ QString NowListeningPlugin::substDepthFirst( NLMediaPlayer *player, if ( depth == 0 ) { // recursively replace contents of matching () - QString substitution = substDepthFirst( player, + TQString substitution = substDepthFirst( player, in.mid( i + 1, j - i - 1), true ) ; in.replace ( i, j - i + 1, substitution ); // perform substitution and return the result @@ -484,7 +484,7 @@ QString NowListeningPlugin::substDepthFirst( NLMediaPlayer *player, return in; } -void NowListeningPlugin::advertiseToChat( Kopete::ChatSession *theChat, QString message ) +void NowListeningPlugin::advertiseToChat( Kopete::ChatSession *theChat, TQString message ) { Kopete::ContactPtrList pl = theChat->members(); @@ -522,27 +522,27 @@ void NowListeningPlugin::slotSettingsChanged() updateCurrentMediaPlayer(); disconnect(Kopete::ChatSessionManager::self(), - SIGNAL(aboutToSend(Kopete::Message&)), + TQT_SIGNAL(aboutToSend(Kopete::Message&)), this, - SLOT(slotOutgoingMessage(Kopete::Message&))); + TQT_SLOT(slotOutgoingMessage(Kopete::Message&))); d->advertTimer->stop(); - disconnect(d->advertTimer, SIGNAL(timeout()), this, SLOT(slotAdvertCurrentMusic())); + disconnect(d->advertTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotAdvertCurrentMusic())); if( NowListeningConfig::self()->chatAdvertising() ) { kdDebug(14307) << k_funcinfo << "Now using chat window advertising." << endl; connect(Kopete::ChatSessionManager::self(), - SIGNAL(aboutToSend(Kopete::Message&)), + TQT_SIGNAL(aboutToSend(Kopete::Message&)), this, - SLOT(slotOutgoingMessage(Kopete::Message&))); + TQT_SLOT(slotOutgoingMessage(Kopete::Message&))); } else if( NowListeningConfig::self()->statusAdvertising() || NowListeningConfig::self()->appendStatusAdvertising() ) { kdDebug(14307) << k_funcinfo << "Now using status message advertising." << endl; - connect(d->advertTimer, SIGNAL(timeout()), this, SLOT(slotAdvertCurrentMusic())); + connect(d->advertTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotAdvertCurrentMusic())); d->advertTimer->start(5000); } } |