Changeset 70870 in vbox
- Timestamp:
- Feb 5, 2018 3:51:16 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120696
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r69500 r70870 100 100 template<> bool canConvert<GuruMeditationHandlerType>(); 101 101 template<> bool canConvert<ScalingOptimizationType>(); 102 #ifdef VBOX_WS_MAC 102 103 template<> bool canConvert<HiDPIOptimizationType>(); 104 #endif 103 105 #ifndef VBOX_WS_MAC 104 106 template<> bool canConvert<MiniToolbarAlignment>(); 105 #endif /* !VBOX_WS_MAC */107 #endif 106 108 template<> bool canConvert<InformationElementType>(); 107 109 template<> bool canConvert<MaxGuestResolutionPolicy>(); … … 197 199 template<> QString toInternalString(const ScalingOptimizationType &optimizationType); 198 200 template<> ScalingOptimizationType fromInternalString<ScalingOptimizationType>(const QString &strOptimizationType); 201 #ifdef VBOX_WS_MAC 199 202 template<> QString toInternalString(const HiDPIOptimizationType &optimizationType); 200 203 template<> HiDPIOptimizationType fromInternalString<HiDPIOptimizationType>(const QString &strOptimizationType); 204 #endif 201 205 #ifndef VBOX_WS_MAC 202 206 template<> QString toInternalString(const MiniToolbarAlignment &miniToolbarAlignment); 203 207 template<> MiniToolbarAlignment fromInternalString<MiniToolbarAlignment>(const QString &strMiniToolbarAlignment); 204 #endif /* !VBOX_WS_MAC */208 #endif 205 209 template<> QString toString(const InformationElementType &informationElementType); 206 210 template<> InformationElementType fromString<InformationElementType>(const QString &strInformationElementType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r70185 r70870 68 68 template<> bool canConvert<GuruMeditationHandlerType>() { return true; } 69 69 template<> bool canConvert<ScalingOptimizationType>() { return true; } 70 #ifdef VBOX_WS_MAC 70 71 template<> bool canConvert<HiDPIOptimizationType>() { return true; } 72 #endif 71 73 #ifndef VBOX_WS_MAC 72 74 template<> bool canConvert<MiniToolbarAlignment>() { return true; } 73 #endif /* !VBOX_WS_MAC */75 #endif 74 76 template<> bool canConvert<InformationElementType>() { return true; } 75 77 template<> bool canConvert<MaxGuestResolutionPolicy>() { return true; } … … 1649 1651 } 1650 1652 1653 #ifdef VBOX_WS_MAC 1651 1654 /* QString <= HiDPIOptimizationType: */ 1652 1655 template<> QString toInternalString(const HiDPIOptimizationType &optimizationType) … … 1680 1683 return values.at(keys.indexOf(QRegExp(strOptimizationType, Qt::CaseInsensitive))); 1681 1684 } 1685 #endif /* VBOX_WS_MAC */ 1682 1686 1683 1687 #ifndef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r70113 r70870 156 156 #endif /* VBOX_WITH_VIDEOHWACCEL */ 157 157 const char* UIExtraDataDefs::GUI_HiDPI_UnscaledOutput = "GUI/HiDPI/UnscaledOutput"; 158 #ifdef VBOX_WS_MAC 158 159 const char* UIExtraDataDefs::GUI_HiDPI_Optimization = "GUI/HiDPI/Optimization"; 160 #endif 159 161 #ifndef VBOX_WS_MAC 160 162 const char* UIExtraDataDefs::GUI_ShowMiniToolBar = "GUI/ShowMiniToolBar"; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r70185 r70870 280 280 /** Holds whether Runtime UI should use unscaled HiDPI output. */ 281 281 extern const char* GUI_HiDPI_UnscaledOutput; 282 #ifdef VBOX_WS_MAC 282 283 /** Holds Runtime UI HiDPI optimization type. */ 283 284 extern const char* GUI_HiDPI_Optimization; 285 #endif 284 286 #ifndef VBOX_WS_MAC 285 287 /** Holds whether mini-toolbar is enabled for full and seamless screens. */ … … 755 757 }; 756 758 759 #ifdef VBOX_WS_MAC 757 760 /** Runtime UI: HiDPI optimization types. */ 758 761 enum HiDPIOptimizationType … … 761 764 HiDPIOptimizationType_Performance 762 765 }; 766 #endif /* VBOX_WS_MAC */ 763 767 764 768 #ifndef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r70856 r70870 1997 1997 #endif /* VBOX_WITH_VIDEOHWACCEL */ 1998 1998 << GUI_HiDPI_UnscaledOutput 1999 #ifdef VBOX_WS_MAC 1999 2000 << GUI_HiDPI_Optimization 2001 #endif 2000 2002 #ifndef VBOX_WS_MAC 2001 2003 << GUI_ShowMiniToolBar << GUI_MiniToolBarAutoHide << GUI_MiniToolBarAlignment … … 3744 3746 } 3745 3747 3748 #ifdef VBOX_WS_MAC 3746 3749 HiDPIOptimizationType UIExtraDataManager::hiDPIOptimizationType(const QString &strID) 3747 3750 { 3748 3751 return gpConverter->fromInternalString<HiDPIOptimizationType>(extraDataString(GUI_HiDPI_Optimization, strID)); 3749 3752 } 3753 #endif /* VBOX_WS_MAC */ 3750 3754 3751 3755 #ifndef VBOX_WS_MAC … … 4415 4419 else if (strKey == GUI_Scaling_Optimization) 4416 4420 emit sigScalingOptimizationTypeChange(strMachineID); 4421 #ifdef VBOX_WS_MAC 4417 4422 /* HiDPI optimization type change: */ 4418 4423 else if (strKey == GUI_HiDPI_Optimization) 4419 4424 emit sigHiDPIOptimizationTypeChange(strMachineID); 4425 #endif 4420 4426 /* Unscaled HiDPI Output mode change: */ 4421 4427 else if (strKey == GUI_HiDPI_UnscaledOutput) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r70113 r70870 85 85 void sigScalingOptimizationTypeChange(const QString &strMachineID); 86 86 87 #ifdef VBOX_WS_MAC 87 88 /** Notifies about the HiDPI optimization type change. */ 88 89 void sigHiDPIOptimizationTypeChange(const QString &strMachineID); 90 #endif 89 91 90 92 /** Notifies about unscaled HiDPI output mode change. */ … … 533 535 void setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput, const QString &strID); 534 536 537 #ifdef VBOX_WS_MAC 535 538 /** Returns Runtime UI HiDPI optimization type. */ 536 539 HiDPIOptimizationType hiDPIOptimizationType(const QString &strID); 540 #endif 537 541 538 542 #ifndef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r69957 r70870 168 168 void setScalingOptimizationType(ScalingOptimizationType type) { m_enmScalingOptimizationType = type; } 169 169 170 #ifdef VBOX_WS_MAC 170 171 /** Returns HiDPI frame-buffer optimization type. */ 171 172 HiDPIOptimizationType hiDPIOptimizationType() const { return m_hiDPIOptimizationType; } 172 173 /** Defines HiDPI frame-buffer optimization type: */ 173 174 void setHiDPIOptimizationType(HiDPIOptimizationType type) { m_hiDPIOptimizationType = type; } 175 #endif 174 176 175 177 DECLARE_NOT_AGGREGATABLE(UIFrameBufferPrivate) … … 300 302 static void eraseImageRect(QPainter &painter, const QRect &rect, 301 303 bool fUseUnscaledHiDPIOutput, 304 #ifdef VBOX_WS_MAC 302 305 HiDPIOptimizationType hiDPIOptimizationType, 306 #endif 303 307 double dDevicePixelRatio); 304 308 /** Draws corresponding @a rect of passed @a image with @a painter. */ … … 306 310 int iContentsShiftX, int iContentsShiftY, 307 311 bool fUseUnscaledHiDPIOutput, 312 #ifdef VBOX_WS_MAC 308 313 HiDPIOptimizationType hiDPIOptimizationType, 314 #endif 309 315 double dDevicePixelRatio); 310 316 … … 386 392 /** Holds whether frame-buffer should use unscaled HiDPI output. */ 387 393 bool m_fUseUnscaledHiDPIOutput; 394 #ifdef VBOX_WS_MAC 388 395 /** Holds HiDPI frame-buffer optimization type. */ 389 396 HiDPIOptimizationType m_hiDPIOptimizationType; 397 #endif 390 398 /** @} */ 391 399 … … 538 546 , m_dDevicePixelRatio(1.0) 539 547 , m_fUseUnscaledHiDPIOutput(false) 548 #ifdef VBOX_WS_MAC 540 549 , m_hiDPIOptimizationType(HiDPIOptimizationType_None) 550 #endif 541 551 { 542 552 /* Update coordinate-system: */ … … 1399 1409 drawImageRect(painter, sourceImage, paintRect, 1400 1410 m_pMachineView->contentsX(), m_pMachineView->contentsY(), 1401 useUnscaledHiDPIOutput(), hiDPIOptimizationType(), devicePixelRatio()); 1411 useUnscaledHiDPIOutput(), 1412 #ifdef VBOX_WS_MAC 1413 hiDPIOptimizationType(), 1414 #endif 1415 devicePixelRatio()); 1402 1416 } 1403 1417 … … 1458 1472 /* Erase rectangle: */ 1459 1473 eraseImageRect(painter, paintRect, 1460 useUnscaledHiDPIOutput(), hiDPIOptimizationType(), devicePixelRatio()); 1474 useUnscaledHiDPIOutput(), 1475 #ifdef VBOX_WS_MAC 1476 hiDPIOptimizationType(), 1477 #endif 1478 devicePixelRatio()); 1461 1479 1462 1480 /* Apply painter clipping for painting: */ … … 1483 1501 drawImageRect(painter, sourceImage, paintRect, 1484 1502 m_pMachineView->contentsX(), m_pMachineView->contentsY(), 1485 useUnscaledHiDPIOutput(), hiDPIOptimizationType(), devicePixelRatio()); 1503 useUnscaledHiDPIOutput(), 1504 #ifdef VBOX_WS_MAC 1505 hiDPIOptimizationType(), 1506 #endif 1507 devicePixelRatio()); 1486 1508 } 1487 1509 … … 1502 1524 void UIFrameBufferPrivate::eraseImageRect(QPainter &painter, const QRect &rect, 1503 1525 bool fUseUnscaledHiDPIOutput, 1526 #ifdef VBOX_WS_MAC 1504 1527 HiDPIOptimizationType hiDPIOptimizationType, 1528 #endif 1505 1529 double dDevicePixelRatio) 1506 1530 { … … 1508 1532 QPixmap subPixmap = QPixmap(rect.width(), rect.height()); 1509 1533 1534 #ifdef VBOX_WS_MAC 1510 1535 /* If HiDPI 'device-pixel-ratio' defined: */ 1511 1536 if (dDevicePixelRatio > 1.0) 1512 1537 { 1513 /* Should we 1514 * perform logical HiDPI scaling and optimize it for performance? */ 1538 /* Should we perform logical HiDPI scaling and optimize it for performance? */ 1515 1539 if (!fUseUnscaledHiDPIOutput && hiDPIOptimizationType == HiDPIOptimizationType_Performance) 1516 1540 { … … 1520 1544 } 1521 1545 1522 /* Should we 1523 * not perform logical HiDPI scaling or 1524 * perform logical HiDPI scaling and optimize it for performance? */ 1546 /* Should we not perform logical HiDPI scaling or perform logical HiDPI scaling and optimize it for performance? */ 1525 1547 if (fUseUnscaledHiDPIOutput || hiDPIOptimizationType == HiDPIOptimizationType_Performance) 1526 1548 { … … 1529 1551 } 1530 1552 } 1553 #else /* !VBOX_WS_MAC */ 1554 /* If HiDPI 'device-pixel-ratio' defined: */ 1555 if (dDevicePixelRatio > 1.0) 1556 { 1557 /* In auto-scale mode: */ 1558 if (!fUseUnscaledHiDPIOutput) 1559 { 1560 /* Adjust sub-pixmap: */ 1561 subPixmap = QPixmap((int)(rect.width() * dDevicePixelRatio), 1562 (int)(rect.height() * dDevicePixelRatio)); 1563 } 1564 1565 /* Mark sub-pixmap HiDPI: */ 1566 subPixmap.setDevicePixelRatio(dDevicePixelRatio); 1567 } 1568 #endif /* !VBOX_WS_MAC */ 1531 1569 1532 1570 /* Which point we should draw corresponding sub-pixmap? */ … … 1545 1583 int iContentsShiftX, int iContentsShiftY, 1546 1584 bool fUseUnscaledHiDPIOutput, 1585 #ifdef VBOX_WS_MAC 1547 1586 HiDPIOptimizationType hiDPIOptimizationType, 1587 #endif 1548 1588 double dDevicePixelRatio) 1549 1589 { … … 1564 1604 QPixmap subPixmap = QPixmap::fromImage(subImage); 1565 1605 1606 #ifdef VBOX_WS_MAC 1566 1607 /* If HiDPI 'device-pixel-ratio' defined: */ 1567 1608 if (dDevicePixelRatio > 1.0) 1568 1609 { 1569 /* Should we 1570 * perform logical HiDPI scaling and optimize it for performance? */ 1610 /* Should we perform logical HiDPI scaling and optimize it for performance? */ 1571 1611 if (!fUseUnscaledHiDPIOutput && hiDPIOptimizationType == HiDPIOptimizationType_Performance) 1572 1612 { … … 1576 1616 } 1577 1617 1578 /* Should we 1579 * not perform logical HiDPI scaling or 1580 * perform logical HiDPI scaling and optimize it for performance? */ 1618 /* Should we not perform logical HiDPI scaling or perform logical HiDPI scaling and optimize it for performance? */ 1581 1619 if (fUseUnscaledHiDPIOutput || hiDPIOptimizationType == HiDPIOptimizationType_Performance) 1582 1620 { … … 1585 1623 } 1586 1624 } 1625 #else /* !VBOX_WS_MAC */ 1626 /* If HiDPI 'device-pixel-ratio' defined: */ 1627 if (dDevicePixelRatio > 1.0) 1628 { 1629 /* In auto-scale mode: */ 1630 if (!fUseUnscaledHiDPIOutput) 1631 { 1632 /* Fast scale sub-pixmap (2nd copy involved): */ 1633 subPixmap = subPixmap.scaled(subPixmap.size() * dDevicePixelRatio, 1634 Qt::IgnoreAspectRatio, Qt::FastTransformation); 1635 } 1636 1637 /* Mark sub-pixmap HiDPI: */ 1638 subPixmap.setDevicePixelRatio(dDevicePixelRatio); 1639 } 1640 #endif /* !VBOX_WS_MAC */ 1587 1641 1588 1642 /* Which point we should draw corresponding sub-pixmap? */ … … 1749 1803 } 1750 1804 1805 #ifdef VBOX_WS_MAC 1751 1806 HiDPIOptimizationType UIFrameBuffer::hiDPIOptimizationType() const 1752 1807 { … … 1758 1813 m_pFrameBuffer->setHiDPIOptimizationType(type); 1759 1814 } 1815 #endif 1760 1816 1761 1817 void UIFrameBuffer::handleNotifyChange(int iWidth, int iHeight) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r69931 r70870 121 121 void setScalingOptimizationType(ScalingOptimizationType type); 122 122 123 #ifdef VBOX_WS_MAC 123 124 /** Returns HiDPI frame-buffer optimization type. */ 124 125 HiDPIOptimizationType hiDPIOptimizationType() const; 125 126 /** Defines HiDPI frame-buffer optimization type: */ 126 127 void setHiDPIOptimizationType(HiDPIOptimizationType type); 128 #endif 127 129 128 130 /** Handles frame-buffer notify-change-event. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r70681 r70870 540 540 } 541 541 542 #ifdef VBOX_WS_MAC 542 543 void UIMachineView::sltHandleHiDPIOptimizationChange(const QString &strMachineID) 543 544 { … … 552 553 viewport()->update(); 553 554 } 555 #endif /* VBOX_WS_MAC */ 554 556 555 557 void UIMachineView::sltHandleUnscaledHiDPIOutputModeChange(const QString &strMachineID) … … 717 719 #endif /* !VBOX_WITH_VIDEOHWACCEL */ 718 720 721 #ifdef VBOX_WS_MAC 719 722 /* Take HiDPI optimization type into account: */ 720 723 m_pFrameBuffer->setHiDPIOptimizationType(gEDataManager->hiDPIOptimizationType(vboxGlobal().managedVMUuid())); 724 #endif 721 725 722 726 /* Take scaling optimization type into account: */ … … 846 850 connect(gEDataManager, SIGNAL(sigScalingOptimizationTypeChange(const QString&)), 847 851 this, SLOT(sltHandleScalingOptimizationChange(const QString&))); 852 #ifdef VBOX_WS_MAC 848 853 /* HiDPI-optimization change: */ 849 854 connect(gEDataManager, SIGNAL(sigHiDPIOptimizationTypeChange(const QString&)), 850 855 this, SLOT(sltHandleHiDPIOptimizationChange(const QString&))); 856 #endif 851 857 /* Unscaled HiDPI output mode change: */ 852 858 connect(gEDataManager, SIGNAL(sigUnscaledHiDPIOutputModeChange(const QString&)), -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r69957 r70870 132 132 void sltHandleScalingOptimizationChange(const QString &strMachineID); 133 133 134 #ifdef VBOX_WS_MAC 134 135 /** Handles the HiDPI-optimization change. */ 135 136 void sltHandleHiDPIOptimizationChange(const QString &strMachineID); 137 #endif 136 138 137 139 /** Handles the unscaled HiDPI output mode change. */
Note:
See TracChangeset
for help on using the changeset viewer.