VirtualBox

Ignore:
Timestamp:
Mar 1, 2023 4:57:31 PM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking CMachine wrapper usage step-by-step; Storage menu stuff, shared one.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r98779 r98808  
    17101710}
    17111711
    1712 void UICommon::prepareStorageMenu(QMenu &menu,
    1713                                     QObject *pListener, const char *pszSlotName,
    1714                                     const CMachine &comMachine, const QString &strControllerName, const StorageSlot &storageSlot)
     1712void UICommon::prepareStorageMenu(QMenu *pMenu,
     1713                                  QObject *pListener, const char *pszSlotName,
     1714                                  const CMachine &comMachine, const QString &strControllerName, const StorageSlot &storageSlot)
    17151715{
    17161716    /* Current attachment attributes: */
     
    17301730
    17311731    /* Prepare open-existing-medium action: */
    1732     QAction *pActionOpenExistingMedium = menu.addAction(UIIconPool::iconSet(":/select_file_16px.png"),
    1733                                                         QString(), pListener, pszSlotName);
     1732    QAction *pActionOpenExistingMedium = pMenu->addAction(UIIconPool::iconSet(":/select_file_16px.png"),
     1733                                                          QString(), pListener, pszSlotName);
    17341734    pActionOpenExistingMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(),
    17351735                                                                          comCurrentAttachment.GetDevice(), enmMediumType)));
     
    17381738
    17391739    /* Prepare open medium file action: */
    1740     QAction *pActionFileSelector = menu.addAction(UIIconPool::iconSet(":/select_file_16px.png"),
    1741                                                   QString(), pListener, pszSlotName);
     1740    QAction *pActionFileSelector = pMenu->addAction(UIIconPool::iconSet(":/select_file_16px.png"),
     1741                                                    QString(), pListener, pszSlotName);
    17421742    pActionFileSelector->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(),
    17431743                                                                    comCurrentAttachment.GetDevice(), enmMediumType,
     
    17471747
    17481748    /* Insert separator: */
    1749     menu.addSeparator();
     1749    pMenu->addSeparator();
    17501750
    17511751    /* Get existing-host-drive vector: */
     
    17771777        if (!fIsHostDriveUsed)
    17781778        {
    1779             QAction *pActionChooseHostDrive = menu.addAction(UIMedium(comMedium, enmMediumType).name(), pListener, pszSlotName);
     1779            QAction *pActionChooseHostDrive = pMenu->addAction(UIMedium(comMedium, enmMediumType).name(), pListener, pszSlotName);
    17801780            pActionChooseHostDrive->setCheckable(true);
    17811781            pActionChooseHostDrive->setChecked(!comCurrentMedium.isNull() && comMedium.GetId() == uCurrentID);
     
    18321832        if (!fIsRecentMediumUsed)
    18331833        {
    1834             QAction *pActionChooseRecentMedium = menu.addAction(QFileInfo(strRecentMediumLocation).fileName(),
    1835                                                                 pListener, pszSlotName);
     1834            QAction *pActionChooseRecentMedium = pMenu->addAction(QFileInfo(strRecentMediumLocation).fileName(),
     1835                                                                  pListener, pszSlotName);
    18361836            pActionChooseRecentMedium->setCheckable(true);
    18371837            pActionChooseRecentMedium->setChecked(!comCurrentMedium.isNull() && strRecentMediumLocation == strCurrentLocation);
     
    18501850    {
    18511851        /* Insert separator: */
    1852         menu.addSeparator();
     1852        pMenu->addSeparator();
    18531853
    18541854        /* Prepare unmount-current-medium action: */
    1855         QAction *pActionUnmountMedium = menu.addAction(QString(), pListener, pszSlotName);
     1855        QAction *pActionUnmountMedium = pMenu->addAction(QString(), pListener, pszSlotName);
    18561856        pActionUnmountMedium->setEnabled(!comCurrentMedium.isNull());
    18571857        pActionUnmountMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, comCurrentAttachment.GetPort(),
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r98779 r98808  
    421421          * @param  strControllerName  Brings the name of the #CStorageController in the @a machine above.
    422422          * @param  storageSlot        Brings the #StorageSlot of the storage controller with @a strControllerName above. */
    423         void prepareStorageMenu(QMenu &menu,
     423        void prepareStorageMenu(QMenu *pMenu,
    424424                                QObject *pListener, const char *pszSlotName,
    425425                                const CMachine &comMachine, const QString &strControllerName, const StorageSlot &storageSlot);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp

    r98103 r98808  
    10771077
    10781078    /* Fill storage-menu: */
    1079     uiCommon().prepareStorageMenu(menu, this, SLOT(sltMountStorageMedium()),
     1079    uiCommon().prepareStorageMenu(&menu, this, SLOT(sltMountStorageMedium()),
    10801080                                  machine(), strControllerName, storageSlot);
    10811081
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98806 r98808  
    770770{
    771771    return uisession()->mountBootMedium(uMediumId);
     772}
     773
     774void UIMachine::prepareStorageMenu(QMenu *pMenu,
     775                                   QObject *pListener, const char *pszSlotName,
     776                                   const QString &strControllerName, const StorageSlot &storageSlot)
     777{
     778    return uisession()->prepareStorageMenu(pMenu,
     779                                           pListener, pszSlotName,
     780                                           strControllerName, storageSlot);
     781}
     782
     783void UIMachine::updateMachineStorage(const UIMediumTarget &target, UIActionPool *pActionPool)
     784{
     785    return uisession()->updateMachineStorage(target, pActionPool);
    772786}
    773787
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98806 r98808  
    4040#include "UIExtraDataDefs.h"
    4141#include "UIMachineDefs.h"
     42#include "UIMediumDefs.h"
    4243#include "UIMousePointerShapeData.h"
    4344#include "UITextTable.h"
     
    527528          * if it can find an appropriate controller and port. */
    528529        bool mountBootMedium(const QUuid &uMediumId);
     530
     531        /** Prepares storage menu. */
     532        void prepareStorageMenu(QMenu *pMenu,
     533                                QObject *pListener, const char *pszSlotName,
     534                                const QString &strControllerName, const StorageSlot &storageSlot);
     535        /** Updates machine storage with data described by target. */
     536        void updateMachineStorage(const UIMediumTarget &target, UIActionPool *pActionPool);
    529537    /** @} */
    530538
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r98805 r98808  
    268268{
    269269    return uimachine()->actionPool();
    270 }
    271 
    272 CMachine& UIMachineLogic::machine() const
    273 {
    274     return uisession()->machine();
    275270}
    276271
     
    21672162
    21682163    /* Update current machine mount-target: */
    2169     uiCommon().updateMachineStorage(machine(), target, actionPool());
     2164    uimachine()->updateMachineStorage(target, actionPool());
    21702165}
    21712166
     
    26832678
    26842679        /* Fill current storage menu: */
    2685         uiCommon().prepareStorageMenu(*pStorageMenu,
    2686                                       this, SLOT(sltMountStorageMedium()), machine(),
    2687                                       guiStorageDevice.m_strControllerName, guiStorageDevice.m_guiStorageSlot);
     2680        uimachine()->prepareStorageMenu(pStorageMenu,
     2681                                        this, SLOT(sltMountStorageMedium()),
     2682                                        guiStorageDevice.m_strControllerName, guiStorageDevice.m_guiStorageSlot);
    26882683    }
    26892684}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r98805 r98808  
    3737#include "UISettingsDialog.h"
    3838
    39 /* COM includes: */
    40 #include "COMEnums.h"
    41 
    4239/* Forward declarations: */
    4340class QAction;
     
    5451class UISoftKeyboard;
    5552class UIVMInformationDialog;
    56 class CMachine;
    57 class CMouse;
    58 class CSnapshot;
    5953class CUSBDevice;
    6054class CVirtualBoxErrorInfo;
     
    107101    /** Returns action-pool reference.  */
    108102    UIActionPool *actionPool() const;
    109 
    110     /** Returns the session's machine reference. */
    111     CMachine& machine() const;
    112103
    113104    /** Returns the machine name. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98805 r98808  
    844844}
    845845
     846void UISession::prepareStorageMenu(QMenu *pMenu,
     847                                   QObject *pListener, const char *pszSlotName,
     848                                   const QString &strControllerName, const StorageSlot &storageSlot)
     849{
     850    CMachine comMachine = machine();
     851    uiCommon().prepareStorageMenu(pMenu,
     852                                  pListener, pszSlotName,
     853                                  comMachine, strControllerName, storageSlot);
     854}
     855
     856void UISession::updateMachineStorage(const UIMediumTarget &target, UIActionPool *pActionPool)
     857{
     858    CMachine comMachine = machine();
     859    uiCommon().updateMachineStorage(comMachine, target, pActionPool);
     860}
     861
    846862bool UISession::usbDevices(QList<USBDeviceInfo> &guiUSBDevices)
    847863{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98805 r98808  
    338338          * if it can find an appropriate controller and port. */
    339339        bool mountBootMedium(const QUuid &uMediumId);
     340
     341        /** Prepares storage menu. */
     342        void prepareStorageMenu(QMenu *pMenu,
     343                                QObject *pListener, const char *pszSlotName,
     344                                const QString &strControllerName, const StorageSlot &storageSlot);
     345        /** Updates machine storage with data described by target. */
     346        void updateMachineStorage(const UIMediumTarget &target, UIActionPool *pActionPool);
    340347    /** @} */
    341348
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