1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 00:54:20 +02:00

* Use native data-types instead of a QVariantMap to store Query / Result related information.

* Don't generate uuids for Queries before we actually need them.
This commit is contained in:
Christian Muehlhaeuser
2010-10-17 06:16:33 +02:00
parent 1f592fbbd9
commit 38b907fe38
4 changed files with 52 additions and 21 deletions

View File

@@ -32,7 +32,7 @@ Query::addResults( const QList< Tomahawk::result_ptr >& newresults )
void
Query::resultUnavailable()
{
Result * result = (Result*) sender();
Result* result = (Result*) sender();
Q_ASSERT( result );
for(int i = 0; i < m_results.length(); ++i )
@@ -83,8 +83,12 @@ QID Query::id() const
{
if ( m_qid.isEmpty() )
{
m_qid = m_v.toMap().value( "qid" ).toString();
Q_ASSERT( !m_qid.isEmpty() );
m_qid = uuid();
QVariantMap m = m_v.toMap();
m.insert( "qid", m_qid );
m_v = m;
}
return m_qid;
}

View File

@@ -3,10 +3,23 @@
using namespace Tomahawk;
Result::Result( QVariant v, collection_ptr collection )
Result::Result( const QVariant& v, const collection_ptr& collection )
: m_v( v )
, m_collection( collection )
{
QVariantMap m = m_v.toMap();
m_artist = m.value( "artist" ).toString();
m_album = m.value( "album" ).toString();
m_track = m.value( "track" ).toString();
m_url = m.value( "url" ).toString();
m_mimetype = m.value( "mimetype" ).toString();
m_duration = m.value( "duration" ).toUInt();
m_bitrate = m.value( "bitrate" ).toUInt();
m_size = m.value( "size" ).toUInt();
m_albumpos = m.value( "albumpos" ).toUInt();
if ( !m_collection.isNull() )
connect( m_collection->source().data(), SIGNAL( offline() ), SIGNAL( becomingUnavailable() ), Qt::QueuedConnection );
}