Changeset 74722 in vbox
- Timestamp:
- Oct 9, 2018 5:08:55 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
-
extradata/UIExtraDataManager.cpp (modified) (3 diffs)
-
extradata/UIExtraDataManager.h (modified) (1 diff)
-
globals/UIActionPoolRuntime.cpp (modified) (2 diffs)
-
runtime/UIMachineView.cpp (modified) (4 diffs)
-
settings/machine/UIMachineSettingsDisplay.cpp (modified) (12 diffs)
-
settings/machine/UIMachineSettingsDisplay.h (modified) (1 diff)
-
settings/machine/UIMachineSettingsDisplay.ui (modified) (5 diffs)
-
widgets/UIScaleFactorEditor.cpp (modified) (3 diffs)
-
widgets/UIScaleFactorEditor.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r74701 r74722 3970 3970 } 3971 3971 3972 double UIExtraDataManager::scaleFactor(const QString &strID, const int uScreenIndex /* = 0 */)3972 double UIExtraDataManager::scaleFactor(const QString &strID, const int uScreenIndex) 3973 3973 { 3974 3974 /* Get corresponding extra-data value: */ … … 3987 3987 } 3988 3988 3989 void UIExtraDataManager::setScaleFactor(double dScaleFactor, const QString &strID, const int uScreenIndex /* = 0 */)3989 void UIExtraDataManager::setScaleFactor(double dScaleFactor, const QString &strID, const int uScreenIndex) 3990 3990 { 3991 3991 /* Set corresponding extra-data value: */ … … 4527 4527 emit sigStatusBarConfigurationChange(strMachineID); 4528 4528 /* Scale-factor change: */ 4529 else if (strKey == GUI_ScaleFactor)4529 else if (strKey.contains(GUI_ScaleFactor)) 4530 4530 emit sigScaleFactorChange(strMachineID); 4531 4531 /* Scaling optimization type change: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r74701 r74722 597 597 598 598 /** Returns the scale-factor. */ 599 double scaleFactor(const QString &strID, const int uScreenIndex = 0);599 double scaleFactor(const QString &strID, const int uScreenIndex); 600 600 /** Defines the @a dScaleFactor. */ 601 void setScaleFactor(double dScaleFactor, const QString &strID, const int uScreenIndex = 0);601 void setScaleFactor(double dScaleFactor, const QString &strID, const int uScreenIndex); 602 602 603 603 /** Returns the scaling optimization type. */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp
r73847 r74722 3157 3157 /* Change scale-factor directly: */ 3158 3158 const double dScaleFactor = pAction->property("Requested Scale Factor").toDouble(); 3159 gEDataManager->setScaleFactor(dScaleFactor, vboxGlobal().managedVMUuid() );3159 gEDataManager->setScaleFactor(dScaleFactor, vboxGlobal().managedVMUuid(), 0); 3160 3160 } 3161 3161 … … 3783 3783 3784 3784 /* Get current scale-factor: */ 3785 const double dCurrentScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid() );3785 const double dCurrentScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), 0); 3786 3786 3787 3787 /* Get device-pixel-ratio: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r71106 r74722 248 248 { 249 249 /* Acquire selected scale-factor: */ 250 double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid() );250 double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), m_uScreenId); 251 251 252 252 /* Take the device-pixel-ratio into account: */ … … 508 508 509 509 /* Acquire selected scale-factor: */ 510 double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid() );510 double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), m_uScreenId); 511 511 512 512 /* Take the device-pixel-ratio into account: */ … … 702 702 703 703 /* Acquire selected scale-factor: */ 704 double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid() );704 double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid(), m_uScreenId); 705 705 706 706 /* Take the device-pixel-ratio into account: */ … … 1904 1904 return size; 1905 1905 } 1906 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r74701 r74722 75 75 && (m_cGuestScreenCount == other.m_cGuestScreenCount) 76 76 && (m_dScaleFactor == other.m_dScaleFactor) 77 && (m_scaleFactors == other.m_scaleFactors) 77 78 && (m_f3dAccelerationEnabled == other.m_f3dAccelerationEnabled) 78 79 #ifdef VBOX_WITH_VIDEOHWACCEL … … 245 246 /** Holds the guest screen scale-factor. */ 246 247 double m_dScaleFactor; 248 QList<double> m_scaleFactors; 247 249 /** Holds whether the 3D acceleration is enabled. */ 248 250 bool m_f3dAccelerationEnabled; … … 362 364 oldDisplayData.m_iCurrentVRAM = m_machine.GetVRAMSize(); 363 365 oldDisplayData.m_cGuestScreenCount = m_machine.GetMonitorCount(); 364 oldDisplayData.m_dScaleFactor = gEDataManager->scaleFactor(m_machine.GetId()); 366 oldDisplayData.m_dScaleFactor = gEDataManager->scaleFactor(m_machine.GetId(), 0); 367 oldDisplayData.m_scaleFactors.clear(); 368 for (unsigned i = 0; i < m_machine.GetMonitorCount(); ++i) 369 oldDisplayData.m_scaleFactors.append(gEDataManager->scaleFactor(m_machine.GetId(), (int)i)); 370 365 371 oldDisplayData.m_f3dAccelerationEnabled = m_machine.GetAccelerate3DEnabled(); 366 372 #ifdef VBOX_WITH_VIDEOHWACCEL … … 410 416 m_pEditorVideoScreenCount->setValue(oldDisplayData.m_cGuestScreenCount); 411 417 m_pScaleFactorEditor->setMonitorCount(oldDisplayData.m_cGuestScreenCount); 412 m_pScaleFactorEditor->hide(); 413 m_pLabelGuestScreenScaleFactorEditor->hide(); 414 m_pEditorGuestScreenScale->setValue((int)(oldDisplayData.m_dScaleFactor * 100)); 418 m_pScaleFactorEditor->setScaleFactors(oldDisplayData.m_scaleFactors); 415 419 m_pCheckbox3D->setChecked(oldDisplayData.m_f3dAccelerationEnabled); 416 420 #ifdef VBOX_WITH_VIDEOHWACCEL … … 469 473 newDisplayData.m_iCurrentVRAM = m_pEditorVideoMemorySize->value(); 470 474 newDisplayData.m_cGuestScreenCount = m_pEditorVideoScreenCount->value(); 471 newDisplayData.m_ dScaleFactor = (double)m_pEditorGuestScreenScale->value() / 100;475 newDisplayData.m_scaleFactors = m_pScaleFactorEditor->scaleFactors(); 472 476 newDisplayData.m_f3dAccelerationEnabled = m_pCheckbox3D->isChecked(); 473 477 #ifdef VBOX_WITH_VIDEOHWACCEL … … 662 666 setTabOrder(m_pEditorVideoMemorySize, m_pSliderVideoScreenCount); 663 667 setTabOrder(m_pSliderVideoScreenCount, m_pEditorVideoScreenCount); 664 setTabOrder(m_pEditorVideoScreenCount, m_pSliderGuestScreenScale);665 setTabOrder(m_pSliderGuestScreenScale, m_pEditorGuestScreenScale);666 setTabOrder(m_pEditorGuestScreenScale, m_pCheckbox3D);667 668 #ifdef VBOX_WITH_VIDEOHWACCEL 668 669 setTabOrder(m_pCheckbox3D, m_pCheckbox2DVideo); … … 702 703 m_pLabelVideoScreenCountMin->setText(QString::number(1)); 703 704 m_pLabelVideoScreenCountMax->setText(QString::number(qMin(sys.GetMaxGuestMonitors(), (ULONG)8))); 704 m_pLabelGuestScreenScaleMin->setText(tr("%1%").arg(100));705 m_pLabelGuestScreenScaleMax->setText(tr("%1%").arg(200));706 705 707 706 /* Remote Display stuff: */ … … 741 740 m_pLabelVideoScreenCountMax->setEnabled(isMachineOffline()); 742 741 m_pEditorVideoScreenCount->setEnabled(isMachineOffline()); 743 m_pLabelGuestScreenScale->setEnabled(isMachineInValidMode()); 744 m_pSliderGuestScreenScale->setEnabled(isMachineInValidMode()); 745 m_pLabelGuestScreenScaleMin->setEnabled(isMachineInValidMode()); 746 m_pLabelGuestScreenScaleMax->setEnabled(isMachineInValidMode()); 747 m_pEditorGuestScreenScale->setEnabled(isMachineInValidMode()); 742 m_pScaleFactorEditor->setEnabled(isMachineInValidMode()); 748 743 m_pLabelVideoOptions->setEnabled(isMachineOffline()); 749 744 m_pCheckbox3D->setEnabled(isMachineOffline()); … … 820 815 /* Revalidate: */ 821 816 revalidate(); 822 }823 824 void UIMachineSettingsDisplay::sltHandleGuestScreenScaleSliderChange()825 {826 /* Apply proposed scale-factor: */827 m_pEditorGuestScreenScale->blockSignals(true);828 m_pEditorGuestScreenScale->setValue(m_pSliderGuestScreenScale->value());829 m_pEditorGuestScreenScale->blockSignals(false);830 }831 832 void UIMachineSettingsDisplay::sltHandleGuestScreenScaleEditorChange()833 {834 /* Apply proposed scale-factor: */835 m_pSliderGuestScreenScale->blockSignals(true);836 m_pSliderGuestScreenScale->setValue(m_pEditorGuestScreenScale->value());837 m_pSliderGuestScreenScale->blockSignals(false);838 817 } 839 818 … … 1017 996 m_pEditorVideoScreenCount->setMinimum(1); 1018 997 m_pEditorVideoScreenCount->setMaximum(cMaxGuestScreens); 1019 }1020 1021 /* Scale-factor slider created in the .ui file. */1022 AssertPtrReturnVoid(m_pSliderGuestScreenScale);1023 {1024 /* Configure slider: */1025 m_pSliderGuestScreenScale->setMinimum(100);1026 m_pSliderGuestScreenScale->setMaximum(200);1027 m_pSliderGuestScreenScale->setPageStep(10);1028 m_pSliderGuestScreenScale->setSingleStep(1);1029 m_pSliderGuestScreenScale->setTickInterval(10);1030 m_pSliderGuestScreenScale->setSnappingEnabled(true);1031 }1032 1033 /* Scale-factor editor created in the .ui file. */1034 AssertPtrReturnVoid(m_pEditorGuestScreenScale);1035 {1036 /* Configure editor: */1037 m_pEditorGuestScreenScale->setMinimum(100);1038 m_pEditorGuestScreenScale->setMaximum(200);1039 vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorGuestScreenScale, 5);1040 998 } 1041 999 } … … 1211 1169 connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountSliderChange())); 1212 1170 connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountEditorChange())); 1213 connect(m_pSliderGuestScreenScale, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenScaleSliderChange())); 1214 connect(m_pEditorGuestScreenScale, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenScaleEditorChange())); 1171 1215 1172 connect(m_pCheckbox3D, SIGNAL(stateChanged(int)), this, SLOT(revalidate())); 1216 1173 #ifdef VBOX_WITH_VIDEOHWACCEL … … 1452 1409 /* Save guest-screen scale-factor: */ 1453 1410 if (fSuccess && newDisplayData.m_dScaleFactor != oldDisplayData.m_dScaleFactor) 1454 /* fSuccess = */ gEDataManager->setScaleFactor(newDisplayData.m_dScaleFactor, strMachineId); 1411 /* fSuccess = */ gEDataManager->setScaleFactor(newDisplayData.m_dScaleFactor, strMachineId, 0); 1412 if (fSuccess && newDisplayData.m_scaleFactors != oldDisplayData.m_scaleFactors) 1413 { 1414 int listSize = newDisplayData.m_scaleFactors.size(); 1415 for (int i = 0; i < listSize; ++i) 1416 gEDataManager->setScaleFactor(newDisplayData.m_scaleFactors[i], strMachineId, i); 1417 } 1455 1418 } 1456 1419 /* Return result: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r73134 r74722 93 93 /** Handles Guest Screen count editor change. */ 94 94 void sltHandleGuestScreenCountEditorChange(); 95 /** Handles Guest Screen scale-factor slider change. */96 void sltHandleGuestScreenScaleSliderChange();97 /** Handles Guest Screen scale-factor editor change. */98 void sltHandleGuestScreenScaleEditorChange();99 95 100 96 /** Handles Video Capture toggle. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui
r74701 r74722 147 147 </item> 148 148 <item row="4" column="0"> 149 <widget class="QLabel" name="m_pLabelGuestScreenScale">150 <property name="text">151 <string>Scale Factor:</string>152 </property>153 <property name="alignment">154 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>155 </property>156 </widget>157 </item>158 <item row="4" column="1" rowspan="2">159 <layout class="QGridLayout" name="m_pLayoutGuestScreenScaleSlider">160 <property name="spacing">161 <number>0</number>162 </property>163 <item row="0" column="0" colspan="3">164 <widget class="QIAdvancedSlider" name="m_pSliderGuestScreenScale">165 <property name="whatsThis">166 <string>Controls the guest screen scale factor.</string>167 </property>168 <property name="orientation">169 <enum>Qt::Horizontal</enum>170 </property>171 </widget>172 </item>173 <item row="1" column="0">174 <widget class="QLabel" name="m_pLabelGuestScreenScaleMin"/>175 </item>176 <item row="1" column="1">177 <spacer name="m_pSpacerGuestScreenScale">178 <property name="orientation">179 <enum>Qt::Horizontal</enum>180 </property>181 <property name="sizeHint" stdset="0">182 <size>183 <width>0</width>184 <height>0</height>185 </size>186 </property>187 </spacer>188 </item>189 <item row="1" column="2">190 <widget class="QLabel" name="m_pLabelGuestScreenScaleMax"/>191 </item>192 </layout>193 </item>194 <item row="4" column="2">195 <widget class="QSpinBox" name="m_pEditorGuestScreenScale">196 <property name="whatsThis">197 <string>Controls the guest screen scale factor.</string>198 </property>199 <property name="suffix">200 <string>%</string>201 </property>202 </widget>203 </item>204 <item row="6" column="0">205 149 <widget class="QLabel" name="m_pLabelGuestScreenScaleFactorEditor"> 206 150 <property name="text"> … … 212 156 </widget> 213 157 </item> 214 <item row=" 6" column="1" rowspan="2" colspan="2">158 <item row="4" column="1" rowspan="1" colspan="2"> 215 159 <layout class="QGridLayout" name="m_pLayoutGuestScreenScaleFactorEditor"> 216 160 <property name="spacing"> … … 226 170 </layout> 227 171 </item> 228 <item row=" 8" column="0">172 <item row="6" column="0"> 229 173 <widget class="QLabel" name="m_pLabelVideoOptions"> 230 174 <property name="text"> … … 236 180 </widget> 237 181 </item> 238 <item row=" 8" column="1">182 <item row="6" column="1"> 239 183 <widget class="QCheckBox" name="m_pCheckbox3D"> 240 184 <property name="sizePolicy"> … … 252 196 </widget> 253 197 </item> 254 <item row=" 9" column="1">198 <item row="7" column="1"> 255 199 <widget class="QCheckBox" name="m_pCheckbox2DVideo"> 256 200 <property name="sizePolicy"> -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIScaleFactorEditor.cpp
r74701 r74722 43 43 } 44 44 45 void UIScaleFactorEditor::setMonitorCount(int iMonitorCount) 46 { 47 if (!m_pMonitorComboBox) 48 return; 49 if (iMonitorCount == m_pMonitorComboBox->count()) 50 return; 51 52 m_pMonitorComboBox->blockSignals(true); 53 m_pMonitorComboBox->clear(); 54 for (int i = 0; i < iMonitorCount; ++i) 55 { 56 m_pMonitorComboBox->addItem(QString("Monitor %1").arg(i)); 57 58 } 59 m_pMonitorComboBox->blockSignals(false); 60 } 61 62 void UIScaleFactorEditor::setScaleFactors(const QList<double> &scaleFactors) 63 { 64 if (m_scaleFactors == scaleFactors) 65 return; 66 m_scaleFactors = scaleFactors; 67 68 /* Set the spinbox value for the currently selected monitor: */ 69 if (m_pMonitorComboBox) 70 { 71 int currentMonitorIndex = m_pMonitorComboBox->currentIndex(); 72 if (m_scaleFactors.size() > currentMonitorIndex && m_pScaleSpinBox) 73 m_pScaleSpinBox->setValue(100 * m_scaleFactors.at(currentMonitorIndex)); 74 } 75 } 76 77 const QList<double>& UIScaleFactorEditor::scaleFactors() const 78 { 79 return m_scaleFactors; 80 } 81 82 void UIScaleFactorEditor::retranslateUi() 83 { 84 } 85 86 void UIScaleFactorEditor::sltScaleSpinBoxValueChanged(int value) 87 { 88 setSliderValue(value); 89 if (m_pMonitorComboBox) 90 setScaleFactor(m_pMonitorComboBox->currentIndex(), value); 91 } 92 93 void UIScaleFactorEditor::sltScaleSliderValueChanged(int value) 94 { 95 setSpinBoxValue(value); 96 if (m_pMonitorComboBox) 97 setScaleFactor(m_pMonitorComboBox->currentIndex(), value); 98 } 99 100 void UIScaleFactorEditor::sltMonitorComboIndexChanged(int index) 101 { 102 if (index >= m_scaleFactors.size()) 103 return; 104 105 /* Update the slider and spinbox values without emitting signals: */ 106 int scaleFactor = 100 *m_scaleFactors[index]; 107 setSliderValue(scaleFactor); 108 setSpinBoxValue(scaleFactor); 109 } 110 45 111 void UIScaleFactorEditor::prepare() 46 112 { 47 setStyleSheet("background-color:yellow;");48 49 113 m_pMainLayout = new QGridLayout; 50 114 if (!m_pMainLayout) … … 54 118 { 55 119 m_pMainLayout->addWidget(m_pMonitorComboBox, 0, 0); 120 connect(m_pMonitorComboBox ,static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 121 this, &UIScaleFactorEditor::sltMonitorComboIndexChanged); 56 122 } 57 123 m_pScaleSpinBox = new QSpinBox; … … 80 146 } 81 147 82 void UIScaleFactorEditor::set MonitorCount(int iMonitorCount)148 void UIScaleFactorEditor::setScaleFactor(int iMonitorIndex, int iScaleFactor) 83 149 { 84 if (!m_pMonitorComboBox) 85 return; 86 if (iMonitorCount == m_pMonitorComboBox->count()) 87 return; 88 89 m_pMonitorComboBox->blockSignals(true); 90 m_pMonitorComboBox->clear(); 91 for (int i = 0; i < iMonitorCount; ++i) 150 /* Make sure we have the corresponding scale value for the @p iMonitorIndex: */ 151 if (iMonitorIndex >= m_scaleFactors.size()) 92 152 { 93 m_pMonitorComboBox->addItem(QString("Monitor %1").arg(i));94 153 for (int i = m_scaleFactors.size(); i <= iMonitorIndex; ++i) 154 m_scaleFactors.append(1.0); 95 155 } 96 m_ pMonitorComboBox->blockSignals(false);156 m_scaleFactors[iMonitorIndex] = iScaleFactor / 100.0; 97 157 } 98 158 99 void UIScaleFactorEditor::s ltScaleSpinBoxValueChanged(int value)159 void UIScaleFactorEditor::setSliderValue(int iValue) 100 160 { 101 if (m_pScaleSlider && value != m_pScaleSlider->value())161 if (m_pScaleSlider && iValue != m_pScaleSlider->value()) 102 162 { 103 163 m_pScaleSlider->blockSignals(true); 104 m_pScaleSlider->setValue( value);164 m_pScaleSlider->setValue(iValue); 105 165 m_pScaleSlider->blockSignals(false); 106 166 } 107 167 } 108 168 109 void UIScaleFactorEditor::s ltScaleSliderValueChanged(int value)169 void UIScaleFactorEditor::setSpinBoxValue(int iValue) 110 170 { 111 if (m_pScaleSpinBox && value != m_pScaleSpinBox->value())171 if (m_pScaleSpinBox && iValue != m_pScaleSpinBox->value()) 112 172 { 113 173 m_pScaleSpinBox->blockSignals(true); 114 m_pScaleSpinBox->setValue( value);174 m_pScaleSpinBox->setValue(iValue); 115 175 m_pScaleSpinBox->blockSignals(false); 116 176 } 117 177 } 118 119 void UIScaleFactorEditor::retranslateUi()120 {121 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIScaleFactorEditor.h
r74701 r74722 41 41 42 42 signals: 43 void sigScaleFactorChanged(int iMonitorID, double scaleFactor);44 43 45 44 public: … … 48 47 UIScaleFactorEditor(QWidget *pParent); 49 48 void setMonitorCount(int iMonitorCount); 49 void setScaleFactors(const QList<double> &scaleFactors); 50 const QList<double>& scaleFactors() const; 50 51 51 52 protected: … … 55 56 void sltScaleSpinBoxValueChanged(int value); 56 57 void sltScaleSliderValueChanged(int value); 58 void sltMonitorComboIndexChanged(int index); 57 59 58 60 private: 59 61 void prepare(); 62 void setScaleFactor(int iMonitorIndex, int iScaleFactor); 63 void setSliderValue(int iValue); 64 void setSpinBoxValue(int iValue); 60 65 QSpinBox *m_pScaleSpinBox; 61 66 QGridLayout *m_pMainLayout; 62 67 QComboBox *m_pMonitorComboBox; 63 68 QIAdvancedSlider *m_pScaleSlider; 69 /* Stores the per-monitor scale factors in range [.., 1, ..] */ 70 QList<double> m_scaleFactors; 64 71 }; 65 72
Note:
See TracChangeset
for help on using the changeset viewer.

