mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-08 23:26:40 +02:00
Expire logplayback commands in the UI after 10minites, they are stale
Fixes TWK-39
This commit is contained in:
@@ -45,7 +45,7 @@ DatabaseCommand_LogPlayback::postCommitHook()
|
|||||||
{
|
{
|
||||||
emit trackPlayed( q );
|
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 );
|
emit trackPlaying( q );
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
#include "network/controlconnection.h"
|
#include "network/controlconnection.h"
|
||||||
#include "database/databasecommand_addsource.h"
|
#include "database/databasecommand_addsource.h"
|
||||||
#include "database/databasecommand_sourceoffline.h"
|
#include "database/databasecommand_sourceoffline.h"
|
||||||
#include "database/databasecommand_logplayback.h"
|
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -50,6 +49,10 @@ Source::Source( int id, const QString& username )
|
|||||||
m_isLocal = true;
|
m_isLocal = true;
|
||||||
m_online = 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();
|
qDebug() << Q_FUNC_INFO << query->toString();
|
||||||
emit playbackFinished( query );
|
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 onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::State oldstate, const QString& info );
|
||||||
void onPlaybackStarted( const Tomahawk::query_ptr& query );
|
void onPlaybackStarted( const Tomahawk::query_ptr& query );
|
||||||
void onPlaybackFinished( const Tomahawk::query_ptr& query );
|
void onPlaybackFinished( const Tomahawk::query_ptr& query );
|
||||||
|
void trackTimerFired();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isLocal;
|
bool m_isLocal;
|
||||||
@@ -118,6 +119,7 @@ private:
|
|||||||
|
|
||||||
Tomahawk::query_ptr m_currentTrack;
|
Tomahawk::query_ptr m_currentTrack;
|
||||||
QString m_textStatus;
|
QString m_textStatus;
|
||||||
|
QTimer m_currentTrackTimer;
|
||||||
|
|
||||||
ControlConnection* m_cc;
|
ControlConnection* m_cc;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user