diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp b/src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp index 3f299524d..80af95037 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestControl.cpp @@ -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( match ); + m_input = QPointer( combo ); + } else { m_match = QPointer( 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; } diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp index e2b40e6c6..da3f7fe3a 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp @@ -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; }