1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-24 01:39:42 +01:00

Add a timeout after last edit in artist line edits

This commit is contained in:
Leo Franchi 2011-05-17 16:00:11 +02:00
parent 6f37e942ce
commit 98c9ddf2b1
2 changed files with 8 additions and 1 deletions

View File

@ -33,8 +33,12 @@ Tomahawk::EchonestControl::EchonestControl( const QString& selectedType, const Q
setType( "echonest" );
m_editingTimer.setInterval( 500 ); //timeout to edits
m_editingTimer.setSingleShot( true );
connect( &m_editingTimer, SIGNAL( timeout() ), this, SLOT( editTimerFired() ) );
m_delayedEditTimer.setInterval( 250 ); // additional timer for "just typing" without enter or focus change
m_delayedEditTimer.setSingleShot( true );
connect( &m_delayedEditTimer, SIGNAL( timeout() ), &m_editingTimer, SLOT( start() ) );
updateWidgets();
}
@ -149,6 +153,7 @@ Tomahawk::EchonestControl::updateWidgets()
connect( input, SIGNAL( textChanged(QString) ), this, SLOT( updateData() ) );
connect( input, SIGNAL( editingFinished() ), this, SLOT( editingFinished() ) );
connect( input, SIGNAL( textEdited( QString ) ), &m_editingTimer, SLOT( stop() ) );
connect( input, SIGNAL( textEdited( QString ) ), &m_delayedEditTimer, SLOT( start() ) );
match->hide();
input->hide();
@ -166,6 +171,7 @@ Tomahawk::EchonestControl::updateWidgets()
connect( input, SIGNAL( textChanged(QString) ), this, SLOT( updateData() ) );
connect( input, SIGNAL( editingFinished() ), this, SLOT( editingFinished() ) );
connect( input, SIGNAL( textEdited( QString ) ), &m_editingTimer, SLOT( stop() ) );
connect( input, SIGNAL( textEdited( QString ) ), &m_delayedEditTimer, SLOT( start() ) );
match->hide();
input->hide();

View File

@ -80,6 +80,7 @@ private:
QString m_summary;
QTimer m_editingTimer;
QTimer m_delayedEditTimer;
Echonest::DynamicPlaylist::PlaylistParamData m_data;
QVariant m_cacheData;