Changeset 43847 in vbox
- Timestamp:
- Nov 9, 2012 11:50:23 AM (12 years ago)
- 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
r43846 r43847 379 379 case GroupItemData_MinorSpacing: return 3; 380 380 case GroupItemData_RootIndent: return 2; 381 /* Sizes: */ 382 case GroupItemData_ToggleButtonSize: return m_pToggleButton ? m_pToggleButton->minimumSizeHint().toSize() : QSize(0, 0); 383 case GroupItemData_EnterButtonSize: return m_pEnterButton ? m_pEnterButton->minimumSizeHint().toSize() : QSize(0, 0); 384 case GroupItemData_ExitButtonSize: return m_pExitButton ? m_pExitButton->minimumSizeHint().toSize() : QSize(0, 0); 385 case GroupItemData_GroupPixmapSize: return isMainRoot() ? QSize(0, 0) : m_groupsPixmap.size(); 386 case GroupItemData_MachinePixmapSize: return isMainRoot() ? QSize(0, 0) : m_machinesPixmap.size(); 387 case GroupItemData_FullHeaderSize: return m_headerSize; 381 388 382 /* Default: */ 389 383 default: break; … … 410 404 m_groupsPixmap = QPixmap(":/nw_16px.png"); 411 405 m_machinesPixmap = QPixmap(":/machine_16px.png"); 406 m_pixmapSizeGroups = m_groupsPixmap.size(); 407 m_pixmapSizeMachines = m_machinesPixmap.size(); 412 408 413 409 /* Items except roots: */ … … 444 440 m_pExitButton->hide(); 445 441 } 442 443 /* Button sizes: */ 444 m_toggleButtonSize = m_pToggleButton ? m_pToggleButton->minimumSizeHint().toSize() : QSize(0, 0); 445 m_enterButtonSize = m_pEnterButton ? m_pEnterButton->minimumSizeHint().toSize() : QSize(0, 0); 446 m_exitButtonSize = m_pExitButton ? m_pExitButton->minimumSizeHint().toSize() : QSize(0, 0); 446 447 } 447 448 … … 476 477 int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt(); 477 478 int iRootIndent = data(GroupItemData_RootIndent).toInt(); 478 int iToggleButtonWidth = data(GroupItemData_ToggleButtonSize).toSize().width();479 int iEnterButtonWidth = data(GroupItemData_EnterButtonSize).toSize().width();480 int iExitButtonWidth = data(GroupItemData_ExitButtonSize).toSize().width();481 int iGroupPixmapWidth = data(GroupItemData_GroupPixmapSize).toSize().width();482 int iMachinePixmapWidth = data(GroupItemData_MachinePixmapSize).toSize().width();479 int iToggleButtonWidth = m_toggleButtonSize.width(); 480 int iEnterButtonWidth = m_enterButtonSize.width(); 481 int iExitButtonWidth = m_exitButtonSize.width(); 482 int iGroupPixmapWidth = m_pixmapSizeGroups.width(); 483 int iMachinePixmapWidth = m_pixmapSizeMachines.width(); 483 484 int iGroupCountTextWidth = m_infoSizeGroups.width(); 484 485 int iMachineCountTextWidth = m_infoSizeMachines.width(); … … 546 547 int iMajorSpacing = data(GroupItemData_MajorSpacing).toInt(); 547 548 int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt(); 548 QSize exitButtonSize = data(GroupItemData_ExitButtonSize).toSize();549 QSize toggleButtonSize = data(GroupItemData_ToggleButtonSize).toSize();550 QSize groupPixmapSize = data(GroupItemData_GroupPixmapSize).toSize();551 QSize machinePixmapSize = data(GroupItemData_MachinePixmapSize).toSize();552 QSize enterButtonSize = data(GroupItemData_EnterButtonSize).toSize();553 549 554 550 /* Calculate minimum visible name size: */ … … 564 560 /* Button width: */ 565 561 if (isRoot()) 566 iHeaderWidth += exitButtonSize.width();562 iHeaderWidth += m_exitButtonSize.width(); 567 563 else 568 iHeaderWidth += toggleButtonSize.width();564 iHeaderWidth += m_toggleButtonSize.width(); 569 565 iHeaderWidth += /* Spacing between button and name: */ 570 566 iMajorSpacing + … … 575 571 /* Group info width: */ 576 572 if (!m_groupItems.isEmpty()) 577 iHeaderWidth += ( groupPixmapSize.width() + m_infoSizeGroups.width());573 iHeaderWidth += (m_pixmapSizeGroups.width() + m_infoSizeGroups.width()); 578 574 /* Machine info width: */ 579 575 if (!m_machineItems.isEmpty()) 580 iHeaderWidth += (m achinePixmapSize.width() + m_infoSizeMachines.width());576 iHeaderWidth += (m_pixmapSizeMachines.width() + m_infoSizeMachines.width()); 581 577 /* Spacing + button width: */ 582 578 if (!isRoot()) 583 iHeaderWidth += (iMinorSpacing + enterButtonSize.width());579 iHeaderWidth += (iMinorSpacing + m_enterButtonSize.width()); 584 580 585 581 /* Search for maximum height: */ … … 587 583 /* Button height: */ 588 584 if (isRoot()) 589 heights << exitButtonSize.height();585 heights << m_exitButtonSize.height(); 590 586 else 591 heights << toggleButtonSize.height();587 heights << m_toggleButtonSize.height(); 592 588 heights /* Minimum name height: */ 593 589 << iMinimumNameHeight 594 590 /* Group info heights: */ 595 << groupPixmapSize.height() << m_infoSizeGroups.height()591 << m_pixmapSizeGroups.height() << m_infoSizeGroups.height() 596 592 /* Machine info heights: */ 597 << m achinePixmapSize.height() << m_infoSizeMachines.height();593 << m_pixmapSizeMachines.height() << m_infoSizeMachines.height(); 598 594 /* Button height: */ 599 595 if (!isRoot()) 600 heights << enterButtonSize.height();596 heights << m_enterButtonSize.height(); 601 597 int iHeaderHeight = 0; 602 598 foreach (int iHeight, heights) … … 952 948 int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 953 949 int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt(); 954 int iFullHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();950 int iFullHeaderHeight = m_headerSize.height(); 955 951 int iRootIndent = data(GroupItemData_RootIndent).toInt(); 956 952 int iPreviousVerticalIndent = 0; … … 978 974 { 979 975 /* Prepare variables: */ 980 int iExitButtonHeight = data(GroupItemData_ExitButtonSize).toSize().height();976 int iExitButtonHeight = m_exitButtonSize.height(); 981 977 /* Layout exit-button: */ 982 978 int iExitButtonX = iHorizontalMargin + iRootIndent; … … 995 991 else 996 992 { 997 /* Prepare variables: */998 QSize toggleButtonSize = data(GroupItemData_ToggleButtonSize).toSize();999 1000 993 /* Hide unnecessary button: */ 1001 994 if (m_pExitButton) … … 1006 999 { 1007 1000 /* Prepare variables: */ 1008 int iToggleButtonHeight = toggleButtonSize.height();1001 int iToggleButtonHeight = m_toggleButtonSize.height(); 1009 1002 /* Layout toggle-button: */ 1010 1003 int iToggleButtonX = iHorizontalMargin; … … 1021 1014 /* Prepare variables: */ 1022 1015 int iFullWidth = geometry().width(); 1023 QSizeF enterButtonSize = data(GroupItemData_EnterButtonSize).toSize(); 1024 int iEnterButtonWidth = enterButtonSize.width(); 1025 int iEnterButtonHeight = enterButtonSize.height(); 1016 int iEnterButtonWidth = m_enterButtonSize.width(); 1017 int iEnterButtonHeight = m_enterButtonSize.height(); 1026 1018 /* Layout enter-button: */ 1027 1019 int iEnterButtonX = iFullWidth - iHorizontalMargin - iEnterButtonWidth; … … 1036 1028 /* Prepare variables: */ 1037 1029 int iMajorSpacing = data(GroupItemData_MajorSpacing).toInt(); 1038 int iToggleButtonWidth = toggleButtonSize.width();1030 int iToggleButtonWidth = m_toggleButtonSize.width(); 1039 1031 /* Layout name-editor: */ 1040 1032 int iNameEditorX = iHorizontalMargin + iToggleButtonWidth + iMajorSpacing; … … 1089 1081 int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt(); 1090 1082 int iRootIndent = data(GroupItemData_RootIndent).toInt(); 1091 int iFullHeaderWidth = data(GroupItemData_FullHeaderSize).toSize().width();1083 int iFullHeaderWidth = m_headerSize.width(); 1092 1084 1093 1085 /* Calculating proposed width: */ … … 1121 1113 int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt(); 1122 1114 int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt(); 1123 int iFullHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();1115 int iFullHeaderHeight = m_headerSize.height(); 1124 1116 1125 1117 /* Calculating proposed height: */ … … 1395 1387 QPoint pos = pEvent->pos().toPoint(); 1396 1388 int iMargin = data(GroupItemData_VerticalMargin).toInt(); 1397 int iHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();1389 int iHeaderHeight = m_headerSize.height(); 1398 1390 int iFullHeaderHeight = 2 * iMargin + iHeaderHeight; 1399 1391 /* Skip if hovered part out of the header: */ … … 1459 1451 int iMargin = data(GroupItemData_VerticalMargin).toInt(); 1460 1452 int iRootIndent = data(GroupItemData_RootIndent).toInt(); 1461 int iHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();1453 int iHeaderHeight = m_headerSize.height(); 1462 1454 int iFullHeaderHeight = 2 * iMargin + iHeaderHeight; 1463 1455 QRect backgroundRect = QRect(0, 0, rect.width(), iFullHeaderHeight); … … 1490 1482 /* Prepare variables: */ 1491 1483 int iMargin = data(GroupItemData_VerticalMargin).toInt(); 1492 int iHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();1484 int iHeaderHeight = m_headerSize.height(); 1493 1485 int iFullHeaderHeight = 2 * iMargin + iHeaderHeight; 1494 1486 int iFullHeight = rect.height(); … … 1568 1560 int iMajorSpacing = data(GroupItemData_MajorSpacing).toInt(); 1569 1561 int iRootIndent = data(GroupItemData_RootIndent).toInt(); 1570 QSize toggleButtonSize = data(GroupItemData_ToggleButtonSize).toSize(); 1571 QSize exitButtonSize = data(GroupItemData_ExitButtonSize).toSize(); 1572 int iFullHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height(); 1562 int iFullHeaderHeight = m_headerSize.height(); 1573 1563 1574 1564 /* Update palette: */ … … 1590 1580 int iNameX = iHorizontalMargin; 1591 1581 if (isRoot()) 1592 iNameX += iRootIndent + exitButtonSize.width();1582 iNameX += iRootIndent + m_exitButtonSize.width(); 1593 1583 else 1594 iNameX += toggleButtonSize.width();1584 iNameX += m_toggleButtonSize.width(); 1595 1585 iNameX += iMajorSpacing; 1596 1586 int iNameY = m_visibleNameSize.height() == iFullHeaderHeight ? iVerticalMargin : … … 1616 1606 /* Prepare variables: */ 1617 1607 int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt(); 1618 int iEnterButtonWidth = data(GroupItemData_EnterButtonSize).toSize().width(); 1619 QSize groupPixmapSize = data(GroupItemData_GroupPixmapSize).toSize(); 1620 QSize machinePixmapSize = data(GroupItemData_MachinePixmapSize).toSize(); 1608 int iEnterButtonWidth = m_enterButtonSize.width(); 1621 1609 1622 1610 /* Indent: */ … … 1643 1631 m_strInfoMachines); 1644 1632 1645 iHorizontalIndent -= m achinePixmapSize.width();1633 iHorizontalIndent -= m_pixmapSizeMachines.width(); 1646 1634 int iMachinePixmapX = iHorizontalIndent; 1647 int iMachinePixmapY = m achinePixmapSize.height() == iFullHeaderHeight ?1648 iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m achinePixmapSize.height()) / 2;1635 int iMachinePixmapY = m_pixmapSizeMachines.height() == iFullHeaderHeight ? 1636 iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m_pixmapSizeMachines.height()) / 2; 1649 1637 paintPixmap(/* Painter: */ 1650 1638 pPainter, 1651 1639 /* Rectangle to paint in: */ 1652 QRect(QPoint(iMachinePixmapX, iMachinePixmapY), m achinePixmapSize),1640 QRect(QPoint(iMachinePixmapX, iMachinePixmapY), m_pixmapSizeMachines), 1653 1641 /* Pixmap to paint: */ 1654 1642 m_machinesPixmap); … … 1673 1661 m_strInfoGroups); 1674 1662 1675 iHorizontalIndent -= groupPixmapSize.width();1663 iHorizontalIndent -= m_pixmapSizeGroups.width(); 1676 1664 int iGroupPixmapX = iHorizontalIndent; 1677 int iGroupPixmapY = groupPixmapSize.height() == iFullHeaderHeight ?1678 iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - groupPixmapSize.height()) / 2;1665 int iGroupPixmapY = m_pixmapSizeGroups.height() == iFullHeaderHeight ? 1666 iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m_pixmapSizeGroups.height()) / 2; 1679 1667 paintPixmap(/* Painter: */ 1680 1668 pPainter, 1681 1669 /* Rectangle to paint in: */ 1682 QRect(QPoint(iGroupPixmapX, iGroupPixmapY), groupPixmapSize),1670 QRect(QPoint(iGroupPixmapX, iGroupPixmapY), m_pixmapSizeGroups), 1683 1671 /* Pixmap to paint: */ 1684 1672 m_groupsPixmap); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h
r43846 r43847 109 109 GroupItemData_MinorSpacing, 110 110 GroupItemData_RootIndent, 111 /* Sizes: */112 GroupItemData_ToggleButtonSize,113 GroupItemData_EnterButtonSize,114 GroupItemData_ExitButtonSize,115 GroupItemData_GroupPixmapSize,116 GroupItemData_MachinePixmapSize,117 GroupItemData_FullHeaderSize118 111 }; 119 112 … … 209 202 QSize m_infoSizeGroups; 210 203 QSize m_infoSizeMachines; 204 QSize m_pixmapSizeGroups; 205 QSize m_pixmapSizeMachines; 211 206 QSize m_headerSize; 207 QSize m_toggleButtonSize; 208 QSize m_enterButtonSize; 209 QSize m_exitButtonSize; 212 210 QFont m_nameFont; 213 211 QFont m_infoFont;
Note:
See TracChangeset
for help on using the changeset viewer.