VirtualBox

Changeset 74002 in vbox for trunk/src


Ignore:
Timestamp:
Aug 31, 2018 11:19:49 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager UI: Chooser pane re-styling: Group and Machine items: Proper children indentation.

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

Legend:

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

    r73927 r74002  
    296296}
    297297
     298int UIChooserItem::level() const
     299{
     300    int iLevel = 0;
     301    UIChooserItem *pParentItem = parentItem();
     302    while (pParentItem && !pParentItem->isRoot())
     303    {
     304        pParentItem = pParentItem->parentItem();
     305        ++iLevel;
     306    }
     307    return iLevel;
     308}
     309
    298310void UIChooserItem::show()
    299311{
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h

    r73948 r74002  
    122122        /** Returns action-pool reference. */
    123123        UIActionPool *actionPool() const;
     124
     125        /** Returns a level of item. */
     126        int level() const;
    124127
    125128        /** Shows item. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r74001 r74002  
    749749{
    750750    /* Prepare variables: */
    751     int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
    752     int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
    753     int iFullHeaderHeight = m_minimumHeaderSize.height();
     751    const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
     752    const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
     753    const int iParentIndent = data(GroupItemData_ParentIndent).toInt();
     754    const int iFullHeaderHeight = m_minimumHeaderSize.height();
    754755    int iPreviousVerticalIndent = 0;
    755756
     
    797798            int iToggleButtonHeight = m_toggleButtonSize.height();
    798799            /* Layout toggle-button: */
    799             int iToggleButtonX = iHorizontalMargin;
     800            int iToggleButtonX = iHorizontalMargin + iParentIndent * level();
    800801            int iToggleButtonY = iToggleButtonHeight == iFullHeaderHeight ? iVerticalMargin :
    801802                                 iVerticalMargin + (iFullHeaderHeight - iToggleButtonHeight) / 2;
     
    12891290        case GroupItemData_VerticalMargin:  return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    12901291        case GroupItemData_Spacing:         return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
     1292        case GroupItemData_ParentIndent:    return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3;
    12911293
    12921294        /* Default: */
     
    14191421    {
    14201422        /* Prepare variables: */
    1421         int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
     1423        const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
     1424        const int iParentIndent = data(GroupItemData_ParentIndent).toInt();
    14221425
    14231426        /* Basically we have to take header width into account: */
     
    14351438
    14361439        /* And 2 margins at last - left and right: */
    1437         iProposedWidth += 2 * iHorizontalMargin;
     1440        iProposedWidth += 2 * iHorizontalMargin + iParentIndent * level();
    14381441    }
    14391442
     
    17441747
    17451748    /* Prepare variables: */
    1746     int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
    1747     int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
    1748     int iSpacing = data(GroupItemData_Spacing).toInt();
    1749     int iFullHeaderHeight = m_minimumHeaderSize.height();
     1749    const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
     1750    const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
     1751    const int iSpacing = data(GroupItemData_Spacing).toInt();
     1752    const int iParentIndent = data(GroupItemData_ParentIndent).toInt();
     1753    const int iFullHeaderHeight = m_minimumHeaderSize.height();
    17501754
    17511755    /* Configure painter color: */
     
    17631767
    17641768    /* Paint name: */
    1765     int iNameX = iHorizontalMargin;
     1769    int iNameX = iHorizontalMargin + iParentIndent * level();
    17661770    if (isRoot())
    17671771        iNameX += m_exitButtonSize.width();
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r74000 r74002  
    243243        GroupItemData_VerticalMargin,
    244244        GroupItemData_Spacing,
     245        GroupItemData_ParentIndent,
    245246    };
    246247
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r73997 r74002  
    399399{
    400400    /* Prepare variables: */
    401     int iMargin = data(MachineItemData_Margin).toInt();
    402     int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt();
    403     int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt();
     401    const int iMargin = data(MachineItemData_Margin).toInt();
     402    const int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt();
     403    const int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt();
     404    const int iParentIndent = data(MachineItemData_ParentIndent).toInt();
    404405
    405406    /* Calculating proposed width: */
     
    407408
    408409    /* Two margins: */
    409     iProposedWidth += 2 * iMargin;
     410    iProposedWidth += 2 * iMargin + iParentIndent * level();
    410411    /* And machine-item content to take into account: */
    411412    int iTopLineWidth = m_iMinimumNameWidth;
     
    622623        case MachineItemData_MinorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
    623624        case MachineItemData_TextSpacing:  return 0;
     625        case MachineItemData_ParentIndent: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3;
    624626
    625627        /* Pixmaps: */
     
    993995    /* Prepare variables: */
    994996    QRect fullRect = pOption->rect;
    995     int iFullHeight = fullRect.height();
    996     int iMargin = data(MachineItemData_Margin).toInt();
    997     int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt();
    998     int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt();
    999     int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt();
     997    const int iFullHeight = fullRect.height();
     998    const int iMargin = data(MachineItemData_Margin).toInt();
     999    const int iMajorSpacing = data(MachineItemData_MajorSpacing).toInt();
     1000    const int iMinorSpacing = data(MachineItemData_MinorSpacing).toInt();
     1001    const int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt();
     1002    const int iParentIndent = data(MachineItemData_ParentIndent).toInt();
    10001003
    10011004    /* Selected item foreground: */
     
    10191022
    10201023    /* Calculate indents: */
    1021     int iLeftColumnIndent = iMargin;
     1024    int iLeftColumnIndent = iMargin + iParentIndent * level();
    10221025
    10231026    /* Paint left column: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h

    r73989 r74002  
    195195        MachineItemData_MinorSpacing,
    196196        MachineItemData_TextSpacing,
     197        MachineItemData_ParentIndent,
    197198        /* Pixmaps: */
    198199        MachineItemData_SettingsButtonPixmap,
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