Adjusted to use new TQStringVariantMap type.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 6 years ago
parent 7314bd7167
commit c41e90dac0
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -213,7 +213,7 @@ Reader::loginFinished( int /* id */, bool error )
http->deleteLater();
return;
}
Map loginResults = parse( http->results() , 0 ,true );
TQStringVariantMap loginResults = parse( http->results() , 0 ,true );
m_sessionId = loginResults["mlog"].asList()[0].asMap()["mlid"].asList()[0].asInt();
m_loginString = "session-id=" + TQString::number( m_sessionId );
@ -234,7 +234,7 @@ Reader::updateFinished( int /*id*/, bool error )
return;
}
Map updateResults = parse( http->results(), 0, true );
TQStringVariantMap updateResults = parse( http->results(), 0, true );
m_loginString = m_loginString + "&revision-number=" +
TQString::number( updateResults["mupd"].asList()[0].asMap()["musr"].asList()[0].asInt() );
@ -254,7 +254,7 @@ Reader::databaseIdFinished( int /*id*/, bool error )
return;
}
Map dbIdResults = parse( http->results(), 0, true );
TQStringVariantMap dbIdResults = parse( http->results(), 0, true );
m_databaseId = TQString::number( dbIdResults["avdb"].asList()[0].asMap()["mlcl"].asList()[0].asMap()["mlit"].asList()[0].asMap()["miid"].asList()[0].asInt() );
connect( http, TQT_SIGNAL( requestFinished( int, bool ) ), this, TQT_SLOT( songListFinished( int, bool ) ) );
http->getDaap( TQString("/databases/%1/items?type=music&meta=dmap.itemid,dmap.itemname,daap.songformat,daap.songartist,daap.songalbum,daap.songtime,daap.songtracknumber,daap.songcomment,daap.songyear,daap.songgenre&%2")
@ -273,7 +273,7 @@ Reader::songListFinished( int /*id*/, bool error )
return;
}
Map songResults = parse( http->results(), 0, true );
TQStringVariantMap songResults = parse( http->results(), 0, true );
SongList result;
TQValueList<TQVariant> songList;
@ -319,7 +319,7 @@ Reader::getTagAndLength( TQDataStream &raw, char tag[5] )
return tagLength;
}
Map
TQStringVariantMap
Reader::parse( TQDataStream &raw, uint containerLength, bool first )
{
//DEBUG_BLOCK
@ -327,7 +327,7 @@ Reader::parse( TQDataStream &raw, uint containerLength, bool first )
0-3 Content code OSType (unsigned long), description of the contents of this chunk
4-7 Length Length of the contents of this chunk (not the whole chunk)
8- Data The data contained within the chunk */
Map childMap;
TQStringVariantMap childMap;
uint index = 0;
while( (first ? !raw.atEnd() : ( index < containerLength ) ) )
{
@ -407,7 +407,7 @@ Reader::parse( TQDataStream &raw, uint containerLength, bool first )
}
void
Reader::addElement( Map &parentMap, char* tag, TQVariant element )
Reader::addElement( TQStringVariantMap &parentMap, char* tag, TQVariant element )
{
if( !parentMap.contains( tag ) )
parentMap[tag] = TQVariant( TQValueList<TQVariant>() );

@ -27,8 +27,6 @@ class TQHttpResponseHeader;
namespace Daap
{
typedef TQMap<TQString, TQVariant> Map;
typedef TQPtrList< MetaBundle > TrackList;
typedef TQMap< TQString, TrackList > AlbumList;
typedef TQMap< TQString, AlbumList > SongList;
@ -91,8 +89,8 @@ namespace Daap
* @param raw stream of DAAP reply
* @param containerLength length of the container (or entire result) being analyzed
*/
static Map parse( TQDataStream &raw, uint containerLength, bool first = false );
static void addElement( Map &parentMap, char* tag, TQVariant element ); //! supporter function for parse
static TQStringVariantMap parse( TQDataStream &raw, uint containerLength, bool first = false );
static void addElement( TQStringVariantMap &parentMap, char* tag, TQVariant element ); //! supporter function for parse
static TQ_UINT32 getTagAndLength( TQDataStream &raw, char tag[5] );
static TQMap<TQString, Code> s_codes;

Loading…
Cancel
Save