Changeset 94667 in vbox
- Timestamp:
- Apr 21, 2022 11:31:58 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 151031
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r94333 r94667 93 93 bool UIMachineSettingsAudio::changed() const 94 94 { 95 return m_pCache ->wasChanged();95 return m_pCache ? m_pCache->wasChanged() : false; 96 96 } 97 97 98 98 void UIMachineSettingsAudio::loadToCacheFrom(QVariant &data) 99 99 { 100 /* Sanity check: */ 101 if (!m_pCache) 102 return; 103 100 104 /* Fetch data to machine: */ 101 105 UISettingsPageMachine::fetchData(data); … … 104 108 m_pCache->clear(); 105 109 106 /* Prepare old audiodata: */110 /* Prepare old data: */ 107 111 UIDataSettingsMachineAudio oldAudioData; 108 112 … … 111 115 if (!comAdapter.isNull()) 112 116 { 113 /* Gather old audiodata: */117 /* Gather old data: */ 114 118 oldAudioData.m_fAudioEnabled = comAdapter.GetEnabled(); 115 119 oldAudioData.m_audioDriverType = comAdapter.GetAudioDriver(); … … 119 123 } 120 124 121 /* Cache old audiodata: */125 /* Cache old data: */ 122 126 m_pCache->cacheInitialData(oldAudioData); 123 127 … … 128 132 void UIMachineSettingsAudio::getFromCache() 129 133 { 130 /* Get old audio data from cache: */ 134 /* Sanity check: */ 135 if (!m_pCache) 136 return; 137 138 /* Get old data from cache: */ 131 139 const UIDataSettingsMachineAudio &oldAudioData = m_pCache->base(); 132 140 133 /* Load old audiodata from cache: */141 /* Load old data from cache: */ 134 142 m_pCheckBoxAudio->setChecked(oldAudioData.m_fAudioEnabled); 135 m_pEditorAudioHostDriver->setValue(oldAudioData.m_audioDriverType); 136 m_pEditorAudioController->setValue(oldAudioData.m_audioControllerType); 137 m_pEditorAudioFeatures->setEnableOutput(oldAudioData.m_fAudioOutputEnabled); 138 m_pEditorAudioFeatures->setEnableInput(oldAudioData.m_fAudioInputEnabled); 143 if (m_pEditorAudioHostDriver) 144 m_pEditorAudioHostDriver->setValue(oldAudioData.m_audioDriverType); 145 if (m_pEditorAudioController) 146 m_pEditorAudioController->setValue(oldAudioData.m_audioControllerType); 147 if (m_pEditorAudioFeatures) 148 { 149 m_pEditorAudioFeatures->setEnableOutput(oldAudioData.m_fAudioOutputEnabled); 150 m_pEditorAudioFeatures->setEnableInput(oldAudioData.m_fAudioInputEnabled); 151 } 139 152 140 153 /* Polish page finally: */ … … 144 157 void UIMachineSettingsAudio::putToCache() 145 158 { 146 /* Prepare new audio data: */ 159 /* Sanity check: */ 160 if (!m_pCache) 161 return; 162 163 /* Prepare new data: */ 147 164 UIDataSettingsMachineAudio newAudioData; 148 165 149 /* Gather new audio data: */ 150 newAudioData.m_fAudioEnabled = m_pCheckBoxAudio->isChecked(); 151 newAudioData.m_audioDriverType = m_pEditorAudioHostDriver->value(); 152 newAudioData.m_audioControllerType = m_pEditorAudioController->value(); 153 newAudioData.m_fAudioOutputEnabled = m_pEditorAudioFeatures->outputEnabled(); 154 newAudioData.m_fAudioInputEnabled = m_pEditorAudioFeatures->inputEnabled(); 155 156 /* Cache new audio data: */ 166 /* Cache new data: */ 167 if (m_pCheckBoxAudio) 168 newAudioData.m_fAudioEnabled = m_pCheckBoxAudio->isChecked(); 169 if (m_pEditorAudioHostDriver) 170 newAudioData.m_audioDriverType = m_pEditorAudioHostDriver->value(); 171 if (m_pEditorAudioController) 172 newAudioData.m_audioControllerType = m_pEditorAudioController->value(); 173 if (m_pEditorAudioFeatures) 174 { 175 newAudioData.m_fAudioOutputEnabled = m_pEditorAudioFeatures->outputEnabled(); 176 newAudioData.m_fAudioInputEnabled = m_pEditorAudioFeatures->inputEnabled(); 177 } 157 178 m_pCache->cacheCurrentData(newAudioData); 158 179 } … … 273 294 bool UIMachineSettingsAudio::saveData() 274 295 { 296 /* Sanity check: */ 297 if (!m_pCache) 298 return false; 299 275 300 /* Prepare result: */ 276 301 bool fSuccess = true; … … 278 303 if (fSuccess && isMachineInValidMode() && m_pCache->wasChanged()) 279 304 { 280 /* Get old audiodata from cache: */305 /* Get old data from cache: */ 281 306 const UIDataSettingsMachineAudio &oldAudioData = m_pCache->base(); 282 /* Get new audiodata from cache: */307 /* Get new data from cache: */ 283 308 const UIDataSettingsMachineAudio &newAudioData = m_pCache->data(); 284 309 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r94436 r94667 355 355 bool UIMachineSettingsDisplay::changed() const 356 356 { 357 return m_pCache ->wasChanged();357 return m_pCache ? m_pCache->wasChanged() : false; 358 358 } 359 359 360 360 void UIMachineSettingsDisplay::loadToCacheFrom(QVariant &data) 361 361 { 362 /* Sanity check: */ 363 if (!m_pCache) 364 return; 365 362 366 /* Fetch data to machine: */ 363 367 UISettingsPageMachine::fetchData(data); … … 366 370 m_pCache->clear(); 367 371 368 /* Prepare old d isplay data: */372 /* Prepare old data: */ 369 373 UIDataSettingsMachineDisplay oldDisplayData; 370 374 … … 423 427 } 424 428 425 /* Cache old d isplay data: */429 /* Cache old data: */ 426 430 m_pCache->cacheInitialData(oldDisplayData); 427 431 … … 432 436 void UIMachineSettingsDisplay::getFromCache() 433 437 { 434 /* Get old display data from cache: */ 438 /* Sanity check: */ 439 if (!m_pCache) 440 return; 441 442 /* Get old data from cache: */ 435 443 const UIDataSettingsMachineDisplay &oldDisplayData = m_pCache->base(); 436 444 437 445 /* Load old 'Screen' data from cache: */ 438 m_pEditorMonitorCount->setValue(oldDisplayData.m_cGuestScreenCount); 439 m_pEditorScaleFactor->setScaleFactors(oldDisplayData.m_scaleFactors); 440 m_pEditorScaleFactor->setMonitorCount(oldDisplayData.m_cGuestScreenCount); 441 m_pEditorGraphicsController->setValue(oldDisplayData.m_graphicsControllerType); 442 #ifdef VBOX_WITH_3D_ACCELERATION 443 m_pEditorDisplayScreenFeatures->setEnable3DAcceleration(oldDisplayData.m_f3dAccelerationEnabled); 446 if (m_pEditorMonitorCount) 447 m_pEditorMonitorCount->setValue(oldDisplayData.m_cGuestScreenCount); 448 if (m_pEditorScaleFactor) 449 { 450 m_pEditorScaleFactor->setScaleFactors(oldDisplayData.m_scaleFactors); 451 m_pEditorScaleFactor->setMonitorCount(oldDisplayData.m_cGuestScreenCount); 452 } 453 if (m_pEditorGraphicsController) 454 m_pEditorGraphicsController->setValue(oldDisplayData.m_graphicsControllerType); 455 #ifdef VBOX_WITH_3D_ACCELERATION 456 if (m_pEditorDisplayScreenFeatures) 457 m_pEditorDisplayScreenFeatures->setEnable3DAcceleration(oldDisplayData.m_f3dAccelerationEnabled); 444 458 #endif 445 459 /* Push required value to m_pEditorVideoMemorySize: */ … … 450 464 #endif 451 465 // Should be the last one for this tab, since it depends on some of others: 452 m_pEditorVideoMemorySize->setValue(oldDisplayData.m_iCurrentVRAM); 466 if (m_pEditorVideoMemorySize) 467 m_pEditorVideoMemorySize->setValue(oldDisplayData.m_iCurrentVRAM); 453 468 454 469 /* If remote display server is supported: */ … … 456 471 { 457 472 /* Load old 'Remote Display' data from cache: */ 458 m_pEditorVRDESettings->setFeatureEnabled(oldDisplayData.m_fRemoteDisplayServerEnabled); 459 m_pEditorVRDESettings->setPort(oldDisplayData.m_strRemoteDisplayPort); 460 m_pEditorVRDESettings->setAuthType(oldDisplayData.m_remoteDisplayAuthType); 461 m_pEditorVRDESettings->setTimeout(QString::number(oldDisplayData.m_uRemoteDisplayTimeout)); 462 m_pEditorVRDESettings->setMultipleConnectionsAllowed(oldDisplayData.m_fRemoteDisplayMultiConnAllowed); 463 } 464 465 /* Load old 'Recording' data from cache: */ 466 m_pEditorRecordingSettings->setFeatureEnabled(oldDisplayData.m_fRecordingEnabled); 467 m_pEditorRecordingSettings->setFolder(oldDisplayData.m_strRecordingFolder); 468 m_pEditorRecordingSettings->setFilePath(oldDisplayData.m_strRecordingFilePath); 469 m_pEditorRecordingSettings->setFrameWidth(oldDisplayData.m_iRecordingVideoFrameWidth); 470 m_pEditorRecordingSettings->setFrameHeight(oldDisplayData.m_iRecordingVideoFrameHeight); 471 m_pEditorRecordingSettings->setFrameRate(oldDisplayData.m_iRecordingVideoFrameRate); 472 m_pEditorRecordingSettings->setBitRate(oldDisplayData.m_iRecordingVideoBitRate); 473 m_pEditorRecordingSettings->setScreens(oldDisplayData.m_vecRecordingScreens); 474 475 /* Load old 'Recording' options: */ 476 const bool fRecordVideo = 477 UIDataSettingsMachineDisplay::isRecordingOptionEnabled(oldDisplayData.m_strRecordingVideoOptions, 478 UIDataSettingsMachineDisplay::RecordingOption_VC); 479 const bool fRecordAudio = 480 UIDataSettingsMachineDisplay::isRecordingOptionEnabled(oldDisplayData.m_strRecordingVideoOptions, 481 UIDataSettingsMachineDisplay::RecordingOption_AC); 482 UISettingsDefs::RecordingMode enmMode; 483 if (fRecordAudio && fRecordVideo) 484 enmMode = UISettingsDefs::RecordingMode_VideoAudio; 485 else if (fRecordAudio && !fRecordVideo) 486 enmMode = UISettingsDefs::RecordingMode_AudioOnly; 487 else 488 enmMode = UISettingsDefs::RecordingMode_VideoOnly; 489 m_pEditorRecordingSettings->setMode(enmMode); 490 const int iAudioQualityRate = 491 UIDataSettingsMachineDisplay::getAudioQualityFromOptions(oldDisplayData.m_strRecordingVideoOptions); 492 m_pEditorRecordingSettings->setAudioQualityRate(iAudioQualityRate); 473 if (m_pEditorVRDESettings) 474 { 475 m_pEditorVRDESettings->setFeatureEnabled(oldDisplayData.m_fRemoteDisplayServerEnabled); 476 m_pEditorVRDESettings->setPort(oldDisplayData.m_strRemoteDisplayPort); 477 m_pEditorVRDESettings->setAuthType(oldDisplayData.m_remoteDisplayAuthType); 478 m_pEditorVRDESettings->setTimeout(QString::number(oldDisplayData.m_uRemoteDisplayTimeout)); 479 m_pEditorVRDESettings->setMultipleConnectionsAllowed(oldDisplayData.m_fRemoteDisplayMultiConnAllowed); 480 } 481 } 482 483 if (m_pEditorRecordingSettings) 484 { 485 /* Load old 'Recording' data from cache: */ 486 m_pEditorRecordingSettings->setFeatureEnabled(oldDisplayData.m_fRecordingEnabled); 487 m_pEditorRecordingSettings->setFolder(oldDisplayData.m_strRecordingFolder); 488 m_pEditorRecordingSettings->setFilePath(oldDisplayData.m_strRecordingFilePath); 489 m_pEditorRecordingSettings->setFrameWidth(oldDisplayData.m_iRecordingVideoFrameWidth); 490 m_pEditorRecordingSettings->setFrameHeight(oldDisplayData.m_iRecordingVideoFrameHeight); 491 m_pEditorRecordingSettings->setFrameRate(oldDisplayData.m_iRecordingVideoFrameRate); 492 m_pEditorRecordingSettings->setBitRate(oldDisplayData.m_iRecordingVideoBitRate); 493 m_pEditorRecordingSettings->setScreens(oldDisplayData.m_vecRecordingScreens); 494 495 /* Load old 'Recording' options: */ 496 const bool fRecordVideo = 497 UIDataSettingsMachineDisplay::isRecordingOptionEnabled(oldDisplayData.m_strRecordingVideoOptions, 498 UIDataSettingsMachineDisplay::RecordingOption_VC); 499 const bool fRecordAudio = 500 UIDataSettingsMachineDisplay::isRecordingOptionEnabled(oldDisplayData.m_strRecordingVideoOptions, 501 UIDataSettingsMachineDisplay::RecordingOption_AC); 502 UISettingsDefs::RecordingMode enmMode; 503 if (fRecordAudio && fRecordVideo) 504 enmMode = UISettingsDefs::RecordingMode_VideoAudio; 505 else if (fRecordAudio && !fRecordVideo) 506 enmMode = UISettingsDefs::RecordingMode_AudioOnly; 507 else 508 enmMode = UISettingsDefs::RecordingMode_VideoOnly; 509 m_pEditorRecordingSettings->setMode(enmMode); 510 const int iAudioQualityRate = 511 UIDataSettingsMachineDisplay::getAudioQualityFromOptions(oldDisplayData.m_strRecordingVideoOptions); 512 m_pEditorRecordingSettings->setAudioQualityRate(iAudioQualityRate); 513 } 493 514 494 515 /* Polish page finally: */ … … 501 522 void UIMachineSettingsDisplay::putToCache() 502 523 { 503 /* Prepare new display data: */ 524 /* Sanity check: */ 525 if (!m_pCache) 526 return; 527 528 /* Prepare new data: */ 504 529 UIDataSettingsMachineDisplay newDisplayData; 505 530 506 531 /* Gather new 'Screen' data: */ 507 newDisplayData.m_iCurrentVRAM = m_pEditorVideoMemorySize->value(); 508 newDisplayData.m_cGuestScreenCount = m_pEditorMonitorCount->value(); 509 newDisplayData.m_scaleFactors = m_pEditorScaleFactor->scaleFactors(); 510 newDisplayData.m_graphicsControllerType = m_pEditorGraphicsController->value(); 511 #ifdef VBOX_WITH_3D_ACCELERATION 512 newDisplayData.m_f3dAccelerationEnabled = m_pEditorDisplayScreenFeatures->isEnabled3DAcceleration(); 513 #endif 532 if (m_pEditorVideoMemorySize) 533 newDisplayData.m_iCurrentVRAM = m_pEditorVideoMemorySize->value(); 534 if (m_pEditorMonitorCount) 535 newDisplayData.m_cGuestScreenCount = m_pEditorMonitorCount->value(); 536 if (m_pEditorScaleFactor) 537 newDisplayData.m_scaleFactors = m_pEditorScaleFactor->scaleFactors(); 538 if (m_pEditorGraphicsController) 539 newDisplayData.m_graphicsControllerType = m_pEditorGraphicsController->value(); 540 #ifdef VBOX_WITH_3D_ACCELERATION 541 if (m_pEditorDisplayScreenFeatures) 542 newDisplayData.m_f3dAccelerationEnabled = m_pEditorDisplayScreenFeatures->isEnabled3DAcceleration(); 543 #endif 544 514 545 /* If remote display server is supported: */ 515 546 newDisplayData.m_fRemoteDisplayServerSupported = m_pCache->base().m_fRemoteDisplayServerSupported; 516 if (newDisplayData.m_fRemoteDisplayServerSupported) 547 if ( newDisplayData.m_fRemoteDisplayServerSupported 548 && m_pEditorVRDESettings) 517 549 { 518 550 /* Gather new 'Remote Display' data: */ … … 524 556 } 525 557 526 /* Gather new 'Recording' data: */ 527 newDisplayData.m_fRecordingEnabled = m_pEditorRecordingSettings->isFeatureEnabled(); 528 newDisplayData.m_strRecordingFolder = m_pEditorRecordingSettings->folder(); 529 newDisplayData.m_strRecordingFilePath = m_pEditorRecordingSettings->filePath(); 530 newDisplayData.m_iRecordingVideoFrameWidth = m_pEditorRecordingSettings->frameWidth(); 531 newDisplayData.m_iRecordingVideoFrameHeight = m_pEditorRecordingSettings->frameHeight(); 532 newDisplayData.m_iRecordingVideoFrameRate = m_pEditorRecordingSettings->frameRate(); 533 newDisplayData.m_iRecordingVideoBitRate = m_pEditorRecordingSettings->bitRate(); 534 newDisplayData.m_vecRecordingScreens = m_pEditorRecordingSettings->screens(); 535 536 /* Gather new 'Recording' options: */ 537 const UISettingsDefs::RecordingMode enmRecordingMode = m_pEditorRecordingSettings->mode(); 538 QStringList optionValues; 539 optionValues.append( (enmRecordingMode == UISettingsDefs::RecordingMode_VideoAudio) 540 || (enmRecordingMode == UISettingsDefs::RecordingMode_VideoOnly) 541 ? "true" : "false"); 542 optionValues.append( (enmRecordingMode == UISettingsDefs::RecordingMode_VideoAudio) 543 || (enmRecordingMode == UISettingsDefs::RecordingMode_AudioOnly) 544 ? "true" : "false"); 545 switch (m_pEditorRecordingSettings->audioQualityRate()) 546 { 547 case 1: optionValues.append("low"); break; 548 case 2: optionValues.append("med"); break; 549 default: optionValues.append("high"); break; 550 } 551 QVector<UIDataSettingsMachineDisplay::RecordingOption> optionKeys; 552 optionKeys.append(UIDataSettingsMachineDisplay::RecordingOption_VC); 553 optionKeys.append(UIDataSettingsMachineDisplay::RecordingOption_AC); 554 optionKeys.append(UIDataSettingsMachineDisplay::RecordingOption_AC_Profile); 555 newDisplayData.m_strRecordingVideoOptions = 556 UIDataSettingsMachineDisplay::setRecordingOptions(m_pCache->base().m_strRecordingVideoOptions, 557 optionKeys, optionValues); 558 559 /* Cache new display data: */ 558 if (m_pEditorRecordingSettings) 559 { 560 /* Gather new 'Recording' data: */ 561 newDisplayData.m_fRecordingEnabled = m_pEditorRecordingSettings->isFeatureEnabled(); 562 newDisplayData.m_strRecordingFolder = m_pEditorRecordingSettings->folder(); 563 newDisplayData.m_strRecordingFilePath = m_pEditorRecordingSettings->filePath(); 564 newDisplayData.m_iRecordingVideoFrameWidth = m_pEditorRecordingSettings->frameWidth(); 565 newDisplayData.m_iRecordingVideoFrameHeight = m_pEditorRecordingSettings->frameHeight(); 566 newDisplayData.m_iRecordingVideoFrameRate = m_pEditorRecordingSettings->frameRate(); 567 newDisplayData.m_iRecordingVideoBitRate = m_pEditorRecordingSettings->bitRate(); 568 newDisplayData.m_vecRecordingScreens = m_pEditorRecordingSettings->screens(); 569 570 /* Gather new 'Recording' options: */ 571 const UISettingsDefs::RecordingMode enmRecordingMode = m_pEditorRecordingSettings->mode(); 572 QStringList optionValues; 573 optionValues.append( (enmRecordingMode == UISettingsDefs::RecordingMode_VideoAudio) 574 || (enmRecordingMode == UISettingsDefs::RecordingMode_VideoOnly) 575 ? "true" : "false"); 576 optionValues.append( (enmRecordingMode == UISettingsDefs::RecordingMode_VideoAudio) 577 || (enmRecordingMode == UISettingsDefs::RecordingMode_AudioOnly) 578 ? "true" : "false"); 579 switch (m_pEditorRecordingSettings->audioQualityRate()) 580 { 581 case 1: optionValues.append("low"); break; 582 case 2: optionValues.append("med"); break; 583 default: optionValues.append("high"); break; 584 } 585 QVector<UIDataSettingsMachineDisplay::RecordingOption> optionKeys; 586 optionKeys.append(UIDataSettingsMachineDisplay::RecordingOption_VC); 587 optionKeys.append(UIDataSettingsMachineDisplay::RecordingOption_AC); 588 optionKeys.append(UIDataSettingsMachineDisplay::RecordingOption_AC_Profile); 589 newDisplayData.m_strRecordingVideoOptions = 590 UIDataSettingsMachineDisplay::setRecordingOptions(m_pCache->base().m_strRecordingVideoOptions, 591 optionKeys, optionValues); 592 } 593 594 /* Cache new data: */ 560 595 m_pCache->cacheCurrentData(newDisplayData); 561 596 } … … 727 762 void UIMachineSettingsDisplay::polishPage() 728 763 { 729 /* Get old d isplay data from cache: */764 /* Get old data from cache: */ 730 765 const UIDataSettingsMachineDisplay &oldDisplayData = m_pCache->base(); 731 766 … … 960 995 bool UIMachineSettingsDisplay::saveData() 961 996 { 997 /* Sanity check: */ 998 if (!m_pCache) 999 return false; 1000 962 1001 /* Prepare result: */ 963 1002 bool fSuccess = true; … … 981 1020 bool UIMachineSettingsDisplay::saveScreenData() 982 1021 { 1022 /* Sanity check: */ 1023 if (!m_pCache) 1024 return false; 1025 983 1026 /* Prepare result: */ 984 1027 bool fSuccess = true; … … 986 1029 if (fSuccess) 987 1030 { 988 /* Get old d isplay data from cache: */1031 /* Get old data from cache: */ 989 1032 const UIDataSettingsMachineDisplay &oldDisplayData = m_pCache->base(); 990 /* Get new d isplay data from cache: */1033 /* Get new data from cache: */ 991 1034 const UIDataSettingsMachineDisplay &newDisplayData = m_pCache->data(); 992 1035 … … 1050 1093 bool UIMachineSettingsDisplay::saveRemoteDisplayData() 1051 1094 { 1095 /* Sanity check: */ 1096 if (!m_pCache) 1097 return false; 1098 1052 1099 /* Prepare result: */ 1053 1100 bool fSuccess = true; … … 1055 1102 if (fSuccess) 1056 1103 { 1057 /* Get old d isplay data from cache: */1104 /* Get old data from cache: */ 1058 1105 const UIDataSettingsMachineDisplay &oldDisplayData = m_pCache->base(); 1059 /* Get new d isplay data from cache: */1106 /* Get new data from cache: */ 1060 1107 const UIDataSettingsMachineDisplay &newDisplayData = m_pCache->data(); 1061 1108 … … 1113 1160 bool UIMachineSettingsDisplay::saveRecordingData() 1114 1161 { 1162 /* Sanity check: */ 1163 if (!m_pCache) 1164 return false; 1165 1115 1166 /* Prepare result: */ 1116 1167 bool fSuccess = true; … … 1118 1169 if (fSuccess) 1119 1170 { 1120 /* Get old d isplay data from cache: */1171 /* Get old data from cache: */ 1121 1172 const UIDataSettingsMachineDisplay &oldDisplayData = m_pCache->base(); 1122 /* Get new d isplay data from cache: */1173 /* Get new data from cache: */ 1123 1174 const UIDataSettingsMachineDisplay &newDisplayData = m_pCache->data(); 1124 1175 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r94515 r94667 174 174 bool UIMachineSettingsGeneral::changed() const 175 175 { 176 return m_pCache ->wasChanged();176 return m_pCache ? m_pCache->wasChanged() : false; 177 177 } 178 178 179 179 void UIMachineSettingsGeneral::loadToCacheFrom(QVariant &data) 180 180 { 181 /* Sanity check: */ 182 if (!m_pCache) 183 return; 184 181 185 /* Fetch data to machine: */ 182 186 UISettingsPageMachine::fetchData(data); … … 185 189 m_pCache->clear(); 186 190 187 /* Prepare old generaldata: */191 /* Prepare old data: */ 188 192 UIDataSettingsMachineGeneral oldGeneralData; 189 193 … … 236 240 oldGeneralData.m_encryptedMedia = encryptedMedia; 237 241 238 /* Cache old generaldata: */242 /* Cache old data: */ 239 243 m_pCache->cacheInitialData(oldGeneralData); 240 244 … … 245 249 void UIMachineSettingsGeneral::getFromCache() 246 250 { 247 /* Get old general data from cache: */ 251 /* Sanity check: */ 252 if (!m_pCache) 253 return; 254 255 /* Get old data from cache: */ 248 256 const UIDataSettingsMachineGeneral &oldGeneralData = m_pCache->base(); 249 257 250 258 /* Load old 'Basic' data from cache: */ 251 AssertPtrReturnVoid(m_pEditorNameAndSystem); 252 m_pEditorNameAndSystem->setName(oldGeneralData.m_strName); 253 m_pEditorNameAndSystem->setTypeId(oldGeneralData.m_strGuestOsTypeId); 259 if (m_pEditorNameAndSystem) 260 { 261 m_pEditorNameAndSystem->setName(oldGeneralData.m_strName); 262 m_pEditorNameAndSystem->setTypeId(oldGeneralData.m_strGuestOsTypeId); 263 } 254 264 255 265 /* Load old 'Advanced' data from cache: */ 256 AssertPtrReturnVoid(m_pEditorSnapshotFolder); 257 AssertPtrReturnVoid(m_pEditorClipboard); 258 AssertPtrReturnVoid(m_pEditorDragAndDrop); 259 m_pEditorSnapshotFolder->setPath(oldGeneralData.m_strSnapshotsFolder); 260 m_pEditorSnapshotFolder->setInitialPath(oldGeneralData.m_strSnapshotsHomeDir); 261 m_pEditorClipboard->setValue(oldGeneralData.m_clipboardMode); 262 m_pEditorDragAndDrop->setValue(oldGeneralData.m_dndMode); 266 if (m_pEditorSnapshotFolder) 267 { 268 m_pEditorSnapshotFolder->setPath(oldGeneralData.m_strSnapshotsFolder); 269 m_pEditorSnapshotFolder->setInitialPath(oldGeneralData.m_strSnapshotsHomeDir); 270 } 271 if (m_pEditorClipboard) 272 m_pEditorClipboard->setValue(oldGeneralData.m_clipboardMode); 273 if (m_pEditorDragAndDrop) 274 m_pEditorDragAndDrop->setValue(oldGeneralData.m_dndMode); 263 275 264 276 /* Load old 'Description' data from cache: */ 265 AssertPtrReturnVoid(m_pEditorDescription);266 m_pEditorDescription->setValue(oldGeneralData.m_strDescription);277 if (m_pEditorDescription) 278 m_pEditorDescription->setValue(oldGeneralData.m_strDescription); 267 279 268 280 /* Load old 'Encryption' data from cache: */ 269 AssertPtrReturnVoid(m_pEditorDiskEncryptionSettings); 270 m_pEditorDiskEncryptionSettings->setFeatureEnabled(oldGeneralData.m_fEncryptionEnabled); 271 m_pEditorDiskEncryptionSettings->setCipherType(oldGeneralData.m_enmEncryptionCipherType); 272 m_fEncryptionCipherChanged = oldGeneralData.m_fEncryptionCipherChanged; 273 m_fEncryptionPasswordChanged = oldGeneralData.m_fEncryptionPasswordChanged; 281 if (m_pEditorDiskEncryptionSettings) 282 { 283 m_pEditorDiskEncryptionSettings->setFeatureEnabled(oldGeneralData.m_fEncryptionEnabled); 284 m_pEditorDiskEncryptionSettings->setCipherType(oldGeneralData.m_enmEncryptionCipherType); 285 } 286 if (m_fEncryptionCipherChanged) 287 m_fEncryptionCipherChanged = oldGeneralData.m_fEncryptionCipherChanged; 288 if (m_fEncryptionPasswordChanged) 289 m_fEncryptionPasswordChanged = oldGeneralData.m_fEncryptionPasswordChanged; 274 290 275 291 /* Polish page finally: */ … … 282 298 void UIMachineSettingsGeneral::putToCache() 283 299 { 284 /* Prepare new general data: */ 300 /* Sanity check: */ 301 if (!m_pCache) 302 return; 303 304 /* Prepare new data: */ 285 305 UIDataSettingsMachineGeneral newGeneralData; 286 306 287 307 /* Gather new 'Basic' data: */ 288 AssertPtrReturnVoid(m_pEditorNameAndSystem); 289 newGeneralData.m_strName = m_pEditorNameAndSystem->name(); 290 newGeneralData.m_strGuestOsTypeId = m_pEditorNameAndSystem->typeId(); 308 if (m_pEditorNameAndSystem) 309 { 310 newGeneralData.m_strName = m_pEditorNameAndSystem->name(); 311 newGeneralData.m_strGuestOsTypeId = m_pEditorNameAndSystem->typeId(); 312 } 291 313 292 314 /* Gather new 'Advanced' data: */ 293 AssertPtrReturnVoid(m_pEditorSnapshotFolder);294 AssertPtrReturnVoid(m_pEditorClipboard);295 AssertPtrReturnVoid(m_pEditorDragAndDrop);296 newGeneralData.m_strSnapshotsFolder = m_pEditorSnapshotFolder->path();297 newGeneralData.m_clipboardMode = m_pEditorClipboard->value();298 newGeneralData.m_dndMode = m_pEditorDragAndDrop->value();315 if (m_pEditorSnapshotFolder) 316 newGeneralData.m_strSnapshotsFolder = m_pEditorSnapshotFolder->path(); 317 if (m_pEditorClipboard) 318 newGeneralData.m_clipboardMode = m_pEditorClipboard->value(); 319 if (m_pEditorDragAndDrop) 320 newGeneralData.m_dndMode = m_pEditorDragAndDrop->value(); 299 321 300 322 /* Gather new 'Description' data: */ 301 AssertPtrReturnVoid(m_pEditorDescription);302 newGeneralData.m_strDescription = m_pEditorDescription->value().isEmpty() ?303 323 if (m_pEditorDescription) 324 newGeneralData.m_strDescription = m_pEditorDescription->value().isEmpty() 325 ? QString() : m_pEditorDescription->value(); 304 326 305 327 /* Gather new 'Encryption' data: */ 306 AssertPtrReturnVoid(m_pEditorDiskEncryptionSettings); 307 newGeneralData.m_fEncryptionEnabled = m_pEditorDiskEncryptionSettings->isFeatureEnabled(); 308 newGeneralData.m_fEncryptionCipherChanged = m_fEncryptionCipherChanged; 309 newGeneralData.m_fEncryptionPasswordChanged = m_fEncryptionPasswordChanged; 310 newGeneralData.m_enmEncryptionCipherType = m_pEditorDiskEncryptionSettings->cipherType(); 311 newGeneralData.m_strEncryptionPassword = m_pEditorDiskEncryptionSettings->password1(); 312 newGeneralData.m_encryptedMedia = m_pCache->base().m_encryptedMedia; 313 /* If encryption status, cipher or password is changed: */ 314 if (newGeneralData.m_fEncryptionEnabled != m_pCache->base().m_fEncryptionEnabled || 315 newGeneralData.m_fEncryptionCipherChanged != m_pCache->base().m_fEncryptionCipherChanged || 316 newGeneralData.m_fEncryptionPasswordChanged != m_pCache->base().m_fEncryptionPasswordChanged) 317 { 318 /* Ask for the disk encryption passwords if necessary: */ 319 if (!m_pCache->base().m_encryptedMedia.isEmpty()) 320 { 321 /* Create corresponding dialog: */ 322 QWidget *pDlgParent = windowManager().realParentWindow(window()); 323 QPointer<UIAddDiskEncryptionPasswordDialog> pDlg = 324 new UIAddDiskEncryptionPasswordDialog(pDlgParent, 325 newGeneralData.m_strName, 326 newGeneralData.m_encryptedMedia); 327 /* Execute it and acquire the result: */ 328 if (pDlg->exec() == QDialog::Accepted) 329 newGeneralData.m_encryptionPasswords = pDlg->encryptionPasswords(); 330 /* Delete dialog if still valid: */ 331 if (pDlg) 332 delete pDlg; 333 } 334 } 335 336 /* Cache new general data: */ 328 if (m_pEditorDiskEncryptionSettings) 329 { 330 newGeneralData.m_fEncryptionEnabled = m_pEditorDiskEncryptionSettings->isFeatureEnabled(); 331 newGeneralData.m_fEncryptionCipherChanged = m_fEncryptionCipherChanged; 332 newGeneralData.m_fEncryptionPasswordChanged = m_fEncryptionPasswordChanged; 333 newGeneralData.m_enmEncryptionCipherType = m_pEditorDiskEncryptionSettings->cipherType(); 334 newGeneralData.m_strEncryptionPassword = m_pEditorDiskEncryptionSettings->password1(); 335 newGeneralData.m_encryptedMedia = m_pCache->base().m_encryptedMedia; 336 /* If encryption status, cipher or password is changed: */ 337 if (newGeneralData.m_fEncryptionEnabled != m_pCache->base().m_fEncryptionEnabled || 338 newGeneralData.m_fEncryptionCipherChanged != m_pCache->base().m_fEncryptionCipherChanged || 339 newGeneralData.m_fEncryptionPasswordChanged != m_pCache->base().m_fEncryptionPasswordChanged) 340 { 341 /* Ask for the disk encryption passwords if necessary: */ 342 if (!m_pCache->base().m_encryptedMedia.isEmpty()) 343 { 344 /* Create corresponding dialog: */ 345 QWidget *pDlgParent = windowManager().realParentWindow(window()); 346 QPointer<UIAddDiskEncryptionPasswordDialog> pDlg = 347 new UIAddDiskEncryptionPasswordDialog(pDlgParent, 348 newGeneralData.m_strName, 349 newGeneralData.m_encryptedMedia); 350 /* Execute it and acquire the result: */ 351 if (pDlg->exec() == QDialog::Accepted) 352 newGeneralData.m_encryptionPasswords = pDlg->encryptionPasswords(); 353 /* Delete dialog if still valid: */ 354 if (pDlg) 355 delete pDlg; 356 } 357 } 358 } 359 360 /* Cache new data: */ 337 361 m_pCache->cacheCurrentData(newGeneralData); 338 362 } … … 670 694 bool UIMachineSettingsGeneral::saveData() 671 695 { 696 /* Sanity check: */ 697 if (!m_pCache) 698 return false; 699 672 700 /* Prepare result: */ 673 701 bool fSuccess = true; … … 694 722 bool UIMachineSettingsGeneral::saveBasicData() 695 723 { 724 /* Sanity check: */ 725 if (!m_pCache) 726 return false; 727 696 728 /* Prepare result: */ 697 729 bool fSuccess = true; … … 699 731 if (fSuccess) 700 732 { 701 /* Get old generaldata from cache: */733 /* Get old data from cache: */ 702 734 const UIDataSettingsMachineGeneral &oldGeneralData = m_pCache->base(); 703 /* Get new generaldata from cache: */735 /* Get new data from cache: */ 704 736 const UIDataSettingsMachineGeneral &newGeneralData = m_pCache->data(); 705 737 … … 733 765 bool UIMachineSettingsGeneral::saveAdvancedData() 734 766 { 767 /* Sanity check: */ 768 if (!m_pCache) 769 return false; 770 735 771 /* Prepare result: */ 736 772 bool fSuccess = true; … … 738 774 if (fSuccess) 739 775 { 740 /* Get old generaldata from cache: */776 /* Get old data from cache: */ 741 777 const UIDataSettingsMachineGeneral &oldGeneralData = m_pCache->base(); 742 /* Get new generaldata from cache: */778 /* Get new data from cache: */ 743 779 const UIDataSettingsMachineGeneral &newGeneralData = m_pCache->data(); 744 780 … … 780 816 bool UIMachineSettingsGeneral::saveDescriptionData() 781 817 { 818 /* Sanity check: */ 819 if (!m_pCache) 820 return false; 821 782 822 /* Prepare result: */ 783 823 bool fSuccess = true; … … 785 825 if (fSuccess) 786 826 { 787 /* Get old generaldata from cache: */827 /* Get old data from cache: */ 788 828 const UIDataSettingsMachineGeneral &oldGeneralData = m_pCache->base(); 789 /* Get new generaldata from cache: */829 /* Get new data from cache: */ 790 830 const UIDataSettingsMachineGeneral &newGeneralData = m_pCache->data(); 791 831 … … 807 847 bool UIMachineSettingsGeneral::saveEncryptionData() 808 848 { 849 /* Sanity check: */ 850 if (!m_pCache) 851 return false; 852 809 853 /* Prepare result: */ 810 854 bool fSuccess = true; … … 812 856 if (fSuccess) 813 857 { 814 /* Get old generaldata from cache: */858 /* Get old data from cache: */ 815 859 const UIDataSettingsMachineGeneral &oldGeneralData = m_pCache->base(); 816 /* Get new generaldata from cache: */860 /* Get new data from cache: */ 817 861 const UIDataSettingsMachineGeneral &newGeneralData = m_pCache->data(); 818 862 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
r94518 r94667 158 158 bool UIMachineSettingsInterface::changed() const 159 159 { 160 return m_pCache ->wasChanged();160 return m_pCache ? m_pCache->wasChanged() : false; 161 161 } 162 162 163 163 void UIMachineSettingsInterface::loadToCacheFrom(QVariant &data) 164 164 { 165 /* Sanity check: */ 166 if (!m_pCache) 167 return; 168 165 169 /* Fetch data to machine: */ 166 170 UISettingsPageMachine::fetchData(data); … … 169 173 m_pCache->clear(); 170 174 171 /* Prepare old interfacedata: */175 /* Prepare old data: */ 172 176 UIDataSettingsMachineInterface oldInterfaceData; 173 177 174 /* Gather old interfacedata: */178 /* Gather old data: */ 175 179 oldInterfaceData.m_fStatusBarEnabled = gEDataManager->statusBarEnabled(m_machine.GetId()); 176 180 oldInterfaceData.m_statusBarRestrictions = gEDataManager->restrictedStatusBarIndicators(m_machine.GetId()); … … 198 202 oldInterfaceData.m_enmVisualState = gEDataManager->requestedVisualState(m_machine.GetId()); 199 203 200 /* Cache old interfacedata: */204 /* Cache old data: */ 201 205 m_pCache->cacheInitialData(oldInterfaceData); 202 206 … … 207 211 void UIMachineSettingsInterface::getFromCache() 208 212 { 209 /* Get old interface data from cache: */ 213 /* Sanity check: */ 214 if (!m_pCache) 215 return; 216 217 /* Get old data from cache: */ 210 218 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base(); 211 219 212 /* Load old interface data from cache: */ 213 m_pEditorStatusBar->setStatusBarEnabled(oldInterfaceData.m_fStatusBarEnabled); 214 m_pEditorStatusBar->setStatusBarConfiguration(oldInterfaceData.m_statusBarRestrictions, 215 oldInterfaceData.m_statusBarOrder); 216 #ifndef VBOX_WS_MAC 217 m_pEditorMenuBar->setMenuBarEnabled(oldInterfaceData.m_fMenuBarEnabled); 218 #endif 219 m_pEditorMenuBar->setRestrictionsOfMenuBar(oldInterfaceData.m_restrictionsOfMenuBar); 220 m_pEditorMenuBar->setRestrictionsOfMenuApplication(oldInterfaceData.m_restrictionsOfMenuApplication); 221 m_pEditorMenuBar->setRestrictionsOfMenuMachine(oldInterfaceData.m_restrictionsOfMenuMachine); 222 m_pEditorMenuBar->setRestrictionsOfMenuView(oldInterfaceData.m_restrictionsOfMenuView); 223 m_pEditorMenuBar->setRestrictionsOfMenuInput(oldInterfaceData.m_restrictionsOfMenuInput); 224 m_pEditorMenuBar->setRestrictionsOfMenuDevices(oldInterfaceData.m_restrictionsOfMenuDevices); 225 #ifdef VBOX_WITH_DEBUGGER_GUI 226 m_pEditorMenuBar->setRestrictionsOfMenuDebug(oldInterfaceData.m_restrictionsOfMenuDebug); 227 #endif 228 #ifdef VBOX_WS_MAC 229 m_pEditorMenuBar->setRestrictionsOfMenuWindow(oldInterfaceData.m_restrictionsOfMenuWindow); 230 #endif 231 m_pEditorMenuBar->setRestrictionsOfMenuHelp(oldInterfaceData.m_restrictionsOfMenuHelp); 232 #ifndef VBOX_WS_MAC 233 m_pEditorMiniToolabSettings->setShowMiniToolbar(oldInterfaceData.m_fShowMiniToolbar); 234 m_pEditorMiniToolabSettings->setMiniToolbarAtTop(oldInterfaceData.m_fMiniToolbarAtTop); 235 #endif 236 m_pEditorVisualState->setMachineId(m_machine.GetId()); 237 m_pEditorVisualState->setValue(oldInterfaceData.m_enmVisualState); 220 /* Load old data from cache: */ 221 if (m_pEditorStatusBar) 222 { 223 m_pEditorStatusBar->setStatusBarEnabled(oldInterfaceData.m_fStatusBarEnabled); 224 m_pEditorStatusBar->setStatusBarConfiguration(oldInterfaceData.m_statusBarRestrictions, 225 oldInterfaceData.m_statusBarOrder); 226 } 227 if (m_pEditorMenuBar) 228 { 229 #ifndef VBOX_WS_MAC 230 m_pEditorMenuBar->setMenuBarEnabled(oldInterfaceData.m_fMenuBarEnabled); 231 #endif 232 m_pEditorMenuBar->setRestrictionsOfMenuBar(oldInterfaceData.m_restrictionsOfMenuBar); 233 m_pEditorMenuBar->setRestrictionsOfMenuApplication(oldInterfaceData.m_restrictionsOfMenuApplication); 234 m_pEditorMenuBar->setRestrictionsOfMenuMachine(oldInterfaceData.m_restrictionsOfMenuMachine); 235 m_pEditorMenuBar->setRestrictionsOfMenuView(oldInterfaceData.m_restrictionsOfMenuView); 236 m_pEditorMenuBar->setRestrictionsOfMenuInput(oldInterfaceData.m_restrictionsOfMenuInput); 237 m_pEditorMenuBar->setRestrictionsOfMenuDevices(oldInterfaceData.m_restrictionsOfMenuDevices); 238 #ifdef VBOX_WITH_DEBUGGER_GUI 239 m_pEditorMenuBar->setRestrictionsOfMenuDebug(oldInterfaceData.m_restrictionsOfMenuDebug); 240 #endif 241 #ifdef VBOX_WS_MAC 242 m_pEditorMenuBar->setRestrictionsOfMenuWindow(oldInterfaceData.m_restrictionsOfMenuWindow); 243 #endif 244 m_pEditorMenuBar->setRestrictionsOfMenuHelp(oldInterfaceData.m_restrictionsOfMenuHelp); 245 } 246 #ifndef VBOX_WS_MAC 247 if (m_pEditorMiniToolabSettings) 248 { 249 m_pEditorMiniToolabSettings->setShowMiniToolbar(oldInterfaceData.m_fShowMiniToolbar); 250 m_pEditorMiniToolabSettings->setMiniToolbarAtTop(oldInterfaceData.m_fMiniToolbarAtTop); 251 } 252 #endif 253 if (m_pEditorVisualState) 254 { 255 m_pEditorVisualState->setMachineId(m_machine.GetId()); 256 m_pEditorVisualState->setValue(oldInterfaceData.m_enmVisualState); 257 } 238 258 239 259 /* Polish page finally: */ … … 246 266 void UIMachineSettingsInterface::putToCache() 247 267 { 248 /* Prepare new interface data: */ 268 /* Sanity check: */ 269 if (!m_pCache) 270 return; 271 272 /* Prepare new data: */ 249 273 UIDataSettingsMachineInterface newInterfaceData; 250 274 251 /* Gather new interface data: */ 252 newInterfaceData.m_fStatusBarEnabled = m_pEditorStatusBar->isStatusBarEnabled(); 253 newInterfaceData.m_statusBarRestrictions = m_pEditorStatusBar->statusBarIndicatorRestrictions(); 254 newInterfaceData.m_statusBarOrder = m_pEditorStatusBar->statusBarIndicatorOrder(); 255 #ifndef VBOX_WS_MAC 256 newInterfaceData.m_fMenuBarEnabled = m_pEditorMenuBar->isMenuBarEnabled(); 257 #endif 258 newInterfaceData.m_restrictionsOfMenuBar = m_pEditorMenuBar->restrictionsOfMenuBar(); 259 newInterfaceData.m_restrictionsOfMenuApplication = m_pEditorMenuBar->restrictionsOfMenuApplication(); 260 newInterfaceData.m_restrictionsOfMenuMachine = m_pEditorMenuBar->restrictionsOfMenuMachine(); 261 newInterfaceData.m_restrictionsOfMenuView = m_pEditorMenuBar->restrictionsOfMenuView(); 262 newInterfaceData.m_restrictionsOfMenuInput = m_pEditorMenuBar->restrictionsOfMenuInput(); 263 newInterfaceData.m_restrictionsOfMenuDevices = m_pEditorMenuBar->restrictionsOfMenuDevices(); 264 #ifdef VBOX_WITH_DEBUGGER_GUI 265 newInterfaceData.m_restrictionsOfMenuDebug = m_pEditorMenuBar->restrictionsOfMenuDebug(); 266 #endif 267 #ifdef VBOX_WS_MAC 268 newInterfaceData.m_restrictionsOfMenuWindow = m_pEditorMenuBar->restrictionsOfMenuWindow(); 269 #endif 270 newInterfaceData.m_restrictionsOfMenuHelp = m_pEditorMenuBar->restrictionsOfMenuHelp(); 271 #ifndef VBOX_WS_MAC 272 newInterfaceData.m_fShowMiniToolbar = m_pEditorMiniToolabSettings->showMiniToolbar(); 273 newInterfaceData.m_fMiniToolbarAtTop = m_pEditorMiniToolabSettings->miniToolbarAtTop(); 274 #endif 275 newInterfaceData.m_enmVisualState = m_pEditorVisualState->value(); 276 277 /* Cache new interface data: */ 275 /* Cache new data: */ 276 if (m_pEditorStatusBar) 277 { 278 newInterfaceData.m_fStatusBarEnabled = m_pEditorStatusBar->isStatusBarEnabled(); 279 newInterfaceData.m_statusBarRestrictions = m_pEditorStatusBar->statusBarIndicatorRestrictions(); 280 newInterfaceData.m_statusBarOrder = m_pEditorStatusBar->statusBarIndicatorOrder(); 281 } 282 if (m_pEditorMenuBar) 283 { 284 #ifndef VBOX_WS_MAC 285 newInterfaceData.m_fMenuBarEnabled = m_pEditorMenuBar->isMenuBarEnabled(); 286 #endif 287 newInterfaceData.m_restrictionsOfMenuBar = m_pEditorMenuBar->restrictionsOfMenuBar(); 288 newInterfaceData.m_restrictionsOfMenuApplication = m_pEditorMenuBar->restrictionsOfMenuApplication(); 289 newInterfaceData.m_restrictionsOfMenuMachine = m_pEditorMenuBar->restrictionsOfMenuMachine(); 290 newInterfaceData.m_restrictionsOfMenuView = m_pEditorMenuBar->restrictionsOfMenuView(); 291 newInterfaceData.m_restrictionsOfMenuInput = m_pEditorMenuBar->restrictionsOfMenuInput(); 292 newInterfaceData.m_restrictionsOfMenuDevices = m_pEditorMenuBar->restrictionsOfMenuDevices(); 293 #ifdef VBOX_WITH_DEBUGGER_GUI 294 newInterfaceData.m_restrictionsOfMenuDebug = m_pEditorMenuBar->restrictionsOfMenuDebug(); 295 #endif 296 #ifdef VBOX_WS_MAC 297 newInterfaceData.m_restrictionsOfMenuWindow = m_pEditorMenuBar->restrictionsOfMenuWindow(); 298 #endif 299 newInterfaceData.m_restrictionsOfMenuHelp = m_pEditorMenuBar->restrictionsOfMenuHelp(); 300 } 301 #ifndef VBOX_WS_MAC 302 if (m_pEditorMiniToolabSettings) 303 { 304 newInterfaceData.m_fShowMiniToolbar = m_pEditorMiniToolabSettings->showMiniToolbar(); 305 newInterfaceData.m_fMiniToolbarAtTop = m_pEditorMiniToolabSettings->miniToolbarAtTop(); 306 } 307 #endif 308 if (m_pEditorVisualState) 309 newInterfaceData.m_enmVisualState = m_pEditorVisualState->value(); 278 310 m_pCache->cacheCurrentData(newInterfaceData); 279 311 } … … 384 416 bool UIMachineSettingsInterface::saveData() 385 417 { 418 /* Sanity check: */ 419 if (!m_pCache) 420 return false; 421 386 422 /* Prepare result: */ 387 423 bool fSuccess = true; … … 408 444 bool UIMachineSettingsInterface::saveMenuBarData() 409 445 { 446 /* Sanity check: */ 447 if (!m_pCache) 448 return false; 449 410 450 /* Prepare result: */ 411 451 bool fSuccess = true; … … 413 453 if (fSuccess) 414 454 { 415 /* Get old interfacedata from cache: */455 /* Get old data from cache: */ 416 456 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base(); 417 /* Get new interfacedata from cache: */457 /* Get new data from cache: */ 418 458 const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data(); 419 459 … … 461 501 bool UIMachineSettingsInterface::saveStatusBarData() 462 502 { 503 /* Sanity check: */ 504 if (!m_pCache) 505 return false; 506 463 507 /* Prepare result: */ 464 508 bool fSuccess = true; … … 466 510 if (fSuccess) 467 511 { 468 /* Get old interfacedata from cache: */512 /* Get old data from cache: */ 469 513 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base(); 470 /* Get new interfacedata from cache: */514 /* Get new data from cache: */ 471 515 const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data(); 472 516 … … 487 531 bool UIMachineSettingsInterface::saveMiniToolbarData() 488 532 { 533 /* Sanity check: */ 534 if (!m_pCache) 535 return false; 536 489 537 /* Prepare result: */ 490 538 bool fSuccess = true; … … 492 540 if (fSuccess) 493 541 { 494 /* Get old interfacedata from cache: */542 /* Get old data from cache: */ 495 543 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base(); Q_UNUSED(oldInterfaceData); 496 /* Get new interfacedata from cache: */544 /* Get new data from cache: */ 497 545 const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data(); Q_UNUSED(newInterfaceData); 498 546 … … 512 560 bool UIMachineSettingsInterface::saveVisualStateData() 513 561 { 562 /* Sanity check: */ 563 if (!m_pCache) 564 return false; 565 514 566 /* Prepare result: */ 515 567 bool fSuccess = true; … … 517 569 if (fSuccess) 518 570 { 519 /* Get old interfacedata from cache: */571 /* Get old data from cache: */ 520 572 const UIDataSettingsMachineInterface &oldInterfaceData = m_pCache->base(); 521 /* Get new interfacedata from cache: */573 /* Get new data from cache: */ 522 574 const UIDataSettingsMachineInterface &newInterfaceData = m_pCache->data(); 523 575 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r94653 r94667 238 238 void UIMachineSettingsNetwork::getAdapterDataFromCache(const UISettingsCacheMachineNetworkAdapter &adapterCache) 239 239 { 240 /* Get old adapterdata: */240 /* Get old data: */ 241 241 const UIDataSettingsMachineNetworkAdapter &oldAdapterData = adapterCache.base(); 242 242 … … 284 284 void UIMachineSettingsNetwork::putAdapterDataToCache(UISettingsCacheMachineNetworkAdapter &adapterCache) 285 285 { 286 /* Prepare new adapterdata: */286 /* Prepare new data: */ 287 287 UIDataSettingsMachineNetworkAdapter newAdapterData; 288 288 … … 342 342 } 343 343 344 /* Cache new adapterdata: */344 /* Cache new data: */ 345 345 adapterCache.cacheCurrentData(newAdapterData); 346 346 } … … 661 661 #endif 662 662 663 /* Prepare old networkdata: */663 /* Prepare old data: */ 664 664 UIDataSettingsMachineNetwork oldNetworkData; 665 665 … … 667 667 for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot) 668 668 { 669 /* Prepare old adapterdata: */669 /* Prepare old data: */ 670 670 UIDataSettingsMachineNetworkAdapter oldAdapterData; 671 671 … … 674 674 if (!comAdapter.isNull()) 675 675 { 676 /* Gather old adapterdata: */676 /* Gather old data: */ 677 677 oldAdapterData.m_iSlot = iSlot; 678 678 oldAdapterData.m_fAdapterEnabled = comAdapter.GetEnabled(); … … 696 696 foreach (const QString &strRedirect, comAdapter.GetNATEngine().GetRedirects()) 697 697 { 698 /* Gather old forwardingdata & cache key: */698 /* Gather old data & cache key: */ 699 699 const QStringList &forwardingData = strRedirect.split(','); 700 700 AssertMsg(forwardingData.size() == 6, ("Redirect rule should be composed of 6 parts!\n")); … … 706 706 forwardingData.at(5).toUInt()); 707 707 const QString &strForwardingKey = forwardingData.at(0); 708 /* Cache old forwardingdata: */708 /* Cache old data: */ 709 709 m_pCache->child(iSlot).child(strForwardingKey).cacheInitialData(oldForwardingData); 710 710 } 711 711 } 712 712 713 /* Cache old adapterdata: */713 /* Cache old data: */ 714 714 m_pCache->child(iSlot).cacheInitialData(oldAdapterData); 715 715 } 716 716 717 /* Cache old networkdata: */717 /* Cache old data: */ 718 718 m_pCache->cacheInitialData(oldNetworkData); 719 719 … … 741 741 AssertPtrReturnVoid(pTab); 742 742 743 /* Load old adapterdata from cache: */743 /* Load old data from cache: */ 744 744 pTab->getAdapterDataFromCache(m_pCache->child(iSlot)); 745 745 … … 765 765 return; 766 766 767 /* Prepare new networkdata: */767 /* Prepare new data: */ 768 768 UIDataSettingsMachineNetwork newNetworkData; 769 769 … … 775 775 AssertPtrReturnVoid(pTab); 776 776 777 /* Gather new adapterdata: */777 /* Gather new data: */ 778 778 pTab->putAdapterDataToCache(m_pCache->child(iSlot)); 779 779 } 780 780 781 /* Cache new networkdata: */781 /* Cache new data: */ 782 782 m_pCache->cacheCurrentData(newNetworkData); 783 783 } … … 1137 1137 if (fSuccess && m_pCache->child(iSlot).wasChanged()) 1138 1138 { 1139 /* Get old networkdata from cache: */1139 /* Get old data from cache: */ 1140 1140 const UIDataSettingsMachineNetworkAdapter &oldAdapterData = m_pCache->child(iSlot).base(); 1141 /* Get new networkdata from cache: */1141 /* Get new data from cache: */ 1142 1142 const UIDataSettingsMachineNetworkAdapter &newAdapterData = m_pCache->child(iSlot).data(); 1143 1143 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r94333 r94667 320 320 bool UIMachineSettingsSF::changed() const 321 321 { 322 return m_pCache ->wasChanged();322 return m_pCache ? m_pCache->wasChanged() : false; 323 323 } 324 324 325 325 void UIMachineSettingsSF::loadToCacheFrom(QVariant &data) 326 326 { 327 /* Sanity check: */ 328 if (!m_pCache) 329 return; 330 327 331 /* Fetch data to machine: */ 328 332 UISettingsPageMachine::fetchData(data); … … 331 335 m_pCache->clear(); 332 336 333 /* Prepare old foldersdata: */337 /* Prepare old data: */ 334 338 UIDataSettingsSharedFolders oldFoldersData; 335 339 … … 356 360 for (int iFolderIndex = 0; iFolderIndex < currentTypeFolders.size(); ++iFolderIndex) 357 361 { 358 /* Prepare old folderdata & cache key: */362 /* Prepare old data & cache key: */ 359 363 UIDataSettingsSharedFolder oldFolderData; 360 364 QString strFolderKey = QString::number(iFolderIndex); … … 364 368 if (!comFolder.isNull()) 365 369 { 366 /* Gather old folderdata: */370 /* Gather old data: */ 367 371 oldFolderData.m_enmType = enmFolderType; 368 372 oldFolderData.m_strName = comFolder.GetName(); … … 375 379 } 376 380 377 /* Cache old folderdata: */381 /* Cache old data: */ 378 382 m_pCache->child(strFolderKey).cacheInitialData(oldFolderData); 379 383 } 380 384 } 381 385 382 /* Cache old foldersdata: */386 /* Cache old data: */ 383 387 m_pCache->cacheInitialData(oldFoldersData); 384 388 … … 389 393 void UIMachineSettingsSF::getFromCache() 390 394 { 395 /* Sanity check: */ 396 if ( !m_pCache 397 || !m_pTreeWidget) 398 return; 399 391 400 /* Clear list initially: */ 392 401 m_pTreeWidget->clear(); … … 409 418 void UIMachineSettingsSF::putToCache() 410 419 { 411 /* Prepare new folders data: */ 420 /* Sanity check: */ 421 if ( !m_pCache 422 || !m_pTreeWidget) 423 return; 424 425 /* Prepare new data: */ 412 426 UIDataSettingsSharedFolders newFoldersData; 413 427 … … 422 436 for (int iFolderIndex = 0; iFolderIndex < pFolderTypeRoot->childCount(); ++iFolderIndex) 423 437 { 424 /* Gather and cache new folderdata: */438 /* Gather and cache new data: */ 425 439 const SFTreeViewItem *pItem = static_cast<SFTreeViewItem*>(pFolderTypeRoot->child(iFolderIndex)); 426 440 m_pCache->child(pItem->m_strName).cacheCurrentData(*pItem); … … 428 442 } 429 443 430 /* Cache new foldersdata: */444 /* Cache new data: */ 431 445 m_pCache->cacheCurrentData(newFoldersData); 432 446 } … … 515 529 Assert(!strName.isEmpty() && !strPath.isEmpty()); 516 530 517 /* Prepare new folderdata: */531 /* Prepare new data: */ 518 532 UIDataSettingsSharedFolder newFolderData; 519 533 newFolderData.m_enmType = enmType; … … 1029 1043 bool UIMachineSettingsSF::saveData() 1030 1044 { 1045 /* Sanity check: */ 1046 if (!m_pCache) 1047 return false; 1048 1031 1049 /* Prepare result: */ 1032 1050 bool fSuccess = true; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r94333 r94667 571 571 bool UIMachineSettingsSerialPage::changed() const 572 572 { 573 return m_pCache ->wasChanged();573 return m_pCache ? m_pCache->wasChanged() : false; 574 574 } 575 575 576 576 void UIMachineSettingsSerialPage::loadToCacheFrom(QVariant &data) 577 577 { 578 /* Sanity check: */ 579 if ( !m_pCache 580 || !m_pTabWidget) 581 return; 582 578 583 /* Fetch data to machine: */ 579 584 UISettingsPageMachine::fetchData(data); … … 582 587 m_pCache->clear(); 583 588 584 /* Prepare old serialdata: */589 /* Prepare old data: */ 585 590 UIDataSettingsMachineSerial oldSerialData; 586 591 … … 588 593 for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot) 589 594 { 590 /* Prepare old portdata: */595 /* Prepare old data: */ 591 596 UIDataSettingsMachineSerialPort oldPortData; 592 597 … … 595 600 if (!comPort.isNull()) 596 601 { 597 /* Gather old portdata: */602 /* Gather old data: */ 598 603 oldPortData.m_iSlot = iSlot; 599 604 oldPortData.m_fPortEnabled = comPort.GetEnabled(); … … 605 610 } 606 611 607 /* Cache old portdata: */612 /* Cache old data: */ 608 613 m_pCache->child(iSlot).cacheInitialData(oldPortData); 609 614 } 610 615 611 /* Cache old serialdata: */616 /* Cache old data: */ 612 617 m_pCache->cacheInitialData(oldSerialData); 613 618 … … 618 623 void UIMachineSettingsSerialPage::getFromCache() 619 624 { 625 /* Sanity check: */ 626 if ( !m_pCache 627 || !m_pTabWidget) 628 return; 629 620 630 /* Setup tab order: */ 621 631 AssertPtrReturnVoid(firstWidget()); … … 627 637 { 628 638 /* Get port page: */ 629 UIMachineSettingsSerial *pPage = qobject_cast<UIMachineSettingsSerial*>(m_pTabWidget->widget(iSlot)); 630 631 /* Load old port data from cache: */ 632 pPage->loadPortData(m_pCache->child(iSlot).base()); 639 UIMachineSettingsSerial *pTab = qobject_cast<UIMachineSettingsSerial*>(m_pTabWidget->widget(iSlot)); 640 AssertPtrReturnVoid(pTab); 641 642 /* Load old data from cache: */ 643 pTab->loadPortData(m_pCache->child(iSlot).base()); 633 644 634 645 /* Setup tab order: */ 635 pLastFocusWidget = p Page->setOrderAfter(pLastFocusWidget);646 pLastFocusWidget = pTab->setOrderAfter(pLastFocusWidget); 636 647 } 637 648 … … 648 659 void UIMachineSettingsSerialPage::putToCache() 649 660 { 650 /* Prepare new serial data: */ 661 /* Sanity check: */ 662 if ( !m_pCache 663 || !m_pTabWidget) 664 return; 665 666 /* Prepare new data: */ 651 667 UIDataSettingsMachineSerial newSerialData; 652 668 … … 656 672 /* Getting port page: */ 657 673 UIMachineSettingsSerial *pTab = qobject_cast<UIMachineSettingsSerial*>(m_pTabWidget->widget(iSlot)); 658 659 /* Prepare new port data: */ 674 AssertPtrReturnVoid(pTab); 675 676 /* Prepare new data: */ 660 677 UIDataSettingsMachineSerialPort newPortData; 661 678 662 /* Gather new portdata: */679 /* Gather new data: */ 663 680 pTab->savePortData(newPortData); 664 681 665 /* Cache new portdata: */682 /* Cache new data: */ 666 683 m_pCache->child(iSlot).cacheCurrentData(newPortData); 667 684 } 668 685 669 /* Cache new serialdata: */686 /* Cache new data: */ 670 687 m_pCache->cacheCurrentData(newSerialData); 671 688 } … … 777 794 m_pCache->child(iSlot).base().m_fPortEnabled)); 778 795 UIMachineSettingsSerial *pTab = qobject_cast<UIMachineSettingsSerial*>(m_pTabWidget->widget(iSlot)); 796 AssertPtrReturnVoid(pTab); 779 797 pTab->polishTab(); 780 798 } … … 825 843 bool UIMachineSettingsSerialPage::saveData() 826 844 { 845 /* Sanity check: */ 846 if ( !m_pCache 847 || !m_pTabWidget) 848 return false; 849 827 850 /* Prepare result: */ 828 851 bool fSuccess = true; … … 840 863 bool UIMachineSettingsSerialPage::savePortData(int iSlot) 841 864 { 865 /* Sanity check: */ 866 if (!m_pCache) 867 return false; 868 842 869 /* Prepare result: */ 843 870 bool fSuccess = true; … … 845 872 if (fSuccess && m_pCache->child(iSlot).wasChanged()) 846 873 { 847 /* Get old serialdata from cache: */874 /* Get old data from cache: */ 848 875 const UIDataSettingsMachineSerialPort &oldPortData = m_pCache->child(iSlot).base(); 849 /* Get new serialdata from cache: */876 /* Get new data from cache: */ 850 877 const UIDataSettingsMachineSerialPort &newPortData = m_pCache->child(iSlot).data(); 851 878 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r94394 r94667 3032 3032 bool UIMachineSettingsStorage::changed() const 3033 3033 { 3034 return m_pCache ->wasChanged();3034 return m_pCache ? m_pCache->wasChanged() : false; 3035 3035 } 3036 3036 3037 3037 void UIMachineSettingsStorage::loadToCacheFrom(QVariant &data) 3038 3038 { 3039 /* Sanity check: */ 3040 if (!m_pCache) 3041 return; 3042 3039 3043 /* Fetch data to machine: */ 3040 3044 UISettingsPageMachine::fetchData(data); … … 3043 3047 m_pCache->clear(); 3044 3048 3045 /* Prepare old storagedata: */3049 /* Prepare old data: */ 3046 3050 UIDataSettingsMachineStorage oldStorageData; 3047 3051 3048 /* Gather old commondata: */3052 /* Gather old data: */ 3049 3053 m_uMachineId = m_machine.GetId(); 3050 3054 m_strMachineSettingsFilePath = m_machine.GetSettingsFilePath(); … … 3056 3060 for (int iControllerIndex = 0; iControllerIndex < controllers.size(); ++iControllerIndex) 3057 3061 { 3058 /* Prepare old controllerdata & cache key: */3062 /* Prepare old data & cache key: */ 3059 3063 UIDataSettingsMachineStorageController oldControllerData; 3060 3064 QString strControllerKey = QString::number(iControllerIndex); … … 3064 3068 if (!comController.isNull()) 3065 3069 { 3066 /* Gather old controllerdata: */3070 /* Gather old data: */ 3067 3071 oldControllerData.m_strName = comController.GetName(); 3068 3072 oldControllerData.m_enmBus = comController.GetBus(); … … 3088 3092 for (int iAttachmentIndex = 0; iAttachmentIndex < attachments.size(); ++iAttachmentIndex) 3089 3093 { 3090 /* Prepare old attachmentdata & cache key: */3094 /* Prepare old data & cache key: */ 3091 3095 UIDataSettingsMachineStorageAttachment oldAttachmentData; 3092 3096 QString strAttachmentKey = QString::number(iAttachmentIndex); … … 3096 3100 if (!comAttachment.isNull()) 3097 3101 { 3098 /* Gather old attachmentdata: */3102 /* Gather old data: */ 3099 3103 oldAttachmentData.m_enmDeviceType = comAttachment.GetType(); 3100 3104 oldAttachmentData.m_iPort = comAttachment.GetPort(); … … 3110 3114 } 3111 3115 3112 /* Cache old attachmentdata: */3116 /* Cache old data: */ 3113 3117 m_pCache->child(strControllerKey).child(strAttachmentKey).cacheInitialData(oldAttachmentData); 3114 3118 } 3115 3119 } 3116 3120 3117 /* Cache old controllerdata: */3121 /* Cache old data: */ 3118 3122 m_pCache->child(strControllerKey).cacheInitialData(oldControllerData); 3119 3123 } 3120 3124 3121 /* Cache old storagedata: */3125 /* Cache old data: */ 3122 3126 m_pCache->cacheInitialData(oldStorageData); 3123 3127 … … 3128 3132 void UIMachineSettingsStorage::getFromCache() 3129 3133 { 3134 /* Sanity check: */ 3135 if ( !m_pCache 3136 || !m_pModelStorage 3137 || !m_pTreeViewStorage) 3138 return; 3139 3130 3140 /* Clear model initially: */ 3131 3141 m_pModelStorage->clear(); 3132 3142 3133 /* Load old commondata from cache: */3143 /* Load old data from cache: */ 3134 3144 m_pModelStorage->setMachineId(m_uMachineId); 3135 3145 … … 3139 3149 /* Get controller cache: */ 3140 3150 const UISettingsCacheMachineStorageController &controllerCache = m_pCache->child(iControllerIndex); 3141 /* Get old controllerdata from cache: */3151 /* Get old data from cache: */ 3142 3152 const UIDataSettingsMachineStorageController &oldControllerData = controllerCache.base(); 3143 3153 3144 /* Load old controllerdata from cache: */3154 /* Load old data from cache: */ 3145 3155 const QModelIndex controllerIndex = m_pModelStorage->addController(oldControllerData.m_strName, 3146 3156 oldControllerData.m_enmBus, … … 3155 3165 /* Get attachment cache: */ 3156 3166 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 3157 /* Get old attachmentdata from cache: */3167 /* Get old data from cache: */ 3158 3168 const UIDataSettingsMachineStorageAttachment &oldAttachmentData = attachmentCache.base(); 3159 3169 3160 /* Load old attachmentdata from cache: */3170 /* Load old data from cache: */ 3161 3171 const QModelIndex attachmentIndex = m_pModelStorage->addAttachment(controllerId, 3162 3172 oldAttachmentData.m_enmDeviceType, … … 3189 3199 void UIMachineSettingsStorage::putToCache() 3190 3200 { 3191 /* Prepare new storage data: */ 3201 /* Sanity check: */ 3202 if ( !m_pCache 3203 || !m_pModelStorage) 3204 return; 3205 3206 /* Prepare new data: */ 3192 3207 UIDataSettingsMachineStorage newStorageData; 3193 3208 … … 3196 3211 for (int iControllerIndex = 0; iControllerIndex < m_pModelStorage->rowCount(rootIndex); ++iControllerIndex) 3197 3212 { 3198 /* Prepare new controllerdata & key: */3213 /* Prepare new data & key: */ 3199 3214 UIDataSettingsMachineStorageController newControllerData; 3200 3215 3201 /* Gather new controllerdata & cache key from model: */3216 /* Gather new data & cache key from model: */ 3202 3217 const QModelIndex controllerIndex = m_pModelStorage->index(iControllerIndex, 0, rootIndex); 3203 3218 newControllerData.m_strName = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrName).toString(); … … 3211 3226 for (int iAttachmentIndex = 0; iAttachmentIndex < m_pModelStorage->rowCount(controllerIndex); ++iAttachmentIndex) 3212 3227 { 3213 /* Prepare new attachmentdata & key: */3228 /* Prepare new data & key: */ 3214 3229 UIDataSettingsMachineStorageAttachment newAttachmentData; 3215 3230 3216 /* Gather new attachmentdata & cache key from model: */3231 /* Gather new data & cache key from model: */ 3217 3232 const QModelIndex attachmentIndex = m_pModelStorage->index(iAttachmentIndex, 0, controllerIndex); 3218 3233 newAttachmentData.m_enmDeviceType = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>(); … … 3227 3242 const QString strAttachmentKey = QString("%1:%2").arg(newAttachmentData.m_iPort).arg(newAttachmentData.m_iDevice); 3228 3243 3229 /* Cache new attachmentdata: */3244 /* Cache new data: */ 3230 3245 m_pCache->child(strControllerKey).child(strAttachmentKey).cacheCurrentData(newAttachmentData); 3231 3246 } 3232 3247 3233 /* Cache new controllerdata: */3248 /* Cache new data: */ 3234 3249 m_pCache->child(strControllerKey).cacheCurrentData(newControllerData); 3235 3250 } 3236 3251 3237 /* Cache new storagedata: */3252 /* Cache new data: */ 3238 3253 m_pCache->cacheCurrentData(newStorageData); 3239 3254 } … … 5381 5396 bool UIMachineSettingsStorage::saveData() 5382 5397 { 5398 /* Sanity check: */ 5399 if (!m_pCache) 5400 return false; 5401 5383 5402 /* Prepare result: */ 5384 5403 bool fSuccess = true; … … 5445 5464 if (fSuccess && isMachineOffline()) 5446 5465 { 5447 /* Get old controllerdata from cache: */5466 /* Get old data from cache: */ 5448 5467 const UIDataSettingsMachineStorageController &oldControllerData = controllerCache.base(); 5449 5468 … … 5475 5494 if (fSuccess && isMachineOffline()) 5476 5495 { 5477 /* Get new controllerdata from cache: */5496 /* Get new data from cache: */ 5478 5497 const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data(); 5479 5498 … … 5562 5581 if (fSuccess) 5563 5582 { 5564 /* Get old controllerdata from cache: */5583 /* Get old data from cache: */ 5565 5584 const UIDataSettingsMachineStorageController &oldControllerData = controllerCache.base(); 5566 /* Get new controllerdata from cache: */5585 /* Get new data from cache: */ 5567 5586 const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data(); 5568 5587 … … 5666 5685 if (fSuccess) 5667 5686 { 5668 /* Get old controllerdata from cache: */5687 /* Get old data from cache: */ 5669 5688 const UIDataSettingsMachineStorageController &oldControllerData = controllerCache.base(); 5670 /* Get old attachmentdata from cache: */5689 /* Get old data from cache: */ 5671 5690 const UIDataSettingsMachineStorageAttachment &oldAttachmentData = attachmentCache.base(); 5672 5691 … … 5703 5722 if (fSuccess) 5704 5723 { 5705 /* Get new controllerdata from cache: */5724 /* Get new data from cache: */ 5706 5725 const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data(); 5707 /* Get new attachmentdata from cache: */5726 /* Get new data from cache: */ 5708 5727 const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data(); 5709 5728 … … 5793 5812 if (fSuccess) 5794 5813 { 5795 /* Get new controllerdata from cache: */5814 /* Get new data from cache: */ 5796 5815 const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data(); 5797 /* Get new attachmentdata from cache: */5816 /* Get new data from cache: */ 5798 5817 const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data(); 5799 5818 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r94333 r94667 257 257 bool UIMachineSettingsSystem::changed() const 258 258 { 259 return m_pCache ->wasChanged();259 return m_pCache ? m_pCache->wasChanged() : false; 260 260 } 261 261 262 262 void UIMachineSettingsSystem::loadToCacheFrom(QVariant &data) 263 263 { 264 /* Sanity check: */ 265 if (!m_pCache) 266 return; 267 264 268 /* Fetch data to machine: */ 265 269 UISettingsPageMachine::fetchData(data); … … 268 272 m_pCache->clear(); 269 273 270 /* Prepare old systemdata: */274 /* Prepare old data: */ 271 275 UIDataSettingsMachineSystem oldSystemData; 272 276 … … 297 301 oldSystemData.m_fEnabledNestedPaging = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging); 298 302 299 /* Cache old systemdata: */303 /* Cache old data: */ 300 304 m_pCache->cacheInitialData(oldSystemData); 301 305 … … 306 310 void UIMachineSettingsSystem::getFromCache() 307 311 { 308 /* Get old system data from cache: */ 312 /* Sanity check: */ 313 if (!m_pCache) 314 return; 315 316 /* Get old data from cache: */ 309 317 const UIDataSettingsMachineSystem &oldSystemData = m_pCache->base(); 310 318 … … 316 324 317 325 /* Load old 'Motherboard' data from cache: */ 318 m_pEditorBaseMemory->setValue(oldSystemData.m_iMemorySize); 319 m_pEditorBootOrder->setValue(oldSystemData.m_bootItems); 320 const int iChipsetTypePosition = m_pComboChipset->findData(oldSystemData.m_chipsetType); 321 m_pComboChipset->setCurrentIndex(iChipsetTypePosition == -1 ? 0 : iChipsetTypePosition); 322 const int iHIDTypePosition = m_pComboPointingHID->findData(oldSystemData.m_pointingHIDType); 323 m_pComboPointingHID->setCurrentIndex(iHIDTypePosition == -1 ? 0 : iHIDTypePosition); 324 m_pCheckBoxAPIC->setChecked(oldSystemData.m_fEnabledIoApic); 325 m_pCheckBoxEFI->setChecked(oldSystemData.m_fEnabledEFI); 326 m_pCheckBoxUTC->setChecked(oldSystemData.m_fEnabledUTC); 326 if (m_pEditorBaseMemory) 327 m_pEditorBaseMemory->setValue(oldSystemData.m_iMemorySize); 328 if (m_pEditorBootOrder) 329 m_pEditorBootOrder->setValue(oldSystemData.m_bootItems); 330 if (m_pComboChipset) 331 { 332 const int iChipsetTypePosition = m_pComboChipset->findData(oldSystemData.m_chipsetType); 333 m_pComboChipset->setCurrentIndex(iChipsetTypePosition == -1 ? 0 : iChipsetTypePosition); 334 } 335 if (m_pComboPointingHID) 336 { 337 const int iHIDTypePosition = m_pComboPointingHID->findData(oldSystemData.m_pointingHIDType); 338 m_pComboPointingHID->setCurrentIndex(iHIDTypePosition == -1 ? 0 : iHIDTypePosition); 339 } 340 if (m_pCheckBoxAPIC) 341 m_pCheckBoxAPIC->setChecked(oldSystemData.m_fEnabledIoApic); 342 if (m_pCheckBoxEFI) 343 m_pCheckBoxEFI->setChecked(oldSystemData.m_fEnabledEFI); 344 if (m_pCheckBoxUTC) 345 m_pCheckBoxUTC->setChecked(oldSystemData.m_fEnabledUTC); 327 346 328 347 /* Load old 'Processor' data from cache: */ 329 m_pSliderProcessorCount->setValue(oldSystemData.m_cCPUCount); 330 m_pSliderProcessorExecCap->setValue(oldSystemData.m_iCPUExecCap); 331 m_pCheckBoxPAE->setChecked(oldSystemData.m_fEnabledPAE); 332 m_pCheckBoxNestedVirtualization->setChecked(oldSystemData.m_fEnabledNestedHwVirtEx); 348 if (m_pSliderProcessorCount) 349 m_pSliderProcessorCount->setValue(oldSystemData.m_cCPUCount); 350 if (m_pSliderProcessorExecCap) 351 m_pSliderProcessorExecCap->setValue(oldSystemData.m_iCPUExecCap); 352 if (m_pCheckBoxPAE) 353 m_pCheckBoxPAE->setChecked(oldSystemData.m_fEnabledPAE); 354 if (m_pCheckBoxNestedVirtualization) 355 m_pCheckBoxNestedVirtualization->setChecked(oldSystemData.m_fEnabledNestedHwVirtEx); 333 356 334 357 /* Load old 'Acceleration' data from cache: */ 335 const int iParavirtProviderPosition = m_pComboParavirtProvider->findData(oldSystemData.m_paravirtProvider); 336 m_pComboParavirtProvider->setCurrentIndex(iParavirtProviderPosition == -1 ? 0 : iParavirtProviderPosition); 337 m_pCheckBoxVirtualization->setChecked(oldSystemData.m_fEnabledHwVirtEx); 338 m_pCheckBoxNestedPaging->setChecked(oldSystemData.m_fEnabledNestedPaging); 358 if (m_pComboParavirtProvider) 359 { 360 const int iParavirtProviderPosition = m_pComboParavirtProvider->findData(oldSystemData.m_paravirtProvider); 361 m_pComboParavirtProvider->setCurrentIndex(iParavirtProviderPosition == -1 ? 0 : iParavirtProviderPosition); 362 } 363 if (m_pCheckBoxVirtualization) 364 m_pCheckBoxVirtualization->setChecked(oldSystemData.m_fEnabledHwVirtEx); 365 if (m_pCheckBoxNestedPaging) 366 m_pCheckBoxNestedPaging->setChecked(oldSystemData.m_fEnabledNestedPaging); 339 367 340 368 /* Polish page finally: */ … … 347 375 void UIMachineSettingsSystem::putToCache() 348 376 { 349 /* Prepare new system data: */ 377 /* Sanity check: */ 378 if (!m_pCache) 379 return; 380 381 /* Prepare new data: */ 350 382 UIDataSettingsMachineSystem newSystemData; 351 383 … … 357 389 358 390 /* Gather 'Motherboard' data: */ 359 newSystemData.m_iMemorySize = m_pEditorBaseMemory->value(); 360 newSystemData.m_bootItems = m_pEditorBootOrder->value(); 361 newSystemData.m_chipsetType = m_pComboChipset->currentData().value<KChipsetType>(); 362 newSystemData.m_pointingHIDType = m_pComboPointingHID->currentData().value<KPointingHIDType>(); 363 newSystemData.m_fEnabledIoApic = m_pCheckBoxAPIC->isChecked() 364 || m_pSliderProcessorCount->value() > 1 365 || m_pComboChipset->currentData().value<KChipsetType>() == KChipsetType_ICH9; 366 newSystemData.m_fEnabledEFI = m_pCheckBoxEFI->isChecked(); 367 newSystemData.m_fEnabledUTC = m_pCheckBoxUTC->isChecked(); 391 if (m_pEditorBaseMemory) 392 newSystemData.m_iMemorySize = m_pEditorBaseMemory->value(); 393 if (m_pEditorBootOrder) 394 newSystemData.m_bootItems = m_pEditorBootOrder->value(); 395 if (m_pComboChipset) 396 newSystemData.m_chipsetType = m_pComboChipset->currentData().value<KChipsetType>(); 397 if (m_pComboPointingHID) 398 newSystemData.m_pointingHIDType = m_pComboPointingHID->currentData().value<KPointingHIDType>(); 399 if ( m_pCheckBoxAPIC 400 && m_pSliderProcessorCount 401 && m_pComboChipset) 402 newSystemData.m_fEnabledIoApic = m_pCheckBoxAPIC->isChecked() 403 || m_pSliderProcessorCount->value() > 1 404 || m_pComboChipset->currentData().value<KChipsetType>() == KChipsetType_ICH9; 405 if (m_pCheckBoxEFI) 406 newSystemData.m_fEnabledEFI = m_pCheckBoxEFI->isChecked(); 407 if (m_pCheckBoxUTC) 408 newSystemData.m_fEnabledUTC = m_pCheckBoxUTC->isChecked(); 368 409 369 410 /* Gather 'Processor' data: */ 370 newSystemData.m_cCPUCount = m_pSliderProcessorCount->value(); 371 newSystemData.m_iCPUExecCap = m_pSliderProcessorExecCap->value(); 372 newSystemData.m_fEnabledPAE = m_pCheckBoxPAE->isChecked(); 411 if (m_pSliderProcessorCount) 412 newSystemData.m_cCPUCount = m_pSliderProcessorCount->value(); 413 if (m_pSliderProcessorExecCap) 414 newSystemData.m_iCPUExecCap = m_pSliderProcessorExecCap->value(); 415 if (m_pCheckBoxPAE) 416 newSystemData.m_fEnabledPAE = m_pCheckBoxPAE->isChecked(); 373 417 newSystemData.m_fEnabledNestedHwVirtEx = isNestedHWVirtExEnabled(); 374 418 375 419 /* Gather 'Acceleration' data: */ 376 newSystemData.m_paravirtProvider = m_pComboParavirtProvider->currentData().value<KParavirtProvider>(); 420 if (m_pComboParavirtProvider) 421 newSystemData.m_paravirtProvider = m_pComboParavirtProvider->currentData().value<KParavirtProvider>(); 377 422 /* Enable HW Virt Ex automatically if it's supported and 378 423 * 1. multiple CPUs, 2. Nested Paging or 3. Nested HW Virt Ex is requested. */ 379 newSystemData.m_fEnabledHwVirtEx = isHWVirtExEnabled() 380 || ( isHWVirtExSupported() 381 && ( m_pSliderProcessorCount->value() > 1 382 || isNestedPagingEnabled() 383 || isNestedHWVirtExEnabled())); 424 if (m_pSliderProcessorCount) 425 newSystemData.m_fEnabledHwVirtEx = isHWVirtExEnabled() 426 || ( isHWVirtExSupported() 427 && ( m_pSliderProcessorCount->value() > 1 428 || isNestedPagingEnabled() 429 || isNestedHWVirtExEnabled())); 384 430 /* Enable Nested Paging automatically if it's supported and 385 431 * Nested HW Virt Ex is requested. */ 386 432 newSystemData.m_fEnabledNestedPaging = isNestedPagingEnabled() 387 388 389 390 /* Cache new systemdata: */433 || ( isNestedPagingSupported() 434 && isNestedHWVirtExEnabled()); 435 436 /* Cache new data: */ 391 437 m_pCache->cacheCurrentData(newSystemData); 392 438 } … … 686 732 void UIMachineSettingsSystem::polishPage() 687 733 { 688 /* Get old systemdata from cache: */734 /* Get old data from cache: */ 689 735 const UIDataSettingsMachineSystem &systemData = m_pCache->base(); 690 736 … … 1320 1366 bool UIMachineSettingsSystem::saveData() 1321 1367 { 1368 /* Sanity check: */ 1369 if (!m_pCache) 1370 return false; 1371 1322 1372 /* Prepare result: */ 1323 1373 bool fSuccess = true; … … 1341 1391 bool UIMachineSettingsSystem::saveMotherboardData() 1342 1392 { 1393 /* Sanity check: */ 1394 if (!m_pCache) 1395 return false; 1396 1343 1397 /* Prepare result: */ 1344 1398 bool fSuccess = true; … … 1346 1400 if (fSuccess) 1347 1401 { 1348 /* Get old systemdata from cache: */1402 /* Get old data from cache: */ 1349 1403 const UIDataSettingsMachineSystem &oldSystemData = m_pCache->base(); 1350 /* Get new systemdata from cache: */1404 /* Get new data from cache: */ 1351 1405 const UIDataSettingsMachineSystem &newSystemData = m_pCache->data(); 1352 1406 … … 1404 1458 bool UIMachineSettingsSystem::saveProcessorData() 1405 1459 { 1460 /* Sanity check: */ 1461 if (!m_pCache) 1462 return false; 1463 1406 1464 /* Prepare result: */ 1407 1465 bool fSuccess = true; … … 1409 1467 if (fSuccess) 1410 1468 { 1411 /* Get old systemdata from cache: */1469 /* Get old data from cache: */ 1412 1470 const UIDataSettingsMachineSystem &oldSystemData = m_pCache->base(); 1413 /* Get new systemdata from cache: */1471 /* Get new data from cache: */ 1414 1472 const UIDataSettingsMachineSystem &newSystemData = m_pCache->data(); 1415 1473 … … 1449 1507 bool UIMachineSettingsSystem::saveAccelerationData() 1450 1508 { 1509 /* Sanity check: */ 1510 if (!m_pCache) 1511 return false; 1512 1451 1513 /* Prepare result: */ 1452 1514 bool fSuccess = true; … … 1454 1516 if (fSuccess) 1455 1517 { 1456 /* Get old systemdata from cache: */1518 /* Get old data from cache: */ 1457 1519 const UIDataSettingsMachineSystem &oldSystemData = m_pCache->base(); 1458 /* Get new systemdata from cache: */1520 /* Get new data from cache: */ 1459 1521 const UIDataSettingsMachineSystem &newSystemData = m_pCache->data(); 1460 1522 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r94333 r94667 369 369 bool UIMachineSettingsUSB::changed() const 370 370 { 371 return m_pCache ->wasChanged();371 return m_pCache ? m_pCache->wasChanged() : false; 372 372 } 373 373 374 374 void UIMachineSettingsUSB::loadToCacheFrom(QVariant &data) 375 375 { 376 /* Sanity check: */ 377 if (!m_pCache) 378 return; 379 376 380 /* Fetch data to machine: */ 377 381 UISettingsPageMachine::fetchData(data); … … 398 402 for (int iFilterIndex = 0; iFilterIndex < filters.size(); ++iFilterIndex) 399 403 { 400 /* Prepare old filterdata: */404 /* Prepare old data: */ 401 405 UIDataSettingsMachineUSBFilter oldFilterData; 402 406 … … 405 409 if (!filter.isNull()) 406 410 { 407 /* Gather old filterdata: */411 /* Gather old data: */ 408 412 oldFilterData.m_fActive = filter.GetActive(); 409 413 oldFilterData.m_strName = filter.GetName(); … … 418 422 } 419 423 420 /* Cache old filterdata: */424 /* Cache old data: */ 421 425 m_pCache->child(iFilterIndex).cacheInitialData(oldFilterData); 422 426 } … … 432 436 void UIMachineSettingsUSB::getFromCache() 433 437 { 438 /* Sanity check: */ 439 if ( !m_pCache 440 || !m_pTreeWidgetFilters) 441 return; 442 434 443 /* Clear list initially: */ 435 444 m_pTreeWidgetFilters->clear(); … … 446 455 447 456 /* Adjust radio-button visibility: */ 448 m_pRadioButtonUSB1->setVisible(supportedTypes.contains(KUSBControllerType_OHCI)); 449 m_pRadioButtonUSB2->setVisible(supportedTypes.contains(KUSBControllerType_EHCI)); 450 m_pRadioButtonUSB3->setVisible(supportedTypes.contains(KUSBControllerType_XHCI)); 457 if (m_pRadioButtonUSB1) 458 m_pRadioButtonUSB1->setVisible(supportedTypes.contains(KUSBControllerType_OHCI)); 459 if (m_pRadioButtonUSB2) 460 m_pRadioButtonUSB2->setVisible(supportedTypes.contains(KUSBControllerType_EHCI)); 461 if (m_pRadioButtonUSB3) 462 m_pRadioButtonUSB3->setVisible(supportedTypes.contains(KUSBControllerType_XHCI)); 451 463 452 464 /* Load old USB data from cache: */ 453 m_pCheckBoxUSB->setChecked(oldUsbData.m_fUSBEnabled); 465 if (m_pCheckBoxUSB) 466 m_pCheckBoxUSB->setChecked(oldUsbData.m_fUSBEnabled); 454 467 switch (oldUsbData.m_USBControllerType) 455 468 { 456 469 default: 457 case KUSBControllerType_OHCI: m_pRadioButtonUSB1->setChecked(true); break; 458 case KUSBControllerType_EHCI: m_pRadioButtonUSB2->setChecked(true); break; 459 case KUSBControllerType_XHCI: m_pRadioButtonUSB3->setChecked(true); break; 470 case KUSBControllerType_OHCI: 471 { 472 if (m_pRadioButtonUSB1) 473 m_pRadioButtonUSB1->setChecked(true); 474 break; 475 } 476 case KUSBControllerType_EHCI: 477 { 478 if (m_pRadioButtonUSB2) 479 m_pRadioButtonUSB2->setChecked(true); 480 break; 481 } 482 case KUSBControllerType_XHCI: 483 { 484 if (m_pRadioButtonUSB3) 485 m_pRadioButtonUSB3->setChecked(true); 486 break; 487 } 460 488 } 461 489 … … 466 494 /* Choose first filter as current: */ 467 495 m_pTreeWidgetFilters->setCurrentItem(m_pTreeWidgetFilters->topLevelItem(0)); 468 sltHandleUsbAdapterToggle(m_pCheckBoxUSB->isChecked()); 496 if (m_pCheckBoxUSB) 497 sltHandleUsbAdapterToggle(m_pCheckBoxUSB->isChecked()); 469 498 470 499 /* Polish page finally: */ … … 477 506 void UIMachineSettingsUSB::putToCache() 478 507 { 508 /* Sanity check: */ 509 if ( !m_pCache 510 || !m_pTreeWidgetFilters) 511 return; 512 479 513 /* Prepare new USB data: */ 480 514 UIDataSettingsMachineUSB newUsbData; 481 515 482 516 /* Gather new USB data: */ 483 newUsbData.m_fUSBEnabled = m_pCheckBoxUSB->isChecked(); 517 if (m_pCheckBoxUSB) 518 newUsbData.m_fUSBEnabled = m_pCheckBoxUSB->isChecked(); 484 519 if (!newUsbData.m_fUSBEnabled) 485 520 newUsbData.m_USBControllerType = KUSBControllerType_Null; 486 521 else 487 522 { 488 if (m_pRadioButtonUSB1->isChecked()) 523 if ( m_pRadioButtonUSB1 524 && m_pRadioButtonUSB1->isChecked()) 489 525 newUsbData.m_USBControllerType = KUSBControllerType_OHCI; 490 else if (m_pRadioButtonUSB2->isChecked()) 526 else if ( m_pRadioButtonUSB2 527 && m_pRadioButtonUSB2->isChecked()) 491 528 newUsbData.m_USBControllerType = KUSBControllerType_EHCI; 492 else if (m_pRadioButtonUSB3->isChecked()) 529 else if ( m_pRadioButtonUSB3 530 && m_pRadioButtonUSB3->isChecked()) 493 531 newUsbData.m_USBControllerType = KUSBControllerType_XHCI; 494 532 } … … 498 536 for (int iFilterIndex = 0; iFilterIndex < pMainRootItem->childCount(); ++iFilterIndex) 499 537 { 500 /* Gather and cache new filterdata: */538 /* Gather and cache new data: */ 501 539 const UIUSBFilterItem *pItem = static_cast<UIUSBFilterItem*>(pMainRootItem->child(iFilterIndex)); 502 540 m_pCache->child(iFilterIndex).cacheCurrentData(*pItem); … … 1089 1127 bool UIMachineSettingsUSB::saveData() 1090 1128 { 1129 /* Sanity check: */ 1130 if (!m_pCache) 1131 return false; 1132 1091 1133 /* Prepare result: */ 1092 1134 bool fSuccess = true;
Note:
See TracChangeset
for help on using the changeset viewer.