5d21e43767a8ad1220a67c8954e95d687a433783vboxsync/** @file
d34409ad02ea0d28e08a6c4b089a412fdb3b4c9cvboxsync * VBox Qt GUI - UINetworkRequest stuff declaration.
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync/*
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync * Copyright (C) 2011-2012 Oracle Corporation
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync *
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync * available from http://www.virtualbox.org. This file is free software;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync * you can redistribute it and/or modify it under the terms of the GNU
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync * General Public License (GPL) as published by the Free Software
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync#ifndef __UINetworkRequest_h__
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync#define __UINetworkRequest_h__
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
6a26bb78e94a73f6033178cf61a20caf316b86b2vboxsync/* Qt includes: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync#include <QUuid>
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync#include <QNetworkRequest>
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync#include <QPointer>
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
6a26bb78e94a73f6033178cf61a20caf316b86b2vboxsync/* GUI inludes: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync#include "UINetworkDefs.h"
6a26bb78e94a73f6033178cf61a20caf316b86b2vboxsync#include "UINetworkReply.h"
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync/* Forward declarations: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncclass UINetworkManager;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncclass UINetworkManagerDialog;
430474e5ec398f769830a548d818d75ff37d5113vboxsyncclass UINetworkManagerIndicator;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncclass UINetworkRequestWidget;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncclass UINetworkCustomer;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync/* Network-request contianer: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncclass UINetworkRequest : public QObject
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync{
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync Q_OBJECT;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncsignals:
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Notifications to UINetworkManager: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sigProgress(const QUuid &uuid, qint64 iReceived, qint64 iTotal);
13825383b1d7b2c56ed9512bb01c6a060e10fff6vboxsync void sigStarted(const QUuid &uuid);
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sigCanceled(const QUuid &uuid);
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sigFinished(const QUuid &uuid);
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sigFailed(const QUuid &uuid, const QString &strError);
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Notifications to UINetworkRequestWidget: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sigProgress(qint64 iReceived, qint64 iTotal);
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sigStarted();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sigFinished();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sigFailed(const QString &strError);
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncpublic:
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Constructor/destructor: */
13825383b1d7b2c56ed9512bb01c6a060e10fff6vboxsync UINetworkRequest(const QNetworkRequest &request, UINetworkRequestType type, const QString &strDescription,
13825383b1d7b2c56ed9512bb01c6a060e10fff6vboxsync UINetworkCustomer *pCustomer,
13825383b1d7b2c56ed9512bb01c6a060e10fff6vboxsync UINetworkManager *pNetworkManager);
13825383b1d7b2c56ed9512bb01c6a060e10fff6vboxsync UINetworkRequest(const QList<QNetworkRequest> &requests, UINetworkRequestType type, const QString &strDescription,
13825383b1d7b2c56ed9512bb01c6a060e10fff6vboxsync UINetworkCustomer *pCustomer,
13825383b1d7b2c56ed9512bb01c6a060e10fff6vboxsync UINetworkManager *pNetworkManager);
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync ~UINetworkRequest();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Getters: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync const QUuid& uuid() const { return m_uuid; }
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync const QString& description() const { return m_strDescription; }
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync UINetworkCustomer* customer() { return m_pCustomer; }
6a26bb78e94a73f6033178cf61a20caf316b86b2vboxsync UINetworkReply* reply() { return m_pReply; }
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncprivate slots:
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Network-reply progress handler: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sltHandleNetworkReplyProgress(qint64 iReceived, qint64 iTotal);
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Network-reply finish handler: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sltHandleNetworkReplyFinish();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Slot to retry network-request: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sltRetry();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Slot to cancel network-request: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void sltCancel();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsyncprivate:
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Initialize: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void initialize();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Prepare network-reply: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void prepareNetworkReply();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Cleanup network-reply: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void cleanupNetworkReply();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Abort network-reply: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync void abortNetworkReply();
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Widgets: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync UINetworkManagerDialog *m_pNetworkManagerDialog;
430474e5ec398f769830a548d818d75ff37d5113vboxsync UINetworkManagerIndicator *m_pNetworkManagerIndicator;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync /* Variables: */
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync QUuid m_uuid;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync QList<QNetworkRequest> m_requests;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync QNetworkRequest m_request;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync int m_iCurrentRequestIndex;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync UINetworkRequestType m_type;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync QString m_strDescription;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync UINetworkCustomer *m_pCustomer;
6a26bb78e94a73f6033178cf61a20caf316b86b2vboxsync QPointer<UINetworkReply> m_pReply;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync bool m_fRunning;
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync};
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync
5d21e43767a8ad1220a67c8954e95d687a433783vboxsync#endif // __UINetworkRequest_h__