VirtualBox

Changeset 90388 in vbox for trunk/src


Ignore:
Timestamp:
Jul 29, 2021 7:57:29 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145974
Message:

FE/Qt: bugref:10067: UINotificationObjectItem: Moving common code related to details update to separate method; Also show details on error happened.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjectItem.cpp

    r90292 r90388  
    189189        if (m_pLabelDetails)
    190190        {
    191             m_pLabelDetails->setText(progress()->details());
    192191            int iHint = m_pLabelName->minimumSizeHint().width()
    193192                      + m_pLayoutUpper->spacing()
    194193                      + m_pButtonClose->minimumSizeHint().width();
    195194            m_pLabelDetails->setMinimumTextWidth(iHint);
     195            updateDetails();
    196196        }
    197197
     
    244244    /* Update details with error text if any: */
    245245    if (m_pLabelDetails)
    246     {
    247         const QString strDetails = progress()->details();
    248         const QString strError = progress()->error();
    249         const QString strFullDetails = strError.isNull()
    250                                      ? strDetails
    251                                      : QString("%1<br>%2").arg(strDetails, strError);
    252         m_pLabelDetails->setText(strFullDetails);
    253     }
     246        updateDetails();
    254247}
    255248
     
    257250{
    258251    return qobject_cast<UINotificationProgress*>(m_pObject);
     252}
     253
     254void UINotificationProgressItem::updateDetails()
     255{
     256    AssertPtrReturnVoid(m_pLabelDetails);
     257    const QString strDetails = progress()->details();
     258    const QString strError = progress()->error();
     259    const QString strFullDetails = strError.isNull()
     260                                 ? strDetails
     261                                 : QString("%1<br>%2").arg(strDetails, strError);
     262    m_pLabelDetails->setText(strFullDetails);
     263    if (!strError.isEmpty())
     264    {
     265        m_fToggled = true;
     266        m_pLabelDetails->setVisible(m_fToggled);
     267    }
    259268}
    260269
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjectItem.h

    r90290 r90388  
    104104    /** Holds the notification-progress this item created for. */
    105105    UINotificationProgress *progress() const;
     106
     107    /** Updates details. */
     108    void updateDetails();
    106109};
    107110
Note: See TracChangeset for help on using the changeset viewer.

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