- Timestamp:
- Jun 6, 2013 1:38:34 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r46406 r46411 52 52 53 53 UIMachineSettingsDisplay::UIMachineSettingsDisplay() 54 : m Validator(0)55 , m_ minVRAM(0)56 , m_ maxVRAM(0)57 , m_ maxVRAMVisible(0)58 , m_i nitialVRAM(0)54 : m_pValidator(0) 55 , m_iMinVRAM(0) 56 , m_iMaxVRAM(0) 57 , m_iMaxVRAMVisible(0) 58 , m_iInitialVRAM(0) 59 59 #ifdef VBOX_WITH_VIDEOHWACCEL 60 60 , m_f2DVideoAccelerationSupported(false) … … 69 69 /* Setup constants */ 70 70 CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties(); 71 m_ minVRAM = sys.GetMinGuestVRAM();72 m_ maxVRAM = sys.GetMaxGuestVRAM();73 m_ maxVRAMVisible = m_maxVRAM;74 const uint MinMonitors = 1;71 m_iMinVRAM = sys.GetMinGuestVRAM(); 72 m_iMaxVRAM = sys.GetMaxGuestVRAM(); 73 m_iMaxVRAMVisible = m_iMaxVRAM; 74 const uint cMinGuestScreens = 1; 75 75 #if (QT_VERSION >= 0x040600) 76 76 const uint cHostScreens = QApplication::desktop()->screenCount(); … … 78 78 const uint cHostScreens = QApplication::desktop()->numScreens(); 79 79 #endif /* !(QT_VERSION >= 0x040600) */ 80 const uint MaxMonitors = sys.GetMaxGuestMonitors();80 const uint cMaxGuestScreens = sys.GetMaxGuestMonitors(); 81 81 82 82 /* Setup validators */ 83 m LeMemory->setValidator (new QIntValidator (m_minVRAM, m_maxVRAMVisible, this));84 m LeMonitors->setValidator (new QIntValidator (MinMonitors, MaxMonitors, this));85 m LeVRDEPort->setValidator (new QRegExpValidator (QRegExp("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this));86 m LeVRDETimeout->setValidator (new QIntValidator (this));83 m_pEditorMemory->setValidator (new QIntValidator (m_iMinVRAM, m_iMaxVRAMVisible, this)); 84 m_pEditorScreens->setValidator (new QIntValidator (cMinGuestScreens, cMaxGuestScreens, this)); 85 m_pEditorRemoteDisplayPort->setValidator (new QRegExpValidator (QRegExp("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this)); 86 m_pEditorRemoteDisplayTimeout->setValidator (new QIntValidator (this)); 87 87 88 88 /* Setup connections */ 89 connect (m SlMemory, SIGNAL (valueChanged (int)), this, SLOT (valueChangedVRAM (int)));90 connect (m LeMemory, SIGNAL (textChanged (const QString&)), this, SLOT (textChangedVRAM (const QString&)));91 connect (m SlMonitors, SIGNAL (valueChanged (int)), this, SLOT (valueChangedMonitors (int)));92 connect (m LeMonitors, SIGNAL (textChanged (const QString&)), this, SLOT (textChangedMonitors (const QString&)));89 connect (m_pSliderMemory, SIGNAL (valueChanged (int)), this, SLOT (sltValueChangedVRAM (int))); 90 connect (m_pEditorMemory, SIGNAL (textChanged (const QString&)), this, SLOT (sltTextChangedVRAM (const QString&))); 91 connect (m_pSliderScreeens, SIGNAL (valueChanged (int)), this, SLOT (sltValueChangedScreens (int))); 92 connect (m_pEditorScreens, SIGNAL (textChanged (const QString&)), this, SLOT (sltTextChangedScreens (const QString&))); 93 93 94 94 /* Setup initial values */ 95 m SlMemory->setPageStep (calcPageStep (m_maxVRAMVisible));96 m SlMemory->setSingleStep (mSlMemory->pageStep() / 4);97 m SlMemory->setTickInterval (mSlMemory->pageStep());98 m SlMonitors->setPageStep (1);99 m SlMonitors->setSingleStep (1);100 m SlMonitors->setTickInterval (1);95 m_pSliderMemory->setPageStep (calcPageStep (m_iMaxVRAMVisible)); 96 m_pSliderMemory->setSingleStep (m_pSliderMemory->pageStep() / 4); 97 m_pSliderMemory->setTickInterval (m_pSliderMemory->pageStep()); 98 m_pSliderScreeens->setPageStep (1); 99 m_pSliderScreeens->setSingleStep (1); 100 m_pSliderScreeens->setTickInterval (1); 101 101 /* Setup the scale so that ticks are at page step boundaries */ 102 m SlMemory->setMinimum ((m_minVRAM / mSlMemory->pageStep()) * mSlMemory->pageStep());103 m SlMemory->setMaximum (m_maxVRAMVisible);104 m SlMemory->setSnappingEnabled (true);105 m SlMemory->setErrorHint (0, 1);106 m SlMonitors->setMinimum (MinMonitors);107 m SlMonitors->setMaximum (MaxMonitors);108 m SlMonitors->setErrorHint (0, MinMonitors);109 m SlMonitors->setOptimalHint (MinMonitors, cHostScreens);110 m SlMonitors->setWarningHint (cHostScreens, MaxMonitors);102 m_pSliderMemory->setMinimum ((m_iMinVRAM / m_pSliderMemory->pageStep()) * m_pSliderMemory->pageStep()); 103 m_pSliderMemory->setMaximum (m_iMaxVRAMVisible); 104 m_pSliderMemory->setSnappingEnabled (true); 105 m_pSliderMemory->setErrorHint (0, 1); 106 m_pSliderScreeens->setMinimum (cMinGuestScreens); 107 m_pSliderScreeens->setMaximum (cMaxGuestScreens); 108 m_pSliderScreeens->setErrorHint (0, cMinGuestScreens); 109 m_pSliderScreeens->setOptimalHint (cMinGuestScreens, cHostScreens); 110 m_pSliderScreeens->setWarningHint (cHostScreens, cMaxGuestScreens); 111 111 /* Limit min/max. size of QLineEdit */ 112 m LeMemory->setFixedWidthByText (QString().fill ('8', 4));113 m LeMonitors->setFixedWidthByText (QString().fill ('8', 4));112 m_pEditorMemory->setFixedWidthByText (QString().fill ('8', 4)); 113 m_pEditorScreens->setFixedWidthByText (QString().fill ('8', 4)); 114 114 /* Ensure value and validation is updated */ 115 valueChangedVRAM (mSlMemory->value());116 valueChangedMonitors (mSlMonitors->value());115 sltValueChangedVRAM (m_pSliderMemory->value()); 116 sltValueChangedScreens (m_pSliderScreeens->value()); 117 117 /* Setup VRDE widget */ 118 mCbVRDEMethod->insertItem (0, ""); /* KAuthType_Null */ 119 mCbVRDEMethod->insertItem (1, ""); /* KAuthType_External */ 120 mCbVRDEMethod->insertItem (2, ""); /* KAuthType_Guest */ 121 /* Initially disabled */ 122 mCbVRDE->setChecked (false); 118 m_pComboRemoteDisplayAuthMethod->insertItem (0, ""); /* KAuthType_Null */ 119 m_pComboRemoteDisplayAuthMethod->insertItem (1, ""); /* KAuthType_External */ 120 m_pComboRemoteDisplayAuthMethod->insertItem (2, ""); /* KAuthType_Guest */ 123 121 124 122 #ifndef VBOX_WITH_VIDEOHWACCEL 125 123 mCb2DVideo->setVisible (false); 126 #endif 124 #endif /* VBOX_WITH_VIDEOHWACCEL */ 127 125 128 126 /* Applying language settings */ … … 176 174 /* Gather display data: */ 177 175 displayData.m_iCurrentVRAM = m_machine.GetVRAMSize(); 178 displayData.m_c MonitorCount = m_machine.GetMonitorCount();176 displayData.m_cGuestScreenCount = m_machine.GetMonitorCount(); 179 177 displayData.m_f3dAccelerationEnabled = m_machine.GetAccelerate3DEnabled(); 180 178 #ifdef VBOX_WITH_VIDEOHWACCEL … … 182 180 #endif /* VBOX_WITH_VIDEOHWACCEL */ 183 181 /* Check if VRDE server is valid: */ 184 CVRDEServer vrdeServer = m_machine.GetVRDEServer();185 displayData.m_f VRDEServerSupported = !vrdeServer.isNull();186 if (! vrdeServer.isNull())187 { 188 displayData.m_f VRDEServerEnabled = vrdeServer.GetEnabled();189 displayData.m_str VRDEPort = vrdeServer.GetVRDEProperty("TCP/Ports");190 displayData.m_ VRDEAuthType = vrdeServer.GetAuthType();191 displayData.m_u VRDETimeout = vrdeServer.GetAuthTimeout();192 displayData.m_f MultipleConnectionsAllowed = vrdeServer.GetAllowMultiConnection();182 CVRDEServer remoteDisplayServer = m_machine.GetVRDEServer(); 183 displayData.m_fRemoteDisplayServerSupported = !remoteDisplayServer.isNull(); 184 if (!remoteDisplayServer.isNull()) 185 { 186 displayData.m_fRemoteDisplayServerEnabled = remoteDisplayServer.GetEnabled(); 187 displayData.m_strRemoteDisplayPort = remoteDisplayServer.GetVRDEProperty("TCP/Ports"); 188 displayData.m_remoteDisplayAuthType = remoteDisplayServer.GetAuthType(); 189 displayData.m_uRemoteDisplayTimeout = remoteDisplayServer.GetAuthTimeout(); 190 displayData.m_fRemoteDisplayMultiConnAllowed = remoteDisplayServer.GetAllowMultiConnection(); 193 191 } 194 192 195 193 /* Initialize other variables: */ 196 m_i nitialVRAM = RT_MIN(displayData.m_iCurrentVRAM, m_maxVRAM);194 m_iInitialVRAM = RT_MIN(displayData.m_iCurrentVRAM, m_iMaxVRAM); 197 195 198 196 /* Cache display data: */ … … 211 209 212 210 /* Load display data to page: */ 213 m SlMonitors->setValue(displayData.m_cMonitorCount);211 m_pSliderScreeens->setValue(displayData.m_cGuestScreenCount); 214 212 mCb3D->setChecked(displayData.m_f3dAccelerationEnabled); 215 213 #ifdef VBOX_WITH_VIDEOHWACCEL … … 217 215 #endif /* VBOX_WITH_VIDEOHWACCEL */ 218 216 checkVRAMRequirements(); 219 m SlMemory->setValue(displayData.m_iCurrentVRAM);220 if (displayData.m_f VRDEServerSupported)221 { 222 m CbVRDE->setChecked(displayData.m_fVRDEServerEnabled);223 m LeVRDEPort->setText(displayData.m_strVRDEPort);224 m CbVRDEMethod->setCurrentIndex(mCbVRDEMethod->findText(gpConverter->toString(displayData.m_VRDEAuthType)));225 m LeVRDETimeout->setText(QString::number(displayData.m_uVRDETimeout));226 m CbMultipleConn->setChecked(displayData.m_fMultipleConnectionsAllowed);217 m_pSliderMemory->setValue(displayData.m_iCurrentVRAM); 218 if (displayData.m_fRemoteDisplayServerSupported) 219 { 220 m_pCheckboxRemoteDisplay->setChecked(displayData.m_fRemoteDisplayServerEnabled); 221 m_pEditorRemoteDisplayPort->setText(displayData.m_strRemoteDisplayPort); 222 m_pComboRemoteDisplayAuthMethod->setCurrentIndex(m_pComboRemoteDisplayAuthMethod->findText(gpConverter->toString(displayData.m_remoteDisplayAuthType))); 223 m_pEditorRemoteDisplayTimeout->setText(QString::number(displayData.m_uRemoteDisplayTimeout)); 224 m_pCheckboxMultipleConn->setChecked(displayData.m_fRemoteDisplayMultiConnAllowed); 227 225 } 228 226 … … 231 229 232 230 /* Revalidate if possible: */ 233 if (m Validator)234 m Validator->revalidate();231 if (m_pValidator) 232 m_pValidator->revalidate(); 235 233 } 236 234 … … 243 241 244 242 /* Gather display data: */ 245 displayData.m_iCurrentVRAM = m SlMemory->value();246 displayData.m_c MonitorCount = mSlMonitors->value();243 displayData.m_iCurrentVRAM = m_pSliderMemory->value(); 244 displayData.m_cGuestScreenCount = m_pSliderScreeens->value(); 247 245 displayData.m_f3dAccelerationEnabled = mCb3D->isChecked(); 248 246 #ifdef VBOX_WITH_VIDEOHWACCEL 249 247 displayData.m_f2dAccelerationEnabled = mCb2DVideo->isChecked(); 250 248 #endif /* VBOX_WITH_VIDEOHWACCEL */ 251 if (displayData.m_f VRDEServerSupported)252 { 253 displayData.m_f VRDEServerEnabled = mCbVRDE->isChecked();254 displayData.m_str VRDEPort = mLeVRDEPort->text();255 displayData.m_ VRDEAuthType = gpConverter->fromString<KAuthType>(mCbVRDEMethod->currentText());256 displayData.m_u VRDETimeout = mLeVRDETimeout->text().toULong();257 displayData.m_f MultipleConnectionsAllowed = mCbMultipleConn->isChecked();249 if (displayData.m_fRemoteDisplayServerSupported) 250 { 251 displayData.m_fRemoteDisplayServerEnabled = m_pCheckboxRemoteDisplay->isChecked(); 252 displayData.m_strRemoteDisplayPort = m_pEditorRemoteDisplayPort->text(); 253 displayData.m_remoteDisplayAuthType = gpConverter->fromString<KAuthType>(m_pComboRemoteDisplayAuthMethod->currentText()); 254 displayData.m_uRemoteDisplayTimeout = m_pEditorRemoteDisplayTimeout->text().toULong(); 255 displayData.m_fRemoteDisplayMultiConnAllowed = m_pCheckboxMultipleConn->isChecked(); 258 256 } 259 257 … … 280 278 /* Video tab: */ 281 279 m_machine.SetVRAMSize(displayData.m_iCurrentVRAM); 282 m_machine.SetMonitorCount(displayData.m_c MonitorCount);280 m_machine.SetMonitorCount(displayData.m_cGuestScreenCount); 283 281 m_machine.SetAccelerate3DEnabled(displayData.m_f3dAccelerationEnabled); 284 282 #ifdef VBOX_WITH_VIDEOHWACCEL … … 287 285 } 288 286 /* Check if VRDE server still valid: */ 289 CVRDEServer vrdeServer = m_machine.GetVRDEServer();290 if (! vrdeServer.isNull())287 CVRDEServer remoteDisplayServer = m_machine.GetVRDEServer(); 288 if (!remoteDisplayServer.isNull()) 291 289 { 292 290 /* Store VRDE data: */ 293 291 if (isMachineInValidMode()) 294 292 { 295 vrdeServer.SetEnabled(displayData.m_fVRDEServerEnabled);296 vrdeServer.SetVRDEProperty("TCP/Ports", displayData.m_strVRDEPort);297 vrdeServer.SetAuthType(displayData.m_VRDEAuthType);298 vrdeServer.SetAuthTimeout(displayData.m_uVRDETimeout);293 remoteDisplayServer.SetEnabled(displayData.m_fRemoteDisplayServerEnabled); 294 remoteDisplayServer.SetVRDEProperty("TCP/Ports", displayData.m_strRemoteDisplayPort); 295 remoteDisplayServer.SetAuthType(displayData.m_remoteDisplayAuthType); 296 remoteDisplayServer.SetAuthTimeout(displayData.m_uRemoteDisplayTimeout); 299 297 } 300 298 if (isMachineOffline() || isMachineSaved()) 301 299 { 302 vrdeServer.SetAllowMultiConnection(displayData.m_fMultipleConnectionsAllowed);300 remoteDisplayServer.SetAllowMultiConnection(displayData.m_fRemoteDisplayMultiConnAllowed); 303 301 } 304 302 } … … 309 307 } 310 308 311 void UIMachineSettingsDisplay::setValidator (QIWidgetValidator *aVal)312 { 313 m Validator = aVal;309 void UIMachineSettingsDisplay::setValidator(QIWidgetValidator *pValidator) 310 { 311 m_pValidator = pValidator; 314 312 connect (mCb3D, SIGNAL (stateChanged (int)), 315 m Validator, SLOT (revalidate()));313 m_pValidator, SLOT (revalidate())); 316 314 #ifdef VBOX_WITH_VIDEOHWACCEL 317 315 connect (mCb2DVideo, SIGNAL (stateChanged (int)), 318 m Validator, SLOT (revalidate()));319 #endif 320 connect (m CbVRDE, SIGNAL (toggled (bool)),321 m Validator, SLOT (revalidate()));322 connect (m LeVRDEPort, SIGNAL (textChanged (const QString&)),323 m Validator, SLOT (revalidate()));324 connect (m LeVRDETimeout, SIGNAL (textChanged (const QString&)),325 m Validator, SLOT (revalidate()));326 } 327 328 bool UIMachineSettingsDisplay::revalidate(QString &strWarning, QString 316 m_pValidator, SLOT (revalidate())); 317 #endif /* VBOX_WITH_VIDEOHWACCEL */ 318 connect (m_pCheckboxRemoteDisplay, SIGNAL (toggled (bool)), 319 m_pValidator, SLOT (revalidate())); 320 connect (m_pEditorRemoteDisplayPort, SIGNAL (textChanged (const QString&)), 321 m_pValidator, SLOT (revalidate())); 322 connect (m_pEditorRemoteDisplayTimeout, SIGNAL (textChanged (const QString&)), 323 m_pValidator, SLOT (revalidate())); 324 } 325 326 bool UIMachineSettingsDisplay::revalidate(QString &strWarning, QString& /* strTitle */) 329 327 { 330 328 /* Check if video RAM requirement changed first: */ … … 342 340 if (shouldWeWarnAboutLowVideoMemory() && !m_guestOSType.isNull()) 343 341 { 344 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), m SlMonitors->value());342 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), m_pSliderScreeens->value()); 345 343 346 344 /* Basic video RAM amount test: */ 347 if ((quint64)m SlMemory->value() * _1M < uNeedBytes)345 if ((quint64)m_pSliderMemory->value() * _1M < uNeedBytes) 348 346 { 349 347 strWarning = tr("you have assigned less than <b>%1</b> of video memory which is " … … 358 356 { 359 357 uNeedBytes += VBoxGlobal::required2DOffscreenVideoMemory(); 360 if ((quint64)m SlMemory->value() * _1M < uNeedBytes)358 if ((quint64)m_pSliderMemory->value() * _1M < uNeedBytes) 361 359 { 362 360 strWarning = tr("you have assigned less than <b>%1</b> of video memory which is " … … 371 369 if (mCb3D->isChecked() && m_fWddmModeSupported) 372 370 { 373 int c MonitorsCount = mSlMonitors->value();374 uNeedBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), c MonitorsCount);371 int cGuestScreenCount = m_pSliderScreeens->value(); 372 uNeedBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), cGuestScreenCount); 375 373 uNeedBytes = RT_MAX(uNeedBytes, 128 * _1M); 376 374 uNeedBytes = RT_MIN(uNeedBytes, 256 * _1M); 377 if ((quint64)m SlMemory->value() * _1M < uNeedBytes)375 if ((quint64)m_pSliderMemory->value() * _1M < uNeedBytes) 378 376 { 379 377 strWarning = tr("you have 3D Acceleration enabled for a operation system which uses the WDDM video driver. " … … 401 399 } 402 400 403 void UIMachineSettingsDisplay::setOrderAfter (QWidget * aWidget)401 void UIMachineSettingsDisplay::setOrderAfter (QWidget *pWidget) 404 402 { 405 403 /* Video tab-order */ 406 setTabOrder ( aWidget, mTwDisplay->focusProxy());407 setTabOrder (m TwDisplay->focusProxy(), mSlMemory);408 setTabOrder (m SlMemory, mLeMemory);409 setTabOrder (m LeMemory, mSlMonitors);410 setTabOrder (m SlMonitors, mLeMonitors);411 setTabOrder (m LeMonitors, mCb3D);404 setTabOrder (pWidget, m_pTabWidget->focusProxy()); 405 setTabOrder (m_pTabWidget->focusProxy(), m_pSliderMemory); 406 setTabOrder (m_pSliderMemory, m_pEditorMemory); 407 setTabOrder (m_pEditorMemory, m_pSliderScreeens); 408 setTabOrder (m_pSliderScreeens, m_pEditorScreens); 409 setTabOrder (m_pEditorScreens, mCb3D); 412 410 #ifdef VBOX_WITH_VIDEOHWACCEL 413 411 setTabOrder (mCb3D, mCb2DVideo); 414 setTabOrder (mCb2DVideo, m CbVRDE);415 #else 416 setTabOrder (mCb3D, m CbVRDE);417 #endif 412 setTabOrder (mCb2DVideo, m_pCheckboxRemoteDisplay); 413 #else /* VBOX_WITH_VIDEOHWACCEL */ 414 setTabOrder (mCb3D, m_pCheckboxRemoteDisplay); 415 #endif /* !VBOX_WITH_VIDEOHWACCEL */ 418 416 419 417 /* Remote display tab-order */ 420 setTabOrder (m CbVRDE, mLeVRDEPort);421 setTabOrder (m LeVRDEPort, mCbVRDEMethod);422 setTabOrder (m CbVRDEMethod, mLeVRDETimeout);423 setTabOrder (m LeVRDETimeout, mCbMultipleConn);418 setTabOrder (m_pCheckboxRemoteDisplay, m_pEditorRemoteDisplayPort); 419 setTabOrder (m_pEditorRemoteDisplayPort, m_pComboRemoteDisplayAuthMethod); 420 setTabOrder (m_pComboRemoteDisplayAuthMethod, m_pEditorRemoteDisplayTimeout); 421 setTabOrder (m_pEditorRemoteDisplayTimeout, m_pCheckboxMultipleConn); 424 422 } 425 423 … … 430 428 431 429 CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties(); 432 m LbMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg (m_minVRAM));433 m LbMemoryMax->setText (tr ("<qt>%1 MB</qt>").arg (m_maxVRAMVisible));434 m LbMonitorsMin->setText (tr ("<qt>%1</qt>").arg (1));435 m LbMonitorsMax->setText (tr ("<qt>%1</qt>").arg (sys.GetMaxGuestMonitors()));436 437 m CbVRDEMethod->setItemText (0,430 m_pLabelMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg (m_iMinVRAM)); 431 m_pLabelMemoryMin->setText (tr ("<qt>%1 MB</qt>").arg (m_iMaxVRAMVisible)); 432 m_pLabelScreensMin->setText (tr ("<qt>%1</qt>").arg (1)); 433 m_pLabelScreensMax->setText (tr ("<qt>%1</qt>").arg (sys.GetMaxGuestMonitors())); 434 435 m_pComboRemoteDisplayAuthMethod->setItemText (0, 438 436 gpConverter->toString (KAuthType_Null)); 439 m CbVRDEMethod->setItemText (1,437 m_pComboRemoteDisplayAuthMethod->setItemText (1, 440 438 gpConverter->toString (KAuthType_External)); 441 m CbVRDEMethod->setItemText (2,439 m_pComboRemoteDisplayAuthMethod->setItemText (2, 442 440 gpConverter->toString (KAuthType_Guest)); 443 441 } 444 442 445 void UIMachineSettingsDisplay:: valueChangedVRAM (int aVal)446 { 447 m LeMemory->setText (QString().setNum (aVal));448 } 449 450 void UIMachineSettingsDisplay:: textChangedVRAM (const QString &aText)451 { 452 m SlMemory->setValue (aText.toInt());453 } 454 455 void UIMachineSettingsDisplay:: valueChangedMonitors (int aVal)456 { 457 m LeMonitors->setText (QString().setNum (aVal));443 void UIMachineSettingsDisplay::sltValueChangedVRAM (int iValue) 444 { 445 m_pEditorMemory->setText (QString::number (iValue)); 446 } 447 448 void UIMachineSettingsDisplay::sltTextChangedVRAM (const QString &strText) 449 { 450 m_pSliderMemory->setValue (strText.toInt()); 451 } 452 453 void UIMachineSettingsDisplay::sltValueChangedScreens (int iValue) 454 { 455 m_pEditorScreens->setText (QString::number (iValue)); 458 456 checkVRAMRequirements(); 459 457 } 460 458 461 void UIMachineSettingsDisplay:: textChangedMonitors (const QString &aText)462 { 463 m SlMonitors->setValue (aText.toInt());459 void UIMachineSettingsDisplay::sltTextChangedScreens (const QString &strText) 460 { 461 m_pSliderScreeens->setValue (strText.toInt()); 464 462 } 465 463 … … 470 468 471 469 /* Get monitors count and base video memory requirements: */ 472 int c MonitorsCount = mSlMonitors->value();473 quint64 uNeedMBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), c MonitorsCount) / _1M;470 int cGuestScreenCount = m_pSliderScreeens->value(); 471 quint64 uNeedMBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), cGuestScreenCount) / _1M; 474 472 475 473 /* Initial values: */ 476 m_ maxVRAMVisible = cMonitorsCount * 32;477 if (m_ maxVRAMVisible < 128)478 m_ maxVRAMVisible = 128;479 if (m_ maxVRAMVisible < m_initialVRAM)480 m_ maxVRAMVisible = m_initialVRAM;474 m_iMaxVRAMVisible = cGuestScreenCount * 32; 475 if (m_iMaxVRAMVisible < 128) 476 m_iMaxVRAMVisible = 128; 477 if (m_iMaxVRAMVisible < m_iInitialVRAM) 478 m_iMaxVRAMVisible = m_iInitialVRAM; 481 479 482 480 #ifdef VBOX_WITH_VIDEOHWACCEL … … 490 488 { 491 489 # if 0 492 uNeedMBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), c MonitorsCount) / _1M;490 uNeedMBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), cGuestScreenCount) / _1M; 493 491 uNeedMBytes = RT_MAX(uNeedMBytes, 128); 494 492 uNeedMBytes = RT_MIN(uNeedMBytes, 256); 495 493 # endif 496 m_ maxVRAMVisible = 256;494 m_iMaxVRAMVisible = 256; 497 495 } 498 496 #endif /* VBOX_WITH_CRHGSMI */ 499 497 500 m SlMemory->setWarningHint(1, uNeedMBytes);501 m SlMemory->setPageStep(calcPageStep(m_maxVRAMVisible));502 m SlMemory->setMaximum(m_maxVRAMVisible);503 m SlMemory->setOptimalHint(uNeedMBytes, m_maxVRAMVisible);504 m LeMemory->setValidator(new QIntValidator(m_minVRAM, m_maxVRAMVisible, this));505 m LbMemoryMax->setText(tr("<qt>%1 MB</qt>").arg(m_maxVRAMVisible));498 m_pSliderMemory->setWarningHint(1, uNeedMBytes); 499 m_pSliderMemory->setPageStep(calcPageStep(m_iMaxVRAMVisible)); 500 m_pSliderMemory->setMaximum(m_iMaxVRAMVisible); 501 m_pSliderMemory->setOptimalHint(uNeedMBytes, m_iMaxVRAMVisible); 502 m_pEditorMemory->setValidator(new QIntValidator(m_iMinVRAM, m_iMaxVRAMVisible, this)); 503 m_pLabelMemoryMin->setText(tr("<qt>%1 MB</qt>").arg(m_iMaxVRAMVisible)); 506 504 } 507 505 … … 524 522 525 523 /* Video tab: */ 526 m WtVideo->setEnabled(isMachineOffline());524 m_pContainerVideo->setEnabled(isMachineOffline()); 527 525 #ifdef VBOX_WITH_VIDEOHWACCEL 528 526 mCb2DVideo->setEnabled(VBoxGlobal::isAcceleration2DVideoAvailable()); 529 527 #endif /* VBOX_WITH_VIDEOHWACCEL */ 530 528 531 /* VRDEtab: */532 m TwDisplay->setTabEnabled(1, displayData.m_fVRDEServerSupported);533 m WtVRDP->setEnabled(isMachineInValidMode());534 m WtVRDPServer->setEnabled(mCbVRDE->isChecked());535 m LbOptions2->setEnabled(isMachineOffline() || isMachineSaved());536 m CbMultipleConn->setEnabled(isMachineOffline() || isMachineSaved());537 } 538 529 /* Remote Display tab: */ 530 m_pTabWidget->setTabEnabled(1, displayData.m_fRemoteDisplayServerSupported); 531 m_pContainerRemoteDisplay->setEnabled(isMachineInValidMode()); 532 m_pContainerRemoteDisplayOptions->setEnabled(m_pCheckboxRemoteDisplay->isChecked()); 533 m_pLabelRemoteDisplayOptions->setEnabled(isMachineOffline() || isMachineSaved()); 534 m_pCheckboxMultipleConn->setEnabled(isMachineOffline() || isMachineSaved()); 535 } 536 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r44528 r46411 6 6 7 7 /* 8 * Copyright (C) 2008-201 2Oracle Corporation8 * Copyright (C) 2008-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 33 33 UIDataSettingsMachineDisplay() 34 34 : m_iCurrentVRAM(0) 35 , m_c MonitorCount(0)35 , m_cGuestScreenCount(0) 36 36 , m_f3dAccelerationEnabled(false) 37 37 #ifdef VBOX_WITH_VIDEOHWACCEL 38 38 , m_f2dAccelerationEnabled(false) 39 39 #endif /* VBOX_WITH_VIDEOHWACCEL */ 40 , m_f VRDEServerSupported(false)41 , m_f VRDEServerEnabled(false)42 , m_str VRDEPort(QString())43 , m_ VRDEAuthType(KAuthType_Null)44 , m_u VRDETimeout(0)45 , m_f MultipleConnectionsAllowed(false) {}40 , m_fRemoteDisplayServerSupported(false) 41 , m_fRemoteDisplayServerEnabled(false) 42 , m_strRemoteDisplayPort(QString()) 43 , m_remoteDisplayAuthType(KAuthType_Null) 44 , m_uRemoteDisplayTimeout(0) 45 , m_fRemoteDisplayMultiConnAllowed(false) {} 46 46 /* Functions: */ 47 47 bool equal(const UIDataSettingsMachineDisplay &other) const 48 48 { 49 49 return (m_iCurrentVRAM == other.m_iCurrentVRAM) && 50 (m_c MonitorCount == other.m_cMonitorCount) &&50 (m_cGuestScreenCount == other.m_cGuestScreenCount) && 51 51 (m_f3dAccelerationEnabled == other.m_f3dAccelerationEnabled) && 52 52 #ifdef VBOX_WITH_VIDEOHWACCEL 53 53 (m_f2dAccelerationEnabled == other.m_f2dAccelerationEnabled) && 54 54 #endif /* VBOX_WITH_VIDEOHWACCEL */ 55 (m_f VRDEServerSupported == other.m_fVRDEServerSupported) &&56 (m_f VRDEServerEnabled == other.m_fVRDEServerEnabled) &&57 (m_str VRDEPort == other.m_strVRDEPort) &&58 (m_ VRDEAuthType == other.m_VRDEAuthType) &&59 (m_u VRDETimeout == other.m_uVRDETimeout) &&60 (m_f MultipleConnectionsAllowed == other.m_fMultipleConnectionsAllowed);55 (m_fRemoteDisplayServerSupported == other.m_fRemoteDisplayServerSupported) && 56 (m_fRemoteDisplayServerEnabled == other.m_fRemoteDisplayServerEnabled) && 57 (m_strRemoteDisplayPort == other.m_strRemoteDisplayPort) && 58 (m_remoteDisplayAuthType == other.m_remoteDisplayAuthType) && 59 (m_uRemoteDisplayTimeout == other.m_uRemoteDisplayTimeout) && 60 (m_fRemoteDisplayMultiConnAllowed == other.m_fRemoteDisplayMultiConnAllowed); 61 61 } 62 62 /* Operators: */ … … 65 65 /* Variables: */ 66 66 int m_iCurrentVRAM; 67 int m_c MonitorCount;67 int m_cGuestScreenCount; 68 68 bool m_f3dAccelerationEnabled; 69 69 #ifdef VBOX_WITH_VIDEOHWACCEL 70 70 bool m_f2dAccelerationEnabled; 71 71 #endif /* VBOX_WITH_VIDEOHWACCEL */ 72 bool m_f VRDEServerSupported;73 bool m_f VRDEServerEnabled;74 QString m_str VRDEPort;75 KAuthType m_ VRDEAuthType;76 ulong m_u VRDETimeout;77 bool m_f MultipleConnectionsAllowed;72 bool m_fRemoteDisplayServerSupported; 73 bool m_fRemoteDisplayServerEnabled; 74 QString m_strRemoteDisplayPort; 75 KAuthType m_remoteDisplayAuthType; 76 ulong m_uRemoteDisplayTimeout; 77 bool m_fRemoteDisplayMultiConnAllowed; 78 78 }; 79 79 typedef UISettingsCache<UIDataSettingsMachineDisplay> UICacheSettingsMachineDisplay; … … 114 114 bool changed() const { return m_cache.wasChanged(); } 115 115 116 void setValidator (QIWidgetValidator *aVal);117 bool revalidate (QString &aWarning, QString &aTitle);116 void setValidator(QIWidgetValidator *pValidator); 117 bool revalidate(QString &strWarning, QString &strTitle); 118 118 119 void setOrderAfter (QWidget *aWidget);119 void setOrderAfter(QWidget *pWidget); 120 120 121 121 void retranslateUi(); … … 123 123 private slots: 124 124 125 void valueChangedVRAM (int aVal);126 void textChangedVRAM (const QString &aText);127 void valueChangedMonitors (int aVal);128 void textChangedMonitors (const QString &aText);125 void sltValueChangedVRAM(int iValue); 126 void sltTextChangedVRAM(const QString &strText); 127 void sltValueChangedScreens(int iValue); 128 void sltTextChangedScreens(const QString &strText); 129 129 130 130 private: … … 135 135 void polishPage(); 136 136 137 QIWidgetValidator *m Validator;137 QIWidgetValidator *m_pValidator; 138 138 139 139 /* Guest OS type id: */ 140 140 CGuestOSType m_guestOSType; 141 141 /* System minimum lower limit of VRAM (MiB). */ 142 int m_ minVRAM;142 int m_iMinVRAM; 143 143 /* System maximum limit of VRAM (MiB). */ 144 int m_ maxVRAM;144 int m_iMaxVRAM; 145 145 /* Upper limit of VRAM in MiB for this dialog. This value is lower than 146 146 * m_maxVRAM to save careless users from setting useless big values. */ 147 int m_ maxVRAMVisible;147 int m_iMaxVRAMVisible; 148 148 /* Initial VRAM value when the dialog is opened. */ 149 int m_i nitialVRAM;149 int m_iInitialVRAM; 150 150 #ifdef VBOX_WITH_VIDEOHWACCEL 151 151 /* Specifies whether the guest OS supports 2D video-acceleration: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui
r46406 r46411 23 23 </rect> 24 24 </property> 25 <layout class="QVBoxLayout" name="m LtMain">25 <layout class="QVBoxLayout" name="m_pLayoutMain"> 26 26 <item> 27 <widget class="QITabWidget" name="m TwDisplay">28 <widget class="QWidget" name="m TabVideo">27 <widget class="QITabWidget" name="m_pTabWidget"> 28 <widget class="QWidget" name="m_pTabVideo"> 29 29 <attribute name="title"> 30 30 <string>&Video</string> 31 31 </attribute> 32 <layout class="QVBoxLayout" name="m LtVideoPage">32 <layout class="QVBoxLayout" name="m_pLayoutTabVideo"> 33 33 <item> 34 <widget class="QWidget" name="m WtVideo">35 <layout class="QGridLayout" name="m LtVideoItems">34 <widget class="QWidget" name="m_pContainerVideo"> 35 <layout class="QGridLayout" name="m_pLayoutContainerVideo"> 36 36 <item row="0" column="0"> 37 <widget class="QLabel" name="m LbMemory">37 <widget class="QLabel" name="m_pLabelMemory"> 38 38 <property name="text"> 39 39 <string>Video &Memory:</string> … … 43 43 </property> 44 44 <property name="buddy"> 45 <cstring>m LeMemory</cstring>45 <cstring>m_pEditorMemory</cstring> 46 46 </property> 47 47 </widget> 48 48 </item> 49 49 <item row="0" column="1" rowspan="2"> 50 <layout class="QVBoxLayout" name="m LtMemorySlider">50 <layout class="QVBoxLayout" name="m_pLayoutSliderMemory"> 51 51 <property name="spacing"> 52 52 <number>0</number> 53 53 </property> 54 54 <item> 55 <widget class="QIAdvancedSlider" name="m SlMemory">55 <widget class="QIAdvancedSlider" name="m_pSliderMemory"> 56 56 <property name="whatsThis"> 57 57 <string>Controls the amount of video memory provided to the virtual machine.</string> … … 66 66 </item> 67 67 <item> 68 <layout class="QHBoxLayout" name="m LtMemoryLegend">69 <item> 70 <widget class="QLabel" name="m LbMemoryMin">68 <layout class="QHBoxLayout" name="m_pLayoutLegendMemory"> 69 <item> 70 <widget class="QLabel" name="m_pLabelMemoryMin"> 71 71 <property name="sizePolicy"> 72 72 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> … … 78 78 </item> 79 79 <item> 80 <spacer name="m SpHor1">80 <spacer name="m_pSpacerLegendMemory"> 81 81 <property name="orientation"> 82 82 <enum>Qt::Horizontal</enum> … … 91 91 </item> 92 92 <item> 93 <widget class="QLabel" name="m LbMemoryMax">93 <widget class="QLabel" name="m_pLabelMemoryMax"> 94 94 <property name="sizePolicy"> 95 95 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> … … 105 105 </item> 106 106 <item row="0" column="2"> 107 <layout class="QHBoxLayout" name="m LtMemorySize">108 <item> 109 <widget class="QILineEdit" name="m LeMemory">107 <layout class="QHBoxLayout" name="m_pLayoutEditorMemory"> 108 <item> 109 <widget class="QILineEdit" name="m_pEditorMemory"> 110 110 <property name="sizePolicy"> 111 111 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> … … 120 120 </item> 121 121 <item> 122 <widget class="QLabel" name="m LbMemoryUnit">122 <widget class="QLabel" name="m_pLabelMemoryUnit"> 123 123 <property name="sizePolicy"> 124 124 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> … … 135 135 </item> 136 136 <item row="2" column="0"> 137 <widget class="QLabel" name="m LbMonitors">137 <widget class="QLabel" name="m_pLabelScreens"> 138 138 <property name="text"> 139 139 <string>Mo&nitor Count:</string> … … 143 143 </property> 144 144 <property name="buddy"> 145 <cstring>m LeMonitors</cstring>145 <cstring>m_pEditorScreens</cstring> 146 146 </property> 147 147 </widget> 148 148 </item> 149 149 <item row="2" column="1" rowspan="2"> 150 <layout class="QVBoxLayout" name="m LtMonitorsSlider">150 <layout class="QVBoxLayout" name="m_pLayoutSliderScreens"> 151 151 <property name="spacing"> 152 152 <number>0</number> 153 153 </property> 154 154 <item> 155 <widget class="QIAdvancedSlider" name="m SlMonitors">155 <widget class="QIAdvancedSlider" name="m_pSliderScreeens"> 156 156 <property name="whatsThis"> 157 157 <string>Controls the amount of virtual monitors provided to the virtual machine.</string> … … 166 166 </item> 167 167 <item> 168 <layout class="QHBoxLayout" name="m LtMonitorsLegend">169 <item> 170 <widget class="QLabel" name="m LbMonitorsMin">168 <layout class="QHBoxLayout" name="m_pLayoutLegendScreens"> 169 <item> 170 <widget class="QLabel" name="m_pLabelScreensMin"> 171 171 <property name="sizePolicy"> 172 172 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> … … 178 178 </item> 179 179 <item> 180 <spacer name="m SpHor2">180 <spacer name="m_pSpacerLegendScreens"> 181 181 <property name="orientation"> 182 182 <enum>Qt::Horizontal</enum> … … 191 191 </item> 192 192 <item> 193 <widget class="QLabel" name="m LbMonitorsMax">193 <widget class="QLabel" name="m_pLabelScreensMax"> 194 194 <property name="sizePolicy"> 195 195 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> … … 205 205 </item> 206 206 <item row="2" column="2"> 207 <layout class="QHBoxLayout" name="m LtMonitorsSize">208 <item> 209 <widget class="QILineEdit" name="m LeMonitors">207 <layout class="QHBoxLayout" name="m_pLayoutEditorScreens"> 208 <item> 209 <widget class="QILineEdit" name="m_pEditorScreens"> 210 210 <property name="sizePolicy"> 211 211 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> … … 220 220 </item> 221 221 <item> 222 <widget class="QLabel" name="m LbMonitorsUnit"/>222 <widget class="QLabel" name="m_pLabelScreensUnit"/> 223 223 </item> 224 224 </layout> 225 225 </item> 226 226 <item row="4" column="0"> 227 <widget class="QLabel" name="m LbOptions">227 <widget class="QLabel" name="m_pLabelVideoOptions"> 228 228 <property name="text"> 229 229 <string>Extended Features:</string> … … 270 270 </item> 271 271 <item> 272 <spacer name="m SpVer1">272 <spacer name="m_pStretchVideo"> 273 273 <property name="orientation"> 274 274 <enum>Qt::Vertical</enum> … … 284 284 </layout> 285 285 </widget> 286 <widget class="QWidget" name="m TabVRDP">286 <widget class="QWidget" name="m_pTabRemoteDisplay"> 287 287 <attribute name="title"> 288 288 <string>&Remote Display</string> 289 289 </attribute> 290 <layout class="QVBoxLayout" name="m LtVRDPPage">290 <layout class="QVBoxLayout" name="m_pLayoutTabRemoteDisplay"> 291 291 <item> 292 <widget class="QWidget" name="m WtVRDP">293 <layout class="QGridLayout" name="m LtVRDPItems">292 <widget class="QWidget" name="m_pContainerRemoteDisplay"> 293 <layout class="QGridLayout" name="m_pLayoutContainerRemoteDisplay"> 294 294 <item row="0" column="0" colspan="2"> 295 <widget class="QCheckBox" name="m CbVRDE">295 <widget class="QCheckBox" name="m_pCheckboxRemoteDisplay"> 296 296 <property name="whatsThis"> 297 297 <string>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</string> … … 306 306 </item> 307 307 <item row="1" column="0"> 308 <spacer name="m SpHor3">308 <spacer name="m_pSpacerContainerRemoteDisplay"> 309 309 <property name="orientation"> 310 310 <enum>Qt::Horizontal</enum> … … 322 322 </item> 323 323 <item row="1" column="1"> 324 <widget class="QWidget" name="m WtVRDPServer">325 <layout class="QGridLayout" name="m LtVRDPServerItems">324 <widget class="QWidget" name="m_pContainerRemoteDisplayOptions"> 325 <layout class="QGridLayout" name="m_pLayoutContainerRemoteDisplayServer"> 326 326 <item row="0" column="0"> 327 <widget class="QLabel" name="m LbVRDPPort">327 <widget class="QLabel" name="m_pLabelRemoteDisplayPort"> 328 328 <property name="text"> 329 329 <string>Server &Port:</string> … … 333 333 </property> 334 334 <property name="buddy"> 335 <cstring>m LeVRDEPort</cstring>335 <cstring>m_pEditorRemoteDisplayPort</cstring> 336 336 </property> 337 337 </widget> 338 338 </item> 339 339 <item row="0" column="1"> 340 <widget class="QLineEdit" name="m LeVRDEPort">340 <widget class="QLineEdit" name="m_pEditorRemoteDisplayPort"> 341 341 <property name="whatsThis"> 342 342 <string>The VRDP Server port number. You may specify <tt>0</tt> (zero), to select port 3389, the standard port for RDP.</string> … … 345 345 </item> 346 346 <item row="1" column="0"> 347 <widget class="QLabel" name="m LbVRDPMethod">347 <widget class="QLabel" name="m_pLabelRemoteDisplayAuthMethod"> 348 348 <property name="text"> 349 349 <string>Authentication &Method:</string> … … 353 353 </property> 354 354 <property name="buddy"> 355 <cstring>m CbVRDEMethod</cstring>355 <cstring>m_pComboRemoteDisplayAuthMethod</cstring> 356 356 </property> 357 357 </widget> 358 358 </item> 359 359 <item row="1" column="1"> 360 <widget class="QComboBox" name="m CbVRDEMethod">360 <widget class="QComboBox" name="m_pComboRemoteDisplayAuthMethod"> 361 361 <property name="whatsThis"> 362 362 <string>Defines the VRDP authentication method.</string> … … 365 365 </item> 366 366 <item row="2" column="0"> 367 <widget class="QLabel" name="m LbVRDPTimeout">367 <widget class="QLabel" name="m_pLabelRemoteDisplayTimeout"> 368 368 <property name="text"> 369 369 <string>Authentication &Timeout:</string> … … 373 373 </property> 374 374 <property name="buddy"> 375 <cstring>m LeVRDETimeout</cstring>375 <cstring>m_pEditorRemoteDisplayTimeout</cstring> 376 376 </property> 377 377 </widget> 378 378 </item> 379 379 <item row="2" column="1"> 380 <widget class="QLineEdit" name="m LeVRDETimeout">380 <widget class="QLineEdit" name="m_pEditorRemoteDisplayTimeout"> 381 381 <property name="whatsThis"> 382 382 <string>Specifies the timeout for guest authentication, in milliseconds.</string> … … 385 385 </item> 386 386 <item row="3" column="0"> 387 <widget class="QLabel" name="m LbOptions2">387 <widget class="QLabel" name="m_pLabelRemoteDisplayOptions"> 388 388 <property name="text"> 389 389 <string>Extended Features:</string> … … 395 395 </item> 396 396 <item row="3" column="1"> 397 <widget class="QCheckBox" name="m CbMultipleConn">397 <widget class="QCheckBox" name="m_pCheckboxMultipleConn"> 398 398 <property name="sizePolicy"> 399 399 <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> … … 417 417 </item> 418 418 <item> 419 <spacer name="m SpVer2">419 <spacer name="m_pStretchRemoteDisplay"> 420 420 <property name="orientation"> 421 421 <enum>Qt::Vertical</enum> … … 455 455 <connections> 456 456 <connection> 457 <sender>m CbVRDE</sender>457 <sender>m_pCheckboxRemoteDisplay</sender> 458 458 <signal>toggled(bool)</signal> 459 <receiver>m WtVRDPServer</receiver>459 <receiver>m_pContainerRemoteDisplayOptions</receiver> 460 460 <slot>setEnabled(bool)</slot> 461 461 </connection>
Note:
See TracChangeset
for help on using the changeset viewer.