VirtualBox

Changeset 77042 in vbox


Ignore:
Timestamp:
Jan 30, 2019 12:51:31 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128485
Message:

FE/Qt: bugref:9241: VirtualBox Manager UI: Sync prepare/cleanup cascade for Chooser global item with machine item.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
2 edited

Legend:

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

    r77026 r77042  
    3737                                         int iPosition /* = -1 */)
    3838    : UIChooserItem(pParent, pParent->isTemporary(), 0, 100)
     39    , m_iPosition(iPosition)
    3940    , m_iDefaultLightnessMin(0)
    4041    , m_iDefaultLightnessMax(0)
     
    4748    , m_iHeightHint(0)
    4849{
    49     /* Prepare: */
    5050    prepare();
    51 
    52     /* Add item to the parent: */
    53     AssertMsg(parentItem(), ("No parent set for global-item!"));
    54     parentItem()->addItem(this, iPosition);
    55     setZValue(parentItem()->zValue() + 1);
    56 
    57     /* Configure connections: */
    58     connect(gpManager, &UIVirtualBoxManager::sigWindowRemapped,
    59             this, &UIChooserItemGlobal::sltHandleWindowRemapped);
    60 
    61     /* Init: */
    62     updatePixmaps();
    63 
    64     /* Apply language settings: */
    65     retranslateUi();
    6651}
    6752
     
    7055                                         int iPosition /* = -1 */)
    7156    : UIChooserItem(pParent, pParent->isTemporary(), 0, 100)
     57    , m_iPosition(iPosition)
    7258    , m_iDefaultLightnessMin(0)
    7359    , m_iDefaultLightnessMax(0)
     
    8066    , m_iHeightHint(pCopyFrom->heightHint())
    8167{
    82     /* Prepare: */
    8368    prepare();
    84 
    85     /* Add item to the parent: */
    86     AssertMsg(parentItem(), ("No parent set for global-item!"));
    87     parentItem()->addItem(this, iPosition);
    88     setZValue(parentItem()->zValue() + 1);
    89 
    90     /* Configure connections: */
    91     connect(gpManager, &UIVirtualBoxManager::sigWindowRemapped,
    92             this, &UIChooserItemGlobal::sltHandleWindowRemapped);
    93 
    94     /* Init: */
    95     updatePixmaps();
    96 
    97     /* Apply language settings: */
    98     retranslateUi();
    9969}
    10070
    10171UIChooserItemGlobal::~UIChooserItemGlobal()
    10272{
    103     /* If that item is focused: */
    104     if (model()->focusItem() == this)
    105     {
    106         /* Unset the focus: */
    107         model()->setFocusItem(0);
    108     }
    109     /* If that item is in selection list: */
    110     if (model()->currentItems().contains(this))
    111     {
    112         /* Remove item from the selection list: */
    113         model()->removeFromCurrentItems(this);
    114     }
    115     /* If that item is in navigation list: */
    116     if (model()->navigationList().contains(this))
    117     {
    118         /* Remove item from the navigation list: */
    119         model()->removeFromNavigationList(this);
    120     }
    121 
    122     /* Remove item from the parent: */
    123     AssertMsg(parentItem(), ("No parent set for global-item!"));
    124     parentItem()->removeItem(this);
     73    cleanup();
    12574}
    12675
     
    438387    m_iMinimumNameWidth = 0;
    439388    m_iMaximumNameWidth = 0;
     389
     390    /* Add item to the parent: */
     391    AssertPtrReturnVoid(parentItem());
     392    parentItem()->addItem(this, m_iPosition);
     393    setZValue(parentItem()->zValue() + 1);
     394
     395    /* Configure connections: */
     396    connect(gpManager, &UIVirtualBoxManager::sigWindowRemapped,
     397            this, &UIChooserItemGlobal::sltHandleWindowRemapped);
     398
     399    /* Init: */
     400    updatePixmaps();
     401
     402    /* Apply language settings: */
     403    retranslateUi();
     404}
     405
     406void UIChooserItemGlobal::cleanup()
     407{
     408    /* If that item is focused: */
     409    if (model()->focusItem() == this)
     410    {
     411        /* Unset the focus: */
     412        model()->setFocusItem(0);
     413    }
     414    /* If that item is in selection list: */
     415    if (model()->currentItems().contains(this))
     416    {
     417        /* Remove item from the selection list: */
     418        model()->removeFromCurrentItems(this);
     419    }
     420    /* If that item is in navigation list: */
     421    if (model()->navigationList().contains(this))
     422    {
     423        /* Remove item from the navigation list: */
     424        model()->removeFromNavigationList(this);
     425    }
     426
     427    /* Remove item from the parent: */
     428    AssertPtrReturnVoid(parentItem());
     429    parentItem()->removeItem(this);
    440430}
    441431
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h

    r77026 r77042  
    195195        /** Prepares all. */
    196196        void prepare();
     197        /** Cleanups all. */
     198        void cleanup();
    197199    /** @} */
    198200
     
    231233    /** @name Item stuff.
    232234      * @{ */
     235        /** Holds initial item position. */
     236        const int  m_iPosition;
     237
    233238        /** Holds item minimum default lightness. */
    234239        int  m_iDefaultLightnessMin;
Note: See TracChangeset for help on using the changeset viewer.

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