1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-15 10:33:59 +02:00

* Scanning status should have priority over now-playing information.

This commit is contained in:
Christian Muehlhaeuser
2011-02-26 01:21:27 +01:00
parent 4d1afb74bf
commit fa6a2533d0
3 changed files with 43 additions and 43 deletions

View File

@@ -159,7 +159,7 @@ Source::scanningProgress( unsigned int files )
void
Source::scanningFinished( unsigned int files )
{
m_textStatus = tr( "Online" );
m_textStatus = QString();
emit stateChanged();
}
@@ -183,14 +183,14 @@ Source::onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::Stat
msg = tr( "Saving" );
break;
case DBSyncConnection::SYNCED:
msg = tr( "Online" );
msg = QString();
break;
case DBSyncConnection::SCANNING:
msg = tr( "Scanning (%L1 tracks)" ).arg( info );
break;
default:
msg = "???";
msg = QString();
}
m_textStatus = msg;

View File

@@ -124,13 +124,15 @@ SourcesModel::appendItem( const source_ptr& source )
// qDebug() << "Appending source item:" << item->source()->username();
invisibleRootItem()->appendRow( item->columns() );
// m_parent->setIndexWidget( m_parent->model()->index( rowCount() - 1, 0 ), item->widget() );
connect( source.data(), SIGNAL( offline() ), SLOT( onSourceChanged() ) );
connect( source.data(), SIGNAL( online() ), SLOT( onSourceChanged() ) );
connect( source.data(), SIGNAL( stats( QVariantMap ) ), SLOT( onSourceChanged() ) );
connect( source.data(), SIGNAL( playbackStarted( Tomahawk::query_ptr ) ), SLOT( onSourceChanged() ) );
connect( source.data(), SIGNAL( stateChanged() ), SLOT( onSourceChanged() ) );
if ( !source.isNull() )
{
connect( source.data(), SIGNAL( offline() ), SLOT( onSourceChanged() ) );
connect( source.data(), SIGNAL( online() ), SLOT( onSourceChanged() ) );
connect( source.data(), SIGNAL( stats( QVariantMap ) ), SLOT( onSourceChanged() ) );
connect( source.data(), SIGNAL( playbackStarted( Tomahawk::query_ptr ) ), SLOT( onSourceChanged() ) );
connect( source.data(), SIGNAL( stateChanged() ), SLOT( onSourceChanged() ) );
}
return true; // FIXME
}

View File

@@ -469,7 +469,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
QString desc = status ? sti->source()->textStatus() : tr( "Offline" );
if ( sti->source().isNull() )
desc = tr( "All available tracks" );
if ( status && !sti->source()->currentTrack().isNull() )
if ( status && desc.isEmpty() && !sti->source()->currentTrack().isNull() )
desc = sti->source()->currentTrack()->artist() + " - " + sti->source()->currentTrack()->track();
if ( desc.isEmpty() )
desc = tr( "Online" );
@@ -479,41 +479,39 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
text = painter->fontMetrics().elidedText( desc, Qt::ElideRight, textRect.width() );
painter->drawText( textRect, text );
if ( !status )
if ( status )
{
painter->restore();
return;
painter->setRenderHint( QPainter::Antialiasing );
QRect figRect = o.rect.adjusted( o.rect.width() - figWidth - 18, 0, -10, -o.rect.height() + 16 );
int hd = ( option.rect.height() - figRect.height() ) / 2;
figRect.adjust( 0, hd, 0, hd );
QColor figColor( 167, 183, 211 );
painter->setPen( figColor );
painter->setBrush( figColor );
QPen origpen = painter->pen();
QPen pen = origpen;
pen.setWidth( 1.0 );
painter->setPen( pen );
painter->drawRect( figRect );
QPainterPath ppath;
ppath.moveTo( QPoint( figRect.x(), figRect.y() ) );
ppath.quadTo( QPoint( figRect.x() - 8, figRect.y() + figRect.height() / 2 ), QPoint( figRect.x(), figRect.y() + figRect.height() ) );
painter->drawPath( ppath );
ppath.moveTo( QPoint( figRect.x() + figRect.width(), figRect.y() ) );
ppath.quadTo( QPoint( figRect.x() + figRect.width() + 8, figRect.y() + figRect.height() / 2 ), QPoint( figRect.x() + figRect.width(), figRect.y() + figRect.height() ) );
painter->drawPath( ppath );
painter->setPen( origpen );
QTextOption to( Qt::AlignCenter );
painter->setFont( bold );
painter->setPen( Qt::white );
painter->drawText( figRect, tracks, to );
}
painter->setRenderHint( QPainter::Antialiasing );
QRect figRect = o.rect.adjusted( o.rect.width() - figWidth - 18, 0, -10, -o.rect.height() + 16 );
int hd = ( option.rect.height() - figRect.height() ) / 2;
figRect.adjust( 0, hd, 0, hd );
QColor figColor( 167, 183, 211 );
painter->setPen( figColor );
painter->setBrush( figColor );
QPen origpen = painter->pen();
QPen pen = origpen;
pen.setWidth( 1.0 );
painter->setPen( pen );
painter->drawRect( figRect );
QPainterPath ppath;
ppath.moveTo( QPoint( figRect.x(), figRect.y() ) );
ppath.quadTo( QPoint( figRect.x() - 8, figRect.y() + figRect.height() / 2 ), QPoint( figRect.x(), figRect.y() + figRect.height() ) );
painter->drawPath( ppath );
ppath.moveTo( QPoint( figRect.x() + figRect.width(), figRect.y() ) );
ppath.quadTo( QPoint( figRect.x() + figRect.width() + 8, figRect.y() + figRect.height() / 2 ), QPoint( figRect.x() + figRect.width(), figRect.y() + figRect.height() ) );
painter->drawPath( ppath );
painter->setPen( origpen );
QTextOption to( Qt::AlignCenter );
painter->setFont( bold );
painter->setPen( Qt::white );
painter->drawText( figRect, tracks, to );
painter->restore();
}