Changeset 92588 in vbox
- Timestamp:
- Nov 24, 2021 7:48:54 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 148472
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r92414 r92588 1690 1690 { 1691 1691 case UIMediumDeviceType_HardDisk: 1692 uMediumId = createVDWithWizard(pParent, strDefaultFolder, strMachineName, strMachineGuestOSTypeId);1692 uMediumId = UIWizardNewVD::createVDWithWizard(pParent, strDefaultFolder, strMachineName, strMachineGuestOSTypeId); 1693 1693 break; 1694 1694 case UIMediumDeviceType_DVD: 1695 uMediumId = createVisoMediumWithVisoCreator(pActionPool, pParent, strDefaultFolder, strMachineName);1695 uMediumId = UIVisoCreatorWidget::createViso(pActionPool, pParent, strDefaultFolder, strMachineName); 1696 1696 break; 1697 1697 case UIMediumDeviceType_Floppy: 1698 uMediumId = showCreateFloppyDiskDialog(pParent, strDefaultFolder, strMachineName);1698 uMediumId = UIFDCreationDialog::createFloppyDisk(pParent, strDefaultFolder, strMachineName); 1699 1699 break; 1700 1700 default: … … 1708 1708 updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uMediumId).location()); 1709 1709 return uMediumId; 1710 }1711 1712 QUuid UICommon::createVisoMediumWithVisoCreator(UIActionPool *pActionPool, QWidget *pParent, const QString &strDefaultFolder /* = QString */,1713 const QString &strMachineName /* = QString */)1714 {1715 QWidget *pDialogParent = windowManager().realParentWindow(pParent);1716 UIVisoCreatorDialog *pVisoCreator = new UIVisoCreatorDialog(pActionPool, pDialogParent, strMachineName);1717 1718 if (!pVisoCreator)1719 return QString();1720 windowManager().registerNewParent(pVisoCreator, pDialogParent);1721 pVisoCreator->setCurrentPath(gEDataManager->visoCreatorRecentFolder());1722 1723 if (pVisoCreator->exec(false /* not application modal */))1724 {1725 QStringList files = pVisoCreator->entryList();1726 QString strVisoName = pVisoCreator->visoName();1727 if (strVisoName.isEmpty())1728 strVisoName = strMachineName;1729 1730 if (files.empty() || files[0].isEmpty())1731 {1732 delete pVisoCreator;1733 return QUuid();1734 }1735 1736 gEDataManager->setVISOCreatorRecentFolder(pVisoCreator->currentPath());1737 1738 /* Produce the VISO. */1739 char szVisoPath[RTPATH_MAX];1740 QString strFileName = QString("%1%2").arg(strVisoName).arg(".viso");1741 1742 QString strVisoSaveFolder(strDefaultFolder);1743 if (strVisoSaveFolder.isEmpty())1744 strVisoSaveFolder = defaultFolderPathForType(UIMediumDeviceType_DVD);1745 1746 int vrc = RTPathJoin(szVisoPath, sizeof(szVisoPath), strVisoSaveFolder.toUtf8().constData(), strFileName.toUtf8().constData());1747 if (RT_SUCCESS(vrc))1748 {1749 PRTSTREAM pStrmViso;1750 vrc = RTStrmOpen(szVisoPath, "w", &pStrmViso);1751 if (RT_SUCCESS(vrc))1752 {1753 RTUUID Uuid;1754 vrc = RTUuidCreate(&Uuid);1755 if (RT_SUCCESS(vrc))1756 {1757 RTStrmPrintf(pStrmViso, "--iprt-iso-maker-file-marker-bourne-sh %RTuuid\n", &Uuid);1758 vrc = UIVisoCreatorWidget::visoWriteQuotedString(pStrmViso, "--volume-id=", strVisoName, "\n");1759 1760 for (int iFile = 0; iFile < files.size() && RT_SUCCESS(vrc); iFile++)1761 vrc = UIVisoCreatorWidget::visoWriteQuotedString(pStrmViso, NULL, files[iFile], "\n");1762 1763 /* Append custom options if any to the file: */1764 const QStringList &customOptions = pVisoCreator->customOptions();1765 foreach (QString strLine, customOptions)1766 RTStrmPrintf(pStrmViso, "%s\n", strLine.toUtf8().constData());1767 1768 RTStrmFlush(pStrmViso);1769 if (RT_SUCCESS(vrc))1770 vrc = RTStrmError(pStrmViso);1771 }1772 1773 RTStrmClose(pStrmViso);1774 }1775 }1776 1777 /* Done. */1778 if (RT_SUCCESS(vrc))1779 {1780 delete pVisoCreator;1781 return openMedium(UIMediumDeviceType_DVD, QString(szVisoPath), pParent);1782 }1783 /** @todo error message. */1784 else1785 {1786 delete pVisoCreator;1787 return QUuid();1788 }1789 }1790 delete pVisoCreator;1791 return QUuid();1792 }1793 1794 QUuid UICommon::showCreateFloppyDiskDialog(QWidget *pParent, const QString &strDefaultFolder /* QString() */,1795 const QString &strMachineName /* = QString() */ )1796 {1797 QString strStartPath(strDefaultFolder);1798 1799 if (strStartPath.isEmpty())1800 strStartPath = defaultFolderPathForType(UIMediumDeviceType_Floppy);1801 1802 QWidget *pDialogParent = windowManager().realParentWindow(pParent);1803 1804 UIFDCreationDialog *pDialog = new UIFDCreationDialog(pParent, strStartPath, strMachineName);1805 if (!pDialog)1806 return QUuid();1807 windowManager().registerNewParent(pDialog, pDialogParent);1808 1809 if (pDialog->exec())1810 {1811 QUuid uMediumID = pDialog->mediumID();1812 delete pDialog;1813 return uMediumID;1814 }1815 delete pDialog;1816 return QUuid();1817 }1818 1819 int UICommon::openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType, const QUuid &uCurrentMediumId,1820 QUuid &uSelectedMediumUuid, const QString &strMachineFolder, const QString &strMachineName,1821 const QString &strMachineGuestOSTypeId, bool fEnableCreate, const QUuid &uMachineID,1822 UIActionPool *pActionPool)1823 {1824 QUuid uMachineOrGlobalId = uMachineID == QUuid() ? gEDataManager->GlobalID : uMachineID;1825 1826 QWidget *pDialogParent = windowManager().realParentWindow(pParent);1827 QPointer<UIMediumSelector> pSelector = new UIMediumSelector(uCurrentMediumId, enmMediumType, strMachineName,1828 strMachineFolder, strMachineGuestOSTypeId,1829 uMachineOrGlobalId, pDialogParent, pActionPool);1830 1831 if (!pSelector)1832 return static_cast<int>(UIMediumSelector::ReturnCode_Rejected);1833 pSelector->setEnableCreateAction(fEnableCreate);1834 windowManager().registerNewParent(pSelector, pDialogParent);1835 1836 int iResult = pSelector->exec(false);1837 UIMediumSelector::ReturnCode returnCode;1838 1839 if (iResult >= static_cast<int>(UIMediumSelector::ReturnCode_Max) || iResult < 0)1840 returnCode = UIMediumSelector::ReturnCode_Rejected;1841 else1842 returnCode = static_cast<UIMediumSelector::ReturnCode>(iResult);1843 1844 if (returnCode == UIMediumSelector::ReturnCode_Accepted)1845 {1846 QList<QUuid> selectedMediumIds = pSelector->selectedMediumIds();1847 1848 /* Currently we only care about the 0th since we support single selection by intention: */1849 if (selectedMediumIds.isEmpty())1850 returnCode = UIMediumSelector::ReturnCode_Rejected;1851 else1852 {1853 uSelectedMediumUuid = selectedMediumIds[0];1854 updateRecentlyUsedMediumListAndFolder(enmMediumType, medium(uSelectedMediumUuid).location());1855 }1856 }1857 delete pSelector;1858 return static_cast<int>(returnCode);1859 }1860 1861 QUuid UICommon::createVDWithWizard(QWidget *pParent,1862 const QString &strMachineFolder /* = QString() */,1863 const QString &strMachineName /* = QString() */,1864 const QString &strMachineGuestOSTypeId /* = QString() */)1865 {1866 /* Initialize variables: */1867 QString strDefaultFolder = strMachineFolder;1868 if (strDefaultFolder.isEmpty())1869 strDefaultFolder = defaultFolderPathForType(UIMediumDeviceType_HardDisk);1870 1871 /* In case we dont have a 'guest os type id' default back to 'Other': */1872 const CGuestOSType comGuestOSType = virtualBox().GetGuestOSType( !strMachineGuestOSTypeId.isEmpty()1873 ? strMachineGuestOSTypeId1874 : "Other");1875 const QString strDiskName = findUniqueFileName(strDefaultFolder, !strMachineName.isEmpty()1876 ? strMachineName1877 : "NewVirtualDisk");1878 1879 /* Show New VD wizard: */1880 UISafePointerWizardNewVD pWizard = new UIWizardNewVD(pParent,1881 strDiskName,1882 strDefaultFolder,1883 comGuestOSType.GetRecommendedHDD());1884 if (!pWizard)1885 return QUuid();1886 QWidget *pDialogParent = windowManager().realParentWindow(pParent);1887 windowManager().registerNewParent(pWizard, pDialogParent);1888 QUuid mediumId = pWizard->mediumId();1889 pWizard->exec();1890 delete pWizard;1891 return mediumId;1892 1710 } 1893 1711 … … 2091 1909 if (target.type == UIMediumTarget::UIMediumTargetType_WithID) 2092 1910 { 2093 int iDialogReturn = openMediumSelectorDialog(windowManager().mainWindowShown(), target.mediumType,2094 uCurrentID, uMediumID,2095 strMachineFolder, comConstMachine.GetName(),2096 comConstMachine.GetOSTypeId(), true /*fEnableCreate */,2097 comConstMachine.GetId(), pActionPool);1911 int iDialogReturn = UIMediumSelector::openMediumSelectorDialog(windowManager().mainWindowShown(), target.mediumType, 1912 uCurrentID, uMediumID, 1913 strMachineFolder, comConstMachine.GetName(), 1914 comConstMachine.GetOSTypeId(), true /*fEnableCreate */, 1915 comConstMachine.GetId(), pActionPool); 2098 1916 if (iDialogReturn == UIMediumSelector::ReturnCode_LeftEmpty && 2099 1917 (target.mediumType == UIMediumDeviceType_DVD || target.mediumType == UIMediumDeviceType_Floppy)) … … 2106 1924 } 2107 1925 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateAdHocVISO) 2108 uMediumID = createVisoMediumWithVisoCreator(pActionPool, windowManager().mainWindowShown(), strMachineFolder,2109 comConstMachine.GetName());1926 uMediumID = UIVisoCreatorWidget::createViso(pActionPool, windowManager().mainWindowShown(), 1927 strMachineFolder, comConstMachine.GetName()); 2110 1928 2111 1929 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateFloppyDisk) 2112 uMediumID = showCreateFloppyDiskDialog(windowManager().mainWindowShown(), strMachineFolder, comConstMachine.GetName());1930 uMediumID = UIFDCreationDialog::createFloppyDisk(windowManager().mainWindowShown(), strMachineFolder, comConstMachine.GetName()); 2113 1931 2114 1932 /* Return focus back: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r92413 r92588 407 407 const QString &strDefaultFolder = QString(), bool fUseLastFolder = false); 408 408 409 /** Creates and shows a UIMediumSelector dialog.410 * @param parent Passes the parent of the dialog,411 * @param enmMediumType Passes the medium type,412 * @param uCurrentMediumId Passes the id of the currently selected medium,413 * @param uSelectedMediumUuid Gets the selected medium id from selection dialog,414 * @param strMachineFolder Passes the machine folder,415 * @param strMachineName Passes the name of the machine,416 * @param strMachineGuestOSTypeId Passes the type ID of machine's guest os,417 * @param fEnableCreate Passes whether to show/enable create action in the medium selector dialog,418 * @param uMachineID Passes the machine UUID,419 * @param pActionPool Passes the action pool instance pointer,420 * returns the return code of the UIMediumSelector::ReturnCode as int. In case of a medium selection421 * UUID of the selected medium is stored in @param inOutUuid.*/422 int openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType, const QUuid &uCurrentMediumId,423 QUuid &uSelectedMediumUuid, const QString &strMachineFolder, const QString &strMachineName,424 const QString &strMachineGuestOSTypeId, bool fEnableCreate, const QUuid &uMachineID,425 UIActionPool *pActionPool);426 427 409 /** Creates and shows a dialog (wizard) to create a medium of type @a enmMediumType. 428 410 * @param pParent Passes the parent of the dialog, … … 607 589 /** Cleanups all. */ 608 590 void cleanup(); 609 610 /** @name COM: Virtual Media create functions.611 * @{ */612 613 /** Creates a VISO by using the VISO creator dialog.614 * @param pParent Passes the dialog parent.615 * @param strDefaultFolder Passes the folder to save the VISO file.616 * @param strMachineName Passes the name of the machine, */617 QUuid createVisoMediumWithVisoCreator(UIActionPool *pActionPool, QWidget *pParent,618 const QString &strDefaultFolder = QString(), const QString &strMachineName = QString());619 620 /** Creates and shows a dialog thru which user can create a new floppy disk a VISO using the file-open dialog.621 * @param parent Passes the parent of the dialog,622 * @param strDefaultFolder Passes the default folder,623 * @param strMachineName Passes the name of the machine,624 * returns the ID of the newly created medium if successful, a null QUuid otherwise.*/625 QUuid showCreateFloppyDiskDialog(QWidget *pParent, const QString &strDefaultFolder = QString(),626 const QString &strMachineName = QString());627 628 /** Creates and shows a UIWizardNewVD wizard.629 * @param pParent Passes the parent of the wizard,630 * @param strMachineFolder Passes the machine folder,631 * @param strMachineName Passes the name of the machine,632 * @param strMachineGuestOSTypeId Passes the string of machine's guest OS type ID,633 * returns QUuid of the created medium. */634 QUuid createVDWithWizard(QWidget *pParent,635 const QString &strMachineFolder = QString(),636 const QString &strMachineName = QString(),637 const QString &strMachineGuestOSTypeId = QString());638 /** @} */639 591 640 592 /** @name Process arguments stuff. -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp
r91350 r92588 31 31 #include "UIMessageCenter.h" 32 32 #include "UINotificationCenter.h" 33 #include "UIModalWindowManager.h" 33 34 34 35 /* COM includes: */ … … 59 60 } 60 61 62 /* static */ 63 QUuid UIFDCreationDialog::createFloppyDisk(QWidget *pParent, const QString &strDefaultFolder /* QString() */, 64 const QString &strMachineName /* = QString() */ ) 65 { 66 QString strStartPath(strDefaultFolder); 67 68 if (strStartPath.isEmpty()) 69 strStartPath = uiCommon().defaultFolderPathForType(UIMediumDeviceType_Floppy); 70 71 QWidget *pDialogParent = windowManager().realParentWindow(pParent); 72 73 UIFDCreationDialog *pDialog = new UIFDCreationDialog(pParent, strStartPath, strMachineName); 74 if (!pDialog) 75 return QUuid(); 76 windowManager().registerNewParent(pDialog, pDialogParent); 77 78 if (pDialog->exec()) 79 { 80 QUuid uMediumID = pDialog->mediumID(); 81 delete pDialog; 82 return uMediumID; 83 } 84 delete pDialog; 85 return QUuid(); 86 } 87 61 88 void UIFDCreationDialog::accept() 62 89 { -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.h
r91350 r92588 53 53 /** Return the medium ID. */ 54 54 QUuid mediumID() const; 55 56 /** Creates and shows a dialog thru which user can create a new floppy disk a VISO using the file-open dialog. 57 * @param parent Passes the parent of the dialog, 58 * @param strDefaultFolder Passes the default folder, 59 * @param strMachineName Passes the name of the machine, 60 * returns the UUID of the newly created medium if successful, a null QUuid otherwise.*/ 61 static QUuid createFloppyDisk(QWidget *pParent, const QString &strDefaultFolder = QString(), 62 const QString &strMachineName = QString()); 63 55 64 56 65 public slots: -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
r92440 r92588 116 116 } 117 117 118 /* static */ 119 int UIMediumSelector::openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType, const QUuid &uCurrentMediumId, 120 QUuid &uSelectedMediumUuid, const QString &strMachineFolder, const QString &strMachineName, 121 const QString &strMachineGuestOSTypeId, bool fEnableCreate, const QUuid &uMachineID, 122 UIActionPool *pActionPool) 123 { 124 QUuid uMachineOrGlobalId = uMachineID == QUuid() ? gEDataManager->GlobalID : uMachineID; 125 126 QWidget *pDialogParent = windowManager().realParentWindow(pParent); 127 QPointer<UIMediumSelector> pSelector = new UIMediumSelector(uCurrentMediumId, enmMediumType, strMachineName, 128 strMachineFolder, strMachineGuestOSTypeId, 129 uMachineOrGlobalId, pDialogParent, pActionPool); 130 131 if (!pSelector) 132 return static_cast<int>(UIMediumSelector::ReturnCode_Rejected); 133 pSelector->setEnableCreateAction(fEnableCreate); 134 windowManager().registerNewParent(pSelector, pDialogParent); 135 136 int iResult = pSelector->exec(false); 137 UIMediumSelector::ReturnCode returnCode; 138 139 if (iResult >= static_cast<int>(UIMediumSelector::ReturnCode_Max) || iResult < 0) 140 returnCode = UIMediumSelector::ReturnCode_Rejected; 141 else 142 returnCode = static_cast<UIMediumSelector::ReturnCode>(iResult); 143 144 if (returnCode == UIMediumSelector::ReturnCode_Accepted) 145 { 146 QList<QUuid> selectedMediumIds = pSelector->selectedMediumIds(); 147 148 /* Currently we only care about the 0th since we support single selection by intention: */ 149 if (selectedMediumIds.isEmpty()) 150 returnCode = UIMediumSelector::ReturnCode_Rejected; 151 else 152 { 153 uSelectedMediumUuid = selectedMediumIds[0]; 154 uiCommon().updateRecentlyUsedMediumListAndFolder(enmMediumType, uiCommon().medium(uSelectedMediumUuid).location()); 155 } 156 } 157 delete pSelector; 158 return static_cast<int>(returnCode); 159 } 160 118 161 void UIMediumSelector::retranslateUi() 119 162 { -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.h
r92440 r92588 66 66 ReturnCode_Max 67 67 }; 68 69 /** Creates and shows a UIMediumSelector dialog. 70 * @param parent Passes the parent of the dialog, 71 * @param enmMediumType Passes the medium type, 72 * @param uCurrentMediumId Passes the id of the currently selected medium, 73 * @param uSelectedMediumUuid Gets the selected medium id from selection dialog, 74 * @param strMachineFolder Passes the machine folder, 75 * @param strMachineName Passes the name of the machine, 76 * @param strMachineGuestOSTypeId Passes the type ID of machine's guest os, 77 * @param fEnableCreate Passes whether to show/enable create action in the medium selector dialog, 78 * @param uMachineID Passes the machine UUID, 79 * @param pActionPool Passes the action pool instance pointer, 80 * returns the return code of the UIMediumSelector::ReturnCode as int. In case of a medium selection 81 * UUID of the selected medium is returned in @param uSelectedMediumUuid.*/ 82 static int openMediumSelectorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType, const QUuid &uCurrentMediumId, 83 QUuid &uSelectedMediumUuid, const QString &strMachineFolder, const QString &strMachineName, 84 const QString &strMachineGuestOSTypeId, bool fEnableCreate, const QUuid &uMachineID, 85 UIActionPool *pActionPool); 68 86 69 87 protected: -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r92504 r92588 41 41 #endif 42 42 43 /* Other VBox includes: */ 43 44 #include <iprt/getopt.h> 45 #include <iprt/path.h> 44 46 45 47 … … 510 512 } 511 513 514 /* static */ 515 QUuid UIVisoCreatorWidget::createViso(UIActionPool *pActionPool, QWidget *pParent, 516 const QString &strDefaultFolder /* = QString() */, 517 const QString &strMachineName /* = QString() */) 518 { 519 QWidget *pDialogParent = windowManager().realParentWindow(pParent); 520 UIVisoCreatorDialog *pVisoCreator = new UIVisoCreatorDialog(pActionPool, pDialogParent, strMachineName); 521 522 if (!pVisoCreator) 523 return QString(); 524 windowManager().registerNewParent(pVisoCreator, pDialogParent); 525 pVisoCreator->setCurrentPath(gEDataManager->visoCreatorRecentFolder()); 526 527 if (pVisoCreator->exec(false /* not application modal */)) 528 { 529 QStringList files = pVisoCreator->entryList(); 530 QString strVisoName = pVisoCreator->visoName(); 531 if (strVisoName.isEmpty()) 532 strVisoName = strMachineName; 533 534 if (files.empty() || files[0].isEmpty()) 535 { 536 delete pVisoCreator; 537 return QUuid(); 538 } 539 540 gEDataManager->setVISOCreatorRecentFolder(pVisoCreator->currentPath()); 541 542 /* Produce the VISO. */ 543 char szVisoPath[RTPATH_MAX]; 544 QString strFileName = QString("%1%2").arg(strVisoName).arg(".viso"); 545 546 QString strVisoSaveFolder(strDefaultFolder); 547 if (strVisoSaveFolder.isEmpty()) 548 strVisoSaveFolder = uiCommon().defaultFolderPathForType(UIMediumDeviceType_DVD); 549 550 int vrc = RTPathJoin(szVisoPath, sizeof(szVisoPath), strVisoSaveFolder.toUtf8().constData(), strFileName.toUtf8().constData()); 551 if (RT_SUCCESS(vrc)) 552 { 553 PRTSTREAM pStrmViso; 554 vrc = RTStrmOpen(szVisoPath, "w", &pStrmViso); 555 if (RT_SUCCESS(vrc)) 556 { 557 RTUUID Uuid; 558 vrc = RTUuidCreate(&Uuid); 559 if (RT_SUCCESS(vrc)) 560 { 561 RTStrmPrintf(pStrmViso, "--iprt-iso-maker-file-marker-bourne-sh %RTuuid\n", &Uuid); 562 vrc = UIVisoCreatorWidget::visoWriteQuotedString(pStrmViso, "--volume-id=", strVisoName, "\n"); 563 564 for (int iFile = 0; iFile < files.size() && RT_SUCCESS(vrc); iFile++) 565 vrc = UIVisoCreatorWidget::visoWriteQuotedString(pStrmViso, NULL, files[iFile], "\n"); 566 567 /* Append custom options if any to the file: */ 568 const QStringList &customOptions = pVisoCreator->customOptions(); 569 foreach (QString strLine, customOptions) 570 RTStrmPrintf(pStrmViso, "%s\n", strLine.toUtf8().constData()); 571 572 RTStrmFlush(pStrmViso); 573 if (RT_SUCCESS(vrc)) 574 vrc = RTStrmError(pStrmViso); 575 } 576 577 RTStrmClose(pStrmViso); 578 } 579 } 580 581 /* Done. */ 582 if (RT_SUCCESS(vrc)) 583 { 584 delete pVisoCreator; 585 return uiCommon().openMedium(UIMediumDeviceType_DVD, QString(szVisoPath), pParent); 586 } 587 /** @todo error message. */ 588 else 589 { 590 delete pVisoCreator; 591 return QUuid(); 592 } 593 } 594 delete pVisoCreator; 595 return QUuid(); 596 } 512 597 513 598 /********************************************************************************************************************************* -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r92504 r92588 69 69 void setCurrentPath(const QString &strPath); 70 70 QMenu *menu() const; 71 72 /** Creates a VISO by using the VISO creator dialog. 73 * @param pParent Passes the dialog parent. 74 * @param strDefaultFolder Passes the folder to save the VISO file. 75 * @param strMachineName Passes the name of the machine, 76 * returns the UUID of the created medium or a null QUuid. */ 77 static QUuid createViso(UIActionPool *pActionPool, QWidget *pParent, 78 const QString &strDefaultFolder = QString(), 79 const QString &strMachineName = QString()); 71 80 72 81 #ifdef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r92455 r92588 4008 4008 uCurrentMediumId = m_pMediumIdHolder->id(); 4009 4009 QUuid uSelectedMediumId; 4010 int iResult = uiCommon().openMediumSelectorDialog(this, m_pMediumIdHolder->type(), uCurrentMediumId, uSelectedMediumId,4011 strMachineFolder, m_strMachineName,4012 m_strMachineGuestOSTypeId,4013 true /* enable create action: */, m_uMachineId, m_pActionPool);4010 int iResult = UIMediumSelector::openMediumSelectorDialog(this, m_pMediumIdHolder->type(), uCurrentMediumId, uSelectedMediumId, 4011 strMachineFolder, m_strMachineName, 4012 m_strMachineGuestOSTypeId, 4013 true /* enable create action: */, m_uMachineId, m_pActionPool); 4014 4014 4015 4015 if (iResult == UIMediumSelector::ReturnCode_Rejected || … … 5228 5228 Assert(m_pModelStorage->data(index, StorageModel::R_IsController).toBool()); 5229 5229 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool()); 5230 // const QString strControllerName(m_pModelStorage->data(index, StorageModel::R_CtrName).toString());5231 5230 const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath()); 5232 5231 5233 5232 QUuid uMediumId; 5234 int iResult = uiCommon().openMediumSelectorDialog(this, UIMediumDefs::mediumTypeToLocal(enmDeviceType),5235 QUuid() /* current medium Id */, uMediumId,5236 strMachineFolder, m_strMachineName,5237 m_strMachineGuestOSTypeId,5238 true /* enable cr1eate action: */, m_uMachineId, m_pActionPool);5233 int iResult = UIMediumSelector::openMediumSelectorDialog(this, UIMediumDefs::mediumTypeToLocal(enmDeviceType), 5234 QUuid() /* current medium Id */, uMediumId, 5235 strMachineFolder, m_strMachineName, 5236 m_strMachineGuestOSTypeId, 5237 true /* enable cr1eate action: */, m_uMachineId, m_pActionPool); 5239 5238 5240 5239 /* Continue only if iResult is either UIMediumSelector::ReturnCode_Accepted or UIMediumSelector::ReturnCode_LeftEmpty: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
r92103 r92588 18 18 /* GUI includes: */ 19 19 #include "UICommon.h" 20 #include "UIModalWindowManager.h" 20 21 #include "UINotificationCenter.h" 21 22 #include "UIWizardNewVD.h" … … 156 157 } 157 158 159 /* static */ 160 QUuid UIWizardNewVD::createVDWithWizard(QWidget *pParent, 161 const QString &strMachineFolder /* = QString() */, 162 const QString &strMachineName /* = QString() */, 163 const QString &strMachineGuestOSTypeId /* = QString() */) 164 { 165 /* Initialize variables: */ 166 QString strDefaultFolder = strMachineFolder; 167 if (strDefaultFolder.isEmpty()) 168 strDefaultFolder = uiCommon().defaultFolderPathForType(UIMediumDeviceType_HardDisk); 169 170 /* In case we dont have a 'guest os type id' default back to 'Other': */ 171 const CGuestOSType comGuestOSType = uiCommon().virtualBox().GetGuestOSType( !strMachineGuestOSTypeId.isEmpty() 172 ? strMachineGuestOSTypeId 173 : "Other"); 174 const QString strDiskName = uiCommon().findUniqueFileName(strDefaultFolder, !strMachineName.isEmpty() 175 ? strMachineName 176 : "NewVirtualDisk"); 177 178 /* Show New VD wizard: */ 179 UISafePointerWizardNewVD pWizard = new UIWizardNewVD(pParent, 180 strDiskName, 181 strDefaultFolder, 182 comGuestOSType.GetRecommendedHDD()); 183 if (!pWizard) 184 return QUuid(); 185 QWidget *pDialogParent = windowManager().realParentWindow(pParent); 186 windowManager().registerNewParent(pWizard, pDialogParent); 187 QUuid mediumId = pWizard->mediumId(); 188 pWizard->exec(); 189 delete pWizard; 190 return mediumId; 191 } 192 158 193 void UIWizardNewVD::retranslateUi() 159 194 { -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h
r91714 r92588 43 43 bool createVirtualDisk(); 44 44 45 /** @name Setter/getters for vm parameters 45 /** Creates and shows a UIWizardNewVD wizard. 46 * @param pParent Passes the parent of the wizard, 47 * @param strMachineFolder Passes the machine folder, 48 * @param strMachineName Passes the name of the machine, 49 * @param strMachineGuestOSTypeId Passes the string of machine's guest OS type ID, 50 * returns QUuid of the created medium. */ 51 static QUuid createVDWithWizard(QWidget *pParent, 52 const QString &strMachineFolder = QString(), 53 const QString &strMachineName = QString(), 54 const QString &strMachineGuestOSTypeId = QString()); 55 56 /** @name Setter/getters for virtual disk parameters 46 57 * @{ */ 47 58 qulonglong mediumVariant() const; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMDiskPage.cpp
r92413 r92588 45 45 { 46 46 QUuid uMediumId; 47 int returnCode = uiCommon().openMediumSelectorDialog(pCaller, UIMediumDeviceType_HardDisk,47 int returnCode = UIMediumSelector::openMediumSelectorDialog(pCaller, UIMediumDeviceType_HardDisk, 48 48 QUuid() /* current medium id */, 49 49 uMediumId,
Note:
See TracChangeset
for help on using the changeset viewer.