1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02: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: public:
enum ExtraRoles { enum ExtraRoles {
DefaultRole = Qt::UserRole + 1, 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 ); explicit Breadcrumb( QWidget* parent = 0, Qt::WindowFlags f = 0 );

View File

@@ -92,7 +92,7 @@ QSize
BreadcrumbButton::sizeHint() const BreadcrumbButton::sizeHint() const
{ {
// our width = width of combo + 20px for right-arrow and spacing // 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 ); return m_combo->sizeHint() + QSize( padding, 0 );
} }

View File

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