VirtualBox

Changeset 77434 in vbox


Ignore:
Timestamp:
Feb 22, 2019 3:06:41 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128997
Message:

FE/Qt: bugref:9241: VirtualBox Manager UI: Chooser pane: Wipe out slider item copying and root changing stuff.

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

Legend:

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

    r77366 r77434  
    199199    , m_fFavorite(fFavorite)
    200200    , m_fTemporary(fTemporary)
    201     , m_fRoot(!pParent)
    202201    , m_iLevel(-1)
    203202    , m_fHovered(false)
     
    353352}
    354353
    355 void UIChooserItem::setRoot(bool fRoot)
    356 {
    357     m_fRoot = fRoot;
    358     handleRootStatusChange();
    359 }
    360 
    361 bool UIChooserItem::isRoot() const
    362 {
    363     return m_fRoot;
    364 }
    365 
    366354void UIChooserItem::setHovered(bool fHovered)
    367355{
     
    533521}
    534522
    535 void UIChooserItem::handleRootStatusChange()
    536 {
    537     /* Reset minimum size hints for non-root items: */
    538     if (!isRoot())
    539         m_iPreviousMinimumWidthHint = 0;
    540 }
    541 
    542523/* static */
    543524QSize UIChooserItem::textSize(const QFont &font, QPaintDevice *pPaintDevice, const QString &strText)
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h

    r77366 r77434  
    122122        virtual void setFavorite(bool fFavorite);
    123123
     124        /** Returns whether item is root. */
     125        bool isRoot() const { return !m_pParent; }
     126
    124127        /** Casts item to group one. */
    125128        UIChooserItemGroup *toGroupItem();
     
    153156        /** Returns item definition. */
    154157        virtual QString definition() const = 0;
    155 
    156         /** Defines whether item is @a fRoot. */
    157         void setRoot(bool fRoot);
    158         /** Returns whether item is root. */
    159         bool isRoot() const;
    160158
    161159        /** Defines whether item is @a fHovered. */
     
    266264    /** @name Item stuff.
    267265      * @{ */
    268         /** Handles root status change. */
    269         virtual void handleRootStatusChange();
    270 
    271266        /** Defines item's default animation @a iValue. */
    272267        void setDefaultValue(int iValue) { m_iDefaultValue = iValue; update(); }
     
    340335        bool           m_fTemporary;
    341336
    342         /** Holds whether item is root. */
    343         bool  m_fRoot;
    344337        /** Holds the item level according to root. */
    345338        int   m_iLevel;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r77430 r77434  
    4646UIChooserItemGroup::UIChooserItemGroup(QGraphicsScene *pScene)
    4747    : UIChooserItem(0, false /* favorite? */, false /* temporary? */)
    48     , m_fMainRoot(true)
    4948    , m_fClosed(false)
    5049    , m_iAdditionalHeight(0)
     
    7877}
    7978
    80 UIChooserItemGroup::UIChooserItemGroup(QGraphicsScene *pScene,
     79UIChooserItemGroup::UIChooserItemGroup(UIChooserItem *pParent,
     80                                       const QString &strName,
     81                                       bool fOpened /* = false */,
     82                                       int iPosition /* = -1 */)
     83    : UIChooserItem(pParent, pParent->isFavorite(), pParent->isTemporary())
     84    , m_fClosed(!fOpened)
     85    , m_iAdditionalHeight(0)
     86    , m_iHeaderDarkness(110)
     87    , m_strName(strName)
     88    , m_pToggleButton(0)
     89    , m_pEnterButton(0)
     90    , m_pExitButton(0)
     91    , m_pNameEditorWidget(0)
     92    , m_pContainerFavorite(0)
     93    , m_pLayoutFavorite(0)
     94    , m_pScrollArea(0)
     95    , m_pContainer(0)
     96    , m_pLayout(0)
     97    , m_pLayoutGlobal(0)
     98    , m_pLayoutGroup(0)
     99    , m_pLayoutMachine(0)
     100{
     101    /* Prepare: */
     102    prepare();
     103
     104    /* Add item to the parent: */
     105    AssertMsg(parentItem(), ("Incorrect parent passed!"));
     106    parentItem()->addItem(this, false, iPosition);
     107    connect(this, &UIChooserItemGroup::sigToggleStarted,
     108            model(), &UIChooserModel::sigToggleStarted);
     109    connect(this, &UIChooserItemGroup::sigToggleFinished,
     110            model(), &UIChooserModel::sigToggleFinished,
     111            Qt::QueuedConnection);
     112    connect(gpManager, &UIVirtualBoxManager::sigWindowRemapped,
     113            this, &UIChooserItemGroup::sltHandleWindowRemapped);
     114
     115    /* Apply language settings: */
     116    retranslateUi();
     117
     118    /* Init: */
     119    updatePixmaps();
     120    updateItemCountInfo();
     121    updateVisibleName();
     122    updateToolTip();
     123
     124    /* Prepare connections: */
     125    connect(this, &UIChooserItemGroup::sigMinimumWidthHintChanged,
     126            model(), &UIChooserModel::sigRootItemMinimumWidthHintChanged);
     127}
     128
     129UIChooserItemGroup::UIChooserItemGroup(UIChooserItem *pParent,
    81130                                       UIChooserItemGroup *pCopyFrom,
    82                                        bool fMainRoot)
    83     : UIChooserItem(0, false /* favorite? */, true /* temporary? */)
    84     , m_fMainRoot(fMainRoot)
     131                                       int iPosition /* = -1 */)
     132    : UIChooserItem(pParent, pParent->isFavorite(), pParent->isTemporary())
    85133    , m_fClosed(pCopyFrom->isClosed())
    86134    , m_iAdditionalHeight(0)
     
    103151    prepare();
    104152
    105     /* Add item to the scene: */
    106     AssertMsg(pScene, ("Incorrect scene passed!"));
    107     pScene->addItem(this);
    108 
    109     /* Copy content to 'this': */
    110     copyContent(pCopyFrom, this);
    111 
    112     /* Apply language settings: */
    113     retranslateUi();
    114 
    115     /* Init: */
    116     updateItemCountInfo();
    117     updateVisibleName();
    118     updateToolTip();
    119 }
    120 
    121 UIChooserItemGroup::UIChooserItemGroup(UIChooserItem *pParent,
    122                                        const QString &strName,
    123                                        bool fOpened /* = false */,
    124                                        int iPosition /* = -1 */)
    125     : UIChooserItem(pParent, pParent->isFavorite(), pParent->isTemporary())
    126     , m_fMainRoot(false)
    127     , m_fClosed(!fOpened)
    128     , m_iAdditionalHeight(0)
    129     , m_iHeaderDarkness(110)
    130     , m_strName(strName)
    131     , m_pToggleButton(0)
    132     , m_pEnterButton(0)
    133     , m_pExitButton(0)
    134     , m_pNameEditorWidget(0)
    135     , m_pContainerFavorite(0)
    136     , m_pLayoutFavorite(0)
    137     , m_pScrollArea(0)
    138     , m_pContainer(0)
    139     , m_pLayout(0)
    140     , m_pLayoutGlobal(0)
    141     , m_pLayoutGroup(0)
    142     , m_pLayoutMachine(0)
    143 {
    144     /* Prepare: */
    145     prepare();
    146 
    147     /* Add item to the parent: */
    148     AssertMsg(parentItem(), ("Incorrect parent passed!"));
    149     parentItem()->addItem(this, false, iPosition);
    150     connect(this, &UIChooserItemGroup::sigToggleStarted,
    151             model(), &UIChooserModel::sigToggleStarted);
    152     connect(this, &UIChooserItemGroup::sigToggleFinished,
    153             model(), &UIChooserModel::sigToggleFinished,
    154             Qt::QueuedConnection);
    155     connect(gpManager, &UIVirtualBoxManager::sigWindowRemapped,
    156             this, &UIChooserItemGroup::sltHandleWindowRemapped);
    157 
    158     /* Apply language settings: */
    159     retranslateUi();
    160 
    161     /* Init: */
    162     updatePixmaps();
    163     updateItemCountInfo();
    164     updateVisibleName();
    165     updateToolTip();
    166 
    167     /* Prepare connections: */
    168     connect(this, &UIChooserItemGroup::sigMinimumWidthHintChanged,
    169             model(), &UIChooserModel::sigRootItemMinimumWidthHintChanged);
    170 }
    171 
    172 UIChooserItemGroup::UIChooserItemGroup(UIChooserItem *pParent,
    173                                        UIChooserItemGroup *pCopyFrom,
    174                                        int iPosition /* = -1 */)
    175     : UIChooserItem(pParent, pParent->isFavorite(), pParent->isTemporary())
    176     , m_fMainRoot(false)
    177     , m_fClosed(pCopyFrom->isClosed())
    178     , m_iAdditionalHeight(0)
    179     , m_iHeaderDarkness(110)
    180     , m_strName(pCopyFrom->name())
    181     , m_pToggleButton(0)
    182     , m_pEnterButton(0)
    183     , m_pExitButton(0)
    184     , m_pNameEditorWidget(0)
    185     , m_pContainerFavorite(0)
    186     , m_pLayoutFavorite(0)
    187     , m_pScrollArea(0)
    188     , m_pContainer(0)
    189     , m_pLayout(0)
    190     , m_pLayoutGlobal(0)
    191     , m_pLayoutGroup(0)
    192     , m_pLayoutMachine(0)
    193 {
    194     /* Prepare: */
    195     prepare();
    196 
    197153    /* Add item to the parent: */
    198154    AssertMsg(parentItem(), ("Incorrect parent passed!"));
     
    468424void UIChooserItemGroup::updateToolTip()
    469425{
    470     /* Not for main root: */
    471     if (isMainRoot())
     426    /* Not for root item: */
     427    if (isRoot())
    472428        return;
    473429
     
    531487QString UIChooserItemGroup::fullName() const
    532488{
    533     /* Return "/" for main root-item: */
    534     if (isMainRoot())
     489    /* Return "/" for root item: */
     490    if (isRoot())
    535491        return "/";
     492
    536493    /* Get full parent name, append with '/' if not yet appended: */
    537494    AssertMsg(parentItem(), ("Incorrect parent set!"));
     
    546503{
    547504    return QString("g=%1").arg(name());
    548 }
    549 
    550 void UIChooserItemGroup::handleRootStatusChange()
    551 {
    552     /* Call to base-class: */
    553     UIChooserItem::handleRootStatusChange();
    554 
    555     /* Update linked values: */
    556     updateVisibleName();
    557     updateMinimumHeaderSize();
    558505}
    559506
     
    858805        const QGraphicsView *pView = model()->scene()->views().first();
    859806
     807#if 0
    860808        /* Header (non-main root-item): */
    861809        if (!isMainRoot())
     
    884832            iPreviousVerticalIndent = iVerticalMargin + iFullHeaderHeight + iVerticalMargin;
    885833        }
     834#endif
    886835
    887836        /* Adjust scroll-view geometry: */
     
    13071256                this, &UIChooserItemGroup::sltGroupToggleFinish);
    13081257        m_pToggleButton->hide();
     1258        m_toggleButtonSize = m_pToggleButton ? m_pToggleButton->minimumSizeHint().toSize() : QSize(0, 0);
    13091259
    13101260        /* Setup enter-button: */
     
    13131263                this, &UIChooserItemGroup::sltIndentRoot);
    13141264        m_pEnterButton->hide();
     1265        m_enterButtonSize = m_pEnterButton ? m_pEnterButton->minimumSizeHint().toSize() : QSize(0, 0);
    13151266
    13161267        /* Setup name-editor: */
     
    13201271                this, &UIChooserItemGroup::sltNameEditingFinished);
    13211272    }
     1273
     1274#if 0
    13221275    /* Items except main root: */
    13231276    if (!isMainRoot())
     
    13301283        m_pExitButton->setTransformOriginPoint(sh.width() / 2, sh.height() / 2);
    13311284        m_pExitButton->hide();
    1332     }
    1333 
    1334     /* Button sizes: */
    1335     m_toggleButtonSize = m_pToggleButton ? m_pToggleButton->minimumSizeHint().toSize() : QSize(0, 0);
    1336     m_enterButtonSize = m_pEnterButton ? m_pEnterButton->minimumSizeHint().toSize() : QSize(0, 0);
    1337     m_exitButtonSize = m_pExitButton ? m_pExitButton->minimumSizeHint().toSize() : QSize(0, 0);
     1285        m_exitButtonSize = m_pExitButton ? m_pExitButton->minimumSizeHint().toSize() : QSize(0, 0);
     1286    }
     1287#endif
    13381288
    13391289    /* Prepare favorite children container: */
     
    14951445void UIChooserItemGroup::updateItemCountInfo()
    14961446{
    1497     /* Not for main root: */
    1498     if (isMainRoot())
     1447    /* Not for root item: */
     1448    if (isRoot())
    14991449        return;
    15001450
     
    15401490    int iProposedWidth = 0;
    15411491
    1542     /* Main root-item: */
    1543     if (isMainRoot())
     1492    /* For root item: */
     1493    if (isRoot())
    15441494    {
    15451495        /* Main root-item always takes body into account: */
     
    15511501        }
    15521502    }
    1553     /* Other items, including temporary roots: */
     1503    /* For other items: */
    15541504    else
    15551505    {
     
    15821532    int iProposedHeight = 0;
    15831533
    1584     /* Main root-item: */
    1585     if (isMainRoot())
     1534    /* For root item: */
     1535    if (isRoot())
    15861536    {
    15871537        /* Main root-item always takes body into account: */
     
    15931543        }
    15941544    }
    1595     /* Other items, including temporary roots: */
     1545    /* For other items: */
    15961546    else
    15971547    {
     
    16281578void UIChooserItemGroup::updateVisibleName()
    16291579{
    1630     /* Not for main root: */
    1631     if (isMainRoot())
     1580    /* Not for root item: */
     1581    if (isRoot())
    16321582        return;
    16331583
     
    17001650void UIChooserItemGroup::updateMinimumHeaderSize()
    17011651{
    1702     /* Not for main root: */
    1703     if (isMainRoot())
     1652    /* Not for root item: */
     1653    if (isRoot())
    17041654        return;
    17051655
     
    17911741    if (isRoot())
    17921742    {
     1743#if 0
    17931744        /* Non-main root-item: */
    17941745        if (!isMainRoot())
     
    18051756            pPainter->fillRect(headerRect, headerGradient);
    18061757        }
     1758#endif
    18071759    }
    18081760    /* Non-root-item: */
     
    18921844void UIChooserItemGroup::paintHeader(QPainter *pPainter, const QRect &rect)
    18931845{
    1894     /* Not for main root: */
    1895     if (isMainRoot())
     1846    /* Not for root item: */
     1847    if (isRoot())
    18961848        return;
    18971849
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r77366 r77434  
    6767    /** Constructs main-root item, passing pScene to the base-class. */
    6868    UIChooserItemGroup(QGraphicsScene *pScene);
    69     /** Constructs temporary @a fMainRoot item as a @a pCopyFrom, passing pScene to the base-class. */
    70     UIChooserItemGroup(QGraphicsScene *pScene, UIChooserItemGroup *pCopyFrom, bool fMainRoot);
    7169    /** Constructs non-root item with specified @a strName and @a iPosition, @a fOpened if requested, passing pParent to the base-class. */
    7270    UIChooserItemGroup(UIChooserItem *pParent, const QString &strName, bool fOpened = false, int iPosition  = -1);
     
    151149        /** Returns item definition. */
    152150        virtual QString definition() const /* override */;
    153 
    154         /** Handles root status change. */
    155         virtual void handleRootStatusChange() /* override */;
    156151    /** @} */
    157152
     
    275270        QVariant data(int iKey) const;
    276271
    277         /** Returns whether group is main-root. */
    278         bool isMainRoot() const { return m_fMainRoot; }
    279 
    280272        /** Returns item's header darkness. */
    281273        int headerDarkness() const { return m_iHeaderDarkness; }
     
    334326    /** @name Item stuff.
    335327      * @{ */
    336         /** Holds whether group is main-root. */
    337         const bool  m_fMainRoot;
    338 
    339328        /** Holds whether group is closed. */
    340329        bool  m_fClosed;
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