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

add Distribution parameter to Echonest playlists

This commit is contained in:
Stefan Derkits
2014-09-16 21:46:38 +02:00
parent 6095ce32fa
commit 9101dc5a7a
2 changed files with 44 additions and 1 deletions

View File

@@ -509,6 +509,25 @@ Tomahawk::EchonestControl::updateWidgets()
m_match = QPointer< QWidget >( match );
m_input = QPointer< QWidget >( combo );
}
else if( selectedType() == "Distribution" )
{
m_currentType = Echonest::DynamicPlaylist::Distribution;
QLabel* match = new QLabel( tr( "is" ) );
QComboBox* combo = new QComboBox();
combo->addItem( tr( "Focused", "Distribution: Songs that are tightly clustered around the seeds"), "focused" );
combo->addItem( tr( "Wandering", "Distribution: Songs from a broader range of artists"), "wandering" );
m_matchString = match->text();
m_matchData = match->text();
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
m_match = QPointer<QWidget>( match );
m_input = QPointer<QWidget>( combo );
}
else
{
m_match = QPointer<QWidget>( new QWidget );
@@ -627,6 +646,15 @@ Tomahawk::EchonestControl::updateData()
}
}
else if( selectedType() == "Distribution" )
{
QComboBox* combo = qobject_cast< QComboBox* >( m_input.data() );
if ( combo )
{
m_data.first = Echonest::DynamicPlaylist::Distribution;
m_data.second = combo->itemData( combo->currentIndex() ).toString();
}
}
calculateSummary();
}
@@ -745,6 +773,13 @@ Tomahawk::EchonestControl::updateWidgetsFromData()
combo->setCurrentIndex( combo->findData( songType ) );
}
}
else if( selectedType() == "Distribution" )
{
QComboBox* combo = qobject_cast< QComboBox* >( m_input.data() );
if ( combo ) {
combo->setCurrentIndex( combo->findData( m_data.second.toString() ));
}
}
calculateSummary();
}
@@ -1005,7 +1040,14 @@ Tomahawk::EchonestControl::calculateSummary()
else
summary = tr( "where song type is not %1" ).arg( text );
}
else if ( selectedType() == "Distribution" )
{
Q_ASSERT( !m_input.isNull() );
Q_ASSERT( qobject_cast< QComboBox* >( m_input.data() ) );
QString text = qobject_cast< QComboBox* >( m_input.data() )->currentText().toLower();
summary = tr( "with a %1 distribution" ).arg( text );
}
m_summary = summary;
}

View File

@@ -85,7 +85,8 @@ EchonestFactory::typeSelectors() const
<< QT_TRANSLATE_NOOP( "Type selector", "Song Hotttnesss" ) << QT_TRANSLATE_NOOP( "Type selector", "Longitude" )
<< QT_TRANSLATE_NOOP( "Type selector", "Latitude" ) << QT_TRANSLATE_NOOP( "Type selector", "Mode" )
<< QT_TRANSLATE_NOOP( "Type selector", "Key" ) << QT_TRANSLATE_NOOP( "Type selector", "Sorting" )
<< QT_TRANSLATE_NOOP( "Type selector", "Song Type" );
<< QT_TRANSLATE_NOOP( "Type selector", "Song Type" ) << QT_TRANSLATE_NOOP( "Type selector", "Distribution" )
<< QT_TRANSLATE_NOOP( "Type selector", "Genre Preset" );
return types;
}