diff options
Diffstat (limited to 'digikam/libs/widgets/common/curveswidget.cpp')
-rw-r--r-- | digikam/libs/widgets/common/curveswidget.cpp | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/digikam/libs/widgets/common/curveswidget.cpp b/digikam/libs/widgets/common/curveswidget.cpp index bd8737a..41ab220 100644 --- a/digikam/libs/widgets/common/curveswidget.cpp +++ b/digikam/libs/widgets/common/curveswidget.cpp @@ -28,18 +28,18 @@ #include <cmath> #include <cstdlib> -// Qt includes. - -#include <qpixmap.h> -#include <qpainter.h> -#include <qpoint.h> -#include <qpen.h> -#include <qevent.h> -#include <qtimer.h> -#include <qrect.h> -#include <qcolor.h> -#include <qfont.h> -#include <qfontmetrics.h> +// TQt includes. + +#include <tqpixmap.h> +#include <tqpainter.h> +#include <tqpoint.h> +#include <tqpen.h> +#include <tqevent.h> +#include <tqtimer.h> +#include <tqrect.h> +#include <tqcolor.h> +#include <tqfont.h> +#include <tqfontmetrics.h> // KDE includes. @@ -101,14 +101,14 @@ public: DColor colorGuide; - QTimer *blinkTimer; + TQTimer *blinkTimer; ImageCurves *curves; // Curves data instance. }; -CurvesWidget::CurvesWidget(int w, int h, QWidget *parent, bool readOnly) - : QWidget(parent, 0, Qt::WDestructiveClose) +CurvesWidget::CurvesWidget(int w, int h, TQWidget *tqparent, bool readOnly) + : TQWidget(tqparent, 0, TQt::WDestructiveClose) { d = new CurvesWidgetPriv; @@ -117,8 +117,8 @@ CurvesWidget::CurvesWidget(int w, int h, QWidget *parent, bool readOnly) CurvesWidget::CurvesWidget(int w, int h, uchar *i_data, uint i_w, uint i_h, bool i_sixteenBits, - QWidget *parent, bool readOnly) - : QWidget(parent, 0, Qt::WDestructiveClose) + TQWidget *tqparent, bool readOnly) + : TQWidget(tqparent, 0, TQt::WDestructiveClose) { d = new CurvesWidgetPriv; @@ -148,13 +148,13 @@ void CurvesWidget::setup(int w, int h, bool readOnly) m_imageHistogram = 0; setMouseTracking(true); - setPaletteBackgroundColor(colorGroup().background()); + setPaletteBackgroundColor(tqcolorGroup().background()); setMinimumSize(w, h); - d->blinkTimer = new QTimer( this ); + d->blinkTimer = new TQTimer( this ); - connect(d->blinkTimer, SIGNAL(timeout()), - this, SLOT(slotBlinkTimerDone())); + connect(d->blinkTimer, TQT_SIGNAL(timeout()), + this, TQT_SLOT(slotBlinkTimerDone())); } void CurvesWidget::updateData(uchar *i_data, uint i_w, uint i_h, bool i_sixteenBits) @@ -168,7 +168,7 @@ void CurvesWidget::updateData(uchar *i_data, uint i_w, uint i_h, bool i_sixteenB delete m_imageHistogram; // Calc new histogram data - m_imageHistogram = new ImageHistogram(i_data, i_w, i_h, i_sixteenBits, this); + m_imageHistogram = new ImageHistogram(i_data, i_w, i_h, i_sixteenBits, TQT_TQOBJECT(this)); if (d->curves) delete d->curves; @@ -184,7 +184,7 @@ void CurvesWidget::reset() d->grabPoint = -1; d->guideVisible = false; - repaint(false); + tqrepaint(false); } ImageCurves* CurvesWidget::curves() const @@ -208,7 +208,7 @@ void CurvesWidget::setLoadingFailed() d->clearFlag = CurvesWidgetPriv::HistogramFailed; d->pos = 0; d->blinkTimer->stop(); - repaint(false); + tqrepaint(false); setCursor(KCursor::arrowCursor()); } @@ -216,7 +216,7 @@ void CurvesWidget::setCurveGuide(const DColor& color) { d->guideVisible = true; d->colorGuide = color; - repaint(false); + tqrepaint(false); } void CurvesWidget::curveTypeChanged() @@ -233,7 +233,7 @@ void CurvesWidget::curveTypeChanged() 0, m_imageHistogram->getHistogramSegment()-1); d->curves->setCurvePoint( m_channelType, - i * 2, QPoint(index, + i * 2, TQPoint(index, d->curves->getCurveValue(m_channelType, index)) ); } @@ -245,11 +245,11 @@ void CurvesWidget::curveTypeChanged() break; } - repaint(false); + tqrepaint(false); emit signalCurvesChanged(); } -void CurvesWidget::customEvent(QCustomEvent *event) +void CurvesWidget::customEvent(TQCustomEvent *event) { if (!event) return; @@ -262,7 +262,7 @@ void CurvesWidget::customEvent(QCustomEvent *event) setCursor(KCursor::waitCursor()); d->clearFlag = CurvesWidgetPriv::HistogramStarted; d->blinkTimer->start(200); - repaint(false); + tqrepaint(false); } else { @@ -271,14 +271,14 @@ void CurvesWidget::customEvent(QCustomEvent *event) // Repaint histogram d->clearFlag = CurvesWidgetPriv::HistogramCompleted; d->blinkTimer->stop(); - repaint(false); + tqrepaint(false); setCursor(KCursor::arrowCursor()); } else { d->clearFlag = CurvesWidgetPriv::HistogramFailed; d->blinkTimer->stop(); - repaint(false); + tqrepaint(false); setCursor(KCursor::arrowCursor()); emit signalHistogramComputationFailed(); } @@ -298,11 +298,11 @@ void CurvesWidget::stopHistogramComputation() void CurvesWidget::slotBlinkTimerDone() { - repaint(false); + tqrepaint(false); d->blinkTimer->start(200); } -void CurvesWidget::paintEvent(QPaintEvent*) +void CurvesWidget::paintEvent(TQPaintEvent*) { if (d->clearFlag == CurvesWidgetPriv::HistogramDataLoading || d->clearFlag == CurvesWidgetPriv::HistogramStarted) @@ -310,14 +310,14 @@ void CurvesWidget::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(TQT_TQPAINTDEVICE(&anim), 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++ ) { @@ -328,20 +328,20 @@ void CurvesWidget::paintEvent(QPaintEvent*) // ... and we render busy text. - QPixmap pm(size()); - QPainter p1; - p1.begin(&pm, this); - p1.fillRect(0, 0, width(), height(), palette().active().background()); - p1.setPen(QPen(palette().active().foreground(), 1, Qt::SolidLine)); + TQPixmap pm(size()); + TQPainter p1; + p1.tqbegin(TQT_TQPAINTDEVICE(&pm), this); + p1.fillRect(0, 0, width(), height(), tqpalette().active().background()); + p1.setPen(TQPen(tqpalette().active().foreground(), 1, TQt::SolidLine)); p1.drawRect(0, 0, width(), height()); p1.drawPixmap(width()/2 - asize /2, asize, anim); - p1.setPen(QPen(palette().active().text())); + p1.setPen(TQPen(tqpalette().active().text())); if (d->clearFlag == CurvesWidgetPriv::HistogramDataLoading) - p1.drawText(0, 0, width(), height(), Qt::AlignCenter, + p1.drawText(0, 0, width(), height(), TQt::AlignCenter, i18n("Loading image...")); else - p1.drawText(0, 0, width(), height(), Qt::AlignCenter, + p1.drawText(0, 0, width(), height(), TQt::AlignCenter, i18n("Histogram calculation...")); p1.end(); @@ -351,14 +351,14 @@ void CurvesWidget::paintEvent(QPaintEvent*) if (d->clearFlag == CurvesWidgetPriv::HistogramFailed) { - QPixmap pm(size()); - QPainter p1; - p1.begin(&pm, this); - p1.fillRect(0, 0, width(), height(), palette().active().background()); - p1.setPen(QPen(palette().active().foreground(), 1, Qt::SolidLine)); + TQPixmap pm(size()); + TQPainter p1; + p1.tqbegin(TQT_TQPAINTDEVICE(&pm), this); + p1.fillRect(0, 0, width(), height(), tqpalette().active().background()); + p1.setPen(TQPen(tqpalette().active().foreground(), 1, TQt::SolidLine)); p1.drawRect(0, 0, width(), height()); - p1.setPen(QPen(palette().active().text())); - p1.drawText(0, 0, width(), height(), Qt::AlignCenter, + p1.setPen(TQPen(tqpalette().active().text())); + p1.drawText(0, 0, width(), height(), TQt::AlignCenter, i18n("Histogram\ncalculation\nfailed.")); p1.end(); bitBlt(this, 0, 0, &pm); @@ -414,11 +414,11 @@ void CurvesWidget::paintEvent(QPaintEvent*) } // Drawing selection or all histogram values. - // A QPixmap is used for enable the double buffering. + // A TQPixmap is used for enable the double buffering. - QPixmap pm(size()); - QPainter p1; - p1.begin(&pm, this); + TQPixmap pm(size()); + TQPainter p1; + p1.tqbegin(TQT_TQPAINTDEVICE(&pm), this); int curvePrevVal = 0; @@ -483,14 +483,14 @@ void CurvesWidget::paintEvent(QPaintEvent*) // Drawing histogram - p1.setPen(QPen(palette().active().foreground(), 1, Qt::SolidLine)); + p1.setPen(TQPen(tqpalette().active().foreground(), 1, TQt::SolidLine)); p1.drawLine(x, wHeight, x, wHeight - y); - p1.setPen(QPen(palette().active().background(), 1, Qt::SolidLine)); + p1.setPen(TQPen(tqpalette().active().background(), 1, TQt::SolidLine)); p1.drawLine(x, wHeight - y, x, 0); // Drawing curves. - p1.setPen(QPen(palette().active().link(), 2, Qt::SolidLine)); + p1.setPen(TQPen(tqpalette().active().link(), 2, TQt::SolidLine)); p1.drawLine(x - 1, wHeight - ((curvePrevVal * wHeight) / histogram->getHistogramSegment()), x, wHeight - ((curveVal * wHeight) / histogram->getHistogramSegment())); @@ -501,11 +501,11 @@ void CurvesWidget::paintEvent(QPaintEvent*) if (!d->readOnlyMode && d->curves->getCurveType(m_channelType) == ImageCurves::CURVE_SMOOTH) { - p1.setPen(QPen(Qt::red, 3, Qt::SolidLine)); + p1.setPen(TQPen(TQt::red, 3, TQt::SolidLine)); for (int p = 0 ; p < 17 ; p++) { - QPoint curvePoint = d->curves->getCurvePoint(m_channelType, p); + TQPoint curvePoint = d->curves->getCurvePoint(m_channelType, p); if (curvePoint.x() >= 0) { @@ -518,7 +518,7 @@ void CurvesWidget::paintEvent(QPaintEvent*) // Drawing black/middle/highlight tone grid separators. - p1.setPen(QPen(palette().active().base(), 1, Qt::SolidLine)); + p1.setPen(TQPen(tqpalette().active().base(), 1, TQt::SolidLine)); p1.drawLine(wWidth/4, 0, wWidth/4, wHeight); p1.drawLine(wWidth/2, 0, wWidth/2, wHeight); p1.drawLine(3*wWidth/4, 0, 3*wWidth/4, wHeight); @@ -528,16 +528,16 @@ void CurvesWidget::paintEvent(QPaintEvent*) // Drawing X,Y point position dragged by mouse over widget. - p1.setPen(QPen(Qt::red, 1, Qt::DotLine)); + p1.setPen(TQPen(TQt::red, 1, TQt::DotLine)); if (d->xMouseOver != -1 && d->yMouseOver != -1) { - QString string = i18n("x:%1\ny:%2").arg(d->xMouseOver).arg(d->yMouseOver); - QFontMetrics fontMt(string); - QRect rect = fontMt.boundingRect(0, 0, wWidth, wHeight, 0, string); + TQString string = i18n("x:%1\ny:%2").tqarg(d->xMouseOver).tqarg(d->yMouseOver); + TQFontMetrics fontMt(string); + TQRect rect = fontMt.boundingRect(0, 0, wWidth, wHeight, 0, string); rect.moveRight(wWidth); rect.moveBottom(wHeight); - p1.drawText(rect, Qt::AlignLeft||Qt::AlignTop, string); + p1.drawText(rect, TQt::AlignLeft||TQt::AlignTop, string); } // Drawing color guide. @@ -561,7 +561,7 @@ void CurvesWidget::paintEvent(QPaintEvent*) break; case CurvesWidget::ValueHistogram: - guidePos = QMAX(QMAX(d->colorGuide.red(), d->colorGuide.green()), d->colorGuide.blue()); + guidePos = TQMAX(TQMAX(d->colorGuide.red(), d->colorGuide.green()), d->colorGuide.blue()); break; default: // Alpha. @@ -574,41 +574,41 @@ void CurvesWidget::paintEvent(QPaintEvent*) int xGuide = (guidePos * wWidth) / histogram->getHistogramSegment(); p1.drawLine(xGuide, 0, xGuide, wHeight); - QString string = i18n("x:%1").arg(guidePos); - QFontMetrics fontMt( string ); - QRect rect = fontMt.boundingRect(0, 0, wWidth, wHeight, 0, string); - p1.setPen(QPen(Qt::red, 1, Qt::SolidLine)); + TQString string = i18n("x:%1").tqarg(guidePos); + TQFontMetrics fontMt( string ); + TQRect rect = fontMt.boundingRect(0, 0, wWidth, wHeight, 0, string); + p1.setPen(TQPen(TQt::red, 1, TQt::SolidLine)); rect.moveTop(1); if (xGuide < wWidth/2) { rect.moveLeft(xGuide); - p1.fillRect(rect, QBrush(QColor(250, 250, 255))); + p1.fillRect(rect, TQBrush(TQColor(250, 250, 255))); p1.drawRect(rect); rect.moveLeft(xGuide+3); - p1.drawText(rect, Qt::AlignLeft, string); + p1.drawText(rect, TQt::AlignLeft, string); } else { rect.moveRight(xGuide); - p1.fillRect(rect, QBrush(QColor(250, 250, 255))); + p1.fillRect(rect, TQBrush(TQColor(250, 250, 255))); p1.drawRect(rect); rect.moveRight(xGuide-3); - p1.drawText(rect, Qt::AlignRight, string); + p1.drawText(rect, TQt::AlignRight, string); } } } // Drawing frame. - p1.setPen(QPen(palette().active().foreground(), 1, Qt::SolidLine)); + p1.setPen(TQPen(tqpalette().active().foreground(), 1, TQt::SolidLine)); p1.drawRect(0, 0, width(), height()); p1.end(); bitBlt(this, 0, 0, &pm); } -void CurvesWidget::mousePressEvent(QMouseEvent *e) +void CurvesWidget::mousePressEvent(TQMouseEvent *e) { if (d->readOnlyMode || !m_imageHistogram) return; @@ -678,7 +678,7 @@ void CurvesWidget::mousePressEvent(QMouseEvent *e) d->grabPoint = closest_point; d->curves->setCurvePoint(m_channelType, d->grabPoint, - QPoint(x, m_imageHistogram->getHistogramSegment() - y)); + TQPoint(x, m_imageHistogram->getHistogramSegment() - y)); break; } @@ -694,10 +694,10 @@ void CurvesWidget::mousePressEvent(QMouseEvent *e) } d->curves->curvesCalculateCurve(m_channelType); - repaint(false); + tqrepaint(false); } -void CurvesWidget::mouseReleaseEvent(QMouseEvent *e) +void CurvesWidget::mouseReleaseEvent(TQMouseEvent *e) { if (d->readOnlyMode || !m_imageHistogram) return; @@ -707,11 +707,11 @@ void CurvesWidget::mouseReleaseEvent(QMouseEvent *e) setCursor(KCursor::arrowCursor()); d->grabPoint = -1; d->curves->curvesCalculateCurve(m_channelType); - repaint(false); + tqrepaint(false); emit signalCurvesChanged(); } -void CurvesWidget::mouseMoveEvent(QMouseEvent *e) +void CurvesWidget::mouseMoveEvent(TQMouseEvent *e) { if (d->readOnlyMode || !m_imageHistogram) return; @@ -771,7 +771,7 @@ void CurvesWidget::mouseMoveEvent(QMouseEvent *e) d->grabPoint = closest_point; d->curves->setCurvePoint(m_channelType, d->grabPoint, - QPoint(x, m_imageHistogram->getHistogramSegment()-1 - y)); + TQPoint(x, m_imageHistogram->getHistogramSegment()-1 - y)); } d->curves->curvesCalculateCurve(m_channelType); @@ -824,15 +824,15 @@ void CurvesWidget::mouseMoveEvent(QMouseEvent *e) d->xMouseOver = x; d->yMouseOver = m_imageHistogram->getHistogramSegment()-1 - y; emit signalMouseMoved(d->xMouseOver, d->yMouseOver); - repaint(false); + tqrepaint(false); } -void CurvesWidget::leaveEvent(QEvent*) +void CurvesWidget::leaveEvent(TQEvent*) { d->xMouseOver = -1; d->yMouseOver = -1; emit signalMouseMoved(d->xMouseOver, d->yMouseOver); - repaint(false); + tqrepaint(false); } } // NameSpace Digikam |