mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Added correct Widget Update after Startup & Summary Text for Song Type Support
This commit is contained in:
@@ -449,17 +449,17 @@ Tomahawk::EchonestControl::updateWidgets()
|
|||||||
match->addItem( tr( "is not" ), 0 );
|
match->addItem( tr( "is not" ), 0 );
|
||||||
|
|
||||||
QComboBox* combo = new QComboBox();
|
QComboBox* combo = new QComboBox();
|
||||||
combo->addItem( tr( "Christmas" ), "christmas" );
|
|
||||||
combo->addItem( tr( "Studio" ), "studio" );
|
combo->addItem( tr( "Studio" ), "studio" );
|
||||||
combo->addItem( tr( "Live" ), "live" );
|
combo->addItem( tr( "Live" ), "live" );
|
||||||
|
combo->addItem( tr( "Christmas" ), "christmas" );
|
||||||
|
|
||||||
connect( match, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
connect( match, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( match, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
connect( match, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
||||||
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
connect( combo, SIGNAL( activated( int ) ), this, SLOT( updateData() ) );
|
||||||
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
connect( combo, SIGNAL( activated( int ) ), this, SLOT( editingFinished() ) );
|
||||||
|
|
||||||
m_matchString = match->currentText();
|
m_matchString = "is";
|
||||||
m_matchData = match->currentText();
|
m_matchData = 1;
|
||||||
|
|
||||||
m_match = QWeakPointer< QWidget >( match );
|
m_match = QWeakPointer< QWidget >( match );
|
||||||
m_input = QWeakPointer< QWidget >( combo );
|
m_input = QWeakPointer< QWidget >( combo );
|
||||||
@@ -546,17 +546,15 @@ Tomahawk::EchonestControl::updateData()
|
|||||||
}
|
}
|
||||||
} else if( selectedType() == "Song Type" ) {
|
} else if( selectedType() == "Song Type" ) {
|
||||||
QComboBox* match = qobject_cast<QComboBox*>( m_match.data() );
|
QComboBox* match = qobject_cast<QComboBox*>( m_match.data() );
|
||||||
QComboBox* input = qobject_cast< QComboBox* >( m_input.data() );
|
QComboBox* combo = qobject_cast< QComboBox* >( m_input.data() );
|
||||||
if ( match && input ) {
|
if ( match && combo ) {
|
||||||
m_matchString = match->currentText();
|
m_matchString = match->currentText();
|
||||||
m_matchData = match->itemData( match->currentIndex() ).toString();
|
m_matchData = match->itemData( match->currentIndex() ).toString();
|
||||||
|
|
||||||
QString songType = input->currentText().toLower();
|
QString songType = combo->currentText().toLower();
|
||||||
if ( match->currentText() == "is not" )
|
if ( match->currentText() == "is not" )
|
||||||
songType.append(":false");
|
songType.append(":false");
|
||||||
|
|
||||||
qDebug() << "ST: " << songType;
|
|
||||||
|
|
||||||
m_data.first = Echonest::DynamicPlaylist::SongType;
|
m_data.first = Echonest::DynamicPlaylist::SongType;
|
||||||
m_data.second = songType;
|
m_data.second = songType;
|
||||||
}
|
}
|
||||||
@@ -650,6 +648,15 @@ Tomahawk::EchonestControl::updateWidgetsFromData()
|
|||||||
input->setCurrentIndex( val );
|
input->setCurrentIndex( val );
|
||||||
// qDebug() << "LOADING" << m_data.second.toInt() << "AS" << val;
|
// qDebug() << "LOADING" << m_data.second.toInt() << "AS" << val;
|
||||||
}
|
}
|
||||||
|
} else if( selectedType() == "Song Type" ) {
|
||||||
|
QComboBox* match = qobject_cast<QComboBox*>( m_match.data() );
|
||||||
|
QComboBox* combo = qobject_cast< QComboBox* >( m_input.data() );
|
||||||
|
if ( match && combo ) {
|
||||||
|
match->setCurrentIndex( match->findData( m_matchData ));
|
||||||
|
|
||||||
|
QString songType = m_data.second.toString().split(":").at(0);
|
||||||
|
combo->setCurrentIndex( combo->findData( songType ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
calculateSummary();
|
calculateSummary();
|
||||||
}
|
}
|
||||||
@@ -862,6 +869,19 @@ Tomahawk::EchonestControl::calculateSummary()
|
|||||||
Q_ASSERT( qobject_cast< QComboBox* >( m_input.data() ) );
|
Q_ASSERT( qobject_cast< QComboBox* >( m_input.data() ) );
|
||||||
QString text = qobject_cast< QComboBox* >( m_input.data() )->currentText().toLower();
|
QString text = qobject_cast< QComboBox* >( m_input.data() )->currentText().toLower();
|
||||||
summary = tr( "in a %1 style" ).arg( text );
|
summary = tr( "in a %1 style" ).arg( text );
|
||||||
|
} else if( selectedType() == "Song Type" ) {
|
||||||
|
Q_ASSERT( !m_input.isNull() );
|
||||||
|
Q_ASSERT( qobject_cast< QComboBox* >( m_input.data() ) );
|
||||||
|
QString text = qobject_cast< QComboBox* >( m_input.data() )->currentText();
|
||||||
|
|
||||||
|
|
||||||
|
Q_ASSERT( !m_match.isNull() );
|
||||||
|
Q_ASSERT( qobject_cast< QComboBox* >( m_match.data() ) );
|
||||||
|
QString isOrIsNot = qobject_cast< QComboBox* >( m_match.data() )->currentText().toLower();
|
||||||
|
if ( isOrIsNot == "is" )
|
||||||
|
summary = tr( "where Song Type is %1" ).arg( text );
|
||||||
|
else
|
||||||
|
summary = tr( "where Song Type is not %1" ).arg( text );
|
||||||
}
|
}
|
||||||
m_summary = summary;
|
m_summary = summary;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user