diff options
Diffstat (limited to 'src/gvcore/filethumbnailviewitem.cpp')
-rw-r--r-- | src/gvcore/filethumbnailviewitem.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/src/gvcore/filethumbnailviewitem.cpp b/src/gvcore/filethumbnailviewitem.cpp index 00f3c89..65da494 100644 --- a/src/gvcore/filethumbnailviewitem.cpp +++ b/src/gvcore/filethumbnailviewitem.cpp @@ -21,12 +21,12 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// Qt includes -#include <qapplication.h> -#include <qcolor.h> -#include <qpainter.h> -#include <qpen.h> -#include <qpixmap.h> +// TQt includes +#include <tqapplication.h> +#include <tqcolor.h> +#include <tqpainter.h> +#include <tqpen.h> +#include <tqpixmap.h> // KDE includes #include <kdebug.h> @@ -45,7 +45,7 @@ namespace Gwenview { const int SHOWN_ITEM_INDICATOR_SIZE = 8; #if 0 -static void printRect(const QString& txt,const QRect& rect) { +static void printRect(const TQString& txt,const TQRect& rect) { kdWarning() << txt << " : " << rect.x() << "x" << rect.y() << " " << rect.width() << "x" << rect.height() << endl; } #endif @@ -56,11 +56,11 @@ static void printRect(const QString& txt,const QRect& rect) { */ class FileThumbnailViewItem::Line { protected: - const QIconViewItem* mItem; - QString mTxt; + const TQIconViewItem* mItem; + TQString mTxt; int mWidth; public: - Line(const QIconViewItem* item, const QString& txt) + Line(const TQIconViewItem* item, const TQString& txt) : mItem(item) , mTxt(txt) , mWidth(-1) { @@ -73,7 +73,7 @@ public: virtual int height() const=0; - void paint(QPainter* p, int textX, int textY, int align) const { + void paint(TQPainter* p, int textX, int textY, int align) const { Q_ASSERT(mWidth!=-1); int length=fontMetrics().width(mTxt); if (length<=mWidth ) { @@ -96,14 +96,14 @@ protected: return static_cast<const FileThumbnailView*>(mItem->iconView()); } - QFontMetrics fontMetrics() const { + TQFontMetrics fontMetrics() const { return view()->fontMetrics(); } /** * Called when the text won't fit the available space */ - virtual void complexPaint(QPainter* p, int textX, int textY, int align) const=0; + virtual void complexPaint(TQPainter* p, int textX, int textY, int align) const=0; }; @@ -112,14 +112,14 @@ protected: */ class FileThumbnailViewItem::CroppedLine : public FileThumbnailViewItem::Line { public: - CroppedLine(const QIconViewItem* item, const QString& txt) + CroppedLine(const TQIconViewItem* item, const TQString& txt) : Line(item, txt) {} int height() const { return fontMetrics().height(); } - void complexPaint(QPainter* p, int textX, int textY, int /*align*/) const { + void complexPaint(TQPainter* p, int textX, int textY, int /*align*/) const { KWordWrap::drawFadeoutText(p, textX, textY + fontMetrics().ascent(), @@ -135,7 +135,7 @@ public: class FileThumbnailViewItem::WrappedLine : public FileThumbnailViewItem::Line { KWordWrap* mWordWrap; public: - WrappedLine(const QIconViewItem* item, const QString& txt) + WrappedLine(const TQIconViewItem* item, const TQString& txt) : Line(item, txt) , mWordWrap(0) {} @@ -156,14 +156,14 @@ public: if (width==mWidth) return; mWidth=width; delete mWordWrap; - QFontMetrics fm=fontMetrics(); + TQFontMetrics fm=fontMetrics(); mWordWrap=KWordWrap::formatText(fm, - QRect(0, 0, mWidth, fm.height()*3), + TQRect(0, 0, mWidth, fm.height()*3), 0 /*flags*/, mTxt); } - void complexPaint(QPainter* p, int textX, int textY, int align) const { + void complexPaint(TQPainter* p, int textX, int textY, int align) const { Q_ASSERT(mWordWrap); if (!mWordWrap) return; @@ -180,16 +180,16 @@ public: }; -FileThumbnailViewItem::FileThumbnailViewItem(QIconView* view,const QString& text,const QPixmap& icon, KFileItem* fileItem) -: QIconViewItem(view,text,icon), mFileItem(fileItem) { +FileThumbnailViewItem::FileThumbnailViewItem(TQIconView* view,const TQString& text,const TQPixmap& icon, KFileItem* fileItem) +: TQIconViewItem(view,text,icon), mFileItem(fileItem) { updateLines(); calcRect(); } FileThumbnailViewItem::~FileThumbnailViewItem() { - QValueVector<Line*>::ConstIterator it=mLines.begin(); - QValueVector<Line*>::ConstIterator itEnd=mLines.end(); + TQValueVector<Line*>::ConstIterator it=mLines.begin(); + TQValueVector<Line*>::ConstIterator itEnd=mLines.end(); for (;it!=itEnd; ++it) { delete *it; } @@ -197,8 +197,8 @@ FileThumbnailViewItem::~FileThumbnailViewItem() { void FileThumbnailViewItem::updateLines() { - QValueVector<Line*>::ConstIterator it=mLines.begin(); - QValueVector<Line*>::ConstIterator itEnd=mLines.end(); + TQValueVector<Line*>::ConstIterator it=mLines.begin(); + TQValueVector<Line*>::ConstIterator itEnd=mLines.end(); for (;it!=itEnd; ++it) { delete *it; } @@ -206,14 +206,14 @@ void FileThumbnailViewItem::updateLines() { if (!mFileItem) return; bool isDir=mFileItem->isDir(); - if (iconView()->itemTextPos()==QIconView::Right) { + if (iconView()->itemTextPos()==TQIconView::Right) { // Text is on the right, show everything time_t time = TimeUtils::getTime(mFileItem); mLines.append( new WrappedLine(this, mFileItem->name()) ); mLines.append( new CroppedLine(this, TimeUtils::formatTime(time)) ); if (mImageSize.isValid()) { - QString txt=QString::number(mImageSize.width())+"x"+QString::number(mImageSize.height()); + TQString txt=TQString::number(mImageSize.width())+"x"+TQString::number(mImageSize.height()); mLines.append( new CroppedLine(this, txt) ); } if (!isDir) { @@ -235,9 +235,9 @@ void FileThumbnailViewItem::updateLines() { mLines.append( new CroppedLine(this, TimeUtils::formatTime(time)) ); } if (details & FileThumbnailView::IMAGESIZE) { - QString txt; + TQString txt; if (mImageSize.isValid()) { - txt=QString::number(mImageSize.width())+"x"+QString::number(mImageSize.height()); + txt=TQString::number(mImageSize.width())+"x"+TQString::number(mImageSize.height()); } mLines.append( new CroppedLine(this, txt) ); } @@ -251,9 +251,9 @@ void FileThumbnailViewItem::updateLines() { } -void FileThumbnailViewItem::calcRect(const QString&) { +void FileThumbnailViewItem::calcRect(const TQString&) { FileThumbnailView *view=static_cast<FileThumbnailView*>(iconView()); - bool isRight=view->itemTextPos()==QIconView::Right; + bool isRight=view->itemTextPos()==TQIconView::Right; int textW=view->gridX(); int thumbnailSize=FileViewConfig::thumbnailSize(); @@ -264,23 +264,23 @@ void FileThumbnailViewItem::calcRect(const QString&) { } int textH=0; - QValueVector<Line*>::ConstIterator it=mLines.begin(); - QValueVector<Line*>::ConstIterator itEnd=mLines.end(); + TQValueVector<Line*>::ConstIterator it=mLines.begin(); + TQValueVector<Line*>::ConstIterator itEnd=mLines.end(); for (;it!=itEnd; ++it) { (*it)->setWidth(textW); textH+=(*it)->height(); } - QRect itemRect(x(), y(), view->gridX(), 0); - QRect itemPixmapRect(PADDING, PADDING, thumbnailSize, thumbnailSize); - QRect itemTextRect(0, 0, textW, textH); + TQRect tqitemRect(x(), y(), view->gridX(), 0); + TQRect itemPixmapRect(PADDING, PADDING, thumbnailSize, thumbnailSize); + TQRect itemTextRect(0, 0, textW, textH); if (isRight) { - itemRect.setHeight( QMAX(thumbnailSize + PADDING*2, textH) ); + tqitemRect.setHeight( TQMAX(thumbnailSize + PADDING*2, textH) ); itemTextRect.moveLeft(thumbnailSize + PADDING * 2 ); - itemTextRect.moveTop((itemRect.height() - textH)/2); + itemTextRect.moveTop((tqitemRect.height() - textH)/2); } else { - itemPixmapRect.moveLeft( (itemRect.width() - itemPixmapRect.width()) / 2 ); - itemRect.setHeight(thumbnailSize + PADDING*3 + textH); + itemPixmapRect.moveLeft( (tqitemRect.width() - itemPixmapRect.width()) / 2 ); + tqitemRect.setHeight(thumbnailSize + PADDING*3 + textH); itemTextRect.moveLeft(PADDING); itemTextRect.moveTop(thumbnailSize + PADDING * 2); } @@ -292,18 +292,18 @@ void FileThumbnailViewItem::calcRect(const QString&) { if ( itemTextRect != textRect() ) { setTextRect( itemTextRect ); } - if ( itemRect != rect() ) { - setItemRect( itemRect ); + if ( tqitemRect != rect() ) { + setItemRect( tqitemRect ); } } -void FileThumbnailViewItem::paintItem(QPainter *p, const QColorGroup &cg) { +void FileThumbnailViewItem::paintItem(TQPainter *p, const TQColorGroup &cg) { FileThumbnailView *view=static_cast<FileThumbnailView*>(iconView()); Q_ASSERT(view); if (!view) return; - bool isRight=view->itemTextPos()==QIconView::Right; + bool isRight=view->itemTextPos()==TQIconView::Right; bool isShownItem=view->shownFileItem() && view->shownFileItem()->extraData(view)==this; bool isImage=!Archive::fileItemIsDirOrArchive(mFileItem); int textX, textY, textW, textH; @@ -315,12 +315,12 @@ void FileThumbnailViewItem::paintItem(QPainter *p, const QColorGroup &cg) { textH=textRect(false).height(); // Draw pixmap - QRect pRect = pixmapRect(false); + TQRect pRect = pixmapRect(false); int pixX = pRect.left() + ( thumbnailSize - pixmap()->width() ) / 2; int pixY = pRect.top() + ( thumbnailSize - pixmap()->height() ) / 2; p->drawPixmap( pixX, pixY, *pixmap() ); - QColor bg; + TQColor bg; if ( isSelected() ) { bg=cg.highlight(); } else { @@ -329,7 +329,7 @@ void FileThumbnailViewItem::paintItem(QPainter *p, const QColorGroup &cg) { // Draw shown item indicator if (isShownItem) { - QPointArray pa(3); + TQPointArray pa(3); pa[0] = pixmapRect(false).bottomLeft(); pa[0].rx() += pixmapRect(false).width() / 2; pa[0].ry() += PADDING - 1; @@ -349,10 +349,10 @@ void FileThumbnailViewItem::paintItem(QPainter *p, const QColorGroup &cg) { if (isImage || isSelected()) { // Draw frame - QRect frmRect=pixmapRect(false); + TQRect frmRect=pixmapRect(false); frmRect.addCoords(-PADDING, -PADDING, PADDING, PADDING); - p->setBrush(QBrush()); + p->setBrush(TQBrush()); p->setPen(bg); p->drawRect(frmRect); if (isSelected()) { @@ -366,8 +366,8 @@ void FileThumbnailViewItem::paintItem(QPainter *p, const QColorGroup &cg) { p->setBackgroundColor(cg.base()); int align = (isRight ? AlignAuto : AlignHCenter) | AlignTop; - QValueVector<Line*>::ConstIterator it=mLines.begin(); - QValueVector<Line*>::ConstIterator itEnd=mLines.end(); + TQValueVector<Line*>::ConstIterator it=mLines.begin(); + TQValueVector<Line*>::ConstIterator itEnd=mLines.end(); for (;it!=itEnd; ++it) { const Line* line=*it; line->paint(p, textX, textY, align); @@ -376,17 +376,17 @@ void FileThumbnailViewItem::paintItem(QPainter *p, const QColorGroup &cg) { } -bool FileThumbnailViewItem::acceptDrop(const QMimeSource* source) const { +bool FileThumbnailViewItem::acceptDrop(const TQMimeSource* source) const { return KURLDrag::canDecode(source); } -void FileThumbnailViewItem::dropped(QDropEvent* event, const QValueList<QIconDragItem>&) { +void FileThumbnailViewItem::dropped(TQDropEvent* event, const TQValueList<TQIconDragItem>&) { FileThumbnailView *view=static_cast<FileThumbnailView*>(iconView()); emit view->dropped(event,mFileItem); } -void FileThumbnailViewItem::setImageSize(const QSize& size) { +void FileThumbnailViewItem::setImageSize(const TQSize& size) { mImageSize=size; updateLines(); } |