mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
Methods to turn Result into a DownloadJob and access it.
This commit is contained in:
parent
29f2e721ed
commit
8a20145806
@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
*
|
||||
* 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>
|
||||
Result::weakRef()
|
||||
{
|
||||
@ -538,4 +551,3 @@ Result::setWeakRef( QWeakPointer<Result> weakRef )
|
||||
{
|
||||
m_ownRef = weakRef;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||
*
|
||||
* 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<DownloadFormat> downloadFormats() const { return m_formats; }
|
||||
void setDownloadFormats( const QList<DownloadFormat>& 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<DownloadFormat> m_formats;
|
||||
downloadjob_ptr m_downloadJob;
|
||||
|
||||
bool m_checked;
|
||||
unsigned int m_bitrate;
|
||||
unsigned int m_size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user