1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

fix chart defaults

This commit is contained in:
Leo Franchi 2011-10-27 21:55:29 -04:00
parent 2b682a14ae
commit 253d65d5a3
3 changed files with 15 additions and 12 deletions

View File

@ -45,7 +45,8 @@ class Breadcrumb : public QWidget
public:
enum ExtraRoles {
DefaultRole = Qt::UserRole + 1,
UserSelectedRole = Qt::UserRole + 2
UserSelectedRole = Qt::UserRole + 2,
ChartIdRole = Qt::UserRole + 3
};
explicit Breadcrumb( QWidget* parent = 0, Qt::WindowFlags f = 0 );

View File

@ -92,7 +92,7 @@ QSize
BreadcrumbButton::sizeHint() const
{
// our width = width of combo + 20px for right-arrow and spacing
const int padding = hasChildren() ? 20 : 5;
const int padding = hasChildren() ? 20 : 8;
return m_combo->sizeHint() + QSize( padding, 0 );
}

View File

@ -308,19 +308,19 @@ WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
QStandardItem* item = m_crumbModelLeft->itemFromIndex( index );
if( !item )
return;
if( !item->data().isValid() )
if( !item->data( Breadcrumb::ChartIdRole ).isValid() )
return;
QList<QModelIndex> indexes;
while ( index.parent().isValid() )
{
indexes.prepend(index);
index = index.parent();
}
QList<QModelIndex> indexes;
while ( index.parent().isValid() )
{
indexes.prepend(index);
index = index.parent();
}
const QString chartId = item->data().toString();
const QString chartId = item->data( Breadcrumb::ChartIdRole ).toString();
if ( m_artistModels.contains( chartId ) )
{
@ -394,9 +394,11 @@ WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString &label, cons
foreach ( Tomahawk::InfoSystem::InfoStringHash chart, charts )
{
QStandardItem *childItem= new QStandardItem( chart[ "label" ] );
childItem->setData( chart[ "id" ] );
childItem->setData( chart[ "id" ], Breadcrumb::ChartIdRole );
if ( chart.value( "default", "" ) == "true")
sourceItem->setData( Breadcrumb::DefaultRole, true );
{
childItem->setData( true, Breadcrumb::DefaultRole );
}
sourceItem->appendRow( childItem );
}
}