summaryrefslogtreecommitdiffstats
path: root/config/colordialog.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2016-03-25 20:03:28 +0100
committerSlávek Banko <slavek.banko@axis.cz>2016-03-25 20:03:28 +0100
commit2ee99ab520931c5efe91123c85ba10064a45e95d (patch)
treea367666e410de28d0f258aed77b11e17cafb28e4 /config/colordialog.cpp
parentcfa36e1a95e82492c17225ff376911abb3688f62 (diff)
downloadtde-style-baghira-2ee99ab520931c5efe91123c85ba10064a45e95d.tar.gz
tde-style-baghira-2ee99ab520931c5efe91123c85ba10064a45e95d.zip
Initial TQt conversion
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'config/colordialog.cpp')
-rw-r--r--config/colordialog.cpp132
1 files changed, 66 insertions, 66 deletions
diff --git a/config/colordialog.cpp b/config/colordialog.cpp
index 3466082..38279c8 100644
--- a/config/colordialog.cpp
+++ b/config/colordialog.cpp
@@ -1,12 +1,12 @@
#include "colordialog.h"
-#include <qlabel.h>
-#include <qdir.h>
-#include <qcombobox.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qpushbutton.h>
-#include <qstyle.h>
+#include <tqlabel.h>
+#include <tqdir.h>
+#include <tqcombobox.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpushbutton.h>
+#include <tqstyle.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kcolordialog.h>
@@ -36,33 +36,33 @@ if ( R < 0 ) R = 0; else if ( R > 255 ) R = 255; \
if ( G < 0 ) G = 0; else if ( G > 255 ) G = 255; \
if ( B < 0 ) B = 0; else if ( B > 255 ) B = 255;
-ColorDialog::ColorDialog(QWidget* parent, const char* name) : QDialog( parent, name)
+ColorDialog::ColorDialog(TQWidget* parent, const char* name) : TQDialog( parent, name)
{
- QVBoxLayout *vertical = new QVBoxLayout(this);
- QHBoxLayout *top = new QHBoxLayout(vertical);
+ TQVBoxLayout *vertical = new TQVBoxLayout(this);
+ TQHBoxLayout *top = new TQHBoxLayout(vertical);
demo = new DemoWindow(this);
top->addWidget(demo);
- QVBoxLayout *topRight = new QVBoxLayout(top);
- QLabel *info = new QLabel("<qt>Select custom colors or grab directly from screen.<br>Click image left to switch between items.</qt>",this);
+ TQVBoxLayout *topRight = new TQVBoxLayout(top);
+ TQLabel *info = new TQLabel("<qt>Select custom colors or grab directly from screen.<br>Click image left to switch between items.</qt>",this);
topRight->addWidget(info);
- QIconSet icon = KGlobal::iconLoader()->loadIconSet("colorpicker", KIcon::Small);
- buttonCP = new QPushButton(icon, QString::null, this);
+ TQIconSet icon = KGlobal::iconLoader()->loadIconSet("colorpicker", KIcon::Small);
+ buttonCP = new TQPushButton(icon, TQString::null, this);
topRight->addWidget(buttonCP);
- QLabel *lb = new QLabel("From other app:",this);
+ TQLabel *lb = new TQLabel("From other app:",this);
topRight->addWidget(lb);
- other = new QComboBox(this);
+ other = new TQComboBox(this);
topRight->addWidget(other);
topRight->addStretch();
- buttonOk = new QPushButton("&Ok", this);
+ buttonOk = new TQPushButton("&Ok", this);
topRight->addWidget(buttonOk);
- buttonCancel = new QPushButton("&Cancel", this);
+ buttonCancel = new TQPushButton("&Cancel", this);
topRight->addWidget(buttonCancel);
const char *title[NUMCOLORS] = {"Background", "Button", "Base", "Text", "Highlight", "Highlighted Text", "Button Text", "Alternate Background"};
for (int i = 0; i < NUMCOLORS; i++)
{
picker[i] = new ColorPicker(this, title[i]);
vertical->addWidget(picker[i]);
- connect (picker[i], SIGNAL(colorChanged(QColor)), demo, SLOT(smartRepaint()));
+ connect (picker[i], SIGNAL(colorChanged(TQColor)), demo, SLOT(smartRepaint()));
picker[i]->hide();
}
for (int i = 0; i < NUMCOLORS; i++)
@@ -83,7 +83,7 @@ ColorDialog::ColorDialog(QWidget* parent, const char* name) : QDialog( parent, n
connect (buttonOk, SIGNAL(clicked()), this, SLOT(close()));
connect (buttonCP, SIGNAL(clicked()), this, SLOT(grabColor()));
connect (buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
- connect (other, SIGNAL(activated (const QString &)), this, SLOT(getFromOther(const QString &)));
+ connect (other, SIGNAL(activated (const TQString &)), this, SLOT(getFromOther(const TQString &)));
}
ColorDialog::~ColorDialog()
@@ -93,21 +93,21 @@ ColorDialog::~ColorDialog()
void ColorDialog::show()
{
other->clear();
- QDir d( QDir::homeDirPath() + "/.baghira", 0L, QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::Readable | QDir::Writable );
+ TQDir d( TQDir::homeDirPath() + "/.baghira", 0L, TQDir::Name | TQDir::IgnoreCase, TQDir::Files | TQDir::Readable | TQDir::Writable );
if (d.exists())
{
for ( uint i = 0; i < d.count(); i++ )
other->insertItem(d[i]);
}
- QDialog::show();
+ TQDialog::show();
demo->show();
// demo->repaint(false);
}
-void ColorDialog::getFromOther( const QString & string )
+void ColorDialog::getFromOther( const TQString & string )
{
FILE *file = NULL;
- QString tmpString = QDir::homeDirPath() + "/.baghira/" + string;
+ TQString tmpString = TQDir::homeDirPath() + "/.baghira/" + string;
if( (file = fopen(tmpString.latin1(), "r")) != NULL )
{
uint k;
@@ -119,7 +119,7 @@ void ColorDialog::getFromOther( const QString & string )
for (int i = 0; i < NUMCOLORS; i++)
{
picker[i]->blockSignals(true);
- if (colors[i] != -1) picker[i]->setColor(QColor(colors[i]));
+ if (colors[i] != -1) picker[i]->setColor(TQColor(colors[i]));
picker[i]->blockSignals(false);
}
demo->repaint(false);
@@ -133,7 +133,7 @@ void ColorDialog::grabColor()
grabKeyboard();
}
-void ColorDialog::mouseReleaseEvent(QMouseEvent* me)
+void ColorDialog::mouseReleaseEvent(TQMouseEvent* me)
{
if (gettingColorFromScreen)
{
@@ -150,38 +150,38 @@ void ColorDialog::mouseReleaseEvent(QMouseEvent* me)
}
}
else
- QDialog::mouseReleaseEvent(me);
+ TQDialog::mouseReleaseEvent(me);
}
-//extern QImage uic_findiImage(const QString& name);
+//extern TQImage uic_findiImage(const TQString& name);
//extern void qInitImages_baghira();
//extern void qCleanupImages_baghira();
-DemoWindow::DemoWindow( ColorDialog* parent, const char* name) : QWidget(parent, name)
+DemoWindow::DemoWindow( ColorDialog* parent, const char* name) : TQWidget(parent, name)
{
- setBackgroundMode ( Qt::NoBackground );
+ setBackgroundMode ( TQt::NoBackground );
colorDialog_ = parent;
setFixedSize(320,120);
- pm = new QPixmap(320,120);
- pp = new QPainter();
- p = new QPainter();
- (const_cast<QFont*>(&p->font()))->setPixelSize(16);
- baseRect = QRect(20, 10, 200, 100);
- buttonRect = QRect(230, 90, 37, 21);
- buttonTextRect = QRect(236, 91, 20, 18);
- highlightRect = QRect(21, 42, 198, 22);
- textRect = QRect(25, 21, 100, 18);
- highTextRect = QRect(25, 42, 120, 22);
- alternateRect = QRect(21, 86, 198, 22);
+ pm = new TQPixmap(320,120);
+ pp = new TQPainter();
+ p = new TQPainter();
+ (const_cast<TQFont*>(&p->font()))->setPixelSize(16);
+ baseRect = TQRect(20, 10, 200, 100);
+ buttonRect = TQRect(230, 90, 37, 21);
+ buttonTextRect = TQRect(236, 91, 20, 18);
+ highlightRect = TQRect(21, 42, 198, 22);
+ textRect = TQRect(25, 21, 100, 18);
+ highTextRect = TQRect(25, 42, 120, 22);
+ alternateRect = TQRect(21, 86, 198, 22);
baseImage = uic_findImage("button-base");
- dest = QImage( baseImage.width(), baseImage.height(), 32 );
+ dest = TQImage( baseImage.width(), baseImage.height(), 32 );
dest.setAlphaBuffer( true );
}
DemoWindow::~DemoWindow(){}
-void DemoWindow::mousePressEvent ( QMouseEvent * me )
+void DemoWindow::mousePressEvent ( TQMouseEvent * me )
{
for (int i = 0; i < NUMCOLORS; i++)
colorDialog_->picker[i]->hide();
@@ -204,23 +204,23 @@ void DemoWindow::mousePressEvent ( QMouseEvent * me )
colorDialog_->picker[Back]->show();
}
-void DemoWindow::paintEvent ( QPaintEvent * )
+void DemoWindow::paintEvent ( TQPaintEvent * )
{
pp->begin(pm);
pp->fillRect(0,0,pm->width(),pm->height(), colorDialog_->picker[Back]->color());
- style().drawPrimitive( QStyle::PE_PanelLineEdit, pp, rect(), colorGroup() );
+ style().drawPrimitive( TQStyle::PE_PanelLineEdit, pp, rect(), colorGroup() );
pp->fillRect(baseRect, colorDialog_->picker[Base]->color());
pp->fillRect(highlightRect, colorDialog_->picker[High]->color());
pp->fillRect(alternateRect, colorDialog_->picker[Alternate]->color());
pp->setPen ( colorDialog_->picker[Text]->color() );
- pp->drawText ( textRect, Qt::AlignAuto | Qt::AlignVCenter, "Common Text");
- pp->drawText ( alternateRect, Qt::AlignAuto | Qt::AlignVCenter, "Alt. Background");
+ pp->drawText ( textRect, TQt::AlignAuto | TQt::AlignVCenter, "Common Text");
+ pp->drawText ( alternateRect, TQt::AlignAuto | TQt::AlignVCenter, "Alt. Background");
pp->setPen ( colorDialog_->picker[HighText]->color() );
- pp->drawText ( highTextRect, Qt::AlignAuto | Qt::AlignVCenter, "Highlighted Text");
+ pp->drawText ( highTextRect, TQt::AlignAuto | TQt::AlignVCenter, "Highlighted Text");
pp->drawPixmap(buttonRect, tintButton(baseImage, colorDialog_->picker[Button]->color()));
pp->setPen ( colorDialog_->picker[ButText]->color() );
- pp->drawText ( buttonTextRect, Qt::AlignCenter, "B");
- style().drawPrimitive( QStyle::PE_PanelLineEdit, pp, baseRect, colorGroup());
+ pp->drawText ( buttonTextRect, TQt::AlignCenter, "B");
+ style().drawPrimitive( TQStyle::PE_PanelLineEdit, pp, baseRect, colorGroup());
pp->end();
p->begin(this);
p->drawPixmap(0,0, *pm);
@@ -231,49 +231,49 @@ void DemoWindow::smartRepaint()
{
if (colorDialog_->picker[Back]->isShown())
{
- QWidget::repaint(false);
+ TQWidget::repaint(false);
return;
}
if (colorDialog_->picker[Button]->isShown())
{
- QWidget::repaint(buttonRect, false);
+ TQWidget::repaint(buttonRect, false);
return;
}
if (colorDialog_->picker[Base]->isShown())
{
- QWidget::repaint(false);
+ TQWidget::repaint(false);
return;
}
if (colorDialog_->picker[Text]->isShown())
{
- QWidget::repaint(textRect, false);
+ TQWidget::repaint(textRect, false);
return;
}
if (colorDialog_->picker[High]->isShown())
{
- QWidget::repaint(highlightRect, false);
+ TQWidget::repaint(highlightRect, false);
return;
}
if (colorDialog_->picker[HighText]->isShown())
{
- QWidget::repaint(highTextRect, false);
+ TQWidget::repaint(highTextRect, false);
return;
}
if (colorDialog_->picker[Alternate]->isShown())
{
- QWidget::repaint(alternateRect, false);
+ TQWidget::repaint(alternateRect, false);
return;
}
if (colorDialog_->picker[ButText]->isShown())
{
- QWidget::repaint(buttonTextRect, false);
+ TQWidget::repaint(buttonTextRect, false);
return;
}
}
-QImage & DemoWindow::tintButton(QImage &src, QColor & c)
+TQImage & DemoWindow::tintButton(TQImage &src, TQColor & c)
{
-// dest = QImage( src.width(), src.height(), 32, 0, _ENDIAN_ );
+// dest = TQImage( src.width(), src.height(), 32, 0, _ENDIAN_ );
unsigned int *data = ( unsigned int * ) src.bits();
unsigned int *destData = ( unsigned int* ) dest.bits();
int total = src.width() * src.height();
@@ -287,14 +287,14 @@ QImage & DemoWindow::tintButton(QImage &src, QColor & c)
int sq = CLAMP((int)((45.0/128.0)*s+55),0,100);
// float srcPercent, destPercent;
for ( int current = 0 ; current < total ; ++current ) {
- alpha = qAlpha( data[ current ] );
- blue = qBlue( data[ current ] );
- red = qRed( data[ current ] );
- green = qGreen( data[ current ] );
+ alpha = tqAlpha( data[ current ] );
+ blue = tqBlue( data[ current ] );
+ red = tqRed( data[ current ] );
+ green = tqGreen( data[ current ] );
SATURATION_COLOR2(sq, red, green, blue);
// force back to valid colorspace !
COLOR_SPACE(destR, destG, destB);
- destData[ current ] = qRgba( destR, destG, destB, alpha );
+ destData[ current ] = tqRgba( destR, destG, destB, alpha );
}
return ( dest );
}