Changeset 37168 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 20, 2011 4:56:46 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r36396 r37168 3805 3805 } 3806 3806 3807 /* static */3808 bool VBoxGlobal::shouldWarnAboutToLowVRAM(const CMachine *pMachine /* = 0 */)3809 {3810 static QStringList osList = QStringList()3811 << "Other" << "DOS" << "Netware" << "L4" << "QNX" << "JRockitVE";3812 3813 bool fResult = true;3814 if ( pMachine3815 && !pMachine->isNull()3816 && osList.contains(pMachine->GetOSTypeId()))3817 fResult = false;3818 3819 return fResult;3820 }3821 3822 3807 /** 3823 3808 * Returns the required video memory in bytes for the current desktop … … 3825 3810 */ 3826 3811 /* static */ 3827 quint64 VBoxGlobal::requiredVideoMemory (CMachine *aMachine /* = 0 */, int cMonitors /* = 1 */)3812 quint64 VBoxGlobal::requiredVideoMemory(const QString &strGuestOSTypeId, int cMonitors /* = 1 */) 3828 3813 { 3829 3814 QSize desktopRes = QApplication::desktop()->screenGeometry().size(); … … 3863 3848 needBits / (8 * _1M) /* convert to megabytes */; 3864 3849 3865 if (aMachine && !aMachine->isNull()) 3866 { 3867 QString typeId = aMachine->GetOSTypeId(); 3868 if (typeId.startsWith("Windows")) 3850 if (strGuestOSTypeId.startsWith("Windows")) 3851 { 3852 /* Windows guests need offscreen VRAM too for graphics acceleration features: */ 3853 #ifdef VBOX_WITH_CRHGSMI 3854 if (strGuestOSTypeId == "WindowsVista" || strGuestOSTypeId == "Windows7") 3869 3855 { 3870 /* Windows guests need offscreen VRAM too for graphics acceleration features. */ 3871 #ifdef VBOX_WITH_CRHGSMI 3872 if (typeId == "WindowsVista" || typeId == "Windows7") 3873 { 3874 /* wddm mode, there are two surfaces for each screen: shadow & primary */ 3875 needMBytes *= 3; 3876 } 3877 else 3878 #endif 3879 { 3880 needMBytes *= 2; 3881 } 3856 /* wddm mode, there are two surfaces for each screen: shadow & primary */ 3857 needMBytes *= 3; 3858 } 3859 else 3860 #endif /* VBOX_WITH_CRHGSMI */ 3861 { 3862 needMBytes *= 2; 3882 3863 } 3883 3864 } … … 4434 4415 #ifdef VBOX_WITH_CRHGSMI 4435 4416 /* static */ 4436 quint64 VBoxGlobal::required3DWddmOffscreenVideoMemory( CMachine *aMachine /* = 0 */, int cMonitors /* = 1 */)4417 quint64 VBoxGlobal::required3DWddmOffscreenVideoMemory(const QString &strGuestOSTypeId, int cMonitors /* = 1 */) 4437 4418 { 4438 4419 cMonitors = RT_MAX(cMonitors, 1); 4439 quint64 cbSize = VBoxGlobal::requiredVideoMemory( aMachine, 1); /* why not cMonitors? */4420 quint64 cbSize = VBoxGlobal::requiredVideoMemory(strGuestOSTypeId, 1); /* why not cMonitors? */ 4440 4421 cbSize += 64 * _1M; 4441 4422 return cbSize; 4442 4423 } 4443 #endif 4424 #endif /* VBOX_WITH_CRHGSMI */ 4444 4425 4445 4426 #ifdef Q_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r36104 r37168 636 636 /* public static stuff */ 637 637 638 static bool shouldWarnAboutToLowVRAM(const CMachine *pMachine = 0);639 638 static bool isDOSType (const QString &aOSTypeId); 640 639 … … 663 662 VBoxDefs::FormatSize aMode = VBoxDefs::FormatSize_Round); 664 663 665 static quint64 requiredVideoMemory (CMachine *aMachine = 0, int cMonitors = 1);664 static quint64 requiredVideoMemory(const QString &strGuestOSTypeId, int cMonitors = 1); 666 665 667 666 static QString locationForHTML (const QString &aFileName); … … 715 714 716 715 #ifdef VBOX_WITH_CRHGSMI 717 static quint64 required3DWddmOffscreenVideoMemory( CMachine *aMachine = 0, int cMonitors = 1);718 #endif 716 static quint64 required3DWddmOffscreenVideoMemory(const QString &strGuestOSTypeId, int cMonitors = 1); 717 #endif /* VBOX_WITH_CRHGSMI */ 719 718 720 719 #ifdef Q_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r37138 r37168 174 174 QString strTitle = m_pSelector->itemTextByPage(pSettingsPage); 175 175 176 /* Recorrelate page with others before revalidation: */ 177 recorrelate(pSettingsPage); 178 176 179 /* Revalidate the page: */ 177 180 bool fValid = pSettingsPage->revalidate(strWarning, strTitle); 178 179 /* If revalidation is fully passed - recorrelate the pages: */180 if (fValid && strWarning.isEmpty())181 fValid = recorrelate(pSettingsPage, strWarning);182 181 183 182 /* Compose a message: */ … … 370 369 if (pSettingsPage) 371 370 assignValidator(pSettingsPage); 372 }373 374 bool UISettingsDialog::recorrelate(QWidget * /* pPage */, QString & /* strWarning */)375 {376 return true;377 371 } 378 372 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r37138 r37168 96 96 UISettingsPage* pSettingsPage = 0, int iParentId = -1); 97 97 98 /* Correlation handler: */99 virtual bool recorrelate(QWidget *pPage, QString &strWarning);98 /* Settings page correlator: */ 99 virtual void recorrelate(UISettingsPage *pSettingsPage) { Q_UNUSED(pSettingsPage); } 100 100 101 101 /* Protected variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r37143 r37168 909 909 } 910 910 911 bool UISettingsDialogMachine::recorrelate(QWidget *pPage, QString &strWarning) 912 { 913 /* This method performs correlation option check 914 * between different pages of VM Settings dialog: */ 915 916 if (pPage == m_pSelector->idToPage(VMSettingsPage_General)) 917 { 918 /* Get General & System pages: */ 919 UIMachineSettingsGeneral *pGeneralPage = 920 qobject_cast<UIMachineSettingsGeneral*>(m_pSelector->idToPage(VMSettingsPage_General)); 921 UIMachineSettingsSystem *pSystemPage = 922 qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(VMSettingsPage_System)); 923 924 /* Guest OS type & VT-x/AMD-V option correlation test: */ 925 if (pGeneralPage && pSystemPage && 926 pGeneralPage->is64BitOSTypeSelected() && !pSystemPage->isHWVirtExEnabled()) 927 { 928 strWarning = tr( 929 "you have selected a 64-bit guest OS type for this VM. As such guests " 930 "require hardware virtualization (VT-x/AMD-V), this feature will be enabled " 931 "automatically."); 932 return true; 933 } 934 } 935 936 #if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI) 937 /* 2D Video Acceleration is available for Windows guests only: */ 938 if (pPage == m_pSelector->idToPage(VMSettingsPage_Display)) 939 { 940 /* Get General & Display pages: */ 941 UIMachineSettingsGeneral *pGeneralPage = 942 qobject_cast<UIMachineSettingsGeneral*>(m_pSelector->idToPage(VMSettingsPage_General)); 943 UIMachineSettingsDisplay *pDisplayPage = 944 qobject_cast<UIMachineSettingsDisplay*>(m_pSelector->idToPage(VMSettingsPage_Display)); 945 #ifdef VBOX_WITH_CRHGSMI 946 if (pGeneralPage && pDisplayPage) 947 { 948 bool bWddmSupported = pGeneralPage->isWddmSupportedForOSType(); 949 pDisplayPage->setWddmMode(bWddmSupported); 950 } 951 #endif 952 #ifdef VBOX_WITH_VIDEOHWACCEL 953 if (pGeneralPage && pDisplayPage && 954 pDisplayPage->isAcceleration2DVideoSelected() && !pGeneralPage->isWindowsOSTypeSelected()) 955 { 956 strWarning = tr( 957 "you have 2D Video Acceleration enabled. As 2D Video Acceleration " 958 "is supported for Windows guests only, this feature will be disabled."); 959 return true; 960 } 961 #endif 962 } 963 #endif /* VBOX_WITH_VIDEOHWACCEL */ 964 965 if (pPage == m_pSelector->idToPage(VMSettingsPage_System)) 966 { 967 /* Get System & USB pages: */ 968 UIMachineSettingsSystem *pSystemPage = 969 qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(VMSettingsPage_System)); 970 UIMachineSettingsUSB *pUsbPage = 971 qobject_cast<UIMachineSettingsUSB*>(m_pSelector->idToPage(VMSettingsPage_USB)); 972 if (pSystemPage && pUsbPage && 973 pSystemPage->isHIDEnabled() && !pUsbPage->isOHCIEnabled()) 974 { 975 strWarning = tr( 976 "you have enabled a USB HID (Human Interface Device). " 977 "This will not work unless USB emulation is also enabled. " 978 "This will be done automatically when you accept the VM Settings " 979 "by pressing the OK button."); 980 return true; 981 } 982 } 983 984 if (pPage == m_pSelector->idToPage(VMSettingsPage_Storage)) 985 { 986 /* Get System & Storage pages: */ 987 UIMachineSettingsSystem *pSystemPage = 988 qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(VMSettingsPage_System)); 989 UIMachineSettingsStorage *pStoragePage = 990 qobject_cast<UIMachineSettingsStorage*>(m_pSelector->idToPage(VMSettingsPage_Storage)); 991 if (pSystemPage && pStoragePage) 992 { 993 /* Update chiset type for the Storage settings page: */ 994 if (pStoragePage->chipsetType() != pSystemPage->chipsetType()) 911 void UISettingsDialogMachine::recorrelate(UISettingsPage *pSettingsPage) 912 { 913 switch (pSettingsPage->id()) 914 { 915 case VMSettingsPage_General: 916 { 917 UIMachineSettingsGeneral *pGeneralPage = qobject_cast<UIMachineSettingsGeneral*>(pSettingsPage); 918 UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(VMSettingsPage_System)); 919 if (pGeneralPage && pSystemPage) 920 pGeneralPage->setHWVirtExEnabled(pSystemPage->isHWVirtExEnabled()); 921 break; 922 } 923 case VMSettingsPage_Display: 924 { 925 UIMachineSettingsDisplay *pDisplayPage = qobject_cast<UIMachineSettingsDisplay*>(pSettingsPage); 926 UIMachineSettingsGeneral *pGeneralPage = qobject_cast<UIMachineSettingsGeneral*>(m_pSelector->idToPage(VMSettingsPage_General)); 927 if (pDisplayPage && pGeneralPage) 928 pDisplayPage->setGuestOSType(pGeneralPage->guestOSType()); 929 break; 930 } 931 case VMSettingsPage_System: 932 { 933 UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(pSettingsPage); 934 UIMachineSettingsUSB *pUsbPage = qobject_cast<UIMachineSettingsUSB*>(m_pSelector->idToPage(VMSettingsPage_USB)); 935 if (pSystemPage && pUsbPage) 936 pSystemPage->setOHCIEnabled(pUsbPage->isOHCIEnabled()); 937 break; 938 } 939 case VMSettingsPage_Storage: 940 { 941 UIMachineSettingsStorage *pStoragePage = qobject_cast<UIMachineSettingsStorage*>(pSettingsPage); 942 UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(VMSettingsPage_System)); 943 if (pStoragePage && pSystemPage) 995 944 pStoragePage->setChipsetType(pSystemPage->chipsetType()); 996 /* Check for excessive controllers on Storage page controllers list: */ 997 QStringList excessiveList; 998 QMap<KStorageBus, int> currentType = pStoragePage->currentControllerTypes(); 999 QMap<KStorageBus, int> maximumType = pStoragePage->maximumControllerTypes(); 1000 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType) 1001 { 1002 if (currentType[(KStorageBus)iStorageBusType] > maximumType[(KStorageBus)iStorageBusType]) 1003 { 1004 QString strExcessiveRecord = QString("%1 (%2)"); 1005 strExcessiveRecord = strExcessiveRecord.arg(QString("<b>%1</b>").arg(vboxGlobal().toString((KStorageBus)iStorageBusType))); 1006 strExcessiveRecord = strExcessiveRecord.arg(maximumType[(KStorageBus)iStorageBusType] == 1 ? 1007 tr("at most one supported") : 1008 tr("up to %1 supported").arg(maximumType[(KStorageBus)iStorageBusType])); 1009 excessiveList << strExcessiveRecord; 1010 } 1011 } 1012 if (!excessiveList.isEmpty()) 1013 { 1014 strWarning = tr( 1015 "you are currently using more storage controllers than a %1 chipset supports. " 1016 "Please change the chipset type on the System settings page or reduce the number " 1017 "of the following storage controllers on the Storage settings page: %2.") 1018 .arg(vboxGlobal().toString(pStoragePage->chipsetType())) 1019 .arg(excessiveList.join(", ")); 1020 return false; 1021 } 1022 } 1023 } 1024 1025 return true; 945 break; 946 } 947 default: 948 break; 949 } 1026 950 } 1027 951 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
r37143 r37168 94 94 QString title() const; 95 95 96 bool recorrelate(QWidget *pPage, QString &strWarning);96 void recorrelate(UISettingsPage *pSettingsPage); 97 97 98 98 private slots: -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r37126 r37168 51 51 , m_maxVRAMVisible(0) 52 52 , m_initialVRAM(0) 53 #ifdef VBOX_WITH_VIDEOHWACCEL 54 , m_f2DVideoAccelerationSupported(false) 55 #endif /* VBOX_WITH_VIDEOHWACCEL */ 53 56 #ifdef VBOX_WITH_CRHGSMI 54 , m_ bWddmMode(false)55 #endif 57 , m_fWddmModeSupported(false) 58 #endif /* VBOX_WITH_CRHGSMI */ 56 59 { 57 60 /* Apply UI decorations */ … … 94 97 mSlMemory->setMaximum (m_maxVRAMVisible); 95 98 mSlMemory->setSnappingEnabled (true); 96 quint64 needMBytes = VBoxGlobal::requiredVideoMemory (&m_machine) / _1M;97 99 mSlMemory->setErrorHint (0, 1); 98 mSlMemory->setWarningHint (1, needMBytes);99 mSlMemory->setOptimalHint (needMBytes, m_maxVRAMVisible);100 100 mSlMonitors->setMinimum (MinMonitors); 101 101 mSlMonitors->setMaximum (MaxMonitors); … … 120 120 #endif 121 121 122 #ifdef VBOX_WITH_CRHGSMI123 m_bWddmMode = false;124 #endif125 126 122 /* Applying language settings */ 127 123 retranslateUi(); 128 124 } 129 125 126 void UIMachineSettingsDisplay::setGuestOSType(CGuestOSType guestOSType) 127 { 128 /* Check if guest os type changed: */ 129 if (m_guestOSType == guestOSType) 130 return; 131 132 /* Remember new guest os type: */ 133 m_guestOSType = guestOSType; 134 135 #ifdef VBOX_WITH_VIDEOHWACCEL 136 /* Check if 2D video acceleration supported by the guest OS type: */ 137 QString strguestOSTypeFamily = m_guestOSType.GetFamilyId(); 138 m_f2DVideoAccelerationSupported = strguestOSTypeFamily == "Windows"; 139 #endif /* VBOX_WITH_VIDEOHWACCEL */ 140 #ifdef VBOX_WITH_CRHGSMI 141 /* Check if WDDM mode supported by the guest OS type: */ 142 QString strguestOSTypeId = m_guestOSType.GetId(); 143 m_fWddmModeSupported = strguestOSTypeId == "WindowsVista" || strguestOSTypeId == "Windows7"; 144 #endif /* VBOX_WITH_CRHGSMI */ 145 146 /* Recheck video RAM requirement: */ 147 checkVRAMRequirements(); 148 } 149 130 150 #ifdef VBOX_WITH_VIDEOHWACCEL 131 151 bool UIMachineSettingsDisplay::isAcceleration2DVideoSelected() const … … 133 153 return mCb2DVideo->isChecked(); 134 154 } 135 #endif 136 137 #ifdef VBOX_WITH_CRHGSMI 138 void UIMachineSettingsDisplay::setWddmMode(bool bWddm) 139 { 140 if (bWddm == m_bWddmMode) 141 return; 142 143 m_bWddmMode = bWddm; 144 checkVRAMRequirements(); 145 } 146 #endif 155 #endif /* VBOX_WITH_VIDEOHWACCEL */ 147 156 148 157 /* Load data to cashe from corresponding external object(s), … … 313 322 } 314 323 315 bool UIMachineSettingsDisplay::revalidate (QString &aWarning, QString & /* aTitle */) 316 { 317 /* Video RAM amount test */ 318 quint64 needBytes = VBoxGlobal::requiredVideoMemory (&m_machine, mSlMonitors->value()); 319 if ( vboxGlobal().shouldWarnAboutToLowVRAM(&m_machine) 320 && (quint64)mSlMemory->value() * _1M < needBytes) 321 { 322 aWarning = tr ( 323 "you have assigned less than <b>%1</b> of video memory which is " 324 "the minimum amount required to switch the virtual machine to " 325 "fullscreen or seamless mode.") 326 .arg (vboxGlobal().formatSize (needBytes, 0, VBoxDefs::FormatSize_RoundUp)); 327 } 328 #ifdef VBOX_WITH_VIDEOHWACCEL 329 else if (mCb2DVideo->isChecked()) 330 { 331 needBytes += VBoxGlobal::required2DOffscreenVideoMemory(); 332 if ((quint64) mSlMemory->value() * _1M < needBytes) 324 bool UIMachineSettingsDisplay::revalidate(QString &strWarning, QString & /* strTitle */) 325 { 326 /* Check if video RAM requirement changed first: */ 327 checkVRAMRequirements(); 328 329 /* Video RAM amount test: */ 330 if (shouldWeWarnAboutLowVideoMemory() && !m_guestOSType.isNull()) 331 { 332 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), mSlMonitors->value()); 333 334 /* Basic video RAM amount test: */ 335 if ((quint64)mSlMemory->value() * _1M < uNeedBytes) 333 336 { 334 aWarning = tr ( 335 "you have assigned less than <b>%1</b> of video memory which is " 336 "the minimum amount required for HD Video to be played efficiently.") 337 .arg (vboxGlobal().formatSize (needBytes, 0, VBoxDefs::FormatSize_RoundUp)); 337 strWarning = tr("you have assigned less than <b>%1</b> of video memory which is " 338 "the minimum amount required to switch the virtual machine to " 339 "fullscreen or seamless mode.") 340 .arg(vboxGlobal().formatSize(uNeedBytes, 0, VBoxDefs::FormatSize_RoundUp)); 341 return true; 338 342 } 339 } 340 #endif 341 #ifdef VBOX_WITH_CRHGSMI 342 else if (false) // m_bWddmMode && mCb3D->isChecked()) 343 { 344 int cVal = mSlMonitors->value(); 345 needBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(&m_machine, cVal); 346 needBytes = RT_MAX(needBytes, 128 * _1M); 347 needBytes = RT_MIN(needBytes, 256 * _1M); 348 if ((quint64) mSlMemory->value() * _1M < needBytes) 343 #ifdef VBOX_WITH_VIDEOHWACCEL 344 /* 2D acceleration video RAM amount test: */ 345 if (mCb2DVideo->isChecked() && m_f2DVideoAccelerationSupported) 349 346 { 350 aWarning = tr( 351 "You have 3D Acceleration enabled for a operation system which uses the WDDM video driver. " 352 "For maximal performance set the guest VRAM to at least <b>%1</b>." 353 ).arg (vboxGlobal().formatSize (needBytes, 0, VBoxDefs::FormatSize_RoundUp)); 347 uNeedBytes += VBoxGlobal::required2DOffscreenVideoMemory(); 348 if ((quint64)mSlMemory->value() * _1M < uNeedBytes) 349 { 350 strWarning = tr("you have assigned less than <b>%1</b> of video memory which is " 351 "the minimum amount required for HD Video to be played efficiently.") 352 .arg(vboxGlobal().formatSize(uNeedBytes, 0, VBoxDefs::FormatSize_RoundUp)); 353 return true; 354 } 354 355 } 355 } 356 #endif 357 checkVRAMRequirements(); 356 #endif /* VBOX_WITH_VIDEOHWACCEL */ 357 #if 0 358 # ifdef VBOX_WITH_CRHGSMI 359 if (mCb3D->isChecked() && m_fWddmModeSupported) 360 { 361 int cMonitorsCount = mSlMonitors->value(); 362 uNeedBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), cMonitorsCount); 363 uNeedBytes = RT_MAX(uNeedBytes, 128 * _1M); 364 uNeedBytes = RT_MIN(uNeedBytes, 256 * _1M); 365 if ((quint64)mSlMemory->value() * _1M < uNeedBytes) 366 { 367 strWarning = tr("you have 3D Acceleration enabled for a operation system which uses the WDDM video driver. " 368 "For maximal performance set the guest VRAM to at least <b>%1</b>.") 369 .arg(vboxGlobal().formatSize(uNeedBytes, 0, VBoxDefs::FormatSize_RoundUp)); 370 return true; 371 } 372 } 373 # endif /* VBOX_WITH_CRHGSMI */ 374 #endif /* 0 */ 375 } 376 377 /* Check mode availability: */ 378 #ifdef VBOX_WITH_VIDEOHWACCEL 379 /* 2D video acceleration is available for Windows guests only: */ 380 if (mCb2DVideo->isChecked() && !m_f2DVideoAccelerationSupported) 381 { 382 strWarning = tr("you have 2D Video Acceleration enabled. As 2D Video Acceleration " 383 "is supported for Windows guests only, this feature will be disabled."); 384 return true; 385 } 386 #endif /* VBOX_WITH_VIDEOHWACCEL */ 387 358 388 return true; 359 389 } … … 424 454 void UIMachineSettingsDisplay::checkVRAMRequirements() 425 455 { 426 int cVal = mSlMonitors->value(); 427 /* The memory requirements have changed too. */ 428 quint64 needMBytes = VBoxGlobal::requiredVideoMemory (&m_machine, cVal) / _1M; 429 /* Limit the maximum memory to save careless users from setting useless big values */ 430 #ifdef VBOX_WITH_VIDEOHWACCEL 431 if (mCb2DVideo->isChecked()) 432 { 433 needMBytes += VBoxGlobal::required2DOffscreenVideoMemory() / _1M; 434 } 435 #endif 436 #if 0 // def VBOX_WITH_CRHGSMI 437 if (m_bWddmMode && mCb3D->isChecked()) 438 { 439 needMBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(&m_machine, cVal) / _1M; 440 needMBytes = RT_MAX(needMBytes, 128); 441 needMBytes = RT_MIN(needMBytes, 256); 456 if (m_guestOSType.isNull()) 457 return; 458 459 /* Get monitors count and base video memory requirements: */ 460 int cMonitorsCount = mSlMonitors->value(); 461 quint64 uNeedMBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), cMonitorsCount) / _1M; 462 463 /* Initial values: */ 464 m_maxVRAMVisible = cMonitorsCount * 32; 465 if (m_maxVRAMVisible < 128) 466 m_maxVRAMVisible = 128; 467 if (m_maxVRAMVisible < m_initialVRAM) 468 m_maxVRAMVisible = m_initialVRAM; 469 470 #ifdef VBOX_WITH_VIDEOHWACCEL 471 if (mCb2DVideo->isChecked() && m_f2DVideoAccelerationSupported) 472 { 473 uNeedMBytes += VBoxGlobal::required2DOffscreenVideoMemory() / _1M; 474 } 475 #endif /* VBOX_WITH_VIDEOHWACCEL */ 476 #if 0 477 # ifdef VBOX_WITH_CRHGSMI 478 if (mCb3D->isChecked() && m_fWddmModeSupported) 479 { 480 uNeedMBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), cMonitorsCount) / _1M; 481 uNeedMBytes = RT_MAX(uNeedMBytes, 128); 482 uNeedMBytes = RT_MIN(uNeedMBytes, 256); 442 483 m_maxVRAMVisible = 256; 443 484 } 444 else 445 #endif 446 { 447 m_maxVRAMVisible = cVal * 32; 448 if (m_maxVRAMVisible < 128) 449 m_maxVRAMVisible = 128; 450 if (m_maxVRAMVisible < m_initialVRAM) 451 m_maxVRAMVisible = m_initialVRAM; 452 } 453 mSlMemory->setWarningHint (1, needMBytes); 454 mSlMemory->setPageStep (calcPageStep (m_maxVRAMVisible)); 455 mSlMemory->setMaximum (m_maxVRAMVisible); 456 mSlMemory->setOptimalHint (needMBytes, m_maxVRAMVisible); 457 mLeMemory->setValidator (new QIntValidator (m_minVRAM, m_maxVRAMVisible, this)); 458 mLbMemoryMax->setText (tr ("<qt>%1 MB</qt>").arg (m_maxVRAMVisible)); 459 /* ... or just call retranslateUi()? */ 485 # endif /* VBOX_WITH_CRHGSMI */ 486 #endif /* 0 */ 487 488 mSlMemory->setWarningHint(1, uNeedMBytes); 489 mSlMemory->setPageStep(calcPageStep(m_maxVRAMVisible)); 490 mSlMemory->setMaximum(m_maxVRAMVisible); 491 mSlMemory->setOptimalHint(uNeedMBytes, m_maxVRAMVisible); 492 mLeMemory->setValidator(new QIntValidator(m_minVRAM, m_maxVRAMVisible, this)); 493 mLbMemoryMax->setText(tr("<qt>%1 MB</qt>").arg(m_maxVRAMVisible)); 494 } 495 496 bool UIMachineSettingsDisplay::shouldWeWarnAboutLowVideoMemory() 497 { 498 bool fResult = true; 499 500 QStringList excludingOSList = QStringList() 501 << "Other" << "DOS" << "Netware" << "L4" << "QNX" << "JRockitVE"; 502 if (excludingOSList.contains(m_guestOSType.GetId())) 503 fResult = false; 504 505 return fResult; 460 506 } 461 507 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r37143 r37168 86 86 UIMachineSettingsDisplay(); 87 87 88 void setGuestOSType(CGuestOSType guestOSType); 89 88 90 #ifdef VBOX_WITH_VIDEOHWACCEL 89 91 bool isAcceleration2DVideoSelected() const; 90 #endif 91 92 #ifdef VBOX_WITH_CRHGSMI 93 void setWddmMode(bool bWddm); 94 #endif 92 #endif /* VBOX_WITH_VIDEOHWACCEL */ 95 93 96 94 protected: … … 130 128 131 129 void checkVRAMRequirements(); 130 bool shouldWeWarnAboutLowVideoMemory(); 132 131 133 132 void polishPage(); … … 135 134 QIWidgetValidator *mValidator; 136 135 136 /* Guest OS type id: */ 137 CGuestOSType m_guestOSType; 137 138 /* System minimum lower limit of VRAM (MiB). */ 138 139 int m_minVRAM; … … 144 145 /* Initial VRAM value when the dialog is opened. */ 145 146 int m_initialVRAM; 147 #ifdef VBOX_WITH_VIDEOHWACCEL 148 /* Specifies whether the guest OS supports 2D video-acceleration: */ 149 bool m_f2DVideoAccelerationSupported; 150 #endif /* VBOX_WITH_VIDEOHWACCEL */ 146 151 #ifdef VBOX_WITH_CRHGSMI 147 /* Specifies whether the guest os is wddm-capable: */148 bool m_ bWddmMode;149 #endif 152 /* Specifies whether the guest OS supports WDDM: */ 153 bool m_fWddmModeSupported; 154 #endif /* VBOX_WITH_CRHGSMI */ 150 155 151 156 /* Cache: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r37126 r37168 27 27 UIMachineSettingsGeneral::UIMachineSettingsGeneral() 28 28 : mValidator(0) 29 , m_fHWVirtExEnabled(false) 29 30 { 30 31 /* Apply UI decorations */ … … 48 49 } 49 50 51 CGuestOSType UIMachineSettingsGeneral::guestOSType() const 52 { 53 return mOSTypeSelector->type(); 54 } 55 56 void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled) 57 { 58 m_fHWVirtExEnabled = fEnabled; 59 } 60 50 61 bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const 51 62 { … … 58 69 return mOSTypeSelector->type().GetFamilyId() == "Windows"; 59 70 } 60 #endif 61 62 #ifdef VBOX_WITH_CRHGSMI 63 bool UIMachineSettingsGeneral::isWddmSupportedForOSType() const 64 { 65 const QString &strOsId = mOSTypeSelector->type().GetId(); 66 return strOsId == "WindowsVista" || strOsId == "Windows7"; 67 } 68 #endif 71 #endif /* VBOX_WITH_VIDEOHWACCEL */ 69 72 70 73 /* Load data to cashe from corresponding external object(s), … … 197 200 } 198 201 202 bool UIMachineSettingsGeneral::revalidate(QString &strWarning, QString& /* strTitle */) 203 { 204 if (is64BitOSTypeSelected() && !m_fHWVirtExEnabled) 205 strWarning = tr("you have selected a 64-bit guest OS type for this VM. As such guests " 206 "require hardware virtualization (VT-x/AMD-V), this feature will be enabled " 207 "automatically."); 208 return true; 209 } 210 199 211 void UIMachineSettingsGeneral::setOrderAfter (QWidget *aWidget) 200 212 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r37143 r37168 77 77 UIMachineSettingsGeneral(); 78 78 79 CGuestOSType guestOSType() const; 80 void setHWVirtExEnabled(bool fEnabled); 79 81 bool is64BitOSTypeSelected() const; 80 81 82 #ifdef VBOX_WITH_VIDEOHWACCEL 82 83 bool isWindowsOSTypeSelected() const; 83 #endif 84 85 #ifdef VBOX_WITH_CRHGSMI 86 bool isWddmSupportedForOSType() const; 87 #endif 84 #endif /* VBOX_WITH_VIDEOHWACCEL */ 88 85 89 86 protected: … … 107 104 108 105 void setValidator (QIWidgetValidator *aVal); 106 bool revalidate(QString &strWarning, QString &strTitle); 109 107 110 108 void setOrderAfter (QWidget *aWidget); … … 117 115 118 116 QIWidgetValidator *mValidator; 117 bool m_fHWVirtExEnabled; 119 118 120 119 /* Cache: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r37140 r37168 1766 1766 } 1767 1767 1768 KChipsetType UIMachineSettingsStorage::chipsetType() const1769 {1770 return mStorageModel->chipsetType();1771 }1772 1773 1768 void UIMachineSettingsStorage::setChipsetType(KChipsetType type) 1774 1769 { 1775 1770 mStorageModel->setChipsetType(type); 1776 1771 updateActionsState(); 1777 }1778 1779 QMap<KStorageBus, int> UIMachineSettingsStorage::currentControllerTypes() const1780 {1781 return mStorageModel->currentControllerTypes();1782 }1783 1784 QMap<KStorageBus, int> UIMachineSettingsStorage::maximumControllerTypes() const1785 {1786 return mStorageModel->maximumControllerTypes();1787 1772 } 1788 1773 … … 1797 1782 m_cache.clear(); 1798 1783 1799 /* Prepare storage data: */1800 UIDataSettingsMachineStorage storageData;1801 1802 1784 /* Gather storage data: */ 1803 storageData.m_strMachineId = m_machine.GetId(); 1785 m_strMachineId = m_machine.GetId(); 1786 m_strMachineSettingsFilePath = m_machine.GetSettingsFilePath(); 1787 m_strMachineGuestOSTypeId = m_machine.GetOSTypeId(); 1804 1788 1805 1789 /* For each controller: */ … … 1851 1835 } 1852 1836 1853 /* Cache storage data: */1854 m_cache.cacheInitialData(storageData);1855 1856 1837 /* Upload machine to data: */ 1857 1838 UISettingsPageMachine::uploadData(data); … … 1865 1846 mStorageModel->clear(); 1866 1847 1867 /* Get storage data from cache: */1868 const UIDataSettingsMachineStorage &storageData = m_cache.base();1869 1870 1848 /* Load storage data to page: */ 1871 mStorageModel->setMachineId( storageData.m_strMachineId);1849 mStorageModel->setMachineId(m_strMachineId); 1872 1850 1873 1851 /* For each storage controller: */ … … 1985 1963 } 1986 1964 1987 bool UIMachineSettingsStorage::revalidate (QString &aWarning, QString &) 1988 { 1965 bool UIMachineSettingsStorage::revalidate (QString &strWarning, QString& /* strTitle */) 1966 { 1967 /* Check controllers for name emptiness & coincidence. 1968 * Check attachments for the hd presence / uniqueness. */ 1989 1969 QModelIndex rootIndex = mStorageModel->root(); 1990 1970 QMap <QString, QString> config; … … 1998 1978 if (ctrName.isEmpty()) 1999 1979 { 2000 aWarning = tr("no name specified for controller at position <b>%1</b>.").arg(i + 1);2001 return aWarning.isNull();1980 strWarning = tr("no name specified for controller at position <b>%1</b>.").arg(i + 1); 1981 return false; 2002 1982 } 2003 1983 /* Check for name coincidence: */ 2004 1984 if (names.values().contains(ctrName)) 2005 1985 { 2006 aWarning = tr("controller at position <b>%1</b> uses the name that is "1986 strWarning = tr("controller at position <b>%1</b> uses the name that is " 2007 1987 "already used by controller at position <b>%2</b>.") 2008 1988 .arg(i + 1).arg(names.key(ctrName) + 1); 2009 return aWarning.isNull();1989 return false; 2010 1990 } 2011 1991 else names.insert(i, ctrName); … … 2021 2001 if (vboxGlobal().findMedium (key).isNull() && attDevice == KDeviceType_HardDisk) 2022 2002 { 2023 aWarning = tr ("no hard disk is selected for <i>%1</i>.").arg (value);2024 return aWarning.isNull();2003 strWarning = tr ("no hard disk is selected for <i>%1</i>.").arg (value); 2004 return false; 2025 2005 } 2026 2006 /* Check for coincidence */ 2027 2007 if (!vboxGlobal().findMedium (key).isNull() && config.contains (key)) 2028 2008 { 2029 aWarning = tr ("<i>%1</i> uses a medium that is already attached to <i>%2</i>.")2009 strWarning = tr ("<i>%1</i> uses a medium that is already attached to <i>%2</i>.") 2030 2010 .arg (value).arg (config [key]); 2031 return aWarning.isNull();2011 return false; 2032 2012 } 2033 2013 else config.insert (key, value); 2034 2014 } 2035 2015 } 2036 return aWarning.isNull(); 2016 2017 /* Check for excessive controllers on Storage page controllers list: */ 2018 QStringList excessiveList; 2019 QMap<KStorageBus, int> currentType = mStorageModel->currentControllerTypes(); 2020 QMap<KStorageBus, int> maximumType = mStorageModel->maximumControllerTypes(); 2021 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType) 2022 { 2023 if (currentType[(KStorageBus)iStorageBusType] > maximumType[(KStorageBus)iStorageBusType]) 2024 { 2025 QString strExcessiveRecord = QString("%1 (%2)"); 2026 strExcessiveRecord = strExcessiveRecord.arg(QString("<b>%1</b>").arg(vboxGlobal().toString((KStorageBus)iStorageBusType))); 2027 strExcessiveRecord = strExcessiveRecord.arg(maximumType[(KStorageBus)iStorageBusType] == 1 ? 2028 tr("at most one supported", "controller") : 2029 tr("up to %1 supported", "controllers").arg(maximumType[(KStorageBus)iStorageBusType])); 2030 excessiveList << strExcessiveRecord; 2031 } 2032 } 2033 if (!excessiveList.isEmpty()) 2034 { 2035 strWarning = tr("you are currently using more storage controllers than a %1 chipset supports. " 2036 "Please change the chipset type on the System settings page or reduce the number " 2037 "of the following storage controllers on the Storage settings page: %2.") 2038 .arg(vboxGlobal().toString(mStorageModel->chipsetType())) 2039 .arg(excessiveList.join(", ")); 2040 return false; 2041 } 2042 2043 return true; 2037 2044 } 2038 2045 … … 2515 2522 void UIMachineSettingsStorage::sltChooseExistingMedium() 2516 2523 { 2517 QString strMachineFolder(QFileInfo(m_ machine.GetSettingsFilePath()).absolutePath());2524 QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath()); 2518 2525 QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(m_pMediumIdHolder->type(), this, strMachineFolder); 2519 2526 if (!strMediumId.isNull()) … … 2865 2872 Assert(mStorageModel->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool()); 2866 2873 QString strControllerName(mStorageModel->data(index, StorageModel::R_CtrName).toString()); 2867 QString strMachineFolder(QFileInfo(m_ machine.GetSettingsFilePath()).absolutePath());2874 QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath()); 2868 2875 2869 2876 QString strMediumId; … … 2914 2921 UINewHDWzd dlg(this); 2915 2922 /* Initialize variables: */ 2916 CGuestOSType guestOSType = vboxGlobal().virtualBox().GetGuestOSType(m_ machine.GetOSTypeId());2923 CGuestOSType guestOSType = vboxGlobal().virtualBox().GetGuestOSType(m_strMachineGuestOSTypeId); 2917 2924 dlg.setRecommendedSize(guestOSType.GetRecommendedHDD()); 2918 QString strMachineSettingsFilepath = m_machine.GetSettingsFilePath(); 2919 QFileInfo fileInfo(strMachineSettingsFilepath); 2925 QFileInfo fileInfo(m_strMachineSettingsFilePath); 2920 2926 dlg.setDefaultPath(fileInfo.absolutePath()); 2921 2927 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r37143 r37168 608 608 { 609 609 /* Default constructor: */ 610 UIDataSettingsMachineStorage() 611 : m_strMachineId(QString()) {} 610 UIDataSettingsMachineStorage() {} 612 611 /* Operators: */ 613 bool operator==(const UIDataSettingsMachineStorage &other) const { return m_strMachineId == other.m_strMachineId; } 614 bool operator!=(const UIDataSettingsMachineStorage &other) const { return m_strMachineId != other.m_strMachineId; } 615 /* Variables: */ 616 QString m_strMachineId; 612 bool operator==(const UIDataSettingsMachineStorage& /* other */) const { return true; } 613 bool operator!=(const UIDataSettingsMachineStorage& /* other */) const { return false; } 617 614 }; 618 615 typedef UISettingsCachePool<UIDataSettingsMachineStorage, UICacheSettingsMachineStorageController> UICacheSettingsMachineStorage; … … 628 625 UIMachineSettingsStorage(); 629 626 630 KChipsetType chipsetType() const;631 627 void setChipsetType(KChipsetType type); 632 633 QMap<KStorageBus, int> currentControllerTypes() const;634 QMap<KStorageBus, int> maximumControllerTypes() const;635 628 636 629 signals: … … 742 735 QIWidgetValidator *mValidator; 743 736 737 QString m_strMachineId; 738 QString m_strMachineSettingsFilePath; 739 QString m_strMachineGuestOSTypeId; 740 744 741 StorageModel *mStorageModel; 745 742 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r37126 r37168 31 31 : mValidator(0) 32 32 , mMinGuestCPU(0), mMaxGuestCPU(0) 33 , m_fOHCIEnabled(false) 33 34 { 34 35 /* Apply UI decorations */ … … 148 149 } 149 150 150 int UIMachineSettingsSystem::cpuCount() const151 {152 return mSlCPU->value();153 }154 155 151 bool UIMachineSettingsSystem::isHIDEnabled() const 156 152 { … … 161 157 { 162 158 return (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt(); 159 } 160 161 void UIMachineSettingsSystem::setOHCIEnabled(bool fEnabled) 162 { 163 m_fOHCIEnabled = fEnabled; 163 164 } 164 165 … … 427 428 "you have assigned ICH9 chipset type to this VM. " 428 429 "It will not work properly unless the IO-APIC feature is also enabled. " 430 "This will be done automatically when you accept the VM Settings " 431 "by pressing the OK button."); 432 return true; 433 } 434 435 /* HID dependency from OHCI feature: */ 436 if (mCbUseAbsHID->isChecked() && !m_fOHCIEnabled) 437 { 438 aWarning = tr ( 439 "you have enabled a USB HID (Human Interface Device). " 440 "This will not work unless USB emulation is also enabled. " 429 441 "This will be done automatically when you accept the VM Settings " 430 442 "by pressing the OK button."); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r37143 r37168 106 106 107 107 bool isHWVirtExEnabled() const; 108 int cpuCount() const;109 108 bool isHIDEnabled() const; 110 109 KChipsetType chipsetType() const; 110 void setOHCIEnabled(bool fEnabled); 111 111 112 112 signals: … … 165 165 QList<KDeviceType> m_possibleBootItems; 166 166 167 bool m_fOHCIEnabled; 168 167 169 /* Cache: */ 168 170 UICacheSettingsMachineSystem m_cache; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp
r36334 r37168 740 740 /* VRAM size - select maximum between recommended and minimum for fullscreen */ 741 741 m_Machine.SetVRAMSize (qMax (type.GetRecommendedVRAM(), 742 (ULONG) (VBoxGlobal::requiredVideoMemory( &m_Machine) / _1M)));742 (ULONG) (VBoxGlobal::requiredVideoMemory(typeId) / _1M))); 743 743 744 744 /* Selecting recommended chipset type */
Note:
See TracChangeset
for help on using the changeset viewer.