diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
commit | bf7f88413be3831a9372d323d02fc0335b9f9188 (patch) | |
tree | 516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvcore/filedetailview.cpp | |
parent | e238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff) | |
download | gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip |
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvcore/filedetailview.cpp')
-rw-r--r-- | src/gvcore/filedetailview.cpp | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/src/gvcore/filedetailview.cpp b/src/gvcore/filedetailview.cpp index 9ba2c0d..5cce441 100644 --- a/src/gvcore/filedetailview.cpp +++ b/src/gvcore/filedetailview.cpp @@ -22,13 +22,13 @@ Boston, MA 02110-1301, USA. */ -// Qt -#include <qbitmap.h> -#include <qevent.h> -#include <qheader.h> -#include <qkeycode.h> -#include <qpainter.h> -#include <qpixmap.h> +// TQt +#include <tqbitmap.h> +#include <tqevent.h> +#include <tqheader.h> +#include <tqkeycode.h> +#include <tqpainter.h> +#include <tqpixmap.h> // KDE #include <kapplication.h> @@ -49,18 +49,18 @@ namespace Gwenview { -static QPixmap createShownItemPixmap(int size, const QColor& color) { - QPixmap pix(size, size); - pix.fill(Qt::red); - QPainter painter(&pix); +static TQPixmap createShownItemPixmap(int size, const TQColor& color) { + TQPixmap pix(size, size); + pix.fill(TQt::red); + TQPainter painter(&pix); int margin = 2; - QPointArray pa(3); + TQPointArray pa(3); int arrowSize = size/2 - margin; int center = size/2 - 1; - pa[0] = QPoint((size - arrowSize) / 2, center - arrowSize); - pa[1] = QPoint((size + arrowSize) / 2, center); - pa[2] = QPoint(pa[0].x(), center + arrowSize); + pa[0] = TQPoint((size - arrowSize) / 2, center - arrowSize); + pa[1] = TQPoint((size + arrowSize) / 2, center); + pa[2] = TQPoint(pa[0].x(), center + arrowSize); painter.setBrush(color); painter.setPen(color); @@ -73,8 +73,8 @@ static QPixmap createShownItemPixmap(int size, const QColor& color) { } -FileDetailView::FileDetailView(QWidget *parent, const char *name) - : KListView(parent, name), FileViewBase() +FileDetailView::FileDetailView(TQWidget *tqparent, const char *name) + : KListView(tqparent, name), FileViewBase() { mSortingCol = COL_NAME; mBlockSortingSignal = false; @@ -88,29 +88,29 @@ FileDetailView::FileDetailView(QWidget *parent, const char *name) setShowSortIndicator( TRUE ); setAllColumnsShowFocus( TRUE ); - connect( header(), SIGNAL( sectionClicked(int)), - SLOT(slotSortingChanged(int) )); + connect( header(), TQT_SIGNAL( sectionClicked(int)), + TQT_SLOT(slotSortingChanged(int) )); - connect( this, SIGNAL( returnPressed(QListViewItem *) ), - SLOT( slotActivate( QListViewItem *) ) ); + connect( this, TQT_SIGNAL( returnPressed(TQListViewItem *) ), + TQT_SLOT( slotActivate( TQListViewItem *) ) ); - connect( this, SIGNAL( clicked(QListViewItem *, const QPoint&, int)), - SLOT( selected( QListViewItem *) ) ); - connect( this, SIGNAL( doubleClicked(QListViewItem *, const QPoint&, int)), - SLOT( slotActivate( QListViewItem *) ) ); + connect( this, TQT_SIGNAL( clicked(TQListViewItem *, const TQPoint&, int)), + TQT_SLOT( selected( TQListViewItem *) ) ); + connect( this, TQT_SIGNAL( doubleClicked(TQListViewItem *, const TQPoint&, int)), + TQT_SLOT( slotActivate( TQListViewItem *) ) ); - connect( this, SIGNAL(contextMenuRequested( QListViewItem *, - const QPoint &, int )), - this, SLOT( slotActivateMenu( QListViewItem *, const QPoint& ))); + connect( this, TQT_SIGNAL(contextMenuRequested( TQListViewItem *, + const TQPoint &, int )), + this, TQT_SLOT( slotActivateMenu( TQListViewItem *, const TQPoint& ))); - QListView::setSelectionMode( QListView::Extended ); - connect( this, SIGNAL( selectionChanged() ), - SLOT( slotSelectionChanged() )); + TQListView::setSelectionMode( TQListView::Extended ); + connect( this, TQT_SIGNAL( selectionChanged() ), + TQT_SLOT( slotSelectionChanged() )); // FileViewStack need to be aware of sort changes, to update the sort menu - connect( sig, SIGNAL(sortingChanged(QDir::SortSpec)), - this, SIGNAL(sortingChanged(QDir::SortSpec)) ); + connect( sig, TQT_SIGNAL(sortingChanged(TQDir::SortSpec)), + this, TQT_SIGNAL(sortingChanged(TQDir::SortSpec)) ); setSorting( sorting() ); @@ -125,8 +125,8 @@ FileDetailView::FileDetailView(QWidget *parent, const char *name) setDropHighlighter(false); int size = IconSize(KIcon::Small); - mShownItemUnselectedPixmap = createShownItemPixmap(size, colorGroup().highlight()); - mShownItemSelectedPixmap = createShownItemPixmap(size, colorGroup().highlightedText()); + mShownItemUnselectedPixmap = createShownItemPixmap(size, tqcolorGroup().highlight()); + mShownItemSelectedPixmap = createShownItemPixmap(size, tqcolorGroup().highlightedText()); } @@ -173,7 +173,7 @@ void FileDetailView::invertSelection() KListView::invertSelection(); } -void FileDetailView::slotActivateMenu (QListViewItem *item,const QPoint& pos ) +void FileDetailView::slotActivateMenu (TQListViewItem *item,const TQPoint& pos ) { if ( !item ) { sig->activateMenu( 0, pos ); @@ -194,7 +194,7 @@ void FileDetailView::insertItem( KFileItem *i ) { KFileView::insertItem( i ); - FileDetailViewItem *item = new FileDetailViewItem( (QListView*) this, i ); + FileDetailViewItem *item = new FileDetailViewItem( (TQListView*) this, i ); setSortingKey( item, i ); @@ -204,7 +204,7 @@ void FileDetailView::insertItem( KFileItem *i ) mResolver->m_lstPendingMimeIconItems.append( item ); } -void FileDetailView::slotActivate( QListViewItem *item ) +void FileDetailView::slotActivate( TQListViewItem *item ) { if ( !item ) return; @@ -212,7 +212,7 @@ void FileDetailView::slotActivate( QListViewItem *item ) if ( fi ) sig->activate( fi ); } -void FileDetailView::selected( QListViewItem *item ) +void FileDetailView::selected( TQListViewItem *item ) { if ( !item ) return; @@ -223,7 +223,7 @@ void FileDetailView::selected( QListViewItem *item ) } } -void FileDetailView::highlighted( QListViewItem *item ) +void FileDetailView::highlighted( TQListViewItem *item ) { if ( !item ) return; @@ -245,7 +245,7 @@ void FileDetailView::updateView( bool b ) { if ( !b ) return; - QListViewItemIterator it( (QListView*)this ); + TQListViewItemIterator it( (TQListView*)this ); for ( ; it.current(); ++it ) { FileDetailViewItem *item=static_cast<FileDetailViewItem *>(it.current()); item->setPixmap( 0, item->fileInfo()->pixmap(KIcon::SizeSmall) ); @@ -266,15 +266,15 @@ void FileDetailView::updateView( const KFileItem *i ) void FileDetailView::setSortingKey( FileDetailViewItem *dvItem, const KFileItem *item) { - QDir::SortSpec spec = KFileView::sorting(); + TQDir::SortSpec spec = KFileView::sorting(); bool isDirOrArchive=item->isDir() || Archive::fileItemIsArchive(item); - QString key; - if ( spec & QDir::Time ) { + TQString key; + if ( spec & TQDir::Time ) { time_t time = TimeUtils::getTime(item); key=sortingKey(time, isDirOrArchive, spec); - } else if ( spec & QDir::Size ) { + } else if ( spec & TQDir::Size ) { key=sortingKey( item->size(), isDirOrArchive, spec ); } else { @@ -300,46 +300,46 @@ void FileDetailView::removeItem( const KFileItem *i ) void FileDetailView::slotSortingChanged( int col ) { - QDir::SortSpec sort = sorting(); + TQDir::SortSpec sort = sorting(); int sortSpec = -1; - bool reversed = col == mSortingCol && (sort & QDir::Reversed) == 0; + bool reversed = col == mSortingCol && (sort & TQDir::Reversed) == 0; mSortingCol = col; switch( col ) { case COL_NAME: - sortSpec = (sort & ~QDir::SortByMask | QDir::Name); + sortSpec = (sort & ~TQDir::SortByMask | TQDir::Name); break; case COL_SIZE: - sortSpec = (sort & ~QDir::SortByMask | QDir::Size); + sortSpec = (sort & ~TQDir::SortByMask | TQDir::Size); break; case COL_DATE: - sortSpec = (sort & ~QDir::SortByMask | QDir::Time); + sortSpec = (sort & ~TQDir::SortByMask | TQDir::Time); break; - // the following columns have no equivalent in QDir, so we set it - // to QDir::Unsorted and remember the column (mSortingCol) + // the following columns have no equivalent in TQDir, so we set it + // to TQDir::Unsorted and remember the column (mSortingCol) case COL_OWNER: case COL_GROUP: case COL_PERM: - // grmbl, QDir::Unsorted == SortByMask. - sortSpec = (sort & ~QDir::SortByMask);// | QDir::Unsorted; + // grmbl, TQDir::Unsorted == SortByMask. + sortSpec = (sort & ~TQDir::SortByMask);// | TQDir::Unsorted; break; default: break; } if ( reversed ) - sortSpec |= QDir::Reversed; + sortSpec |= TQDir::Reversed; else - sortSpec &= ~QDir::Reversed; + sortSpec &= ~TQDir::Reversed; - if ( sort & QDir::IgnoreCase ) - sortSpec |= QDir::IgnoreCase; + if ( sort & TQDir::IgnoreCase ) + sortSpec |= TQDir::IgnoreCase; else - sortSpec &= ~QDir::IgnoreCase; + sortSpec &= ~TQDir::IgnoreCase; - KFileView::setSorting( static_cast<QDir::SortSpec>( sortSpec ) ); + KFileView::setSorting( static_cast<TQDir::SortSpec>( sortSpec ) ); KFileItem *item; KFileItemListIterator it( *items() ); @@ -352,30 +352,30 @@ void FileDetailView::slotSortingChanged( int col ) KListView::setSorting( mSortingCol, !reversed ); KListView::sort(); - if (!mBlockSortingSignal) sig->changeSorting( static_cast<QDir::SortSpec>( sortSpec ) ); + if (!mBlockSortingSignal) sig->changeSorting( static_cast<TQDir::SortSpec>( sortSpec ) ); } -void FileDetailView::setSorting( QDir::SortSpec spec ) +void FileDetailView::setSorting( TQDir::SortSpec spec ) { int col = 0; - if ( spec & QDir::Time ) + if ( spec & TQDir::Time ) col = COL_DATE; - else if ( spec & QDir::Size ) + else if ( spec & TQDir::Size ) col = COL_SIZE; - else if ( spec & QDir::Unsorted ) + else if ( spec & TQDir::Unsorted ) col = mSortingCol; else col = COL_NAME; // inversed, because slotSortingChanged will reverse it - if ( spec & QDir::Reversed ) - spec = (QDir::SortSpec) (spec & ~QDir::Reversed); + if ( spec & TQDir::Reversed ) + spec = (TQDir::SortSpec) (spec & ~TQDir::Reversed); else - spec = (QDir::SortSpec) (spec | QDir::Reversed); + spec = (TQDir::SortSpec) (spec | TQDir::Reversed); mSortingCol = col; - KFileView::setSorting( (QDir::SortSpec) spec ); + KFileView::setSorting( (TQDir::SortSpec) spec ); // don't emit sortingChanged() when called via setSorting() @@ -432,7 +432,7 @@ KFileItem * FileDetailView::prevItem( const KFileItem *fileItem ) const return firstFileItem(); } -void FileDetailView::keyPressEvent( QKeyEvent *e ) +void FileDetailView::keyPressEvent( TQKeyEvent *e ) { KListView::keyPressEvent( e ); @@ -469,19 +469,19 @@ void FileDetailView::startDrag() * The item drawer for DragPixmapGenerator */ struct ItemDrawer : public DragPixmapItemDrawer<KFileItem*> { - ItemDrawer(const QFontMetrics& fontMetrics) + ItemDrawer(const TQFontMetrics& fontMetrics) : mFontMetrics(fontMetrics) {} - QSize itemSize(KFileItem* fileItem) { - if (!fileItem) return QSize(); - QString name = fileItem->name(); - int width = QMIN(mGenerator->maxWidth(), mFontMetrics.width(name)); + TQSize itemSize(KFileItem* fileItem) { + if (!fileItem) return TQSize(); + TQString name = fileItem->name(); + int width = TQMIN(mGenerator->maxWidth(), mFontMetrics.width(name)); int height = mFontMetrics.height(); - return QSize(width, height); + return TQSize(width, height); } - void drawItem(QPainter* painter, int left, int top, KFileItem* fileItem) { - QString name = fileItem->name(); + void drawItem(TQPainter* painter, int left, int top, KFileItem* fileItem) { + TQString name = fileItem->name(); painter->save(); KWordWrap::drawFadeoutText(painter, left, top + mFontMetrics.ascent(), @@ -489,7 +489,7 @@ void FileDetailView::startDrag() painter->restore(); } - QFontMetrics mFontMetrics; + TQFontMetrics mFontMetrics; }; ItemDrawer drawer(fontMetrics()); @@ -510,10 +510,10 @@ void FileDetailView::startDrag() return; } - QDragObject* drag=new KURLDrag(urls, this, 0); - QPixmap dragPixmap = generator.generate(); + TQDragObject* drag=new KURLDrag(urls, this, 0); + TQPixmap dragPixmap = generator.generate(); - drag->setPixmap( dragPixmap, QPoint(-generator.DRAG_OFFSET, -generator.DRAG_OFFSET)); + drag->setPixmap( dragPixmap, TQPoint(-generator.DRAG_OFFSET, -generator.DRAG_OFFSET)); drag->dragCopy(); } @@ -525,8 +525,8 @@ void FileDetailView::setShownFileItem(KFileItem* fileItem) FileDetailViewItem* newShownItem=viewItem(fileItem); FileViewBase::setShownFileItem(fileItem); - if (oldShownItem) oldShownItem->repaint(); - if (newShownItem) newShownItem->repaint(); + if (oldShownItem) oldShownItem->tqrepaint(); + if (newShownItem) newShownItem->tqrepaint(); } @@ -535,13 +535,13 @@ void FileDetailView::setShownFileItem(KFileItem* fileItem) // Drop support // //---------------------------------------------------------------------- -bool FileDetailView::acceptDrag(QDropEvent* event) const { +bool FileDetailView::acceptDrag(TQDropEvent* event) const { return KURLDrag::canDecode(event); } -void FileDetailView::contentsDropEvent(QDropEvent *event) { +void FileDetailView::contentsDropEvent(TQDropEvent *event) { KFileItem* fileItem=0L; - QListViewItem *item=itemAt(contentsToViewport(event->pos() ) ); + TQListViewItem *item=itemAt(contentsToViewport(event->pos() ) ); if (item) { fileItem=static_cast<FileDetailViewItem*>(item)->fileInfo(); |