VirtualBox

Ignore:
Timestamp:
May 28, 2020 11:11:40 AM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Small cleanup for Chooser-pane and Chooser-model regarding passed action-pool pointer.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r84557 r84582  
    494494
    495495            /* Create Chooser-pane: */
    496             m_pPaneChooser = new UIChooser(this);
     496            m_pPaneChooser = new UIChooser(this, actionPool());
    497497            if (m_pPaneChooser)
    498498            {
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp

    r84578 r84582  
    2424#include "UIChooserModel.h"
    2525#include "UIChooserView.h"
    26 #include "UIVirtualBoxManagerWidget.h"
    27 
    28 
    29 UIChooser::UIChooser(UIVirtualBoxManagerWidget *pParent)
     26
     27
     28UIChooser::UIChooser(QWidget *pParent, UIActionPool *pActionPool)
    3029    : QWidget(pParent)
    31     , m_pManagerWidget(pParent)
     30    , m_pActionPool(pActionPool)
    3231    , m_pChooserModel(0)
    3332    , m_pChooserView(0)
     
    3938{
    4039    cleanup();
    41 }
    42 
    43 UIActionPool *UIChooser::actionPool() const
    44 {
    45     AssertPtrReturn(managerWidget(), 0);
    46     return managerWidget()->actionPool();
    4740}
    4841
     
    205198{
    206199    /* Prepare Chooser-model: */
    207     m_pChooserModel = new UIChooserModel(this);
     200    m_pChooserModel = new UIChooserModel(this, actionPool());
    208201}
    209202
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h

    r84557 r84582  
    3232class UIChooserModel;
    3333class UIChooserView;
    34 class UIVirtualBoxManagerWidget;
    3534class UIVirtualMachineItem;
    3635
     
    8079public:
    8180
    82     /** Constructs Chooser-pane passing @a pParent to the base-class. */
    83     UIChooser(UIVirtualBoxManagerWidget *pParent);
     81    /** Constructs Chooser-pane passing @a pParent to the base-class.
     82      * @param  pActionPool  Brings the action-pool reference.  */
     83    UIChooser(QWidget *pParent, UIActionPool *pActionPool);
    8484    /** Destructs Chooser-pane. */
    8585    virtual ~UIChooser() /* override */;
     
    8787    /** @name General stuff.
    8888      * @{ */
    89         /** Returns the manager-widget reference. */
    90         UIVirtualBoxManagerWidget *managerWidget() const { return m_pManagerWidget; }
    91 
    9289        /** Returns the action-pool reference. */
    93         UIActionPool *actionPool() const;
     90        UIActionPool *actionPool() const { return m_pActionPool; }
    9491
    9592        /** Return the Chooser-model instance. */
     
    197194    /** @name General stuff.
    198195      * @{ */
    199         /** Holds the manager-widget reference. */
    200         UIVirtualBoxManagerWidget *m_pManagerWidget;
     196        /** Holds the action-pool reference. */
     197        UIActionPool *m_pActionPool;
    201198
    202199        /** Holds the Chooser-model instane. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp

    r83884 r84582  
    3030
    3131/* GUI includes: */
    32 #include "UIChooser.h"
    3332#include "UIChooserItem.h"
    3433#include "UIChooserItemGroup.h"
     
    9190
    9291        /* Return the parent: */
    93         return QAccessible::queryAccessibleInterface(item()->model()->chooser()->view());
     92        return QAccessible::queryAccessibleInterface(item()->model()->view());
    9493    }
    9594
     
    138137        const QSize   itemSize         = item()->size().toSize();
    139138        const QPointF itemPosInScene   = item()->mapToScene(QPointF(0, 0));
    140         const QPoint  itemPosInView    = item()->model()->chooser()->view()->mapFromScene(itemPosInScene);
    141         const QPoint  itemPosInScreen  = item()->model()->chooser()->view()->mapToGlobal(itemPosInView);
     139        const QPoint  itemPosInView    = item()->model()->view()->mapFromScene(itemPosInScene);
     140        const QPoint  itemPosInScreen  = item()->model()->view()->mapToGlobal(itemPosInView);
    142141        const QRect   itemRectInScreen = QRect(itemPosInScreen, itemSize);
    143142        return itemRectInScreen;
     
    345344    AssertMsg(pModel, ("Incorrect graphics scene parent set!"));
    346345    return pModel;
    347 }
    348 
    349 UIActionPool *UIChooserItem::actionPool() const
    350 {
    351     return model()->actionPool();
    352346}
    353347
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h

    r83672 r84582  
    108108        /** Returns model reference. */
    109109        UIChooserModel *model() const;
    110         /** Returns action-pool reference. */
    111         UIActionPool *actionPool() const;
    112110
    113111        /** Returns whether item is root. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r84574 r84582  
    5757
    5858
    59 UIChooserModel:: UIChooserModel(UIChooser *pParent)
     59UIChooserModel::UIChooserModel(UIChooser *pParent, UIActionPool *pActionPool)
    6060    : UIChooserAbstractModel(pParent)
    61     , m_pChooser(pParent)
     61    , m_pActionPool(pActionPool)
    6262    , m_pScene(0)
    6363    , m_pMouseHandler(0)
     
    9898}
    9999
    100 UIChooser *UIChooserModel::chooser() const
    101 {
    102     return m_pChooser;
    103 }
    104 
    105100UIActionPool *UIChooserModel::actionPool() const
    106101{
    107     return chooser() ? chooser()->actionPool() : 0;
     102    return m_pActionPool;
    108103}
    109104
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r84569 r84582  
    9999
    100100    /** Constructs Chooser-model passing @a pParent to the base-class. */
    101     UIChooserModel(UIChooser *pParent);
     101    UIChooserModel(UIChooser *pParent, UIActionPool *pActionPool);
    102102    /** Destructs Chooser-model. */
    103103    virtual ~UIChooserModel() /* override */;
     
    110110        virtual void deinit() /* override */;
    111111
    112         /** Returns the Chooser reference. */
    113         UIChooser *chooser() const;
    114112        /** Returns the action-pool reference. */
    115113        UIActionPool *actionPool() const;
     
    381379    /** @name General stuff.
    382380      * @{ */
    383         /** Holds the Chooser reference. */
    384         UIChooser *m_pChooser;
     381        /** Holds the action-pool reference. */
     382        UIActionPool *m_pActionPool;
    385383
    386384        /** Holds the scene reference. */
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