diff --git a/src/libtomahawk/Result.cpp b/src/libtomahawk/Result.cpp index 39fd92e6b..29ff855e7 100644 --- a/src/libtomahawk/Result.cpp +++ b/src/libtomahawk/Result.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -526,6 +526,19 @@ Result::track() const } +downloadjob_ptr +Result::toDownloadJob() +{ + if ( !m_downloadJob ) + { + m_downloadJob = downloadjob_ptr( new DownloadJob( track(), downloadFormats().first() ) ); + connect( m_downloadJob.data(), SIGNAL( progress( int ) ), SIGNAL( updated() ) ); + } + + return m_downloadJob; +} + + QWeakPointer Result::weakRef() { @@ -538,4 +551,3 @@ Result::setWeakRef( QWeakPointer weakRef ) { m_ownRef = weakRef; } - diff --git a/src/libtomahawk/Result.h b/src/libtomahawk/Result.h index eac71a99d..8f8f1d984 100644 --- a/src/libtomahawk/Result.h +++ b/src/libtomahawk/Result.h @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2015, Christian Muehlhaeuser * Copyright 2010-2011, Jeff Mitchell * * Tomahawk is free software: you can redistribute it and/or modify @@ -21,6 +21,7 @@ #define RESULT_H #include "ResultProvider.h" +#include "DownloadJob.h" #include "utils/TomahawkUtils.h" #include "Typedefs.h" @@ -130,6 +131,12 @@ public: track_ptr track() const; + QList downloadFormats() const { return m_formats; } + void setDownloadFormats( const QList& formats ) { m_formats = formats; } + + downloadjob_ptr downloadJob() const { return m_downloadJob; } + downloadjob_ptr toDownloadJob(); + public slots: void deleteLater(); @@ -160,6 +167,9 @@ private: QString m_mimetype; QString m_friendlySource; + QList m_formats; + downloadjob_ptr m_downloadJob; + bool m_checked; unsigned int m_bitrate; unsigned int m_size;