mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-05 08:32:42 +02:00
Expire logplayback commands in the UI after 10minites, they are stale
Fixes TWK-39
This commit is contained in:
parent
d71bdb2fef
commit
9236da101e
@ -45,7 +45,7 @@ DatabaseCommand_LogPlayback::postCommitHook()
|
||||
{
|
||||
emit trackPlayed( q );
|
||||
}
|
||||
else if ( m_action == Started )
|
||||
else if ( m_action == Started && QDateTime::fromTime_t( playtime() ).secsTo( QDateTime::currentDateTime() ) < 600 ) // if the play time is more than 10 minutes in the past, ignore
|
||||
{
|
||||
emit trackPlaying( q );
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "network/controlconnection.h"
|
||||
#include "database/databasecommand_addsource.h"
|
||||
#include "database/databasecommand_sourceoffline.h"
|
||||
#include "database/databasecommand_logplayback.h"
|
||||
#include "database/database.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
@ -50,6 +49,10 @@ Source::Source( int id, const QString& username )
|
||||
m_isLocal = true;
|
||||
m_online = true;
|
||||
}
|
||||
|
||||
m_currentTrackTimer.setInterval( 600000 ); // 10 minutes
|
||||
m_currentTrackTimer.setSingleShot( true );
|
||||
connect( &m_currentTrackTimer, SIGNAL( timeout() ), this, SLOT( trackTimerFired() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -278,4 +281,14 @@ Source::onPlaybackFinished( const Tomahawk::query_ptr& query )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << query->toString();
|
||||
emit playbackFinished( query );
|
||||
|
||||
m_currentTrackTimer.start();
|
||||
}
|
||||
|
||||
void
|
||||
Source::trackTimerFired()
|
||||
{
|
||||
m_currentTrack.clear();
|
||||
|
||||
emit stateChanged();
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ private slots:
|
||||
void onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::State oldstate, const QString& info );
|
||||
void onPlaybackStarted( const Tomahawk::query_ptr& query );
|
||||
void onPlaybackFinished( const Tomahawk::query_ptr& query );
|
||||
void trackTimerFired();
|
||||
|
||||
private:
|
||||
bool m_isLocal;
|
||||
@ -118,6 +119,7 @@ private:
|
||||
|
||||
Tomahawk::query_ptr m_currentTrack;
|
||||
QString m_textStatus;
|
||||
QTimer m_currentTrackTimer;
|
||||
|
||||
ControlConnection* m_cc;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user