MythTV  master
Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
MythDownloadManager Class Reference

#include <libmythbase/mythdownloadmanager.h>

Inheritance diagram for MythDownloadManager:
[legend]
Collaboration diagram for MythDownloadManager:
[legend]

Public Member Functions

 MythDownloadManager ()
 Constructor for MythDownloadManager. More...
 
 ~MythDownloadManager () override
 Destructor for MythDownloadManager. More...
 
void run (void) override
 Runs a loop to process incoming download requests and triggers download events to be processed. More...
 
void setRunThread (void)
 
QThread * getQueueThread (void)
 
bool isRunning (void) const
 
void preCache (const QString &url)
 Downloads a URL but doesn't store the resulting data anywhere. More...
 
void queueDownload (const QString &url, const QString &dest, QObject *caller, bool reload=false)
 Adds a url to the download queue. More...
 
void queueDownload (QNetworkRequest *req, QByteArray *data, QObject *caller)
 Downloads a QNetworkRequest via the QNetworkAccessManager. More...
 
bool download (const QString &url, const QString &dest, bool reload=false)
 Downloads a URL to a file in blocking mode. More...
 
bool download (const QString &url, QByteArray *data, bool reload=false, QString *finalUrl=nullptr)
 Downloads a URI to a QByteArray in blocking mode. More...
 
QNetworkReply * download (const QString &url, bool reload=false)
 Downloads a URI to a QByteArray in blocking mode. More...
 
bool download (QNetworkRequest *req, QByteArray *data)
 Downloads a QNetworkRequest via the QNetworkAccessManager. More...
 
bool downloadAuth (const QString &url, const QString &dest, bool reload=false, AuthCallback authCallback=nullptr, void *authArg=nullptr, const QHash< QByteArray, QByteArray > *headers=nullptr)
 Downloads a URL to a file in blocking mode. More...
 
void queuePost (const QString &url, QByteArray *data, QObject *caller)
 Queues a post to a URL via the QNetworkAccessManager. More...
 
void queuePost (QNetworkRequest *req, QByteArray *data, QObject *caller)
 Queues a post to a URL via the QNetworkAccessManager. More...
 
bool post (const QString &url, QByteArray *data)
 Posts data to a url via the QNetworkAccessManager. More...
 
bool post (QNetworkRequest *req, QByteArray *data)
 Posts a QNetworkRequest via the QNetworkAccessManager. More...
 
bool postAuth (const QString &url, QByteArray *data, AuthCallback authCallback, void *authArg, const QHash< QByteArray, QByteArray > *headers=nullptr)
 Posts data to a url via the QNetworkAccessManager. More...
 
void cancelDownload (const QString &url, bool block=true)
 Cancel a queued or current download. More...
 
void cancelDownload (const QStringList &urls, bool block=true)
 Cancel a queued or current download. More...
 
void removeListener (QObject *caller)
 Disconnects the specified caller from any existing MythDownloadInfo instances. More...
 
QDateTime GetLastModified (const QString &url)
 Gets the Last Modified timestamp for a URI. More...
 
void loadCookieJar (const QString &filename)
 Loads the cookie jar from a cookie file. More...
 
void saveCookieJar (const QString &filename)
 Saves the cookie jar to a cookie file. More...
 
void setCookieJar (QNetworkCookieJar *cookieJar)
 
QNetworkCookieJar * copyCookieJar (void)
 Copy from one cookie jar to another. More...
 
void refreshCookieJar (QNetworkCookieJar *jar)
 Refresh the temporary cookie jar from another cookie jar. More...
 
void updateCookieJar (void)
 Update the cookie jar from the temporary cookie jar. More...
 
QString getHeader (const QUrl &url, const QString &header)
 
- Public Member Functions inherited from MThread
 MThread (const QString &objectName)
 Standard constructor. More...
 
 MThread (const QString &objectName, QRunnable *runnable)
 Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More...
 
virtual ~MThread ()
 
 MThread (const MThread &)=delete
 
MThreadoperator= (const MThread &)=delete
 
void RunProlog (void)
 Sets up a thread, call this if you reimplement run(). More...
 
void RunEpilog (void)
 Cleans up a thread's resources, call this if you reimplement run(). More...
 
QThread * qthread (void)
 Returns the thread, this will always return the same pointer no matter how often you restart the thread. More...
 
void setObjectName (const QString &name)
 
QString objectName (void) const
 
void setPriority (QThread::Priority priority)
 
QThread::Priority priority (void) const
 
bool isFinished (void) const
 
bool isRunning (void) const
 
void setStackSize (uint stackSize)
 
uint stackSize (void) const
 
void exit (int retcode=0)
 Use this to exit from the thread if you are using a Qt event loop. More...
 
void start (QThread::Priority p=QThread::InheritPriority)
 Tell MThread to start running the thread in the near future. More...
 
void terminate (void)
 Kill a thread unsafely. More...
 
void quit (void)
 calls exit(0) More...
 
bool wait (std::chrono::milliseconds time=std::chrono::milliseconds::max())
 Wait for the MThread to exit, with a maximum timeout. More...
 

Static Public Member Functions

static QString getHeader (const QNetworkCacheMetaData &cacheData, const QString &header)
 Gets the value of an HTTP header from the cache. More...
 
- Static Public Member Functions inherited from MThread
static void ThreadSetup (const QString &name)
 This is to be called on startup in those few threads that haven't been ported to MThread. More...
 
static void ThreadCleanup (void)
 This is to be called on exit in those few threads that haven't been ported to MThread. More...
 
static void Cleanup (void)
 This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More...
 
static void GetAllThreadNames (QStringList &list)
 
static void GetAllRunningThreadNames (QStringList &list)
 

Private Slots

void downloadFinished (QNetworkReply *reply)
 Slot to process download finished events. More...
 
void authCallback (QNetworkReply *reply, QAuthenticator *authenticator)
 Signal handler for authentication requests. More...
 
void downloadError (QNetworkReply::NetworkError errorCode)
 Slot to process download error events. More...
 
void downloadProgress (qint64 bytesReceived, qint64 bytesTotal)
 Slot to process download update events. More...
 

Private Member Functions

void downloadFinished (MythDownloadInfo *dlInfo)
 Callback to process download finished events. More...
 
void queueItem (const QString &url, QNetworkRequest *req, const QString &dest, QByteArray *data, QObject *caller, MRequestType reqType=kRequestGet, bool reload=false)
 Adds a request to the download queue. More...
 
bool processItem (const QString &url, QNetworkRequest *req, const QString &dest, QByteArray *data, MRequestType reqType=kRequestGet, bool reload=false, AuthCallback authCallback=nullptr, void *authArg=nullptr, const QHash< QByteArray, QByteArray > *headers=nullptr, QString *finalUrl=nullptr)
 Processes a network request immediately and waits for a response. More...
 
void downloadRemoteFile (MythDownloadInfo *dlInfo)
 Triggers a myth:// URI download in the background via RemoteFile. More...
 
void downloadQNetworkRequest (MythDownloadInfo *dlInfo)
 Downloads a QNetworkRequest via the QNetworkAccessManager. More...
 
bool downloadNow (MythDownloadInfo *dlInfo, bool deleteInfo=true)
 Download helper for download() blocking methods. More...
 
void downloadCanceled (void)
 
void updateCookieJar (QNetworkCookieJar *jar)
 

Static Private Member Functions

static QUrl redirectUrl (const QUrl &possibleRedirectUrl, const QUrl &oldRedirectUrl)
 Checks whether we were redirected to the given URL. More...
 
static bool saveFile (const QString &outFile, const QByteArray &data, bool append=false)
 Saves a QByteArray of data to a given filename. More...
 

Private Attributes

QNetworkAccessManager * m_manager {nullptr}
 
QNetworkDiskCache * m_diskCache {nullptr}
 
QNetworkProxy * m_proxy {nullptr}
 
QWaitCondition m_queueWaitCond
 
QMutex m_queueWaitLock
 
QRecursiveMutex * m_infoLock {nullptr}
 
QMap< QString, MythDownloadInfo * > m_downloadInfos
 
QMap< QNetworkReply *, MythDownloadInfo * > m_downloadReplies
 
QList< MythDownloadInfo * > m_downloadQueue
 
QList< MythDownloadInfo * > m_cancellationQueue
 
QThread * m_queueThread {nullptr}
 
bool m_runThread {false}
 
bool m_isRunning {false}
 
QNetworkCookieJar * m_inCookieJar {nullptr}
 
QMutex m_cookieLock
 

Friends

class RemoteFileDownloadThread
 

Additional Inherited Members

- Protected Member Functions inherited from MThread
int exec (void)
 Enters the qt event loop. call exit or quit to exit thread. More...
 
- Static Protected Member Functions inherited from MThread
static void setTerminationEnabled (bool enabled=true)
 
static void usleep (std::chrono::microseconds time)
 
template<typename R , typename P >
static std::enable_if_t< std::chrono::treat_as_floating_point< R >::value, void > usleep (std::chrono::duration< R, P > time)
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread {nullptr}
 
QRunnable * m_runnable {nullptr}
 
bool m_prologExecuted {true}
 
bool m_epilogExecuted {true}
 

Detailed Description

Definition at line 48 of file mythdownloadmanager.h.

Constructor & Destructor Documentation

◆ MythDownloadManager()

MythDownloadManager::MythDownloadManager ( )
inline

Constructor for MythDownloadManager.

Instantiates a QNetworkAccessManager and QNetworkDiskCache.

Definition at line 56 of file mythdownloadmanager.h.

◆ ~MythDownloadManager()

MythDownloadManager::~MythDownloadManager ( )
override

Destructor for MythDownloadManager.

Definition at line 177 of file mythdownloadmanager.cpp.

Member Function Documentation

◆ run()

void MythDownloadManager::run ( void  )
overridevirtual

Runs a loop to process incoming download requests and triggers download events to be processed.

Reimplemented from MThread.

Definition at line 191 of file mythdownloadmanager.cpp.

◆ setRunThread()

void MythDownloadManager::setRunThread ( void  )
inline

Definition at line 65 of file mythdownloadmanager.h.

◆ getQueueThread()

QThread* MythDownloadManager::getQueueThread ( void  )
inline

Definition at line 66 of file mythdownloadmanager.h.

◆ isRunning()

bool MythDownloadManager::isRunning ( void  ) const
inline

Definition at line 67 of file mythdownloadmanager.h.

◆ preCache()

void MythDownloadManager::preCache ( const QString &  url)

Downloads a URL but doesn't store the resulting data anywhere.

Parameters
urlURI to download.

Definition at line 381 of file mythdownloadmanager.cpp.

◆ queueDownload() [1/2]

void MythDownloadManager::queueDownload ( const QString &  url,
const QString &  dest,
QObject *  caller,
bool  reload = false 
)

Adds a url to the download queue.

Parameters
urlURI to download.
destDestination filename.
callerQObject to receive event notifications.
reloadWhether to force reloading of the URL or not

Definition at line 393 of file mythdownloadmanager.cpp.

Referenced by DecoderHandler::createPlaylistFromRemoteUrl(), ThemeChooser::customEvent(), MythWebView::doDownload(), FileServerHandler::HandleDownloadFile(), MainServer::HandleDownloadFile(), ThemeChooser::LoadVersion(), NewsSite::retrieve(), and ThemeChooser::saveAndReload().

◆ queueDownload() [2/2]

void MythDownloadManager::queueDownload ( QNetworkRequest *  req,
QByteArray *  data,
QObject *  caller 
)

Downloads a QNetworkRequest via the QNetworkAccessManager.

Parameters
reqNetwork request to GET
dataLocation to store download data
callerQObject of caller for event notification

Definition at line 409 of file mythdownloadmanager.cpp.

◆ download() [1/4]

bool MythDownloadManager::download ( const QString &  url,
const QString &  dest,
bool  reload = false 
)

Downloads a URL to a file in blocking mode.

Parameters
urlURI to download.
destDestination filename.
reloadWhether to force reloading of the URL or not
Returns
true if download was successful, false otherwise.

Definition at line 430 of file mythdownloadmanager.cpp.

Referenced by ImportIconsWizard::checkAndDownload(), V2Channel::CopyIconToBackend(), Content::DownloadFile(), V2Content::DownloadFile(), DownloadFile(), downloadURL(), RecExtEspnDataSource::loadPage(), RecExtMlbDataSource::loadPage(), ThemeUpdateTask::LoadVersion(), ThemeChooser::LoadVersion(), MythImageReader::MythImageReader(), ThemeInfo::parseThemeInfo(), UPnpDeviceDesc::Retrieve(), and MetadataImageDownload::run().

◆ download() [2/4]

bool MythDownloadManager::download ( const QString &  url,
QByteArray *  data,
bool  reload = false,
QString *  finalUrl = nullptr 
)

Downloads a URI to a QByteArray in blocking mode.

Parameters
urlURI to download.
dataPointer to destination QByteArray.
reloadWhether to force reloading of the URL or not
Returns
true if download was successful, false otherwise.

Definition at line 442 of file mythdownloadmanager.cpp.

◆ download() [3/4]

QNetworkReply * MythDownloadManager::download ( const QString &  url,
bool  reload = false 
)

Downloads a URI to a QByteArray in blocking mode.

Parameters
urlURI to download.
reloadWhether to force reloading of the URL or not
Returns
pointer to the QNetworkReply containing the download response, nullptr if an error

Definition at line 460 of file mythdownloadmanager.cpp.

◆ download() [4/4]

bool MythDownloadManager::download ( QNetworkRequest *  req,
QByteArray *  data 
)

Downloads a QNetworkRequest via the QNetworkAccessManager.

Parameters
reqInformation on the network request
dataLocation to store download data
Returns
true if download was successful, false otherwise.

Definition at line 495 of file mythdownloadmanager.cpp.

◆ downloadAuth()

bool MythDownloadManager::downloadAuth ( const QString &  url,
const QString &  dest,
bool  reload = false,
AuthCallback  authCallbackFn = nullptr,
void *  authArg = nullptr,
const QHash< QByteArray, QByteArray > *  headers = nullptr 
)

Downloads a URL to a file in blocking mode.

Parameters
urlURI to download.
destDestination filename.
reloadWhether to force reloading of the URL or not
authCallbackFnAuthCallback function for use with authentication
authArgOpaque argument for callback function
headersHash of optional HTTP header to add to the request
Returns
true if download was successful, false otherwise.

Definition at line 515 of file mythdownloadmanager.cpp.

◆ queuePost() [1/2]

void MythDownloadManager::queuePost ( const QString &  url,
QByteArray *  data,
QObject *  caller 
)

Queues a post to a URL via the QNetworkAccessManager.

Parameters
urlURL to post to
dataLocation holding post and response data
callerQObject of caller for event notification

Definition at line 529 of file mythdownloadmanager.cpp.

◆ queuePost() [2/2]

void MythDownloadManager::queuePost ( QNetworkRequest *  req,
QByteArray *  data,
QObject *  caller 
)

Queues a post to a URL via the QNetworkAccessManager.

Parameters
reqQNetworkRequest to post
dataLocation holding post and response data
callerQObject of caller for event notification

Definition at line 550 of file mythdownloadmanager.cpp.

◆ post() [1/2]

bool MythDownloadManager::post ( const QString &  url,
QByteArray *  data 
)

Posts data to a url via the QNetworkAccessManager.

Parameters
urlURL to post to
dataLocation holding post and response data
Returns
true if post was successful, false otherwise.

Definition at line 576 of file mythdownloadmanager.cpp.

◆ post() [2/2]

bool MythDownloadManager::post ( QNetworkRequest *  req,
QByteArray *  data 
)

Posts a QNetworkRequest via the QNetworkAccessManager.

Parameters
reqInformation on the network request
dataLocation holding post and response data
Returns
true if post was successful, false otherwise.

Definition at line 595 of file mythdownloadmanager.cpp.

◆ postAuth()

bool MythDownloadManager::postAuth ( const QString &  url,
QByteArray *  data,
AuthCallback  authCallbackFn,
void *  authArg,
const QHash< QByteArray, QByteArray > *  headers = nullptr 
)

Posts data to a url via the QNetworkAccessManager.

Parameters
urlURL to post to
dataLocation holding post and response data
authCallbackFnAuthCallback function for authentication
authArgOpaque argument for callback function
headersHash of optional HTTP headers to add to the request
Returns
true if post was successful, false otherwise.

Definition at line 622 of file mythdownloadmanager.cpp.

◆ cancelDownload() [1/2]

void MythDownloadManager::cancelDownload ( const QString &  url,
bool  block = true 
)

Cancel a queued or current download.

Parameters
urlURL for download to cancel
blockIf true, wait until all the cancellations have finished.

Definition at line 1013 of file mythdownloadmanager.cpp.

Referenced by cancelURL(), DecoderHandler::createPlaylistFromRemoteUrl(), NewsSite::deleteLater(), NewsSite::stop(), ThemeUpdateTask::Terminate(), and NewsSite::~NewsSite().

◆ cancelDownload() [2/2]

void MythDownloadManager::cancelDownload ( const QStringList &  urls,
bool  block = true 
)

Cancel a queued or current download.

Parameters
urlsList of URLs for download to cancel
blockIf true, wait until all the cancellations have finished.

Definition at line 1022 of file mythdownloadmanager.cpp.

◆ removeListener()

void MythDownloadManager::removeListener ( QObject *  caller)

Disconnects the specified caller from any existing MythDownloadInfo instances.

Parameters
callerQObject listener to remove

Definition at line 1106 of file mythdownloadmanager.cpp.

Referenced by NewsSite::deleteLater(), NewsSite::stop(), and NewsSite::~NewsSite().

◆ GetLastModified()

QDateTime MythDownloadManager::GetLastModified ( const QString &  url)

Gets the Last Modified timestamp for a URI.

Parameters
urlURI to test.
Returns
Timestamp the URI was last modified or now if an error occurred

Definition at line 1541 of file mythdownloadmanager.cpp.

Referenced by MythUIThemeCache::LoadCacheImage(), and MusicMetadata::updateStreamList().

◆ loadCookieJar()

void MythDownloadManager::loadCookieJar ( const QString &  filename)

Loads the cookie jar from a cookie file.

Parameters
filenameFilename of the cookie file to read.

Definition at line 1635 of file mythdownloadmanager.cpp.

Referenced by GetNetworkAccessManager().

◆ saveCookieJar()

void MythDownloadManager::saveCookieJar ( const QString &  filename)

Saves the cookie jar to a cookie file.

Parameters
filenameFilename of the cookie file to write.

Definition at line 1647 of file mythdownloadmanager.cpp.

Referenced by MythWebPage::~MythWebPage().

◆ setCookieJar()

void MythDownloadManager::setCookieJar ( QNetworkCookieJar *  cookieJar)

Definition at line 1660 of file mythdownloadmanager.cpp.

◆ copyCookieJar()

QNetworkCookieJar * MythDownloadManager::copyCookieJar ( void  )

Copy from one cookie jar to another.

Returns
new copy of the cookie jar

Definition at line 1669 of file mythdownloadmanager.cpp.

◆ refreshCookieJar()

void MythDownloadManager::refreshCookieJar ( QNetworkCookieJar *  jar)

Refresh the temporary cookie jar from another cookie jar.

Parameters
jarother cookie jar to update from

Definition at line 1688 of file mythdownloadmanager.cpp.

Referenced by MythWebPage::~MythWebPage().

◆ updateCookieJar() [1/2]

void MythDownloadManager::updateCookieJar ( void  )

Update the cookie jar from the temporary cookie jar.

Definition at line 1707 of file mythdownloadmanager.cpp.

Referenced by run().

◆ getHeader() [1/2]

QString MythDownloadManager::getHeader ( const QUrl &  url,
const QString &  header 
)

◆ getHeader() [2/2]

QString MythDownloadManager::getHeader ( const QNetworkCacheMetaData &  cacheData,
const QString &  header 
)
static

Gets the value of an HTTP header from the cache.

Parameters
cacheDataThe cache data to search through
headerWhich HTTP header to get the value of
Returns
a QString containing the value of the HTTP header

Definition at line 1740 of file mythdownloadmanager.cpp.

◆ downloadFinished [1/2]

void MythDownloadManager::downloadFinished ( QNetworkReply *  reply)
privateslot

Slot to process download finished events.

Parameters
replyQNetworkReply for completed download.

Definition at line 1182 of file mythdownloadmanager.cpp.

Referenced by run(), and RemoteFileDownloadThread::run().

◆ authCallback

void MythDownloadManager::authCallback ( QNetworkReply *  reply,
QAuthenticator *  authenticator 
)
privateslot

Signal handler for authentication requests.

Parameters
replyResponse from the remote server
authenticatorTo fill in with authentication details

Definition at line 781 of file mythdownloadmanager.cpp.

Referenced by downloadQNetworkRequest().

◆ downloadError

void MythDownloadManager::downloadError ( QNetworkReply::NetworkError  errorCode)
privateslot

Slot to process download error events.

Parameters
errorCodeerror code

Definition at line 1138 of file mythdownloadmanager.cpp.

Referenced by downloadFinished(), and downloadQNetworkRequest().

◆ downloadProgress

void MythDownloadManager::downloadProgress ( qint64  bytesReceived,
qint64  bytesTotal 
)
privateslot

Slot to process download update events.

Parameters
bytesReceivedBytes received so far
bytesTotalBytes total for the download, -1 if the total is unknown

Definition at line 1426 of file mythdownloadmanager.cpp.

Referenced by downloadFinished(), and downloadQNetworkRequest().

◆ downloadFinished() [2/2]

void MythDownloadManager::downloadFinished ( MythDownloadInfo dlInfo)
private

Callback to process download finished events.

Parameters
dlInfoMythDownloadInfo for completed download.

Definition at line 1205 of file mythdownloadmanager.cpp.

◆ queueItem()

void MythDownloadManager::queueItem ( const QString &  url,
QNetworkRequest *  req,
const QString &  dest,
QByteArray *  data,
QObject *  caller,
MRequestType  reqType = kRequestGet,
bool  reload = false 
)
private

Adds a request to the download queue.

Parameters
urlURI to download.
reqQNetworkRequest to queue
destDestination filename.
dataLocation of data for request
callerQObject to receive event notifications.
reqTypeIssue a POST/GET/HEAD request
reloadForce reloading of the URL

Definition at line 321 of file mythdownloadmanager.cpp.

Referenced by preCache(), queueDownload(), and queuePost().

◆ processItem()

bool MythDownloadManager::processItem ( const QString &  url,
QNetworkRequest *  req,
const QString &  dest,
QByteArray *  data,
MRequestType  reqType = kRequestGet,
bool  reload = false,
AuthCallback  authCallbackFn = nullptr,
void *  authArg = nullptr,
const QHash< QByteArray, QByteArray > *  headers = nullptr,
QString *  finalUrl = nullptr 
)
private

Processes a network request immediately and waits for a response.

Parameters
urlURI to download.
reqQNetworkRequest to queue
destDestination filename.
dataLocation of data for request
reqTypeIssue a POST/GET/HEAD request
reloadForce reloading of the URL
authCallbackAuthCallback function for authentication
authArgOpaque argument for callback function
headersHash of optional HTTP header to add to the request

Definition at line 353 of file mythdownloadmanager.cpp.

Referenced by download(), downloadAuth(), post(), and postAuth().

◆ downloadRemoteFile()

void MythDownloadManager::downloadRemoteFile ( MythDownloadInfo dlInfo)
private

Triggers a myth:// URI download in the background via RemoteFile.

Parameters
dlInfoMythDownloadInfo information for download

Definition at line 642 of file mythdownloadmanager.cpp.

Referenced by run().

◆ downloadQNetworkRequest()

void MythDownloadManager::downloadQNetworkRequest ( MythDownloadInfo dlInfo)
private

Downloads a QNetworkRequest via the QNetworkAccessManager.

Parameters
dlInfoMythDownloadInfo information for download

Definition at line 651 of file mythdownloadmanager.cpp.

Referenced by run().

◆ downloadNow()

bool MythDownloadManager::downloadNow ( MythDownloadInfo dlInfo,
bool  deleteInfo = true 
)
private

Download helper for download() blocking methods.

Parameters
dlInfoInformation on URI to download.
deleteInfoFlag to indicate whether to delete the provided MythDownloadInfo instance when done.
Returns
true if download was successful, false otherwise.

Definition at line 805 of file mythdownloadmanager.cpp.

Referenced by download(), GetLastModified(), and processItem().

◆ downloadCanceled()

void MythDownloadManager::downloadCanceled ( void  )
private

Definition at line 1073 of file mythdownloadmanager.cpp.

Referenced by cancelDownload(), and run().

◆ redirectUrl()

QUrl MythDownloadManager::redirectUrl ( const QUrl &  possibleRedirectUrl,
const QUrl &  oldRedirectUrl 
)
staticprivate

Checks whether we were redirected to the given URL.

Parameters
possibleRedirectUrlPossible Redirect URL
oldRedirectUrlOld Redirect URL
Returns
empty QUrl if we were not redirected, otherwise the redirected URL

Definition at line 1167 of file mythdownloadmanager.cpp.

Referenced by downloadFinished().

◆ saveFile()

bool MythDownloadManager::saveFile ( const QString &  outFile,
const QByteArray &  data,
bool  append = false 
)
staticprivate

Saves a QByteArray of data to a given filename.

Any parent directories are created automatically.

Parameters
outFileFilename to save to.
dataData to save.
appendAppend data to output file instead of overwriting.
Returns
true if successful, false otherwise

Definition at line 1488 of file mythdownloadmanager.cpp.

Referenced by downloadFinished(), and downloadProgress().

◆ updateCookieJar() [2/2]

void MythDownloadManager::updateCookieJar ( QNetworkCookieJar *  jar)
private

Friends And Related Function Documentation

◆ RemoteFileDownloadThread

friend class RemoteFileDownloadThread
friend

Definition at line 180 of file mythdownloadmanager.h.

Referenced by downloadRemoteFile().

Member Data Documentation

◆ m_manager

QNetworkAccessManager* MythDownloadManager::m_manager {nullptr}
private

◆ m_diskCache

QNetworkDiskCache* MythDownloadManager::m_diskCache {nullptr}
private

Definition at line 160 of file mythdownloadmanager.h.

Referenced by run().

◆ m_proxy

QNetworkProxy* MythDownloadManager::m_proxy {nullptr}
private

Definition at line 161 of file mythdownloadmanager.h.

Referenced by run().

◆ m_queueWaitCond

QWaitCondition MythDownloadManager::m_queueWaitCond
private

◆ m_queueWaitLock

QMutex MythDownloadManager::m_queueWaitLock
private

Definition at line 164 of file mythdownloadmanager.h.

Referenced by downloadNow(), refreshCookieJar(), and run().

◆ m_infoLock

QRecursiveMutex* MythDownloadManager::m_infoLock {nullptr}
private

◆ m_downloadInfos

QMap<QString, MythDownloadInfo*> MythDownloadManager::m_downloadInfos
private

Definition at line 167 of file mythdownloadmanager.h.

Referenced by cancelDownload(), downloadFinished(), removeListener(), and run().

◆ m_downloadReplies

QMap<QNetworkReply*, MythDownloadInfo*> MythDownloadManager::m_downloadReplies
private

◆ m_downloadQueue

QList<MythDownloadInfo*> MythDownloadManager::m_downloadQueue
private

Definition at line 169 of file mythdownloadmanager.h.

Referenced by cancelDownload(), downloadNow(), queueItem(), removeListener(), and run().

◆ m_cancellationQueue

QList<MythDownloadInfo*> MythDownloadManager::m_cancellationQueue
private

Definition at line 170 of file mythdownloadmanager.h.

Referenced by cancelDownload(), downloadCanceled(), and run().

◆ m_queueThread

QThread* MythDownloadManager::m_queueThread {nullptr}
private

Definition at line 172 of file mythdownloadmanager.h.

Referenced by run().

◆ m_runThread

bool MythDownloadManager::m_runThread {false}
private

Definition at line 174 of file mythdownloadmanager.h.

Referenced by run(), and ~MythDownloadManager().

◆ m_isRunning

bool MythDownloadManager::m_isRunning {false}
private

Definition at line 175 of file mythdownloadmanager.h.

Referenced by run().

◆ m_inCookieJar

QNetworkCookieJar* MythDownloadManager::m_inCookieJar {nullptr}
private

◆ m_cookieLock

QMutex MythDownloadManager::m_cookieLock
private

The documentation for this class was generated from the following files: