From c6466bdf5c47f4627af195869137e938ff7b3e50 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 23 Feb 2011 01:49:56 +0100 Subject: [PATCH 1/2] * Fix build on OS/X. --- admin/mac/deposx.sh | 6 ++++++ src/sip/jabber/CMakeLists.txt | 1 + src/sip/twitter/CMakeLists.txt | 1 + src/sip/zeroconf/CMakeLists.txt | 1 + 4 files changed, 9 insertions(+) diff --git a/admin/mac/deposx.sh b/admin/mac/deposx.sh index fb9ba6081..5ea012bbd 100755 --- a/admin/mac/deposx.sh +++ b/admin/mac/deposx.sh @@ -74,8 +74,10 @@ function deplib_change install_name_tool -change /usr/local/Cellar/flac/1.2.1/lib/libFLAC.8.dylib @executable_path/libFLAC.8.dylib $1 install_name_tool -change $ORIGROOT/src/libtomahawk/libtomahawklib.dylib @executable_path/libtomahawklib.dylib $1 install_name_tool -change $ORIGROOT/libsip_jabber.dylib @executable_path/libsip_jabber.dylib $1 + install_name_tool -change $ORIGROOT/libsip_twitter.dylib @executable_path/libsip_twitter.dylib $1 install_name_tool -change $ORIGROOT/libsip_zeroconf.dylib @executable_path/libsip_zeroconf.dylib $1 install_name_tool -change $ORIGROOT/thirdparty/jdns/libtomahawk_jdns.dylib @executable_path/libtomahawk_jdns.dylib $1 + install_name_tool -change $ORIGROOT/thirdparty/qtweetlib/libtomahawk_qtweetlib.dylib @executable_path/libtomahawk_qtweetlib.dylib $1 } ################################################################################ @@ -104,18 +106,22 @@ import_lib /usr/local/lib/libechonest.1.1.dylib import_lib /usr/local/Cellar/clucene/0.9.21/lib/libclucene.0.dylib import_lib ../../libsip_jabber.dylib +import_lib ../../libsip_twitter.dylib import_lib ../../libsip_zeroconf.dylib import_lib ../../src/libtomahawk/libtomahawklib.dylib import_lib ../../thirdparty/jdns/libtomahawk_jdns.dylib +import_lib ../../thirdparty/qtweetlib/libtomahawk_qtweetlib.dylib deposx_change MacOS/libqjson.0.dylib deposx_change MacOS/liblastfm.0.dylib deposx_change MacOS/libclucene.0.dylib deposx_change MacOS/libechonest.1.1.dylib deposx_change MacOS/libsip_jabber.dylib +deposx_change MacOS/libsip_twitter.dylib deposx_change MacOS/libsip_zeroconf.dylib deposx_change MacOS/libtomahawklib.dylib deposx_change MacOS/libtomahawk_jdns.dylib +deposx_change MacOS/libtomahawk_qtweetlib.dylib # now Qt for x in $QTLIBS diff --git a/src/sip/jabber/CMakeLists.txt b/src/sip/jabber/CMakeLists.txt index f8d35ca20..d064a3aeb 100644 --- a/src/sip/jabber/CMakeLists.txt +++ b/src/sip/jabber/CMakeLists.txt @@ -36,6 +36,7 @@ target_link_libraries( sip_jabber ${QT_LIBRARIES} ${GLOOX_LIBRARIES} ${OS_SPECIFIC_LINK_LIBRARIES} + tomahawklib ) IF( APPLE ) diff --git a/src/sip/twitter/CMakeLists.txt b/src/sip/twitter/CMakeLists.txt index f1d7fce53..f3bc32bd5 100644 --- a/src/sip/twitter/CMakeLists.txt +++ b/src/sip/twitter/CMakeLists.txt @@ -43,6 +43,7 @@ ENDIF( WIN32 ) target_link_libraries( sip_twitter ${QT_LIBRARIES} ${OS_SPECIFIC_LINK_LIBRARIES} + tomahawklib ) IF( APPLE ) diff --git a/src/sip/zeroconf/CMakeLists.txt b/src/sip/zeroconf/CMakeLists.txt index 53e2f7acc..e203901cf 100644 --- a/src/sip/zeroconf/CMakeLists.txt +++ b/src/sip/zeroconf/CMakeLists.txt @@ -34,6 +34,7 @@ ENDIF( WIN32 ) target_link_libraries( sip_zeroconf ${QT_LIBRARIES} ${OS_SPECIFIC_LINK_LIBRARIES} + tomahawklib ) IF( APPLE ) From 3a832928f8185961faa86c8aa419ba02a52ba724 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Tue, 22 Feb 2011 19:20:59 -0600 Subject: [PATCH 2/2] fix painting bg by making the row height 1 larger cleanup the anim code a bit --- .../playlist/dynamic/DynamicView.cpp | 75 +++++++++---------- .../playlist/dynamic/DynamicView.h | 2 + 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/libtomahawk/playlist/dynamic/DynamicView.cpp b/src/libtomahawk/playlist/dynamic/DynamicView.cpp index f345f7279..ecd2d10a1 100644 --- a/src/libtomahawk/playlist/dynamic/DynamicView.cpp +++ b/src/libtomahawk/playlist/dynamic/DynamicView.cpp @@ -201,36 +201,14 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep ) m_fadingIndexes = QPixmap::grabWidget( this, fadingRect ); // but all values we use to grab the widgetr have to be in scrollarea coords :( m_fadingPointAnchor = QPoint( 0, fadingRectViewport.topLeft().y() ); - + // get the background - m_bg = QPixmap( m_fadingIndexes.size() ); - m_bg.fill( Qt::white ); - QPainter p( &m_bg ); - QStyleOptionViewItemV4 opt = viewOptions(); - // code taken from QTreeViewPrivate::paintAlternatingRowColors - if( alternatingRowColors() ) { - m_fadebg = !style()->styleHint( QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea, &opt ); - qDebug() << "PAINTING ALTERNATING ROW BG!: " << fadingRectViewport; - int rowHeight = itemDelegate()->sizeHint( opt, QModelIndex() ).height(); - int y = m_fadingIndexes.rect().topLeft().y(); - int current = startRow; - while( y <= m_fadingIndexes.rect().bottomLeft().y() ) { - opt.rect.setRect(0, y, viewport()->width(), rowHeight); - qDebug() << "Painting a row from " << y << "to" << y + rowHeight << ":" << opt.rect; - if( current & 1 ) { - opt.features |= QStyleOptionViewItemV2::Alternate; - } else { - opt.features &= ~QStyleOptionViewItemV2::Alternate; - } - ++current; - style()->drawPrimitive( QStyle::PE_PanelItemViewRow, &opt, &p ); - y += rowHeight; - } - } + m_bg = backgroundBetween( m_fadingIndexes.rect(), startRow ); + m_fadeOutAnim.start(); qDebug() << "Grabbed fading indexes from rect:" << fadingRect << m_fadingIndexes.size(); - + if( !justFade ) { /// sanity checks. make sure we have all the rows we need int firstSlider = startRow + realNum; @@ -242,8 +220,7 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep ) firstSlider = proxyModel()->rowCount(); } } - - + topLeft = proxyModel()->index( startRow + realNum, 0, QModelIndex() ); bottomRight = proxyModel()->index( startRow + realNum + numToKeep - 1, proxyModel()->columnCount( QModelIndex() ) - 1, QModelIndex() ); QRect slidingRect = visualRegionForSelection( QItemSelection( topLeft, bottomRight ) ).boundingRect(); @@ -255,12 +232,12 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep ) m_bottomAnchor = QPoint( 0, slidingRectViewport.topLeft().y() ); m_bottomOfAnim = QPoint( 0, slidingRectViewport.bottomLeft().y() ); qDebug() << "Grabbed sliding index from rect:" << slidingRect << m_slidingIndex.size(); - + // slide from the current position to the new one int frameRange = fadingRect.topLeft().y() - slidingRect.topLeft().y(); m_slideAnim.setDuration( SLIDE_LENGTH + frameRange * LONG_MULT ); m_slideAnim.setFrameRange( slidingRectViewport.topLeft().y(), fadingRectViewport.topLeft().y() ); - + QTimer::singleShot( SLIDE_OFFSET, &m_slideAnim, SLOT( start() ) ); } @@ -274,6 +251,35 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep ) proxyModel()->removeIndexes( todel ); } +QPixmap +DynamicView::backgroundBetween( QRect rect, int rowStart ) +{ + QPixmap bg = QPixmap( rect.size() ); + bg.fill( Qt::white ); + QPainter p( &bg ); + QStyleOptionViewItemV4 opt = viewOptions(); + // code taken from QTreeViewPrivate::paintAlternatingRowColors + m_fadebg = !style()->styleHint( QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea, &opt ); + // qDebug() << "PAINTING ALTERNATING ROW BG!: " << fadingRectViewport; + int rowHeight = itemDelegate()->sizeHint( opt, QModelIndex() ).height() + 1; + int y = 0; + int current = rowStart; + while( y <= rect.bottomLeft().y() ) { + opt.rect.setRect(0, y, viewport()->width(), rowHeight); + // qDebug() << "PAINTING BG ROW IN RECT" << y << "to" << y + rowHeight << ":" << opt.rect; + if( current & 1 ) { + opt.features |= QStyleOptionViewItemV2::Alternate; + } else { + opt.features &= ~QStyleOptionViewItemV2::Alternate; + } + ++current; + style()->drawPrimitive( QStyle::PE_PanelItemViewRow, &opt, &p ); + y += rowHeight; + } + + return bg; +} + void DynamicView::animFinished() { @@ -294,7 +300,6 @@ DynamicView::paintEvent( QPaintEvent* event ) bg.moveTo( m_fadingPointAnchor ); // cover up the background if( m_fadebg ) { p.save(); - p.fillRect( bg, Qt::white ); p.setOpacity( 1 - m_fadeOutAnim.currentValue() ); } @@ -302,19 +307,13 @@ DynamicView::paintEvent( QPaintEvent* event ) if( m_fadebg ) { p.restore(); } - -// qDebug() << "FAST SETOPACITY:" << p.paintEngine()->hasFeature(QPaintEngine::ConstantOpacity); + // qDebug() << "FAST SETOPACITY:" << p.paintEngine()->hasFeature(QPaintEngine::ConstantOpacity); p.setOpacity( 1 - m_fadeOutAnim.currentValue() ); p.drawPixmap( m_fadingPointAnchor, m_fadingIndexes ); - p.restore(); if( m_slideAnim.state() == QTimeLine::Running ) { // draw the collapsing entry - QRect bg = m_slidingIndex.rect(); - bg.moveTo( m_bottomAnchor ); - bg.setBottom( m_bottomOfAnim.y() ); - p.fillRect( bg, Qt::white ); p.drawPixmap( 0, m_slideAnim.currentFrame(), m_slidingIndex ); } else if( m_fadeOutAnim.state() == QTimeLine::Running ) { p.drawPixmap( 0, m_bottomAnchor.y(), m_slidingIndex ); diff --git a/src/libtomahawk/playlist/dynamic/DynamicView.h b/src/libtomahawk/playlist/dynamic/DynamicView.h index 235117c37..d7ad8103e 100644 --- a/src/libtomahawk/playlist/dynamic/DynamicView.h +++ b/src/libtomahawk/playlist/dynamic/DynamicView.h @@ -63,6 +63,8 @@ private slots: void animFinished(); private: + QPixmap backgroundBetween( QRect rect, int rowStart ); + DynamicModel* m_model; QString m_title; QString m_body;