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

#include <mythdownloadmanager.h>

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

Public Member Functions

 MythDownloadManager ()
 Constructor for MythDownloadManager. More...
 
 ~MythDownloadManager ()
 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)
 
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, const 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, const bool reload=false)
 Downloads a URL to a file in blocking mode. More...
 
bool download (const QString &url, QByteArray *data, const bool reload=false)
 Downloads a URI to a QByteArray in blocking mode. More...
 
QNetworkReply * download (const QString &url, const 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, const 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)
 
QString getHeader (const QNetworkCacheMetaData &cacheData, const QString &header)
 Gets the value of an HTTP header from the cache. More...
 
- 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 ()
 
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=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 (unsigned long time=ULONG_MAX)
 Wait for the MThread to exit, with a maximum timeout. More...
 

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, const MRequestType reqType=kRequestGet, const bool reload=false)
 Adds a request to the download queue. More...
 
bool processItem (const QString &url, QNetworkRequest *req, const QString &dest, QByteArray *data, const MRequestType reqType=kRequestGet, const bool reload=false, AuthCallback authCallback=nullptr, void *authArg=nullptr, const QHash< QByteArray, QByteArray > *headers=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)
 
QUrl redirectUrl (const QUrl &possibleRedirectUrl, const QUrl &oldRedirectUrl) const
 Checks whether we were redirected to the given URL. More...
 
bool saveFile (const QString &outFile, const QByteArray &data, const bool append=false)
 Saves a QByteArray of data to a given filename. More...
 
void updateCookieJar (QNetworkCookieJar *jar)
 

Private Attributes

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

Friends

class RemoteFileDownloadThread
 

Additional Inherited Members

- Static Public Member Functions inherited from MThread
static void ThreadSetup (const QString &)
 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)
 
- Static Public Attributes inherited from MThread
static const int kDefaultStartTimeout
 
- 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 sleep (unsigned long time)
 
static void msleep (unsigned long time)
 
static void usleep (unsigned long time)
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread
 
QRunnable * m_runnable
 
bool m_prolog_executed
 
bool m_epilog_executed
 

Detailed Description

Definition at line 32 of file mythdownloadmanager.h.

Constructor & Destructor Documentation

◆ MythDownloadManager()

MythDownloadManager::MythDownloadManager ( )

Constructor for MythDownloadManager.

Instantiates a QNetworkAccessManager and QNetworkDiskCache.

Definition at line 194 of file mythdownloadmanager.cpp.

◆ ~MythDownloadManager()

MythDownloadManager::~MythDownloadManager ( )

Destructor for MythDownloadManager.

Definition at line 209 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 225 of file mythdownloadmanager.cpp.

◆ setRunThread()

void MythDownloadManager::setRunThread ( void  )
inline

Definition at line 42 of file mythdownloadmanager.h.

Referenced by GetMythDownloadManager().

◆ getQueueThread()

QThread* MythDownloadManager::getQueueThread ( void  )
inline

Definition at line 43 of file mythdownloadmanager.h.

Referenced by GetMythDownloadManager().

◆ isRunning()

bool MythDownloadManager::isRunning ( void  )
inline

Definition at line 44 of file mythdownloadmanager.h.

Referenced by GetMythDownloadManager().

◆ 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 413 of file mythdownloadmanager.cpp.

◆ queueDownload() [1/2]

void MythDownloadManager::queueDownload ( const QString &  url,
const QString &  dest,
QObject *  caller,
const 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 425 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 441 of file mythdownloadmanager.cpp.

◆ download() [1/4]

bool MythDownloadManager::download ( const QString &  url,
const QString &  dest,
const 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 462 of file mythdownloadmanager.cpp.

Referenced by ImportIconsWizard::checkAndDownload(), DownloadFile(), downloadURL(), MusicMetadata::getAlbumArtFile(), ChannelData::handleChannels(), MythImage::Load(), ThemeUpdateTask::LoadVersion(), ThemeChooser::LoadVersion(), MythImageReader::MythImageReader(), ThemeInfo::parseThemeInfo(), UPnpDeviceDesc::Retrieve(), and MetadataImageDownload::run().

◆ download() [2/4]

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

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 474 of file mythdownloadmanager.cpp.

◆ download() [3/4]

QNetworkReply * MythDownloadManager::download ( const QString &  url,
const 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 486 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 521 of file mythdownloadmanager.cpp.

◆ downloadAuth()

bool MythDownloadManager::downloadAuth ( const QString &  url,
const QString &  dest,
const 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 541 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 555 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 576 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 602 of file mythdownloadmanager.cpp.

Referenced by ImportIconsWizard::wget().

◆ 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 621 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 648 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 1038 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 1047 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 1134 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 1563 of file mythdownloadmanager.cpp.

Referenced by MythUIHelper::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 1657 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 1669 of file mythdownloadmanager.cpp.

Referenced by MythWebPage::~MythWebPage().

◆ setCookieJar()

void MythDownloadManager::setCookieJar ( QNetworkCookieJar *  cookieJar)

Definition at line 1680 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 1689 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 1706 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 1723 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 
)

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 1753 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 1209 of file mythdownloadmanager.cpp.

Referenced by 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 807 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 1167 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 1447 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 1232 of file mythdownloadmanager.cpp.

◆ queueItem()

void MythDownloadManager::queueItem ( const QString &  url,
QNetworkRequest *  req,
const QString &  dest,
QByteArray *  data,
QObject *  caller,
const MRequestType  reqType = kRequestGet,
const 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 355 of file mythdownloadmanager.cpp.

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

◆ processItem()

bool MythDownloadManager::processItem ( const QString &  url,
QNetworkRequest *  req,
const QString &  dest,
QByteArray *  data,
const MRequestType  reqType = kRequestGet,
const bool  reload = false,
AuthCallback  authCallbackFn = nullptr,
void *  authArg = nullptr,
const QHash< QByteArray, QByteArray > *  headers = 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 387 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 668 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 678 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 831 of file mythdownloadmanager.cpp.

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

◆ downloadCanceled()

void MythDownloadManager::downloadCanceled ( void  )
private

Definition at line 1100 of file mythdownloadmanager.cpp.

Referenced by cancelDownload(), and run().

◆ redirectUrl()

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

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 1194 of file mythdownloadmanager.cpp.

Referenced by downloadFinished().

◆ saveFile()

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

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 1507 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 156 of file mythdownloadmanager.h.

Referenced by downloadRemoteFile().

Member Data Documentation

◆ m_manager

QNetworkAccessManager* MythDownloadManager::m_manager
private

◆ m_diskCache

QNetworkDiskCache* MythDownloadManager::m_diskCache
private

Definition at line 136 of file mythdownloadmanager.h.

Referenced by run().

◆ m_proxy

QNetworkProxy* MythDownloadManager::m_proxy
private

Definition at line 137 of file mythdownloadmanager.h.

Referenced by run().

◆ m_queueWaitCond

QWaitCondition MythDownloadManager::m_queueWaitCond
private

◆ m_queueWaitLock

QMutex MythDownloadManager::m_queueWaitLock
private

Definition at line 140 of file mythdownloadmanager.h.

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

◆ m_infoLock

QMutex* MythDownloadManager::m_infoLock
private

◆ m_downloadInfos

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

Definition at line 143 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 145 of file mythdownloadmanager.h.

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

◆ m_cancellationQueue

QList<MythDownloadInfo*> MythDownloadManager::m_cancellationQueue
private

Definition at line 146 of file mythdownloadmanager.h.

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

◆ m_queueThread

QThread* MythDownloadManager::m_queueThread
private

Definition at line 148 of file mythdownloadmanager.h.

Referenced by run().

◆ m_runThread

bool MythDownloadManager::m_runThread
private

Definition at line 150 of file mythdownloadmanager.h.

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

◆ m_isRunning

bool MythDownloadManager::m_isRunning
private

Definition at line 151 of file mythdownloadmanager.h.

Referenced by run().

◆ m_inCookieJar

QNetworkCookieJar* MythDownloadManager::m_inCookieJar
private

◆ m_cookieLock

QMutex MythDownloadManager::m_cookieLock
private

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