mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 01:39:42 +01:00
* Moved isLocalResult and isHttpResult to TomahawkUtils.
This commit is contained in:
parent
e4c0bd7f30
commit
d8a7669df8
@ -440,7 +440,8 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
{
|
||||
setCurrentTrack( result );
|
||||
|
||||
if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) )
|
||||
if ( !TomahawkUtils::isHttpResult( m_currentTrack->url() ) &&
|
||||
!TomahawkUtils::isLocalResult( m_currentTrack->url() ) )
|
||||
{
|
||||
io = Servent::instance()->getIODeviceForUrl( m_currentTrack );
|
||||
|
||||
@ -458,7 +459,8 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
m_state = Loading;
|
||||
emit loading( m_currentTrack );
|
||||
|
||||
if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) )
|
||||
if ( !TomahawkUtils::isHttpResult( m_currentTrack->url() ) &&
|
||||
!TomahawkUtils::isLocalResult( m_currentTrack->url() ) )
|
||||
{
|
||||
if ( QNetworkReply* qnr_io = qobject_cast< QNetworkReply* >( io.data() ) )
|
||||
m_mediaObject->setCurrentSource( new QNR_IODeviceStream( qnr_io, this ) );
|
||||
@ -468,7 +470,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !isLocalResult( m_currentTrack->url() ) )
|
||||
if ( !TomahawkUtils::isLocalResult( m_currentTrack->url() ) )
|
||||
{
|
||||
QUrl furl = m_currentTrack->url();
|
||||
if ( m_currentTrack->url().contains( "?" ) )
|
||||
@ -977,20 +979,6 @@ AudioEngine::setCurrentTrack( const Tomahawk::result_ptr& result )
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
AudioEngine::isHttpResult( const QString& url ) const
|
||||
{
|
||||
return url.startsWith( "http://" ) || url.startsWith( "https://" );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
AudioEngine::isLocalResult( const QString& url ) const
|
||||
{
|
||||
return url.startsWith( "file://" );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioEngine::checkStateQueue()
|
||||
{
|
||||
|
@ -152,9 +152,6 @@ private:
|
||||
|
||||
void setState( AudioState state );
|
||||
|
||||
bool isHttpResult( const QString& ) const;
|
||||
bool isLocalResult( const QString& ) const;
|
||||
|
||||
QSharedPointer<QIODevice> m_input;
|
||||
|
||||
Tomahawk::query_ptr m_stopAfterTrack;
|
||||
|
@ -772,6 +772,20 @@ md5( const QByteArray& data )
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
isHttpResult( const QString& url )
|
||||
{
|
||||
return url.startsWith( "http://" ) || url.startsWith( "https://" );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
isLocalResult( const QString& url )
|
||||
{
|
||||
return url.startsWith( "file://" );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
crash()
|
||||
{
|
||||
|
@ -189,6 +189,9 @@ namespace TomahawkUtils
|
||||
DLLEXPORT QString md5( const QByteArray& data );
|
||||
DLLEXPORT bool removeDirectory( const QString& dir );
|
||||
|
||||
DLLEXPORT bool isHttpResult( const QString& url );
|
||||
DLLEXPORT bool isLocalResult( const QString& url );
|
||||
|
||||
DLLEXPORT bool verifyFile( const QString& filePath, const QString& signature );
|
||||
DLLEXPORT QString extractScriptPayload( const QString& filename, const QString& resolverId );
|
||||
DLLEXPORT bool unzipFileInFolder( const QString& zipFileName, const QDir& folder );
|
||||
|
Loading…
x
Reference in New Issue
Block a user