1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-08 15:16:34 +02:00

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

This commit is contained in:
Jason Herskowitz
2013-01-03 08:58:15 -05:00
11 changed files with 4380 additions and 65 deletions

View File

@@ -14,10 +14,9 @@ SET( TOMAHAWK_DESCRIPTION_SUMMARY "The social media player" )
SET( TOMAHAWK_VERSION_MAJOR 0 ) SET( TOMAHAWK_VERSION_MAJOR 0 )
SET( TOMAHAWK_VERSION_MINOR 5 ) SET( TOMAHAWK_VERSION_MINOR 5 )
SET( TOMAHAWK_VERSION_PATCH 99 ) SET( TOMAHAWK_VERSION_PATCH 99 )
#SET( TOMAHAWK_VERSION_RC 0 ) #SET( TOMAHAWK_VERSION_RC 0 )
SET( TOMAHAWK_TRANSLATION_LANGUAGES ar bg ca de en es fi fr ja pl pt_BR ru sv tr zh_CN zh_TW ) SET( TOMAHAWK_TRANSLATION_LANGUAGES ar bg bn_IN ca cs de en el es fi fr hi_IN hu gl it ja lt pl pt_BR ru sv tr zh_CN zh_TW )
# enforce proper symbol exporting on all platforms # enforce proper symbol exporting on all platforms
add_definitions( "-fvisibility=hidden" ) add_definitions( "-fvisibility=hidden" )

View File

@@ -217,7 +217,7 @@ TOMAHAWK_PLUGINS = [
] ]
QT_PLUGINS_SEARCH_PATH=[ QT_PLUGINS_SEARCH_PATH=[
'/usr/local/Cellar/qt/4.8.2/plugins', '/usr/local/Cellar/qt/4.8.4/plugins',
] ]

4242
lang/tomahawk_cs.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -547,7 +547,7 @@ de se connecter et streamer de vous?</translation>
<message> <message>
<location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="59"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="59"/>
<source>Steer this station:</source> <source>Steer this station:</source>
<translation type="unfinished"/> <translation>Modifier cette station :</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="82"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="82"/>
@@ -632,12 +632,12 @@ de se connecter et streamer de vous?</translation>
<message> <message>
<location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="113"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="113"/>
<source>Apply steering command</source> <source>Apply steering command</source>
<translation type="unfinished"/> <translation>Appliquer la modification</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="119"/> <location filename="../src/libtomahawk/playlist/dynamic/echonest/EchonestSteerer.cpp" line="119"/>
<source>Reset all steering commands</source> <source>Reset all steering commands</source>
<translation type="unfinished"/> <translation>Annuler toutes les modifications</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -1017,42 +1017,42 @@ de se connecter et streamer de vous?</translation>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/>
<source>Accuracy</source> <source>Accuracy</source>
<translation type="unfinished"/> <translation>Précision</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="241"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="241"/>
<source>Perfect match</source> <source>Perfect match</source>
<translation type="unfinished"/> <translation>Correspondance parfaite</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="243"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="243"/>
<source>Very good match</source> <source>Very good match</source>
<translation type="unfinished"/> <translation>Très bonne correspondance</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="245"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="245"/>
<source>Good match</source> <source>Good match</source>
<translation type="unfinished"/> <translation>Bonne correspondance</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="247"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="247"/>
<source>Vague match</source> <source>Vague match</source>
<translation type="unfinished"/> <translation>Vague correspondance</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="249"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="249"/>
<source>Bad match</source> <source>Bad match</source>
<translation type="unfinished"/> <translation>Mauvaise correspondance</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="251"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="251"/>
<source>Very bad match</source> <source>Very bad match</source>
<translation type="unfinished"/> <translation>Très mauvaise correspondance</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="253"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="253"/>
<source>Not available</source> <source>Not available</source>
<translation type="unfinished"/> <translation>Indisponible</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/> <location filename="../src/libtomahawk/playlist/PlayableModel.cpp" line="50"/>
@@ -1328,13 +1328,13 @@ de se connecter et streamer de vous?</translation>
<location filename="../src/libtomahawk/utils/GuiHelpers.cpp" line="102"/> <location filename="../src/libtomahawk/utils/GuiHelpers.cpp" line="102"/>
<location filename="../src/libtomahawk/utils/GuiHelpers.cpp" line="113"/> <location filename="../src/libtomahawk/utils/GuiHelpers.cpp" line="113"/>
<source>%1 Config</source> <source>%1 Config</source>
<translation type="unfinished"/> <translation>%1 Configuration</translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/utils/GuiHelpers.cpp" line="142"/> <location filename="../src/libtomahawk/utils/GuiHelpers.cpp" line="142"/>
<location filename="../src/libtomahawk/utils/GuiHelpers.cpp" line="157"/> <location filename="../src/libtomahawk/utils/GuiHelpers.cpp" line="157"/>
<source>%1 Configuration</source> <source>%1 Configuration</source>
<translation type="unfinished"/> <translation>%1 Configuration</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -2418,7 +2418,7 @@ Essayez de vous authentifier de nouveau.</translation>
<location filename="../src/accounts/zeroconf/ZeroconfAccount.cpp" line="67"/> <location filename="../src/accounts/zeroconf/ZeroconfAccount.cpp" line="67"/>
<location filename="../src/accounts/zeroconf/ZeroconfAccount.cpp" line="68"/> <location filename="../src/accounts/zeroconf/ZeroconfAccount.cpp" line="68"/>
<source>Local Network</source> <source>Local Network</source>
<translation type="unfinished"/> <translation>Réseau local</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -2426,7 +2426,7 @@ Essayez de vous authentifier de nouveau.</translation>
<message> <message>
<location filename="../src/accounts/zeroconf/ZeroconfAccount.h" line="42"/> <location filename="../src/accounts/zeroconf/ZeroconfAccount.h" line="42"/>
<source>Local Network</source> <source>Local Network</source>
<translation type="unfinished"/> <translation>Réseau local</translation>
</message> </message>
<message> <message>
<location filename="../src/accounts/zeroconf/ZeroconfAccount.h" line="43"/> <location filename="../src/accounts/zeroconf/ZeroconfAccount.h" line="43"/>
@@ -3146,7 +3146,7 @@ Essayez de changer les filtres pour avoir de nouveaux morceaux à jouer.</transl
<message numerus="yes"> <message numerus="yes">
<location filename="../src/libtomahawk/Query.cpp" line="776"/> <location filename="../src/libtomahawk/Query.cpp" line="776"/>
<source>%n people</source> <source>%n people</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> <translation><numerusform>%n personne</numerusform><numerusform>%n personnes</numerusform></translation>
</message> </message>
<message> <message>
<location filename="../src/libtomahawk/Query.cpp" line="778"/> <location filename="../src/libtomahawk/Query.cpp" line="778"/>
@@ -3175,7 +3175,7 @@ Essayez de changer les filtres pour avoir de nouveaux morceaux à jouer.</transl
<message> <message>
<location filename="../src/libtomahawk/utils/SoundcloudParser.cpp" line="112"/> <location filename="../src/libtomahawk/utils/SoundcloudParser.cpp" line="112"/>
<source>Track &apos;%1&apos; by %2 is not streamable.</source> <source>Track &apos;%1&apos; by %2 is not streamable.</source>
<translation type="unfinished"/> <translation>La piste &apos;%1&apos; par %2 n&apos;est pas écoutable.</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -3266,7 +3266,7 @@ saisissez le numéro PIN ici :</translation>
<message> <message>
<location filename="../src/libtomahawk/TomahawkSettings.cpp" line="375"/> <location filename="../src/libtomahawk/TomahawkSettings.cpp" line="375"/>
<source>Local Network</source> <source>Local Network</source>
<translation type="unfinished"/> <translation>Réseau local</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -3547,7 +3547,7 @@ saisissez le numéro PIN ici :</translation>
<message> <message>
<location filename="../src/TomahawkWindow.cpp" line="985"/> <location filename="../src/TomahawkWindow.cpp" line="985"/>
<source>Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped.</source> <source>Sorry, there is a problem accessing your audio device or the desired track, current track will be skipped.</source>
<translation>Désolé, il y a un problème d&apos;accès à votre matériel audio ou la piste en cours va être sauter.</translation> <translation>Désolé, il y a un problème d&apos;accès à votre matériel audio ou la piste en cours , celle-ci va être sautée.</translation>
</message> </message>
<message> <message>
<location filename="../src/TomahawkWindow.cpp" line="1017"/> <location filename="../src/TomahawkWindow.cpp" line="1017"/>

View File

@@ -1,33 +1,33 @@
macro(add_tomahawk_translations language) macro(add_tomahawk_translations language)
list(APPEND TOMAHAWK_LANGUAGES ${ARGV}) list( APPEND TOMAHAWK_LANGUAGES ${ARGV} )
set(tomahawk_i18n_qrc_content "<!DOCTYPE RCC><RCC version=\"1.0\">\n") set( tomahawk_i18n_qrc_content "<!DOCTYPE RCC><RCC version=\"1.0\">\n" )
# tomahawk and qt language files # tomahawk and qt language files
set(tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}<qresource prefix=\"/lang\">\n") set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}<qresource prefix=\"/lang\">\n" )
foreach(lang ${TOMAHAWK_LANGUAGES}) foreach( lang ${TOMAHAWK_LANGUAGES} )
set(tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}<file>tomahawk_${lang}.qm</file>\n") set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}<file>tomahawk_${lang}.qm</file>\n" )
if(NOT lang STREQUAL "en" AND EXISTS ${QT_TRANSLATIONS_DIR}/qt_${lang}.qm) if( NOT lang STREQUAL "en" AND EXISTS ${QT_TRANSLATIONS_DIR}/qt_${lang}.qm )
file(COPY ${QT_TRANSLATIONS_DIR}/qt_${lang}.qm DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file( COPY ${QT_TRANSLATIONS_DIR}/qt_${lang}.qm DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
set(tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}<file>qt_${lang}.qm</file>\n") set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}<file>qt_${lang}.qm</file>\n" )
endif() endif()
# build explicitly enabled languages # build explicitly enabled languages
list(APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/tomahawk_${lang}.ts") list( APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/tomahawk_${lang}.ts" )
endforeach() endforeach()
set(tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}</qresource>\n") set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}</qresource>\n" )
set(tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}</RCC>\n") set( tomahawk_i18n_qrc_content "${tomahawk_i18n_qrc_content}</RCC>\n" )
file(WRITE ${CMAKE_BINARY_DIR}/lang/tomahawk_i18n.qrc "${tomahawk_i18n_qrc_content}" ) file( WRITE ${CMAKE_BINARY_DIR}/lang/tomahawk_i18n.qrc "${tomahawk_i18n_qrc_content}" )
QT4_ADD_TRANSLATION(QM_FILES ${TS_FILES}) QT4_ADD_TRANSLATION( QM_FILES ${TS_FILES} )
## HACK HACK HACK - around rcc limitations to allow out of source-tree building ## HACK HACK HACK - around rcc limitations to allow out of source-tree building
SET( trans_file tomahawk_i18n ) SET( trans_file tomahawk_i18n )
SET( trans_srcfile ${CMAKE_BINARY_DIR}/lang/${trans_file}.qrc) SET( trans_srcfile ${CMAKE_BINARY_DIR}/lang/${trans_file}.qrc )
SET( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc) SET( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc )
SET( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${trans_file}.cxx) SET( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${trans_file}.cxx )
# Copy the QRC file to the output directory # Copy the QRC file to the output directory
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(

View File

@@ -171,7 +171,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
QPixmap p = index.data( Qt::DecorationRole ).value< QPixmap >(); QPixmap p = index.data( Qt::DecorationRole ).value< QPixmap >();
QRect pixmapRect( leftEdge + PADDING, center - ICONSIZE/2, ICONSIZE, ICONSIZE ); QRect pixmapRect( leftEdge + PADDING, center - ICONSIZE/2, ICONSIZE, ICONSIZE );
if ( p.isNull() ) // default image... TODO if ( p.isNull() ) // default image... TODO
p = TomahawkUtils::defaultPixmap( TomahawkUtils::SipPluginOnline, TomahawkUtils::Original, pixmapRect.size() ); p = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultResolver, TomahawkUtils::Original, pixmapRect.size() );
else else
p = p.scaled( pixmapRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ); p = p.scaled( pixmapRect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation );

View File

@@ -232,6 +232,11 @@ ResolverAccount::resolverChanged()
emit connectionStateChanged( connectionState() ); emit connectionStateChanged( connectionState() );
} }
QPixmap
ResolverAccount::icon() const
{
return m_resolver.data()->icon();
}
/// AtticaResolverAccount /// AtticaResolverAccount

View File

@@ -77,8 +77,9 @@ public:
QString path() const; QString path() const;
virtual QPixmap icon() const;
// Not relevant // Not relevant
virtual QPixmap icon() const { return QPixmap(); }
virtual SipPlugin* sipPlugin() { return 0; } virtual SipPlugin* sipPlugin() { return 0; }
virtual Tomahawk::InfoSystem::InfoPluginPtr infoPlugin() { return Tomahawk::InfoSystem::InfoPluginPtr(); } virtual Tomahawk::InfoSystem::InfoPluginPtr infoPlugin() { return Tomahawk::InfoSystem::InfoPluginPtr(); }
virtual QWidget* aclWidget() { return 0; } virtual QWidget* aclWidget() { return 0; }

View File

@@ -18,7 +18,9 @@
#include "PlayableCover.h" #include "PlayableCover.h"
#include "Artist.h"
#include "Album.h" #include "Album.h"
#include "ViewManager.h"
#include "audio/AudioEngine.h" #include "audio/AudioEngine.h"
#include "widgets/ImageButton.h" #include "widgets/ImageButton.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
@@ -77,6 +79,56 @@ PlayableCover::resizeEvent( QResizeEvent* event )
} }
void
PlayableCover::mouseMoveEvent( QMouseEvent* event )
{
QLabel::mouseMoveEvent( event );
foreach ( const QRect& rect, m_itemRects )
{
if ( rect.contains( event->pos() ) )
{
if ( m_hoveredRect != rect )
{
setCursor( Qt::PointingHandCursor );
m_hoveredRect = rect;
repaint();
}
return;
}
}
if ( !m_hoveredRect.isNull() )
{
setCursor( Qt::ArrowCursor );
m_hoveredRect = QRect();
repaint();
}
}
void
PlayableCover::mouseReleaseEvent( QMouseEvent* event )
{
QLabel::mouseReleaseEvent( event );
foreach ( const QRect& rect, m_itemRects )
{
if ( rect.contains( event->pos() ) )
{
if ( m_artist )
ViewManager::instance()->show( m_artist );
else if ( m_album )
ViewManager::instance()->show( m_album->artist() );
else if ( m_query )
ViewManager::instance()->show( Tomahawk::Artist::get( m_query->artist() ) );
return;
}
}
}
void void
PlayableCover::setPixmap( const QPixmap& pixmap ) PlayableCover::setPixmap( const QPixmap& pixmap )
{ {
@@ -87,6 +139,8 @@ PlayableCover::setPixmap( const QPixmap& pixmap )
void void
PlayableCover::paintEvent( QPaintEvent* event ) PlayableCover::paintEvent( QPaintEvent* event )
{ {
Q_UNUSED( event );
QPainter painter( this ); QPainter painter( this );
painter.setRenderHint( QPainter::Antialiasing ); painter.setRenderHint( QPainter::Antialiasing );
painter.drawPixmap( 0, 0, pixmap() ); painter.drawPixmap( 0, 0, pixmap() );
@@ -98,6 +152,7 @@ PlayableCover::paintEvent( QPaintEvent* event )
QPixmap buffer( r.size() ); QPixmap buffer( r.size() );
buffer.fill( Qt::transparent ); buffer.fill( Qt::transparent );
QPainter bufpainter( &buffer ); QPainter bufpainter( &buffer );
bufpainter.setRenderHint( QPainter::Antialiasing );
QTextOption to; QTextOption to;
to.setWrapMode( QTextOption::NoWrap ); to.setWrapMode( QTextOption::NoWrap );
@@ -181,18 +236,25 @@ PlayableCover::paintEvent( QPaintEvent* event )
bufpainter.drawText( textRect, text, to ); bufpainter.drawText( textRect, text, to );
bufpainter.setFont( font ); bufpainter.setFont( font );
// If the user is hovering over an artist rect, draw a background so she knows it's clickable
QRect r = textRect; QRect r = textRect;
r.setTop( r.bottom() - bufpainter.fontMetrics().height() ); r.setTop( r.bottom() - bufpainter.fontMetrics().height() );
r.adjust( 4, 0, -4, -1 ); r.adjust( 4, 0, -4, -1 );
/* if ( m_hoveringOver == index )
text = bufpainter.fontMetrics().elidedText( bottom, Qt::ElideRight, textRect.width() - 16 );
int textWidth = bufpainter.fontMetrics().width( text );
r.adjust( ( r.width() - textWidth ) / 2 - 6, 0, - ( ( r.width() - textWidth ) / 2 - 6 ), 0 );
m_itemRects.clear();
m_itemRects << r;
if ( m_hoveredRect == r )
{ {
TomahawkUtils::drawQueryBackground( bufpainter, opt.palette, r, 1.1 ); TomahawkUtils::drawQueryBackground( &bufpainter, palette(), r, 1.1 );
bufpainter.setPen( opt.palette.color( QPalette::HighlightedText ) ); bufpainter.setPen( Qt::white );
}*/ }
to.setAlignment( Qt::AlignHCenter | Qt::AlignBottom ); to.setAlignment( Qt::AlignHCenter | Qt::AlignBottom );
text = bufpainter.fontMetrics().elidedText( bottom, Qt::ElideRight, textRect.width() - 16 );
bufpainter.drawText( textRect.adjusted( 5, -1, -5, -1 ), text, to ); bufpainter.drawText( textRect.adjusted( 5, -1, -5, -1 ), text, to );
} }

View File

@@ -56,6 +56,9 @@ protected:
virtual void resizeEvent( QResizeEvent* event ); virtual void resizeEvent( QResizeEvent* event );
virtual void paintEvent( QPaintEvent* event ); virtual void paintEvent( QPaintEvent* event );
virtual void mouseMoveEvent( QMouseEvent* event );
virtual void mouseReleaseEvent( QMouseEvent* event );
void leaveEvent( QEvent* event ); void leaveEvent( QEvent* event );
void enterEvent( QEvent* event ); void enterEvent( QEvent* event );
@@ -70,6 +73,9 @@ private:
Tomahawk::album_ptr m_album; Tomahawk::album_ptr m_album;
Tomahawk::query_ptr m_query; Tomahawk::query_ptr m_query;
QList< QRect > m_itemRects;
QRect m_hoveredRect;
bool m_showText; bool m_showText;
}; };

View File

@@ -43,11 +43,11 @@ Api_v1::Api_v1(QxtAbstractWebSessionManager* sm, QObject* parent)
void void
Api_v1::auth_1( QxtWebRequestEvent* event, QString arg ) Api_v1::auth_1( QxtWebRequestEvent* event, QString arg )
{ {
qDebug() << "AUTH_1 HTTP" << event->url.toString() << arg; tDebug( LOGVERBOSE ) << "AUTH_1 HTTP" << event->url.toString() << arg;
if ( !event->url.hasQueryItem( "website" ) || !event->url.hasQueryItem( "name" ) ) if ( !event->url.hasQueryItem( "website" ) || !event->url.hasQueryItem( "name" ) )
{ {
qDebug() << "Malformed HTTP resolve request"; tDebug( LOGVERBOSE ) << "Malformed HTTP resolve request";
send404( event ); send404( event );
return; return;
} }
@@ -80,10 +80,10 @@ Api_v1::auth_1( QxtWebRequestEvent* event, QString arg )
void void
Api_v1::auth_2( QxtWebRequestEvent* event, QString arg ) Api_v1::auth_2( QxtWebRequestEvent* event, QString arg )
{ {
qDebug() << "AUTH_2 HTTP" << event->url.toString() << arg; tDebug( LOGVERBOSE ) << "AUTH_2 HTTP" << event->url.toString() << arg;
if ( event->content.isNull() ) if ( event->content.isNull() )
{ {
qDebug() << "Null content"; tDebug( LOGVERBOSE ) << "Null content";
send404( event ); send404( event );
return; return;
} }
@@ -99,13 +99,13 @@ Api_v1::auth_2( QxtWebRequestEvent* event, QString arg )
if ( keyval.size() == 2 ) if ( keyval.size() == 2 )
queryItems.insert( keyval.first(), keyval.last() ); queryItems.insert( keyval.first(), keyval.last() );
else else
qDebug() << "Failed parsing url parameters:" << part; tDebug( LOGVERBOSE ) << "Failed parsing url parameters:" << part;
} }
qDebug() << "has query items:" << pieces; tDebug( LOGVERBOSE ) << "has query items:" << pieces;
if ( !params.contains( "website" ) || !params.contains( "name" ) || !params.contains( "formtoken" ) ) if ( !params.contains( "website" ) || !params.contains( "name" ) || !params.contains( "formtoken" ) )
{ {
qDebug() << "Malformed HTTP resolve request"; tDebug( LOGVERBOSE ) << "Malformed HTTP resolve request";
send404( event ); send404( event );
return; return;
} }
@@ -113,7 +113,7 @@ Api_v1::auth_2( QxtWebRequestEvent* event, QString arg )
QString website = queryItems[ "website" ]; QString website = queryItems[ "website" ];
QString name = queryItems[ "name" ]; QString name = queryItems[ "name" ];
QByteArray authtoken = uuid().toLatin1(); QByteArray authtoken = uuid().toLatin1();
qDebug() << "HEADERS:" << event->headers; tDebug( LOGVERBOSE ) << "HEADERS:" << event->headers;
if ( !queryItems.contains( "receiverurl" ) || queryItems.value( "receiverurl" ).isEmpty() ) if ( !queryItems.contains( "receiverurl" ) || queryItems.value( "receiverurl" ).isEmpty() )
{ {
//no receiver url, so do it ourselves //no receiver url, so do it ourselves
@@ -139,7 +139,7 @@ Api_v1::auth_2( QxtWebRequestEvent* event, QString arg )
// do what the client wants // do what the client wants
QUrl receiverurl = QUrl( queryItems.value( "receiverurl" ), QUrl::TolerantMode ); QUrl receiverurl = QUrl( queryItems.value( "receiverurl" ), QUrl::TolerantMode );
receiverurl.addEncodedQueryItem( "authtoken", "#" + authtoken ); receiverurl.addEncodedQueryItem( "authtoken", "#" + authtoken );
qDebug() << "Got receiver url:" << receiverurl.toString(); tDebug( LOGVERBOSE ) << "Got receiver url:" << receiverurl.toString();
QxtWebRedirectEvent* e = new QxtWebRedirectEvent( event->sessionID, event->requestID, receiverurl.toString() ); QxtWebRedirectEvent* e = new QxtWebRedirectEvent( event->sessionID, event->requestID, receiverurl.toString() );
postEvent( e ); postEvent( e );
@@ -155,7 +155,7 @@ Api_v1::auth_2( QxtWebRequestEvent* event, QString arg )
void void
Api_v1::api( QxtWebRequestEvent* event ) Api_v1::api( QxtWebRequestEvent* event )
{ {
qDebug() << "HTTP" << event->url.toString(); tDebug( LOGVERBOSE ) << "HTTP" << event->url.toString();
const QUrl& url = event->url; const QUrl& url = event->url;
if ( url.hasQueryItem( "method" ) ) if ( url.hasQueryItem( "method" ) )
@@ -178,7 +178,7 @@ Api_v1::sid( QxtWebRequestEvent* event, QString unused )
Q_UNUSED( unused ); Q_UNUSED( unused );
RID rid = event->url.path().mid( 5 ); RID rid = event->url.path().mid( 5 );
qDebug() << "Request for sid" << rid; tDebug( LOGVERBOSE ) << "Request for sid" << rid;
result_ptr rp = Pipeline::instance()->result( rid ); result_ptr rp = Pipeline::instance()->result( rid );
if ( rp.isNull() ) if ( rp.isNull() )
@@ -204,7 +204,7 @@ Api_v1::sid( QxtWebRequestEvent* event, QString unused )
void void
Api_v1::send404( QxtWebRequestEvent* event ) Api_v1::send404( QxtWebRequestEvent* event )
{ {
qDebug() << "404" << event->url.toString(); tDebug() << "404" << event->url.toString();
QxtWebPageEvent* wpe = new QxtWebPageEvent( event->sessionID, event->requestID, "<h1>Not Found</h1>" ); QxtWebPageEvent* wpe = new QxtWebPageEvent( event->sessionID, event->requestID, "<h1>Not Found</h1>" );
wpe->status = 404; wpe->status = 404;
wpe->statusMessage = "no event found"; wpe->statusMessage = "no event found";
@@ -215,11 +215,11 @@ Api_v1::send404( QxtWebRequestEvent* event )
void void
Api_v1::stat( QxtWebRequestEvent* event ) Api_v1::stat( QxtWebRequestEvent* event )
{ {
qDebug() << "Got Stat request:" << event->url.toString(); tDebug( LOGVERBOSE ) << "Got Stat request:" << event->url.toString();
m_storedEvent = event; m_storedEvent = event;
if ( !event->content.isNull() ) if ( !event->content.isNull() )
qDebug() << "BODY:" << event->content->readAll(); tDebug( LOGVERBOSE ) << "BODY:" << event->content->readAll();
if ( event->url.hasQueryItem( "auth" ) ) if ( event->url.hasQueryItem( "auth" ) )
{ {
@@ -262,7 +262,7 @@ Api_v1::resolve( QxtWebRequestEvent* event )
if ( !event->url.hasQueryItem( "artist" ) || if ( !event->url.hasQueryItem( "artist" ) ||
!event->url.hasQueryItem( "track" ) ) !event->url.hasQueryItem( "track" ) )
{ {
qDebug() << "Malformed HTTP resolve request"; tDebug( LOGVERBOSE ) << "Malformed HTTP resolve request";
return send404( event ); return send404( event );
} }
@@ -273,7 +273,7 @@ Api_v1::resolve( QxtWebRequestEvent* event )
if ( artist.trimmed().isEmpty() || if ( artist.trimmed().isEmpty() ||
track.trimmed().isEmpty() ) track.trimmed().isEmpty() )
{ {
qDebug() << "Malformed HTTP resolve request"; tDebug( LOGVERBOSE ) << "Malformed HTTP resolve request";
return send404( event ); return send404( event );
} }
@@ -300,7 +300,7 @@ Api_v1::resolve( QxtWebRequestEvent* event )
void void
Api_v1::staticdata( QxtWebRequestEvent* event, const QString& str ) Api_v1::staticdata( QxtWebRequestEvent* event, const QString& str )
{ {
qDebug() << "STATIC request:" << event << str; tDebug( LOGVERBOSE ) << "STATIC request:" << event << str;
if ( str.contains( "tomahawk_auth_logo.png" ) ) if ( str.contains( "tomahawk_auth_logo.png" ) )
{ {
QFile f( RESPATH "www/tomahawk_banner_small.png" ); QFile f( RESPATH "www/tomahawk_banner_small.png" );
@@ -318,7 +318,7 @@ Api_v1::get_results( QxtWebRequestEvent* event )
{ {
if ( !event->url.hasQueryItem( "qid" ) ) if ( !event->url.hasQueryItem( "qid" ) )
{ {
tDebug() << "Malformed HTTP get_results request"; tDebug( LOGVERBOSE ) << "Malformed HTTP get_results request";
send404( event ); send404( event );
return; return;
} }
@@ -372,7 +372,7 @@ Api_v1::sendJSON( const QVariantMap& m, QxtWebRequestEvent* event )
e->contentType = ctype; e->contentType = ctype;
e->headers.insert( "Content-Length", QString::number( body.length() ) ); e->headers.insert( "Content-Length", QString::number( body.length() ) );
postEvent( e ); postEvent( e );
qDebug() << "JSON response" << event->url.toString() << body; tDebug( LOGVERBOSE ) << "JSON response" << event->url.toString() << body;
} }