mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-16 11:04:01 +02:00
* Scanning status should have priority over now-playing information.
This commit is contained in:
@@ -159,7 +159,7 @@ Source::scanningProgress( unsigned int files )
|
|||||||
void
|
void
|
||||||
Source::scanningFinished( unsigned int files )
|
Source::scanningFinished( unsigned int files )
|
||||||
{
|
{
|
||||||
m_textStatus = tr( "Online" );
|
m_textStatus = QString();
|
||||||
emit stateChanged();
|
emit stateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,14 +183,14 @@ Source::onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::Stat
|
|||||||
msg = tr( "Saving" );
|
msg = tr( "Saving" );
|
||||||
break;
|
break;
|
||||||
case DBSyncConnection::SYNCED:
|
case DBSyncConnection::SYNCED:
|
||||||
msg = tr( "Online" );
|
msg = QString();
|
||||||
break;
|
break;
|
||||||
case DBSyncConnection::SCANNING:
|
case DBSyncConnection::SCANNING:
|
||||||
msg = tr( "Scanning (%L1 tracks)" ).arg( info );
|
msg = tr( "Scanning (%L1 tracks)" ).arg( info );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
msg = "???";
|
msg = QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_textStatus = msg;
|
m_textStatus = msg;
|
||||||
|
@@ -124,13 +124,15 @@ SourcesModel::appendItem( const source_ptr& source )
|
|||||||
|
|
||||||
// qDebug() << "Appending source item:" << item->source()->username();
|
// qDebug() << "Appending source item:" << item->source()->username();
|
||||||
invisibleRootItem()->appendRow( item->columns() );
|
invisibleRootItem()->appendRow( item->columns() );
|
||||||
// m_parent->setIndexWidget( m_parent->model()->index( rowCount() - 1, 0 ), item->widget() );
|
|
||||||
|
|
||||||
connect( source.data(), SIGNAL( offline() ), SLOT( onSourceChanged() ) );
|
if ( !source.isNull() )
|
||||||
connect( source.data(), SIGNAL( online() ), SLOT( onSourceChanged() ) );
|
{
|
||||||
connect( source.data(), SIGNAL( stats( QVariantMap ) ), SLOT( onSourceChanged() ) );
|
connect( source.data(), SIGNAL( offline() ), SLOT( onSourceChanged() ) );
|
||||||
connect( source.data(), SIGNAL( playbackStarted( Tomahawk::query_ptr ) ), SLOT( onSourceChanged() ) );
|
connect( source.data(), SIGNAL( online() ), SLOT( onSourceChanged() ) );
|
||||||
connect( source.data(), SIGNAL( stateChanged() ), 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
|
return true; // FIXME
|
||||||
}
|
}
|
||||||
|
@@ -469,7 +469,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
QString desc = status ? sti->source()->textStatus() : tr( "Offline" );
|
QString desc = status ? sti->source()->textStatus() : tr( "Offline" );
|
||||||
if ( sti->source().isNull() )
|
if ( sti->source().isNull() )
|
||||||
desc = tr( "All available tracks" );
|
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();
|
desc = sti->source()->currentTrack()->artist() + " - " + sti->source()->currentTrack()->track();
|
||||||
if ( desc.isEmpty() )
|
if ( desc.isEmpty() )
|
||||||
desc = tr( "Online" );
|
desc = tr( "Online" );
|
||||||
@@ -479,41 +479,39 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
text = painter->fontMetrics().elidedText( desc, Qt::ElideRight, textRect.width() );
|
text = painter->fontMetrics().elidedText( desc, Qt::ElideRight, textRect.width() );
|
||||||
painter->drawText( textRect, text );
|
painter->drawText( textRect, text );
|
||||||
|
|
||||||
if ( !status )
|
if ( status )
|
||||||
{
|
{
|
||||||
painter->restore();
|
painter->setRenderHint( QPainter::Antialiasing );
|
||||||
return;
|
|
||||||
|
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();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user