diff options
Diffstat (limited to 'src/SUSE2client.cpp')
-rw-r--r-- | src/SUSE2client.cpp | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/src/SUSE2client.cpp b/src/SUSE2client.cpp index 7d92417..ee443c5 100644 --- a/src/SUSE2client.cpp +++ b/src/SUSE2client.cpp @@ -29,15 +29,15 @@ #include <kstandarddirs.h> #include <kdecoration.h> -#include <qbitmap.h> -#include <qdatetime.h> -#include <qfontmetrics.h> -#include <qimage.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qimage.h> +#include <tqbitmap.h> +#include <tqdatetime.h> +#include <tqfontmetrics.h> +#include <tqimage.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqimage.h> #include "SUSE2client.h" #include "SUSE2button.h" @@ -52,7 +52,7 @@ SUSE2Client::SUSE2Client(KDecorationBridge* bridge, KDecorationFactory* factory) aTitleBarTile(0), iTitleBarTile(0), pixmaps_created(false), captionBufferDirty(true), - s_titleFont(QFont()) + s_titleFont(TQFont()) {} SUSE2Client::~SUSE2Client() @@ -64,17 +64,17 @@ SUSE2Client::~SUSE2Client() } // pure virtual methods from KCommonDecoration -QString SUSE2Client::visibleName() const +TQString SUSE2Client::visibleName() const { return i18n("SUSE2 (Version %1)").arg("0.4.1"); } -QString SUSE2Client::defaultButtonsLeft() const +TQString SUSE2Client::defaultButtonsLeft() const { return "M"; } -QString SUSE2Client::defaultButtonsRight() const +TQString SUSE2Client::defaultButtonsRight() const { return "HIA___X"; } @@ -197,14 +197,14 @@ void SUSE2Client::init() create_pixmaps(); - aCaptionBuffer = new QPixmap(); - iCaptionBuffer = new QPixmap(); + aCaptionBuffer = new TQPixmap(); + iCaptionBuffer = new TQPixmap(); captionBufferDirty = true; KCommonDecoration::init(); } -QRegion SUSE2Client::cornerShape(WindowCorner corner) +TQRegion SUSE2Client::cornerShape(WindowCorner corner) { int w = widget()->width(); int h = widget()->height(); @@ -214,58 +214,58 @@ QRegion SUSE2Client::cornerShape(WindowCorner corner) if (layoutMetric(LM_TitleEdgeLeft) > 0 && (Handler()->roundCorners() == 1 || (Handler()->roundCorners() == 2 && maximizeMode() != MaximizeFull))) { - return QRegion(0, 0, 1, 5) + QRegion(0, 0, 2, 3) + QRegion(0, 0, 3, 2) + QRegion(0, 0, 5, 1); + return TQRegion(0, 0, 1, 5) + TQRegion(0, 0, 2, 3) + TQRegion(0, 0, 3, 2) + TQRegion(0, 0, 5, 1); } else { - return QRegion(0, 0, 1, 1); + return TQRegion(0, 0, 1, 1); } case WC_TopRight: if (layoutMetric(LM_TitleEdgeRight) > 0 && (Handler()->roundCorners() == 1 || (Handler()->roundCorners() == 2 && maximizeMode() != MaximizeFull))) { - return QRegion(w-1, 0, 1, 5) + QRegion(w-2, 0, 2, 3) + QRegion(w-3, 0, 3, 2) + QRegion(w-5, 0, 5, 1); + return TQRegion(w-1, 0, 1, 5) + TQRegion(w-2, 0, 2, 3) + TQRegion(w-3, 0, 3, 2) + TQRegion(w-5, 0, 5, 1); } else { - return QRegion(w-1, 0, 1, 1); + return TQRegion(w-1, 0, 1, 1); } case WC_BottomLeft: if (layoutMetric(LM_BorderLeft) > 0) - return QRegion(0, h-1, 1, 1); + return TQRegion(0, h-1, 1, 1); else - return QRegion(); + return TQRegion(); case WC_BottomRight: if (layoutMetric(LM_BorderRight) > 0) - return QRegion(w-1, h-1, 1, 1); + return TQRegion(w-1, h-1, 1, 1); else - return QRegion(); + return TQRegion(); default: - return QRegion(); + return TQRegion(); } } -void SUSE2Client::paintEvent(QPaintEvent *e) +void SUSE2Client::paintEvent(TQPaintEvent *e) { - QRegion region = e->region(); + TQRegion region = e->region(); if (captionBufferDirty) update_captionBuffer(); bool active = isActive(); - QPainter painter(widget()); + TQPainter painter(widget()); // colors... - const QColor windowContour = Handler()->getColor(WindowContour, active); - const QColor innerWindowContour = Handler()->getColor(TitleGradientTo, active); - const QColor deco = Handler()->getColor(TitleGradientTo, active); - const QColor aBorder = Handler()->getColor(Border, active); - const QColor darkAntiAlias = alphaBlendColors(innerWindowContour, active ? aAntialiasBase : iAntialiasBase, 140); - const QColor midAntiAlias = alphaBlendColors(innerWindowContour, active ? aAntialiasBase : iAntialiasBase, 120); - const QColor brightAntiAlias = alphaBlendColors(innerWindowContour, active ? aAntialiasBase : iAntialiasBase, 80); - const QColor innerAntiAlias = alphaBlendColors(innerWindowContour, active ? aAntialiasBase : iAntialiasBase, 170); + const TQColor windowContour = Handler()->getColor(WindowContour, active); + const TQColor innerWindowContour = Handler()->getColor(TitleGradientTo, active); + const TQColor deco = Handler()->getColor(TitleGradientTo, active); + const TQColor aBorder = Handler()->getColor(Border, active); + const TQColor darkAntiAlias = alphaBlendColors(innerWindowContour, active ? aAntialiasBase : iAntialiasBase, 140); + const TQColor midAntiAlias = alphaBlendColors(innerWindowContour, active ? aAntialiasBase : iAntialiasBase, 120); + const TQColor brightAntiAlias = alphaBlendColors(innerWindowContour, active ? aAntialiasBase : iAntialiasBase, 80); + const TQColor innerAntiAlias = alphaBlendColors(innerWindowContour, active ? aAntialiasBase : iAntialiasBase, 170); - QRect r = widget()->rect(); + TQRect r = widget()->rect(); int r_w = r.width(); int r_x, r_y, r_x2, r_y2; @@ -299,11 +299,11 @@ void SUSE2Client::paintEvent(QPaintEvent *e) active ? *aTitleBarTile : *iTitleBarTile); } - QRect Rtitle = QRect(r_x+titleEdgeLeft+buttonsLeftWidth(), r_y+titleEdgeTop, + TQRect Rtitle = TQRect(r_x+titleEdgeLeft+buttonsLeftWidth(), r_y+titleEdgeTop, r_x2-titleEdgeRight-buttonsRightWidth()-(r_x+titleEdgeLeft+buttonsLeftWidth()), titleEdgeBottomBottom-(r_y+titleEdgeTop) ); - QRect tmpRect; + TQRect tmpRect; // topSpacer if(titleEdgeTop > 0) { @@ -419,13 +419,13 @@ void SUSE2Client::paintEvent(QPaintEvent *e) } // titleSpacer - QPixmap *titleBfrPtr = active ? aCaptionBuffer : iCaptionBuffer; + TQPixmap *titleBfrPtr = active ? aCaptionBuffer : iCaptionBuffer; if (Rtitle.width() > 0 && titleBfrPtr != 0) { int tX, tW; switch (Handler()->titleAlign()) { // AlignCenter - case Qt::AlignHCenter: + case TQt::AlignHCenter: tX = (titleBfrPtr->width() > Rtitle.width()-2 * titleMargin) ? (Rtitle.left()+titleMargin) : Rtitle.left()+(Rtitle.width()- titleBfrPtr->width())/2; @@ -434,7 +434,7 @@ void SUSE2Client::paintEvent(QPaintEvent *e) : titleBfrPtr->width(); break; // AlignRight - case Qt::AlignRight: + case TQt::AlignRight: tX = (titleBfrPtr->width() > Rtitle.width()-2 * titleMargin) ? (Rtitle.left()+titleMargin) : Rtitle.right()-titleMargin-titleBfrPtr->width(); @@ -452,13 +452,13 @@ void SUSE2Client::paintEvent(QPaintEvent *e) if(tW > 0) { if (titleBfrPtr->width()+2*titleMargin > Rtitle.width()) { - QPixmap *tmp = new QPixmap(30, Rtitle.height()); - QPainter fade; + TQPixmap *tmp = new TQPixmap(30, Rtitle.height()); + TQPainter fade; fade.begin(tmp); fade.drawPixmap(0, 0, *titleBfrPtr, Rtitle.right()-30-2*titleMargin-Rtitle.left(), 0); - QImage background = (active ? *aTitleBarTile : *iTitleBarTile).convertToImage(); - QImage tmpImg = tmp->convertToImage(); - QImage blended = KImageEffect::blend(tmpImg, background, gradient, KImageEffect::Red); + TQImage background = (active ? *aTitleBarTile : *iTitleBarTile).convertToImage(); + TQImage tmpImg = tmp->convertToImage(); + TQImage blended = KImageEffect::blend(tmpImg, background, gradient, KImageEffect::Red); painter.drawPixmap(tX, Rtitle.top() - TOPMARGIN + btnMarginTop+2, *titleBfrPtr, 0, 2, tW - 2* titleMargin, -1); @@ -562,7 +562,7 @@ void SUSE2Client::updateCaption() const int marginLeft = layoutMetric(LM_TitleBorderLeft); const int marginRight = layoutMetric(LM_TitleBorderRight); - QRect g = QRect(titleEdgeLeft, titleEdgeTop, (widget()->rect()).width()-marginLeft-marginRight, titleHeight + titleEdgeBottom); + TQRect g = TQRect(titleEdgeLeft, titleEdgeTop, (widget()->rect()).width()-marginLeft-marginRight, titleHeight + titleEdgeBottom); widget()->update(g); } @@ -597,7 +597,7 @@ void SUSE2Client::create_pixmaps() return; KPixmap tempPixmap; - QPainter painter; + TQPainter painter; const int titleHeight = layoutMetric(LM_TitleHeight); @@ -607,32 +607,32 @@ void SUSE2Client::create_pixmaps() Handler()->getColor(TitleGradientFrom, true), Handler()->getColor(TitleGradientTo, true), KPixmapEffect::VerticalGradient); - aTitleBarTile = new QPixmap(30, titleHeight + TOPMARGIN + DECOHEIGHT); + aTitleBarTile = new TQPixmap(30, titleHeight + TOPMARGIN + DECOHEIGHT); painter.begin(aTitleBarTile); painter.drawPixmap(0, 0, tempPixmap); - QImage t; + TQImage t; if (Handler()->titlebarStyle() == 0) { // new, Toplight - t = QImage(30, (titleHeight + TOPMARGIN + DECOHEIGHT)/3 + 1, 32 ); - t = KImageEffect::gradient(QSize(30, t.height()), + t = TQImage(30, (titleHeight + TOPMARGIN + DECOHEIGHT)/3 + 1, 32 ); + t = KImageEffect::gradient(TQSize(30, t.height()), Handler()->getColor(TitleGradientFrom, true).light(130), Handler()->getColor(TitleGradientTo, true), KImageEffect::VerticalGradient/*, 100, 100*/); painter.drawImage(0, 2, t, 0, 0, -1, tempPixmap.height()-2); t.create(t.width(), t.height()*2, t.depth()); - t = KImageEffect::unbalancedGradient(QSize(30, t.height()), + t = KImageEffect::unbalancedGradient(TQSize(30, t.height()), Handler()->getColor(TitleGradientTo, true), Handler()->getColor(TitleGradientFrom, true), KImageEffect::VerticalGradient, 100, 100); painter.drawImage(0, t.height()/2, t, 0, 0, -1, t.height()); } else { // older, Balanced - t = QImage(30, (titleHeight + TOPMARGIN + DECOHEIGHT)/2 + 1, 32 ); - t = KImageEffect::gradient(QSize(30, t.height()), + t = TQImage(30, (titleHeight + TOPMARGIN + DECOHEIGHT)/2 + 1, 32 ); + t = KImageEffect::gradient(TQSize(30, t.height()), Handler()->getColor(TitleGradientFrom, true).light(150), Handler()->getColor(TitleGradientTo, true).light(110), KImageEffect::VerticalGradient); painter.drawImage(0, 2, t, 0, 0, -1, tempPixmap.height()-2); - t = KImageEffect::gradient(QSize(30, t.height()), + t = KImageEffect::gradient(TQSize(30, t.height()), Handler()->getColor(TitleGradientTo, true), Handler()->getColor(TitleGradientFrom, true), KImageEffect::VerticalGradient); @@ -647,22 +647,22 @@ void SUSE2Client::create_pixmaps() Handler()->getColor(TitleGradientFrom, false), Handler()->getColor(TitleGradientTo, false), KPixmapEffect::VerticalGradient); - iTitleBarTile = new QPixmap(30, titleHeight + TOPMARGIN + DECOHEIGHT); + iTitleBarTile = new TQPixmap(30, titleHeight + TOPMARGIN + DECOHEIGHT); painter.begin(iTitleBarTile); painter.drawPixmap(0, 0, tempPixmap); painter.end(); - QImage aTempImage = aTitleBarTile->convertToImage(); - aGradientBottom = QColor::QColor(aTempImage.pixel(0, aTempImage.height()-1)); - aAntialiasBase = QColor::QColor(aTempImage.pixel(0, 2)); - QImage iTempImage = iTitleBarTile->convertToImage(); - iGradientBottom = QColor::QColor(iTempImage.pixel(0, iTempImage.height()-1)); - iAntialiasBase = QColor::QColor(iTempImage.pixel(0, 2)); + TQImage aTempImage = aTitleBarTile->convertToImage(); + aGradientBottom = TQColor::TQColor(aTempImage.pixel(0, aTempImage.height()-1)); + aAntialiasBase = TQColor::TQColor(aTempImage.pixel(0, 2)); + TQImage iTempImage = iTitleBarTile->convertToImage(); + iGradientBottom = TQColor::TQColor(iTempImage.pixel(0, iTempImage.height()-1)); + iAntialiasBase = TQColor::TQColor(iTempImage.pixel(0, 2)); // the gradient for the fade out effect - gradient = KImageEffect::gradient(QSize(30, titleHeight + TOPMARGIN + DECOHEIGHT), - QColor(255,255,255), - QColor(0,0,0), + gradient = KImageEffect::gradient(TQSize(30, titleHeight + TOPMARGIN + DECOHEIGHT), + TQColor(255,255,255), + TQColor(0,0,0), KImageEffect::HorizontalGradient); pixmaps_created = true; @@ -682,16 +682,16 @@ void SUSE2Client::delete_pixmaps() void SUSE2Client::update_captionBuffer() { const uint maxCaptionLength = 110; // truncate captions longer than this! - QString c(caption()); + TQString c(caption()); if (c.length() > maxCaptionLength) { - QString tmpLeft = c.left(50); - QString tmpRight = c.right(50); - c = tmpLeft + QString::fromUtf8("[...]") + tmpRight; + TQString tmpLeft = c.left(50); + TQString tmpRight = c.right(50); + c = tmpLeft + TQString::fromUtf8("[...]") + tmpRight; } - QImage logo(Handler()->titleLogoURL()); + TQImage logo(Handler()->titleLogoURL()); int logoOffset = Handler()->titleLogoOffset(); - QFontMetrics fm(s_titleFont); + TQFontMetrics fm(s_titleFont); int captionWidth = fm.width(c); int logoWidth = 0; @@ -705,12 +705,12 @@ void SUSE2Client::update_captionBuffer() const int titleEdgeTop = layoutMetric(LM_TitleEdgeTop); const int titleEdgeBottom = layoutMetric(LM_TitleEdgeBottom); const int titleHeight = layoutMetric(LM_TitleHeight); - QPixmap textPixmap; - QPainter painter; + TQPixmap textPixmap; + TQPainter painter; if(Handler()->titleShadow()) { // prepare the shadow - textPixmap = QPixmap(captionWidth+4, titleHeight + TOPMARGIN + DECOHEIGHT); // 4 px shadow space - textPixmap.fill(QColor(0,0,0)); + textPixmap = TQPixmap(captionWidth+4, titleHeight + TOPMARGIN + DECOHEIGHT); // 4 px shadow space + textPixmap.fill(TQColor(0,0,0)); textPixmap.setMask(textPixmap.createHeuristicMask(true)); painter.begin(&textPixmap); painter.setFont(s_titleFont); @@ -728,7 +728,7 @@ void SUSE2Client::update_captionBuffer() painter.end(); } - QImage shadow; + TQImage shadow; ShadowEngine se; // active @@ -736,7 +736,7 @@ void SUSE2Client::update_captionBuffer() painter.begin(aCaptionBuffer); painter.drawTiledPixmap(aCaptionBuffer->rect(), *aTitleBarTile); if(Handler()->titleShadow()) { - shadow = se.makeShadow(textPixmap, QColor(0, 0, 0)); + shadow = se.makeShadow(textPixmap, TQColor(0, 0, 0)); painter.drawImage(1, 1, shadow); } painter.setFont(s_titleFont); |