mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-20 07:52:30 +02:00
Add an "apply steering" button to make it clearer how to steer
Remove some super spammy debug
This commit is contained in:
parent
cb072fcf2c
commit
9f009f5979
BIN
data/images/apply-check.png
Normal file
BIN
data/images/apply-check.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -98,6 +98,7 @@
|
||||
<file>data/images/track-icon-22x22.png</file>
|
||||
<file>data/images/track-icon-32x32.png</file>
|
||||
<file>data/images/track-icon-16x16.png</file>
|
||||
<file>data/images/apply-check.png</file>
|
||||
<file>data/stylesheets/topbar-radiobuttons.css</file>
|
||||
<file>data/icons/tomahawk-icon-16x16.png</file>
|
||||
<file>data/icons/tomahawk-icon-32x32.png</file>
|
||||
|
@ -114,7 +114,7 @@ JobStatusModel::itemFinished()
|
||||
JobStatusItem* item = qobject_cast< JobStatusItem* >( sender() );
|
||||
Q_ASSERT( item );
|
||||
|
||||
tDebug() << "Got item finished:" << item->type() << item->mainText() << item;
|
||||
// tDebug() << "Got item finished:" << item->type() << item->mainText() << item;
|
||||
if ( !m_items.contains( item ) && !m_collapseCount.contains( item->type() ) )
|
||||
return;
|
||||
|
||||
@ -140,7 +140,7 @@ JobStatusModel::itemFinished()
|
||||
// qDebug() << "Replaced" << m_collapseCount[ item->type() ].first() << "with:" << m_collapseCount[ item->type() ][ 1 ] << m_items;
|
||||
}
|
||||
m_collapseCount[ item->type() ].removeAll( item );
|
||||
tDebug() << "New collapse count list:" << m_collapseCount[ item->type() ];
|
||||
// tDebug() << "New collapse count list:" << m_collapseCount[ item->type() ];
|
||||
if ( m_collapseCount[ item->type() ].isEmpty() )
|
||||
m_collapseCount.remove( item->type() );
|
||||
else
|
||||
|
@ -389,9 +389,6 @@ EchonestGenerator::dynamicFetched()
|
||||
|
||||
resetSteering();
|
||||
|
||||
if( !m_steerer.isNull() )
|
||||
m_steerer.data()->resetSteering( true );
|
||||
|
||||
try
|
||||
{
|
||||
Echonest::Song song = m_dynPlaylist->parseNextSong( reply );
|
||||
|
@ -97,6 +97,12 @@ EchonestSteerer::EchonestSteerer( QWidget* parent )
|
||||
|
||||
connect( m_description, SIGNAL( textChanged( QString ) ), this, SLOT( changed() ) );
|
||||
|
||||
m_apply = initButton( this );
|
||||
m_apply->setIcon( QIcon( RESPATH "images/apply-check.png" ) );
|
||||
m_apply->setToolTip( tr( "Apply steering command" ) );
|
||||
m_layout->addWidget( m_apply );
|
||||
connect( m_apply, SIGNAL( clicked( bool ) ), this, SLOT( applySteering() ) );
|
||||
|
||||
m_reset = initButton( this );
|
||||
m_reset->setIcon( QIcon( RESPATH "images/view-refresh.png" ) );
|
||||
m_reset->setToolTip( tr( "Reset all steering commands" ) );
|
||||
@ -165,19 +171,7 @@ EchonestSteerer::fadeOut()
|
||||
void
|
||||
EchonestSteerer::changed()
|
||||
{
|
||||
bool keep = false;
|
||||
if( m_amplifier->itemData( m_amplifier->currentIndex() ).toString().isEmpty() ) { // Keep Current
|
||||
keep = true;
|
||||
|
||||
emit reset();
|
||||
}
|
||||
|
||||
if( m_field->itemData( m_field->currentIndex() ).toString() != "desc" ) {
|
||||
if( !keep ) {
|
||||
QString steer = m_field->itemData( m_field->currentIndex() ).toString() + m_amplifier->itemData( m_amplifier->currentIndex() ).toString();
|
||||
emit steerField( steer );
|
||||
}
|
||||
|
||||
// if description was shown, animate to shrink
|
||||
if( m_layout->indexOf( m_description ) > 0 ) {
|
||||
m_expanding = false;
|
||||
@ -190,15 +184,8 @@ EchonestSteerer::changed()
|
||||
|
||||
m_resizeAnim.setFrameRange( start, end );
|
||||
m_resizeAnim.start();
|
||||
|
||||
qDebug() << "COLLAPSING FROM" << start << "TO" << end;
|
||||
}
|
||||
} else { // description, so put in the description field
|
||||
if( !m_description->text().isEmpty() && !keep ) {
|
||||
QString steer = m_description->text() + m_amplifier->itemData( m_amplifier->currentIndex() ).toString();
|
||||
emit steerDescription( steer );
|
||||
}
|
||||
|
||||
if( m_layout->indexOf( m_description ) == -1 ) {
|
||||
// animate to expand
|
||||
m_layout->insertWidget( m_layout->count() - 1, m_description, 1 );
|
||||
@ -210,12 +197,30 @@ EchonestSteerer::changed()
|
||||
int end = start + m_layout->spacing() + m_description->sizeHint().width();
|
||||
m_resizeAnim.setFrameRange( start, end );
|
||||
m_resizeAnim.start();
|
||||
|
||||
qDebug() << "EXPANDING FROM" << start << "TO" << end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EchonestSteerer::applySteering()
|
||||
{
|
||||
if ( m_field->itemData( m_field->currentIndex() ).toString() != "desc" )
|
||||
{
|
||||
QString steer = m_field->itemData( m_field->currentIndex() ).toString() + m_amplifier->itemData( m_amplifier->currentIndex() ).toString();
|
||||
emit steerField( steer );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_description->text().isEmpty() )
|
||||
{
|
||||
QString steer = m_description->text() + m_amplifier->itemData( m_amplifier->currentIndex() ).toString();
|
||||
emit steerDescription( steer );
|
||||
}
|
||||
}
|
||||
|
||||
resetSteering( true );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchonestSteerer::resizeFrame( int width )
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
virtual void paintEvent(QPaintEvent* );
|
||||
|
||||
public slots:
|
||||
void applySteering();
|
||||
void resetSteering( bool automatic = false );
|
||||
|
||||
void fadeIn();
|
||||
@ -77,6 +78,7 @@ private:
|
||||
QLabel* m_steerBottom;
|
||||
|
||||
// icons on the right
|
||||
QToolButton* m_apply;
|
||||
QToolButton* m_reset;
|
||||
|
||||
// animations
|
||||
|
@ -102,8 +102,6 @@ Query::Query( const QString& query, const QID& qid )
|
||||
|
||||
Query::~Query()
|
||||
{
|
||||
tDebug() << Q_FUNC_INFO << toString();
|
||||
|
||||
if ( !id().isEmpty() )
|
||||
{
|
||||
QMutexLocker lock( &s_mutex );
|
||||
|
Loading…
x
Reference in New Issue
Block a user