UINetworkRequestWidget.cpp revision 22c01c0da1c882e8e6bc68ce31e619a4d24983e5
/* $Id$ */
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UINetworkRequestWidget 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.
*/
/* Global includes: */
#include <QTimer>
#include <QGridLayout>
#include <QProgressBar>
/* Local includes: */
#include "UINetworkRequestWidget.h"
#include "UINetworkRequest.h"
#include "UINetworkManager.h"
#include "UINetworkManagerDialog.h"
#include "UIIconPool.h"
#include "QIToolButton.h"
#include "QIRichTextLabel.h"
UINetworkRequestWidget::UINetworkRequestWidget(UINetworkManagerDialog *pParent, UINetworkRequest *pNetworkRequest)
, m_pContentWidget(new QWidget(this))
{
/* Setup self: */
setOpen(true);
/* Prepare listeners for m_pNetworkRequest: */
connect(m_pNetworkRequest, SIGNAL(sigProgress(qint64, qint64)), this, SLOT(sltSetProgress(qint64, qint64)));
connect(m_pNetworkRequest, SIGNAL(sigFailed(const QString&)), this, SLOT(sltSetProgressToFailed(const QString&)));
/* Setup timer: */
/* Setup main-layout: */
/* Setup progress-bar: */
m_pProgressBar->setRange(0, 0);
/* Setup retry-button: */
m_pRetryButton->setHidden(true);
/* Setup cancel-button: */
/* Setup error-label: */
m_pErrorPane->setHidden(true);
/* Calculate required width: */
/* Take into account content-widget layout margins: */
iMinimumWidth -= iLeft;
iMinimumWidth -= iRight;
/* Take into account this layout margins: */
iMinimumWidth -= iLeft;
iMinimumWidth -= iRight;
/* Take into account parent layout margins: */
iMinimumWidth -= iLeft;
iMinimumWidth -= iRight;
/* Set minimum text width: */
/* Layout content: */
/* Retranslate UI: */
}
{
/* Restart timer: */
/* Set current progress to passed: */
}
{
/* Start timer: */
/* Set current progress to 'started': */
m_pProgressBar->setValue(0);
/* Hide 'retry' button: */
m_pRetryButton->setHidden(true);
/* Hide error label: */
m_pErrorPane->setHidden(true);
}
{
/* Stop timer: */
/* Set current progress to 'started': */
}
{
/* Stop timer: */
/* Set current progress to 'failed': */
/* Show 'retry' button: */
m_pRetryButton->setHidden(false);
/* Try to find all the links in the error-message,
* replace them with %increment if present: */
{
}
/* Return back all the links, just in bold: */
/* Show error label: */
m_pErrorPane->setHidden(false);
m_pErrorPane->setText(UINetworkManagerDialog::tr("The network operation failed with the following error: %1.").arg(strErrorText));
}
void UINetworkRequestWidget::sltTimeIsOut()
{
/* Stop timer: */
/* Set current progress to unknown: */
m_pProgressBar->setRange(0, 0);
}
void UINetworkRequestWidget::retranslateUi()
{
/* Get corresponding title: */
/* Set popup title (default if missed): */
/* Translate retry button: */
/* Translate cancel button: */
}