From c663b6440964f6ac48027143ac9e63298991f9d0 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:33:34 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kwin/clients/plastik/config/config.cpp | 50 ++++++++--------- kwin/clients/plastik/config/config.h | 4 +- kwin/clients/plastik/misc.cpp | 18 +++---- kwin/clients/plastik/misc.h | 6 +-- kwin/clients/plastik/plastik.cpp | 90 +++++++++++++++---------------- kwin/clients/plastik/plastik.h | 26 ++++----- kwin/clients/plastik/plastikbutton.cpp | 60 ++++++++++----------- kwin/clients/plastik/plastikbutton.h | 18 +++---- kwin/clients/plastik/plastikclient.cpp | 98 +++++++++++++++++----------------- kwin/clients/plastik/plastikclient.h | 24 ++++----- 10 files changed, 197 insertions(+), 197 deletions(-) (limited to 'kwin/clients/plastik') diff --git a/kwin/clients/plastik/config/config.cpp b/kwin/clients/plastik/config/config.cpp index 91ec501d0..0352bff91 100644 --- a/kwin/clients/plastik/config/config.cpp +++ b/kwin/clients/plastik/config/config.cpp @@ -20,12 +20,12 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -34,8 +34,8 @@ #include "config.h" #include "configdialog.h" -PlastikConfig::PlastikConfig(KConfig* config, QWidget* parent) - : QObject(parent), m_config(0), m_dialog(0) +PlastikConfig::PlastikConfig(KConfig* config, TQWidget* parent) + : TQObject(parent), m_config(0), m_dialog(0) { // create the configuration object m_config = new KConfig("kwinplastikrc"); @@ -49,16 +49,16 @@ PlastikConfig::PlastikConfig(KConfig* config, QWidget* parent) load(config); // setup the connections - connect(m_dialog->titleAlign, SIGNAL(clicked(int)), - this, SIGNAL(changed())); - connect(m_dialog->animateButtons, SIGNAL(toggled(bool)), - this, SIGNAL(changed())); - connect(m_dialog->menuClose, SIGNAL(toggled(bool)), - this, SIGNAL(changed())); - connect(m_dialog->titleShadow, SIGNAL(toggled(bool)), - this, SIGNAL(changed())); - connect(m_dialog->coloredBorder, SIGNAL(toggled(bool)), - this, SIGNAL(changed())); + connect(m_dialog->titleAlign, TQT_SIGNAL(clicked(int)), + this, TQT_SIGNAL(changed())); + connect(m_dialog->animateButtons, TQT_SIGNAL(toggled(bool)), + this, TQT_SIGNAL(changed())); + connect(m_dialog->menuClose, TQT_SIGNAL(toggled(bool)), + this, TQT_SIGNAL(changed())); + connect(m_dialog->titleShadow, TQT_SIGNAL(toggled(bool)), + this, TQT_SIGNAL(changed())); + connect(m_dialog->coloredBorder, TQT_SIGNAL(toggled(bool)), + this, TQT_SIGNAL(changed())); } PlastikConfig::~PlastikConfig() @@ -72,8 +72,8 @@ void PlastikConfig::load(KConfig*) m_config->setGroup("General"); - QString value = m_config->readEntry("TitleAlignment", "AlignLeft"); - QRadioButton *button = (QRadioButton*)m_dialog->titleAlign->child(value.latin1()); + TQString value = m_config->readEntry("TitleAlignment", "AlignLeft"); + TQRadioButton *button = (TQRadioButton*)m_dialog->titleAlign->child(value.latin1()); if (button) button->setChecked(true); bool animateButtons = m_config->readBoolEntry("AnimateButtons", true); m_dialog->animateButtons->setChecked(animateButtons); @@ -89,8 +89,8 @@ void PlastikConfig::save(KConfig*) { m_config->setGroup("General"); - QRadioButton *button = (QRadioButton*)m_dialog->titleAlign->selected(); - if (button) m_config->writeEntry("TitleAlignment", QString(button->name())); + TQRadioButton *button = (TQRadioButton*)m_dialog->titleAlign->selected(); + if (button) m_config->writeEntry("TitleAlignment", TQString(button->name())); m_config->writeEntry("AnimateButtons", m_dialog->animateButtons->isChecked() ); m_config->writeEntry("CloseOnMenuDoubleClick", m_dialog->menuClose->isChecked() ); m_config->writeEntry("TitleShadow", m_dialog->titleShadow->isChecked() ); @@ -100,8 +100,8 @@ void PlastikConfig::save(KConfig*) void PlastikConfig::defaults() { - QRadioButton *button = - (QRadioButton*)m_dialog->titleAlign->child("AlignLeft"); + TQRadioButton *button = + (TQRadioButton*)m_dialog->titleAlign->child("AlignLeft"); if (button) button->setChecked(true); m_dialog->animateButtons->setChecked(true); m_dialog->menuClose->setChecked(false); @@ -115,7 +115,7 @@ void PlastikConfig::defaults() extern "C" { - KDE_EXPORT QObject* allocate_config(KConfig* config, QWidget* parent) { + KDE_EXPORT TQObject* allocate_config(KConfig* config, TQWidget* parent) { return (new PlastikConfig(config, parent)); } } diff --git a/kwin/clients/plastik/config/config.h b/kwin/clients/plastik/config/config.h index 540a27cda..249f5f7dd 100644 --- a/kwin/clients/plastik/config/config.h +++ b/kwin/clients/plastik/config/config.h @@ -23,7 +23,7 @@ #ifndef KNIFTYCONFIG_H #define KNIFTYCONFIG_H -#include +#include class QButtonGroup; class QGroupBox; @@ -34,7 +34,7 @@ class PlastikConfig : public QObject { Q_OBJECT public: - PlastikConfig(KConfig* config, QWidget* parent); + PlastikConfig(KConfig* config, TQWidget* parent); ~PlastikConfig(); signals: diff --git a/kwin/clients/plastik/misc.cpp b/kwin/clients/plastik/misc.cpp index da491b2ba..43786fe46 100644 --- a/kwin/clients/plastik/misc.cpp +++ b/kwin/clients/plastik/misc.cpp @@ -23,13 +23,13 @@ #include #include -#include -#include -#include +#include +#include +#include #include "misc.h" -QColor hsvRelative(const QColor& baseColor, int relativeH, int relativeS, int relativeV) +TQColor hsvRelative(const TQColor& baseColor, int relativeH, int relativeS, int relativeV) { int h, s, v; baseColor.hsv(&h, &s, &v); @@ -45,12 +45,12 @@ QColor hsvRelative(const QColor& baseColor, int relativeH, int relativeS, int re if(v < 0) { v = 0; } else if(v > 255) { v = 255; } - QColor c; + TQColor c; c.setHsv( h, s, v ); return c; } -QColor alphaBlendColors(const QColor &bgColor, const QColor &fgColor, const int a) +TQColor alphaBlendColors(const TQColor &bgColor, const TQColor &fgColor, const int a) { // normal button... @@ -61,15 +61,15 @@ QColor alphaBlendColors(const QColor &bgColor, const QColor &fgColor, const int if(alpha<0) alpha = 0; int inv_alpha = 255 - alpha; - QColor result = QColor( qRgb(qRed(rgb_b)*inv_alpha/255 + qRed(rgb)*alpha/255, + TQColor result = TQColor( qRgb(qRed(rgb_b)*inv_alpha/255 + qRed(rgb)*alpha/255, qGreen(rgb_b)*inv_alpha/255 + qGreen(rgb)*alpha/255, qBlue(rgb_b)*inv_alpha/255 + qBlue(rgb)*alpha/255) ); return result; } -QImage recolorImage(QImage *img, QColor color) { - QImage destImg(img->width(),img->height(),32); +TQImage recolorImage(TQImage *img, TQColor color) { + TQImage destImg(img->width(),img->height(),32); destImg.setAlphaBuffer(true); for (int x = 0; x < img->width(); x++) { for (int y = 0; y < img->height(); y++) { diff --git a/kwin/clients/plastik/misc.h b/kwin/clients/plastik/misc.h index 6c06b282b..985b405e8 100644 --- a/kwin/clients/plastik/misc.h +++ b/kwin/clients/plastik/misc.h @@ -23,8 +23,8 @@ #ifndef MISC_H #define MISC_H -QColor hsvRelative(const QColor& baseColor, int relativeH, int relativeS = 0, int relativeV = 0); -QColor alphaBlendColors(const QColor &backgroundColor, const QColor &foregroundColor, const int alpha); -QImage recolorImage(QImage *img, QColor color); +TQColor hsvRelative(const TQColor& baseColor, int relativeH, int relativeS = 0, int relativeV = 0); +TQColor alphaBlendColors(const TQColor &backgroundColor, const TQColor &foregroundColor, const int alpha); +TQImage recolorImage(TQImage *img, TQColor color); #endif // MISC_H diff --git a/kwin/clients/plastik/plastik.cpp b/kwin/clients/plastik/plastik.cpp index 25e6d2563..a6313cd1c 100644 --- a/kwin/clients/plastik/plastik.cpp +++ b/kwin/clients/plastik/plastik.cpp @@ -20,9 +20,9 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include +#include +#include +#include #include #include @@ -39,8 +39,8 @@ namespace KWinPlastik PlastikHandler::PlastikHandler() { - memset(m_pixmaps, 0, sizeof(QPixmap*)*NumPixmaps*2*2); // set elements to 0 - memset(m_bitmaps, 0, sizeof(QBitmap*)*NumButtonIcons*2); + memset(m_pixmaps, 0, sizeof(TQPixmap*)*NumPixmaps*2*2); // set elements to 0 + memset(m_bitmaps, 0, sizeof(TQBitmap*)*NumButtonIcons*2); reset(0); } @@ -88,7 +88,7 @@ bool PlastikHandler::reset(unsigned long changed) } // check if we are in reverse layout mode - m_reverse = QApplication::reverseLayout(); + m_reverse = TQApplication::reverseLayout(); // read in the configuration readConfig(); @@ -168,7 +168,7 @@ void PlastikHandler::readConfig() // grab settings m_titleShadow = config.readBoolEntry("TitleShadow", true); - QFontMetrics fm(m_titleFont); // active font = inactive font + TQFontMetrics fm(m_titleFont); // active font = inactive font int titleHeightMin = config.readNumEntry("MinTitleHeight", 16); // The title should strech with bigger font sizes! m_titleHeight = QMAX(titleHeightMin, fm.height() + 4); // 4 px for the shadow etc. @@ -176,7 +176,7 @@ void PlastikHandler::readConfig() if ( m_titleHeight%2 == 0) m_titleHeight++; - fm = QFontMetrics(m_titleFontTool); // active font = inactive font + fm = TQFontMetrics(m_titleFontTool); // active font = inactive font int titleHeightToolMin = config.readNumEntry("MinTitleHeightTool", 13); // The title should strech with bigger font sizes! m_titleHeightTool = QMAX(titleHeightToolMin, fm.height() ); // don't care about the shadow etc. @@ -184,7 +184,7 @@ void PlastikHandler::readConfig() if ( m_titleHeightTool%2 == 0) m_titleHeightTool++; - QString value = config.readEntry("TitleAlignment", "AlignLeft"); + TQString value = config.readEntry("TitleAlignment", "AlignLeft"); if (value == "AlignLeft") m_titleAlign = Qt::AlignLeft; else if (value == "AlignHCenter") m_titleAlign = Qt::AlignHCenter; else if (value == "AlignRight") m_titleAlign = Qt::AlignRight; @@ -194,7 +194,7 @@ void PlastikHandler::readConfig() m_menuClose = config.readBoolEntry("CloseOnMenuDoubleClick", true); } -QColor PlastikHandler::getColor(KWinPlastik::ColorType type, const bool active) +TQColor PlastikHandler::getColor(KWinPlastik::ColorType type, const bool active) { switch (type) { case WindowContour: @@ -225,15 +225,15 @@ QColor PlastikHandler::getColor(KWinPlastik::ColorType type, const bool active) } } -void PlastikHandler::pretile( QPixmap *&pix, int size, Qt::Orientation dir ) const +void PlastikHandler::pretile( TQPixmap *&pix, int size, Qt::Orientation dir ) const { - QPixmap *newpix; - QPainter p; + TQPixmap *newpix; + TQPainter p; if ( dir == Qt::Horizontal ) - newpix = new QPixmap( size, pix->height() ); + newpix = new TQPixmap( size, pix->height() ); else - newpix = new QPixmap( pix->width(), size ); + newpix = new TQPixmap( pix->width(), size ); p.begin( newpix ); p.drawTiledPixmap( newpix->rect(), *pix ) ; @@ -243,12 +243,12 @@ void PlastikHandler::pretile( QPixmap *&pix, int size, Qt::Orientation dir ) con pix = newpix; } -const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow) +const TQPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow) { if (m_pixmaps[toolWindow][active][type]) return *m_pixmaps[toolWindow][active][type]; - QPixmap *pm = 0; + TQPixmap *pm = 0; switch (type) { case TitleBarTileTop: @@ -257,8 +257,8 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow const int titleBarTileHeight = (toolWindow ? m_titleHeightTool : m_titleHeight) + 2; // gradient used as well in TitleBarTileTop as TitleBarTile const int gradientHeight = 2 + titleBarTileHeight-1; - QPixmap gradient(1, gradientHeight); - QPainter painter(&gradient); + TQPixmap gradient(1, gradientHeight); + TQPainter painter(&gradient); KPixmap tempPixmap; tempPixmap.resize(1, 4); KPixmapEffect::gradient(tempPixmap, @@ -276,7 +276,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow // actual titlebar tiles if (type == TitleBarTileTop) { - pm = new QPixmap(1, 4); + pm = new TQPixmap(1, 4); painter.begin(pm); // contour painter.setPen(getColor(WindowContour, active) ); @@ -288,7 +288,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow painter.drawPixmap(0, 2, gradient); painter.end(); } else { - pm = new QPixmap(1, titleBarTileHeight); + pm = new TQPixmap(1, titleBarTileHeight); painter.begin(pm); painter.drawPixmap(0, 0, gradient, 0,2); if (m_coloredBorder) { @@ -310,8 +310,8 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow const int w = m_borderSize; const int h = 4 + (toolWindow ? m_titleHeightTool : m_titleHeight) + 2; - pm = new QPixmap(w, h); - QPainter painter(pm); + pm = new TQPixmap(w, h); + TQPainter painter(pm); painter.drawTiledPixmap(0,0, w, 4, pixmap(TitleBarTileTop, active, toolWindow) ); painter.drawTiledPixmap(0,4, w, h-4, pixmap(TitleBarTile, active, toolWindow) ); @@ -320,7 +320,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow painter.drawLine(0,0, 0,h); painter.drawPoint(1,1); - const QColor highlightTitleLeft = getColor(ShadeTitleLight, active); + const TQColor highlightTitleLeft = getColor(ShadeTitleLight, active); painter.setPen(highlightTitleLeft); painter.drawLine(1,2, 1,h); @@ -330,7 +330,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow } // outside the region normally masked by doShape - painter.setPen(QColor(0,0,0) ); + painter.setPen(TQColor(0,0,0) ); painter.drawLine(0, 0, 1, 0 ); painter.drawPoint(0, 1); @@ -342,8 +342,8 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow const int w = m_borderSize; const int h = 4 + (toolWindow ? m_titleHeightTool : m_titleHeight) + 2; - pm = new QPixmap(w, h); - QPainter painter(pm); + pm = new TQPixmap(w, h); + TQPainter painter(pm); painter.drawTiledPixmap(0,0, w, 4, pixmap(TitleBarTileTop, active, toolWindow) ); painter.drawTiledPixmap(0,4, w, h-4, pixmap(TitleBarTile, active, toolWindow) ); @@ -352,7 +352,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow painter.drawLine(w-1,0, w-1,h); painter.drawPoint(w-2,1); - const QColor highlightTitleRight = getColor(ShadeTitleDark, active); + const TQColor highlightTitleRight = getColor(ShadeTitleDark, active); painter.setPen(highlightTitleRight); painter.drawLine(w-2,2, w-2,h); @@ -362,7 +362,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow } // outside the region normally masked by doShape - painter.setPen(QColor(0,0,0) ); + painter.setPen(TQColor(0,0,0) ); painter.drawLine(w-2, 0, w-1, 0 ); painter.drawPoint(w-1, 1); @@ -373,8 +373,8 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow { const int w = m_borderSize; - pm = new QPixmap(w, 1); - QPainter painter(pm); + pm = new TQPixmap(w, 1); + TQPainter painter(pm); if (m_coloredBorder) { painter.setPen(getColor(WindowContour, active) ); painter.drawPoint(0, 0); @@ -408,8 +408,8 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow { const int w = m_borderSize; - pm = new QPixmap(w, 1); - QPainter painter(pm); + pm = new TQPixmap(w, 1); + TQPainter painter(pm); if (m_coloredBorder) { painter.setPen(getColor(TitleGradient3, active).dark(110) ); painter.drawPoint(0,0); @@ -443,8 +443,8 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow const int w = m_borderSize; const int h = m_borderSize; - pm = new QPixmap(w, h); - QPainter painter(pm); + pm = new TQPixmap(w, h); + TQPainter painter(pm); painter.drawTiledPixmap(0,0,w,h, pixmap(BorderBottomTile, active, toolWindow) ); painter.setPen(getColor(WindowContour, active) ); painter.drawLine(0,0, 0,h); @@ -473,8 +473,8 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow const int w = m_borderSize; const int h = m_borderSize; - pm = new QPixmap(w, h); - QPainter painter(pm); + pm = new TQPixmap(w, h); + TQPainter painter(pm); painter.drawTiledPixmap(0,0,w,h, pixmap(BorderBottomTile, active, toolWindow) ); painter.setPen(getColor(WindowContour, active) ); painter.drawLine(w-1,0, w-1,h); @@ -501,8 +501,8 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow { const int h = m_borderSize; - pm = new QPixmap(1, m_borderSize); - QPainter painter(pm); + pm = new TQPixmap(1, m_borderSize); + TQPainter painter(pm); if (m_coloredBorder) { painter.setPen(getColor(TitleGradient3, active).dark(110) ); @@ -533,7 +533,7 @@ const QPixmap &PlastikHandler::pixmap(Pixmaps type, bool active, bool toolWindow return *pm; } -const QBitmap &PlastikHandler::buttonBitmap(ButtonIcon type, const QSize &size, bool toolWindow) +const TQBitmap &PlastikHandler::buttonBitmap(ButtonIcon type, const TQSize &size, bool toolWindow) { int typeIndex = type; @@ -552,7 +552,7 @@ const QBitmap &PlastikHandler::buttonBitmap(ButtonIcon type, const QSize &size, int w = size.width() - reduceW; int h = size.height() - reduceH; - if (m_bitmaps[toolWindow][typeIndex] && m_bitmaps[toolWindow][typeIndex]->size()==QSize(w,h) ) + if (m_bitmaps[toolWindow][typeIndex] && m_bitmaps[toolWindow][typeIndex]->size()==TQSize(w,h) ) return *m_bitmaps[toolWindow][typeIndex]; // no matching pixmap found, create a new one... @@ -560,17 +560,17 @@ const QBitmap &PlastikHandler::buttonBitmap(ButtonIcon type, const QSize &size, delete m_bitmaps[toolWindow][typeIndex]; m_bitmaps[toolWindow][typeIndex] = 0; - QBitmap bmp = IconEngine::icon(type /*icon*/, QMIN(w,h) ); - QBitmap *bitmap = new QBitmap(bmp); + TQBitmap bmp = IconEngine::icon(type /*icon*/, QMIN(w,h) ); + TQBitmap *bitmap = new TQBitmap(bmp); m_bitmaps[toolWindow][typeIndex] = bitmap; return *bitmap; } -QValueList< PlastikHandler::BorderSize > +TQValueList< PlastikHandler::BorderSize > PlastikHandler::borderSizes() const { // the list must be sorted - return QValueList< BorderSize >() << BorderTiny << BorderNormal << + return TQValueList< BorderSize >() << BorderTiny << BorderNormal << BorderLarge << BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized; } diff --git a/kwin/clients/plastik/plastik.h b/kwin/clients/plastik/plastik.h index 16972c9ac..974df622b 100644 --- a/kwin/clients/plastik/plastik.h +++ b/kwin/clients/plastik/plastik.h @@ -23,7 +23,7 @@ #ifndef PLASTIK_H #define PLASTIK_H -#include +#include #include #include @@ -71,7 +71,7 @@ enum ButtonIcon { NumButtonIcons }; -class PlastikHandler: public QObject, public KDecorationFactory +class PlastikHandler: public TQObject, public KDecorationFactory { Q_OBJECT public: @@ -82,26 +82,26 @@ public: virtual KDecoration* createDecoration( KDecorationBridge* ); virtual bool supports( Ability ability ); - const QPixmap &pixmap(Pixmaps type, bool active, bool toolWindow); - const QBitmap &buttonBitmap(ButtonIcon type, const QSize &size, bool toolWindow); + const TQPixmap &pixmap(Pixmaps type, bool active, bool toolWindow); + const TQBitmap &buttonBitmap(ButtonIcon type, const TQSize &size, bool toolWindow); int titleHeight() { return m_titleHeight; } int titleHeightTool() { return m_titleHeightTool; } - const QFont &titleFont() { return m_titleFont; } - const QFont &titleFontTool() { return m_titleFontTool; } + const TQFont &titleFont() { return m_titleFont; } + const TQFont &titleFontTool() { return m_titleFontTool; } bool titleShadow() { return m_titleShadow; } int borderSize() { return m_borderSize; } bool animateButtons() { return m_animateButtons; } bool menuClose() { return m_menuClose; } Qt::AlignmentFlags titleAlign() { return m_titleAlign; } bool reverseLayout() { return m_reverse; } - QColor getColor(KWinPlastik::ColorType type, const bool active = true); + TQColor getColor(KWinPlastik::ColorType type, const bool active = true); - QValueList< PlastikHandler::BorderSize > borderSizes() const; + TQValueList< PlastikHandler::BorderSize > borderSizes() const; private: void readConfig(); - void pretile(QPixmap *&pix, int size, Qt::Orientation dir) const; + void pretile(TQPixmap *&pix, int size, Qt::Orientation dir) const; bool m_coloredBorder; bool m_titleShadow; @@ -111,13 +111,13 @@ private: int m_borderSize; int m_titleHeight; int m_titleHeightTool; - QFont m_titleFont; - QFont m_titleFontTool; + TQFont m_titleFont; + TQFont m_titleFontTool; Qt::AlignmentFlags m_titleAlign; // pixmap cache - QPixmap *m_pixmaps[2][2][NumPixmaps]; // button pixmaps have normal+pressed state... - QBitmap *m_bitmaps[2][NumButtonIcons]; + TQPixmap *m_pixmaps[2][2][NumPixmaps]; // button pixmaps have normal+pressed state... + TQBitmap *m_bitmaps[2][NumButtonIcons]; }; PlastikHandler* Handler(); diff --git a/kwin/clients/plastik/plastikbutton.cpp b/kwin/clients/plastik/plastikbutton.cpp index 5917465ab..27a3eb127 100644 --- a/kwin/clients/plastik/plastikbutton.cpp +++ b/kwin/clients/plastik/plastikbutton.cpp @@ -22,12 +22,12 @@ // #include -#include -#include -#include +#include +#include +#include #include #include -#include +#include #include "plastikbutton.h" #include "plastikbutton.moc" @@ -50,8 +50,8 @@ PlastikButton::PlastikButton(ButtonType type, PlastikClient *parent, const char // no need to reset here as the button will be resetted on first resize. - animTmr = new QTimer(this); - connect(animTmr, SIGNAL(timeout() ), this, SLOT(animate() ) ); + animTmr = new TQTimer(this); + connect(animTmr, TQT_SIGNAL(timeout() ), this, TQT_SLOT(animate() ) ); animProgress = 0; } @@ -143,43 +143,43 @@ void PlastikButton::animate() repaint(false); } -void PlastikButton::enterEvent(QEvent *e) +void PlastikButton::enterEvent(TQEvent *e) { - QButton::enterEvent(e); + TQButton::enterEvent(e); hover = true; animate(); } -void PlastikButton::leaveEvent(QEvent *e) +void PlastikButton::leaveEvent(TQEvent *e) { - QButton::leaveEvent(e); + TQButton::leaveEvent(e); hover = false; animate(); } -void PlastikButton::drawButton(QPainter *painter) +void PlastikButton::drawButton(TQPainter *painter) { - QRect r(0,0,width(),height()); + TQRect r(0,0,width(),height()); bool active = m_client->isActive(); KPixmap tempKPixmap; - QColor highlightColor; + TQColor highlightColor; if(type() == CloseButton) { - highlightColor = QColor(255,64,0); + highlightColor = TQColor(255,64,0); } else { highlightColor = Qt::white; } - QColor contourTop = alphaBlendColors(Handler()->getColor(TitleGradient2, active), + TQColor contourTop = alphaBlendColors(Handler()->getColor(TitleGradient2, active), Qt::black, 215); - QColor contourBottom = alphaBlendColors(Handler()->getColor(TitleGradient3, active), + TQColor contourBottom = alphaBlendColors(Handler()->getColor(TitleGradient3, active), Qt::black, 215); - QColor sourfaceTop = alphaBlendColors(Handler()->getColor(TitleGradient2, active), + TQColor sourfaceTop = alphaBlendColors(Handler()->getColor(TitleGradient2, active), Qt::white, 210); - QColor sourfaceBottom = alphaBlendColors(Handler()->getColor(TitleGradient3, active), + TQColor sourfaceBottom = alphaBlendColors(Handler()->getColor(TitleGradient3, active), Qt::white, 210); int highlightAlpha = static_cast(255-((60/static_cast(ANIMATIONSTEPS))* @@ -196,9 +196,9 @@ void PlastikButton::drawButton(QPainter *painter) sourfaceBottom = alphaBlendColors(sourfaceBottom, Qt::black, 200); } - QPixmap buffer; + TQPixmap buffer; buffer.resize(width(), height()); - QPainter bP(&buffer); + TQPainter bP(&buffer); // fake the titlebar background bP.drawTiledPixmap(0, 0, width(), width(), m_client->getTitleBarTile(active) ); @@ -251,7 +251,7 @@ void PlastikButton::drawButton(QPainter *painter) if (type() == MenuButton) { - QPixmap menuIcon(m_client->icon().pixmap( QIconSet::Small, QIconSet::Normal)); + TQPixmap menuIcon(m_client->icon().pixmap( TQIconSet::Small, TQIconSet::Normal)); if (width() < menuIcon.width() || height() < menuIcon.height() ) { menuIcon.convertFromImage( menuIcon.convertToImage().smoothScale(width(), height())); } @@ -260,7 +260,7 @@ void PlastikButton::drawButton(QPainter *painter) else { int dX,dY; - const QBitmap &icon = Handler()->buttonBitmap(m_iconType, size(), decoration()->isToolWindow() ); + const TQBitmap &icon = Handler()->buttonBitmap(m_iconType, size(), decoration()->isToolWindow() ); dX = r.x()+(r.width()-icon.width())/2; dY = r.y()+(r.height()-icon.height())/2; if (isDown() ) { @@ -268,11 +268,11 @@ void PlastikButton::drawButton(QPainter *painter) } if(!isDown() && Handler()->titleShadow() ) { - QColor shadowColor; + TQColor shadowColor; if (qGray(Handler()->getColor(TitleFont,active).rgb()) < 100) - shadowColor = QColor(255, 255, 255); + shadowColor = TQColor(255, 255, 255); else - shadowColor = QColor(0,0,0); + shadowColor = TQColor(0,0,0); bP.setPen(alphaBlendColors(sourfaceTop, shadowColor, 180) ); bP.drawPixmap(dX+1, dY+1, icon); } @@ -285,18 +285,18 @@ void PlastikButton::drawButton(QPainter *painter) painter->drawPixmap(0, 0, buffer); } -QBitmap IconEngine::icon(ButtonIcon icon, int size) +TQBitmap IconEngine::icon(ButtonIcon icon, int size) { if (size%2 == 0) --size; - QBitmap bitmap(size,size); + TQBitmap bitmap(size,size); bitmap.fill(Qt::color0); - QPainter p(&bitmap); + TQPainter p(&bitmap); p.setPen(Qt::color1); - QRect r = bitmap.rect(); + TQRect r = bitmap.rect(); // line widths int lwTitleBar = 1; @@ -554,7 +554,7 @@ QBitmap IconEngine::icon(ButtonIcon icon, int size) return bitmap; } -void IconEngine::drawObject(QPainter &p, Object object, int x, int y, int length, int lineWidth) +void IconEngine::drawObject(TQPainter &p, Object object, int x, int y, int length, int lineWidth) { switch(object) { case DiagonalLine: diff --git a/kwin/clients/plastik/plastikbutton.h b/kwin/clients/plastik/plastikbutton.h index 0be8dddea..69ba6d8e0 100644 --- a/kwin/clients/plastik/plastikbutton.h +++ b/kwin/clients/plastik/plastikbutton.h @@ -23,8 +23,8 @@ #ifndef PLASTIKBUTTON_H #define PLASTIKBUTTON_H -#include -#include +#include +#include #include "plastik.h" #include @@ -49,30 +49,30 @@ protected slots: void animate(); private: - void enterEvent(QEvent *e); - void leaveEvent(QEvent *e); - void drawButton(QPainter *painter); + void enterEvent(TQEvent *e); + void leaveEvent(TQEvent *e); + void drawButton(TQPainter *painter); private: PlastikClient *m_client; ButtonIcon m_iconType; bool hover; - QTimer *animTmr; + TQTimer *animTmr; uint animProgress; }; /** * This class creates bitmaps which can be used as icons on buttons. The icons * are "hardcoded". - * Over the previous "Gimp->xpm->QImage->recolor->SmoothScale->QPixmap" solution + * Over the previous "Gimp->xpm->QImage->recolor->SmoothScale->TQPixmap" solution * it has the important advantage that icons are more scalable and at the same * time sharp and not blurred. */ class IconEngine { public: - static QBitmap icon(ButtonIcon icon, int size); + static TQBitmap icon(ButtonIcon icon, int size); private: enum Object { @@ -82,7 +82,7 @@ class IconEngine CrossDiagonalLine }; - static void drawObject(QPainter &p, Object object, int x, int y, int length, int lineWidth); + static void drawObject(TQPainter &p, Object object, int x, int y, int length, int lineWidth); }; } // namespace KWinPlastik diff --git a/kwin/clients/plastik/plastikclient.cpp b/kwin/clients/plastik/plastikclient.cpp index 722761a5f..604c66641 100644 --- a/kwin/clients/plastik/plastikclient.cpp +++ b/kwin/clients/plastik/plastikclient.cpp @@ -22,15 +22,15 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "plastikclient.h" #include "plastikbutton.h" @@ -41,9 +41,9 @@ namespace KWinPlastik PlastikClient::PlastikClient(KDecorationBridge* bridge, KDecorationFactory* factory) : KCommonDecoration (bridge, factory), - s_titleFont(QFont() ) + s_titleFont(TQFont() ) { - memset(m_captionPixmaps, 0, sizeof(QPixmap*)*2); + memset(m_captionPixmaps, 0, sizeof(TQPixmap*)*2); } PlastikClient::~PlastikClient() @@ -51,17 +51,17 @@ PlastikClient::~PlastikClient() clearCaptionPixmaps(); } -QString PlastikClient::visibleName() const +TQString PlastikClient::visibleName() const { return i18n("Plastik"); } -QString PlastikClient::defaultButtonsLeft() const +TQString PlastikClient::defaultButtonsLeft() const { return "M"; } -QString PlastikClient::defaultButtonsRight() const +TQString PlastikClient::defaultButtonsRight() const { return "HIAX"; } @@ -197,7 +197,7 @@ void PlastikClient::init() KCommonDecoration::init(); } -QRegion PlastikClient::cornerShape(WindowCorner corner) +TQRegion PlastikClient::cornerShape(WindowCorner corner) { int w = widget()->width(); int h = widget()->height(); @@ -205,37 +205,37 @@ QRegion PlastikClient::cornerShape(WindowCorner corner) switch (corner) { case WC_TopLeft: if (layoutMetric(LM_TitleEdgeLeft) > 0) - return QRegion(0, 0, 1, 2) + QRegion(1, 0, 1, 1); + return TQRegion(0, 0, 1, 2) + TQRegion(1, 0, 1, 1); else - return QRegion(); + return TQRegion(); case WC_TopRight: if (layoutMetric(LM_TitleEdgeRight) > 0) - return QRegion(w-1, 0, 1, 2) + QRegion(w-2, 0, 1, 1); + return TQRegion(w-1, 0, 1, 2) + TQRegion(w-2, 0, 1, 1); else - return QRegion(); + return TQRegion(); case WC_BottomLeft: if (layoutMetric(LM_BorderBottom) > 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_BorderBottom) > 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 PlastikClient::paintEvent(QPaintEvent *e) +void PlastikClient::paintEvent(TQPaintEvent *e) { - QRegion region = e->region(); + TQRegion region = e->region(); PlastikHandler *handler = Handler(); @@ -245,10 +245,10 @@ void PlastikClient::paintEvent(QPaintEvent *e) bool active = isActive(); bool toolWindow = isToolWindow(); - QPainter painter(widget() ); + TQPainter painter(widget() ); // often needed coordinates - QRect r = widget()->rect(); + TQRect r = widget()->rect(); int r_w = r.width(); // int r_h = r.height(); @@ -270,11 +270,11 @@ void PlastikClient::paintEvent(QPaintEvent *e) const int sideHeight = borderBottomTop-titleEdgeBottomBottom-1; - 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 tempRect; + TQRect tempRect; // topSpacer if(titleEdgeTop > 0) @@ -308,7 +308,7 @@ void PlastikClient::paintEvent(QPaintEvent *e) } // titleSpacer - const QPixmap &caption = captionPixmap(); + const TQPixmap &caption = captionPixmap(); if(Rtitle.width() > 0) { m_captionRect = captionRect(); // also update m_captionRect! @@ -376,10 +376,10 @@ void PlastikClient::paintEvent(QPaintEvent *e) } } -QRect PlastikClient::captionRect() const +TQRect PlastikClient::captionRect() const { - const QPixmap &caption = captionPixmap(); - QRect r = widget()->rect(); + const TQPixmap &caption = captionPixmap(); + TQRect r = widget()->rect(); const int titleHeight = layoutMetric(LM_TitleHeight); const int titleEdgeBottom = layoutMetric(LM_TitleEdgeBottom); @@ -413,12 +413,12 @@ QRect PlastikClient::captionRect() const tX = titleLeft+titleWidth-caption.width(); } - return QRect(tX, r.top()+titleEdgeTop, tW, titleHeight+titleEdgeBottom); + return TQRect(tX, r.top()+titleEdgeTop, tW, titleHeight+titleEdgeBottom); } void PlastikClient::updateCaption() { - QRect oldCaptionRect = m_captionRect; + TQRect oldCaptionRect = m_captionRect; if (oldCaption != caption() ) clearCaptionPixmaps(); @@ -453,12 +453,12 @@ void PlastikClient::reset( unsigned long changed ) KCommonDecoration::reset(changed); } -const QPixmap &PlastikClient::getTitleBarTile(bool active) const +const TQPixmap &PlastikClient::getTitleBarTile(bool active) const { return Handler()->pixmap(TitleBarTile, active, isToolWindow() ); } -const QPixmap &PlastikClient::captionPixmap() const +const TQPixmap &PlastikClient::captionPixmap() const { bool active = isActive(); @@ -469,44 +469,44 @@ const QPixmap &PlastikClient::captionPixmap() const // not found, create new pixmap... const uint maxCaptionLength = 300; // truncate captions longer than this! - QString c(caption() ); + TQString c(caption() ); if (c.length() > maxCaptionLength) { c.truncate(maxCaptionLength); c.append(" [...]"); } - QFontMetrics fm(s_titleFont); + TQFontMetrics fm(s_titleFont); int captionWidth = fm.width(c); int captionHeight = fm.height(); const int th = layoutMetric(LM_TitleHeight, false) + layoutMetric(LM_TitleEdgeBottom, false); - QPainter painter; + TQPainter painter; const int thickness = 2; - QPixmap *captionPixmap = new QPixmap(captionWidth+2*thickness, th); + TQPixmap *captionPixmap = new TQPixmap(captionWidth+2*thickness, th); painter.begin(captionPixmap); painter.drawTiledPixmap(captionPixmap->rect(), Handler()->pixmap(TitleBarTile, active, isToolWindow()) ); painter.setFont(s_titleFont); - QPoint tp(1, captionHeight-1); + TQPoint tp(1, captionHeight-1); if(Handler()->titleShadow()) { - QColor shadowColor; + TQColor shadowColor; if (qGray(Handler()->getColor(TitleFont,active).rgb()) < 100) - shadowColor = QColor(255, 255, 255); + shadowColor = TQColor(255, 255, 255); else - shadowColor = QColor(0,0,0); + shadowColor = TQColor(0,0,0); painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 205) ); - painter.drawText(tp+QPoint(1,2), c); + painter.drawText(tp+TQPoint(1,2), c); painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 225) ); - painter.drawText(tp+QPoint(2,2), c); + painter.drawText(tp+TQPoint(2,2), c); painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 165) ); - painter.drawText(tp+QPoint(1,1), c); + painter.drawText(tp+TQPoint(1,1), c); } painter.setPen(Handler()->getColor(TitleFont,active) ); painter.drawText(tp, c ); diff --git a/kwin/clients/plastik/plastikclient.h b/kwin/clients/plastik/plastikclient.h index 28b611b8e..e83bf75a5 100644 --- a/kwin/clients/plastik/plastikclient.h +++ b/kwin/clients/plastik/plastikclient.h @@ -37,35 +37,35 @@ public: PlastikClient(KDecorationBridge* bridge, KDecorationFactory* factory); ~PlastikClient(); - virtual QString visibleName() const; - virtual QString defaultButtonsLeft() const; - virtual QString defaultButtonsRight() const; + virtual TQString visibleName() const; + virtual TQString defaultButtonsLeft() const; + virtual TQString defaultButtonsRight() const; virtual bool decorationBehaviour(DecorationBehaviour behaviour) const; virtual int layoutMetric(LayoutMetric lm, bool respectWindowState = true, const KCommonDecorationButton * = 0) const; - virtual QRegion cornerShape(WindowCorner corner); + virtual TQRegion cornerShape(WindowCorner corner); virtual KCommonDecorationButton *createButton(ButtonType type); virtual void init(); virtual void reset( unsigned long changed ); - virtual void paintEvent(QPaintEvent *e); + virtual void paintEvent(TQPaintEvent *e); virtual void updateCaption(); - const QPixmap &getTitleBarTile(bool active) const; + const TQPixmap &getTitleBarTile(bool active) const; private: - QRect captionRect() const; + TQRect captionRect() const; - const QPixmap &captionPixmap() const; + const TQPixmap &captionPixmap() const; void clearCaptionPixmaps(); - mutable QPixmap *m_captionPixmaps[2]; + mutable TQPixmap *m_captionPixmaps[2]; - QRect m_captionRect; - QString oldCaption; + TQRect m_captionRect; + TQString oldCaption; // settings... - QFont s_titleFont; + TQFont s_titleFont; }; } // KWinPlastik -- cgit v1.2.1