mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
* Store last processed dbcmd guid in Source in case a DBSyncConnection dies on us.
This commit is contained in:
@@ -133,6 +133,7 @@ DBSyncConnection::check()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_ASSERT( m_cmds.isEmpty() );
|
||||||
m_uscache.clear();
|
m_uscache.clear();
|
||||||
m_us.clear();
|
m_us.clear();
|
||||||
|
|
||||||
@@ -143,10 +144,16 @@ DBSyncConnection::check()
|
|||||||
connect( cmd_us, SIGNAL( done( QVariantMap ) ), SLOT( gotUs( QVariantMap ) ) );
|
connect( cmd_us, SIGNAL( done( QVariantMap ) ), SLOT( gotUs( QVariantMap ) ) );
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_us) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_us) );
|
||||||
|
|
||||||
Q_ASSERT( m_cmds.isEmpty() );
|
if ( m_source->lastCmdGuid().isEmpty() )
|
||||||
|
{
|
||||||
DatabaseCommand_CollectionStats* cmd_them = new DatabaseCommand_CollectionStats( m_source );
|
DatabaseCommand_CollectionStats* cmd_them = new DatabaseCommand_CollectionStats( m_source );
|
||||||
connect( cmd_them, SIGNAL( done( QVariantMap ) ), SLOT( gotThem( QVariantMap ) ) );
|
connect( cmd_them, SIGNAL( done( QVariantMap ) ), SLOT( gotThem( QVariantMap ) ) );
|
||||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_them) );
|
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_them) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fetchOpsData( m_source->lastCmdGuid() );
|
||||||
|
}
|
||||||
|
|
||||||
// restarts idle countdown
|
// restarts idle countdown
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
@@ -267,6 +274,9 @@ DBSyncConnection::executeCommands()
|
|||||||
if ( !m_cmds.isEmpty() )
|
if ( !m_cmds.isEmpty() )
|
||||||
{
|
{
|
||||||
QSharedPointer<DatabaseCommand> cmd = m_cmds.takeFirst();
|
QSharedPointer<DatabaseCommand> cmd = m_cmds.takeFirst();
|
||||||
|
if ( !cmd->singletonCmd() )
|
||||||
|
m_source->setLastCmdGuid( cmd->guid() );
|
||||||
|
|
||||||
connect( cmd.data(), SIGNAL( finished() ), SLOT( executeCommands() ) );
|
connect( cmd.data(), SIGNAL( finished() ), SLOT( executeCommands() ) );
|
||||||
Database::instance()->enqueue( cmd );
|
Database::instance()->enqueue( cmd );
|
||||||
}
|
}
|
||||||
|
@@ -45,8 +45,6 @@ Source::Source( int id, const QString& username )
|
|||||||
, m_avatar( 0 )
|
, m_avatar( 0 )
|
||||||
, m_fancyAvatar( 0 )
|
, m_fancyAvatar( 0 )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << id << username;
|
|
||||||
|
|
||||||
m_scrubFriendlyName = qApp->arguments().contains( "--demo" );
|
m_scrubFriendlyName = qApp->arguments().contains( "--demo" );
|
||||||
|
|
||||||
if ( id == 0 )
|
if ( id == 0 )
|
||||||
|
@@ -102,6 +102,8 @@ public slots:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void dbLoaded( unsigned int id, const QString& fname );
|
void dbLoaded( unsigned int id, const QString& fname );
|
||||||
|
QString lastCmdGuid() const { return m_lastCmdGuid; }
|
||||||
|
void setLastCmdGuid( const QString& guid ) { m_lastCmdGuid = guid; }
|
||||||
|
|
||||||
void setOffline();
|
void setOffline();
|
||||||
void setOnline();
|
void setOnline();
|
||||||
@@ -114,12 +116,15 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void reportSocialAttributesChanged();
|
void reportSocialAttributesChanged();
|
||||||
|
|
||||||
bool m_isLocal;
|
|
||||||
bool m_online;
|
|
||||||
QString m_username, m_friendlyname;
|
|
||||||
int m_id;
|
|
||||||
QList< QSharedPointer<Collection> > m_collections;
|
QList< QSharedPointer<Collection> > m_collections;
|
||||||
QVariantMap m_stats;
|
QVariantMap m_stats;
|
||||||
|
QString m_lastCmdGuid;
|
||||||
|
|
||||||
|
bool m_isLocal;
|
||||||
|
bool m_online;
|
||||||
|
QString m_username;
|
||||||
|
QString m_friendlyname;
|
||||||
|
int m_id;
|
||||||
bool m_scrubFriendlyName;
|
bool m_scrubFriendlyName;
|
||||||
|
|
||||||
Tomahawk::query_ptr m_currentTrack;
|
Tomahawk::query_ptr m_currentTrack;
|
||||||
|
Reference in New Issue
Block a user