Changeset 47944 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 21, 2013 7:36:55 AM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r47895 r47944 297 297 /* Perform page revalidation: */ 298 298 UISettingsPage *pSettingsPage = pValidator->page(); 299 QString strPageTitle = m_pSelector->itemTextByPage(pSettingsPage); 300 QString strMessageText; 301 bool fIsValid = pSettingsPage->validate(strMessageText, strPageTitle); 299 QList<UIValidationMessage> messages; 300 bool fIsValid = pSettingsPage->validate(messages); 302 301 303 302 /* Remember revalidation result: */ … … 305 304 306 305 /* Remember warning/error message: */ 307 if ( strMessageText.isEmpty())306 if (messages.isEmpty()) 308 307 pValidator->setLastMessage(QString()); 309 308 else 310 309 { 311 pValidator->setLastMessage(tr("<b>%1</b> page:<br><br>%2").arg(strPageTitle, strMessageText)); 310 /* Prepare title prefix: */ 311 // Its the only thing preventing us from moving this method to validator. 312 const QString strTitlePrefix(m_pSelector->itemTextByPage(pSettingsPage)); 313 /* Prepare text: */ 314 QStringList text; 315 foreach (const UIValidationMessage &message, messages) 316 { 317 /* Prepare title: */ 318 const QString strTitle(message.first.isNull() ? tr("<b>%1</b> page:").arg(strTitlePrefix) : 319 tr("<b>%1: %2</b> page:").arg(strTitlePrefix, message.first)); 320 /* Prepare paragraph: */ 321 QStringList paragraph(message.second); 322 paragraph.prepend(strTitle); 323 /* Format text for iterated message: */ 324 text << paragraph.join("<br>"); 325 } 326 /* Remember text: */ 327 pValidator->setLastMessage(text.join("<br><br>")); 312 328 LogRel(("Settings Dialog: Page validation FAILED: {%s}\n", 313 329 pValidator->lastMessage().toUtf8().constData())); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r47595 r47944 72 72 Q_DECLARE_METATYPE(UISettingsDataMachine); 73 73 74 /* Validation message type: */ 75 typedef QPair<QString, QStringList> UIValidationMessage; 76 74 77 /* Settings page base class: */ 75 78 class UISettingsPage : public QIWithRetranslateUI<QWidget> … … 96 99 void setValidator(UIPageValidator *pValidator); 97 100 void setValidatorBlocked(bool fIsValidatorBlocked) { m_fIsValidatorBlocked = fIsValidatorBlocked; } 98 virtual bool validate(Q String& /* strWarningText */, QString& /* strTitle*/) { return true; }101 virtual bool validate(QList<UIValidationMessage>& /* messages */) { return true; } 99 102 100 103 /* Navigation stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r47895 r47944 161 161 } 162 162 163 bool UIGlobalSettingsInput::validate(QString &strWarning, QString &strTitle) 164 { 165 /* Check for unique shortcuts: */ 163 bool UIGlobalSettingsInput::validate(QList<UIValidationMessage> &messages) 164 { 165 /* Pass by default: */ 166 bool fPass = true; 167 168 /* Check VirtualBox Manager page for unique shortcuts: */ 166 169 if (!m_pSelectorModel->isAllShortcutsUnique()) 167 170 { 168 strTitle += ": " + VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(UIHotKeyTableIndex_Selector)); 169 strWarning = tr("Some items have the same shortcuts assigned."); 170 return false; 171 } 172 else if (!m_pMachineModel->isAllShortcutsUnique()) 173 { 174 strTitle += ": " + VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(UIHotKeyTableIndex_Machine)); 175 strWarning = tr("Some items have the same shortcuts assigned."); 176 return false; 177 } 178 179 /* Pass by default: */ 180 return true; 171 UIValidationMessage message; 172 message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(UIHotKeyTableIndex_Selector)); 173 message.second << tr("Some items have the same shortcuts assigned."); 174 messages << message; 175 fPass = false; 176 } 177 178 /* Check Virtual Machine page for unique shortcuts: */ 179 if (!m_pMachineModel->isAllShortcutsUnique()) 180 { 181 UIValidationMessage message; 182 message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(UIHotKeyTableIndex_Machine)); 183 message.second << tr("Some items have the same shortcuts assigned."); 184 messages << message; 185 fPass = false; 186 } 187 188 /* Return result: */ 189 return fPass; 181 190 } 182 191 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
r47573 r47944 140 140 141 141 /* API: Validation stuff: */ 142 bool validate(Q String &strWarning, QString &strTitle);142 bool validate(QList<UIValidationMessage> &messages); 143 143 144 144 /* Helper: Navigation stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r47895 r47944 58 58 59 59 /* Validation stuff: */ 60 bool UIHostInterfaceItem::validate(QString &strWarning, QString&) 61 { 60 bool UIHostInterfaceItem::validate(QList<UIValidationMessage> &messages) 61 { 62 /* Pass by default: */ 63 bool fPass = true; 64 65 /* Prepare message: */ 66 UIValidationMessage message; 67 62 68 /* Host-only interface validation: */ 63 69 if (!m_data.m_interface.m_fDhcpClientEnabled) … … 67 73 QHostAddress(m_data.m_interface.m_strInterfaceAddress).protocol() != QAbstractSocket::IPv4Protocol)) 68 74 { 69 strWarning =UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid IPv4 address.").arg(text(0));70 returnfalse;75 message.second << UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid IPv4 address.").arg(text(0)); 76 fPass = false; 71 77 } 72 78 if (!m_data.m_interface.m_strInterfaceMask.isEmpty() && … … 74 80 QHostAddress(m_data.m_interface.m_strInterfaceMask).protocol() != QAbstractSocket::IPv4Protocol)) 75 81 { 76 strWarning =UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid IPv4 network mask.").arg(text(0));77 returnfalse;82 message.second << UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid IPv4 network mask.").arg(text(0)); 83 fPass = false; 78 84 } 79 85 if (m_data.m_interface.m_fIpv6Supported) … … 83 89 QHostAddress(m_data.m_interface.m_strInterfaceAddress6).protocol() != QAbstractSocket::IPv6Protocol)) 84 90 { 85 strWarning =UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid IPv6 address.").arg(text(0));86 returnfalse;91 message.second << UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid IPv6 address.").arg(text(0)); 92 fPass = false; 87 93 } 88 94 } … … 95 101 QHostAddress(m_data.m_dhcpserver.m_strDhcpServerAddress).protocol() != QAbstractSocket::IPv4Protocol) 96 102 { 97 strWarning =UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid DHCP server address.").arg(text(0));98 returnfalse;103 message.second << UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid DHCP server address.").arg(text(0)); 104 fPass = false; 99 105 } 100 106 if (QHostAddress(m_data.m_dhcpserver.m_strDhcpServerMask) == QHostAddress::Any || 101 107 QHostAddress(m_data.m_dhcpserver.m_strDhcpServerMask).protocol() != QAbstractSocket::IPv4Protocol) 102 108 { 103 strWarning =UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid DHCP server mask.").arg(text(0));104 returnfalse;109 message.second << UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid DHCP server mask.").arg(text(0)); 110 fPass = false; 105 111 } 106 112 if (QHostAddress(m_data.m_dhcpserver.m_strDhcpLowerAddress) == QHostAddress::Any || 107 113 QHostAddress(m_data.m_dhcpserver.m_strDhcpLowerAddress).protocol() != QAbstractSocket::IPv4Protocol) 108 114 { 109 strWarning =UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.").arg(text(0));110 returnfalse;115 message.second << UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.").arg(text(0)); 116 fPass = false; 111 117 } 112 118 if (QHostAddress(m_data.m_dhcpserver.m_strDhcpUpperAddress) == QHostAddress::Any || 113 119 QHostAddress(m_data.m_dhcpserver.m_strDhcpUpperAddress).protocol() != QAbstractSocket::IPv4Protocol) 114 120 { 115 strWarning = UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.").arg(text(0)); 116 return false; 117 } 118 } 119 return true; 121 message.second << UIGlobalSettingsNetwork::tr("The host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.").arg(text(0)); 122 fPass = false; 123 } 124 } 125 126 /* Serialize message: */ 127 if (!message.second.isEmpty()) 128 messages << message; 129 130 /* Return result: */ 131 return fPass; 120 132 } 121 133 … … 371 383 372 384 /* Validation processing: */ 373 bool UIGlobalSettingsNetwork::validate(Q String &strWarning, QString &strTitle)385 bool UIGlobalSettingsNetwork::validate(QList<UIValidationMessage> &messages) 374 386 { 375 387 /* Redirect validation to items: */ 376 388 UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem()); 377 return pItem ? pItem->validate( strWarning, strTitle) : true;389 return pItem ? pItem->validate(messages) : true; 378 390 } 379 391 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h
r47573 r47944 97 97 98 98 /* API: Validation stuff: */ 99 bool validate(Q String &strWarning, QString &strTitle);99 bool validate(QList<UIValidationMessage> &messages); 100 100 101 101 /* API: Update stuff: */ … … 164 164 165 165 /* API: Validation stuff: */ 166 bool validate(Q String &strWarning, QString &strTitle);166 bool validate(QList<UIValidationMessage> &messages); 167 167 168 168 /* Navigation stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
r47895 r47944 102 102 } 103 103 104 bool UIGlobalSettingsProxy::validate(Q String &strWarning, QString&)104 bool UIGlobalSettingsProxy::validate(QList<UIValidationMessage> &messages) 105 105 { 106 106 /* Pass if proxy is disabled: */ … … 108 108 return true; 109 109 110 /* Check for host/port values: */ 110 /* Pass by default: */ 111 bool fPass = true; 112 113 /* Prepare message: */ 114 UIValidationMessage message; 115 116 /* Check for host value: */ 111 117 if (m_pHostEditor->text().trimmed().isEmpty()) 112 118 { 113 strWarning = tr("No proxy host is currently specified."); 114 return false; 115 } 116 else if (m_pPortEditor->text().trimmed().isEmpty()) 117 { 118 strWarning = tr("No proxy port is currently specified."); 119 return false; 119 message.second << tr("No proxy host is currently specified."); 120 fPass = false; 120 121 } 121 122 122 /* Pass by default: */ 123 return true; 123 /* Check for port value: */ 124 if (m_pPortEditor->text().trimmed().isEmpty()) 125 { 126 message.second << tr("No proxy port is currently specified."); 127 fPass = false; 128 } 129 130 /* Serialize message: */ 131 if (!message.second.isEmpty()) 132 messages << message; 133 134 /* Return result: */ 135 return fPass; 124 136 } 125 137 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
r47573 r47944 62 62 63 63 /* API: Validation stuff: */ 64 bool validate(Q String &strWarning, QString &strTitle);64 bool validate(QList<UIValidationMessage> &messages); 65 65 66 66 /* Helper: Navigation stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r47895 r47944 301 301 } 302 302 303 bool UIMachineSettingsDisplay::validate(Q String &strWarning, QString&)303 bool UIMachineSettingsDisplay::validate(QList<UIValidationMessage> &messages) 304 304 { 305 305 /* Check if video RAM requirement changed first: */ 306 306 checkVRAMRequirements(); 307 307 308 if (m_pCheckbox3D->isChecked() && !vboxGlobal().is3DAvailable()) 308 /* Pass by default: */ 309 bool fPass = true; 310 311 /* Video tab: */ 309 312 { 310 strWarning = tr("The virtual machine is set to use hardware graphics acceleration. " 311 "However the host system does not currently provide this, " 312 "so you will not be able to start the machine."); 313 return true; 314 } 315 316 /* Video RAM amount test: */ 317 if (shouldWeWarnAboutLowVideoMemory() && !m_guestOSType.isNull()) 318 { 319 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), m_pEditorVideoScreenCount->value()); 320 321 /* Basic video RAM amount test: */ 322 if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes) 313 /* Prepare message: */ 314 UIValidationMessage message; 315 message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(0)); 316 317 /* 3D acceleration test: */ 318 if (m_pCheckbox3D->isChecked() && !vboxGlobal().is3DAvailable()) 323 319 { 324 strWarning = tr("The virtual machine is currently assigned less than <b>%1</b> of video memory " 325 "which is the minimum amount required to switch to fullscreen or seamless mode.") 326 .arg(vboxGlobal().formatSize(uNeedBytes, 0, FormatSize_RoundUp)); 327 return true; 320 message.second << tr("The virtual machine is set to use hardware graphics acceleration. " 321 "However the host system does not currently provide this, " 322 "so you will not be able to start the machine."); 328 323 } 329 #ifdef VBOX_WITH_VIDEOHWACCEL 330 /* 2D acceleration video RAM amount test: */331 if ( m_pCheckbox2DVideo->isChecked() && m_f2DVideoAccelerationSupported)324 325 /* Video RAM amount test: */ 326 if (shouldWeWarnAboutLowVideoMemory() && !m_guestOSType.isNull()) 332 327 { 333 uNeedBytes += VBoxGlobal::required2DOffscreenVideoMemory(); 328 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), m_pEditorVideoScreenCount->value()); 329 330 /* Basic video RAM amount test: */ 334 331 if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes) 335 332 { 336 strWarning = tr("The virtual machine is currently assigned less than <b>%1</b> of video memory " 337 "which is the minimum amount required for High Definition Video to be played efficiently.") 338 .arg(vboxGlobal().formatSize(uNeedBytes, 0, FormatSize_RoundUp)); 339 return true; 333 message.second << tr("The virtual machine is currently assigned less than <b>%1</b> of video memory " 334 "which is the minimum amount required to switch to fullscreen or seamless mode.") 335 .arg(vboxGlobal().formatSize(uNeedBytes, 0, FormatSize_RoundUp)); 340 336 } 341 } 337 #ifdef VBOX_WITH_VIDEOHWACCEL 338 /* 2D acceleration video RAM amount test: */ 339 else if (m_pCheckbox2DVideo->isChecked() && m_f2DVideoAccelerationSupported) 340 { 341 uNeedBytes += VBoxGlobal::required2DOffscreenVideoMemory(); 342 if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes) 343 { 344 message.second << tr("The virtual machine is currently assigned less than <b>%1</b> of video memory " 345 "which is the minimum amount required for High Definition Video to be played efficiently.") 346 .arg(vboxGlobal().formatSize(uNeedBytes, 0, FormatSize_RoundUp)); 347 } 348 } 342 349 #endif /* VBOX_WITH_VIDEOHWACCEL */ 343 350 #if 0 344 351 # ifdef VBOX_WITH_CRHGSMI 345 if (m_pCheckbox3D->isChecked() && m_fWddmModeSupported) 346 { 347 int cGuestScreenCount = m_pEditorVideoScreenCount->value(); 348 uNeedBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), cGuestScreenCount); 349 uNeedBytes = qMax(uNeedBytes, 128 * _1M); 350 uNeedBytes = qMin(uNeedBytes, 256 * _1M); 351 if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes) 352 /* 3D acceleration video RAM amount test: */ 353 else if (m_pCheckbox3D->isChecked() && m_fWddmModeSupported) 352 354 { 353 strWarning = tr("The virtual machine is set to use hardware graphics acceleration " 354 "and the operating system hint is set to Windows Vista or later. " 355 "For best performance you should set the machine's video memory to at least b>%1</b>.") 356 .arg(vboxGlobal().formatSize(uNeedBytes, 0, FormatSize_RoundUp)); 357 return true; 355 int cGuestScreenCount = m_pEditorVideoScreenCount->value(); 356 uNeedBytes += VBoxGlobal::required3DWddmOffscreenVideoMemory(m_guestOSType.GetId(), cGuestScreenCount); 357 uNeedBytes = qMax(uNeedBytes, 128 * _1M); 358 uNeedBytes = qMin(uNeedBytes, 256 * _1M); 359 if ((quint64)m_pEditorVideoMemorySize->value() * _1M < uNeedBytes) 360 { 361 message.second << tr("The virtual machine is set to use hardware graphics acceleration " 362 "and the operating system hint is set to Windows Vista or later. " 363 "For best performance you should set the machine's video memory to at least b>%1</b>.") 364 .arg(vboxGlobal().formatSize(uNeedBytes, 0, FormatSize_RoundUp)); 365 } 358 366 } 359 }360 367 # endif /* VBOX_WITH_CRHGSMI */ 361 368 #endif /* 0 */ 369 } 370 371 #ifdef VBOX_WITH_VIDEOHWACCEL 372 /* 2D video acceleration is available for Windows guests only: */ 373 if (m_pCheckbox2DVideo->isChecked() && !m_f2DVideoAccelerationSupported) 374 { 375 message.second << tr("The virtual machine is set to use Video Stream Acceleration. " 376 "As this feature only works with Windows guest systems it will be disabled."); 377 } 378 #endif /* VBOX_WITH_VIDEOHWACCEL */ 379 380 /* Serialize message: */ 381 if (!message.second.isEmpty()) 382 messages << message; 362 383 } 363 384 364 /* Check mode availability: */ 365 #ifdef VBOX_WITH_VIDEOHWACCEL 366 /* 2D video acceleration is available for Windows guests only: */ 367 if (m_pCheckbox2DVideo->isChecked() && !m_f2DVideoAccelerationSupported) 385 /* Remote Display tab: */ 368 386 { 369 strWarning = tr("The virtual machine is set to use Video Stream Acceleration. " 370 "As this feature only works with Windows guest systems it will be disabled."); 371 return true; 387 /* Prepare message: */ 388 UIValidationMessage message; 389 message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(1)); 390 391 /* Check VRDE server port: */ 392 if (m_pEditorRemoteDisplayPort->text().trimmed().isEmpty()) 393 { 394 message.second << tr("The VRDE server port value is not currently specified."); 395 fPass = false; 396 } 397 398 /* Check VRDE server timeout: */ 399 if (m_pEditorRemoteDisplayTimeout->text().trimmed().isEmpty()) 400 { 401 message.second << tr("The VRDE authentication timeout value is not currently specified."); 402 fPass = false; 403 } 404 405 /* Serialize message: */ 406 if (!message.second.isEmpty()) 407 messages << message; 372 408 } 373 #endif /* VBOX_WITH_VIDEOHWACCEL */ 374 375 /* Check VRDE server port: */ 376 if (m_pEditorRemoteDisplayPort->text().trimmed().isEmpty()) 377 { 378 strWarning = tr("The VRDE server port value is not currently specified."); 379 return false; 380 } 381 382 /* Check VRDE server timeout: */ 383 if (m_pEditorRemoteDisplayTimeout->text().trimmed().isEmpty()) 384 { 385 strWarning = tr("The VRDE authentication timeout value is not currently specified."); 386 return false; 387 } 388 389 /* Pass by default: */ 390 return true; 409 410 /* Return result: */ 411 return fPass; 391 412 } 392 413 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r47573 r47944 146 146 147 147 /* API: Validation stuff: */ 148 bool validate(Q String &strWarning, QString &strTitle);148 bool validate(QList<UIValidationMessage> &messages); 149 149 150 150 /* Helper: Navigation stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r47895 r47944 224 224 } 225 225 226 bool UIMachineSettingsGeneral::validate(QString &strWarning, QString&) 227 { 226 bool UIMachineSettingsGeneral::validate(QList<UIValidationMessage> &messages) 227 { 228 /* Pass by default: */ 229 bool fPass = true; 230 231 /* Prepare message: */ 232 UIValidationMessage message; 233 message.first = VBoxGlobal::removeAccelMark(mTwGeneral->tabText(0)); 234 228 235 /* VM name validation: */ 229 236 if (m_pNameAndSystemEditor->name().trimmed().isEmpty()) 230 237 { 231 strWarning =tr("No name specified for the virtual machine.");232 returnfalse;238 message.second << tr("No name specified for the virtual machine."); 239 fPass = false; 233 240 } 234 241 … … 236 243 if (is64BitOSTypeSelected() && !m_fHWVirtExEnabled) 237 244 { 238 strWarning = tr("The virtual machine operating system hint is set to a 64-bit type. " 239 "64-bit guest systems require hardware virtualization, " 240 "so this will be enabled automatically if you confirm the changes."); 241 return true; 245 message.second << tr("The virtual machine operating system hint is set to a 64-bit type. " 246 "64-bit guest systems require hardware virtualization, " 247 "so this will be enabled automatically if you confirm the changes."); 242 248 } 243 249 244 /* Pass by default: */ 245 return true; 250 /* Serialize message: */ 251 if (!message.second.isEmpty()) 252 messages << message; 253 254 /* Return result: */ 255 return fPass; 246 256 } 247 257 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r47573 r47944 107 107 108 108 /* API: Validation stuff: */ 109 bool validate(Q String &strWarning, QString &strTitle);109 bool validate(QList<UIValidationMessage> &messages); 110 110 111 111 void setOrderAfter (QWidget *aWidget); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r47895 r47944 163 163 } 164 164 165 bool UIMachineSettingsNetwork::validate(Q String &strWarning, QString &strTitle)165 bool UIMachineSettingsNetwork::validate(QList<UIValidationMessage> &messages) 166 166 { 167 167 /* Pass if adapter is disabled: */ … … 169 169 return true; 170 170 171 /* Pass by default: */ 172 bool fPass = true; 173 174 /* Prepare message: */ 175 UIValidationMessage message; 176 message.first = vboxGlobal().removeAccelMark(tabTitle()); 177 171 178 /* Validate alternatives: */ 172 bool fValid = true;173 179 switch (attachmentType()) 174 180 { … … 177 183 if (alternativeName().isNull()) 178 184 { 179 strWarning =tr("No bridged network adapter is currently selected.");180 f Valid= false;185 message.second << tr("No bridged network adapter is currently selected."); 186 fPass = false; 181 187 } 182 188 break; … … 186 192 if (alternativeName().isNull()) 187 193 { 188 strWarning =tr("No internal network name is currently specified.");189 f Valid= false;194 message.second << tr("No internal network name is currently specified."); 195 fPass = false; 190 196 } 191 197 break; … … 195 201 if (alternativeName().isNull()) 196 202 { 197 strWarning =tr("No host-only network adapter is currently selected.");198 f Valid= false;203 message.second << tr("No host-only network adapter is currently selected."); 204 fPass = false; 199 205 } 200 206 break; … … 204 210 if (alternativeName().isNull()) 205 211 { 206 strWarning =tr("No generic driver is currently selected.");207 f Valid= false;212 message.second << tr("No generic driver is currently selected."); 213 fPass = false; 208 214 } 209 215 break; … … 214 220 215 221 /* Validate MAC-address length: */ 216 if (fValid && m_pMACEditor->text().size() < 12) 217 { 218 strWarning = tr("The MAC address must be 12 hexadecimal digits long."); 219 fValid = false; 220 } 222 if (m_pMACEditor->text().size() < 12) 223 { 224 message.second << tr("The MAC address must be 12 hexadecimal digits long."); 225 fPass = false; 226 } 227 221 228 /* Make sure MAC-address is unicast: */ 222 if ( fValid &&m_pMACEditor->text().size() >= 2)229 if (m_pMACEditor->text().size() >= 2) 223 230 { 224 231 QRegExp validator("^[0-9A-Fa-f][02468ACEace]"); 225 232 if (validator.indexIn(m_pMACEditor->text()) != 0) 226 233 { 227 strWarning = tr("The second digit in the MAC address may not be odd as only unicast addresses are allowed."); 228 fValid = false; 229 } 230 } 231 232 if (!fValid) 233 strTitle += ": " + vboxGlobal().removeAccelMark(tabTitle()); 234 235 return fValid; 234 message.second << tr("The second digit in the MAC address may not be odd as only unicast addresses are allowed."); 235 fPass = false; 236 } 237 } 238 239 /* Serialize message: */ 240 if (!message.second.isEmpty()) 241 messages << message; 242 243 /* Return result: */ 244 return fPass; 236 245 } 237 246 … … 938 947 } 939 948 940 bool UIMachineSettingsNetworkPage::validate(Q String &strWarning, QString &strTitle)949 bool UIMachineSettingsNetworkPage::validate(QList<UIValidationMessage> &messages) 941 950 { 942 951 /* Pass by default: */ 943 952 bool fValid = true; 944 953 945 /* Delegate validation to adapter s: */954 /* Delegate validation to adapter tabs: */ 946 955 for (int i = 0; i < m_pTwAdapters->count(); ++i) 947 956 { 948 957 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(i)); 949 Assert (pTab);950 fValid = pTab->validate(strWarning, strTitle);951 if (!fValid)952 break;953 } 954 958 AssertMsg(pTab, ("Can't get adapter tab!\n")); 959 if (!pTab->validate(messages)) 960 fValid = false; 961 } 962 963 /* Return result: */ 955 964 return fValid; 956 965 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r47573 r47944 110 110 111 111 /* API: Validation stuff: */ 112 bool validate(Q String &strWarning, QString &strTitle);112 bool validate(QList<UIValidationMessage> &messages); 113 113 114 114 /* Navigation stuff: */ … … 207 207 208 208 /* API: Validation stuff: */ 209 bool validate(Q String &strWarning, QString &strTitle);209 bool validate(QList<UIValidationMessage> &messages); 210 210 211 211 /* Translation stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r47895 r47944 325 325 } 326 326 327 bool UIMachineSettingsParallelPage::validate(QString &strWarning, QString &strTitle) 328 { 329 bool valid = true; 327 bool UIMachineSettingsParallelPage::validate(QList<UIValidationMessage> &messages) 328 { 329 /* Pass by default: */ 330 bool fPass = true; 331 332 /* Validation stuff: */ 330 333 QList<QPair<QString, QString> > ports; 331 334 QStringList paths; 332 335 333 int index = 0; 334 for (; index < mTabWidget->count(); ++ index) 335 { 336 QWidget *tab = mTabWidget->widget (index); 337 UIMachineSettingsParallel *page = 338 static_cast<UIMachineSettingsParallel*> (tab); 339 340 if (!page->mGbParallel->isChecked()) 336 /* Validate all the ports: */ 337 for (int iIndex = 0; iIndex < mTabWidget->count(); ++iIndex) 338 { 339 /* Get current tab/page: */ 340 QWidget *pTab = mTabWidget->widget(iIndex); 341 UIMachineSettingsParallel *pPage = static_cast<UIMachineSettingsParallel*> (pTab); 342 if (!pPage->mGbParallel->isChecked()) 341 343 continue; 342 344 343 /* Check the predefined port attributes uniqueness: */ 344 { 345 QString strIRQ = page->mLeIRQ->text(); 346 QString strIOPort = page->mLeIOPort->text(); 347 QPair<QString, QString> pair(strIRQ, strIOPort); 348 valid = !strIRQ.isEmpty() && !strIOPort.isEmpty() && !ports.contains(pair); 349 if (!valid) 350 { 351 if (strIRQ.isEmpty()) 352 strWarning = tr("No IRQ is currently specified."); 353 else if (strIOPort.isEmpty()) 354 strWarning = tr("No I/O port is currently specified."); 355 else 356 strWarning = tr("Two or more ports have the same settings."); 357 strTitle += ": " + 358 vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(tab))); 359 } 360 ports << pair; 361 } 362 363 /* Check the port path emptiness & unicity */ 364 { 365 QString path = page->mLePath->text(); 366 valid = !path.isEmpty() && !paths.contains (path); 367 if (!valid) 368 { 369 strWarning = path.isEmpty() ? 370 tr("No port path is currently specified.") : 371 tr("There are currently duplicate port paths specified."); 372 strTitle += ": " + 373 vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab))); 374 break; 375 } 376 paths << path; 377 } 378 } 379 380 return valid; 345 /* Prepare message: */ 346 UIValidationMessage message; 347 message.first = vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(pTab))); 348 349 /* Check the port attribute emptiness & uniqueness: */ 350 const QString strIRQ(pPage->mLeIRQ->text()); 351 const QString strIOPort(pPage->mLeIOPort->text()); 352 const QString strPath(pPage->mLePath->text()); 353 QPair<QString, QString> pair(strIRQ, strIOPort); 354 355 if (strIRQ.isEmpty()) 356 { 357 message.second << tr("No IRQ is currently specified."); 358 fPass = false; 359 } 360 if (strIOPort.isEmpty()) 361 { 362 message.second << tr("No I/O port is currently specified."); 363 fPass = false; 364 } 365 if (ports.contains(pair)) 366 { 367 message.second << tr("Two or more ports have the same settings."); 368 fPass = false; 369 } 370 if (strPath.isEmpty()) 371 { 372 message.second << tr("No port path is currently specified."); 373 fPass = false; 374 } 375 if (paths.contains(strPath)) 376 { 377 message.second << tr("There are currently duplicate port paths specified."); 378 fPass = false; 379 } 380 381 ports << pair; 382 paths << strPath; 383 384 /* Serialize message: */ 385 if (!message.second.isEmpty()) 386 messages << message; 387 } 388 389 /* Return result: */ 390 return fPass; 381 391 } 382 392 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h
r47573 r47944 136 136 137 137 /* API: Validation stuff: */ 138 bool validate(Q String &strWarning, QString &strTitle);138 bool validate(QList<UIValidationMessage> &messages); 139 139 140 140 void retranslateUi(); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r47895 r47944 368 368 } 369 369 370 bool UIMachineSettingsSerialPage::validate(QString &strWarning, QString &strTitle) 371 { 372 bool valid = true; 370 bool UIMachineSettingsSerialPage::validate(QList<UIValidationMessage> &messages) 371 { 372 /* Pass by default: */ 373 bool fPass = true; 374 375 /* Validation stuff: */ 373 376 QList<QPair<QString, QString> > ports; 374 377 QStringList paths; 375 378 376 int index = 0; 377 for (; index < mTabWidget->count(); ++ index) 378 { 379 QWidget *tab = mTabWidget->widget (index); 380 UIMachineSettingsSerial *page = 381 static_cast<UIMachineSettingsSerial*> (tab); 382 379 /* Validate all the ports: */ 380 for (int iIndex = 0; iIndex < mTabWidget->count(); ++iIndex) 381 { 382 /* Get current tab/page: */ 383 QWidget *pTab = mTabWidget->widget(iIndex); 384 UIMachineSettingsSerial *page = static_cast<UIMachineSettingsSerial*>(pTab); 383 385 if (!page->mGbSerial->isChecked()) 384 386 continue; 385 387 386 /* Check the predefined port attributes uniqueness: */ 387 { 388 QString strIRQ = page->mLeIRQ->text(); 389 QString strIOPort = page->mLeIOPort->text(); 390 QPair<QString, QString> pair(strIRQ, strIOPort); 391 valid = !strIRQ.isEmpty() && !strIOPort.isEmpty() && !ports.contains(pair); 392 if (!valid) 388 /* Prepare message: */ 389 UIValidationMessage message; 390 message.first = vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(pTab))); 391 392 /* Check the port attribute emptiness & uniqueness: */ 393 const QString strIRQ(page->mLeIRQ->text()); 394 const QString strIOPort(page->mLeIOPort->text()); 395 QPair<QString, QString> pair(strIRQ, strIOPort); 396 397 if (strIRQ.isEmpty()) 398 { 399 message.second << tr("No IRQ is currently specified."); 400 fPass = false; 401 } 402 if (strIOPort.isEmpty()) 403 { 404 message.second << tr("No I/O port is currently specified."); 405 fPass = false; 406 } 407 if (ports.contains(pair)) 408 { 409 message.second << tr("Two or more ports have the same settings."); 410 fPass = false; 411 } 412 413 ports << pair; 414 415 KPortMode mode = gpConverter->fromString<KPortMode>(page->mCbMode->currentText()); 416 if (mode != KPortMode_Disconnected) 417 { 418 const QString strPath(page->mLePath->text()); 419 420 if (strPath.isEmpty()) 393 421 { 394 if (strIRQ.isEmpty()) 395 strWarning = tr("No IRQ is currently specified."); 396 else if (strIOPort.isEmpty()) 397 strWarning = tr("No I/O port is currently specified."); 398 else 399 strWarning = tr("Two or more ports have the same settings."); 400 strTitle += ": " + 401 vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(tab))); 422 message.second << tr("No port path is currently specified."); 423 fPass = false; 402 424 } 403 ports << pair; 404 } 405 406 /* Check the port path emptiness & unicity */ 407 KPortMode mode = 408 gpConverter->fromString<KPortMode> (page->mCbMode->currentText()); 409 if (mode != KPortMode_Disconnected) 410 { 411 QString path = page->mLePath->text(); 412 valid = !path.isEmpty() && !paths.contains (path); 413 if (!valid) 425 if (paths.contains(strPath)) 414 426 { 415 if (!page->mGbSerial->isChecked()) 416 page->mCbMode->setCurrentIndex (KPortMode_Disconnected); 417 else 418 { 419 strWarning = path.isEmpty() ? 420 tr("No port path is currently specified.") : 421 tr("There are currently duplicate port paths specified."); 422 strTitle += ": " + 423 vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab))); 424 break; 425 } 427 message.second << tr("There are currently duplicate port paths specified."); 428 fPass = false; 426 429 } 427 paths << path; 428 } 429 } 430 431 return valid; 430 431 paths << strPath; 432 } 433 434 /* Serialize message: */ 435 if (!message.second.isEmpty()) 436 messages << message; 437 } 438 439 /* Return result: */ 440 return fPass; 432 441 } 433 442 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
r47573 r47944 143 143 144 144 /* API: Validation stuff: */ 145 bool validate(Q String &strWarning, QString &strTitle);145 bool validate(QList<UIValidationMessage> &messages); 146 146 147 147 void retranslateUi(); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r47895 r47944 2104 2104 } 2105 2105 2106 bool UIMachineSettingsStorage::validate(QString &strWarning, QString&) 2107 { 2106 bool UIMachineSettingsStorage::validate(QList<UIValidationMessage> &messages) 2107 { 2108 /* Pass by default: */ 2109 bool fPass = true; 2110 2111 /* Prepare message: */ 2112 UIValidationMessage message; 2113 2108 2114 /* Check controllers for name emptiness & coincidence. 2109 2115 * Check attachments for the hd presence / uniqueness. */ … … 2116 2122 QModelIndex ctrIndex = rootIndex.child (i, 0); 2117 2123 QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString(); 2124 2118 2125 /* Check for name emptiness: */ 2119 2126 if (ctrName.isEmpty()) 2120 2127 { 2121 strWarning =tr("No name is currently specified for the controller at position <b>%1</b>.").arg(i + 1);2122 returnfalse;2128 message.second << tr("No name is currently specified for the controller at position <b>%1</b>.").arg(i + 1); 2129 fPass = false; 2123 2130 } 2124 2131 /* Check for name coincidence: */ 2125 2132 if (names.values().contains(ctrName)) 2126 2133 { 2127 strWarning = tr("The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.") 2128 .arg(i + 1).arg(names.key(ctrName) + 1); 2129 return false; 2130 } 2131 else names.insert(i, ctrName); 2134 message.second << tr("The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.") 2135 .arg(i + 1).arg(names.key(ctrName) + 1); 2136 fPass = false; 2137 } 2138 else 2139 names.insert(i, ctrName); 2140 2132 2141 /* For each attachment: */ 2133 2142 for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j) … … 2138 2147 QString key (mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString()); 2139 2148 QString value (QString ("%1 (%2)").arg (ctrName, gpConverter->toString (attSlot))); 2140 /* Check for emptiness */2149 /* Check for emptiness: */ 2141 2150 if (vboxGlobal().findMedium (key).isNull() && attDevice == KDeviceType_HardDisk) 2142 2151 { 2143 strWarning =tr("No hard disk is selected for <i>%1</i>.").arg (value);2144 returnfalse;2152 message.second << tr("No hard disk is selected for <i>%1</i>.").arg (value); 2153 fPass = false; 2145 2154 } 2146 /* Check for coincidence */2155 /* Check for coincidence: */ 2147 2156 if (!vboxGlobal().findMedium (key).isNull() && config.contains (key)) 2148 2157 { 2149 strWarning =tr("<i>%1</i> is using a disk that is already attached to <i>%2</i>.")2150 .arg (value).arg (config [key]);2151 returnfalse;2158 message.second << tr("<i>%1</i> is using a disk that is already attached to <i>%2</i>.") 2159 .arg (value).arg (config [key]); 2160 fPass = false; 2152 2161 } 2153 else config.insert (key, value); 2162 else 2163 config.insert (key, value); 2154 2164 } 2155 2165 } … … 2173 2183 if (!excessiveList.isEmpty()) 2174 2184 { 2175 strWarning = tr("The machine currently has more storage controllers assigned than a %1 chipset supports. " 2176 "Please change the chipset type on the System settings page or reduce the number " 2177 "of the following storage controllers on the Storage settings page: %2") 2178 .arg(gpConverter->toString(mStorageModel->chipsetType())) 2179 .arg(excessiveList.join(", ")); 2180 return false; 2181 } 2182 2183 /* Pass by default: */ 2184 return true; 2185 message.second << tr("The machine currently has more storage controllers assigned than a %1 chipset supports. " 2186 "Please change the chipset type on the System settings page or reduce the number " 2187 "of the following storage controllers on the Storage settings page: %2") 2188 .arg(gpConverter->toString(mStorageModel->chipsetType())) 2189 .arg(excessiveList.join(", ")); 2190 fPass = false; 2191 } 2192 2193 /* Serialize message: */ 2194 if (!message.second.isEmpty()) 2195 messages << message; 2196 2197 /* Return result: */ 2198 return fPass; 2185 2199 } 2186 2200 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r47573 r47944 674 674 675 675 /* API: Validation stuff: */ 676 bool validate(Q String &strWarning, QString &strTitle);676 bool validate(QList<UIValidationMessage> &messages); 677 677 678 678 void retranslateUi(); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r47902 r47944 285 285 } 286 286 287 bool UIMachineSettingsSystem::validate(QString &strWarning, QString&) 288 { 289 /* RAM amount test: */ 290 ulong uFullSize = vboxGlobal().host().GetMemorySize(); 291 if (m_pSliderMemorySize->value() > (int)m_pSliderMemorySize->maxRAMAlw()) 292 { 293 strWarning = tr( 294 "More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. " 295 "Not enough memory is left for the host operating system. Please select a smaller amount.") 296 .arg((unsigned)qRound((double)m_pSliderMemorySize->maxRAMAlw() / uFullSize * 100.0)) 297 .arg(vboxGlobal().formatSize((uint64_t)uFullSize * _1M)); 298 return false; 299 } 300 if (m_pSliderMemorySize->value() > (int)m_pSliderMemorySize->maxRAMOpt()) 301 { 302 strWarning = tr( 303 "More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. " 304 "There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.") 305 .arg((unsigned)qRound((double)m_pSliderMemorySize->maxRAMOpt() / uFullSize * 100.0)) 306 .arg(vboxGlobal().formatSize((uint64_t)uFullSize * _1M)); 307 return true; 308 } 309 310 /* VCPU amount test: */ 311 int cTotalCPUs = vboxGlobal().host().GetProcessorOnlineCount(); 312 if (m_pSliderCPUCount->value() > 2 * cTotalCPUs) 313 { 314 strWarning = tr( 315 "For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number " 316 "of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.") 317 .arg(cTotalCPUs); 318 return false; 319 } 320 if (m_pSliderCPUCount->value() > cTotalCPUs) 321 { 322 strWarning = tr( 323 "More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). " 324 "This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.") 325 .arg(cTotalCPUs); 326 return true; 327 } 328 329 /* VCPU IO-APIC test: */ 330 if (m_pSliderCPUCount->value() > 1 && !m_pCheckBoxApic->isChecked()) 331 { 332 strWarning = tr( 333 "The IO APIC feature is not currently enabled in the Motherboard section of the System page. " 334 "This is needed in order to support more than one virtual processor. " 335 "It will be done automatically if you confirm your changes."); 336 return true; 337 } 338 339 /* VCPU VT-x/AMD-V test: */ 340 if (m_pSliderCPUCount->value() > 1 && !m_pCheckBoxVirtualization->isChecked()) 341 { 342 strWarning = tr( 343 "Hardware virtualization is not currently enabled in the Acceleration section of the System page. " 344 "This is needed in order to support more than one virtual processor. " 345 "It will be done automatically if you confirm your changes."); 346 return true; 347 } 348 349 /* CPU execution cap is low: */ 350 if (m_pSliderCPUExecCap->value() < (int)m_uMedGuestCPUExecCap) 351 { 352 strWarning = tr( 353 "The processor execution cap is set to a low value. This may make the machine feel slow to respond."); 354 return true; 355 } 356 357 /* Chipset type & IO-APIC test: */ 358 if ((KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt() == KChipsetType_ICH9 && !m_pCheckBoxApic->isChecked()) 359 { 360 strWarning = tr( 361 "The I/O APIC feature is not currently enabled in the Motherboard section of the System page. " 362 "This is needed in order to support a chip set of type ICH9. " 363 "It will be done automatically if you confirm your changes."); 364 return true; 365 } 366 367 /* HID dependency from OHCI feature: */ 368 if (isHIDEnabled() && !m_fOHCIEnabled) 369 { 370 strWarning = tr( 371 "USB controller emulation is not currently enabled on the USB page. " 372 "This is needed to support an emulated USB input device. " 373 "It will be done automatically if you confirm your changes."); 374 return true; 375 } 376 377 return true; 287 bool UIMachineSettingsSystem::validate(QList<UIValidationMessage> &messages) 288 { 289 /* Pass by default: */ 290 bool fPass = true; 291 292 /* Motherboard tab: */ 293 { 294 /* Prepare message: */ 295 UIValidationMessage message; 296 message.first = VBoxGlobal::removeAccelMark(m_pTabWidgetSystem->tabText(0)); 297 298 /* RAM amount test: */ 299 ulong uFullSize = vboxGlobal().host().GetMemorySize(); 300 if (m_pSliderMemorySize->value() > (int)m_pSliderMemorySize->maxRAMAlw()) 301 { 302 message.second << tr( 303 "More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. " 304 "Not enough memory is left for the host operating system. Please select a smaller amount.") 305 .arg((unsigned)qRound((double)m_pSliderMemorySize->maxRAMAlw() / uFullSize * 100.0)) 306 .arg(vboxGlobal().formatSize((uint64_t)uFullSize * _1M)); 307 fPass = false; 308 } 309 else if (m_pSliderMemorySize->value() > (int)m_pSliderMemorySize->maxRAMOpt()) 310 { 311 message.second << tr( 312 "More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. " 313 "There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.") 314 .arg((unsigned)qRound((double)m_pSliderMemorySize->maxRAMOpt() / uFullSize * 100.0)) 315 .arg(vboxGlobal().formatSize((uint64_t)uFullSize * _1M)); 316 } 317 318 /* Chipset type vs IO-APIC test: */ 319 if ((KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt() == KChipsetType_ICH9 && !m_pCheckBoxApic->isChecked()) 320 { 321 message.second << tr( 322 "The I/O APIC feature is not currently enabled in the Motherboard section of the System page. " 323 "This is needed in order to support a chip set of type ICH9. " 324 "It will be done automatically if you confirm your changes."); 325 } 326 327 /* HID vs OHCI test: */ 328 if (isHIDEnabled() && !m_fOHCIEnabled) 329 { 330 message.second << tr( 331 "USB controller emulation is not currently enabled on the USB page. " 332 "This is needed to support an emulated USB input device. " 333 "It will be done automatically if you confirm your changes."); 334 } 335 336 /* Serialize message: */ 337 if (!message.second.isEmpty()) 338 messages << message; 339 } 340 341 /* CPU tab: */ 342 { 343 /* Prepare message: */ 344 UIValidationMessage message; 345 message.first = VBoxGlobal::removeAccelMark(m_pTabWidgetSystem->tabText(1)); 346 347 /* VCPU amount test: */ 348 int cTotalCPUs = vboxGlobal().host().GetProcessorOnlineCount(); 349 if (m_pSliderCPUCount->value() > 2 * cTotalCPUs) 350 { 351 message.second << tr( 352 "For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number " 353 "of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.") 354 .arg(cTotalCPUs); 355 fPass = false; 356 } 357 else if (m_pSliderCPUCount->value() > cTotalCPUs) 358 { 359 message.second << tr( 360 "More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). " 361 "This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.") 362 .arg(cTotalCPUs); 363 } 364 365 /* VCPU vs IO-APIC test: */ 366 if (m_pSliderCPUCount->value() > 1 && !m_pCheckBoxApic->isChecked()) 367 { 368 message.second << tr( 369 "The IO APIC feature is not currently enabled in the Motherboard section of the System page. " 370 "This is needed in order to support more than one virtual processor. " 371 "It will be done automatically if you confirm your changes."); 372 } 373 374 /* VCPU vs VT-x/AMD-V test: */ 375 if (m_pSliderCPUCount->value() > 1 && !m_pCheckBoxVirtualization->isChecked()) 376 { 377 message.second << tr( 378 "Hardware virtualization is not currently enabled in the Acceleration section of the System page. " 379 "This is needed in order to support more than one virtual processor. " 380 "It will be done automatically if you confirm your changes."); 381 } 382 383 /* CPU execution cap test: */ 384 if (m_pSliderCPUExecCap->value() < (int)m_uMedGuestCPUExecCap) 385 { 386 message.second << tr( 387 "The processor execution cap is set to a low value. This may make the machine feel slow to respond."); 388 } 389 390 /* Serialize message: */ 391 if (!message.second.isEmpty()) 392 messages << message; 393 } 394 395 /* Return result: */ 396 return fPass; 378 397 } 379 398 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r47573 r47944 153 153 154 154 /* API: Validation stuff: */ 155 bool validate(Q String &strWarning, QString &strTitle);155 bool validate(QList<UIValidationMessage> &messages); 156 156 157 157 /* Helper: Navigation stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r47594 r47944 424 424 } 425 425 426 bool UIMachineSettingsUSB::validate(QString &strWarningText, QString&) 427 { 428 NOREF(strWarningText); 426 bool UIMachineSettingsUSB::validate(QList<UIValidationMessage> &messages) 427 { 428 Q_UNUSED(messages); 429 430 /* Pass by default: */ 431 bool fPass = true; 429 432 430 433 #ifdef VBOX_WITH_EXTPACK … … 433 436 if (mGbUSB->isChecked() && mCbUSB2->isChecked() && (extPack.isNull() || !extPack.GetUsable())) 434 437 { 435 strWarningText = tr("USB 2.0 is currently enabled for this virtual machine. " 436 "However, this requires the <b>%1</b> to be installed. " 437 "Please install the Extension Pack from the VirtualBox download site. " 438 "After this you will be able to re-enable USB 2.0. " 439 "It will be disabled in the meantime unless you cancel the current settings changes.") 440 .arg(GUI_ExtPackName); 438 /* Prepare message: */ 439 UIValidationMessage message; 440 message.second << tr("USB 2.0 is currently enabled for this virtual machine. " 441 "However, this requires the <b>%1</b> to be installed. " 442 "Please install the Extension Pack from the VirtualBox download site. " 443 "After this you will be able to re-enable USB 2.0. " 444 "It will be disabled in the meantime unless you cancel the current settings changes.") 445 .arg(GUI_ExtPackName); 446 /* Serialize message: */ 447 if (!message.second.isEmpty()) 448 messages << message; 449 /* Show message-center warning: */ 441 450 msgCenter().warnAboutUnsupportedUSB2(GUI_ExtPackName, this); 451 /* Disable USB2.0 if enabled: */ 442 452 mCbUSB2->setChecked(false); 443 return true;444 453 } 445 454 #endif /* VBOX_WITH_EXTPACK */ 446 455 447 /* Pass by default: */448 return true;456 /* Return result: */ 457 return fPass; 449 458 } 450 459 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
r47594 r47944 143 143 144 144 /* API: Validation stuff: */ 145 bool validate(Q String &strWarningText, QString &strTitle);145 bool validate(QList<UIValidationMessage> &messages); 146 146 147 147 void setOrderAfter (QWidget *aWidget);
Note:
See TracChangeset
for help on using the changeset viewer.