diff options
Diffstat (limited to 'digikam/libs/widgets/iccprofiles/cietonguewidget.cpp')
-rw-r--r-- | digikam/libs/widgets/iccprofiles/cietonguewidget.cpp | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/digikam/libs/widgets/iccprofiles/cietonguewidget.cpp b/digikam/libs/widgets/iccprofiles/cietonguewidget.cpp index 78da59f..abbf928 100644 --- a/digikam/libs/widgets/iccprofiles/cietonguewidget.cpp +++ b/digikam/libs/widgets/iccprofiles/cietonguewidget.cpp @@ -29,13 +29,13 @@ #include <cmath> -// Qt includes. +// TQt includes. -#include <qimage.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qfile.h> -#include <qtimer.h> +#include <tqimage.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqfile.h> +#include <tqtimer.h> // KDE includes. @@ -182,9 +182,9 @@ public: int pxrows; int pos; // Position of animation during loading/calculation. - QPainter painter; - QPixmap pixmap; - QTimer *blinkTimer; + TQPainter painter; + TQPixmap pixmap; + TQTimer *blinkTimer; cmsHPROFILE hMonitorProfile; cmsHPROFILE hXYZProfile; @@ -195,11 +195,11 @@ public: MEASUREMENT Measurement; }; -CIETongueWidget::CIETongueWidget(int w, int h, QWidget *parent, cmsHPROFILE hMonitor) - : QWidget(parent, 0, Qt::WDestructiveClose) +CIETongueWidget::CIETongueWidget(int w, int h, TQWidget *tqparent, cmsHPROFILE hMonitor) + : TQWidget(tqparent, 0, TQt::WDestructiveClose) { d = new CIETongueWidgetPriv; - d->blinkTimer = new QTimer( this ); + d->blinkTimer = new TQTimer( this ); setMinimumSize(w, h); cmsErrorAction(LCMS_ERROR_SHOW); @@ -213,8 +213,8 @@ CIETongueWidget::CIETongueWidget(int w, int h, QWidget *parent, cmsHPROFILE hMon d->hMonitorProfile, TYPE_RGB_8, INTENT_PERCEPTUAL, 0); - connect(d->blinkTimer, SIGNAL(timeout()), - this, SLOT(slotBlinkTimerDone())); + connect(d->blinkTimer, TQT_SIGNAL(timeout()), + this, TQT_SLOT(slotBlinkTimerDone())); } CIETongueWidget::~CIETongueWidget() @@ -236,11 +236,11 @@ int CIETongueWidget::grids(double val) const return (int) floor(val * d->gridside + 0.5); } -bool CIETongueWidget::setProfileData(const QByteArray &profileData) +bool CIETongueWidget::setProfileData(const TQByteArray &profileData) { if (!profileData.isEmpty()) { - cmsHPROFILE hProfile = cmsOpenProfileFromMem(profileData.data(), + cmsHPROFILE hProfile = cmsOpenProfileFromMem(const_cast<char*>(profileData.data()), (DWORD)profileData.size()); if (!hProfile) @@ -265,7 +265,7 @@ bool CIETongueWidget::setProfileData(const QByteArray &profileData) d->loadingImageMode = false; d->blinkTimer->stop(); - repaint(false); + tqrepaint(false); return (d->profileDataAvailable); } @@ -273,7 +273,7 @@ bool CIETongueWidget::setProfileFromFile(const KURL& file) { if (!file.isEmpty() && file.isValid()) { - cmsHPROFILE hProfile = cmsOpenProfileFromFile(QFile::encodeName(file.path()), "r"); + cmsHPROFILE hProfile = cmsOpenProfileFromFile(TQFile::encodeName(file.path()), "r"); if (!hProfile) { @@ -295,7 +295,7 @@ bool CIETongueWidget::setProfileFromFile(const KURL& file) } d->blinkTimer->stop(); - repaint(false); + tqrepaint(false); return (d->profileDataAvailable); } @@ -376,12 +376,12 @@ void CIETongueWidget::biasedLine(int x1, int y1, int x2, int y2) d->painter.drawLine(x1 + d->xBias, y1, x2 + d->xBias, y2); } -void CIETongueWidget::biasedText(int x, int y, QString Txt) +void CIETongueWidget::biasedText(int x, int y, TQString Txt) { - d->painter.drawText(QPoint(d->xBias + x, y), Txt); + d->painter.drawText(TQPoint(d->xBias + x, y), Txt); } -QRgb CIETongueWidget::colorByCoord(double x, double y) +TQRgb CIETongueWidget::colorByCoord(double x, double y) { // Get xyz components scaled from coordinates @@ -400,7 +400,7 @@ QRgb CIETongueWidget::colorByCoord(double x, double y) cmsFloat2XYZEncoded(XYZW, &XYZ); cmsDoTransform(d->hXFORM, XYZW, RGB, 1); - return qRgb(RGB[0], RGB[1], RGB[2]); + return tqRgb(RGB[0], RGB[1], RGB[2]); } void CIETongueWidget::outlineTongue() @@ -438,7 +438,7 @@ void CIETongueWidget::outlineTongue() void CIETongueWidget::fillTongue() { - QImage Img = d->pixmap.convertToImage(); + TQImage Img = d->pixmap.convertToImage(); int x; @@ -450,11 +450,11 @@ void CIETongueWidget::fillTongue() for (x = 0; x < d->pxcols; x++) { - if ((QColor) Img.pixel(x + d->xBias, y) != Qt::black) + if ((TQColor) Img.pixel(x + d->xBias, y) != TQt::black) { for (xe = d->pxcols - 1; xe >= x; xe--) { - if ((QColor) Img.pixel(xe + d->xBias, y) != Qt::black) + if ((TQColor) Img.pixel(xe + d->xBias, y) != TQt::black) { break; } @@ -468,29 +468,29 @@ void CIETongueWidget::fillTongue() { for ( ; x <= xe; x++) { - QRgb Color = colorByCoord(x, y); + TQRgb Color = colorByCoord(x, y); Img.setPixel(x + d->xBias, y, Color); } } } - d->pixmap.convertFromImage(Img, QPixmap::AvoidDither ); + d->pixmap.convertFromImage(Img, TQPixmap::AvoidDither ); } void CIETongueWidget::drawTongueAxis() { - QFont font; + TQFont font; font.setPointSize(6); d->painter.setFont(font); - d->painter.setPen(qRgb(255, 255, 255)); + d->painter.setPen(tqRgb(255, 255, 255)); biasedLine(0, 0, 0, d->pxrows - 1); biasedLine(0, d->pxrows-1, d->pxcols-1, d->pxrows - 1); for (int y = 1; y <= 9; y += 1) { - QString s; + TQString s; int xstart = (y * (d->pxcols - 1)) / 10; int ystart = (y * (d->pxrows - 1)) / 10; @@ -506,7 +506,7 @@ void CIETongueWidget::drawTongueAxis() void CIETongueWidget::drawTongueGrid() { - d->painter.setPen(qRgb(80, 80, 80)); + d->painter.setPen(tqRgb(80, 80, 80)); for (int y = 1; y <= 9; y += 1) { @@ -520,13 +520,13 @@ void CIETongueWidget::drawTongueGrid() void CIETongueWidget::drawLabels() { - QFont font; + TQFont font; font.setPointSize(5); d->painter.setFont(font); for (int x = 450; x <= 650; x += (x > 470 && x < 600) ? 5 : 10) { - QString wl; + TQString wl; int bx = 0, by = 0, tx, ty; if (x < 520) @@ -555,10 +555,10 @@ void CIETongueWidget::drawLabels() tx = icx + ((x < 520) ? grids(-2) : ((x >= 535) ? grids(2) : 0)); ty = icy + ((x < 520) ? 0 : ((x >= 535) ? grids(-1) : grids(-2))); - d->painter.setPen(qRgb(255, 255, 255)); + d->painter.setPen(tqRgb(255, 255, 255)); biasedLine(icx, icy, tx, ty); - QRgb Color = colorByCoord(icx, icy); + TQRgb Color = colorByCoord(icx, icy); d->painter.setPen(Color); wl.sprintf("%d", x); @@ -571,7 +571,7 @@ void CIETongueWidget::drawSmallElipse(LPcmsCIExyY xyY, BYTE r, BYTE g, BYTE b, i int icx, icy; mapPoint(icx, icy, xyY); - d->painter.setPen(qRgb(r, g, b)); + d->painter.setPen(tqRgb(r, g, b)); d->painter.drawEllipse(icx + d->xBias- sz/2, icy-sz/2, sz, sz); } @@ -607,7 +607,7 @@ void CIETongueWidget::drawPatches() if (icx2 < 5 || icy2 < 5 || icx1 < 5 || icy1 < 5) continue; - d->painter.setPen(qRgb(255, 255, 0)); + d->painter.setPen(tqRgb(255, 255, 0)); biasedLine(icx1, icy1, icx2, icy2); } } @@ -626,7 +626,7 @@ void CIETongueWidget::drawColorantTriangle() mapPoint(x2, y2, &(d->Primaries.Green)); mapPoint(x3, y3, &(d->Primaries.Blue)); - d->painter.setPen(qRgb(255, 255, 255)); + d->painter.setPen(tqRgb(255, 255, 255)); biasedLine(x1, y1, x2, y2); biasedLine(x2, y2, x3, y3); @@ -684,7 +684,7 @@ void CIETongueWidget::loadingStarted() d->pos = 0; d->loadingImageMode = true; d->loadingImageSucess = false; - repaint(false); + tqrepaint(false); d->blinkTimer->start(200); } @@ -694,21 +694,21 @@ void CIETongueWidget::loadingFailed() d->pos = 0; d->loadingImageMode = false; d->loadingImageSucess = false; - repaint(false); + tqrepaint(false); } -void CIETongueWidget::paintEvent(QPaintEvent*) +void CIETongueWidget::paintEvent(TQPaintEvent*) { - d->pixmap = QPixmap(size()); - d->pixmap.setOptimization(QPixmap::BestOptim); + d->pixmap = TQPixmap(size()); + d->pixmap.setOptimization(TQPixmap::BestOptim); // Widget is disable : drawing grayed frame. if ( !isEnabled() ) { d->painter.begin(&d->pixmap); - d->painter.fillRect(0, 0, size().width(), size().height(), palette().disabled().background()); - d->painter.setPen(QPen(palette().disabled().foreground(), 1, Qt::SolidLine)); + d->painter.fillRect(0, 0, size().width(), size().height(), tqpalette().disabled().background()); + d->painter.setPen(TQPen(tqpalette().disabled().foreground(), 1, TQt::SolidLine)); d->painter.drawRect(0, 0, width(), height()); d->painter.end(); bitBlt(this, 0, 0, &d->pixmap); @@ -722,14 +722,14 @@ void CIETongueWidget::paintEvent(QPaintEvent*) // In first, we draw an animation. int asize = 24; - QPixmap anim(asize, asize); - QPainter p2; - p2.begin(&anim, this); - p2.fillRect(0, 0, asize, asize, palette().active().background()); + TQPixmap anim(asize, asize); + TQPainter p2; + p2.tqbegin(&anim, TQT_TQOBJECT(this)); + p2.fillRect(0, 0, asize, asize, tqpalette().active().background()); p2.translate(asize/2, asize/2); d->pos = (d->pos + 10) % 360; - p2.setPen(QPen(palette().active().text())); + p2.setPen(TQPen(tqpalette().active().text())); p2.rotate(d->pos); for ( int i=0 ; i<12 ; i++ ) { @@ -741,11 +741,11 @@ void CIETongueWidget::paintEvent(QPaintEvent*) // ... and we render busy text. d->painter.begin(&d->pixmap); - d->painter.fillRect(0, 0, size().width(), size().height(), palette().active().background()); + d->painter.fillRect(0, 0, size().width(), size().height(), tqpalette().active().background()); d->painter.drawPixmap(width()/2 - asize /2, asize, anim); - d->painter.setPen(QPen(palette().active().text(), 1, Qt::SolidLine)); + d->painter.setPen(TQPen(tqpalette().active().text(), 1, TQt::SolidLine)); d->painter.drawRect(0, 0, width(), height()); - d->painter.drawText(0, 0, size().width(), size().height(), Qt::AlignCenter, + d->painter.drawText(0, 0, size().width(), size().height(), TQt::AlignCenter, i18n("Loading image...")); d->painter.end(); @@ -758,10 +758,10 @@ void CIETongueWidget::paintEvent(QPaintEvent*) if (!d->profileDataAvailable || (!d->loadingImageMode && !d->loadingImageSucess)) { d->painter.begin(&d->pixmap); - d->painter.fillRect(0, 0, size().width(), size().height(), palette().active().background()); - d->painter.setPen(QPen(palette().active().text(), 1, Qt::SolidLine)); + d->painter.fillRect(0, 0, size().width(), size().height(), tqpalette().active().background()); + d->painter.setPen(TQPen(tqpalette().active().text(), 1, TQt::SolidLine)); d->painter.drawRect(0, 0, width(), height()); - d->painter.drawText(0, 0, size().width(), size().height(), Qt::AlignCenter, + d->painter.drawText(0, 0, size().width(), size().height(), TQt::AlignCenter, i18n("No profile available...")); d->painter.end(); @@ -771,20 +771,20 @@ void CIETongueWidget::paintEvent(QPaintEvent*) // Draw the CIE tongue curve. - d->pixmap.fill(Qt::black); + d->pixmap.fill(TQt::black); d->painter.begin(&d->pixmap); int pixcols = d->pixmap.width(); int pixrows = d->pixmap.height(); - d->gridside = (QMIN(pixcols, pixrows)) / 512.0; + d->gridside = (TQMIN(pixcols, pixrows)) / 512.0; d->xBias = grids(32); d->yBias = grids(20); d->pxcols = pixcols - d->xBias; d->pxrows = pixrows - d->yBias; - d->painter.setBackgroundColor(qRgb(0, 0, 0)); - d->painter.setPen(qRgb(255, 255, 255)); + d->painter.setBackgroundColor(tqRgb(0, 0, 0)); + d->painter.setPen(tqRgb(255, 255, 255)); outlineTongue(); fillTongue(); @@ -809,7 +809,7 @@ void CIETongueWidget::paintEvent(QPaintEvent*) void CIETongueWidget::slotBlinkTimerDone() { - repaint(false); + tqrepaint(false); d->blinkTimer->start( 200 ); } |