From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/libkopete/private/kopeteemoticons.cpp | 170 +++++++++++++-------------- 1 file changed, 85 insertions(+), 85 deletions(-) (limited to 'kopete/libkopete/private/kopeteemoticons.cpp') diff --git a/kopete/libkopete/private/kopeteemoticons.cpp b/kopete/libkopete/private/kopeteemoticons.cpp index 0b234deb..a2d33341 100644 --- a/kopete/libkopete/private/kopeteemoticons.cpp +++ b/kopete/libkopete/private/kopeteemoticons.cpp @@ -21,11 +21,11 @@ #include "kopeteprefs.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -50,10 +50,10 @@ struct Emoticons::Emoticon Emoticon(){} /* sort by longest to shortest matchText */ bool operator< (const Emoticon &e){ return matchText.length() > e.matchText.length(); } - QString matchText; - QString matchTextEscaped; + TQString matchText; + TQString matchTextEscaped; QString picPath; - QString picHTMLCode; + TQString picHTMLCode; }; /* This is the object we will store each emoticon match in */ @@ -67,13 +67,13 @@ struct Emoticons::EmoticonNode { class Emoticons::Private { public: - QMap > emoticonMap; - QMap emoticonAndPicList; + TQMap > emoticonMap; + TQMap emoticonAndPicList; /** * The current icon theme from KopetePrefs */ - QString theme; + TQString theme; }; @@ -89,19 +89,19 @@ Emoticons *Emoticons::self() } -QString Emoticons::parseEmoticons(const QString& message, ParseMode mode ) //static +TQString Emoticons::parseEmoticons(const TQString& message, ParseMode mode ) //static { return self()->parse( message, mode ); } -QValueList Emoticons::tokenizeEmoticons( const QString& message, ParseMode mode ) // static +TQValueList Emoticons::tokenizeEmoticons( const TQString& message, ParseMode mode ) // static { return self()->tokenize( message, mode ); } -QValueList Emoticons::tokenize( const QString& message, uint mode ) +TQValueList Emoticons::tokenize( const TQString& message, uint mode ) { - QValueList result; + TQValueList result; if ( !KopetePrefs::prefs()->useEmoticons() ) { result.append( Token( Text, message ) ); @@ -115,23 +115,23 @@ QValueList Emoticons::tokenize( const QString& message, uint m } /* previous char, in the firs iteration assume that it is space since we want - * to let emoticons at the beginning, the very first previous QChar must be a space. */ - QChar p = ' '; - QChar c; /* current char */ - QChar n; /* next character after a match candidate, if strict this should be QChar::null or space */ + * to let emoticons at the beginning, the very first previous TQChar must be a space. */ + TQChar p = ' '; + TQChar c; /* current char */ + TQChar n; /* next character after a match candidate, if strict this should be TQChar::null or space */ /* This is the EmoticonNode container, it will represent each matched emoticon */ - QValueList foundEmoticons; - QValueList::const_iterator found; + TQValueList foundEmoticons; + TQValueList::const_iterator found; /* First-pass, store the matched emoticon locations in foundEmoticons */ - QValueList emoticonList; - QValueList::const_iterator it; + TQValueList emoticonList; + TQValueList::const_iterator it; size_t pos; bool inHTMLTag = false; bool inHTMLLink = false; bool inHTMLEntity = false; - QString needle; // search for this + TQString needle; // search for this for ( pos = 0; pos < message.length(); pos++ ) { c = message[ pos ]; @@ -271,14 +271,14 @@ QValueList Emoticons::tokenize( const QString& message, uint m return result; } -Emoticons::Emoticons( const QString &theme ) : QObject( kapp, "KopeteEmoticons" ) +Emoticons::Emoticons( const TQString &theme ) : TQObject( kapp, "KopeteEmoticons" ) { // kdDebug(14010) << "KopeteEmoticons::KopeteEmoticons" << endl; d=new Private; if(theme.isNull()) { initEmoticons(); - connect( KopetePrefs::prefs(), SIGNAL(saved()), this, SLOT(initEmoticons()) ); + connect( KopetePrefs::prefs(), TQT_SIGNAL(saved()), this, TQT_SLOT(initEmoticons()) ); } else { @@ -294,32 +294,32 @@ Emoticons::~Emoticons( ) -void Emoticons::addIfPossible( const QString& filenameNoExt, const QStringList &emoticons ) +void Emoticons::addIfPossible( const TQString& filenameNoExt, const TQStringList &emoticons ) { KStandardDirs *dir = KGlobal::dirs(); - QString pic; + TQString pic; //maybe an extension was given, so try to find the exact file - pic = dir->findResource( "emoticons", d->theme + QString::fromLatin1( "/" ) + filenameNoExt ); + pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt ); if( pic.isNull() ) - pic = dir->findResource( "emoticons", d->theme + QString::fromLatin1( "/" ) + filenameNoExt + QString::fromLatin1( ".mng" ) ); + pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".mng" ) ); if ( pic.isNull() ) - pic = dir->findResource( "emoticons", d->theme + QString::fromLatin1( "/" ) + filenameNoExt + QString::fromLatin1( ".png" ) ); + pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".png" ) ); if ( pic.isNull() ) - pic = dir->findResource( "emoticons", d->theme + QString::fromLatin1( "/" ) + filenameNoExt + QString::fromLatin1( ".gif" ) ); + pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".gif" ) ); if( !pic.isNull() ) // only add if we found one file { - QPixmap p; - QString result; + TQPixmap p; + TQString result; d->emoticonAndPicList.insert( pic, emoticons ); - for ( QStringList::const_iterator it = emoticons.constBegin(), end = emoticons.constEnd(); + for ( TQStringList::const_iterator it = emoticons.constBegin(), end = emoticons.constEnd(); it != end; ++it ) { - QString matchEscaped=QStyleSheet::escape(*it); + TQString matchEscaped=TQStyleSheet::escape(*it); Emoticon e; e.picPath = pic; @@ -328,15 +328,15 @@ void Emoticons::addIfPossible( const QString& filenameNoExt, const QStringList & // Unless we do so, ChatMessagePart::slotScrollView does not work properly and causing // HTMLPart not to be scrolled to the very last message. p.load( e.picPath ); - result = QString::fromLatin1( "" ); + TQString::fromLatin1( "\" width=\"" ) + + TQString::number( p.width() ) + + TQString::fromLatin1( "\" height=\"" ) + + TQString::number( p.height() ) + + TQString::fromLatin1( "\" />" ); e.picHTMLCode = result; e.matchTextEscaped = matchEscaped; @@ -347,7 +347,7 @@ void Emoticons::addIfPossible( const QString& filenameNoExt, const QStringList & } } -void Emoticons::initEmoticons( const QString &theme ) +void Emoticons::initEmoticons( const TQString &theme ) { if(theme.isNull()) { @@ -365,43 +365,43 @@ void Emoticons::initEmoticons( const QString &theme ) d->emoticonAndPicList.clear(); d->emoticonMap.clear(); - QString filename= KGlobal::dirs()->findResource( "emoticons", d->theme + QString::fromLatin1( "/emoticons.xml" ) ); + TQString filename= KGlobal::dirs()->findResource( "emoticons", d->theme + TQString::fromLatin1( "/emoticons.xml" ) ); if(!filename.isEmpty()) return initEmoticon_emoticonsxml( filename ); - filename= KGlobal::dirs()->findResource( "emoticons", d->theme + QString::fromLatin1( "/icondef.xml" ) ); + filename= KGlobal::dirs()->findResource( "emoticons", d->theme + TQString::fromLatin1( "/icondef.xml" ) ); if(!filename.isEmpty()) return initEmoticon_JEP0038( filename ); kdWarning(14010) << k_funcinfo << "emotiucon XML theme description not found" < keys = d->emoticonMap.keys(); - for ( QValueList::const_iterator it = keys.begin(); it != keys.end(); ++it ) + TQValueList keys = d->emoticonMap.keys(); + for ( TQValueList::const_iterator it = keys.begin(); it != keys.end(); ++it ) { - QChar key = (*it); - QValueList keyValues = d->emoticonMap[key]; + TQChar key = (*it); + TQValueList keyValues = d->emoticonMap[key]; qHeapSort(keyValues.begin(), keyValues.end()); d->emoticonMap[key] = keyValues; } @@ -516,21 +516,21 @@ void Emoticons::sortEmoticons() -QMap Emoticons::emoticonAndPicList() +TQMap Emoticons::emoticonAndPicList() { return d->emoticonAndPicList; } -QString Emoticons::parse( const QString &message, ParseMode mode ) +TQString Emoticons::parse( const TQString &message, ParseMode mode ) { if ( !KopetePrefs::prefs()->useEmoticons() ) return message; - QValueList tokens = tokenize( message, mode ); - QValueList::const_iterator token; - QString result; - QPixmap p; + TQValueList tokens = tokenize( message, mode ); + TQValueList::const_iterator token; + TQString result; + TQPixmap p; for ( token = tokens.begin(); token != tokens.end(); ++token ) { switch ( (*token).type ) -- cgit v1.2.1