UINetworkRequest.cpp revision 6a26bb78e94a73f6033178cf61a20caf316b86b2
/* $Id$ */
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UINetworkRequest stuff implementation
*/
/*
* Copyright (C) 2011-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/* Qt includes: */
#include <QNetworkReply>
/* GUI includes: */
#include "UINetworkRequest.h"
#include "UINetworkRequestWidget.h"
#include "UINetworkManager.h"
#include "UINetworkManagerDialog.h"
#include "UINetworkManagerIndicator.h"
#include "UINetworkCustomer.h"
#include "VBoxGlobal.h"
/* Constructor: */
UINetworkRequest::UINetworkRequest(const QNetworkRequest &request, UINetworkRequestType type, const QString &strDescription,
, m_fRunning(false)
{
/* Initialize: */
initialize();
}
UINetworkRequest::UINetworkRequest(const QList<QNetworkRequest> &requests, UINetworkRequestType type, const QString &strDescription,
, m_fRunning(false)
{
/* Initialize: */
initialize();
}
/* Destructor: */
{
/* Destroy network-reply: */
/* Remove network-request description from network-manager state-indicator: */
/* Remove network-request widget from network-manager dialog: */
}
/* Network-reply progress handler: */
{
/* Notify general network-requests listeners: */
/* Notify particular network-request listeners: */
}
/* Network-reply finish handler: */
{
/* Set as non-running: */
m_fRunning = false;
/* Make sure network-reply still valid: */
if (!m_pReply)
return;
/* If network-request was canceled: */
{
/* Notify network-manager: */
}
/* If network-reply has no errors: */
{
/* Check if redirection required: */
{
/* Cleanup current network-reply first: */
/* Choose redirect-source as current: */
/* Create new network-reply finally: */
}
else
{
/* Notify particular network-request listeners: */
emit sigFinished();
/* Notify general network-requests listeners: */
}
}
/* If some error occured: */
else
{
/* Check if we have other requests in set: */
{
/* Cleanup current network-reply first: */
/* Choose next network-request as current: */
/* Create new network-reply finally: */
}
else
{
/* Notify particular network-request listeners: */
/* Notify general network-requests listeners: */
}
}
}
/* Slot to retry network-request: */
void UINetworkRequest::sltRetry()
{
/* Cleanup current network-reply first: */
/* Choose first network-request as current: */
/* Create new network-reply finally: */
}
/* Slot to cancel network-request: */
void UINetworkRequest::sltCancel()
{
/* Abort network-reply if present: */
}
/* Initialize: */
void UINetworkRequest::initialize()
{
/* Prepare listeners for parent(): */
/* Create network-request widget in network-manager dialog: */
/* Create network-request description in network-manager state-indicator: */
/* Choose first network-request as current: */
/* Create network-reply: */
}
/* Prepare network-reply: */
void UINetworkRequest::prepareNetworkReply()
{
/* Make network-request: */
/* Prepare listeners for m_pReply: */
connect(m_pReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(sltHandleNetworkReplyProgress(qint64, qint64)));
/* Set as running: */
m_fRunning = true;
/* Notify general network-requests listeners: */
/* Notify particular network-request listeners: */
emit sigStarted();
}
/* Cleanup network-reply: */
void UINetworkRequest::cleanupNetworkReply()
{
/* Destroy current reply: */
m_pReply->disconnect();
m_pReply->deleteLater();
m_pReply = 0;
}
/* Abort network-reply: */
void UINetworkRequest::abortNetworkReply()
{
/* Abort network-reply if present: */
if (m_pReply)
{
if (m_fRunning)
else
}
}