1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 02:09:48 +01:00

Expand breadcrumb fully when any item is selected

This commit is contained in:
Leo Franchi 2011-10-16 23:19:57 -04:00
parent 75cb466909
commit c4c94de1ac
3 changed files with 28 additions and 28 deletions

View File

@ -132,26 +132,27 @@ void BreadcrumbBar::deleteAnimationFinished()
void BreadcrumbBar::deleteButton(BreadcrumbButtonBase *widget)
{
if( !m_useAnimation ) {
widget->hide();
widget->deleteLater();
return; // all done here
}
widget->hide();
widget->deleteLater();
return; // all done here
int index = m_layout->indexOf(widget);
if( index != 0 && m_navButtons.size() > 0 ) {
QWidget* neighbor = m_layout->itemAt(index-1)->widget();
QPropertyAnimation *animation = new QPropertyAnimation(widget,"pos");
m_layout->removeWidget(widget);
connect(animation, SIGNAL(finished()), SLOT(deleteAnimationFinished()));
animation->setDuration(300);
animation->setStartValue(widget->pos());
animation->setEndValue(neighbor->pos());
animation->start();
} else {
widget->hide();
widget->deleteLater();
}
// Don't animate on delete. We expand a child recursively until it has no more children---this makes
// the deleting and creating animations overlap.
// int index = m_layout->indexOf(widget);
// if( index != 0 && m_navButtons.size() > 0 ) {
// QWidget* neighbor = m_layout->itemAt(index-1)->widget();
// QPropertyAnimation *animation = new QPropertyAnimation(widget,"pos");
// m_layout->removeWidget(widget);
// connect(animation, SIGNAL(finished()), SLOT(deleteAnimationFinished()));
// animation->setDuration(300);
// animation->setStartValue(widget->pos());
// animation->setEndValue(neighbor->pos());
// animation->start();
// } else {
// widget->hide();
// widget->deleteLater();
// }
}

View File

@ -44,10 +44,11 @@ SiblingCrumbButton::SiblingCrumbButton(
void SiblingCrumbButton::setIndex( QModelIndex index )
{
if ( m_index == index && text() == index.data().toString() )
return;
m_index = index;
setText( index.data().toString() );
if ( !(m_index == index && text() == index.data().toString()) )
{
m_index = index;
setText( index.data().toString() );
}
fillCombo();
}
@ -59,6 +60,8 @@ QModelIndex SiblingCrumbButton::index() const
void SiblingCrumbButton::setActive( bool active )
{
Q_UNUSED( active );
if ( active )
QTimer::singleShot( 0, this, SLOT( activateSelf() ) );
}
bool SiblingCrumbButton::isActive() const
@ -152,7 +155,7 @@ void SiblingCrumbButton::comboboxActivated(int i)
QModelIndex activated = m_index.sibling(i,0);
int count = breadcrumbBar()->model()->rowCount(activated);
if( count > 0 ) {
qDebug() << "activated" << activated.child(0,0).data().toString();
// qDebug() << "activated crumb with children:" << activated.child(0,0).data().toString();
breadcrumbBar()->currentChangedTriggered(activated.child(0,0));
} else {
// if it has no children, then emit itself

View File

@ -160,10 +160,6 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
ui->breadCrumbLeft->setSelectionModel(selectionModelLeft);
//ui->breadCrumbRight->setSelectionModel(selectionModelLeft);
//HACK ALERT - we want the second crumb to expand right away, so we
//force it here. We should find a more elegant want to do this
/// @note: this expands the billboard chart, as its fast loading and intersting album view ;) i think
ui->breadCrumbLeft->currentChangedTriggered(m_crumbModelLeft->index(1,0).child(0,0).child(0,0));
break;
}
case InfoSystem::InfoChart: