VirtualBox

Ignore:
Timestamp:
Oct 23, 2015 3:19:21 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Networking cleanup/rework (part 19): Do not pass static error information from network reply to network request widget since it should be re-acquirable on demand.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/net
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.cpp

    r57474 r58395  
    165165    m_pRetryButton->setHidden(false);
    166166
     167    /* Show error label: */
     168    m_pErrorPane->setHidden(false);
     169    m_pErrorPane->setText(composeErrorText(strError));
     170}
     171
     172void UINetworkRequestWidget::sltTimeIsOut()
     173{
     174    /* Stop timer: */
     175    m_pTimer->stop();
     176
     177    /* Set current progress to unknown: */
     178    m_pProgressBar->setRange(0, 0);
     179}
     180
     181void UINetworkRequestWidget::retranslateUi()
     182{
     183    /* Get corresponding title: */
     184    const QString &strTitle = m_pNetworkRequest->description();
     185
     186    /* Set popup title (default if missed): */
     187    setTitle(strTitle.isEmpty() ? UINetworkManagerDialog::tr("Network Operation") : strTitle);
     188
     189    /* Translate retry button: */
     190    m_pRetryButton->setStatusTip(UINetworkManagerDialog::tr("Restart network operation"));
     191
     192    /* Translate cancel button: */
     193    m_pCancelButton->setStatusTip(UINetworkManagerDialog::tr("Cancel network operation"));
     194
     195    /* Translate error label: */
     196    if (m_pNetworkRequest->reply())
     197        m_pErrorPane->setText(composeErrorText(m_pNetworkRequest->reply()->errorString()));
     198}
     199
     200/* static */
     201const QString UINetworkRequestWidget::composeErrorText(QString strErrorText)
     202{
     203    /* Null-string for null-string: */
     204    if (strErrorText.isEmpty())
     205        return QString();
     206
    167207    /* Try to find all the links in the error-message,
    168208     * replace them with %increment if present: */
    169     QString strErrorText(strError);
    170209    QRegExp linkRegExp("[\\S]+[\\./][\\S]+");
    171210    QStringList links;
     
    184223    strErrorText.prepend("<br>");
    185224
    186     /* Show error label: */
    187     m_pErrorPane->setHidden(false);
    188     m_pErrorPane->setText(UINetworkManagerDialog::tr("The network operation failed with the following error: %1.").arg(strErrorText));
    189 }
    190 
    191 void UINetworkRequestWidget::sltTimeIsOut()
    192 {
    193     /* Stop timer: */
    194     m_pTimer->stop();
    195 
    196     /* Set current progress to unknown: */
    197     m_pProgressBar->setRange(0, 0);
    198 }
    199 
    200 void UINetworkRequestWidget::retranslateUi()
    201 {
    202     /* Get corresponding title: */
    203     const QString &strTitle = m_pNetworkRequest->description();
    204 
    205     /* Set popup title (default if missed): */
    206     setTitle(strTitle.isEmpty() ? UINetworkManagerDialog::tr("Network Operation") : strTitle);
    207 
    208     /* Translate retry button: */
    209     m_pRetryButton->setStatusTip(UINetworkManagerDialog::tr("Restart network operation"));
    210 
    211     /* Translate cancel button: */
    212     m_pCancelButton->setStatusTip(UINetworkManagerDialog::tr("Cancel network operation"));
    213 }
     225    /* Return final result: */
     226    return UINetworkManagerDialog::tr("The network operation failed with the following error: %1.").arg(strErrorText);
     227}
     228
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.h

    r55401 r58395  
    7272    void retranslateUi();
    7373
     74    /** Composes error text on the basis of the passed @a strErrorText. */
     75    static const QString composeErrorText(QString strErrorText);
     76
    7477    /* Widgets: */
    7578    QWidget *m_pContentWidget;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette