Changeset 69200 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 24, 2017 11:28:50 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r68721 r69200 1627 1627 } 1628 1628 1629 void UIMessageCenter::cannotCreateMediumStorage(const CVirtualBox &comVBox, const QString &strLocation, QWidget *pParent /* = 0 */) const 1630 { 1631 error(pParent, MessageType_Error, 1632 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>") 1633 .arg(strLocation), 1634 UIErrorString::formatErrorInfo(comVBox)); 1635 } 1636 1637 void UIMessageCenter::cannotCreateMediumStorage(const CMedium &comMedium, const QString &strLocation, QWidget *pParent /* = 0 */) const 1638 { 1639 error(pParent, MessageType_Error, 1640 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>") 1641 .arg(strLocation), 1642 UIErrorString::formatErrorInfo(comMedium)); 1643 } 1644 1645 void UIMessageCenter::cannotCreateMediumStorage(const CProgress &comProgress, const QString &strLocation, QWidget *pParent /* = 0 */) const 1646 { 1647 error(pParent, MessageType_Error, 1648 tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>") 1649 .arg(strLocation), 1650 UIErrorString::formatErrorInfo(comProgress)); 1651 } 1652 1629 1653 void UIMessageCenter::cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const 1630 1654 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r68721 r69200 283 283 void cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0) const; 284 284 void cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0) const; 285 void cannotCreateMediumStorage(const CVirtualBox &comVBox, const QString &strLocation, QWidget *pParent = 0) const; 286 void cannotCreateMediumStorage(const CMedium &comMedium, const QString &strLocation, QWidget *pParent = 0) const; 287 void cannotCreateMediumStorage(const CProgress &comProgress, const QString &strLocation, QWidget *pParent = 0) const; 285 288 void cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent = 0) const; 286 289 void cannotRewriteMachineFolder(const QString &strFolderName, QWidget *pParent = 0) const; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r69130 r69200 73 73 74 74 /** Copies UIMedium wrapped by <i>this</i> item. */ 75 virtual bool copy() = 0;75 virtual bool copy(); 76 76 /** Moves UIMedium wrapped by <i>this</i> item. */ 77 77 virtual bool move(); … … 163 163 protected: 164 164 165 /** Copies UIMedium wrapped by <i>this</i> item. */166 virtual bool copy() /* override */;167 165 /** Removes UIMedium wrapped by <i>this</i> item. */ 168 166 virtual bool remove() /* override */; … … 188 186 protected: 189 187 190 /** Copies UIMedium wrapped by <i>this</i> item. */191 virtual bool copy() /* override */;192 188 /** Removes UIMedium wrapped by <i>this</i> item. */ 193 189 virtual bool remove() /* override */; … … 208 204 protected: 209 205 210 /** Copies UIMedium wrapped by <i>this</i> item. */211 virtual bool copy() /* override */;212 206 /** Removes UIMedium wrapped by <i>this</i> item. */ 213 207 virtual bool remove() /* override */; … … 376 370 } 377 371 372 bool UIMediumItem::copy() 373 { 374 /* Show Clone VD wizard: */ 375 UISafePointerWizard pWizard = new UIWizardCloneVD(treeWidget(), medium().medium()); 376 pWizard->prepare(); 377 pWizard->exec(); 378 379 /* Delete if still exists: */ 380 if (pWizard) 381 delete pWizard; 382 383 /* True by default: */ 384 return true; 385 } 386 378 387 bool UIMediumItem::release() 379 388 { … … 546 555 : UIMediumItem(guiMedium, pParent) 547 556 { 548 }549 550 bool UIMediumItemHD::copy()551 {552 /* Show Clone VD wizard: */553 UISafePointerWizard pWizard = new UIWizardCloneVD(treeWidget(), medium().medium());554 pWizard->prepare();555 pWizard->exec();556 557 /* Delete if still exists: */558 if (pWizard)559 delete pWizard;560 561 /* True by default: */562 return true;563 557 } 564 558 … … 685 679 } 686 680 687 bool UIMediumItemCD::copy()688 {689 AssertMsgFailedReturn(("That functionality in not supported!\n"), false);690 }691 692 681 bool UIMediumItemCD::remove() 693 682 { … … 754 743 : UIMediumItem(guiMedium, pParent) 755 744 { 756 }757 758 bool UIMediumItemFD::copy()759 {760 AssertMsgFailedReturn(("That functionality in not supported!\n"), false);761 745 } 762 746 … … 1787 1771 if (m_pActionCopy) 1788 1772 { 1789 bool fActionEnabledCopy = currentMediumType() == UIMediumType_HardDisk && 1790 fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Copy); 1773 bool fActionEnabledCopy = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Copy); 1791 1774 m_pActionCopy->setEnabled(fActionEnabledCopy); 1792 1775 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp
r69198 r69200 39 39 : UIWizard(pParent, WizardType_CloneVD) 40 40 , m_comSourceVirtualDisk(comSourceVirtualDisk) 41 , m_enmSourceVirtualDiskDeviceType(m_comSourceVirtualDisk.GetDeviceType()) 41 42 { 42 43 #ifndef VBOX_WS_MAC … … 64 65 CVirtualBox comVBox = vboxGlobal().virtualBox(); 65 66 66 /* Create new virtual hard-disk: */67 CMedium comVirtualDisk = comVBox.CreateMedium(comMediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, KDeviceType_HardDisk);67 /* Create new virtual disk image: */ 68 CMedium comVirtualDisk = comVBox.CreateMedium(comMediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, m_enmSourceVirtualDiskDeviceType); 68 69 if (!comVBox.isOk()) 69 70 { 70 msgCenter().cannotCreate HardDiskStorage(comVBox, strMediumPath, this);71 msgCenter().cannotCreateMediumStorage(comVBox, strMediumPath, this); 71 72 return false; 72 73 } … … 81 82 } 82 83 83 /* Copy existing virtual-disk to the new virtual-disk: */84 /* Copy source image to new one: */ 84 85 CProgress comProgress = comSourceVirtualDisk.CloneTo(comVirtualDisk, variants, CMedium()); 85 86 if (!comSourceVirtualDisk.isOk()) 86 87 { 87 msgCenter().cannotCreate HardDiskStorage(comSourceVirtualDisk, strMediumPath, this);88 msgCenter().cannotCreateMediumStorage(comSourceVirtualDisk, strMediumPath, this); 88 89 return false; 89 90 } … … 95 96 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 96 97 { 97 msgCenter().cannotCreate HardDiskStorage(comProgress, strMediumPath, this);98 msgCenter().cannotCreateMediumStorage(comProgress, strMediumPath, this); 98 99 return false; 99 100 } 100 101 101 /* Remember created virtual-disk: */102 /* Save created image as target one: */ 102 103 m_comTargetVirtualDisk = comVirtualDisk; 103 104 104 /* Just close the created medium, it is not necessary yet: */105 /* Just close the created image, it is not required anymore: */ 105 106 m_comTargetVirtualDisk.Close(); 106 107 … … 114 115 115 116 /* Translate wizard: */ 116 setWindowTitle(tr("Copy Virtual Hard Disk"));117 setWindowTitle(tr("Copy Virtual Disk Image")); 117 118 setButtonText(QWizard::FinishButton, tr("Copy")); 118 119 } … … 125 126 case WizardMode_Basic: 126 127 { 127 setPage(Page1, new UIWizardCloneVDPageBasic1(m_comSourceVirtualDisk)); 128 setPage(Page2, new UIWizardCloneVDPageBasic2); 129 setPage(Page3, new UIWizardCloneVDPageBasic3); 128 setPage(Page1, new UIWizardCloneVDPageBasic1(m_comSourceVirtualDisk, 129 m_enmSourceVirtualDiskDeviceType)); 130 setPage(Page2, new UIWizardCloneVDPageBasic2(m_enmSourceVirtualDiskDeviceType)); 131 setPage(Page3, new UIWizardCloneVDPageBasic3(m_enmSourceVirtualDiskDeviceType)); 130 132 setPage(Page4, new UIWizardCloneVDPageBasic4); 131 133 break; … … 133 135 case WizardMode_Expert: 134 136 { 135 setPage(PageExpert, new UIWizardCloneVDPageExpert(m_comSourceVirtualDisk)); 137 setPage(PageExpert, new UIWizardCloneVDPageExpert(m_comSourceVirtualDisk, 138 m_enmSourceVirtualDiskDeviceType)); 136 139 break; 137 140 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h
r69198 r69200 57 57 CMedium targetVirtualDisk() const { return m_comTargetVirtualDisk; } 58 58 59 /** Returns the source virtual-disk device type. */ 60 KDeviceType sourceVirtualDiskDeviceType() const { return m_enmSourceVirtualDiskDeviceType; } 61 59 62 /** Makes a copy of source virtual-disk. */ 60 63 bool copyVirtualDisk(); … … 72 75 /** Holds the target virtual disk wrapper. */ 73 76 CMedium m_comTargetVirtualDisk; 77 78 /** Holds the source virtual-disk device type. */ 79 KDeviceType m_enmSourceVirtualDiskDeviceType; 74 80 }; 75 81 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp
r69197 r69200 42 42 void UIWizardCloneVDPage1::onHandleOpenSourceDiskClick() 43 43 { 44 /* Get current virtual-disk medium type: */ 45 const UIMediumType enmMediumType = UIMediumDefs::mediumTypeToLocal(sourceVirtualDisk().GetDeviceType()); 44 46 /* Get source virtual-disk using file-open dialog: */ 45 QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog( UIMediumType_HardDisk, thisImp());47 QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(enmMediumType, thisImp()); 46 48 if (!strMediumId.isNull()) 47 49 { … … 63 65 } 64 66 65 UIWizardCloneVDPageBasic1::UIWizardCloneVDPageBasic1(const CMedium &comSourceVirtualDisk )67 UIWizardCloneVDPageBasic1::UIWizardCloneVDPageBasic1(const CMedium &comSourceVirtualDisk, KDeviceType enmDeviceType) 66 68 { 67 69 /* Create widgets: */ … … 74 76 { 75 77 m_pSourceDiskSelector->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); 76 m_pSourceDiskSelector->setType(UIMedium Type_HardDisk);78 m_pSourceDiskSelector->setType(UIMediumDefs::mediumTypeToLocal(enmDeviceType)); 77 79 m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId()); 78 80 m_pSourceDiskSelector->repopulate(); … … 113 115 { 114 116 /* Translate page: */ 115 setTitle(UIWizardCloneVD::tr(" Hard diskto copy"));117 setTitle(UIWizardCloneVD::tr("Disk image to copy")); 116 118 117 119 /* Translate widgets: */ 118 m_pLabel->setText(UIWizardCloneVD::tr("<p>Please select the virtual hard diskfile that you would like to copy "120 m_pLabel->setText(UIWizardCloneVD::tr("<p>Please select the virtual disk image file that you would like to copy " 119 121 "if it is not already selected. You can either choose one from the list " 120 122 "or use the folder icon beside the list to select one.</p>")); 121 m_pSourceDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a virtual hard diskfile to copy..."));123 m_pSourceDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a virtual disk image file to copy...")); 122 124 } 123 125 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h
r69197 r69200 65 65 /** Constructs basic page. 66 66 * @param comSourceVirtualDisk Brings the initial source disk to make copy from. */ 67 UIWizardCloneVDPageBasic1(const CMedium &comSourceVirtualDisk );67 UIWizardCloneVDPageBasic1(const CMedium &comSourceVirtualDisk, KDeviceType enmDeviceType); 68 68 69 69 protected: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp
r69197 r69200 41 41 } 42 42 43 void UIWizardCloneVDPage2::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatLayout, CMediumFormat comMediumFormat, bool fPreferred /* = false */)43 void UIWizardCloneVDPage2::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatLayout, KDeviceType enmDeviceType, CMediumFormat comMediumFormat, bool fPreferred /* = false */) 44 44 { 45 45 /* Check that medium format supports creation: */ … … 54 54 return; 55 55 56 /* Check that medium format supports creation of virtual hard-disks: */56 /* Check that medium format supports creation of virtual disk images: */ 57 57 QVector<QString> fileExtensions; 58 58 QVector<KDeviceType> deviceTypes; 59 59 comMediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes); 60 if (!deviceTypes.contains( KDeviceType_HardDisk))60 if (!deviceTypes.contains(enmDeviceType)) 61 61 return; 62 62 … … 94 94 } 95 95 96 UIWizardCloneVDPageBasic2::UIWizardCloneVDPageBasic2( )96 UIWizardCloneVDPageBasic2::UIWizardCloneVDPageBasic2(KDeviceType enmDeviceType) 97 97 { 98 98 /* Create widgets: */ … … 107 107 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); 108 108 const QVector<CMediumFormat> &formats = properties.GetMediumFormats(); 109 QMap<QString, CMediumFormat> vdi, preferred ;109 QMap<QString, CMediumFormat> vdi, preferred, others; 110 110 foreach (const CMediumFormat &format, formats) 111 111 { … … 119 119 if (capabilities.contains(KMediumFormatCapabilities_Preferred)) 120 120 preferred[format.GetId()] = format; 121 /* Then others: */ 122 else 123 others[format.GetId()] = format; 121 124 } 122 125 } … … 124 127 /* Create buttons for VDI and preferred: */ 125 128 foreach (const QString &strId, vdi.keys()) 126 addFormatButton(this, pFormatLayout, vdi.value(strId));129 addFormatButton(this, pFormatLayout, enmDeviceType, vdi.value(strId)); 127 130 foreach (const QString &strId, preferred.keys()) 128 addFormatButton(this, pFormatLayout, preferred.value(strId)); 131 addFormatButton(this, pFormatLayout, enmDeviceType, preferred.value(strId)); 132 if (enmDeviceType == KDeviceType_DVD || enmDeviceType == KDeviceType_Floppy) 133 foreach (const QString &strId, others.keys()) 134 addFormatButton(this, pFormatLayout, enmDeviceType, others.value(strId)); 129 135 130 136 if (!m_pFormatButtonGroup->buttons().isEmpty()) … … 152 158 { 153 159 /* Translate page: */ 154 setTitle(UIWizardCloneVD::tr(" Hard diskfile type"));160 setTitle(UIWizardCloneVD::tr("Disk image file type")); 155 161 156 162 /* Translate widgets: */ 157 163 m_pLabel->setText(UIWizardCloneVD::tr("Please choose the type of file that you would like to use " 158 "for the new virtual hard disk. If you do not need to use it "164 "for the new virtual disk image. If you do not need to use it " 159 165 "with other virtualization software you can leave this setting unchanged.")); 160 166 QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons(); -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h
r69197 r69200 44 44 * @param pParent Brings the parent to add button to. 45 45 * @param pFormatsLayout Brings the layout to insert button to. 46 * @param enmDeviceType Brings the device type all buttons should be restricted to. 46 47 * @param comMediumFormat Brings the medium format object to acquire format from. 47 48 * @param fPreferred Brings whether curretn format is preferred or not. */ 48 49 void addFormatButton(QWidget *pParent, 49 50 QVBoxLayout *pFormatsLayout, 51 KDeviceType enmDeviceType, 50 52 CMediumFormat comMediumFormat, 51 53 bool fPreferred = false); … … 73 75 public: 74 76 75 /** Constructs basic page. */ 76 UIWizardCloneVDPageBasic2(); 77 /** Constructs basic page. 78 * @param enmDeviceType Brings the device type to limit format to. */ 79 UIWizardCloneVDPageBasic2(KDeviceType enmDeviceType); 77 80 78 81 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp
r69187 r69200 78 78 } 79 79 80 UIWizardCloneVDPageBasic3::UIWizardCloneVDPageBasic3( )80 UIWizardCloneVDPageBasic3::UIWizardCloneVDPageBasic3(KDeviceType enmDeviceType) 81 81 { 82 82 /* Create widgets: */ … … 92 92 { 93 93 m_pDynamicalButton = new QRadioButton(this); 94 if (enmDeviceType == KDeviceType_HardDisk) 94 95 { 95 96 m_pDynamicalButton->click(); … … 97 98 } 98 99 m_pFixedButton = new QRadioButton(this); 100 if ( enmDeviceType == KDeviceType_DVD 101 || enmDeviceType == KDeviceType_Floppy) 102 { 103 m_pFixedButton->click(); 104 m_pFixedButton->setFocus(); 105 } 99 106 m_pVariantButtonGroup->addButton(m_pDynamicalButton, 0); 100 107 m_pVariantButtonGroup->addButton(m_pFixedButton, 1); … … 127 134 128 135 /* Translate widgets: */ 129 m_pDescriptionLabel->setText(UIWizardCloneVD::tr("Please choose whether the new virtual hard diskfile should grow as it is used "136 m_pDescriptionLabel->setText(UIWizardCloneVD::tr("Please choose whether the new virtual disk image file should grow as it is used " 130 137 "(dynamically allocated) or if it should be created at its maximum size (fixed size).")); 131 m_pDynamicLabel->setText(UIWizardCloneVD::tr("<p>A <b>dynamically allocated</b> hard diskfile will only use space "138 m_pDynamicLabel->setText(UIWizardCloneVD::tr("<p>A <b>dynamically allocated</b> disk image file will only use space " 132 139 "on your physical hard disk as it fills up (up to a maximum <b>fixed size</b>), " 133 140 "although it will not shrink again automatically when space on it is freed.</p>")); 134 m_pFixedLabel->setText(UIWizardCloneVD::tr("<p>A <b>fixed size</b> hard diskfile may take longer to create on some "141 m_pFixedLabel->setText(UIWizardCloneVD::tr("<p>A <b>fixed size</b> disk image file may take longer to create on some " 135 142 "systems but is often faster to use.</p>")); 136 m_pSplitLabel->setText(UIWizardCloneVD::tr("<p>You can also choose to <b>split</b> the hard diskfile into several files "143 m_pSplitLabel->setText(UIWizardCloneVD::tr("<p>You can also choose to <b>split</b> the disk image file into several files " 137 144 "of up to two gigabytes each. This is mainly useful if you wish to store the " 138 145 "virtual machine on removable USB devices or old systems, some of which cannot " -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.h
r69197 r69200 21 21 /* GUI includes: */ 22 22 #include "UIWizardPage.h" 23 24 /* COM includes: */ 25 #include "COMEnums.h" 23 26 24 27 /* Forward declarations: */ … … 62 65 63 66 /** Constructs basic page. */ 64 UIWizardCloneVDPageBasic3( );67 UIWizardCloneVDPageBasic3(KDeviceType enmDeviceType); 65 68 66 69 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp
r69199 r69200 77 77 QStringList validExtensionList; 78 78 for (int i = 0; i < fileExtensions.size(); ++i) 79 if (deviceTypes[i] == KDeviceType_HardDisk)79 if (deviceTypes[i] == static_cast<UIWizardCloneVD*>(wizardImp())->sourceVirtualDiskDeviceType()) 80 80 validExtensionList << QString("*.%1").arg(fileExtensions[i]); 81 81 /* Compose full filter list: */ … … 85 85 QString strChosenFilePath = QIFileDialog::getSaveFileName(folder.absoluteFilePath(strFileName), 86 86 strBackendsList, thisImp(), 87 UIWizardCloneVD::tr("Please choose a location for new virtual hard diskfile"));87 UIWizardCloneVD::tr("Please choose a location for new virtual disk image file")); 88 88 89 89 /* If there was something really chosen: */ … … 129 129 fileInfo = QFileInfo(strDefaultPath, strFileName); 130 130 } 131 /* Return full absolute hard diskfile path: */131 /* Return full absolute disk image file path: */ 132 132 return QDir::toNativeSeparators(fileInfo.absoluteFilePath()); 133 133 } 134 134 135 135 /* static */ 136 void UIWizardCloneVDPage4::acquireExtensions(const CMediumFormat &comMediumFormat, 136 void UIWizardCloneVDPage4::acquireExtensions(const CMediumFormat &comMediumFormat, KDeviceType enmDeviceType, 137 137 QStringList &aAllowedExtensions, QString &strDefaultExtension) 138 138 { … … 143 143 mediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes); 144 144 for (int i = 0; i < fileExtensions.size(); ++i) 145 if (deviceTypes[i] == KDeviceType_HardDisk)145 if (deviceTypes[i] == enmDeviceType) 146 146 aAllowedExtensions << fileExtensions[i].toLower(); 147 147 AssertReturnVoid(!aAllowedExtensions.isEmpty()); … … 208 208 { 209 209 /* Translate page: */ 210 setTitle(UIWizardCloneVD::tr("New hard diskto create"));210 setTitle(UIWizardCloneVD::tr("New disk image to create")); 211 211 212 212 /* Translate widgets: */ 213 m_pLabel->setText(UIWizardCloneVD::tr("Please type the name of the new virtual hard diskfile into the box below or "213 m_pLabel->setText(UIWizardCloneVD::tr("Please type the name of the new virtual disk image file into the box below or " 214 214 "click on the folder icon to select a different folder to create the file in.")); 215 m_pDestinationDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a location for new virtual hard diskfile..."));215 m_pDestinationDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a location for new virtual disk image file...")); 216 216 } 217 217 … … 227 227 /* Get default extension for virtual-disk copy: */ 228 228 acquireExtensions(field("mediumFormat").value<CMediumFormat>(), 229 static_cast<UIWizardCloneVD*>(wizardImp())->sourceVirtualDiskDeviceType(), 229 230 m_aAllowedExtensions, m_strDefaultExtension); 230 231 /* Compose default-name for virtual-disk copy: */ 231 QString strMediumName = UIWizardCloneVD::tr("%1_copy", "copied virtual hard drive name").arg(sourceFileInfo.baseName());232 QString strMediumName = UIWizardCloneVD::tr("%1_copy", "copied virtual disk image name").arg(sourceFileInfo.baseName()); 232 233 /* Set default-name as text for location editor: */ 233 234 m_pDestinationDiskEditor->setText(strMediumName); … … 256 257 startProcessing(); 257 258 258 /* Try to copy virtual hard drive file: */259 /* Try to copy virtual disk image file: */ 259 260 fResult = qobject_cast<UIWizardCloneVD*>(wizard())->copyVirtualDisk(); 260 261 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.h
r69199 r69200 25 25 #include "UIWizardPage.h" 26 26 27 /* COM includes: */ 28 #include "COMEnums.h" 29 27 30 /* Forward declarations: */ 28 31 class CMediumFormat; … … 48 51 static QString absoluteFilePath(const QString &strFileName, const QString &strDefaultPath); 49 52 /** Acquires the list of @a aAllowedExtensions and @a strDefaultExtension 50 * on the basis of incoming @a comMediumFormat . */51 static void acquireExtensions(const CMediumFormat &comMediumFormat, 53 * on the basis of incoming @a comMediumFormat and @a enmDeviceType. */ 54 static void acquireExtensions(const CMediumFormat &comMediumFormat, KDeviceType enmDeviceType, 52 55 QStringList &aAllowedExtensions, QString &strDefaultExtension); 53 56 … … 86 89 protected: 87 90 91 /** Allows to access 'wizard()' from base part. */ 92 UIWizard* wizardImp() { return wizard(); } 88 93 /** Allows to access 'this' from base part. */ 89 94 UIWizardPage* thisImp() { return this; } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp
r69199 r69200 44 44 45 45 46 UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk )46 UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk, KDeviceType enmDeviceType) 47 47 { 48 48 /* Create widgets: */ … … 59 59 { 60 60 m_pSourceDiskSelector->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); 61 m_pSourceDiskSelector->setType(UIMedium Type_HardDisk);61 m_pSourceDiskSelector->setType(UIMediumDefs::mediumTypeToLocal(enmDeviceType)); 62 62 m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId()); 63 63 m_pSourceDiskSelector->repopulate(); … … 117 117 /* Create buttons for VDI, preferred and others: */ 118 118 foreach (const QString &strId, vdi.keys()) 119 addFormatButton(this, pFormatCntLayout, vdi.value(strId), true);119 addFormatButton(this, pFormatCntLayout, enmDeviceType, vdi.value(strId), true); 120 120 foreach (const QString &strId, preferred.keys()) 121 addFormatButton(this, pFormatCntLayout, preferred.value(strId), true);121 addFormatButton(this, pFormatCntLayout, enmDeviceType, preferred.value(strId), true); 122 122 foreach (const QString &strId, others.keys()) 123 addFormatButton(this, pFormatCntLayout, others.value(strId));123 addFormatButton(this, pFormatCntLayout, enmDeviceType, others.value(strId)); 124 124 125 125 if (!m_pFormatButtonGroup->buttons().isEmpty()) … … 139 139 { 140 140 m_pDynamicalButton = new QRadioButton(m_pVariantCnt); 141 if (enmDeviceType == KDeviceType_HardDisk) 141 142 { 142 143 m_pDynamicalButton->click(); … … 144 145 } 145 146 m_pFixedButton = new QRadioButton(m_pVariantCnt); 147 if ( enmDeviceType == KDeviceType_DVD 148 || enmDeviceType == KDeviceType_Floppy) 149 { 150 m_pFixedButton->click(); 151 m_pFixedButton->setFocus(); 152 } 146 153 m_pVariantButtonGroup->addButton(m_pDynamicalButton, 0); 147 154 m_pVariantButtonGroup->addButton(m_pFixedButton, 1); … … 157 164 pMainLayout->addWidget(m_pFormatCnt, 2, 0, Qt::AlignTop); 158 165 pMainLayout->addWidget(m_pVariantCnt, 2, 1, Qt::AlignTop); 159 sltHandleSourceDiskChange();160 sltMediumFormatChanged();161 166 } 162 167 … … 188 193 m_strDefaultPath = sourceFileInfo.absolutePath(); 189 194 /* Compose name for virtual-disk copy: */ 190 QString strMediumName = UIWizardCloneVD::tr("%1_copy", "copied virtual hard drive name").arg(sourceFileInfo.baseName());195 QString strMediumName = UIWizardCloneVD::tr("%1_copy", "copied virtual disk image name").arg(sourceFileInfo.baseName()); 191 196 /* Set text to location editor: */ 192 197 m_pDestinationDiskEditor->setText(strMediumName); … … 230 235 231 236 /* Compose virtual-disk extension: */ 232 acquireExtensions(mf, m_aAllowedExtensions, m_strDefaultExtension); 237 acquireExtensions(mf, static_cast<UIWizardCloneVD*>(wizardImp())->sourceVirtualDiskDeviceType(), 238 m_aAllowedExtensions, m_strDefaultExtension); 233 239 234 240 /* Broadcast complete-change: */ … … 245 251 { 246 252 /* Translate widgets: */ 247 m_pSourceDiskCnt->setTitle(UIWizardCloneVD::tr(" Hard diskto ©"));248 m_pSourceDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a virtual hard diskfile to copy..."));249 m_pDestinationCnt->setTitle(UIWizardCloneVD::tr("&New hard diskto create"));250 m_pDestinationDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a location for new virtual hard diskfile..."));251 m_pFormatCnt->setTitle(UIWizardCloneVD::tr(" Hard diskfile &type"));253 m_pSourceDiskCnt->setTitle(UIWizardCloneVD::tr("Disk image to ©")); 254 m_pSourceDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a virtual disk image file to copy...")); 255 m_pDestinationCnt->setTitle(UIWizardCloneVD::tr("&New disk image to create")); 256 m_pDestinationDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a location for new virtual disk image file...")); 257 m_pFormatCnt->setTitle(UIWizardCloneVD::tr("Disk image file &type")); 252 258 QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons(); 253 259 for (int i = 0; i < buttons.size(); ++i) … … 266 272 /* Translate page: */ 267 273 retranslateUi(); 274 275 sltHandleSourceDiskChange(); 276 sltMediumFormatChanged(); 268 277 } 269 278 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.h
r69197 r69200 46 46 47 47 /** Constructs basic page. 48 * @param comSourceVirtualDisk Brings the initial source disk to make copy from. */ 49 UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk); 48 * @param comSourceVirtualDisk Brings the initial source disk to make copy from. 49 * @param enmDeviceType Brings the device type to limit format to. */ 50 UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk, KDeviceType enmDeviceType); 50 51 51 52 protected: 52 53 54 /** Allows to access 'wizard()' from base part. */ 55 UIWizard* wizardImp() { return wizard(); } 53 56 /** Allows to access 'this' from base part. */ 54 57 UIWizardPage* thisImp() { return this; }
Note:
See TracChangeset
for help on using the changeset viewer.