Changeset 97311 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 26, 2022 4:55:35 PM (2 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r97307 r97311 267 267 268 268 const char *UIExtraDataDefs::GUI_MediumSelector_DialogGeometry = "GUI/MediumSelector/DialogGeometry"; 269 270 const int UIExtraDataDefs::iFontScaleMin = 50; 271 const int UIExtraDataDefs::iFontScaleMax = 150; 269 272 270 273 /* Obsolete keys: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r97307 r97311 489 489 SHARED_LIBRARY_STUFF extern QMultiMap<QString, QString> g_mapOfObsoleteKeys; 490 490 /** @} */ 491 492 /** @name Font scaling factor min-max. 493 * @{ */ 494 extern const int iFontScaleMin; 495 extern const int iFontScaleMax; 496 /** @} */ 491 497 } 492 498 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r97307 r97311 2612 2612 void UIExtraDataManager::setFontScaleFactor(int iFontScaleFactor) 2613 2613 { 2614 int iMax = 200; 2615 int iMin = 40; 2616 if (iFontScaleFactor < iMin || iFontScaleFactor > iMax) 2614 if (iFontScaleFactor < UIExtraDataDefs::iFontScaleMin || iFontScaleFactor > UIExtraDataDefs::iFontScaleMax) 2617 2615 return; 2618 2616 setExtraDataString(GUI_FontScaleFactor, QString::number(iFontScaleFactor)); … … 2624 2622 bool fConversion = false; 2625 2623 int iScaleFactor = strFontScaleFactor.toInt(&fConversion); 2626 int iMax = 200; 2627 int iMin = 40; 2628 if (!fConversion || iScaleFactor < iMin || iScaleFactor > iMax) 2624 if (!fConversion || iScaleFactor < UIExtraDataDefs::iFontScaleMin || iScaleFactor > UIExtraDataDefs::iFontScaleMax) 2629 2625 return 100; 2630 2626 return iScaleFactor; … … 4847 4843 emit sigDetailsOptionsChange(enmType); 4848 4844 } 4845 /* Font scaling factor has changed: */ 4846 else if (strKey == GUI_FontScaleFactor) 4847 emit sigFontScaleFactorChanged(fontScaleFactor()); 4849 4848 } 4850 4849 } -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r97307 r97311 121 121 void sigScalingOptimizationTypeChange(const QUuid &uMachineID); 122 122 123 /** Notifies about font scale factor. */ 124 void sigFontScaleFactorChanged(int iFontScaleFactor); 125 123 126 #ifdef VBOX_WS_MAC 124 127 /** Notifies about the HiDPI optimization type change. */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
r97307 r97311 63 63 #include "UIConverter.h" 64 64 #include "UIDesktopWidgetWatchdog.h" 65 #include "UIExtraDataDefs.h" 65 66 #include "UIExtraDataManager.h" 66 67 #include "UIFDCreationDialog.h" … … 321 322 connect(gEDataManager, &UIExtraDataManager::sigLanguageChange, 322 323 this, &UICommon::sltGUILanguageChange); 324 connect(gEDataManager, &UIExtraDataManager::sigFontScaleFactorChanged, 325 this, &UICommon::sltHandleFontScaleFactorChanged); 323 326 324 327 qApp->installEventFilter(this); … … 731 734 #endif 732 735 733 scaleApplicationFont(gEDataManager->fontScaleFactor()); 734 } 735 736 void UICommon::scaleApplicationFont(int iFontScaleFactor) 737 { 738 QFont appFont = qApp->font(); 739 if (appFont.pixelSize() != -1) 740 appFont.setPixelSize(iFontScaleFactor / 100 * appFont.pixelSize()); 741 else 742 appFont.setPointSize(iFontScaleFactor / 100 * appFont.pointSize()); 743 qApp->setFont(appFont); 736 737 iOriginalFontPixelSize = qApp->font().pixelSize(); 738 iOriginalFontPointSize = qApp->font().pointSize(); 739 sltHandleFontScaleFactorChanged(gEDataManager->fontScaleFactor()); 744 740 } 745 741 … … 2722 2718 } 2723 2719 2720 2721 void UICommon::sltHandleFontScaleFactorChanged(int iFontScaleFactor) 2722 { 2723 QFont appFont = qApp->font(); 2724 2725 if (iOriginalFontPixelSize != -1) 2726 appFont.setPixelSize(iFontScaleFactor / 100.f * iOriginalFontPixelSize); 2727 else 2728 appFont.setPointSize(iFontScaleFactor / 100.f * iOriginalFontPointSize); 2729 qApp->setFont(appFont); 2730 } 2731 2724 2732 void UICommon::retranslateUi() 2725 2733 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
r97307 r97311 527 527 /** @} */ 528 528 529 /* Scales the qApp's font. iFontScaleFactor is percentage thus 100% is for no scaling. */530 void scaleApplicationFont(int iFontScaleFactor);531 532 529 public slots: 533 530 … … 590 587 void sltHandleVBoxSVCAvailabilityChange(bool fAvailable); 591 588 /** @} */ 589 590 /* Handle font scale factor change. */ 591 void sltHandleFontScaleFactorChanged(int iFontScaleFactor); 592 592 593 593 private: … … 782 782 /** @} */ 783 783 #endif 784 /** @name Font scaling related variables. 785 * @{ */ 786 int iOriginalFontPixelSize; 787 int iOriginalFontPointSize; 788 /** @} */ 784 789 785 790 /** Allows for shortcut access. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIFontScaleEditor.cpp
r97307 r97311 36 36 #include "QIAdvancedSlider.h" 37 37 #include "UIDesktopWidgetWatchdog.h" 38 #include "UIExtraDataDefs.h" 38 39 #include "UIFontScaleEditor.h" 39 40 … … 176 177 m_pScaleSlider->blockSignals(true); 177 178 m_pScaleSpinBox->blockSignals(true); 178 const int iMinimum = 40; 179 const int iMaximum = 200; 180 181 const int iStep = 25; 179 const int iMinimum = UIExtraDataDefs::iFontScaleMin; 180 const int iMaximum = UIExtraDataDefs::iFontScaleMax; 182 181 183 182 m_pScaleSlider->setMinimum(iMinimum); 184 183 m_pScaleSlider->setMaximum(iMaximum); 185 m_pScaleSlider->setPageStep(iStep); 186 m_pScaleSlider->setSingleStep(1); 187 m_pScaleSlider->setTickInterval(iStep); 184 m_pScaleSlider->setPageStep(20); 185 m_pScaleSlider->setSingleStep(10); 186 m_pScaleSlider->setTickInterval(20); 187 m_pScaleSpinBox->setSingleStep(10); 188 188 m_pScaleSpinBox->setMinimum(iMinimum); 189 189 m_pScaleSpinBox->setMaximum(iMaximum);
Note:
See TracChangeset
for help on using the changeset viewer.