mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Methods to turn Result into a DownloadJob and access it.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === 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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* 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>
|
QWeakPointer<Result>
|
||||||
Result::weakRef()
|
Result::weakRef()
|
||||||
{
|
{
|
||||||
@@ -538,4 +551,3 @@ Result::setWeakRef( QWeakPointer<Result> weakRef )
|
|||||||
{
|
{
|
||||||
m_ownRef = weakRef;
|
m_ownRef = weakRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === 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>
|
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#define RESULT_H
|
#define RESULT_H
|
||||||
|
|
||||||
#include "ResultProvider.h"
|
#include "ResultProvider.h"
|
||||||
|
#include "DownloadJob.h"
|
||||||
#include "utils/TomahawkUtils.h"
|
#include "utils/TomahawkUtils.h"
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
|
|
||||||
@@ -130,6 +131,12 @@ public:
|
|||||||
|
|
||||||
track_ptr track() const;
|
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:
|
public slots:
|
||||||
void deleteLater();
|
void deleteLater();
|
||||||
|
|
||||||
@@ -160,6 +167,9 @@ private:
|
|||||||
QString m_mimetype;
|
QString m_mimetype;
|
||||||
QString m_friendlySource;
|
QString m_friendlySource;
|
||||||
|
|
||||||
|
QList<DownloadFormat> m_formats;
|
||||||
|
downloadjob_ptr m_downloadJob;
|
||||||
|
|
||||||
bool m_checked;
|
bool m_checked;
|
||||||
unsigned int m_bitrate;
|
unsigned int m_bitrate;
|
||||||
unsigned int m_size;
|
unsigned int m_size;
|
||||||
|
Reference in New Issue
Block a user