Changeset 69197 in vbox for trunk/src/VBox
- Timestamp:
- Oct 24, 2017 10:19:03 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp
r69187 r69197 39 39 40 40 41 UIWizardCloneVD::UIWizardCloneVD(QWidget *pParent, const CMedium & sourceVirtualDisk)41 UIWizardCloneVD::UIWizardCloneVD(QWidget *pParent, const CMedium &comSourceVirtualDisk) 42 42 : UIWizard(pParent, WizardType_CloneVD) 43 , m_ sourceVirtualDisk(sourceVirtualDisk)43 , m_comSourceVirtualDisk(comSourceVirtualDisk) 44 44 { 45 45 #ifndef VBOX_WS_MAC … … 55 55 { 56 56 /* Gather attributes: */ 57 CMedium sourceVirtualDisk = field("sourceVirtualDisk").value<CMedium>();58 CMediumFormat mediumFormat = field("mediumFormat").value<CMediumFormat>();57 CMedium comSourceVirtualDisk = field("sourceVirtualDisk").value<CMedium>(); 58 CMediumFormat comMediumFormat = field("mediumFormat").value<CMediumFormat>(); 59 59 qulonglong uVariant = field("mediumVariant").toULongLong(); 60 60 QString strMediumPath = field("mediumPath").toString(); … … 65 65 66 66 /* Get VBox object: */ 67 CVirtualBox vbox = vboxGlobal().virtualBox();67 CVirtualBox comVBox = vboxGlobal().virtualBox(); 68 68 69 69 /* Create new virtual hard-disk: */ 70 CMedium virtualDisk = vbox.CreateMedium(mediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, KDeviceType_HardDisk);71 if (! vbox.isOk())70 CMedium comVirtualDisk = comVBox.CreateMedium(comMediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, KDeviceType_HardDisk); 71 if (!comVBox.isOk()) 72 72 { 73 msgCenter().cannotCreateHardDiskStorage( vbox, strMediumPath, this);73 msgCenter().cannotCreateHardDiskStorage(comVBox, strMediumPath, this); 74 74 return false; 75 75 } 76 76 77 77 /* Compose medium-variant: */ 78 QVector<KMediumVariant> variants(sizeof(qulonglong) *8);78 QVector<KMediumVariant> variants(sizeof(qulonglong) * 8); 79 79 for (int i = 0; i < variants.size(); ++i) 80 80 { … … 85 85 86 86 /* Copy existing virtual-disk to the new virtual-disk: */ 87 CProgress progress = sourceVirtualDisk.CloneTo(virtualDisk, variants, CMedium());88 if (! sourceVirtualDisk.isOk())87 CProgress comProgress = comSourceVirtualDisk.CloneTo(comVirtualDisk, variants, CMedium()); 88 if (!comSourceVirtualDisk.isOk()) 89 89 { 90 msgCenter().cannotCreateHardDiskStorage( sourceVirtualDisk, strMediumPath, this);90 msgCenter().cannotCreateHardDiskStorage(comSourceVirtualDisk, strMediumPath, this); 91 91 return false; 92 92 } 93 93 94 94 /* Show creation progress: */ 95 msgCenter().showModalProgressDialog( progress, windowTitle(), ":/progress_media_create_90px.png", this);96 if ( progress.GetCanceled())95 msgCenter().showModalProgressDialog(comProgress, windowTitle(), ":/progress_media_create_90px.png", this); 96 if (comProgress.GetCanceled()) 97 97 return false; 98 if (! progress.isOk() || progress.GetResultCode() != 0)98 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 99 99 { 100 msgCenter().cannotCreateHardDiskStorage( progress, strMediumPath, this);100 msgCenter().cannotCreateHardDiskStorage(comProgress, strMediumPath, this); 101 101 return false; 102 102 } 103 103 104 104 /* Remember created virtual-disk: */ 105 m_ virtualDisk = virtualDisk;105 m_comTargetVirtualDisk = comVirtualDisk; 106 106 107 107 /* Just close the created medium, it is not necessary yet: */ 108 m_ virtualDisk.Close();108 m_comTargetVirtualDisk.Close(); 109 109 110 110 return true; … … 128 128 case WizardMode_Basic: 129 129 { 130 setPage(Page1, new UIWizardCloneVDPageBasic1(m_ sourceVirtualDisk));130 setPage(Page1, new UIWizardCloneVDPageBasic1(m_comSourceVirtualDisk)); 131 131 setPage(Page2, new UIWizardCloneVDPageBasic2); 132 132 setPage(Page3, new UIWizardCloneVDPageBasic3); … … 136 136 case WizardMode_Expert: 137 137 { 138 setPage(PageExpert, new UIWizardCloneVDPageExpert(m_ sourceVirtualDisk));138 setPage(PageExpert, new UIWizardCloneVDPageExpert(m_comSourceVirtualDisk)); 139 139 break; 140 140 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h
r69187 r69197 49 49 }; 50 50 51 /** Constructs wizard to clone @a sourceVirtualDisk passing @a pParent to the base-class. */52 UIWizardCloneVD(QWidget *pParent, const CMedium & sourceVirtualDisk);51 /** Constructs wizard to clone @a comSourceVirtualDisk passing @a pParent to the base-class. */ 52 UIWizardCloneVD(QWidget *pParent, const CMedium &comSourceVirtualDisk); 53 53 54 54 /** Returns target virtual-disk. */ 55 CMedium virtualDisk() const { return m_virtualDisk; }55 CMedium targetVirtualDisk() const { return m_comTargetVirtualDisk; } 56 56 57 57 protected: … … 67 67 68 68 /** Handles translation event. */ 69 v oid retranslateUi();69 virtual void retranslateUi() /* override */; 70 70 71 71 /** Prepares all. */ 72 v oid prepare();72 virtual void prepare() /* override */; 73 73 74 74 /** Holds the source virtual disk wrapper. */ 75 CMedium m_ sourceVirtualDisk;75 CMedium m_comSourceVirtualDisk; 76 76 /** Holds the target virtual disk wrapper. */ 77 CMedium m_ virtualDisk;77 CMedium m_comTargetVirtualDisk; 78 78 }; 79 79 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp
r69187 r69197 58 58 } 59 59 60 void UIWizardCloneVDPage1::setSourceVirtualDisk(const CMedium & sourceVirtualDisk)60 void UIWizardCloneVDPage1::setSourceVirtualDisk(const CMedium &comSourceVirtualDisk) 61 61 { 62 m_pSourceDiskSelector->setCurrentItem( sourceVirtualDisk.GetId());62 m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId()); 63 63 } 64 64 65 UIWizardCloneVDPageBasic1::UIWizardCloneVDPageBasic1(const CMedium & sourceVirtualDisk)65 UIWizardCloneVDPageBasic1::UIWizardCloneVDPageBasic1(const CMedium &comSourceVirtualDisk) 66 66 { 67 67 /* Create widgets: */ … … 75 75 m_pSourceDiskSelector->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); 76 76 m_pSourceDiskSelector->setType(UIMediumType_HardDisk); 77 m_pSourceDiskSelector->setCurrentItem( sourceVirtualDisk.GetId());77 m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId()); 78 78 m_pSourceDiskSelector->repopulate(); 79 79 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h
r69187 r69197 46 46 CMedium sourceVirtualDisk() const; 47 47 /** Defines 'sourceVirtualDisk' field value. */ 48 void setSourceVirtualDisk(const CMedium & sourceVirtualDisk);48 void setSourceVirtualDisk(const CMedium &comSourceVirtualDisk); 49 49 50 50 /** Holds the source media combo-box instance. */ … … 64 64 65 65 /** Constructs basic page. 66 * @param sourceVirtualDisk Brings the initial source disk to make copy from. */67 UIWizardCloneVDPageBasic1(const CMedium & sourceVirtualDisk);66 * @param comSourceVirtualDisk Brings the initial source disk to make copy from. */ 67 UIWizardCloneVDPageBasic1(const CMedium &comSourceVirtualDisk); 68 68 69 69 protected: … … 80 80 81 81 /** Handles translation event. */ 82 v oid retranslateUi();82 virtual void retranslateUi() /* override */; 83 83 84 84 /** Prepares the page. */ 85 v oid initializePage();85 virtual void initializePage() /* override */; 86 86 87 87 /** Returns whether the page is complete. */ 88 bool isComplete() const;88 virtual bool isComplete() const /* override */; 89 89 90 90 /** Holds the description label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp
r69187 r69197 41 41 } 42 42 43 void UIWizardCloneVDPage2::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatLayout, CMediumFormat medFormat, bool fPreferred /* = false */)43 void UIWizardCloneVDPage2::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatLayout, CMediumFormat comMediumFormat, bool fPreferred /* = false */) 44 44 { 45 45 /* Check that medium format supports creation: */ 46 46 ULONG uFormatCapabilities = 0; 47 47 QVector<KMediumFormatCapabilities> capabilities; 48 capabilities = medFormat.GetCapabilities();48 capabilities = comMediumFormat.GetCapabilities(); 49 49 for (int i = 0; i < capabilities.size(); i++) 50 50 uFormatCapabilities |= capabilities[i]; … … 57 57 QVector<QString> fileExtensions; 58 58 QVector<KDeviceType> deviceTypes; 59 medFormat.DescribeFileExtensions(fileExtensions, deviceTypes);59 comMediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes); 60 60 if (!deviceTypes.contains(KDeviceType_HardDisk)) 61 61 return; … … 73 73 } 74 74 pFormatLayout->addWidget(pFormatButton); 75 m_formats << medFormat;76 m_formatNames << medFormat.GetName();75 m_formats << comMediumFormat; 76 m_formatNames << comMediumFormat.GetName(); 77 77 m_pFormatButtonGroup->addButton(pFormatButton, m_formatNames.size() - 1); 78 78 } … … 84 84 } 85 85 86 void UIWizardCloneVDPage2::setMediumFormat(const CMediumFormat & mediumFormat)87 { 88 int iPosition = m_formats.indexOf( mediumFormat);86 void UIWizardCloneVDPage2::setMediumFormat(const CMediumFormat &comMediumFormat) 87 { 88 int iPosition = m_formats.indexOf(comMediumFormat); 89 89 if (iPosition >= 0) 90 90 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h
r69187 r69197 42 42 43 43 /** Adds format button. 44 * @param pParent Brings the parent to add button to. 45 * @param pFormatsLayout Brings the layout to insert button to. 46 * @param medFormat Brings the medium format object to acquire format from. 47 * @param fPreferred Brings whether curretn format is preferred or not. */ 48 void addFormatButton(QWidget *pParent, QVBoxLayout *pFormatsLayout, CMediumFormat medFormat, bool fPreferred = false); 44 * @param pParent Brings the parent to add button to. 45 * @param pFormatsLayout Brings the layout to insert button to. 46 * @param comMediumFormat Brings the medium format object to acquire format from. 47 * @param fPreferred Brings whether curretn format is preferred or not. */ 48 void addFormatButton(QWidget *pParent, 49 QVBoxLayout *pFormatsLayout, 50 CMediumFormat comMediumFormat, 51 bool fPreferred = false); 49 52 50 53 /** Returns 'mediumFormat' field value. */ 51 54 CMediumFormat mediumFormat() const; 52 55 /** Defines 'mediumFormat' field value. */ 53 void setMediumFormat(const CMediumFormat & mediumFormat);56 void setMediumFormat(const CMediumFormat &comMediumFormat); 54 57 55 58 /** Holds the format button-group instance. */ … … 76 79 77 80 /** Handles translation event. */ 78 v oid retranslateUi();81 virtual void retranslateUi() /* override */; 79 82 80 83 /** Prepares the page. */ 81 v oid initializePage();84 virtual void initializePage() /* override */; 82 85 83 86 /** Returns whether the page is complete. */ 84 bool isComplete() const;87 virtual bool isComplete() const /* override */; 85 88 86 89 /** Returns the ID of the next page to traverse to. */ 87 int nextId() const;90 virtual int nextId() const /* override */; 88 91 89 92 /** Holds the description label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.h
r69187 r69197 67 67 68 68 /** Handles translation event. */ 69 v oid retranslateUi();69 virtual void retranslateUi() /* override */; 70 70 71 71 /** Prepares the page. */ 72 v oid initializePage();72 virtual void initializePage() /* override */; 73 73 74 74 /** Returns whether the page is complete. */ 75 bool isComplete() const;75 virtual bool isComplete() const /* override */; 76 76 77 77 /** Holds the description label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp
r69187 r69197 134 134 135 135 /* static */ 136 QString UIWizardCloneVDPage4::defaultExtension(const CMediumFormat & mediumFormatRef)136 QString UIWizardCloneVDPage4::defaultExtension(const CMediumFormat &comMediumFormat) 137 137 { 138 138 /* Load extension / device list: */ 139 139 QVector<QString> fileExtensions; 140 140 QVector<KDeviceType> deviceTypes; 141 CMediumFormat mediumFormat( mediumFormatRef);141 CMediumFormat mediumFormat(comMediumFormat); 142 142 mediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes); 143 143 for (int i = 0; i < fileExtensions.size(); ++i) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.h
r69187 r69197 48 48 static QString absoluteFilePath(const QString &strFileName, const QString &strDefaultPath); 49 49 /** Acquires @a strDefaultExtension on the basis of incoming @a mediumFormatRef. */ 50 static QString defaultExtension(const CMediumFormat & mediumFormatRef);50 static QString defaultExtension(const CMediumFormat &comMediumFormat); 51 51 52 52 /** Returns 'mediumPath' field value. */ … … 95 95 96 96 /** Handles translation event. */ 97 v oid retranslateUi();97 virtual void retranslateUi() /* override */; 98 98 99 99 /** Prepares the page. */ 100 v oid initializePage();100 virtual void initializePage() /* override */; 101 101 102 102 /** Returns whether the page is complete. */ 103 bool isComplete() const;103 virtual bool isComplete() const /* override */; 104 104 105 105 /** Returns whether the page is valid. */ 106 bool validatePage();106 virtual bool validatePage() /* override */; 107 107 108 108 /** Holds the description label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp
r69187 r69197 44 44 45 45 46 UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(const CMedium & sourceVirtualDisk)46 UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk) 47 47 { 48 48 /* Create widgets: */ … … 60 60 m_pSourceDiskSelector->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); 61 61 m_pSourceDiskSelector->setType(UIMediumType_HardDisk); 62 m_pSourceDiskSelector->setCurrentItem( sourceVirtualDisk.GetId());62 m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId()); 63 63 m_pSourceDiskSelector->repopulate(); 64 64 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.h
r69187 r69197 46 46 47 47 /** Constructs basic page. 48 * @param sourceVirtualDisk Brings the initial source disk to make copy from. */49 UIWizardCloneVDPageExpert(const CMedium & sourceVirtualDisk);48 * @param comSourceVirtualDisk Brings the initial source disk to make copy from. */ 49 UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk); 50 50 51 51 protected: … … 72 72 73 73 /** Handles translation event. */ 74 v oid retranslateUi();74 virtual void retranslateUi() /* override */; 75 75 76 76 /** Prepares the page. */ 77 v oid initializePage();77 virtual void initializePage() /* override */; 78 78 79 79 /** Returns whether the page is complete. */ 80 bool isComplete() const;80 virtual bool isComplete() const /* override */; 81 81 82 82 /** Returns whether the page is valid. */ 83 bool validatePage();83 virtual bool validatePage() /* override */; 84 84 85 85 /** Holds the source disk container instance. */
Note:
See TracChangeset
for help on using the changeset viewer.