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 1 year 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 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 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 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 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 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 don't, then forget about it. It's not for you. Go back to squaredom. I

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

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

Loading…
Cancel
Save