summaryrefslogtreecommitdiffstats
path: root/src/gvcore/imageview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gvcore/imageview.cpp')
-rw-r--r--src/gvcore/imageview.cpp370
1 files changed, 185 insertions, 185 deletions
diff --git a/src/gvcore/imageview.cpp b/src/gvcore/imageview.cpp
index cd8a828..174d4f9 100644
--- a/src/gvcore/imageview.cpp
+++ b/src/gvcore/imageview.cpp
@@ -26,17 +26,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <assert.h>
#include <math.h>
-// Qt
-#include <qcolor.h>
-#include <qcombobox.h>
-#include <qcursor.h>
-#include <qdatetime.h>
-#include <qevent.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qlabel.h>
-#include <qtimer.h>
-#include <qvaluevector.h>
+// TQt
+#include <tqcolor.h>
+#include <tqcombobox.h>
+#include <tqcursor.h>
+#include <tqdatetime.h>
+#include <tqevent.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqlabel.h>
+#include <tqtimer.h>
+#include <tqvaluevector.h>
// KDE
#include <kaction.h>
@@ -65,7 +65,7 @@ namespace Gwenview {
Coordinates:
The image can be zoomed, can have a position offset, and additionally there is
-QScrollView's viewport. This means there are several coordinate systems.
+TQScrollView's viewport. This means there are several coordinate systems.
@@ -113,7 +113,7 @@ as approximate as possible). However when converting from widget to image and ba
this can result in the final rectangle being smaller than the original.
The widgetToImageBounding() function converts from widget to image coordinates
in a way which makes sure the reverse conversion will be at least as large
-as the original geometry.
+as the original tqgeometry.
There are no conversion functions for only width/height, as their conversion
depends on the position (because of the rounding etc.). For similar reasons
@@ -122,7 +122,7 @@ but with the point next to it.
-For conversions from/to QScrollView's viewport, usually QScrollView methods should
+For conversions from/to TQScrollView's viewport, usually TQScrollView methods should
be used: contentsX(), contentsY(), contentsWidth(), contentsHeight(), visibleWidth(),
visibleHeight(), contentsToViewport() and viewportToContents().
@@ -159,13 +159,13 @@ struct ImageView::Private {
int mGamma, mBrightness, mContrast;
// Our actions
- QComboBox* mZoomCombo;
+ TQComboBox* mZoomCombo;
// We do not use KSelectAction because it's not possible to set the combo text
KWidgetAction* mZoomComboAction;
KToggleAction* mZoomToFit;
KToggleAction* mZoomToWidth;
KToggleAction* mZoomToHeight;
- QValueVector<KToggleAction*> mZoomComboActions;
+ TQValueVector<KToggleAction*> mZoomComboActions;
KAction* mZoomIn;
KAction* mZoomOut;
KAction* mResetZoom;
@@ -188,13 +188,13 @@ struct ImageView::Private {
double mZoomBeforeAuto;
int mXCenterBeforeAuto, mYCenterBeforeAuto;
- QMap< long long, PendingPaint > mPendingPaints;
- QRegion mPendingNormalRegion;
- QRegion mPendingSmoothRegion;
+ TQMap< long long, PendingPaint > mPendingPaints;
+ TQRegion mPendingNormalRegion;
+ TQRegion mPendingSmoothRegion;
int mPendingOperations;
- QTimer mPendingPaintTimer;
+ TQTimer mPendingPaintTimer;
bool mSmoothingSuspended;
- QRegion mValidImageArea;
+ TQRegion mValidImageArea;
int imageToWidgetX( int x ) const {
if( mZoom == 1.0 ) return x + mXOffset;
@@ -206,14 +206,14 @@ struct ImageView::Private {
return lround( y * mZoom ) + mYOffset;
}
- QPoint imageToWidget( const QPoint& p ) const {
- return QPoint( imageToWidgetX( p.x()), imageToWidgetY( p.y()));
+ TQPoint imageToWidget( const TQPoint& p ) const {
+ return TQPoint( imageToWidgetX( p.x()), imageToWidgetY( p.y()));
}
- QRect imageToWidget( const QRect& r ) const {
- return QRect( imageToWidget( r.topLeft()),
+ TQRect imageToWidget( const TQRect& r ) const {
+ return TQRect( imageToWidget( r.topLeft()),
// don't use bottomright corner for conversion, but the one next to it
- imageToWidget( r.bottomRight() + QPoint( 1, 1 )) - QPoint( 1, 1 ));
+ imageToWidget( r.bottomRight() + TQPoint( 1, 1 )) - TQPoint( 1, 1 ));
}
int widgetToImageX( int x ) const {
@@ -226,19 +226,19 @@ struct ImageView::Private {
return lround( ( y - mYOffset ) / mZoom );
}
- QPoint widgetToImage( const QPoint& p ) const {
- return QPoint( widgetToImageX( p.x()), widgetToImageY( p.y()));
+ TQPoint widgetToImage( const TQPoint& p ) const {
+ return TQPoint( widgetToImageX( p.x()), widgetToImageY( p.y()));
}
- QRect widgetToImage( const QRect& r ) const {
- return QRect( widgetToImage( r.topLeft()),
+ TQRect widgetToImage( const TQRect& r ) const {
+ return TQRect( widgetToImage( r.topLeft()),
// don't use bottomright corner for conversion, but the one next to it
- widgetToImage( r.bottomRight() + QPoint( 1, 1 )) - QPoint( 1, 1 ));
+ widgetToImage( r.bottomRight() + TQPoint( 1, 1 )) - TQPoint( 1, 1 ));
}
- QRect widgetToImageBounding( const QRect& r, int extra ) const {
- QRect ret = widgetToImage( r );
- // make sure converting to image and back always returns QRect at least as large as 'r'
+ TQRect widgetToImageBounding( const TQRect& r, int extra ) const {
+ TQRect ret = widgetToImage( r );
+ // make sure converting to image and back always returns TQRect at least as large as 'r'
extra += mZoom == 1.0 ? 0 : int( ceil( 1 / mZoom ));
ret.addCoords( -extra, -extra, extra, extra );
return ret;
@@ -246,18 +246,18 @@ struct ImageView::Private {
void initZoomCombo() {
mZoomCombo->clear();
- for (QValueVector<KToggleAction*>::iterator it=mZoomComboActions.begin();
+ for (TQValueVector<KToggleAction*>::iterator it=mZoomComboActions.begin();
it!=mZoomComboActions.end();
++it)
{
- QString txt=(*it)->plainText();
+ TQString txt=(*it)->plainText();
mZoomCombo->insertItem(txt);
}
const double zoomValues[] = { 0.5, 1, 2 };
int nbValues=sizeof(zoomValues) / sizeof(double);
for (int pos=0; pos<nbValues; ++pos) {
- QString txt=QString("%1%").arg( int(zoomValues[pos]*100) );
+ TQString txt=TQString("%1%").tqarg( int(zoomValues[pos]*100) );
mZoomCombo->insertItem(txt);
}
}
@@ -270,18 +270,18 @@ inline bool doDelayedSmoothing() {
}
-class ImageView::EventFilter : public QObject {
+class ImageView::EventFilter : public TQObject {
public:
- EventFilter(ImageView* parent)
- : QObject(parent) {}
+ EventFilter(ImageView* tqparent)
+ : TQObject(tqparent) {}
- bool eventFilter(QObject*, QEvent* event) {
+ bool eventFilter(TQObject*, TQEvent* event) {
switch (event->type()) {
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- case QEvent::AccelOverride:
- return static_cast< ImageView* >( parent())
- ->viewportKeyEvent(static_cast<QKeyEvent*>(event));
+ case TQEvent::KeyPress:
+ case TQEvent::KeyRelease:
+ case TQEvent::AccelOverride:
+ return static_cast< ImageView* >( TQT_TQWIDGET(tqparent()))
+ ->viewportKeyEvent(TQT_TQKEYEVENT(event));
default:
break;
}
@@ -291,8 +291,8 @@ public:
-ImageView::ImageView(QWidget* parent,Document* document, KActionCollection* actionCollection)
-: QScrollView(parent,0L,WResizeNoErase|WRepaintNoErase|WPaintClever)
+ImageView::ImageView(TQWidget* tqparent,Document* document, KActionCollection* actionCollection)
+: TQScrollView(tqparent,0L,WResizeNoErase|WRepaintNoErase|WPaintClever)
{
d=new Private;
d->mDocument=document;
@@ -312,7 +312,7 @@ ImageView::ImageView(QWidget* parent,Document* document, KActionCollection* acti
d->mContrast = 100;
d->mBCGDialog = 0;
- viewport()->setFocusPolicy(WheelFocus);
+ viewport()->setFocusPolicy(TQ_WheelFocus);
setFrameStyle(NoFrame);
setAcceptDrops( true );
viewport()->setAcceptDrops( true );
@@ -326,32 +326,32 @@ ImageView::ImageView(QWidget* parent,Document* document, KActionCollection* acti
// Create actions
d->mZoomToFit=new KToggleAction(i18n("Fit to &Window"),"viewmagfit",0,d->mActionCollection,"view_zoom_to_fit");
- connect(d->mZoomToFit,SIGNAL(toggled(bool)),
- this,SLOT(setZoomToFit(bool)) );
+ connect(d->mZoomToFit,TQT_SIGNAL(toggled(bool)),
+ TQT_TQOBJECT(this), TQT_SLOT(setZoomToFit(bool)) );
d->mZoomToWidth=new KToggleAction(i18n("Fit to &Width"),0,0,d->mActionCollection,"view_zoom_to_width");
- connect(d->mZoomToWidth,SIGNAL(toggled(bool)),
- this,SLOT(setZoomToWidth(bool)) );
+ connect(d->mZoomToWidth,TQT_SIGNAL(toggled(bool)),
+ TQT_TQOBJECT(this), TQT_SLOT(setZoomToWidth(bool)) );
d->mZoomToHeight=new KToggleAction(i18n("Fit to &Height"),0,0,d->mActionCollection,"view_zoom_to_height");
- connect(d->mZoomToHeight,SIGNAL(toggled(bool)),
- this,SLOT(setZoomToHeight(bool)) );
+ connect(d->mZoomToHeight,TQT_SIGNAL(toggled(bool)),
+ TQT_TQOBJECT(this), TQT_SLOT(setZoomToHeight(bool)) );
- d->mZoomIn=KStdAction::zoomIn(this,SLOT(slotZoomIn()),d->mActionCollection);
+ d->mZoomIn=KStdAction::zoomIn(TQT_TQOBJECT(this),TQT_SLOT(slotZoomIn()),d->mActionCollection);
- d->mZoomOut=KStdAction::zoomOut(this,SLOT(slotZoomOut()),d->mActionCollection);
+ d->mZoomOut=KStdAction::zoomOut(TQT_TQOBJECT(this),TQT_SLOT(slotZoomOut()),d->mActionCollection);
- d->mResetZoom=KStdAction::actualSize(this,SLOT(slotResetZoom()),d->mActionCollection);
+ d->mResetZoom=KStdAction::actualSize(TQT_TQOBJECT(this),TQT_SLOT(slotResetZoom()),d->mActionCollection);
d->mResetZoom->setIcon("viewmag1");
d->mLockZoom=new KToggleAction(i18n("&Lock Zoom"),"lock",0,d->mActionCollection,"view_zoom_lock");
d->mLockZoom->setChecked(ImageViewConfig::lockZoom());
- connect(d->mLockZoom,SIGNAL(toggled(bool)),
- this,SLOT(setLockZoom(bool)) );
+ connect(d->mLockZoom,TQT_SIGNAL(toggled(bool)),
+ TQT_TQOBJECT(this), TQT_SLOT(setLockZoom(bool)) );
- d->mZoomCombo=new QComboBox(true);
+ d->mZoomCombo=new TQComboBox(true);
// Avoid stealing focus
- d->mZoomCombo->setFocusPolicy(ClickFocus);
- connect(d->mZoomCombo, SIGNAL(activated(int)),
- this, SLOT(slotSelectZoom()) );
+ d->mZoomCombo->setFocusPolicy(TQ_ClickFocus);
+ connect(d->mZoomCombo, TQT_SIGNAL(activated(int)),
+ TQT_TQOBJECT(this), TQT_SLOT(slotSelectZoom()) );
d->mZoomComboAction=new KWidgetAction(d->mZoomCombo, i18n("Zoom"), 0, 0, 0, d->mActionCollection, "view_zoom_to");
@@ -364,45 +364,45 @@ ImageView::ImageView(QWidget* parent,Document* document, KActionCollection* acti
d->initZoomCombo();
d->mAdjustBCG=new KAction(i18n("Adjust Brightness/Contrast/Gamma"), "colorize", 0,
- this, SLOT(showBCGDialog()), d->mActionCollection, "adjust_bcg");
+ TQT_TQOBJECT(this), TQT_SLOT(showBCGDialog()), d->mActionCollection, "adjust_bcg");
d->mIncreaseGamma=new KAction(i18n("Increase Gamma"),0,CTRL+Key_G,
- this,SLOT(increaseGamma()),d->mActionCollection,"increase_gamma");
+ TQT_TQOBJECT(this), TQT_SLOT(increaseGamma()),d->mActionCollection,"increase_gamma");
d->mDecreaseGamma=new KAction(i18n("Decrease Gamma"),0,SHIFT+CTRL+Key_G,
- this,SLOT(decreaseGamma()),d->mActionCollection,"decrease_gamma");
+ TQT_TQOBJECT(this), TQT_SLOT(decreaseGamma()),d->mActionCollection,"decrease_gamma");
d->mIncreaseBrightness=new KAction(i18n("Increase Brightness" ),0,CTRL+Key_B,
- this,SLOT(increaseBrightness()),d->mActionCollection,"increase_brightness");
+ TQT_TQOBJECT(this), TQT_SLOT(increaseBrightness()),d->mActionCollection,"increase_brightness");
d->mDecreaseBrightness=new KAction(i18n("Decrease Brightness" ),0,SHIFT+CTRL+Key_B,
- this,SLOT(decreaseBrightness()),d->mActionCollection,"decrease_brightness");
+ TQT_TQOBJECT(this), TQT_SLOT(decreaseBrightness()),d->mActionCollection,"decrease_brightness");
d->mIncreaseContrast=new KAction(i18n("Increase Contrast" ),0,CTRL+Key_C,
- this,SLOT(increaseContrast()),d->mActionCollection,"increase_contrast");
+ TQT_TQOBJECT(this), TQT_SLOT(increaseContrast()),d->mActionCollection,"increase_contrast");
d->mDecreaseContrast=new KAction(i18n("Decrease Contrast" ),0,SHIFT+CTRL+Key_C,
- this,SLOT(decreaseContrast()),d->mActionCollection,"decrease_contrast");
+ TQT_TQOBJECT(this), TQT_SLOT(decreaseContrast()),d->mActionCollection,"decrease_contrast");
// Connect to some interesting signals
- connect(d->mDocument,SIGNAL(loaded(const KURL&)),
- this,SLOT(slotLoaded()) );
+ connect(d->mDocument,TQT_SIGNAL(loaded(const KURL&)),
+ TQT_TQOBJECT(this), TQT_SLOT(slotLoaded()) );
- connect(d->mDocument,SIGNAL(loading()),
- this,SLOT( loadingStarted()) );
+ connect(d->mDocument,TQT_SIGNAL(loading()),
+ TQT_TQOBJECT(this), TQT_SLOT( loadingStarted()) );
- connect(d->mDocument,SIGNAL(modified()),
- this,SLOT(slotModified()) );
+ connect(d->mDocument,TQT_SIGNAL(modified()),
+ TQT_TQOBJECT(this), TQT_SLOT(slotModified()) );
- connect(d->mDocument, SIGNAL(sizeUpdated()),
- this, SLOT(slotImageSizeUpdated()) );
+ connect(d->mDocument, TQT_SIGNAL(sizeUpdated()),
+ TQT_TQOBJECT(this), TQT_SLOT(slotImageSizeUpdated()) );
- connect(d->mDocument, SIGNAL(rectUpdated(const QRect&)),
- this, SLOT(slotImageRectUpdated(const QRect&)) );
+ connect(d->mDocument, TQT_SIGNAL(rectUpdated(const TQRect&)),
+ TQT_TQOBJECT(this), TQT_SLOT(slotImageRectUpdated(const TQRect&)) );
- connect(&d->mPendingPaintTimer,SIGNAL(timeout()),
- this,SLOT(checkPendingOperations()) );
+ connect(&d->mPendingPaintTimer,TQT_SIGNAL(timeout()),
+ TQT_TQOBJECT(this), TQT_SLOT(checkPendingOperations()) );
- connect(BusyLevelManager::instance(),SIGNAL(busyLevelChanged(BusyLevel)),
- this,SLOT(slotBusyLevelChanged(BusyLevel) ));
+ connect(BusyLevelManager::instance(),TQT_SIGNAL(busyLevelChanged(BusyLevel)),
+ TQT_TQOBJECT(this), TQT_SLOT(slotBusyLevelChanged(BusyLevel) ));
// This event filter is here to make sure the pixmap view is aware of the changes
// in the keyboard modifiers, even if it isn't focused. However, making this widget
- // itself the filter would lead to doubled paint events, because QScrollView
+ // itself the filter would lead to doubled paint events, because TQScrollView
// installs an event filter on its viewport, and doesn't filter out the paint
// events -> it'd get it twice, first from app filter, second from viewport filter.
EventFilter* filter=new EventFilter(this);
@@ -423,7 +423,7 @@ ImageView::~ImageView() {
void ImageView::slotLoaded() {
if (d->mDocument->isNull()) {
resizeContents(0,0);
- viewport()->repaint(false);
+ viewport()->tqrepaint(false);
return;
}
@@ -446,7 +446,7 @@ void ImageView::slotModified() {
void ImageView::loadingStarted() {
cancelPending();
d->mSmoothingSuspended = true;
- d->mValidImageArea = QRegion();
+ d->mValidImageArea = TQRegion();
d->mGamma = 100;
d->mBrightness = 0;
d->mContrast = 100;
@@ -471,8 +471,8 @@ bool ImageView::fullScreen() const {
}
-QPoint ImageView::offset() const {
- return QPoint(d->mXOffset, d->mYOffset);
+TQPoint ImageView::offset() const {
+ return TQPoint(d->mXOffset, d->mYOffset);
}
@@ -488,7 +488,7 @@ KToggleAction* ImageView::zoomToFit() const {
void ImageView::updateFromSettings() {
- // Reset, so that next repaint doesn't possibly take longer because of
+ // Reset, so that next tqrepaint doesn't possibly take longer because of
// smoothing
ImageViewConfig::setMaxRepaintSize(DEFAULT_MAX_REPAINT_SIZE);
ImageViewConfig::setMaxScaleRepaintSize(DEFAULT_MAX_REPAINT_SIZE);
@@ -594,8 +594,8 @@ void ImageView::setFullScreen(bool fullScreen) {
// Overloaded methods
//
//------------------------------------------------------------------------
-void ImageView::resizeEvent(QResizeEvent* event) {
- QScrollView::resizeEvent(event);
+void ImageView::resizeEvent(TQResizeEvent* event) {
+ TQScrollView::resizeEvent(event);
if (d->mZoomMode!=ZOOM_FREE) {
updateZoom(d->mZoomMode);
} else {
@@ -617,22 +617,22 @@ inline void composite(uint* rgba,uint value) {
}
}
-void ImageView::drawContents(QPainter* painter,int clipx,int clipy,int clipw,int cliph) {
+void ImageView::drawContents(TQPainter* painter,int clipx,int clipy,int clipw,int cliph) {
// Erase borders
- QRect imageRect(0, 0, d->mDocument->width(), d->mDocument->height());
+ TQRect imageRect(0, 0, d->mDocument->width(), d->mDocument->height());
imageRect = d->imageToWidget(imageRect);
- QRect widgetRect = QRect(0, 0, visibleWidth(), visibleHeight());
+ TQRect widgetRect = TQRect(0, 0, visibleWidth(), visibleHeight());
- QRegion region = QRegion(widgetRect) - imageRect;
- QMemArray<QRect> rects = region.rects();
+ TQRegion region = TQRegion(widgetRect) - imageRect;
+ TQMemArray<TQRect> rects = region.tqrects();
for(unsigned int pos = 0; pos < rects.count(); ++pos ) {
painter->eraseRect(rects[pos]);
}
// Repaint
if( !d->mValidImageArea.isEmpty()) {
- addPendingPaint( false, QRect( clipx, clipy, clipw, cliph ));
+ addPendingPaint( false, TQRect( clipx, clipy, clipw, cliph ));
}
}
@@ -640,34 +640,34 @@ void ImageView::drawContents(QPainter* painter,int clipx,int clipy,int clipw,int
// There's a queue of areas to paint (each with bool saying whether it's smooth pass).
// Also, there's a bitfield of pending operations, operations are handled only after
// there's nothing more to paint (so that smooth pass is started).
-void ImageView::addPendingPaint( bool smooth, QRect rect ) {
+void ImageView::addPendingPaint( bool smooth, TQRect rect ) {
if( d->mSmoothingSuspended && smooth ) return;
// try to avoid scheduling already scheduled areas
- QRegion& region = smooth ? d->mPendingSmoothRegion : d->mPendingNormalRegion;
- if( region.intersect( rect ) == QRegion( rect ))
+ TQRegion& region = smooth ? d->mPendingSmoothRegion : d->mPendingNormalRegion;
+ if( region.intersect( rect ) == TQRegion( rect ))
return; // whole rect has already pending paints
// at least try to remove the part that's already scheduled
- rect = ( QRegion( rect ) - region ).boundingRect();
+ rect = ( TQRegion( rect ) - region ).boundingRect();
region += rect;
if( rect.isEmpty())
return;
addPendingPaintInternal( smooth, rect );
}
-void ImageView::addPendingPaintInternal( bool smooth, QRect rect ) {
+void ImageView::addPendingPaintInternal( bool smooth, TQRect rect ) {
const long long MAX_DIM = 1000000; // if monitors get larger than this, we're in trouble :)
- // QMap will ensure ordering (non-smooth first, top-to-bottom, left-to-right)
+ // TQMap will ensure ordering (non-smooth first, top-to-bottom, left-to-right)
long long key = ( smooth ? MAX_DIM * MAX_DIM : 0 ) + rect.y() * MAX_DIM + rect.x();
// handle the case of two different paints at the same position (just in case)
key *= 100;
bool insert = true;
- while( d->mPendingPaints.contains( key )) {
- if( d->mPendingPaints[ key ].rect.contains( rect )) {
+ while( d->mPendingPaints.tqcontains( key )) {
+ if( d->mPendingPaints[ key ].rect.tqcontains( rect )) {
insert = false;
break;
}
- if( rect.contains( d->mPendingPaints[ key ].rect )) {
+ if( rect.tqcontains( d->mPendingPaints[ key ].rect )) {
break;
}
++key;
@@ -700,10 +700,10 @@ void ImageView::limitPaintSize( PendingPaint& paint ) {
}
// don't paint more than max_size pixels at a time
int maxHeight = ( maxSize + paint.rect.width() - 1 ) / paint.rect.width(); // round up
- maxHeight = QMAX( maxHeight, 5 ); // at least 5 lines together
- // can't repaint whole paint at once, adjust height and schedule the rest
+ maxHeight = TQMAX( maxHeight, 5 ); // at least 5 lines together
+ // can't tqrepaint whole paint at once, adjust height and schedule the rest
if( maxHeight < paint.rect.height()) {
- QRect remaining = paint.rect;
+ TQRect remaining = paint.rect;
remaining.setTop( remaining.top() + maxHeight );
addPendingPaintInternal( paint.smooth, remaining );
paint.rect.setHeight( maxHeight );
@@ -718,12 +718,12 @@ void ImageView::checkPendingOperationsInternal() {
PendingPaint paint = *d->mPendingPaints.begin();
d->mPendingPaints.remove( d->mPendingPaints.begin());
limitPaintSize( paint ); // modifies paint.rect if necessary
- QRegion& region = paint.smooth ? d->mPendingSmoothRegion : d->mPendingNormalRegion;
+ TQRegion& region = paint.smooth ? d->mPendingSmoothRegion : d->mPendingNormalRegion;
region -= paint.rect;
- QRect visibleRect( contentsX(), contentsY(), visibleWidth(), visibleHeight());
- QRect paintRect = paint.rect.intersect( visibleRect );
+ TQRect visibleRect( contentsX(), contentsY(), visibleWidth(), visibleHeight());
+ TQRect paintRect = paint.rect.intersect( visibleRect );
if( !paintRect.isEmpty()) {
- QPainter painter( viewport());
+ TQPainter painter( viewport());
painter.translate( -contentsX(), -contentsY());
performPaint( &painter, paintRect.x(), paintRect.y(),
paintRect.width(), paintRect.height(), paint.smooth );
@@ -733,7 +733,7 @@ void ImageView::checkPendingOperationsInternal() {
if( d->mPendingOperations & SMOOTH_PASS ) {
d->mSmoothingSuspended = false;
if( doDelayedSmoothing() ) {
- QRect visibleRect( contentsX(), contentsY(), visibleWidth(), visibleHeight());
+ TQRect visibleRect( contentsX(), contentsY(), visibleWidth(), visibleHeight());
addPendingPaint( true, visibleRect );
}
d->mPendingOperations &= ~SMOOTH_PASS;
@@ -750,12 +750,12 @@ void ImageView::scheduleOperation( Operation operation )
void ImageView::updateBusyLevels() {
if( !d->mPendingPaintTimer.isActive()) {
- BusyLevelManager::instance()->setBusyLevel( this, BUSY_NONE );
+ BusyLevelManager::instance()->setBusyLevel( TQT_TQOBJECT(this), BUSY_NONE );
} else if( !d->mPendingPaints.isEmpty() && !(*d->mPendingPaints.begin()).smooth ) {
- BusyLevelManager::instance()->setBusyLevel( this, BUSY_PAINTING );
+ BusyLevelManager::instance()->setBusyLevel( TQT_TQOBJECT(this), BUSY_PAINTING );
} else if(( d->mPendingOperations & SMOOTH_PASS )
|| ( !d->mPendingPaints.isEmpty() && (*d->mPendingPaints.begin()).smooth )) {
- BusyLevelManager::instance()->setBusyLevel( this, BUSY_SMOOTHING );
+ BusyLevelManager::instance()->setBusyLevel( TQT_TQOBJECT(this), BUSY_SMOOTHING );
} else {
assert( false );
}
@@ -779,20 +779,20 @@ void ImageView::slotBusyLevelChanged( BusyLevel level ) {
}
// How to do painting:
-// When something needs to be erased: QPainter on viewport and eraseRect()
-// When whole picture needs to be repainted: fullRepaint()
-// When a part of the picture needs to be updated: viewport()->repaint(area,false)
+// When something needs to be erased: TQPainter on viewport and eraseRect()
+// When whole picture needs to be tqrepainted: fullRepaint()
+// When a part of the picture needs to be updated: viewport()->tqrepaint(area,false)
// All other paints will be changed to progressive painting.
void ImageView::fullRepaint() {
if( !viewport()->isUpdatesEnabled()) return;
cancelPending();
- viewport()->repaint(false);
+ viewport()->tqrepaint(false);
}
void ImageView::cancelPending() {
d->mPendingPaints.clear();
- d->mPendingNormalRegion = QRegion();
- d->mPendingSmoothRegion = QRegion();
+ d->mPendingNormalRegion = TQRegion();
+ d->mPendingSmoothRegion = TQRegion();
d->mPendingPaintTimer.stop();
d->mPendingOperations = 0;
updateBusyLevels();
@@ -801,13 +801,13 @@ void ImageView::cancelPending() {
//#define DEBUG_RECTS
// do the actual painting
-void ImageView::performPaint( QPainter* painter, int clipx, int clipy, int clipw, int cliph, bool secondPass ) {
+void ImageView::performPaint( TQPainter* painter, int clipx, int clipy, int clipw, int cliph, bool secondPass ) {
#ifdef DEBUG_RECTS
- static QColor colors[4]={QColor(255,0,0),QColor(0,255,0),QColor(0,0,255),QColor(255,255,0) };
+ static TQColor colors[4]={TQColor(255,0,0),TQColor(0,255,0),TQColor(0,0,255),TQColor(255,255,0) };
static int numColor=0;
#endif
- QTime t;
+ TQTime t;
t.start();
if (d->mDocument->isNull()) {
@@ -822,7 +822,7 @@ void ImageView::performPaint( QPainter* painter, int clipx, int clipy, int clipw
if( zoom() != 1.0 ) {
if (doDelayedSmoothing() && !secondPass) {
// Add a second, smoothing pass
- addPendingPaint( true, QRect( clipx, clipy, clipw, cliph ));
+ addPendingPaint( true, TQRect( clipx, clipy, clipw, cliph ));
} else {
// We need to smooth now
smoothAlgo = static_cast<ImageUtils::SmoothAlgorithm>( ImageViewConfig::smoothAlgorithm() );
@@ -830,31 +830,31 @@ void ImageView::performPaint( QPainter* painter, int clipx, int clipy, int clipw
}
int extraPixels = ImageUtils::extraScalePixels( smoothAlgo, zoom());
- QRect imageRect = d->widgetToImageBounding( QRect(clipx,clipy,clipw,cliph), extraPixels );
- imageRect = imageRect.intersect( QRect( 0, 0, d->mDocument->width(), d->mDocument->height()));
- QMemArray< QRect > rects = d->mValidImageArea.intersect( imageRect ).rects();
+ TQRect imageRect = d->widgetToImageBounding( TQRect(clipx,clipy,clipw,cliph), extraPixels );
+ imageRect = imageRect.intersect( TQRect( 0, 0, d->mDocument->width(), d->mDocument->height()));
+ TQMemArray< TQRect > rects = TQRegion(d->mValidImageArea.intersect( imageRect )).tqrects();
for( unsigned int i = 1; i < rects.count(); ++i ) {
addPendingPaint( secondPass, d->imageToWidget( rects[ i ] ));
}
- imageRect = rects.count() > 0 ? rects[ 0 ] : QRect();
+ imageRect = rects.count() > 0 ? rects[ 0 ] : TQRect();
if (imageRect.isEmpty()) {
painter->eraseRect(clipx,clipy,clipw,cliph);
return;
}
- QRect widgetRect = d->imageToWidget( imageRect );
+ TQRect widgetRect = d->imageToWidget( imageRect );
if (widgetRect.isEmpty() || imageRect.isEmpty()) {
painter->eraseRect(clipx,clipy,clipw,cliph);
return;
}
-// With very large images, just getting a subimage using QImage::copy( QRect ) takes a significant
+// With very large images, just getting a subimage using TQImage::copy( TQRect ) takes a significant
// portion of time here (even though it's just copying of data - probably because it's a lot of data).
-// So don't do any subimage copying but instead use CroppedQImage which just manipulates scanline
+// So don't do any subimage copying but instead use CroppedTQImage which just manipulates scanline
// pointers. Note however that it's a bit hackish and there may be trouble if any code accesses
-// the image data directly as a whole. See CroppedQImage for details.
+// the image data directly as a whole. See CroppedTQImage for details.
-// QImage image = d->mDocument->image().copy( imageRect );
- ImageUtils::CroppedQImage image( d->mDocument->image(), imageRect );
+// TQImage image = d->mDocument->image().copy( imageRect );
+ ImageUtils::CroppedTQImage image( d->mDocument->image(), imageRect );
if( zoom() != 1.0 ) {
image=ImageUtils::scale(image,widgetRect.width(),widgetRect.height(), smoothAlgo );
@@ -875,9 +875,9 @@ void ImageView::performPaint( QPainter* painter, int clipx, int clipy, int clipw
image = ImageUtils::changeGamma( image, d->mGamma );
}
-// Calling normalize() here would make image to be a proper QImage without modified scanlines,
-// so that even calling QImage::copy() would work. However, it seems it's not necessary to call
-// it here. The code above checks that QImage::copy() or similar doesn't occur (that zoom() != 1.0
+// Calling normalize() here would make image to be a proper TQImage without modified scanlines,
+// so that even calling TQImage::copy() would work. However, it seems it's not necessary to call
+// it here. The code above checks that TQImage::copy() or similar doesn't occur (that zoom() != 1.0
// is there primarily to avoid that). If any kind of redraw trouble occurs, try uncommenting this
// line below first.
// image.normalize(); // make it use its own data, if needed
@@ -905,10 +905,10 @@ void ImageView::performPaint( QPainter* painter, int clipx, int clipy, int clipw
image.setAlphaBuffer(false);
}
- QRect paintRect( clipx, clipy, clipw, cliph );
- QPixmap buffer( paintRect.size());
+ TQRect paintRect( clipx, clipy, clipw, cliph );
+ TQPixmap buffer( paintRect.size());
{
- QPainter bufferPainter(&buffer);
+ TQPainter bufferPainter(&buffer);
bufferPainter.setBackgroundColor(painter->backgroundColor());
bufferPainter.eraseRect(0,0,paintRect.width(),paintRect.height());
bufferPainter.drawImage(widgetRect.topLeft()-paintRect.topLeft(),image,
@@ -916,9 +916,9 @@ void ImageView::performPaint( QPainter* painter, int clipx, int clipy, int clipw
}
painter->drawPixmap(paintRect.topLeft(),buffer);
- if( paintRect.width() * paintRect.height() >= 10000 ) { // ignore small repaints
+ if( paintRect.width() * paintRect.height() >= 10000 ) { // ignore small tqrepaints
// try to do one step in 0.1sec
- int size = paintRect.width() * paintRect.height() * 100 / QMAX( t.elapsed(), 1 );
+ int size = paintRect.width() * paintRect.height() * 100 / TQMAX( t.elapsed(), 1 );
int maxRepaintSize;
if (zoom() == 1.0) {
@@ -952,11 +952,11 @@ void ImageView::performPaint( QPainter* painter, int clipx, int clipy, int clipw
painter->drawRect(paintRect);
#endif
- QApplication::flushX();
+ TQApplication::flushX();
}
-void ImageView::viewportMousePressEvent(QMouseEvent* event) {
+void ImageView::viewportMousePressEvent(TQMouseEvent* event) {
viewport()->setFocus();
switch (event->button()) {
case Qt::LeftButton:
@@ -971,13 +971,13 @@ void ImageView::viewportMousePressEvent(QMouseEvent* event) {
}
-void ImageView::viewportMouseMoveEvent(QMouseEvent* event) {
+void ImageView::viewportMouseMoveEvent(TQMouseEvent* event) {
selectTool(event->state(), true);
d->mTools[d->mToolID]->mouseMoveEvent(event);
}
-void ImageView::viewportMouseReleaseEvent(QMouseEvent* event) {
+void ImageView::viewportMouseReleaseEvent(TQMouseEvent* event) {
switch (event->button()) {
case Qt::LeftButton:
if (event->stateAfter() & Qt::RightButton) {
@@ -1011,26 +1011,26 @@ void ImageView::viewportMouseReleaseEvent(QMouseEvent* event) {
}
-bool ImageView::eventFilter(QObject* obj, QEvent* event) {
+bool ImageView::eventFilter(TQObject* obj, TQEvent* event) {
switch (event->type()) {
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- case QEvent::AccelOverride:
- return viewportKeyEvent(static_cast<QKeyEvent*>(event));
+ case TQEvent::KeyPress:
+ case TQEvent::KeyRelease:
+ case TQEvent::AccelOverride:
+ return viewportKeyEvent(TQT_TQKEYEVENT(event));
- case QEvent::MouseButtonDblClick:
+ case TQEvent::MouseButtonDblClick:
if (d->mToolID==ZOOM) return false;
emit doubleClicked();
return true;
- // Getting/loosing focus causes repaints, but repainting here is expensive,
- // and there's no need to repaint on focus changes, as the focus is not
+ // Getting/loosing focus causes tqrepaints, but tqrepainting here is expensive,
+ // and there's no need to tqrepaint on focus changes, as the focus is not
// indicated.
- case QEvent::FocusIn:
- case QEvent::FocusOut:
+ case TQEvent::FocusIn:
+ case TQEvent::FocusOut:
return true;
- case QEvent::Enter:
+ case TQEvent::Enter:
selectTool( kapp->keyboardMouseState(), true );
emitRequestHintDisplay();
break;
@@ -1038,29 +1038,29 @@ bool ImageView::eventFilter(QObject* obj, QEvent* event) {
default:
break;
}
- return QScrollView::eventFilter(obj,event);
+ return TQScrollView::eventFilter(obj,event);
}
-bool ImageView::viewportKeyEvent(QKeyEvent* event) {
+bool ImageView::viewportKeyEvent(TQKeyEvent* event) {
selectTool(event->stateAfter(), false);
return false;
}
-void ImageView::contentsDragEnterEvent(QDragEnterEvent* event) {
- event->accept( QUriDrag::canDecode( event ));
+void ImageView::contentsDragEnterEvent(TQDragEnterEvent* event) {
+ event->accept( TQUriDrag::canDecode( event ));
}
-void ImageView::contentsDropEvent(QDropEvent* event) {
+void ImageView::contentsDropEvent(TQDropEvent* event) {
KURL::List list;
if( KURLDrag::decode( event, list )) {
d->mDocument->setURL( list.first());
}
}
-void ImageView::keyPressEvent( QKeyEvent *event ) {
- QScrollView::keyPressEvent( event );
+void ImageView::keyPressEvent( TQKeyEvent *event ) {
+ TQScrollView::keyPressEvent( event );
int deltaX, deltaY;
if (event->state() != Qt::NoButton) {
@@ -1112,7 +1112,7 @@ void ImageView::selectTool(ButtonState state, bool force) {
}
-void ImageView::wheelEvent(QWheelEvent* event) {
+void ImageView::wheelEvent(TQWheelEvent* event) {
d->mTools[d->mToolID]->wheelEvent(event);
}
@@ -1141,8 +1141,8 @@ void ImageView::slotSelectZoom() {
int currentItem=d->mZoomCombo->currentItem();
if (currentItem>=int(d->mZoomComboActions.count()) ) {
- QString txt=d->mZoomCombo->currentText();
- txt=txt.left(txt.find('%'));
+ TQString txt=d->mZoomCombo->currentText();
+ txt=txt.left(txt.tqfind('%'));
double value=KGlobal::locale()->readNumber(txt) / 100.0;
updateZoom(ZOOM_FREE, value);
} else {
@@ -1280,7 +1280,7 @@ void ImageView::slotImageSizeUpdated() {
d->mXOffset=0;
d->mYOffset=0;
- d->mValidImageArea = QRegion();
+ d->mValidImageArea = TQRegion();
if (d->mZoomMode!=ZOOM_FREE) {
d->mXCenterBeforeAuto=0;
d->mYCenterBeforeAuto=0;
@@ -1311,9 +1311,9 @@ void ImageView::slotImageSizeUpdated() {
fullRepaint();
}
-void ImageView::slotImageRectUpdated(const QRect& imageRect) {
+void ImageView::slotImageRectUpdated(const TQRect& imageRect) {
d->mValidImageArea += imageRect;
- viewport()->repaint( d->imageToWidget( imageRect ), false );
+ viewport()->tqrepaint( d->imageToWidget( imageRect ), false );
}
@@ -1338,8 +1338,8 @@ double ImageView::computeZoomToFit() const {
if (d->mDocument->isNull()) {
return 1.0;
}
- QSize size=d->mDocument->image().size();
- size.scale(width(),height(),QSize::ScaleMin);
+ TQSize size=d->mDocument->image().size();
+ size.tqscale(width(),height(),TQSize::ScaleMin);
double zoom=double(size.width())/d->mDocument->width();
if (zoom>1.0 && !ImageViewConfig::enlargeSmallImages()) return 1.0;
@@ -1350,7 +1350,7 @@ double ImageView::computeZoomToWidth() const {
if (d->mDocument->isNull()) {
return 1.0;
}
- int sw = verticalScrollBar()->sizeHint().width(); // geometry is not valid before first show()
+ int sw = verticalScrollBar()->tqsizeHint().width(); // tqgeometry is not valid before first show()
int w = width();
int dw = d->mDocument->width();
switch( vScrollBarMode()) {
@@ -1370,7 +1370,7 @@ double ImageView::computeZoomToHeight() const {
if (d->mDocument->isNull()) {
return 1.0;
}
- int sh = horizontalScrollBar()->sizeHint().height();
+ int sh = horizontalScrollBar()->tqsizeHint().height();
int h = height();
int dh = d->mDocument->height();
switch( vScrollBarMode()) {
@@ -1425,15 +1425,15 @@ void ImageView::updateImageOffset() {
int zpixHeight=int(d->mDocument->height() * d->mZoom);
if (zpixWidth>viewWidth && hScrollBarMode()!=AlwaysOff) {
- // use sizeHint() - geometry is not valid before first show()
- viewHeight-=horizontalScrollBar()->sizeHint().height();
+ // use tqsizeHint() - tqgeometry is not valid before first show()
+ viewHeight-=horizontalScrollBar()->tqsizeHint().height();
}
if (zpixHeight>viewHeight && vScrollBarMode()!=AlwaysOff) {
- viewWidth-=verticalScrollBar()->sizeHint().width();
+ viewWidth-=verticalScrollBar()->tqsizeHint().width();
}
- d->mXOffset=QMAX(0,(viewWidth-zpixWidth)/2);
- d->mYOffset=QMAX(0,(viewHeight-zpixHeight)/2);
+ d->mXOffset=TQMAX(0,(viewWidth-zpixWidth)/2);
+ d->mYOffset=TQMAX(0,(viewHeight-zpixHeight)/2);
}
@@ -1457,7 +1457,7 @@ void ImageView::updateZoomActions() {
if (d->mZoomMode==ZOOM_FREE) {
d->mZoomIn->setEnabled(d->mZoom<MAX_ZOOM);
d->mZoomOut->setEnabled(d->mZoom>1/MAX_ZOOM);
- QString zoomText=QString("%1%").arg(int(d->mZoom*100));
+ TQString zoomText=TQString("%1%").tqarg(int(d->mZoom*100));
d->mZoomCombo->setCurrentText(zoomText);
} else {
d->mZoomIn->setEnabled(true);