Raw Qt->TQt conversion using tde/scripts/conversions/qt3-tqt3/convert_existing_qt3_app_to_tq

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/1/head
Michele Calgaro 7 months ago
parent 5f9ef32111
commit c3e158a8a1
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -17,7 +17,7 @@ Square is practical. Square is comforting and familiar, like a teddy
bear that's gotten the stuffing squeezed out of it. But square is also
boring, overdone, and, like week-old leftovers, there's only so much you
can do with it before you get sick of turkey sandwiches and turkey
quiche and turkey omlettes and cream of turkey soup.
tquiche and turkey omlettes and cream of turkey soup.
To relieve my boredom, there's Fahrenheit. That's right, this is
about _me_. If you like it, you're more than welcome to use it. If you
don't, then forget about it. It's not for you. Go back to squaredom. I

@ -13,11 +13,11 @@
#include <klocale.h>
#include <kstandarddirs.h>
#include <qbitmap.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpainter.h>
#include <qtooltip.h>
#include <ntqbitmap.h>
#include <ntqlabel.h>
#include <ntqlayout.h>
#include <ntqpainter.h>
#include <ntqtooltip.h>
#include "fahrenheitclient.h"
@ -33,7 +33,7 @@ int titleHeight_ = 24;
//////////////////////////////////////////////////////////////////////////////
bool FahrenheitFactory::initialized_ = false;
Qt::AlignmentFlags FahrenheitFactory::titlealign_ = Qt::AlignLeft;
TQt::AlignmentFlags FahrenheitFactory::titlealign_ = TQt::AlignLeft;
extern "C" KDecorationFactory* create_factory()
{
@ -102,11 +102,11 @@ bool FahrenheitFactory::readConfig()
config.setGroup("General");
// grab settings
Qt::AlignmentFlags oldalign = titlealign_;
QString value = config.readEntry("TitleAlignment", "AlignLeft");
if (value == "AlignLeft") titlealign_ = Qt::AlignLeft;
else if (value == "AlignHCenter") titlealign_ = Qt::AlignHCenter;
else if (value == "AlignRight") titlealign_ = Qt::AlignRight;
TQt::AlignmentFlags oldalign = titlealign_;
TQString value = config.readEntry("TitleAlignment", "AlignLeft");
if (value == "AlignLeft") titlealign_ = TQt::AlignLeft;
else if (value == "AlignHCenter") titlealign_ = TQt::AlignHCenter;
else if (value == "AlignRight") titlealign_ = TQt::AlignRight;
if (oldalign == titlealign_)
return false;
@ -124,16 +124,16 @@ bool FahrenheitFactory::readConfig()
// Constructor
FahrenheitButton::FahrenheitButton(FahrenheitClient *parent, const char *name,
const QString& tip, ButtonType type,
QString pixmap)
: QButton(parent->widget(), name), client_(parent), type_(type),
const TQString& tip, ButtonType type,
TQString pixmap)
: TQButton(parent->widget(), name), client_(parent), type_(type),
deco_(0), lastmouse_(0)
{
setBackgroundMode(NoBackground);
setFixedWidth(16);
setCursor(arrowCursor);
if (pixmap) setPixmap(pixmap);
QToolTip::add(this, tip);
TQToolTip::add(this, tip);
}
FahrenheitButton::~FahrenheitButton()
@ -146,15 +146,15 @@ FahrenheitButton::~FahrenheitButton()
// -----------
// Create pixmap button decorations
void FahrenheitButton::setPixmap(QString pixmap)
void FahrenheitButton::setPixmap(TQString pixmap)
{
if (!pixmap) return; // probably the menu button
QString buttonLocation_ = KGlobal::dirs()->findResource ("data",
QString("kwin/fahrenheit/") + pixmap + ".png");
TQString buttonLocation_ = KGlobal::dirs()->findResource ("data",
TQString("kwin/fahrenheit/") + pixmap + ".png");
if (deco_) delete deco_;
deco_ = new QPixmap(buttonLocation_);
deco_ = new TQPixmap(buttonLocation_);
repaint(false);
}
@ -163,9 +163,9 @@ void FahrenheitButton::setPixmap(QString pixmap)
// ----------
// Return size hint
QSize FahrenheitButton::sizeHint() const
TQSize FahrenheitButton::sizeHint() const
{
return QSize(11, 9);
return TQSize(11, 9);
}
//////////////////////////////////////////////////////////////////////////////
@ -173,10 +173,10 @@ QSize FahrenheitButton::sizeHint() const
// ------------
// Mouse has entered the button
void FahrenheitButton::enterEvent(QEvent *e)
void FahrenheitButton::enterEvent(TQEvent *e)
{
// if we wanted to do mouseovers, we would keep track of it here
QButton::enterEvent(e);
TQButton::enterEvent(e);
}
//////////////////////////////////////////////////////////////////////////////
@ -184,10 +184,10 @@ void FahrenheitButton::enterEvent(QEvent *e)
// ------------
// Mouse has left the button
void FahrenheitButton::leaveEvent(QEvent *e)
void FahrenheitButton::leaveEvent(TQEvent *e)
{
// if we wanted to do mouseovers, we would keep track of it here
QButton::leaveEvent(e);
TQButton::leaveEvent(e);
}
//////////////////////////////////////////////////////////////////////////////
@ -195,7 +195,7 @@ void FahrenheitButton::leaveEvent(QEvent *e)
// -----------------
// Button has been pressed
void FahrenheitButton::mousePressEvent(QMouseEvent* e)
void FahrenheitButton::mousePressEvent(TQMouseEvent* e)
{
lastmouse_ = e->button();
@ -204,9 +204,9 @@ void FahrenheitButton::mousePressEvent(QMouseEvent* e)
if ((type_ != ButtonMax) && (e->button() != LeftButton)) {
button = NoButton; // middle & right buttons inappropriate
}
QMouseEvent me(e->type(), e->pos(), e->globalPos(),
TQMouseEvent me(e->type(), e->pos(), e->globalPos(),
button, e->state());
QButton::mousePressEvent(&me);
TQButton::mousePressEvent(&me);
}
//////////////////////////////////////////////////////////////////////////////
@ -214,7 +214,7 @@ void FahrenheitButton::mousePressEvent(QMouseEvent* e)
// -----------------
// Button has been released
void FahrenheitButton::mouseReleaseEvent(QMouseEvent* e)
void FahrenheitButton::mouseReleaseEvent(TQMouseEvent* e)
{
lastmouse_ = e->button();
@ -223,8 +223,8 @@ void FahrenheitButton::mouseReleaseEvent(QMouseEvent* e)
if ((type_ != ButtonMax) && (e->button() != LeftButton)) {
button = NoButton; // middle & right buttons inappropriate
}
QMouseEvent me(e->type(), e->pos(), e->globalPos(), button, e->state());
QButton::mouseReleaseEvent(&me);
TQMouseEvent me(e->type(), e->pos(), e->globalPos(), button, e->state());
TQButton::mouseReleaseEvent(&me);
}
//////////////////////////////////////////////////////////////////////////////
@ -232,12 +232,12 @@ void FahrenheitButton::mouseReleaseEvent(QMouseEvent* e)
// ------------
// Draw the button
void FahrenheitButton::drawButton(QPainter *painter)
void FahrenheitButton::drawButton(TQPainter *painter)
{
if (!FahrenheitFactory::initialized()) return;
QColorGroup titleColor;
QColorGroup borderColor;
TQColorGroup titleColor;
TQColorGroup borderColor;
int dx, dy;
if (type_ == ButtonMenu) {
@ -250,8 +250,8 @@ void FahrenheitButton::drawButton(QPainter *painter)
painter->drawLine(0, 0, width(), 0);
painter->setPen(titleColor.light());
painter->drawLine(0, 1, width(), 1);
painter->drawPixmap(0, 3, client_->icon().pixmap(QIconSet::Small,
QIconSet::Normal));
painter->drawPixmap(0, 3, client_->icon().pixmap(TQIconSet::Small,
TQIconSet::Normal));
} else if (deco_) {
// otherwise we paint the deco
borderColor = KDecoration::options()->colorGroup(
@ -307,27 +307,27 @@ void FahrenheitClient::init()
// setup layout
delete mainLayout_;
mainLayout_ = new QVBoxLayout(widget(), 0, 0);
topLayout_ = new QBoxLayout(mainLayout_, QBoxLayout::LeftToRight, 0, 0);
mainLayout_ = new TQVBoxLayout(widget(), 0, 0);
topLayout_ = new TQBoxLayout(mainLayout_, TQBoxLayout::LeftToRight, 0, 0);
titleSpacer_ = new QSpacerItem ( 0, 24,
QSizePolicy::Preferred,
QSizePolicy::Fixed);
barSpacer_ = new QSpacerItem ( 14, 24,
QSizePolicy::MinimumExpanding,
QSizePolicy::Fixed);
titleSpacer_ = new TQSpacerItem ( 0, 24,
TQSizePolicy::Preferred,
TQSizePolicy::Fixed);
barSpacer_ = new TQSpacerItem ( 14, 24,
TQSizePolicy::MinimumExpanding,
TQSizePolicy::Fixed);
menuLayout_ = new QBoxLayout(topLayout_, QBoxLayout::LeftToRight, 0, 0);
menuLayout_ = new TQBoxLayout(topLayout_, TQBoxLayout::LeftToRight, 0, 0);
menuLayout_->addSpacing(16);
recalcTitlebar();
QBoxLayout * titleLayout_ = new QBoxLayout(topLayout_,
QBoxLayout::LeftToRight, 0, 0);
buttonLayout_ = new QBoxLayout(topLayout_,
QBoxLayout::LeftToRight, 0, 0);
QBoxLayout * barLayout_ = new QBoxLayout(topLayout_,
QBoxLayout::LeftToRight, 0, 0);
TQBoxLayout * titleLayout_ = new TQBoxLayout(topLayout_,
TQBoxLayout::LeftToRight, 0, 0);
buttonLayout_ = new TQBoxLayout(topLayout_,
TQBoxLayout::LeftToRight, 0, 0);
TQBoxLayout * barLayout_ = new TQBoxLayout(topLayout_,
TQBoxLayout::LeftToRight, 0, 0);
titleLayout_->addItem(titleSpacer_);
for (int n=0; n<ButtonTypeCount; n++) {
@ -338,15 +338,15 @@ void FahrenheitClient::init()
addButtons(buttonLayout_, options()->titleButtonsRight());
barLayout_->addItem(barSpacer_);
QHBoxLayout * midLayout = new QHBoxLayout(mainLayout_, 0, 0);
TQHBoxLayout * midLayout = new TQHBoxLayout(mainLayout_, 0, 0);
midLayout->addSpacing(borderSize_ + 9);
if( isPreview()) {
midLayout->addWidget(
new QLabel( i18n( "<center><b>Fahrenheit</b></center>" ),
new TQLabel( i18n( "<center><b>Fahrenheit</b></center>" ),
widget()));
} else {
midLayout->addItem( new QSpacerItem( 0, 0 ));
midLayout->addItem( new TQSpacerItem( 0, 0 ));
}
midLayout->addSpacing(borderSize_ + (isResizable() ? 2 : 0));
@ -365,14 +365,14 @@ void FahrenheitClient::init()
void FahrenheitClient::recalcTitlebar()
{
QFontMetrics fm(options()->font(isActive()));
TQFontMetrics fm(options()->font(isActive()));
titleHeight_ = fm.height();
QString cap = caption();
TQString cap = caption();
if (cap.length() < 5) // make sure the titlebar has sufficiently wide
cap = "XXXXX"; // area for dragging the window
int textLen_ = fm.width( cap );
titleSpacer_->changeSize(4 + textLen_ + 16,
24, QSizePolicy::Preferred, QSizePolicy::Fixed);
24, TQSizePolicy::Preferred, TQSizePolicy::Fixed);
}
@ -382,10 +382,10 @@ void FahrenheitClient::recalcTitlebar()
// ------------
// Add buttons to title layout
void FahrenheitClient::addButtons(QBoxLayout *layout, const QString& s)
void FahrenheitClient::addButtons(TQBoxLayout *layout, const TQString& s)
{
QString pixmap;
QString tip;
TQString pixmap;
TQString tip;
if (s.length() > 0) {
for (unsigned n=0; n < s.length(); n++) {
@ -399,7 +399,7 @@ void FahrenheitClient::addButtons(QBoxLayout *layout, const QString& s)
this, SLOT(menuButtonPressed()));
button[ButtonMenu]->setFixedHeight(19);
menuLayout_->insertWidget(-1, button[ButtonMenu],
0, Qt::AlignTop);
0, TQt::AlignTop);
menuLayout_->addSpacing(4);
}
break;
@ -420,7 +420,7 @@ void FahrenheitClient::addButtons(QBoxLayout *layout, const QString& s)
this, SLOT(toggleOnAllDesktops()));
button[ButtonSticky]->setFixedHeight(11);
layout->insertWidget(-1, button[ButtonSticky],
0, Qt::AlignBottom);
0, TQt::AlignBottom);
}
break;
@ -433,7 +433,7 @@ void FahrenheitClient::addButtons(QBoxLayout *layout, const QString& s)
this, SLOT(showContextHelp()));
button[ButtonHelp]->setFixedHeight(11);
layout->insertWidget(-1, button[ButtonHelp],
0, Qt::AlignBottom);
0, TQt::AlignBottom);
}
break;
@ -447,7 +447,7 @@ void FahrenheitClient::addButtons(QBoxLayout *layout, const QString& s)
this, SLOT(minimize()));
button[ButtonMin]->setFixedHeight(11);
layout->insertWidget(-1, button[ButtonMin],
0, Qt::AlignBottom);
0, TQt::AlignBottom);
}
break;
@ -467,7 +467,7 @@ void FahrenheitClient::addButtons(QBoxLayout *layout, const QString& s)
this, SLOT(maxButtonPressed()));
button[ButtonMax]->setFixedHeight(11);
layout->insertWidget(-1, button[ButtonMax],
0, Qt::AlignBottom);
0, TQt::AlignBottom);
}
break;
@ -480,7 +480,7 @@ void FahrenheitClient::addButtons(QBoxLayout *layout, const QString& s)
this, SLOT(closeWindow()));
button[ButtonClose]->setFixedHeight(11);
layout->insertWidget(-1, button[ButtonClose],
0, Qt::AlignBottom);
0, TQt::AlignBottom);
}
break;
@ -527,8 +527,8 @@ void FahrenheitClient::desktopChange()
if (button[ButtonSticky]) {
//button[ButtonSticky]->setBitmap(d ? stickydown_bits : sticky_bits);
button[ButtonSticky]->setPixmap(d ? "unsticky" : "sticky");
QToolTip::remove(button[ButtonSticky]);
QToolTip::add(button[ButtonSticky], d ? i18n("Un-Sticky") : i18n("Sticky"));
TQToolTip::remove(button[ButtonSticky]);
TQToolTip::add(button[ButtonSticky], d ? i18n("Un-Sticky") : i18n("Sticky"));
}
}
@ -556,8 +556,8 @@ void FahrenheitClient::maximizeChange()
if (button[ButtonMax]) {
//button[ButtonMax]->setBitmap(m ? minmax_bits : max_bits);
button[ButtonMax]->setPixmap(m ? "minmax" : "maximize");
QToolTip::remove(button[ButtonMax]);
QToolTip::add(button[ButtonMax], m ? i18n("Restore") : i18n("Maximize"));
TQToolTip::remove(button[ButtonMax]);
TQToolTip::add(button[ButtonMax], m ? i18n("Restore") : i18n("Maximize"));
}
}
@ -592,7 +592,7 @@ void FahrenheitClient::borders(int &l, int &r, int &t, int &b) const
// --------
// Called to resize the window
void FahrenheitClient::resize(const QSize &size)
void FahrenheitClient::resize(const TQSize &size)
{
widget()->resize(size);
}
@ -602,9 +602,9 @@ void FahrenheitClient::resize(const QSize &size)
// -------------
// Return the minimum allowable size for this decoration
QSize FahrenheitClient::minimumSize() const
TQSize FahrenheitClient::minimumSize() const
{
return QSize(100, 50);
return TQSize(100, 50);
}
//////////////////////////////////////////////////////////////////////////////
@ -612,7 +612,7 @@ QSize FahrenheitClient::minimumSize() const
// ---------------
// Return logical mouse position
KDecoration::Position FahrenheitClient::mousePosition(const QPoint &point) const
KDecoration::Position FahrenheitClient::mousePosition(const TQPoint &point) const
{
//const int corner = 24;
Position pos;
@ -665,29 +665,29 @@ bool FahrenheitClient::isTool()
// -------------
// Event filter
bool FahrenheitClient::eventFilter(QObject *obj, QEvent *e)
bool FahrenheitClient::eventFilter(TQObject *obj, TQEvent *e)
{
if (obj != widget()) return false;
switch (e->type()) {
case QEvent::MouseButtonDblClick: {
mouseDoubleClickEvent(static_cast<QMouseEvent *>(e));
case TQEvent::MouseButtonDblClick: {
mouseDoubleClickEvent(static_cast<TQMouseEvent *>(e));
return true;
}
case QEvent::MouseButtonPress: {
processMousePressEvent(static_cast<QMouseEvent *>(e));
case TQEvent::MouseButtonPress: {
processMousePressEvent(static_cast<TQMouseEvent *>(e));
return true;
}
case QEvent::Paint: {
paintEvent(static_cast<QPaintEvent *>(e));
case TQEvent::Paint: {
paintEvent(static_cast<TQPaintEvent *>(e));
return true;
}
case QEvent::Resize: {
resizeEvent(static_cast<QResizeEvent *>(e));
case TQEvent::Resize: {
resizeEvent(static_cast<TQResizeEvent *>(e));
return true;
}
case QEvent::Show: {
showEvent(static_cast<QShowEvent *>(e));
case TQEvent::Show: {
showEvent(static_cast<TQShowEvent *>(e));
return true;
}
default: {
@ -703,7 +703,7 @@ bool FahrenheitClient::eventFilter(QObject *obj, QEvent *e)
// -----------------------
// Doubleclick on title
void FahrenheitClient::mouseDoubleClickEvent(QMouseEvent *e)
void FahrenheitClient::mouseDoubleClickEvent(TQMouseEvent *e)
{
if (titleSpacer_->geometry().contains(e->pos())) titlebarDblClickOperation();
}
@ -713,15 +713,15 @@ void FahrenheitClient::mouseDoubleClickEvent(QMouseEvent *e)
// ------------
// Repaint the window
void FahrenheitClient::paintEvent(QPaintEvent*)
void FahrenheitClient::paintEvent(TQPaintEvent*)
{
QColorGroup titleColor = options()->colorGroup(ColorTitleBar, isActive());
QColorGroup handleColor = options()->colorGroup(ColorHandle, isActive());
QColorGroup borderColor = options()->colorGroup(ColorFrame, isActive());
TQColorGroup titleColor = options()->colorGroup(ColorTitleBar, isActive());
TQColorGroup handleColor = options()->colorGroup(ColorHandle, isActive());
TQColorGroup borderColor = options()->colorGroup(ColorFrame, isActive());
QRect t = titleSpacer_->geometry();
QRect buttonRect = buttonLayout_->geometry();
QRect barRect = barSpacer_->geometry();
TQRect t = titleSpacer_->geometry();
TQRect buttonRect = buttonLayout_->geometry();
TQRect barRect = barSpacer_->geometry();
t.setTop(1);
int handle = (isResizable() ? 2 : 0);
@ -732,9 +732,9 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
int b = height() - handle;
int w = width();
int h = height();
QPainter p(widget());
TQPainter p(widget());
p.setPen(Qt::black);
p.setPen(TQt::black);
p.setBrush(borderColor.background());
p.drawRect(9, 13, width() - 9 - handle, height() - 13 - handle); // Outer edge
@ -752,7 +752,7 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
// Draw edge of bottom-left corner inside the area removed by the mask.
// We draw this now, instead of later with the rest, so that it doesn't
// cover up part of the grip bar.
p.setPen(Qt::black);
p.setPen(TQt::black);
p.drawPoint(10, b - 5);
p.drawPoint(10, b - 4);
p.drawPoint(11, b - 3);
@ -771,7 +771,7 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
p.drawLine(12, 10, width() - handle - 6, 10); // Bevel edge to left of button area
// Draw to the right of the button area
p.setPen(Qt::black);
p.setPen(TQt::black);
p.drawLine(r - barWidth, 10, r - barWidth + 5, 12);
p.setPen(borderColor.mid());
p.drawLine(r - barWidth, 11, r - barWidth + 5, 13);
@ -838,7 +838,7 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
p.drawLine(tr - 5, tt + 7, tr - 5, tt + 11);
// Draw top edge and left curve of title bar
//p.setPen(Qt::black);
//p.setPen(TQt::black);
p.setPen(titleColor.dark());
p.drawPoint(3, 1);
p.drawPoint(4, 1);
@ -976,7 +976,7 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
p.drawLine(8, 26, 5, 29);
}
p.setPen(Qt::black);
p.setPen(TQt::black);
//p.setPen(borderColor.dark());
// Draw edge of top-right corner inside the area removed by the mask.
@ -995,7 +995,7 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
// Draw edge of bottom-right corner inside the area removed by the mask.
p.setPen(Qt::black);
p.setPen(TQt::black);
p.drawPoint(r - 2, b - 5);
p.drawPoint(r - 2, b - 4);
p.drawPoint(r - 3, b - 3);
@ -1009,7 +1009,7 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
if (isResizable()) {
if (!isShade()) { // Draw handle bar
p.setPen(Qt::black);
p.setPen(TQt::black);
p.fillRect(w - 5, h - 20, 3, 17, borderColor.background());
p.fillRect(w - 20, h - 5, 17, 3, borderColor.background());
@ -1037,10 +1037,10 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
p.setFont(options()->font(isActive(), isTool()));
p.setPen(options()->color(ColorFont, isActive()));
/*
p.drawText(20, 0, t.width() - 36, 20, Qt::AlignVCenter, caption());
p.drawText(20, 0, t.width() - 36, 20, TQt::AlignVCenter, caption());
*/
p.drawText(menuLayout_->geometry().width(), 0, t.width() - 16, 20,
Qt::AlignVCenter, caption());
TQt::AlignVCenter, caption());
}
@ -1051,12 +1051,12 @@ void FahrenheitClient::paintEvent(QPaintEvent*)
void FahrenheitClient::doShape()
{
QRegion mask(0, 0, width(), height());
QRect t(titleSpacer_->geometry());
TQRegion mask(0, 0, width(), height());
TQRect t(titleSpacer_->geometry());
int handle = (isResizable() ? 2 : 0);
int tr = t.right();
QRect barRect(barSpacer_->geometry());
QRect buttonRect(buttonLayout_->geometry());
TQRect barRect(barSpacer_->geometry());
TQRect buttonRect(buttonLayout_->geometry());
int barWidth = barRect.width() - handle;
int buttonWidth = buttonRect.width();
@ -1067,77 +1067,77 @@ void FahrenheitClient::doShape()
// Remove top-left corner.
mask -= QRegion(0, 0, 5, 1);
mask -= QRegion(0, 1, 3, 1);
mask -= QRegion(0, 2, 2, 1);
mask -= QRegion(0, 3, 1, 2);
mask -= TQRegion(0, 0, 5, 1);
mask -= TQRegion(0, 1, 3, 1);
mask -= TQRegion(0, 2, 2, 1);
mask -= TQRegion(0, 3, 1, 2);
// Remove area above rounded portion of title bar
mask -= QRegion(tr - 11, 0, 12, 1);
mask -= QRegion(tr - 8, 1, 9, 1);
mask -= QRegion(tr - 7, 2, 8, 1);
mask -= QRegion(tr - 6, 3, 7, 1);
mask -= QRegion(tr - 5, 4, 6, 1);
mask -= QRegion(tr - 4, 5, 5, 3);
mask -= QRegion(tr - 3, 8, 4, 1);
mask -= TQRegion(tr - 11, 0, 12, 1);
mask -= TQRegion(tr - 8, 1, 9, 1);
mask -= TQRegion(tr - 7, 2, 8, 1);
mask -= TQRegion(tr - 6, 3, 7, 1);
mask -= TQRegion(tr - 5, 4, 6, 1);
mask -= TQRegion(tr - 4, 5, 5, 3);
mask -= TQRegion(tr - 3, 8, 4, 1);
// Remove area above button area
mask -= QRegion(r - buttonWidth - barWidth, 0, buttonWidth + 6, 9);
mask -= TQRegion(r - buttonWidth - barWidth, 0, buttonWidth + 6, 9);
// Remove top area above blank bar and top-right corner.
mask -= QRegion(r - barWidth + 6, 0, barWidth, 13);
mask -= TQRegion(r - barWidth + 6, 0, barWidth, 13);
mask -= QRegion(r - barWidth, 9, 6, 1);
mask -= QRegion(r - barWidth + 2, 10, 4, 1);
mask -= QRegion(r - barWidth + 4, 11, 2, 1);
mask -= QRegion(r - 5, 13, 5, 1);
mask -= QRegion(r - 3, 14, 3, 1);
mask -= QRegion(r - 2, 15, 2, 1);
mask -= QRegion(r - 1, 16, 1, 2);
mask -= TQRegion(r - barWidth, 9, 6, 1);
mask -= TQRegion(r - barWidth + 2, 10, 4, 1);
mask -= TQRegion(r - barWidth + 4, 11, 2, 1);
mask -= TQRegion(r - 5, 13, 5, 1);
mask -= TQRegion(r - 3, 14, 3, 1);
mask -= TQRegion(r - 2, 15, 2, 1);
mask -= TQRegion(r - 1, 16, 1, 2);
// Remove left side below grip bar
if (isShade())
{
mask -= QRegion(0, 20, 1, 5);
mask -= QRegion(1, 22, 1, 3);
mask -= QRegion(2, 23, 1, 2);
mask -= QRegion(3, 24, 2, 1);
mask -= TQRegion(0, 20, 1, 5);
mask -= TQRegion(1, 22, 1, 3);
mask -= TQRegion(2, 23, 1, 2);
mask -= TQRegion(3, 24, 2, 1);
} else {
mask -= QRegion(0, 29, 1, 2);
mask -= QRegion(0, 31, 2, 1);
mask -= QRegion(0, 32, 3, 1);
mask -= QRegion(0, 33, 5, 1);
mask -= QRegion(0, 34, 7, 1);
mask -= TQRegion(0, 29, 1, 2);
mask -= TQRegion(0, 31, 2, 1);
mask -= TQRegion(0, 32, 3, 1);
mask -= TQRegion(0, 33, 5, 1);
mask -= TQRegion(0, 34, 7, 1);
}
mask -= QRegion(0, 35, 9, b - 35);
mask -= TQRegion(0, 35, 9, b - 35);
// Remove bottom-left corner
//mask -= QRegion(0, b - 5, 10, 3);
mask -= QRegion(0, b - 4, 10, 3);
mask -= QRegion(0, b - 3, 11, 1);
mask -= QRegion(0, b - 2, 12, 1);
mask -= QRegion(0, b - 1, 14, 1);
//mask -= TQRegion(0, b - 5, 10, 3);
mask -= TQRegion(0, b - 4, 10, 3);
mask -= TQRegion(0, b - 3, 11, 1);
mask -= TQRegion(0, b - 2, 12, 1);
mask -= TQRegion(0, b - 1, 14, 1);
// Remove bottom-right corner.
mask -= QRegion(w - 5, h - 1, 5, 1);
mask -= QRegion(w - 3, h - 2, 3, 1);
mask -= QRegion(w - 2, h - 3, 2, 1);
mask -= QRegion(w - 1, h - 5, 1, 2);
mask -= TQRegion(w - 5, h - 1, 5, 1);
mask -= TQRegion(w - 3, h - 2, 3, 1);
mask -= TQRegion(w - 2, h - 3, 2, 1);
mask -= TQRegion(w - 1, h - 5, 1, 2);
if (isResizable()) {
if (isShade()) { // We don't have a handle bar to worry about
mask -= QRect(w - 2, 0, w - 1, h); // right side
mask -= QRect(0, h - 2, w, h - 1); // bottom
mask -= QRegion(r - 5, b - 1, 5, 1);
mask -= QRegion(r - 3, b - 2, 3, 1);
mask -= QRegion(r - 2, b - 3, 2, 1);
mask -= QRegion(r - 1, b - 5, 1, 2);
mask -= TQRect(w - 2, 0, w - 1, h); // right side
mask -= TQRect(0, h - 2, w, h - 1); // bottom
mask -= TQRegion(r - 5, b - 1, 5, 1);
mask -= TQRegion(r - 3, b - 2, 3, 1);
mask -= TQRegion(r - 2, b - 3, 2, 1);
mask -= TQRegion(r - 1, b - 5, 1, 2);
} else { // Leave area for handle bar
mask -= QRect(w - 2, 0, w - 1, h - 20); // right side
mask -= QRect(0, h - 2, w - 20, h - 1); // bottom
mask -= QRegion(w - 1, h - 20, 1, 2);
mask -= QRegion(w - 20, h - 1, 2, 1);
mask -= TQRect(w - 2, 0, w - 1, h - 20); // right side
mask -= TQRect(0, h - 2, w - 20, h - 1); // bottom
mask -= TQRegion(w - 1, h - 20, 1, 2);
mask -= TQRegion(w - 20, h - 1, 2, 1);
}
}
setMask(mask);
@ -1148,10 +1148,10 @@ void FahrenheitClient::doShape()
// -------------
// Window is being resized
void FahrenheitClient::resizeEvent(QResizeEvent *)
void FahrenheitClient::resizeEvent(TQResizeEvent *)
{
if (widget()->isShown()) {
QRegion region = widget()->rect();
TQRegion region = widget()->rect();
region = region.subtract(titleSpacer_->geometry());
doShape();
widget()->erase(region);
@ -1163,7 +1163,7 @@ void FahrenheitClient::resizeEvent(QResizeEvent *)
// -----------
// Window is being shown
void FahrenheitClient::showEvent(QShowEvent *)
void FahrenheitClient::showEvent(TQShowEvent *)
{
doShape();
widget()->repaint();
@ -1199,7 +1199,7 @@ void FahrenheitClient::maxButtonPressed()
void FahrenheitClient::menuButtonPressed()
{
if (button[ButtonMenu]) {
QPoint p(button[ButtonMenu]->rect().bottomLeft().x(),
TQPoint p(button[ButtonMenu]->rect().bottomLeft().x(),
button[ButtonMenu]->rect().bottomLeft().y());
KDecorationFactory* f = factory();
showWindowMenu(button[ButtonMenu]->mapToGlobal(p));

@ -27,12 +27,12 @@
#ifndef FAHRENHEITCLIENT_H
#define FAHRENHEITCLIENT_H
#include <qbutton.h>
#include <ntqbutton.h>
#include <kdecoration.h>
#include <kdecorationfactory.h>
class QSpacerItem;
class QPoint;
class TQSpacerItem;
class TQPoint;
namespace Fahrenheit {
@ -59,49 +59,49 @@ public:
virtual bool reset(unsigned long changed);
static bool initialized();
static Qt::AlignmentFlags titleAlign();
static TQt::AlignmentFlags titleAlign();
private:
bool readConfig();
private:
static bool initialized_;
static Qt::AlignmentFlags titlealign_;
static TQt::AlignmentFlags titlealign_;
};
inline bool FahrenheitFactory::initialized()
{ return initialized_; }
inline Qt::AlignmentFlags FahrenheitFactory::titleAlign()
inline TQt::AlignmentFlags FahrenheitFactory::titleAlign()
{ return titlealign_; }
// FahrenheitButton //////////////////////////////////////////////////////////////
class FahrenheitButton : public QButton
class FahrenheitButton : public TQButton
{
public:
FahrenheitButton(FahrenheitClient *parent=0, const char *name=0,
const QString &tip=NULL,
const TQString &tip=NULL,
ButtonType type=ButtonHelp,
QString pixmap=NULL);
TQString pixmap=NULL);
~FahrenheitButton();
void setPixmap(QString pixmap);
QSize sizeHint() const;
void setPixmap(TQString pixmap);
TQSize sizeHint() const;
int lastMousePress() const;
void reset();
private:
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void drawButton(QPainter *painter);
void enterEvent(TQEvent *e);
void leaveEvent(TQEvent *e);
void mousePressEvent(TQMouseEvent *e);
void mouseReleaseEvent(TQMouseEvent *e);
void drawButton(TQPainter *painter);
private:
FahrenheitClient *client_;
ButtonType type_;
QPixmap *deco_;
TQPixmap *deco_;
int lastmouse_;
};
@ -132,19 +132,19 @@ public:
virtual void doShape();
virtual void borders(int &l, int &r, int &t, int &b) const;
virtual void resize(const QSize &size);
virtual QSize minimumSize() const;
virtual Position mousePosition(const QPoint &point) const;
virtual void resize(const TQSize &size);
virtual TQSize minimumSize() const;
virtual Position mousePosition(const TQPoint &point) const;
private:
void addButtons(QBoxLayout* layout, const QString& buttons);
void addButtons(TQBoxLayout* layout, const TQString& buttons);
bool isTool();
bool eventFilter(QObject *obj, QEvent *e);
void mouseDoubleClickEvent(QMouseEvent *e);
void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *);
void showEvent(QShowEvent *);
bool eventFilter(TQObject *obj, TQEvent *e);
void mouseDoubleClickEvent(TQMouseEvent *e);
void paintEvent(TQPaintEvent *e);
void resizeEvent(TQResizeEvent *);
void showEvent(TQShowEvent *);
private slots:
void maxButtonPressed();
@ -153,12 +153,12 @@ private slots:
private:
int buttonWidth_;
FahrenheitButton *button[ButtonTypeCount];
QBoxLayout *mainLayout_;
QBoxLayout *topLayout_;
QBoxLayout *menuLayout_;
QBoxLayout *buttonLayout_;
QSpacerItem *titleSpacer_;
QSpacerItem *barSpacer_;
TQBoxLayout *mainLayout_;
TQBoxLayout *topLayout_;
TQBoxLayout *menuLayout_;
TQBoxLayout *buttonLayout_;
TQSpacerItem *titleSpacer_;
TQSpacerItem *barSpacer_;
};
} // namespace Fahrenheit

Loading…
Cancel
Save