summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/kopeteonlinestatusmanager.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/libkopete/kopeteonlinestatusmanager.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz
tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/libkopete/kopeteonlinestatusmanager.cpp')
-rw-r--r--kopete/libkopete/kopeteonlinestatusmanager.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/kopete/libkopete/kopeteonlinestatusmanager.cpp b/kopete/libkopete/kopeteonlinestatusmanager.cpp
index 61c41b83..67364e6b 100644
--- a/kopete/libkopete/kopeteonlinestatusmanager.cpp
+++ b/kopete/libkopete/kopeteonlinestatusmanager.cpp
@@ -41,16 +41,16 @@ class OnlineStatusManager::Private
struct RegisteredStatusStruct
{
- QString caption;
+ TQString caption;
unsigned int categories;
unsigned int options;
};
- typedef QMap< OnlineStatus , RegisteredStatusStruct > ProtocolMap ;
+ typedef TQMap< OnlineStatus , RegisteredStatusStruct > ProtocolMap ;
- QPixmap *nullPixmap;
- QMap<Protocol* , ProtocolMap > registeredStatus;
- QDict< QPixmap > iconCache;
+ TQPixmap *nullPixmap;
+ TQMap<Protocol* , ProtocolMap > registeredStatus;
+ TQDict< TQPixmap > iconCache;
};
OnlineStatusManager *OnlineStatusManager::s_self=0L;
@@ -68,7 +68,7 @@ OnlineStatusManager::OnlineStatusManager()
{
d->iconCache.setAutoDelete( true );
d->nullPixmap = new QPixmap;
- connect( kapp, SIGNAL( iconChanged(int) ), this, SLOT( slotIconsChanged() ) );
+ connect( kapp, TQT_SIGNAL( iconChanged(int) ), this, TQT_SLOT( slotIconsChanged() ) );
}
OnlineStatusManager::~OnlineStatusManager()
@@ -83,7 +83,7 @@ void OnlineStatusManager::slotIconsChanged()
emit iconsChanged();
}
-void OnlineStatusManager::registerOnlineStatus( const OnlineStatus &status, const QString & caption, unsigned int categories, unsigned int options)
+void OnlineStatusManager::registerOnlineStatus( const OnlineStatus &status, const TQString & caption, unsigned int categories, unsigned int options)
{
Private::RegisteredStatusStruct s;
s.caption=caption;
@@ -133,25 +133,25 @@ OnlineStatus OnlineStatusManager::onlineStatus(Protocol * protocol, Categories c
return OnlineStatus();
}
-QString OnlineStatusManager::fingerprint( const OnlineStatus &statusFor, const QString& icon, int size, QColor color, bool idle)
+TQString OnlineStatusManager::fingerprint( const OnlineStatus &statusFor, const TQString& icon, int size, TQColor color, bool idle)
{
// create a 'fingerprint' to use as a hash key
// fingerprint consists of description/icon name/color/overlay name/size/idle state
- return QString::fromLatin1("%1/%2/%3/%4/%5/%6")
+ return TQString::fromLatin1("%1/%2/%3/%4/%5/%6")
.arg( statusFor.description() )
.arg( icon )
.arg( color.name() )
- .arg( statusFor.overlayIcons().join( QString::fromLatin1( "," ) ) )
+ .arg( statusFor.overlayIcons().join( TQString::fromLatin1( "," ) ) )
.arg( size )
.arg( idle ? 'i' : 'a' );
}
-QPixmap OnlineStatusManager::cacheLookupByObject( const OnlineStatus &statusFor, const QString& icon, int size, QColor color, bool idle)
+TQPixmap OnlineStatusManager::cacheLookupByObject( const OnlineStatus &statusFor, const TQString& icon, int size, TQColor color, bool idle)
{
- QString fp = fingerprint( statusFor, icon, size, color, idle );
+ TQString fp = fingerprint( statusFor, icon, size, color, idle );
// look it up in the cache
- QPixmap *theIcon= d->iconCache.find( fp );
+ TQPixmap *theIcon= d->iconCache.find( fp );
if ( !theIcon )
{
// cache miss
@@ -162,10 +162,10 @@ QPixmap OnlineStatusManager::cacheLookupByObject( const OnlineStatus &statusFor,
return *theIcon;
}
-QPixmap OnlineStatusManager::cacheLookupByMimeSource( const QString &mimeSource )
+TQPixmap OnlineStatusManager::cacheLookupByMimeSource( const TQString &mimeSource )
{
// look it up in the cache
- const QPixmap *theIcon= d->iconCache.find( mimeSource );
+ const TQPixmap *theIcon= d->iconCache.find( mimeSource );
if ( !theIcon )
{
// need to return an invalid pixmap
@@ -176,7 +176,7 @@ QPixmap OnlineStatusManager::cacheLookupByMimeSource( const QString &mimeSource
// This code was forked from the broken KImageEffect::blendOnLower, but it's
// been so heavily fixed and rearranged it's hard to recognise that now.
-static void blendOnLower( const QImage &upper_, QImage &lower, const QPoint &offset )
+static void blendOnLower( const TQImage &upper_, TQImage &lower, const TQPoint &offset )
{
if ( upper_.width() <= 0 || upper_.height() <= 0 )
return;
@@ -187,7 +187,7 @@ static void blendOnLower( const QImage &upper_, QImage &lower, const QPoint &off
if ( offset.y() < 0 || offset.y() >= lower.height() )
return;
- QImage upper = upper_;
+ TQImage upper = upper_;
if ( upper.depth() != 32 )
upper = upper.convertDepth( 32 );
if ( lower.depth() != 32 )
@@ -223,12 +223,12 @@ static void blendOnLower( const QImage &upper_, QImage &lower, const QPoint &off
}
// Get bounding box of image via alpha channel
-static QRect getBoundingBox( const QImage& image )
+static TQRect getBoundingBox( const TQImage& image )
{
const int width = image.width();
const int height = image.height();
if ( width <= 0 || height <= 0 )
- return QRect();
+ return TQRect();
// scan image from left to right and top to bottom
// to get upper left corner of bounding box
@@ -267,39 +267,39 @@ static QRect getBoundingBox( const QImage& image )
}
}
}
- return QRect( x1, y1, std::max( 0, x2-x1+1 ), std::max( 0, y2-y1+1 ) );
+ return TQRect( x1, y1, std::max( 0, x2-x1+1 ), std::max( 0, y2-y1+1 ) );
}
// Get offset for upperImage to blend it in the i%4-th corner of lowerImage:
// bottom right, bottom left, top left, top right
-static QPoint getOffsetForCorner( const QImage& upperImage, const QImage& lowerImage, const int i )
+static TQPoint getOffsetForCorner( const TQImage& upperImage, const TQImage& lowerImage, const int i )
{
const int dX = lowerImage.width() - upperImage.width();
const int dY = lowerImage.height() - upperImage.height();
const int corner = i % 4;
- QPoint offset;
+ TQPoint offset;
switch( corner ) {
case 0:
// bottom right
- offset = QPoint( dX, dY );
+ offset = TQPoint( dX, dY );
break;
case 1:
// bottom left
- offset = QPoint( 0, dY );
+ offset = TQPoint( 0, dY );
break;
case 2:
// top left
- offset = QPoint( 0, 0 );
+ offset = TQPoint( 0, 0 );
break;
case 3:
// top right
- offset = QPoint( dX, 0 );
+ offset = TQPoint( dX, 0 );
break;
}
return offset;
}
-QPixmap* OnlineStatusManager::renderIcon( const OnlineStatus &statusFor, const QString& baseIcon, int size, QColor color, bool idle) const
+TQPixmap* OnlineStatusManager::renderIcon( const OnlineStatus &statusFor, const TQString& baseIcon, int size, TQColor color, bool idle) const
{
// create an icon suiting the status from the base icon
// use reasonable defaults if not provided or protocol not set
@@ -307,7 +307,7 @@ QPixmap* OnlineStatusManager::renderIcon( const OnlineStatus &statusFor, const Q
if ( baseIcon == statusFor.overlayIcons().first() )
kdWarning( 14010 ) << "Base and overlay icons are the same - icon effects will not be visible." << endl;
- QPixmap* basis = new QPixmap( SmallIcon( baseIcon ) );
+ TQPixmap* basis = new TQPixmap( SmallIcon( baseIcon ) );
// Colorize
if ( color.isValid() )
@@ -317,19 +317,19 @@ QPixmap* OnlineStatusManager::renderIcon( const OnlineStatus &statusFor, const Q
// that to be colored in this case.
if ( statusFor.internalStatus() == Kopete::OnlineStatus::AccountOffline || statusFor.status() == Kopete::OnlineStatus::Offline )
{
- *basis = KIconEffect().apply( *basis, KIconEffect::ToGray , 0.85, QColor() , false );
+ *basis = KIconEffect().apply( *basis, KIconEffect::ToGray , 0.85, TQColor() , false );
}
//composite the iconOverlay for this status and the supplied baseIcon
- QStringList overlays = statusFor.overlayIcons();
+ TQStringList overlays = statusFor.overlayIcons();
if ( !( overlays.isEmpty() ) ) // otherwise leave the basis as-is
{
KIconLoader *loader = KGlobal::instance()->iconLoader();
int i = 0;
- for( QStringList::iterator it = overlays.begin(), end = overlays.end(); it != end; ++it )
+ for( TQStringList::iterator it = overlays.begin(), end = overlays.end(); it != end; ++it )
{
- QPixmap overlay = loader->loadIcon(*it, KIcon::Small, 0 ,
+ TQPixmap overlay = loader->loadIcon(*it, KIcon::Small, 0 ,
KIcon::DefaultState, 0L, /*canReturnNull=*/ true );
if ( !overlay.isNull() )
@@ -337,10 +337,10 @@ QPixmap* OnlineStatusManager::renderIcon( const OnlineStatus &statusFor, const Q
// we want to preserve the alpha channels of both basis and overlay.
// there's no way to do this in Qt. In fact, there's no way to do this
// in KDE since KImageEffect is so badly broken.
- QImage basisImage = basis->convertToImage();
- QImage overlayImage = overlay.convertToImage();
- QPoint offset;
- if ( (*it).endsWith( QString::fromLatin1( "_overlay" ) ) )
+ TQImage basisImage = basis->convertToImage();
+ TQImage overlayImage = overlay.convertToImage();
+ TQPoint offset;
+ if ( (*it).endsWith( TQString::fromLatin1( "_overlay" ) ) )
{
// it is possible to have more than one overlay icon
// to avoid overlapping we place them in different corners
@@ -357,8 +357,8 @@ QPixmap* OnlineStatusManager::renderIcon( const OnlineStatus &statusFor, const Q
// no need to scale if the icon is already of the required size (assuming height == width!)
if ( basis->width() != size )
{
- QImage scaledImg = basis->convertToImage().smoothScale( size, size );
- *basis = QPixmap( scaledImg );
+ TQImage scaledImg = basis->convertToImage().smoothScale( size, size );
+ *basis = TQPixmap( scaledImg );
}
// if idle, apply effects
@@ -379,27 +379,27 @@ void OnlineStatusManager::createAccountStatusActions( Account *account , KAction
continue;
OnlineStatus status=it.key();
- QString caption=it.data().caption;
+ TQString caption=it.data().caption;
KAction *action;
// Any existing actions owned by the account are reused by recovering them
// from the parent's child list.
// The description of the onlinestatus is used as the qobject name
// This is safe as long as OnlineStatus are immutable
- QCString actionName = status.description().ascii();
+ TQCString actionName = status.description().ascii();
if ( !( action = static_cast<KAction*>( account->child( actionName ) ) ) )
{
if(options & OnlineStatusManager::HasAwayMessage)
{
action = new AwayAction( status, caption, status.iconFor(account), 0, account,
- SLOT( setOnlineStatus( const Kopete::OnlineStatus&, const QString& ) ),
+ TQT_SLOT( setOnlineStatus( const Kopete::OnlineStatus&, const TQString& ) ),
account, actionName );
}
else
{
action=new OnlineStatusAction( status, caption, status.iconFor(account) , account, actionName );
- connect(action,SIGNAL(activated(const Kopete::OnlineStatus&)) ,
- account, SLOT(setOnlineStatus(const Kopete::OnlineStatus&)));
+ connect(action,TQT_SIGNAL(activated(const Kopete::OnlineStatus&)) ,
+ account, TQT_SLOT(setOnlineStatus(const Kopete::OnlineStatus&)));
}
}
@@ -416,10 +416,10 @@ void OnlineStatusManager::createAccountStatusActions( Account *account , KAction
}
-OnlineStatusAction::OnlineStatusAction( const OnlineStatus& status, const QString &text, const QIconSet &pix, QObject *parent, const char *name)
+OnlineStatusAction::OnlineStatusAction( const OnlineStatus& status, const TQString &text, const TQIconSet &pix, TQObject *parent, const char *name)
: KAction( text, pix, KShortcut() , parent, name) , m_status(status)
{
- connect(this,SIGNAL(activated()),this,SLOT(slotActivated()));
+ connect(this,TQT_SIGNAL(activated()),this,TQT_SLOT(slotActivated()));
}
void OnlineStatusAction::slotActivated()