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:
@@ -509,6 +509,25 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
m_match = QPointer< QWidget >( match );
|
m_match = QPointer< QWidget >( match );
|
||||||
m_input = QPointer< QWidget >( combo );
|
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
|
else
|
||||||
{
|
{
|
||||||
m_match = QPointer<QWidget>( new QWidget );
|
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();
|
calculateSummary();
|
||||||
}
|
}
|
||||||
@@ -745,6 +773,13 @@ Tomahawk::EchonestControl::updateWidgetsFromData()
|
|||||||
combo->setCurrentIndex( combo->findData( songType ) );
|
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();
|
calculateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1005,7 +1040,14 @@ Tomahawk::EchonestControl::calculateSummary()
|
|||||||
else
|
else
|
||||||
summary = tr( "where song type is not %1" ).arg( text );
|
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;
|
m_summary = summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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", "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", "Latitude" ) << QT_TRANSLATE_NOOP( "Type selector", "Mode" )
|
||||||
<< QT_TRANSLATE_NOOP( "Type selector", "Key" ) << QT_TRANSLATE_NOOP( "Type selector", "Sorting" )
|
<< 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;
|
return types;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user