VirtualBox

Changeset 92397 in vbox


Ignore:
Timestamp:
Nov 12, 2021 11:53:07 AM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10141 Passing the action pool instance to VISO creator.

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  
    114114#include <iprt/err.h>
    115115#include <iprt/file.h>
    116 #include <iprt/getopt.h>
    117116#include <iprt/ldr.h>
    118117#include <iprt/param.h>
    119118#include <iprt/path.h>
    120 #include <iprt/stream.h>
    121119#include <iprt/system.h>
    122120#include <VBox/sup.h>
     
    16821680}
    16831681
    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,
     1682QUuid UICommon::openMediumCreatorDialog(UIActionPool *pActionPool, QWidget *pParent, UIMediumDeviceType enmMediumType,
    17161683                                       const QString &strDefaultFolder /* = QString() */,
    17171684                                       const QString &strMachineName /* = QString() */,
     
    17261693            break;
    17271694        case UIMediumDeviceType_DVD:
    1728             uMediumId = createVisoMediumWithVisoCreator(pParent, strDefaultFolder, strMachineName);
     1695            uMediumId = createVisoMediumWithVisoCreator(pActionPool, pParent, strDefaultFolder, strMachineName);
    17291696            break;
    17301697        case UIMediumDeviceType_Floppy:
     
    17431710}
    17441711
    1745 QUuid UICommon::createVisoMediumWithVisoCreator(QWidget *pParent, const QString &strDefaultFolder /* = QString */,
    1746                                                   const QString &strMachineName /* = QString */)
     1712QUuid UICommon::createVisoMediumWithVisoCreator(UIActionPool *pActionPool, QWidget *pParent, const QString &strDefaultFolder /* = QString */,
     1713                                                const QString &strMachineName /* = QString */)
    17471714{
    17481715    QWidget *pDialogParent = windowManager().realParentWindow(pParent);
    1749     UIVisoCreatorDialog *pVisoCreator = 0;//new UIVisoCreatorDialog(pDialogParent, strMachineName);
     1716    UIVisoCreatorDialog *pVisoCreator = new UIVisoCreatorDialog(pActionPool, pDialogParent, strMachineName);
    17501717
    17511718    if (!pVisoCreator)
     
    17891756                {
    17901757                    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");
    17921759
    17931760                    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");
    17951762
    17961763                    /* Append custom options if any to the file: */
     
    20772044}
    20782045
    2079 void UICommon::updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target)
     2046void UICommon::updateMachineStorage(const CMachine &comConstMachine, const UIMediumTarget &target, UIActionPool *pActionPool)
    20802047{
    20812048    /* Mount (by default): */
     
    21372104                }
    21382105                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());
    21402108
    21412109                else if(target.type == UIMediumTarget::UIMediumTargetType_CreateFloppyDisk)
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r91445 r92397  
    5656class CMachine;
    5757class CUSBDevice;
     58class UIActionPool;
    5859class UIMedium;
    5960class UIMediumEnumerator;
     
    430431          * @param  fEnableCreate            Passes whether to show/enable create action in the medium selector dialog,
    431432          * 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(),
    435435                                      const QString &strMachineGuestOSTypeId = QString());
    436436
     
    446446                                const CMachine &comMachine, const QString &strControllerName, const StorageSlot &storageSlot);
    447447        /** 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);
    449449
    450450        /** Generates details for passed @a comMedium.
     
    613613          * @param  strDefaultFolder  Passes the folder to save the VISO file.
    614614          * @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());
    616617
    617618        /** 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  
    684684
    685685    /* Update current machine mount-target: */
    686     uiCommon().updateMachineStorage(machine(), target);
     686    uiCommon().updateMachineStorage(machine(), target, gpManager->actionPool());
    687687}
    688688
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r91363 r92397  
    459459void UIMediumManagerWidget::sltCreateMedium()
    460460{
    461     uiCommon().openMediumCreatorDialog(this, currentMediumType());
     461    uiCommon().openMediumCreatorDialog(m_pActionPool, this, currentMediumType());
    462462}
    463463
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumSelector.cpp

    r92276 r92397  
    452452void UIMediumSelector::sltCreateMedium()
    453453{
    454     QUuid uMediumId = uiCommon().openMediumCreatorDialog(this, m_enmMediumType, m_strMachineFolder,
    455                                                          m_strMachineName, m_strMachineGuestOSTypeId);
     454    QUuid uMediumId;// = uiCommon().openMediumCreatorDialog(this, m_enmMediumType, m_strMachineFolder,
     455    //                                   m_strMachineName, m_strMachineGuestOSTypeId);
    456456    /* Make sure that the data structure is updated and newly created medium is selected and visible: */
    457457    sltHandleMediumCreated(uMediumId);
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp

    r92352 r92397  
    3939# include "VBoxUtils-darwin.h"
    4040#endif
     41
     42#include <iprt/getopt.h>
    4143
    4244
     
    550552}
    551553
     554/* static */
     555int 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
    552577
    553578/*********************************************************************************************************************************
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h

    r92352 r92397  
    2929#include "QIWithRetranslateUI.h"
    3030
     31#include <iprt/stream.h>
    3132
    3233/* Forward declarations: */
     
    6667#endif
    6768
     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);
    6879protected:
    6980
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r92324 r92397  
    22812281
    22822282    /* Update current machine mount-target: */
    2283     uiCommon().updateMachineStorage(machine(), target);
     2283    uiCommon().updateMachineStorage(machine(), target, actionPool());
    22842284}
    22852285
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette