VirtualBox

Changeset 92147 in vbox for trunk


Ignore:
Timestamp:
Oct 29, 2021 1:46:25 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: Revert r146354 and r146353 cause this functionality will be reworked different way.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r92132 r92147  
    14911491}
    14921492
    1493 void UIMessageCenter::cannotAssignFormValue(const QString &strError, QWidget *pParent /* = 0 */) const
     1493void UIMessageCenter::cannotAssignFormValue(const CBooleanFormValue &comValue, QWidget *pParent /* = 0 */) const
    14941494{
    14951495    error(pParent, MessageType_Error,
    14961496          tr("Failed to assign form value."),
    1497           strError);
     1497          UIErrorString::formatErrorInfo(comValue));
     1498}
     1499
     1500void UIMessageCenter::cannotAssignFormValue(const CStringFormValue &comValue, QWidget *pParent /* = 0 */) const
     1501{
     1502    error(pParent, MessageType_Error,
     1503          tr("Failed to assign form value."),
     1504          UIErrorString::formatErrorInfo(comValue));
     1505}
     1506
     1507void UIMessageCenter::cannotAssignFormValue(const CChoiceFormValue &comValue, QWidget *pParent /* = 0 */) const
     1508{
     1509    error(pParent, MessageType_Error,
     1510          tr("Failed to assign form value."),
     1511          UIErrorString::formatErrorInfo(comValue));
     1512}
     1513
     1514void UIMessageCenter::cannotAssignFormValue(const CRangedIntegerFormValue &comValue, QWidget *pParent /* = 0 */) const
     1515{
     1516    error(pParent, MessageType_Error,
     1517          tr("Failed to assign form value."),
     1518          UIErrorString::formatErrorInfo(comValue));
     1519}
     1520
     1521void UIMessageCenter::cannotAssignFormValue(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
     1522{
     1523    error(pParent, MessageType_Error,
     1524          tr("Failed to assign form value."),
     1525          UIErrorString::formatErrorInfo(comProgress));
    14981526}
    14991527
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r92132 r92147  
    392392    /** @name VirtualBox Manager / Cloud machine settings warnings.
    393393      * @{ */
    394         void cannotAssignFormValue(const QString &strError, QWidget *pParent = 0) const;
     394        void cannotAssignFormValue(const CBooleanFormValue &comValue, QWidget *pParent = 0) const;
     395        void cannotAssignFormValue(const CStringFormValue &comValue, QWidget *pParent = 0) const;
     396        void cannotAssignFormValue(const CChoiceFormValue &comValue, QWidget *pParent = 0) const;
     397        void cannotAssignFormValue(const CRangedIntegerFormValue &comValue, QWidget *pParent = 0) const;
     398        void cannotAssignFormValue(const CProgress &comProgress, QWidget *pParent = 0) const;
    395399    /** @} */
    396400
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFormEditorWidget.cpp

    r91637 r92147  
    3737#include "UIIconPool.h"
    3838#include "UIMessageCenter.h"
    39 #include "UIProgressObject.h"
    4039
    4140/* COM includes: */
     
    319318    Q_OBJECT;
    320319
    321 signals:
    322 
    323     /** Starts @a comProgress execution. */
    324     void sigStartProgress(const CProgress &comProgress);
    325     /** Notifies listeners about progress has started. */
    326     void sigProgressStarted();
    327     /** Notifies listeners about progress has changed.
    328       * @param  uPercent  Brings the progress percentage. */
    329     void sigProgressChange(ulong uPercent);
    330     /** Notifies listeners about progress has finished. */
    331     void sigProgressFinished();
    332 
    333320public:
    334321
     
    389376    /** Returns the child item with @a iIndex. */
    390377    virtual QITableViewCell *childItem(int iIndex) const /* override */;
    391 
    392 private slots:
    393 
    394     /** Handles request to start progress.
    395       * @param  comProgress  Brings the progress just started. */
    396     void sltHandleProgressStarted(CProgress comProgress);
    397     /** Handles progress failure.
    398       * @param  strError  Brings error information. */
    399     void sltHandleProgressFailed(const QString &strError);
    400378
    401379private:
     
    438416    Q_OBJECT;
    439417
    440 signals:
    441 
    442     /** Notifies listeners about progress has started. */
    443     void sigProgressStarted();
    444     /** Notifies listeners about progress has changed.
    445       * @param  uPercent  Brings the progress percentage. */
    446     void sigProgressChange(ulong uPercent);
    447     /** Notifies listeners about progress has finished. */
    448     void sigProgressFinished();
    449 
    450418public:
    451419
     
    755723    CBooleanFormValue comValue(m_comValue);
    756724    CProgress comProgress = comValue.SetSelected(fBool);
    757     emit sigStartProgress(comProgress);
     725
     726    /* Show error message if necessary: */
     727    if (!comValue.isOk())
     728        msgCenter().cannotAssignFormValue(comValue, table()->window());
     729    else
     730    {
     731        /* Show "Acquire export form" progress: */
     732        msgCenter().showModalProgressDialog(comProgress, UIFormEditorWidget::tr("Assign value ..."),
     733                                            ":/progress_refresh_90px.png",
     734                                            table()->window(), 0 /* duration */);
     735
     736        /* Show error message if necessary: */
     737        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     738            msgCenter().cannotAssignFormValue(comProgress, table()->window());
     739        else
     740            updateValueCells();
     741    }
    758742}
    759743
     
    775759    CStringFormValue comValue(m_comValue);
    776760    CProgress comProgress = comValue.SetString(text.text());
    777     emit sigStartProgress(comProgress);
     761
     762    /* Show error message if necessary: */
     763    if (!comValue.isOk())
     764        msgCenter().cannotAssignFormValue(comValue, table()->window());
     765    else
     766    {
     767        /* Show "Acquire export form" progress: */
     768        msgCenter().showModalProgressDialog(comProgress, UIFormEditorWidget::tr("Assign value ..."),
     769                                            ":/progress_refresh_90px.png",
     770                                            table()->window(), 0 /* duration */);
     771
     772        /* Show error message if necessary: */
     773        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     774            msgCenter().cannotAssignFormValue(comProgress, table()->window());
     775        else
     776            updateValueCells();
     777    }
    778778}
    779779
     
    789789    CStringFormValue comValue(m_comValue);
    790790    CProgress comProgress = comValue.SetString(strString);
    791     emit sigStartProgress(comProgress);
     791
     792    /* Show error message if necessary: */
     793    if (!comValue.isOk())
     794        msgCenter().cannotAssignFormValue(comValue, table()->window());
     795    else
     796    {
     797        /* Show "Acquire export form" progress: */
     798        msgCenter().showModalProgressDialog(comProgress, UIFormEditorWidget::tr("Assign value ..."),
     799                                            ":/progress_refresh_90px.png",
     800                                            table()->window(), 0 /* duration */);
     801
     802        /* Show error message if necessary: */
     803        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     804            msgCenter().cannotAssignFormValue(comProgress, table()->window());
     805        else
     806            updateValueCells();
     807    }
    792808}
    793809
     
    807823    CChoiceFormValue comValue(m_comValue);
    808824    CProgress comProgress = comValue.SetSelectedIndex(choice.selectedIndex());
    809     emit sigStartProgress(comProgress);
     825
     826    /* Show error message if necessary: */
     827    if (!comValue.isOk())
     828        msgCenter().cannotAssignFormValue(comValue, table()->window());
     829    else
     830    {
     831        /* Show "Acquire export form" progress: */
     832        msgCenter().showModalProgressDialog(comProgress, UIFormEditorWidget::tr("Assign value ..."),
     833                                            ":/progress_refresh_90px.png",
     834                                            table()->window(), 0 /* duration */);
     835
     836        /* Show error message if necessary: */
     837        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     838            msgCenter().cannotAssignFormValue(comProgress, table()->window());
     839        else
     840            updateValueCells();
     841    }
    810842}
    811843
     
    821853    CRangedIntegerFormValue comValue(m_comValue);
    822854    CProgress comProgress = comValue.SetInteger(rangedInteger.integer());
    823     emit sigStartProgress(comProgress);
     855
     856    /* Show error message if necessary: */
     857    if (!comValue.isOk())
     858        msgCenter().cannotAssignFormValue(comValue, table()->window());
     859    else
     860    {
     861        /* Show "Acquire export form" progress: */
     862        msgCenter().showModalProgressDialog(comProgress, UIFormEditorWidget::tr("Assign value ..."),
     863                                            ":/progress_refresh_90px.png",
     864                                            table()->window(), 0 /* duration */);
     865
     866        /* Show error message if necessary: */
     867        if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     868            msgCenter().cannotAssignFormValue(comProgress, table()->window());
     869        else
     870            updateValueCells();
     871    }
    824872}
    825873
     
    903951}
    904952
    905 void UIFormEditorRow::sltHandleProgressStarted(CProgress comProgress)
    906 {
    907     /* Make sure progress valid: */
    908     if (!comProgress.isNull() && !comProgress.GetCompleted())
    909     {
    910         /* Create set value progress object: */
    911         QPointer<UIProgressObject> pObject = new UIProgressObject(comProgress, this);
    912         if (pObject)
    913         {
    914             connect(pObject.data(), &UIProgressObject::sigProgressError,
    915                     this, &UIFormEditorRow::sltHandleProgressFailed);
    916             connect(pObject.data(), &UIProgressObject::sigProgressChange,
    917                     this, &UIFormEditorRow::sigProgressChange);
    918             connect(pObject.data(), &UIProgressObject::sigProgressComplete,
    919                     this, &UIFormEditorRow::sigProgressFinished);
    920             emit sigProgressStarted();
    921             pObject->exec();
    922             if (pObject)
    923                 delete pObject;
    924             else
    925             {
    926                 // Premature application shutdown,
    927                 // exit immediately:
    928                 return;
    929             }
    930         }
    931     }
    932 
    933     /* Update values finally: */
    934     updateValueCells();
    935 }
    936 
    937 void UIFormEditorRow::sltHandleProgressFailed(const QString &strError)
    938 {
    939     msgCenter().cannotAssignFormValue(strError, table()->window());
    940     emit sigProgressFinished();
    941 }
    942 
    943953void UIFormEditorRow::prepare()
    944954{
     
    954964    m_cells[UIFormEditorDataType_Value] = new UIFormEditorCell(this);
    955965    updateValueCells();
    956 
    957     /* Configure connections: */
    958     connect(this, &UIFormEditorRow::sigStartProgress,
    959             this, &UIFormEditorRow::sltHandleProgressStarted);
    960966}
    961967
     
    10011007    beginInsertRows(QModelIndex(), 0, values.size() - 1);
    10021008    foreach (const CFormValue &comValue, values)
    1003     {
    1004         UIFormEditorRow *pRow = new UIFormEditorRow(parentTable(), comValue);
    1005         if (pRow)
    1006         {
    1007             connect(pRow, &UIFormEditorRow::sigProgressStarted,
    1008                     this, &UIFormEditorModel::sigProgressStarted);
    1009             connect(pRow, &UIFormEditorRow::sigProgressChange,
    1010                     this, &UIFormEditorModel::sigProgressChange);
    1011             connect(pRow, &UIFormEditorRow::sigProgressFinished,
    1012                     this, &UIFormEditorModel::sigProgressFinished);
    1013             m_dataList << pRow;
    1014         }
    1015     }
     1009        m_dataList << new UIFormEditorRow(parentTable(), comValue);
    10161010    endInsertRows();
    10171011}
     
    15381532                    pProxyModel->setSourceModel(m_pTableModel);
    15391533                    m_pTableView->setModel(pProxyModel);
    1540                     connect(m_pTableModel, &UIFormEditorModel::sigProgressStarted,
    1541                             this, &UIFormEditorWidget::sigProgressStarted);
    1542                     connect(m_pTableModel, &UIFormEditorModel::sigProgressChange,
    1543                             this, &UIFormEditorWidget::sigProgressChange);
    1544                     connect(m_pTableModel, &UIFormEditorModel::sigProgressFinished,
    1545                             this, &UIFormEditorWidget::sigProgressFinished);
    15461534                }
    15471535            }
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFormEditorWidget.h

    r91637 r92147  
    4141{
    4242    Q_OBJECT;
    43 
    44 signals:
    45 
    46     /** Notifies listeners about progress has started. */
    47     void sigProgressStarted();
    48     /** Notifies listeners about progress has changed.
    49       * @param  uPercent  Brings the progress percentage. */
    50     void sigProgressChange(ulong uPercent);
    51     /** Notifies listeners about progress has finished. */
    52     void sigProgressFinished();
    5343
    5444public:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.cpp

    r92036 r92147  
    202202    connect(m_pSourceImageList, &QListWidget::currentRowChanged,
    203203            this, &UIWizardNewCloudVMPageExpert::sltHandleSourceImageChange);
    204     connect(m_pFormEditor, &UIFormEditorWidget::sigProgressStarted,
    205             this, &UIWizardNewCloudVMPageExpert::sigProgressStarted);
    206     connect(m_pFormEditor, &UIFormEditorWidget::sigProgressChange,
    207             this, &UIWizardNewCloudVMPageExpert::sigProgressChange);
    208     connect(m_pFormEditor, &UIFormEditorWidget::sigProgressFinished,
    209             this, &UIWizardNewCloudVMPageExpert::sigProgressFinished);
    210204}
    211205
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageProperties.cpp

    r92036 r92147  
    7979        }
    8080    }
    81 
    82     /* Setup connections: */
    83     connect(m_pFormEditor, &UIFormEditorWidget::sigProgressStarted,
    84             this, &UIWizardNewCloudVMPageProperties::sigProgressStarted);
    85     connect(m_pFormEditor, &UIFormEditorWidget::sigProgressChange,
    86             this, &UIWizardNewCloudVMPageProperties::sigProgressChange);
    87     connect(m_pFormEditor, &UIFormEditorWidget::sigProgressFinished,
    88             this, &UIWizardNewCloudVMPageProperties::sigProgressFinished);
    8981}
    9082
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