1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-18 03:41:27 +02:00

Merge branch 'master' of github.com:tomahawk-player/tomahawk

This commit is contained in:
Jeff Mitchell
2011-08-28 02:17:49 -04:00
6 changed files with 63 additions and 57 deletions

View File

@@ -3,19 +3,23 @@ Version 0.3.0:
Version 0.2.3:
* Fixed an issue where the Twitter plugin could get out of sync if the
database was cleared, leading to eventual crashes when connecting to peers.
database was cleared, leading to eventual crashes when re-connecting.
* Fixed duplicate albums showing up on Dashboard.
* Automatically sort search results by score.
* Fixed stations being stuck not fetching more songs.
* Fixed issue where artist bio could be referring to a different artist.
* Opening a "tomahawk" URL (or other URL with Tomahawk) brings the Tomahawk
window to the foreground.
Version 0.2.2:
* Fixed crash when pressing previous and next when playing a song from the Queue.
* Fixed issue where wrench for newly added resolvers would not show up immediately.
* Fixed crash pressing previous and next when playing a song from the Queue.
* Fixed issue where wrench for newly added resolvers would not show up.
* Fixed sidebar statistics not updating after collection scan finished.
* Fixed omitting a few tracks in the Collection tree-view.
* Fixed sidebar & track sorting issues.
* Seek- & volume sliders now directly jump to the position you clicked on.
* Added ability to drag artists and albums within Tomahawk (to playlists, queue, etc.).
* Added ability to drag artists and albums within Tomahawk.
* (OS X) Fixed Ogg Vorbis support.
Version 0.2.1:
* Fixed crashing trying to play an unavailable track.

View File

@@ -57,11 +57,7 @@ DatabaseCommand_CollectionStats::exec( DatabaseImpl* dbi )
{
m.insert( "numfiles", query.value( 0 ).toInt() );
m.insert( "lastmodified", query.value( 1 ).toInt() );
if ( !source()->isLocal() && !source()->lastOpGuid().isEmpty() )
m.insert( "lastop", source()->lastOpGuid() );
else
m.insert( "lastop", query.value( 2 ).toString() );
m.insert( "lastop", query.value( 2 ).toString() );
}
emit done( m );

View File

@@ -134,27 +134,23 @@ DBSyncConnection::check()
}
m_uscache.clear();
m_themcache.clear();
m_us.clear();
changeState( CHECKING );
// load last-modified etc data for our collection and theirs from our DB:
DatabaseCommand_CollectionStats* cmd_us =
new DatabaseCommand_CollectionStats( SourceList::instance()->getLocal() );
DatabaseCommand_CollectionStats* cmd_them =
new DatabaseCommand_CollectionStats( m_source );
connect( cmd_us, SIGNAL( done( QVariantMap ) ),
SLOT( gotUs( QVariantMap ) ) );
connect( cmd_them, SIGNAL( done( QVariantMap ) ),
SLOT( gotThemCache( QVariantMap ) ) );
DatabaseCommand_CollectionStats* cmd_us = new DatabaseCommand_CollectionStats( SourceList::instance()->getLocal() );
connect( cmd_us, SIGNAL( done( QVariantMap ) ), SLOT( gotUs( QVariantMap ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_us) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_them) );
if ( m_lastop.isEmpty() )
{
DatabaseCommand_CollectionStats* cmd_them = new DatabaseCommand_CollectionStats( m_source );
connect( cmd_them, SIGNAL( done( QVariantMap ) ), SLOT( gotThem( QVariantMap ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_them) );
}
else
fetchOpsData( m_lastop );
// restarts idle countdown
m_timer.start();
@@ -174,16 +170,24 @@ DBSyncConnection::gotUs( const QVariantMap& m )
/// Called once we've loaded our cached data about their collection
void
DBSyncConnection::gotThemCache( const QVariantMap& m )
DBSyncConnection::gotThem( const QVariantMap& m )
{
m_lastop = m.value( "lastop" ).toString();
fetchOpsData( m_lastop );
}
void
DBSyncConnection::fetchOpsData( const QString& sinceguid )
{
m_themcache = m;
changeState( FETCHING );
tLog() << "Sending a FETCHOPS cmd since:" << m_themcache.value( "lastop" ).toString();
tLog() << "Sending a FETCHOPS cmd since:" << sinceguid;
QVariantMap msg;
msg.insert( "method", "fetchops" );
msg.insert( "lastop", m_themcache.value( "lastop" ).toString() );
msg.insert( "lastop", sinceguid );
sendMsg( msg );
}
@@ -234,8 +238,7 @@ DBSyncConnection::handleMsg( msg_ptr msg )
lastOpApplied();
return;
}
// qDebug() << "APPLYING CMD" << cmd->commandname() << cmd->guid();
QSharedPointer<DatabaseCommand> cmdsp = QSharedPointer<DatabaseCommand>(cmd);
if ( !msg->is( Msg::FRAGMENT ) ) // last msg in this batch
{
@@ -243,10 +246,21 @@ DBSyncConnection::handleMsg( msg_ptr msg )
connect( cmd, SIGNAL( finished() ), SLOT( lastOpApplied() ) );
}
if ( !cmd->singletonCmd() )
m_source->setLastOpGuid( cmd->guid() );
if ( m_recentTempOps.contains( cmd->guid() ) )
{
qDebug() << "Ignoring dupe temporary command:" << cmd->guid();
return;
}
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
if ( !cmd->singletonCmd() )
{
m_lastop = cmd->guid();
m_recentTempOps.clear();
}
else
m_recentTempOps << cmd->guid();
Database::instance()->enqueue( cmdsp );
return;
}

View File

@@ -64,9 +64,13 @@ public slots:
private slots:
void gotUs( const QVariantMap& m );
void gotThemCache( const QVariantMap& m );
void lastOpApplied();
void gotThem( const QVariantMap& m );
void fetchOpsData( const QString& sinceguid );
void sendOpsData( QString sinceguid, QString lastguid, QList< dbop_ptr > ops );
void lastOpApplied();
void check();
void idleTimeout();
@@ -76,11 +80,13 @@ private:
void changeState( State newstate );
Tomahawk::source_ptr m_source;
QVariantMap m_us, m_uscache, m_themcache;
State m_state;
QVariantMap m_us, m_uscache;
QString m_lastop;
QString m_lastSentOp;
QStringList m_recentTempOps;
State m_state;
QTimer m_timer;
};

View File

@@ -74,7 +74,7 @@ Source::setControlConnection( ControlConnection* cc )
{
m_cc = cc;
if ( cc )
connect( cc, SIGNAL( finished() ), SLOT( remove() ), Qt::QueuedConnection );
connect( cc, SIGNAL( finished() ), SLOT( setOffline() ), Qt::QueuedConnection );
}
@@ -97,15 +97,6 @@ Source::setStats( const QVariantMap& m )
}
void
Source::remove()
{
qDebug() << Q_FUNC_INFO;
setOffline();
}
QString
Source::friendlyName() const
{

View File

@@ -40,8 +40,9 @@ class DLLEXPORT Source : public QObject
{
Q_OBJECT
friend class ::DatabaseCommand_LogPlayback;
friend class ::DBSyncConnection;
friend class ::ControlConnection;
friend class ::DatabaseCommand_LogPlayback;
friend class ::DatabaseCommand_SocialAction;
public:
@@ -53,8 +54,6 @@ public:
bool isLocal() const { return m_isLocal; }
bool isOnline() const { return m_online; }
QString lastOpGuid() const { return m_lastOpGuid; }
QString userName() const { return m_username; }
QString friendlyName() const;
void setFriendlyName( const QString& fname );
@@ -73,9 +72,6 @@ public:
void scanningProgress( unsigned int files );
void scanningFinished( unsigned int files );
void setOffline();
void setOnline();
unsigned int trackCount() const;
Tomahawk::query_ptr currentTrack() const { return m_currentTrack; }
@@ -105,10 +101,10 @@ public slots:
void setStats( const QVariantMap& m );
private slots:
void setLastOpGuid( const QString& guid ) { m_lastOpGuid = guid; }
void dbLoaded( unsigned int id, const QString& fname );
void remove();
void setOffline();
void setOnline();
void onStateChanged( DBSyncConnection::State newstate, DBSyncConnection::State oldstate, const QString& info );
void onPlaybackStarted( const Tomahawk::query_ptr& query );
@@ -124,7 +120,6 @@ private:
int m_id;
QList< QSharedPointer<Collection> > m_collections;
QVariantMap m_stats;
QString m_lastOpGuid;
bool m_scrubFriendlyName;
Tomahawk::query_ptr m_currentTrack;