- Timestamp:
- Oct 29, 2021 1:46:25 PM (3 years ago)
- 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 1491 1491 } 1492 1492 1493 void UIMessageCenter::cannotAssignFormValue(const QString &strError, QWidget *pParent /* = 0 */) const1493 void UIMessageCenter::cannotAssignFormValue(const CBooleanFormValue &comValue, QWidget *pParent /* = 0 */) const 1494 1494 { 1495 1495 error(pParent, MessageType_Error, 1496 1496 tr("Failed to assign form value."), 1497 strError); 1497 UIErrorString::formatErrorInfo(comValue)); 1498 } 1499 1500 void 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 1507 void 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 1514 void 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 1521 void 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)); 1498 1526 } 1499 1527 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r92132 r92147 392 392 /** @name VirtualBox Manager / Cloud machine settings warnings. 393 393 * @{ */ 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; 395 399 /** @} */ 396 400 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFormEditorWidget.cpp
r91637 r92147 37 37 #include "UIIconPool.h" 38 38 #include "UIMessageCenter.h" 39 #include "UIProgressObject.h"40 39 41 40 /* COM includes: */ … … 319 318 Q_OBJECT; 320 319 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 333 320 public: 334 321 … … 389 376 /** Returns the child item with @a iIndex. */ 390 377 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);400 378 401 379 private: … … 438 416 Q_OBJECT; 439 417 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 450 418 public: 451 419 … … 755 723 CBooleanFormValue comValue(m_comValue); 756 724 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 } 758 742 } 759 743 … … 775 759 CStringFormValue comValue(m_comValue); 776 760 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 } 778 778 } 779 779 … … 789 789 CStringFormValue comValue(m_comValue); 790 790 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 } 792 808 } 793 809 … … 807 823 CChoiceFormValue comValue(m_comValue); 808 824 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 } 810 842 } 811 843 … … 821 853 CRangedIntegerFormValue comValue(m_comValue); 822 854 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 } 824 872 } 825 873 … … 903 951 } 904 952 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 else925 {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 943 953 void UIFormEditorRow::prepare() 944 954 { … … 954 964 m_cells[UIFormEditorDataType_Value] = new UIFormEditorCell(this); 955 965 updateValueCells(); 956 957 /* Configure connections: */958 connect(this, &UIFormEditorRow::sigStartProgress,959 this, &UIFormEditorRow::sltHandleProgressStarted);960 966 } 961 967 … … 1001 1007 beginInsertRows(QModelIndex(), 0, values.size() - 1); 1002 1008 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); 1016 1010 endInsertRows(); 1017 1011 } … … 1538 1532 pProxyModel->setSourceModel(m_pTableModel); 1539 1533 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);1546 1534 } 1547 1535 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFormEditorWidget.h
r91637 r92147 41 41 { 42 42 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();53 43 54 44 public: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageExpert.cpp
r92036 r92147 202 202 connect(m_pSourceImageList, &QListWidget::currentRowChanged, 203 203 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);210 204 } 211 205 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVMPageProperties.cpp
r92036 r92147 79 79 } 80 80 } 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);89 81 } 90 82
Note:
See TracChangeset
for help on using the changeset viewer.