Changeset 92397 in vbox
- Timestamp:
- Nov 12, 2021 11:53:07 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r92361 r92397 114 114 #include <iprt/err.h> 115 115 #include <iprt/file.h> 116 #include <iprt/getopt.h>117 116 #include <iprt/ldr.h> 118 117 #include <iprt/param.h> 119 118 #include <iprt/path.h> 120 #include <iprt/stream.h>121 119 #include <iprt/system.h> 122 120 #include <VBox/sup.h> … … 1682 1680 } 1683 1681 1684 1685 /** 1686 * Helper for createVisoMediumWithVisoCreator. 1687 * @returns IPRT status code. 1688 * @param pStrmDst Where to write the quoted string. 1689 * @param pszPrefix Stuff to put in front of it. 1690 * @param rStr The string to quote and write out. 1691 * @param pszPrefix Stuff to put after it. 1692 */ 1693 DECLINLINE(int) visoWriteQuotedString(PRTSTREAM pStrmDst, const char *pszPrefix, QString const &rStr, const char *pszPostFix) 1694 { 1695 QByteArray const utf8Array = rStr.toUtf8(); 1696 const char *apszArgv[2] = { utf8Array.constData(), NULL }; 1697 char *pszQuoted; 1698 int vrc = RTGetOptArgvToString(&pszQuoted, apszArgv, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH); 1699 if (RT_SUCCESS(vrc)) 1700 { 1701 if (pszPrefix) 1702 vrc = RTStrmPutStr(pStrmDst, pszPrefix); 1703 if (RT_SUCCESS(vrc)) 1704 { 1705 vrc = RTStrmPutStr(pStrmDst, pszQuoted); 1706 if (pszPostFix && RT_SUCCESS(vrc)) 1707 vrc = RTStrmPutStr(pStrmDst, pszPostFix); 1708 } 1709 RTStrFree(pszQuoted); 1710 } 1711 1712 return vrc; 1713 } 1714 1715 QUuid UICommon::openMediumCreatorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType, 1682 QUuid UICommon::openMediumCreatorDialog(UIActionPool *pActionPool, QWidget *pParent, UIMediumDeviceType enmMediumType, 1716 1683 const QString &strDefaultFolder /* = QString() */, 1717 1684 const QString &strMachineName /* = QString() */, … … 1726 1693 break; 1727 1694 case UIMediumDeviceType_DVD: 1728 uMediumId = createVisoMediumWithVisoCreator(p Parent, strDefaultFolder, strMachineName);1695 uMediumId = createVisoMediumWithVisoCreator(pActionPool, pParent, strDefaultFolder, strMachineName); 1729 1696 break; 1730 1697 case UIMediumDeviceType_Floppy: … … 1743 1710 } 1744 1711 1745 QUuid UICommon::createVisoMediumWithVisoCreator( QWidget *pParent, const QString &strDefaultFolder /* = QString */,1746 1712 QUuid UICommon::createVisoMediumWithVisoCreator(UIActionPool *pActionPool, QWidget *pParent, const QString &strDefaultFolder /* = QString */, 1713 const QString &strMachineName /* = QString */) 1747 1714 { 1748 1715 QWidget *pDialogParent = windowManager().realParentWindow(pParent); 1749 UIVisoCreatorDialog *pVisoCreator = 0;//new UIVisoCreatorDialog(pDialogParent, strMachineName);1716 UIVisoCreatorDialog *pVisoCreator = new UIVisoCreatorDialog(pActionPool, pDialogParent, strMachineName); 1750 1717 1751 1718 if (!pVisoCreator) … … 1789 1756 { 1790 1757 RTStrmPrintf(pStrmViso, "--iprt-iso-maker-file-marker-bourne-sh %RTuuid\n", &Uuid); 1791 vrc = visoWriteQuotedString(pStrmViso, "--volume-id=", strVisoName, "\n");1758 vrc = UIVisoCreatorWidget::visoWriteQuotedString(pStrmViso, "--volume-id=", strVisoName, "\n"); 1792 1759 1793 1760 for (int iFile = 0; iFile < files.size() && RT_SUCCESS(vrc); iFile++) 1794 vrc = visoWriteQuotedString(pStrmViso, NULL, files[iFile], "\n");1761 vrc = UIVisoCreatorWidget::visoWriteQuotedString(pStrmViso, NULL, files[iFile], "\n"); 1795 1762 1796 1763 /* Append custom options if any to the file: */ … … 2077 2044 } 2078 2045 2079 void UICommon::updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target )2046 void UICommon::updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target, UIActionPool *pActionPool) 2080 2047 { 2081 2048 /* Mount (by default): */ … … 2137 2104 } 2138 2105 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateAdHocVISO) 2139 uMediumID = createVisoMediumWithVisoCreator(windowManager().mainWindowShown(), strMachineFolder, comConstMachine.GetName()); 2106 uMediumID = createVisoMediumWithVisoCreator(pActionPool, windowManager().mainWindowShown(), strMachineFolder, 2107 comConstMachine.GetName()); 2140 2108 2141 2109 else if(target.type == UIMediumTarget::UIMediumTargetType_CreateFloppyDisk) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r91445 r92397 56 56 class CMachine; 57 57 class CUSBDevice; 58 class UIActionPool; 58 59 class UIMedium; 59 60 class UIMediumEnumerator; … … 430 431 * @param fEnableCreate Passes whether to show/enable create action in the medium selector dialog, 431 432 * returns QUuid of the new medium */ 432 QUuid openMediumCreatorDialog(QWidget *pParent, UIMediumDeviceType enmMediumType, 433 const QString &strMachineFolder = QString(), 434 const QString &strMachineName = QString(), 433 QUuid openMediumCreatorDialog(UIActionPool *pActionPool, QWidget *pParent, UIMediumDeviceType enmMediumType, 434 const QString &strMachineFolder = QString(), const QString &strMachineName = QString(), 435 435 const QString &strMachineGuestOSTypeId = QString()); 436 436 … … 446 446 const CMachine &comMachine, const QString &strControllerName, const StorageSlot &storageSlot); 447 447 /** Updates @a comConstMachine storage with data described by @a target. */ 448 void updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target );448 void updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target, UIActionPool *pActionPool); 449 449 450 450 /** Generates details for passed @a comMedium. … … 613 613 * @param strDefaultFolder Passes the folder to save the VISO file. 614 614 * @param strMachineName Passes the name of the machine, */ 615 QUuid createVisoMediumWithVisoCreator(QWidget *pParent, const QString &strDefaultFolder = QString(), const QString &strMachineName = QString()); 615 QUuid createVisoMediumWithVisoCreator(UIActionPool *pActionPool, QWidget *pParent, 616 const QString &strDefaultFolder = QString(), const QString &strMachineName = QString()); 616 617 617 618 /** Creates and shows a dialog thru which user can create a new floppy disk a VISO using the file-open dialog. -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r91003 r92397 684 684 685 685 /* Update current machine mount-target: */ 686 uiCommon().updateMachineStorage(machine(), target );686 uiCommon().updateMachineStorage(machine(), target, gpManager->actionPool()); 687 687 } 688 688 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r91363 r92397 459 459 void UIMediumManagerWidget::sltCreateMedium() 460 460 { 461 uiCommon().openMediumCreatorDialog( this, currentMediumType());461 uiCommon().openMediumCreatorDialog(m_pActionPool, this, currentMediumType()); 462 462 } 463 463 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp
r92276 r92397 452 452 void UIMediumSelector::sltCreateMedium() 453 453 { 454 QUuid uMediumId = uiCommon().openMediumCreatorDialog(this, m_enmMediumType, m_strMachineFolder,455 454 QUuid uMediumId;// = uiCommon().openMediumCreatorDialog(this, m_enmMediumType, m_strMachineFolder, 455 // m_strMachineName, m_strMachineGuestOSTypeId); 456 456 /* Make sure that the data structure is updated and newly created medium is selected and visible: */ 457 457 sltHandleMediumCreated(uMediumId); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r92352 r92397 39 39 # include "VBoxUtils-darwin.h" 40 40 #endif 41 42 #include <iprt/getopt.h> 41 43 42 44 … … 550 552 } 551 553 554 /* static */ 555 int UIVisoCreatorWidget::visoWriteQuotedString(PRTSTREAM pStrmDst, const char *pszPrefix, 556 QString const &rStr, const char *pszPostFix) 557 { 558 QByteArray const utf8Array = rStr.toUtf8(); 559 const char *apszArgv[2] = { utf8Array.constData(), NULL }; 560 char *pszQuoted; 561 int vrc = RTGetOptArgvToString(&pszQuoted, apszArgv, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH); 562 if (RT_SUCCESS(vrc)) 563 { 564 if (pszPrefix) 565 vrc = RTStrmPutStr(pStrmDst, pszPrefix); 566 if (RT_SUCCESS(vrc)) 567 { 568 vrc = RTStrmPutStr(pStrmDst, pszQuoted); 569 if (pszPostFix && RT_SUCCESS(vrc)) 570 vrc = RTStrmPutStr(pStrmDst, pszPostFix); 571 } 572 RTStrFree(pszQuoted); 573 } 574 return vrc; 575 } 576 552 577 553 578 /********************************************************************************************************************************* -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r92352 r92397 29 29 #include "QIWithRetranslateUI.h" 30 30 31 #include <iprt/stream.h> 31 32 32 33 /* Forward declarations: */ … … 66 67 #endif 67 68 69 /** 70 * Helper for createVisoMediumWithVisoCreator. 71 * @returns IPRT status code. 72 * @param pStrmDst Where to write the quoted string. 73 * @param pszPrefix Stuff to put in front of it. 74 * @param rStr The string to quote and write out. 75 * @param pszPrefix Stuff to put after it. 76 */ 77 static int visoWriteQuotedString(PRTSTREAM pStrmDst, const char *pszPrefix, 78 QString const &rStr, const char *pszPostFix); 68 79 protected: 69 80 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r92324 r92397 2281 2281 2282 2282 /* Update current machine mount-target: */ 2283 uiCommon().updateMachineStorage(machine(), target );2283 uiCommon().updateMachineStorage(machine(), target, actionPool()); 2284 2284 } 2285 2285
Note:
See TracChangeset
for help on using the changeset viewer.