diff options
Diffstat (limited to 'amarok/src/lastfm.cpp')
-rw-r--r-- | amarok/src/lastfm.cpp | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/amarok/src/lastfm.cpp b/amarok/src/lastfm.cpp index 0f57049f..fa9964d8 100644 --- a/amarok/src/lastfm.cpp +++ b/amarok/src/lastfm.cpp @@ -50,9 +50,9 @@ using namespace LastFm; // AmarokHttp is a hack written so that lastfm code could easily use something proxy aware. // DO NOT use this class for anything else, use KIO directly instead. //////////////////////////////////////////////////////////////////////////////// -AmarokHttp::AmarokHttp ( const TQString& hostname, Q_UINT16 port, - TQObject* parent ) - : TQObject( parent ), +AmarokHttp::AmarokHttp ( const TQString& hostname, TQ_UINT16 port, + TQObject* tqparent ) + : TQObject( tqparent ), m_hostname( hostname ), m_port( port ) {} @@ -61,9 +61,9 @@ int AmarokHttp::get ( const TQString & path ) { TQString uri = TQString( "http://%1:%2/%3" ) - .arg( m_hostname ) - .arg( m_port ) - .arg( path ); + .tqarg( m_hostname ) + .tqarg( m_port ) + .tqarg( path ); m_done = false; m_error = TQHttp::NoError; @@ -83,7 +83,7 @@ AmarokHttp::state() const return m_state; } -QByteArray +TQByteArray AmarokHttp::readAll () { return m_result; @@ -104,7 +104,7 @@ AmarokHttp::slotData(KIO::Job*, const TQByteArray& data) else if ( m_result.size() == 0 ) { m_result = data; } - else if ( m_result.resize( m_result.size() + data.size() ) ) { + else if ( m_result.tqresize( m_result.size() + data.size() ) ) { memcpy( m_result.end(), data.data(), data.size() ); } } @@ -138,13 +138,13 @@ Controller::Controller() { KActionCollection* ac = Amarok::actionCollection(); m_actionList.append( new KAction( i18n( "Ban" ), Amarok::icon( "remove" ), - KKey( Qt::CTRL | Qt::Key_B ), this, TQT_SLOT( ban() ), ac, "ban" ) ); + KKey( TQt::CTRL | TQt::Key_B ), this, TQT_SLOT( ban() ), ac, "ban" ) ); m_actionList.append( new KAction( i18n( "Love" ), Amarok::icon( "love" ), - KKey( Qt::CTRL | Qt::Key_L ), this, TQT_SLOT( love() ), ac, "love" ) ); + KKey( TQt::CTRL | TQt::Key_L ), this, TQT_SLOT( love() ), ac, "love" ) ); m_actionList.append( new KAction( i18n( "Skip" ), Amarok::icon( "next" ), - KKey( Qt::CTRL | Qt::Key_K ), this, TQT_SLOT( skip() ), ac, "skip" ) ); + KKey( TQt::CTRL | TQt::Key_K ), this, TQT_SLOT( skip() ), ac, "skip" ) ); setActionsEnabled( false ); } @@ -244,7 +244,7 @@ Controller::checkCredentials() //static } -QString +TQString Controller::createCustomStation() //static { TQString token; @@ -295,7 +295,7 @@ Controller::setActionsEnabled( bool enable ) } /// return a translatable description of the station we are connected to -QString +TQString Controller::stationDescription( TQString url ) { if( url.isEmpty() && instance() && instance()->isPlaying() ) @@ -308,17 +308,17 @@ Controller::stationDescription( TQString url ) /// TAG RADIOS // eg: lastfm://globaltag/rock if ( elements[1] == "globaltags" ) - return i18n( "Global Tag Radio: %1" ).arg( elements[2] ); + return i18n( "Global Tag Radio: %1" ).tqarg( elements[2] ); /// ARTIST RADIOS if ( elements[1] == "artist" ) { // eg: lastfm://artist/Queen/similarartists if ( elements[3] == "similarartists" ) - return i18n( "Similar Artists to %1" ).arg( elements[2] ); + return i18n( "Similar Artists to %1" ).tqarg( elements[2] ); if ( elements[3] == "fans" ) - return i18n( "Artist Fan Radio: %1" ).arg( elements[2] ); + return i18n( "Artist Fan Radio: %1" ).tqarg( elements[2] ); } /// CUSTOM STATION @@ -328,15 +328,15 @@ Controller::stationDescription( TQString url ) // turn "genesis,pink floyd,queen" into "Genesis, Pink Floyd, Queen" TQString artists = elements[2]; - artists.replace( ",", ", " ); + artists.tqreplace( ",", ", " ); const TQStringList words = TQStringList::split( " ", TQString( artists ).remove( "," ) ); foreach( words ) { TQString capitalized = *it; - capitalized.replace( 0, 1, (*it)[0].upper() ); - artists.replace( *it, capitalized ); + capitalized.tqreplace( 0, 1, (*it)[0].upper() ); + artists.tqreplace( *it, capitalized ); } - return i18n( "Custom Station: %1" ).arg( artists ); + return i18n( "Custom Station: %1" ).tqarg( artists ); } /// USER RADIOS @@ -344,25 +344,25 @@ Controller::stationDescription( TQString url ) { // eg: lastfm://user/sebr/neighbours if ( elements[3] == "neighbours" ) - return i18n( "%1's Neighbor Radio" ).arg( elements[2] ); + return i18n( "%1's Neighbor Radio" ).tqarg( elements[2] ); // eg: lastfm://user/sebr/personal if ( elements[3] == "personal" ) - return i18n( "%1's Personal Radio" ).arg( elements[2] ); + return i18n( "%1's Personal Radio" ).tqarg( elements[2] ); // eg: lastfm://user/sebr/loved if ( elements[3] == "loved" ) - return i18n( "%1's Loved Radio" ).arg( elements[2] ); + return i18n( "%1's Loved Radio" ).tqarg( elements[2] ); // eg: lastfm://user/sebr/recommended/100 : 100 is number for how obscure the music should be if ( elements[3] == "recommended" ) - return i18n( "%1's Recommended Radio" ).arg( elements[2] ); + return i18n( "%1's Recommended Radio" ).tqarg( elements[2] ); } /// GROUP RADIOS //eg: lastfm://group/Amarok%20users else if ( elements[1] == "group" ) - return i18n( "Group Radio: %1" ).arg( elements[2] ); + return i18n( "Group Radio: %1" ).tqarg( elements[2] ); /// TRACK RADIOS else if ( elements[1] == "play" ) @@ -382,8 +382,8 @@ Controller::stationDescription( TQString url ) // CLASS WebService //////////////////////////////////////////////////////////////////////////////// -WebService::WebService( TQObject* parent, bool useProxy ) - : TQObject( parent, "lastfmParent" ) +WebService::WebService( TQObject* tqparent, bool useProxy ) + : TQObject( tqparent, "lastfmParent" ) , m_useProxy( useProxy ) , m_deletionUnsafe( false ) , m_wasCanceled( false ) @@ -429,11 +429,11 @@ WebService::handshake( const TQString& username, const TQString& password ) const TQString path = TQString( "/radio/handshake.php?version=%1&platform=%2&username=%3&passwordmd5=%4&debug=%5" ) - .arg( APP_VERSION ) //Muesli-approved: Amarok version, and Amarok-as-platform - .arg( TQString("Amarok") ) - .arg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) - .arg( KMD5( m_password.utf8() ).hexDigest() ) - .arg( "0" ); + .tqarg( APP_VERSION ) //Muesli-approved: Amarok version, and Amarok-as-platform + .tqarg( TQString("Amarok") ) + .tqarg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) + .tqarg( KMD5( m_password.utf8() ).hexDigest().data() ) + .tqarg( "0" ); http.get( path ); @@ -478,7 +478,7 @@ WebService::handshake( const TQString& username, const TQString& password ) debug() << "Proxy server using port: " << port << endl; delete socket; - m_proxyUrl = TQString( "http://localhost:%1/lastfm.mp3" ).arg( port ); + m_proxyUrl = TQString( "http://localhost:%1/lastfm.mp3" ).tqarg( port ); m_server = new Amarok::ProcIO(); m_server->setComm( KProcess::Communication( KProcess::AllOutput ) ); @@ -523,8 +523,8 @@ WebService::changeStation( TQString url ) AmarokHttp http( m_baseHost, 80 ); http.get( TQString( m_basePath + "/adjust.php?session=%1&url=%2&debug=0" ) - .arg( m_session ) - .arg( url ) ); + .tqarg( m_session ) + .tqarg( url ) ); m_deletionUnsafe = true; do @@ -556,7 +556,7 @@ WebService::changeStation( TQString url ) emit stationChanged( _url, m_station ); } else - emit stationChanged( _url, TQString::null ); + emit stationChanged( _url, TQString() ); return true; } @@ -568,8 +568,8 @@ WebService::requestMetaData() //SLOT connect( http, TQT_SIGNAL( requestFinished( int, bool ) ), this, TQT_SLOT( metaDataFinished( int, bool ) ) ); http->get( TQString( m_basePath + "/np.php?session=%1&debug=%2" ) - .arg( m_session ) - .arg( "0" ) ); + .tqarg( m_session ) + .tqarg( "0" ) ); } @@ -603,7 +603,7 @@ WebService::metaDataFinished( int /*id*/, bool error ) //SLOT if( imageUrl == "http://static.last.fm/coverart/" || imageUrl == "http://static.last.fm/depth/catalogue/no_album_large.gif" ) - imageUrl = TQString::null; + imageUrl = TQString(); lastFmStuff.setImageUrl ( CollectionDB::instance()->notAvailCover( true ) ); lastFmStuff.setArtistUrl( parameter( "artist_url", result ) ); @@ -655,9 +655,9 @@ WebService::enableScrobbling( bool enabled ) //SLOT connect( http, TQT_SIGNAL( requestFinished( int, bool ) ), this, TQT_SLOT( enableScrobblingFinished( int, bool ) ) ); http->get( TQString( m_basePath + "/control.php?session=%1&command=%2&debug=%3" ) - .arg( m_session ) - .arg( enabled ? TQString( "rtp" ) : TQString( "nortp" ) ) - .arg( "0" ) ); + .tqarg( m_session ) + .tqarg( enabled ? TQString( "rtp" ) : TQString( "nortp" ) ) + .tqarg( "0" ) ); } @@ -679,8 +679,8 @@ WebService::love() //SLOT connect( http, TQT_SIGNAL( requestFinished( int, bool ) ), this, TQT_SLOT( loveFinished( int, bool ) ) ); http->get( TQString( m_basePath + "/control.php?session=%1&command=love&debug=%2" ) - .arg( m_session ) - .arg( "0" ) ); + .tqarg( m_session ) + .tqarg( "0" ) ); Amarok::StatusBar::instance()->shortMessage( i18n("love, as in affection", "Loving song...") ); } @@ -692,8 +692,8 @@ WebService::skip() //SLOT connect( http, TQT_SIGNAL( requestFinished( int, bool ) ), this, TQT_SLOT( skipFinished( int, bool ) ) ); http->get( TQString( m_basePath + "/control.php?session=%1&command=skip&debug=%2" ) - .arg( m_session ) - .arg( "0" ) ); + .tqarg( m_session ) + .tqarg( "0" ) ); Amarok::StatusBar::instance()->shortMessage( i18n("Skipping song...") ); } @@ -705,8 +705,8 @@ WebService::ban() //SLOT connect( http, TQT_SIGNAL( requestFinished( int, bool ) ), this, TQT_SLOT( banFinished( int, bool ) ) ); http->get( TQString( m_basePath + "/control.php?session=%1&command=ban&debug=%2" ) - .arg( m_session ) - .arg( "0" ) ); + .tqarg( m_session ) + .tqarg( "0" ) ); Amarok::StatusBar::instance()->shortMessage( i18n("Ban, as in dislike", "Banning song...") ); } @@ -763,7 +763,7 @@ WebService::friends( TQString username ) connect( http, TQT_SIGNAL( requestFinished( bool ) ), this, TQT_SLOT( friendsFinished( bool ) ) ); http->get( TQString( "/1.0/user/%1/friends.xml" ) - .arg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) ); + .tqarg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) ); } @@ -805,7 +805,7 @@ WebService::neighbours( TQString username ) connect( http, TQT_SIGNAL( requestFinished( bool ) ), this, TQT_SLOT( neighboursFinished( bool ) ) ); http->get( TQString( "/1.0/user/%1/neighbours.xml" ) - .arg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) ); + .tqarg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) ); } @@ -847,7 +847,7 @@ WebService::userTags( TQString username ) connect( http, TQT_SIGNAL( requestFinished( bool ) ), this, TQT_SLOT( userTagsFinished( bool ) ) ); http->get( TQString( "/1.0/user/%1/tags.xml?debug=%2" ) - .arg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) ); + .tqarg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) ); } @@ -889,7 +889,7 @@ WebService::recentTracks( TQString username ) connect( http, TQT_SIGNAL( requestFinished( bool ) ), this, TQT_SLOT( recentTracksFinished( bool ) ) ); http->get( TQString( "/1.0/user/%1/recenttracks.xml" ) - .arg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) ); + .tqarg( TQString( TQUrl( username ).encodedPathAndQuery() ) ) ); } @@ -900,7 +900,7 @@ WebService::recentTracksFinished( int /*id*/, bool error ) //SLOT http->deleteLater(); if( error ) return; - TQValueList< QPair<TQString, TQString> > songs; + TQValueList< TQPair<TQString, TQString> > songs; TQDomDocument document; document.setContent( http->readAll() ); @@ -914,7 +914,7 @@ WebService::recentTracksFinished( int /*id*/, bool error ) //SLOT TQString user = document.elementsByTagName( "recenttracks" ).item( 0 ).attributes().namedItem( "user" ).nodeValue(); for ( uint i = 0; i < values.count(); i++ ) { - QPair<TQString, TQString> song; + TQPair<TQString, TQString> song; song.first = values.item( i ).namedItem( "artist" ).toElement().text(); song.second = values.item( i ).namedItem( "name" ).toElement().text(); @@ -931,35 +931,35 @@ WebService::recommend( int type, TQString username, TQString artist, TQString to switch ( type ) { case 0: - modeToken = TQString( "artist_name=%1" ).arg( TQString( TQUrl( artist ).encodedPathAndQuery() ) ); + modeToken = TQString( "artist_name=%1" ).tqarg( TQString( TQUrl( artist ).encodedPathAndQuery() ) ); break; case 1: modeToken = TQString( "album_artist=%1&album_name=%2" ) - .arg( TQString( TQUrl( artist ).encodedPathAndQuery() ) ) - .arg( TQString( TQUrl( token ).encodedPathAndQuery() ) ); + .tqarg( TQString( TQUrl( artist ).encodedPathAndQuery() ) ) + .tqarg( TQString( TQUrl( token ).encodedPathAndQuery() ) ); break; case 2: modeToken = TQString( "track_artist=%1&track_name=%2" ) - .arg( TQString( TQUrl( artist ).encodedPathAndQuery() ) ) - .arg( TQString( TQUrl( token ).encodedPathAndQuery() ) ); + .tqarg( TQString( TQUrl( artist ).encodedPathAndQuery() ) ) + .tqarg( TQString( TQUrl( token ).encodedPathAndQuery() ) ); break; } TQHttp *http = new TQHttp( "wsdev.audioscrobbler.com", 80, this ); connect( http, TQT_SIGNAL( requestFinished( bool ) ), this, TQT_SLOT( recommendFinished( bool ) ) ); - uint currentTime = TQDateTime::currentDateTime( Qt::UTC ).toTime_t(); + uint currentTime = TQDateTime::tqcurrentDateTime( Qt::UTC ).toTime_t(); TQString challenge = TQString::number( currentTime ); TQCString md5pass = KMD5( KMD5( m_password.utf8() ).hexDigest() + currentTime ).hexDigest(); token = TQString( "user=%1&auth=%2&nonce=%3recipient=%4" ) - .arg( TQString( TQUrl( currentUsername() ).encodedPathAndQuery() ) ) - .arg( TQString( TQUrl( md5pass ).encodedPathAndQuery() ) ) - .arg( TQString( TQUrl( challenge ).encodedPathAndQuery() ) ) - .arg( TQString( TQUrl( username ).encodedPathAndQuery() ) ); + .tqarg( TQString( TQUrl( currentUsername() ).encodedPathAndQuery() ) ) + .tqarg( TQString( TQUrl( md5pass ).encodedPathAndQuery() ) ) + .tqarg( TQString( TQUrl( challenge ).encodedPathAndQuery() ) ) + .tqarg( TQString( TQUrl( username ).encodedPathAndQuery() ) ); TQHttpRequestHeader header( "POST", "/1.0/rw/recommend.php?" + token.utf8() ); header.setValue( "Host", "wsdev.audioscrobbler.com" ); @@ -978,7 +978,7 @@ WebService::recommendFinished( int /*id*/, bool /*error*/ ) //SLOT } -QString +TQString WebService::parameter( const TQString keyName, const TQString data ) const { TQStringList list = TQStringList::split( '\n', data ); @@ -997,7 +997,7 @@ WebService::parameter( const TQString keyName, const TQString data ) const } -QStringList +TQStringList WebService::parameterArray( const TQString keyName, const TQString data ) const { TQStringList result; @@ -1017,7 +1017,7 @@ WebService::parameterArray( const TQString keyName, const TQString data ) const } -QStringList +TQStringList WebService::parameterKeys( const TQString keyName, const TQString data ) const { TQStringList result; @@ -1093,8 +1093,8 @@ void Bundle::detach() { //////////////////////////////////////////////////////////////////////////////// // CLASS LastFm::LoginDialog //////////////////////////////////////////////////////////////////////////////// -LoginDialog::LoginDialog( TQWidget *parent ) - : KDialogBase( parent, "LastfmLogin", true, TQString::null, Ok|Cancel) +LoginDialog::LoginDialog( TQWidget *tqparent ) + : KDialogBase( tqparent, "LastfmLogin", true, TQString(), Ok|Cancel) { makeGridMainWidget( 1, Qt::Horizontal ); new TQLabel( i18n( "To use last.fm with Amarok, you need a last.fm profile." ), mainWidget() ); @@ -1125,8 +1125,8 @@ void LoginDialog::slotOk() //////////////////////////////////////////////////////////////////////////////// // CLASS LastFm::CustomStationDialog //////////////////////////////////////////////////////////////////////////////// -CustomStationDialog::CustomStationDialog( TQWidget *parent ) - : KDialogBase( parent, "LastfmCustomStation", true, i18n( "Create Custom Station" ) , Ok|Cancel) +CustomStationDialog::CustomStationDialog( TQWidget *tqparent ) + : KDialogBase( tqparent, "LastfmCustomStation", true, i18n( "Create Custom Station" ) , Ok|Cancel) { makeVBoxMainWidget(); @@ -1137,7 +1137,7 @@ CustomStationDialog::CustomStationDialog( TQWidget *parent ) } -QString +TQString CustomStationDialog::text() const { return m_edit->text(); |