diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:43:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:43:15 +0000 |
commit | e654398e46e37abf457b2b1122ab898d2c51c49f (patch) | |
tree | d39ee6440f3c3663c3ead84a2d4cc2d034667e96 /noatun/modules/kjofol-skin/kjfont.cpp | |
parent | e4f29b18e19394b9352f52a6c0d0d0e3932cf511 (diff) | |
download | tdemultimedia-e654398e46e37abf457b2b1122ab898d2c51c49f.tar.gz tdemultimedia-e654398e46e37abf457b2b1122ab898d2c51c49f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1157644 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun/modules/kjofol-skin/kjfont.cpp')
-rw-r--r-- | noatun/modules/kjofol-skin/kjfont.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/noatun/modules/kjofol-skin/kjfont.cpp b/noatun/modules/kjofol-skin/kjfont.cpp index df2abed3..c6b16b77 100644 --- a/noatun/modules/kjofol-skin/kjfont.cpp +++ b/noatun/modules/kjofol-skin/kjfont.cpp @@ -16,16 +16,16 @@ #include <kdebug.h> #include <kglobalsettings.h> -#include <qimage.h> -#include <qpainter.h> +#include <tqimage.h> +#include <tqpainter.h> /******************************************* * KJFont *******************************************/ -KJFont::KJFont(const QString &prefix, KJLoader *parent) : mTextMask(0), mTransparentRGB(0) +KJFont::KJFont(const TQString &prefix, KJLoader *parent) : mTextMask(0), mTransparentRGB(0) { -// kdDebug(66666) << "KJFont::KJFont(const QString &prefix, KJLoader *parent)" << prefix.latin1() << endl; +// kdDebug(66666) << "KJFont::KJFont(const TQString &prefix, KJLoader *parent)" << prefix.latin1() << endl; if (prefix=="timefont") { @@ -86,7 +86,7 @@ KJFont::KJFont(const QString &prefix, KJLoader *parent) : mTextMask(0), mTranspa // define color in font that will be transparent later on if ( mTransparent ) { - QImage ibackground = mText.convertToImage(); + TQImage ibackground = mText.convertToImage(); mTransparentRGB = ibackground.pixel( ibackground.width()-1, ibackground.height()-1 ); // kdDebug(66666) << "color (" << qRed(mTransparentRGB) << "," << qGreen(mTransparentRGB) << "," << qBlue(mTransparentRGB) << ") will be transparent for " << prefix.latin1() << endl; mTextMask = KJWidget::getMask(ibackground,mTransparentRGB); @@ -105,8 +105,8 @@ void KJFont::recalcSysFont(void) mUseSysFont = KJLoader::kjofol->prefs()->useSysFont(); if (!mUseSysFont) return; - sysFont = QFont(KJLoader::kjofol->prefs()->sysFont()); - sysFont.setStyleStrategy( QFont::NoAntialias ); + sysFont = TQFont(KJLoader::kjofol->prefs()->sysFont()); + sysFont.setStyleStrategy( TQFont::NoAntialias ); if ( sysFontMetrics ) delete sysFontMetrics; sysFontColor = KJLoader::kjofol->prefs()->sysFontColor(); @@ -117,7 +117,7 @@ void KJFont::recalcSysFont(void) for(fSize = mHeight; fSize>=4; fSize--) { sysFont.setPixelSize ( fSize ); - sysFontMetrics = new QFontMetrics(sysFont); + sysFontMetrics = new TQFontMetrics(sysFont); // kdDebug(66666) << "wanted fSize=" << fSize << ", metric h=" << sysFontMetrics->height() << endl; // either found a small enough font or found no proper font at all if ( sysFontMetrics->height() <= mHeight || fSize==4 ) @@ -129,7 +129,7 @@ void KJFont::recalcSysFont(void) } } -QPixmap KJFont::draw(const QCString &str, int wide, const QPoint &pos) const +TQPixmap KJFont::draw(const TQCString &str, int wide, const TQPoint &pos) const { if ( mUseSysFont ) return drawSysFont(str,wide,pos); @@ -137,24 +137,24 @@ QPixmap KJFont::draw(const QCString &str, int wide, const QPoint &pos) const return drawPixmapFont(str,wide,pos); } -QPixmap KJFont::drawSysFont(const QCString &s, int wide, const QPoint &pos) const +TQPixmap KJFont::drawSysFont(const TQCString &s, int wide, const TQPoint &pos) const { // kdDebug(66666) << k_funcinfo << "BEGIN, s='" << s << "'" << endl; - QPoint to(pos); - QString string(s); + TQPoint to(pos); + TQString string(s); int stringWidth = sysFontMetrics->width( string ); // kdDebug(66666) << "final metrics; w=" << stringWidth << ", h=" << sysFontMetrics->height() << endl; - QPixmap region( + TQPixmap region( (stringWidth > wide ? stringWidth : wide), mHeight); - QPainter rp(®ion); // region painter + TQPainter rp(®ion); // region painter - QBitmap regionMask( + TQBitmap regionMask( (stringWidth > wide ? stringWidth : wide), mHeight, true); // fully transparent mask - QPainter mp(®ionMask); // mask painter + TQPainter mp(®ionMask); // mask painter // kdDebug(66666) << "region; w=" << region.width() << ", h=" << region.height() << endl; @@ -164,7 +164,7 @@ QPixmap KJFont::drawSysFont(const QCString &s, int wide, const QPoint &pos) cons { freeSpace = wide - stringWidth; mp.fillRect ( to.x(), 0, (freeSpace/2), mHeight, Qt::color0 ); - to += QPoint ( (freeSpace/2), 0 ); + to += TQPoint ( (freeSpace/2), 0 ); // kdDebug(66666) << "centering text, freeSpace=" << freeSpace << endl; } @@ -176,13 +176,13 @@ QPixmap KJFont::drawSysFont(const QCString &s, int wide, const QPoint &pos) cons mp.setPen(Qt::color1); mp.drawText(to.x(), to.y(), region.width()-freeSpace, mHeight, Qt::AlignLeft|Qt::AlignTop, string); - to += QPoint(region.width()-freeSpace,0); + to += TQPoint(region.width()-freeSpace,0); // kdDebug(66666) << "text width=" << region.width()-freeSpace << endl; if (freeSpace > 0) { mp.fillRect ( to.x(), 0, (freeSpace/2), mHeight, Qt::color0 ); - to += QPoint ( (freeSpace/2), 0 ); + to += TQPoint ( (freeSpace/2), 0 ); // kdDebug(66666) << "centering text, freeSpace=" << freeSpace << endl; } @@ -192,22 +192,22 @@ QPixmap KJFont::drawSysFont(const QCString &s, int wide, const QPoint &pos) cons return region; } -QPixmap KJFont::drawPixmapFont(const QCString &str, int wide, const QPoint &pos) const +TQPixmap KJFont::drawPixmapFont(const TQCString &str, int wide, const TQPoint &pos) const { // kdDebug(66666) << k_funcinfo << "BEGIN" << endl; - QPoint to(pos); + TQPoint to(pos); - QCString string = str.lower(); - QPixmap region( + TQCString string = str.lower(); + TQPixmap region( (string.length()*mWidth+string.length()*mSpacing > (unsigned int)wide ? string.length()*mWidth+string.length()*mSpacing : wide), mHeight); - QBitmap regionMask( + TQBitmap regionMask( (string.length()*mWidth+string.length()*mSpacing > (unsigned int)wide ? string.length()*mWidth+string.length()*mSpacing : wide), mHeight, true); // fully transparent mask - QPainter mask( ®ionMask ); + TQPainter mask( ®ionMask ); // kdDebug(66666) << "draw: {" << str << "}" << endl; @@ -217,7 +217,7 @@ QPixmap KJFont::drawPixmapFont(const QCString &str, int wide, const QPoint &pos) { freeSpace = wide - string.length()*mWidth+string.length()*mSpacing; mask.fillRect ( to.x(), 0, (freeSpace/2), mHeight, Qt::color0 ); - to += QPoint ( (freeSpace/2), 0 ); + to += TQPoint ( (freeSpace/2), 0 ); } // kdDebug(66666) << k_funcinfo << "pixmap width=" << region.width() << endl; @@ -229,20 +229,20 @@ QPixmap KJFont::drawPixmapFont(const QCString &str, int wide, const QPoint &pos) char c = string[charPos]; // the character to be drawn next drawCharacter(®ion, ®ionMask, to, c); - to += QPoint(mWidth, 0); + to += TQPoint(mWidth, 0); // draw according to "spacing" if ( (charPos < string.length()-1) && mSpacing > 0 ) { // make the spacing-area transparent mask.fillRect ( to.x(), 0, mSpacing, mHeight, Qt::color0 ); - to += QPoint ( mSpacing, 0 ); + to += TQPoint ( mSpacing, 0 ); } } if (freeSpace > 0) { mask.fillRect ( to.x(), 0, (freeSpace/2), mHeight, Qt::color0 ); - to += QPoint ( (freeSpace/2), 0 ); + to += TQPoint ( (freeSpace/2), 0 ); } region.setMask( regionMask ); @@ -250,24 +250,24 @@ QPixmap KJFont::drawPixmapFont(const QCString &str, int wide, const QPoint &pos) return region; } -void KJFont::drawCharacter(QPixmap *dev, QBitmap *devMask, const QPoint &to, char c) const +void KJFont::drawCharacter(TQPixmap *dev, TQBitmap *devMask, const TQPoint &to, char c) const { - QPoint src=charSource(c); + TQPoint src=charSource(c); int x=src.x(); int y=src.y(); int xs=mWidth; int ys=mHeight; - bitBlt(dev, to, &mText, QRect(x,y,xs,ys), Qt::CopyROP); + bitBlt(dev, to, &mText, TQRect(x,y,xs,ys), Qt::CopyROP); // bitBlt mask for transparency if ( mTransparent ) { - bitBlt(devMask, to, &mTextMask, QRect(x,y,xs,ys), Qt::OrROP); + bitBlt(devMask, to, &mTextMask, TQRect(x,y,xs,ys), Qt::OrROP); } else // fill mask { - QPainter tempPainter (devMask); + TQPainter tempPainter (devMask); tempPainter.fillRect ( to.x(), 0, xs,ys, Qt::color1 ); } } @@ -276,14 +276,14 @@ void KJFont::drawCharacter(QPixmap *dev, QBitmap *devMask, const QPoint &to, cha #include <string.h> // searches for top/left coordinate of a given character inside the font-pixmap -QPoint KJFont::charSource(char c) const +TQPoint KJFont::charSource(char c) const { for (int i=0; i<3; i++) { const char *pos = strchr(mString[i], c); if (!pos) continue; - return QPoint(mWidth*((int)(pos-mString[i])), mHeight*i); + return TQPoint(mWidth*((int)(pos-mString[i])), mHeight*i); } return charSource(mNullChar); |