Changeset 55187 in vbox for trunk/src/VBox
- Timestamp:
- Apr 10, 2015 3:52:50 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99493
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r55170 r55187 94 94 template<> bool canConvert<MouseCapturePolicy>(); 95 95 template<> bool canConvert<GuruMeditationHandlerType>(); 96 template<> bool canConvert<ScalingOptimizationType>(); 96 97 template<> bool canConvert<HiDPIOptimizationType>(); 97 98 #ifndef Q_WS_MAC … … 178 179 template<> QString toInternalString(const GuruMeditationHandlerType &guruMeditationHandlerType); 179 180 template<> GuruMeditationHandlerType fromInternalString<GuruMeditationHandlerType>(const QString &strGuruMeditationHandlerType); 181 template<> QString toInternalString(const ScalingOptimizationType &optimizationType); 182 template<> ScalingOptimizationType fromInternalString<ScalingOptimizationType>(const QString &strOptimizationType); 180 183 template<> QString toInternalString(const HiDPIOptimizationType &optimizationType); 181 184 template<> HiDPIOptimizationType fromInternalString<HiDPIOptimizationType>(const QString &strOptimizationType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r55170 r55187 62 62 template<> bool canConvert<MouseCapturePolicy>() { return true; } 63 63 template<> bool canConvert<GuruMeditationHandlerType>() { return true; } 64 template<> bool canConvert<ScalingOptimizationType>() { return true; } 64 65 template<> bool canConvert<HiDPIOptimizationType>() { return true; } 65 66 #ifndef Q_WS_MAC … … 1411 1412 } 1412 1413 1414 /* QString <= ScalingOptimizationType: */ 1415 template<> QString toInternalString(const ScalingOptimizationType &optimizationType) 1416 { 1417 QString strResult; 1418 switch (optimizationType) 1419 { 1420 case ScalingOptimizationType_None: strResult = "None"; break; 1421 case ScalingOptimizationType_Performance: strResult = "Performance"; break; 1422 default: 1423 { 1424 AssertMsgFailed(("No text for type=%d", optimizationType)); 1425 break; 1426 } 1427 } 1428 return strResult; 1429 } 1430 1431 /* ScalingOptimizationType <= QString: */ 1432 template<> ScalingOptimizationType fromInternalString<ScalingOptimizationType>(const QString &strOptimizationType) 1433 { 1434 /* Here we have some fancy stuff allowing us 1435 * to search through the keys using 'case-insensitive' rule: */ 1436 QStringList keys; QList<ScalingOptimizationType> values; 1437 keys << "None"; values << ScalingOptimizationType_None; 1438 keys << "Performance"; values << ScalingOptimizationType_Performance; 1439 /* 'None' type for empty/unknown words: */ 1440 if (!keys.contains(strOptimizationType, Qt::CaseInsensitive)) 1441 return ScalingOptimizationType_None; 1442 /* Corresponding type for known words: */ 1443 return values.at(keys.indexOf(QRegExp(strOptimizationType, Qt::CaseInsensitive))); 1444 } 1445 1413 1446 /* QString <= HiDPIOptimizationType: */ 1414 1447 template<> QString toInternalString(const HiDPIOptimizationType &optimizationType) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r55170 r55187 143 143 const char* UIExtraDataDefs::GUI_HidLedsSync = "GUI/HidLedsSync"; 144 144 const char* UIExtraDataDefs::GUI_ScaleFactor = "GUI/ScaleFactor"; 145 const char* UIExtraDataDefs::GUI_Scaling_Optimization = "GUI/Scaling/Optimization"; 145 146 146 147 /* Virtual Machine: Information dialog: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r55170 r55187 247 247 /** Holds the scale-factor. */ 248 248 extern const char* GUI_ScaleFactor; 249 /** Holds the scaling optimization type. */ 250 extern const char* GUI_Scaling_Optimization; 249 251 /** @} */ 250 252 … … 622 624 }; 623 625 626 /** Runtime UI: Scaling optimization types. */ 627 enum ScalingOptimizationType 628 { 629 ScalingOptimizationType_None, 630 ScalingOptimizationType_Performance 631 }; 632 624 633 /** Runtime UI: HiDPI optimization types. */ 625 634 enum HiDPIOptimizationType -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r55170 r55187 1796 1796 << GUI_GuruMeditationHandler 1797 1797 << GUI_HidLedsSync 1798 << GUI_ScaleFactor 1798 << GUI_ScaleFactor << GUI_Scaling_Optimization 1799 1799 << GUI_InformationWindowGeometry 1800 1800 << GUI_DefaultCloseAction << GUI_RestrictedCloseActions … … 3390 3390 /* Set corresponding extra-data value: */ 3391 3391 setExtraDataString(GUI_ScaleFactor, QString::number(dScaleFactor), strID); 3392 } 3393 3394 ScalingOptimizationType UIExtraDataManager::scalingOptimizationType(const QString &strID) 3395 { 3396 return gpConverter->fromInternalString<ScalingOptimizationType>(extraDataString(GUI_Scaling_Optimization, strID)); 3392 3397 } 3393 3398 … … 3692 3697 else if (strKey == GUI_ScaleFactor) 3693 3698 emit sigScaleFactorChange(strMachineID); 3699 /* Scaling optimization type change: */ 3700 else if (strKey == GUI_Scaling_Optimization) 3701 emit sigScalingOptimizationTypeChange(strMachineID); 3702 /* Unscaled HiDPI Output mode change: */ 3694 3703 else if (strKey == GUI_HiDPI_UnscaledOutput) 3695 3704 emit sigUnscaledHiDPIOutputModeChange(strMachineID); -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r55170 r55187 78 78 /** Notifies about the scale-factor change. */ 79 79 void sigScaleFactorChange(const QString &strMachineID); 80 81 /** Notifies about the scaling optimization type change. */ 82 void sigScalingOptimizationTypeChange(const QString &strMachineID); 80 83 81 84 /** Notifies about unscaled HiDPI output mode change. */ … … 475 478 /** Defines the @a dScaleFactor. */ 476 479 void setScaleFactor(double dScaleFactor, const QString &strID); 480 481 /** Returns the scaling optimization type. */ 482 ScalingOptimizationType scalingOptimizationType(const QString &strID); 477 483 /** @} */ 478 484 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r55139 r55187 159 159 void setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput) { m_fUseUnscaledHiDPIOutput = fUseUnscaledHiDPIOutput; } 160 160 161 /** Return HiDPI frame-buffer optimization type. */ 161 /** Returns frame-buffer scaling optimization type. */ 162 ScalingOptimizationType scalingOptimizationType() const { return m_enmScalingOptimizationType; } 163 /** Defines frame-buffer scaling optimization type: */ 164 void setScalingOptimizationType(ScalingOptimizationType type) { m_enmScalingOptimizationType = type; } 165 166 /** Returns HiDPI frame-buffer optimization type. */ 162 167 HiDPIOptimizationType hiDPIOptimizationType() const { return m_hiDPIOptimizationType; } 163 /** Define HiDPI frame-buffer optimization type: */164 void setHiDPIOptimizationType(HiDPIOptimizationType optimizationType) { m_hiDPIOptimizationType = optimizationType; }168 /** Defines HiDPI frame-buffer optimization type: */ 169 void setHiDPIOptimizationType(HiDPIOptimizationType type) { m_hiDPIOptimizationType = type; } 165 170 166 171 DECLARE_NOT_AGGREGATABLE(UIFrameBufferPrivate) … … 285 290 void paintSeamless(QPaintEvent *pEvent); 286 291 292 /** Returns the transformation mode corresponding to the passed ScalingOptimizationType. */ 293 static Qt::TransformationMode transformationMode(ScalingOptimizationType type); 294 287 295 /** Erases corresponding @a rect with @a painter. */ 288 296 static void eraseImageRect(QPainter &painter, const QRect &rect, … … 293 301 static void drawImageRect(QPainter &painter, const QImage &image, const QRect &rect, 294 302 int iContentsShiftX, int iContentsShiftY, 303 ScalingOptimizationType enmScalingOptimizationType, 295 304 bool fUseUnscaledHiDPIOutput, 296 305 HiDPIOptimizationType hiDPIOptimizationType, … … 342 351 /** Holds the scale-factor used by the scaled-size. */ 343 352 double m_dScaleFactor; 353 /** Holds the scaling optimization type used by the scaling mechanism. */ 354 ScalingOptimizationType m_enmScalingOptimizationType; 344 355 /** Holds the coordinate-system for the scale-factor above. */ 345 356 QTransform m_transform; … … 524 535 , m_fAutoEnabled(false) 525 536 , m_dScaleFactor(1.0) 537 , m_enmScalingOptimizationType(ScalingOptimizationType_None) 526 538 , m_dBackingScaleFactor(1.0) 527 539 , m_fUseUnscaledHiDPIOutput(false) … … 1328 1340 scaledImage = m_image.copy(); 1329 1341 /* And scaling the image to predefined scaled-factor: */ 1330 scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, Qt::FastTransformation); 1342 scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, 1343 transformationMode(scalingOptimizationType())); 1331 1344 } 1332 1345 /* Finally we are choosing image to paint from: */ … … 1354 1367 drawImageRect(painter, sourceImage, paintRect, 1355 1368 m_pMachineView->contentsX(), m_pMachineView->contentsY(), 1356 useUnscaledHiDPIOutput(), hiDPIOptimizationType(), backingScaleFactor()); 1369 scalingOptimizationType(), useUnscaledHiDPIOutput(), 1370 hiDPIOptimizationType(), backingScaleFactor()); 1357 1371 } 1358 1372 … … 1368 1382 scaledImage = m_image.copy(); 1369 1383 /* And scaling the image to predefined scaled-factor: */ 1370 scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, Qt::FastTransformation); 1384 scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, 1385 transformationMode(scalingOptimizationType())); 1371 1386 } 1372 1387 /* Finally we are choosing image to paint from: */ … … 1420 1435 drawImageRect(painter, sourceImage, paintRect, 1421 1436 m_pMachineView->contentsX(), m_pMachineView->contentsY(), 1422 useUnscaledHiDPIOutput(), hiDPIOptimizationType(), backingScaleFactor()); 1437 scalingOptimizationType(), useUnscaledHiDPIOutput(), 1438 hiDPIOptimizationType(), backingScaleFactor()); 1439 } 1440 1441 /* static */ 1442 Qt::TransformationMode UIFrameBufferPrivate::transformationMode(ScalingOptimizationType type) 1443 { 1444 switch (type) 1445 { 1446 case ScalingOptimizationType_Performance: return Qt::FastTransformation; 1447 default: break; 1448 } 1449 return Qt::SmoothTransformation; 1423 1450 } 1424 1451 … … 1472 1499 void UIFrameBufferPrivate::drawImageRect(QPainter &painter, const QImage &image, const QRect &rect, 1473 1500 int iContentsShiftX, int iContentsShiftY, 1501 ScalingOptimizationType enmScalingOptimizationType, 1474 1502 bool fUseUnscaledHiDPIOutput, 1475 1503 HiDPIOptimizationType hiDPIOptimizationType, … … 1501 1529 /* Fast scale sub-pixmap (2nd copy involved): */ 1502 1530 subPixmap = subPixmap.scaled(subPixmap.size() * dBackingScaleFactor, 1503 Qt::IgnoreAspectRatio, Qt::FastTransformation);1531 Qt::IgnoreAspectRatio, transformationMode(enmScalingOptimizationType)); 1504 1532 } 1505 1533 … … 1671 1699 } 1672 1700 1701 ScalingOptimizationType UIFrameBuffer::scalingOptimizationType() const 1702 { 1703 return m_pFrameBuffer->scalingOptimizationType(); 1704 } 1705 1706 void UIFrameBuffer::setScalingOptimizationType(ScalingOptimizationType type) 1707 { 1708 m_pFrameBuffer->setScalingOptimizationType(type); 1709 } 1710 1673 1711 HiDPIOptimizationType UIFrameBuffer::hiDPIOptimizationType() const 1674 1712 { … … 1676 1714 } 1677 1715 1678 void UIFrameBuffer::setHiDPIOptimizationType(HiDPIOptimizationType optimizationType)1679 { 1680 m_pFrameBuffer->setHiDPIOptimizationType( optimizationType);1716 void UIFrameBuffer::setHiDPIOptimizationType(HiDPIOptimizationType type) 1717 { 1718 m_pFrameBuffer->setHiDPIOptimizationType(type); 1681 1719 } 1682 1720 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r54590 r55187 115 115 void setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput); 116 116 117 /** Return HiDPI frame-buffer optimization type. */ 117 /** Returns the frame-buffer scaling optimization type. */ 118 ScalingOptimizationType scalingOptimizationType() const; 119 /** Defines the frame-buffer scaling optimization type. */ 120 void setScalingOptimizationType(ScalingOptimizationType type); 121 122 /** Returns HiDPI frame-buffer optimization type. */ 118 123 HiDPIOptimizationType hiDPIOptimizationType() const; 119 /** Define HiDPI frame-buffer optimization type: */120 void setHiDPIOptimizationType(HiDPIOptimizationType optimizationType);124 /** Defines HiDPI frame-buffer optimization type: */ 125 void setHiDPIOptimizationType(HiDPIOptimizationType type); 121 126 122 127 /** Handles frame-buffer notify-change-event. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r54865 r55187 402 402 } 403 403 404 void UIMachineView::sltHandleScalingOptimizationChange(const QString &strMachineID) 405 { 406 /* Skip unrelated machine IDs: */ 407 if (strMachineID != vboxGlobal().managedVMUuid()) 408 return; 409 410 /* Take the scale-factor into account: */ 411 frameBuffer()->setScalingOptimizationType(gEDataManager->scalingOptimizationType(vboxGlobal().managedVMUuid())); 412 413 /* Update viewport: */ 414 viewport()->update(); 415 } 416 404 417 void UIMachineView::sltHandleUnscaledHiDPIOutputModeChange(const QString &strMachineID) 405 418 { … … 675 688 connect(gEDataManager, SIGNAL(sigScaleFactorChange(const QString&)), 676 689 this, SLOT(sltHandleScaleFactorChange(const QString&))); 690 /* Scaling-optimization change: */ 691 connect(gEDataManager, SIGNAL(sigScalingOptimizationTypeChange(const QString&)), 692 this, SLOT(sltHandleScalingOptimizationChange(const QString&))); 677 693 /* Unscaled HiDPI output mode change: */ 678 694 connect(gEDataManager, SIGNAL(sigUnscaledHiDPIOutputModeChange(const QString&)), -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r54590 r55187 122 122 /** Handles the scale-factor change. */ 123 123 void sltHandleScaleFactorChange(const QString &strMachineID); 124 125 /** Handles the scaling-optimization change. */ 126 void sltHandleScalingOptimizationChange(const QString &strMachineID); 124 127 125 128 /** Handles the unscaled HiDPI output mode change. */
Note:
See TracChangeset
for help on using the changeset viewer.