diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-18 03:28:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-18 03:28:57 +0000 |
commit | 1d9d9f5ce46f0220f7b1b350f5ad4e6dc5079ac6 (patch) | |
tree | 728d80ad748a95d7aa27ee020706dbe985e0e8cb /amarok/src/covermanager.cpp | |
parent | e9db3e45ed0189bbe18125b120da394a5bc8a832 (diff) | |
download | amarok-1d9d9f5ce46f0220f7b1b350f5ad4e6dc5079ac6.tar.gz amarok-1d9d9f5ce46f0220f7b1b350f5ad4e6dc5079ac6.zip |
Finish TQt4 porting of Amarok
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/amarok@1228394 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'amarok/src/covermanager.cpp')
-rw-r--r-- | amarok/src/covermanager.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/amarok/src/covermanager.cpp b/amarok/src/covermanager.cpp index 79b5d571..bf1c60ef 100644 --- a/amarok/src/covermanager.cpp +++ b/amarok/src/covermanager.cpp @@ -73,9 +73,9 @@ class ArtistItem : public KListViewItem TQString a = text(0); TQString b = i->text(0); - if ( a.startsWith( "the ", false ) ) + if ( a.tqstartsWith( "the ", false ) ) CollectionView::manipulateThe( a, true ); - if ( b.startsWith( "the ", false ) ) + if ( b.tqstartsWith( "the ", false ) ) CollectionView::manipulateThe( b, true ); return TQString::localeAwareCompare( a.lower(), b.lower() ); @@ -270,26 +270,26 @@ void CoverManager::init() } -CoverViewDialog::CoverViewDialog( const TQString& artist, const TQString& album, TQWidget *parent ) - : TQDialog( parent, 0, false, WDestructiveClose | WType_TopLevel | WNoAutoErase ) +CoverViewDialog::CoverViewDialog( const TQString& artist, const TQString& album, TQWidget *tqparent ) + : TQDialog( tqparent, 0, false, WDestructiveClose | WType_TopLevel | WNoAutoErase ) , m_pixmap( CollectionDB::instance()->albumImage( artist, album, false, 0 ) ) { KWin::setType( winId(), NET::Utility ); kapp->setTopWidget( this ); - setCaption( kapp->makeStdCaption( i18n("%1 - %2").arg( artist, album ) ) ); + setCaption( kapp->makeStdCaption( i18n("%1 - %2").tqarg( artist, album ) ) ); - m_layout = new TQHBoxLayout( this ); - m_layout->setAutoAdd( true ); + m_tqlayout = new TQHBoxLayout( this ); + m_tqlayout->setAutoAdd( true ); m_pixmapViewer = new PixmapViewer( this, m_pixmap ); setFixedSize( m_pixmapViewer->maximalSize() ); } -void CoverManager::viewCover( const TQString& artist, const TQString& album, TQWidget *parent ) //static +void CoverManager::viewCover( const TQString& artist, const TQString& album, TQWidget *tqparent ) //static { //TQDialog means "escape" works as expected - TQDialog *dialog = new CoverViewDialog( artist, album, parent ); + TQDialog *dialog = new CoverViewDialog( artist, album, tqparent ); dialog->show(); } @@ -394,9 +394,9 @@ void CoverManager::slotArtistSelected( TQListViewItem *item ) //SLOT progress.TQDialog::setCaption( i18n("...") ); //NOTE we MUST show the dialog, otherwise the closeEvents get processed - // in the processEvents() calls below, GRUMBLE! Qt sux0rs + // in the processEvents() calls below, GRUMBLE! TQt sux0rs progress.show(); - progress.repaint( false ); //ensures the dialog isn't blank + progress.tqrepaint( false ); //ensures the dialog isn't blank //this is an extra processEvent call for the sake of init() and aesthetics //it isn't necessary @@ -456,8 +456,8 @@ void CoverManager::slotArtistSelected( TQListViewItem *item ) //SLOT m_coverItems.append( new CoverViewItem( m_coverView, m_coverView->lastItem(), artist, album ) ); if ( ++x % 50 == 0 ) { - progress.setProgress( x / 5 ); // we do it less often due to bug in Qt, ask Max - kapp->processEvents(); // TQProgressDialog also calls this, but not always due to Qt bug! + progress.setProgress( x / 5 ); // we do it less often due to bug in TQt, ask Max + kapp->processEvents(); // TQProgressDialog also calls this, but not always due to TQt bug! //only worth testing for after processEvents() is called if( progress.wasCancelled() ) @@ -499,7 +499,7 @@ void CoverManager::showCoverMenu( TQIconViewItem *item, const TQPoint &p ) //SLO } else { menu.insertItem( SmallIconSet( Amarok::icon( "zoom" ) ), i18n( "&Show Fullsize" ), SHOW ); - menu.insertItem( SmallIconSet( Amarok::icon( "download" ) ), i18n( "&Fetch From amazon.%1" ).arg( CoverManager::amazonTld() ), FETCH ); + menu.insertItem( SmallIconSet( Amarok::icon( "download" ) ), i18n( "&Fetch From amazon.%1" ).tqarg( CoverManager::amazonTld() ), FETCH ); menu.insertItem( SmallIconSet( Amarok::icon( "files" ) ), i18n( "Set &Custom Cover" ), CUSTOM ); menu.insertItem( SmallIconSet( Amarok::icon( "add_playlist" ) ), i18n( "&Append to Playlist" ), APPEND ); menu.insertSeparator(); @@ -586,7 +586,7 @@ void CoverManager::slotSetFilter() //SLOT for( TQIconViewItem *item = m_coverItems.first(); item; item = m_coverItems.next() ) { CoverViewItem *coverItem = static_cast<CoverViewItem*>(item); - if( coverItem->album().contains( m_filter, false ) || coverItem->artist().contains( m_filter, false ) ) + if( coverItem->album().tqcontains( m_filter, false ) || coverItem->artist().tqcontains( m_filter, false ) ) m_coverView->insertItem( item, m_coverView->lastItem() ); } m_coverView->setAutoArrange( true ); @@ -621,7 +621,7 @@ void CoverManager::changeView( int id ) //SLOT bool show = false; CoverViewItem *coverItem = static_cast<CoverViewItem*>(item); if( !m_filter.isEmpty() ) { - if( !coverItem->album().contains( m_filter, false ) && !coverItem->artist().contains( m_filter, false ) ) + if( !coverItem->album().tqcontains( m_filter, false ) && !coverItem->artist().tqcontains( m_filter, false ) ) continue; } @@ -729,7 +729,7 @@ void CoverManager::setCustomSelectedCovers() } KURL file = KFileDialog::getImageOpenURL( startPath, this, i18n( "Select Cover Image File" ) ); if ( !file.isEmpty() ) { - qApp->processEvents(); //it may takes a while so process pending events + tqApp->processEvents(); //it may takes a while so process pending events TQString tmpFile; TQImage image = CollectionDB::fetchImage(file, tmpFile); for ( CoverViewItem* item = selected.first(); item; item = selected.next() ) { @@ -763,12 +763,12 @@ void CoverManager::deleteSelectedCovers() i18n( "Are you sure you want to remove this cover from the Collection?", "Are you sure you want to delete these %n covers from the Collection?", selected.count() ), - TQString::null, + TQString(), KStdGuiItem::del() ); if ( button == KMessageBox::Continue ) { for ( CoverViewItem* item = selected.first(); item; item = selected.next() ) { - qApp->processEvents(); + tqApp->processEvents(); if ( CollectionDB::instance()->removeAlbumImage( item->artist(), item->album() ) ) //delete selected cover coverRemoved( item->artist(), item->album() ); } @@ -817,9 +817,9 @@ void CoverManager::updateStatusBar() if ( values.count() >= 2 ) { if( values[0].isEmpty() ) - text = i18n( "Fetching cover for %1..." ).arg( values[1] ); + text = i18n( "Fetching cover for %1..." ).tqarg( values[1] ); else - text = i18n( "Fetching cover for %1 - %2..." ).arg( values[0], values[1] ); + text = i18n( "Fetching cover for %1 - %2..." ).tqarg( values[0], values[1] ); } } else if( m_fetchingCovers ) { @@ -851,7 +851,7 @@ void CoverManager::updateStatusBar() } if( !m_filter.isEmpty() ) - text = i18n( "1 result for \"%1\"", "%n results for \"%1\"", totalCounter ).arg( m_filter ); + text = i18n( "1 result for \"%1\"", "%n results for \"%1\"", totalCounter ).tqarg( m_filter ); else if( m_artistView->selectedItem() ) { text = i18n( "1 album", "%n albums", totalCounter ); if( m_artistView->selectedItem() != m_artistView->firstChild() ) //showing albums by an artist @@ -864,7 +864,7 @@ void CoverManager::updateStatusBar() } if( missingCounter ) - text += i18n(" - ( <b>%1</b> without cover )" ).arg( missingCounter ); + text += i18n(" - ( <b>%1</b> without cover )" ).tqarg( missingCounter ); #ifdef AMAZON_SUPPORT m_fetchButton->setEnabled( missingCounter ); @@ -884,8 +884,8 @@ void CoverManager::setStatusText( TQString text ) // CLASS CoverView ///////////////////////////////////////////////////////////////////// -CoverView::CoverView( TQWidget *parent, const char *name, WFlags f ) - : KIconView( parent, name, f ) +CoverView::CoverView( TQWidget *tqparent, const char *name, WFlags f ) + : KIconView( tqparent, name, f ) { Debug::Block block( __PRETTY_FUNCTION__ ); @@ -912,7 +912,7 @@ TQDragObject *CoverView::dragObject() return 0; const TQString sql = "SELECT tags.url FROM tags, album WHERE album.name %1 AND tags.album = album.id ORDER BY tags.track;"; - const TQStringList values = CollectionDB::instance()->query( sql.arg( CollectionDB::likeCondition( item->album() ) ) ); + const TQStringList values = CollectionDB::instance()->query( sql.tqarg( CollectionDB::likeCondition( item->album() ) ) ); KURL::List urls; for( TQStringList::ConstIterator it = values.begin(), end = values.end(); it != end; ++it ) @@ -939,8 +939,8 @@ void CoverView::setStatusText( TQIconViewItem *item ) //FIXME: Don't rely on other independent code, use an sql query if( item->artist().isEmpty() ) sampler = true; - TQString tipContent = i18n( "%1 - %2" ).arg( sampler ? i18n("Various Artists") : item->artist() ) - .arg( item->album() ); + TQString tipContent = i18n( "%1 - %2" ).tqarg( sampler ? i18n("Various Artists") : item->artist() ) + .tqarg( item->album() ); CoverManager::instance()->setStatusText( tipContent ); @@ -951,8 +951,8 @@ void CoverView::setStatusText( TQIconViewItem *item ) // CLASS CoverViewItem ///////////////////////////////////////////////////////////////////// -CoverViewItem::CoverViewItem( TQIconView *parent, TQIconViewItem *after, const TQString &artist, const TQString &album ) - : KIconViewItem( parent, after, album ) +CoverViewItem::CoverViewItem( TQIconView *tqparent, TQIconViewItem *after, const TQString &artist, const TQString &album ) + : KIconViewItem( tqparent, after, album ) , m_artist( artist ) , m_album( album ) , m_coverImagePath( CollectionDB::instance()->albumImage( m_artist, m_album, false, 0, &m_embedded ) ) @@ -973,7 +973,7 @@ void CoverViewItem::loadCover() m_coverImagePath = CollectionDB::instance()->albumImage( m_artist, m_album, false, 1, &m_embedded ); m_coverPixmap = TQPixmap( m_coverImagePath ); //create the scaled cover - repaint(); + tqrepaint(); } @@ -983,27 +983,27 @@ void CoverViewItem::calcRect( const TQString& ) TQFontMetrics fm = iconView()->fontMetrics(); TQRect itemPixmapRect( 5, 1, thumbWidth, thumbWidth ); - TQRect itemRect = rect(); - itemRect.setWidth( thumbWidth + 10 ); - itemRect.setHeight( thumbWidth + fm.lineSpacing() + 2 ); - TQRect itemTextRect( 0, thumbWidth+2, itemRect.width(), fm.lineSpacing() ); + TQRect tqitemRect = rect(); + tqitemRect.setWidth( thumbWidth + 10 ); + tqitemRect.setHeight( thumbWidth + fm.lineSpacing() + 2 ); + TQRect itemTextRect( 0, thumbWidth+2, tqitemRect.width(), fm.lineSpacing() ); setPixmapRect( itemPixmapRect ); setTextRect( itemTextRect ); - setItemRect( itemRect ); + setItemRect( tqitemRect ); } void CoverViewItem::paintItem(TQPainter* p, const TQColorGroup& cg) { - TQRect itemRect = rect(); + TQRect tqitemRect = rect(); p->save(); - p->translate( itemRect.x(), itemRect.y() ); + p->translate( tqitemRect.x(), tqitemRect.y() ); // draw the border p->setPen( cg.mid() ); - p->drawRect( 0, 0, itemRect.width(), pixmapRect().height()+2 ); + p->drawRect( 0, 0, tqitemRect.width(), pixmapRect().height()+2 ); // draw the cover image if( !m_coverPixmap.isNull() ) @@ -1019,7 +1019,7 @@ void CoverViewItem::paintItem(TQPainter* p, const TQColorGroup& cg) str = KStringHandler::rPixelSqueeze( str, p->fontMetrics(), textRect().width() ); } p->setPen( cg.text() ); - p->drawText( textRect(), Qt::AlignCenter, str ); + p->drawText( textRect(), TQt::AlignCenter, str ); if( isSelected() ) { p->setPen( cg.highlight() ); |