VirtualBox

Changeset 43825 in vbox for trunk


Ignore:
Timestamp:
Nov 7, 2012 10:31:08 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: VM group UI: Get rid of root-item indent hardcoding.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp

    r43824 r43825  
    367367        case GroupItemData_MajorSpacing: return 10;
    368368        case GroupItemData_MinorSpacing: return 3;
     369        case GroupItemData_RootIndent: return 2;
    369370        /* Texts: */
    370371        case GroupItemData_Name: return m_strVisibleName;
     
    476477    int iMajorSpacing = data(GroupItemData_MajorSpacing).toInt();
    477478    int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
     479    int iRootIndent = data(GroupItemData_RootIndent).toInt();
    478480    int iToggleButtonWidth = data(GroupItemData_ToggleButtonSize).toSize().width();
    479481    int iEnterButtonWidth = data(GroupItemData_EnterButtonSize).toSize().width();
     
    486488
    487489    /* Left margin: */
     490    if (isRoot())
     491        iMaximumWidth -= iRootIndent;
    488492    iMaximumWidth -= iHorizontalMargin;
    489493    /* Button width: */
     
    497501    {
    498502        /* Spacing between name and info: */
    499         iMaximumWidth -= iMinorSpacing;
     503        iMaximumWidth -= iMajorSpacing;
    500504        /* Group info width: */
    501505        if (!m_groupItems.isEmpty())
     
    510514    /* Right margin: */
    511515    iMaximumWidth -= iHorizontalMargin;
     516    if (isRoot())
     517        iMaximumWidth -= iRootIndent;
    512518
    513519    /* Recache visible name: */
     
    555561                    iMinimumNameWidth +
    556562                    /* Spacing between name and info: */
    557                     iMinorSpacing;
     563                    iMajorSpacing;
    558564    /* Group info width: */
    559565    if (!m_groupItems.isEmpty())
     
    936942    int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
    937943    int iFullHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();
     944    int iRootIndent = data(GroupItemData_RootIndent).toInt();
    938945    int iPreviousVerticalIndent = 0;
    939946
     
    945952        {
    946953            /* Prepare body indent: */
    947             iPreviousVerticalIndent = 2;
     954            iPreviousVerticalIndent = iRootIndent;
    948955        }
    949956        /* Header (non-main root-item): */
     
    962969                int iExitButtonHeight = data(GroupItemData_ExitButtonSize).toSize().height();
    963970                /* Layout exit-button: */
    964                 int iExitButtonX = iHorizontalMargin + 2;
     971                int iExitButtonX = iHorizontalMargin + iRootIndent;
    965972                int iExitButtonY = iExitButtonHeight == iFullHeaderHeight ? iVerticalMargin :
    966973                                   iVerticalMargin + (iFullHeaderHeight - iExitButtonHeight) / 2;
     
    10411048    {
    10421049        /* Prepare variables: */
    1043         int iHorizontalIndent = isRoot() ? 2 : iHorizontalMargin;
     1050        int iHorizontalIndent = isRoot() ? iRootIndent : iHorizontalMargin;
    10441051        QRect geo = geometry().toRect();
    10451052        int iX = geo.x();
     
    10701077    /* Prepare variables: */
    10711078    int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
     1079    int iRootIndent = data(GroupItemData_RootIndent).toInt();
    10721080    int iFullHeaderWidth = data(GroupItemData_FullHeaderSize).toSize().width();
    10731081
     
    10831091    {
    10841092        /* Prepare variables: */
    1085         int iHorizontalIndent = isRoot() ? 2 : iHorizontalMargin;
     1093        int iHorizontalIndent = isRoot() ? iRootIndent : iHorizontalMargin;
    10861094        /* We have to make sure that we had taken into account: */
    10871095        foreach (UIGChooserItem *pItem, items())
     
    14381446            /* Prepare variables: */
    14391447            int iMargin = data(GroupItemData_VerticalMargin).toInt();
     1448            int iRootIndent = data(GroupItemData_RootIndent).toInt();
    14401449            int iHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();
    14411450            int iFullHeaderHeight = 2 * iMargin + iHeaderHeight;
     
    14441453            /* Add clipping: */
    14451454            QPainterPath path;
    1446             path.moveTo(2, 0);
     1455            path.moveTo(iRootIndent, 0);
    14471456            path.lineTo(path.currentPosition().x(), iFullHeaderHeight - 10);
    14481457            path.arcTo(QRectF(path.currentPosition(), QSizeF(20, 20)).translated(0, -10), 180, 90);
    1449             path.lineTo(rect.width() - 10 - 2, path.currentPosition().y());
     1458            path.lineTo(rect.width() - 10 - iRootIndent, path.currentPosition().y());
    14501459            path.arcTo(QRectF(path.currentPosition(), QSizeF(20, 20)).translated(-10, -20), 270, 90);
    14511460            path.lineTo(path.currentPosition().x(), 0);
     
    15461555    int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
    15471556    int iMajorSpacing = data(GroupItemData_MajorSpacing).toInt();
     1557    int iRootIndent = data(GroupItemData_RootIndent).toInt();
    15481558    QSize toggleButtonSize = data(GroupItemData_ToggleButtonSize).toSize();
    15491559    QSize exitButtonSize = data(GroupItemData_ExitButtonSize).toSize();
     
    15691579    int iNameX = iHorizontalMargin;
    15701580    if (isRoot())
    1571         iNameX += 2 + exitButtonSize.width();
     1581        iNameX += iRootIndent + exitButtonSize.width();
    15721582    else
    15731583        iNameX += toggleButtonSize.width();
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h

    r43823 r43825  
    108108        GroupItemData_MajorSpacing,
    109109        GroupItemData_MinorSpacing,
     110        GroupItemData_RootIndent,
    110111        /* Text: */
    111112        GroupItemData_Name,
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