Changeset 66555 in vbox
- Timestamp:
- Apr 13, 2017 12:09:31 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 10 edited
-
UIMachineSettingsAudio.cpp (modified) (1 diff)
-
UIMachineSettingsDisplay.cpp (modified) (4 diffs)
-
UIMachineSettingsGeneral.cpp (modified) (5 diffs)
-
UIMachineSettingsNetwork.cpp (modified) (2 diffs)
-
UIMachineSettingsParallel.cpp (modified) (1 diff)
-
UIMachineSettingsSF.cpp (modified) (7 diffs)
-
UIMachineSettingsSerial.cpp (modified) (1 diff)
-
UIMachineSettingsStorage.cpp (modified) (16 diffs)
-
UIMachineSettingsSystem.cpp (modified) (3 diffs)
-
UIMachineSettingsUSB.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r66475 r66555 270 270 CAudioAdapter comAdapter = m_machine.GetAudioAdapter(); 271 271 fSuccess = m_machine.isOk() && comAdapter.isNotNull(); 272 272 273 /* Show error message if necessary: */ 273 274 if (!fSuccess) 274 275 msgCenter().cannotSaveAudioSettings(m_machine, this); 275 276 /* Save whether audio is enabled: */ 277 if (fSuccess && isMachineOffline() && newAudioData.m_fAudioEnabled != oldAudioData.m_fAudioEnabled) 276 else 278 277 { 279 comAdapter.SetEnabled(newAudioData.m_fAudioEnabled); 280 fSuccess = comAdapter.isOk(); 278 /* Save whether audio is enabled: */ 279 if (fSuccess && isMachineOffline() && newAudioData.m_fAudioEnabled != oldAudioData.m_fAudioEnabled) 280 { 281 comAdapter.SetEnabled(newAudioData.m_fAudioEnabled); 282 fSuccess = comAdapter.isOk(); 283 } 284 /* Save audio driver type: */ 285 if (fSuccess && isMachineOffline() && newAudioData.m_audioDriverType != oldAudioData.m_audioDriverType) 286 { 287 comAdapter.SetAudioDriver(newAudioData.m_audioDriverType); 288 fSuccess = comAdapter.isOk(); 289 } 290 /* Save audio controller type: */ 291 if (fSuccess && isMachineOffline() && newAudioData.m_audioControllerType != oldAudioData.m_audioControllerType) 292 { 293 comAdapter.SetAudioController(newAudioData.m_audioControllerType); 294 fSuccess = comAdapter.isOk(); 295 } 296 297 /* Show error message if necessary: */ 298 if (!fSuccess) 299 msgCenter().cannotSaveAudioAdapterSettings(comAdapter, this); 281 300 } 282 /* Save audio driver type: */283 if (fSuccess && isMachineOffline() && newAudioData.m_audioDriverType != oldAudioData.m_audioDriverType)284 {285 comAdapter.SetAudioDriver(newAudioData.m_audioDriverType);286 fSuccess = comAdapter.isOk();287 }288 /* Save audio controller type: */289 if (fSuccess && isMachineOffline() && newAudioData.m_audioControllerType != oldAudioData.m_audioControllerType)290 {291 comAdapter.SetAudioController(newAudioData.m_audioControllerType);292 fSuccess = comAdapter.isOk();293 }294 /* Show error message if necessary: */295 if (!fSuccess)296 msgCenter().cannotSaveAudioAdapterSettings(comAdapter, this);297 301 } 298 302 /* Return result: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r66476 r66555 1264 1264 } 1265 1265 #endif 1266 1266 1267 /* Get machine ID for further activities: */ 1267 1268 QString strMachineId; … … 1271 1272 fSuccess = m_machine.isOk(); 1272 1273 } 1274 1273 1275 /* Show error message if necessary: */ 1274 1276 if (!fSuccess) … … 1303 1305 CVRDEServer comServer = m_machine.GetVRDEServer(); 1304 1306 fSuccess = m_machine.isOk() && comServer.isNotNull(); 1307 1305 1308 /* Show error message if necessary: */ 1306 1309 if (!fSuccess) 1307 1310 msgCenter().cannotSaveDisplaySettings(m_machine, this); 1308 1309 /* Save whether remote display server is enabled: */ 1310 if (fSuccess && newDisplayData.m_fRemoteDisplayServerEnabled != oldDisplayData.m_fRemoteDisplayServerEnabled) 1311 { 1312 comServer.SetEnabled(newDisplayData.m_fRemoteDisplayServerEnabled); 1313 fSuccess = comServer.isOk(); 1314 } 1315 /* Save remote display server port: */ 1316 if (fSuccess && newDisplayData.m_strRemoteDisplayPort != oldDisplayData.m_strRemoteDisplayPort) 1317 { 1318 comServer.SetVRDEProperty("TCP/Ports", newDisplayData.m_strRemoteDisplayPort); 1319 fSuccess = comServer.isOk(); 1320 } 1321 /* Save remote display server auth type: */ 1322 if (fSuccess && newDisplayData.m_remoteDisplayAuthType != oldDisplayData.m_remoteDisplayAuthType) 1323 { 1324 comServer.SetAuthType(newDisplayData.m_remoteDisplayAuthType); 1325 fSuccess = comServer.isOk(); 1326 } 1327 /* Save remote display server timeout: */ 1328 if (fSuccess && newDisplayData.m_uRemoteDisplayTimeout != oldDisplayData.m_uRemoteDisplayTimeout) 1329 { 1330 comServer.SetAuthTimeout(newDisplayData.m_uRemoteDisplayTimeout); 1331 fSuccess = comServer.isOk(); 1332 } 1333 /* Save whether remote display server allows multiple connections: */ 1334 if ( fSuccess 1335 && (isMachineOffline() || isMachineSaved()) 1336 && (newDisplayData.m_fRemoteDisplayMultiConnAllowed != oldDisplayData.m_fRemoteDisplayMultiConnAllowed)) 1337 { 1338 comServer.SetAllowMultiConnection(newDisplayData.m_fRemoteDisplayMultiConnAllowed); 1339 fSuccess = comServer.isOk(); 1340 } 1341 /* Show error message if necessary: */ 1342 if (!fSuccess) 1343 msgCenter().cannotSaveRemoteDisplayServerSettings(comServer, this); 1311 else 1312 { 1313 /* Save whether remote display server is enabled: */ 1314 if (fSuccess && newDisplayData.m_fRemoteDisplayServerEnabled != oldDisplayData.m_fRemoteDisplayServerEnabled) 1315 { 1316 comServer.SetEnabled(newDisplayData.m_fRemoteDisplayServerEnabled); 1317 fSuccess = comServer.isOk(); 1318 } 1319 /* Save remote display server port: */ 1320 if (fSuccess && newDisplayData.m_strRemoteDisplayPort != oldDisplayData.m_strRemoteDisplayPort) 1321 { 1322 comServer.SetVRDEProperty("TCP/Ports", newDisplayData.m_strRemoteDisplayPort); 1323 fSuccess = comServer.isOk(); 1324 } 1325 /* Save remote display server auth type: */ 1326 if (fSuccess && newDisplayData.m_remoteDisplayAuthType != oldDisplayData.m_remoteDisplayAuthType) 1327 { 1328 comServer.SetAuthType(newDisplayData.m_remoteDisplayAuthType); 1329 fSuccess = comServer.isOk(); 1330 } 1331 /* Save remote display server timeout: */ 1332 if (fSuccess && newDisplayData.m_uRemoteDisplayTimeout != oldDisplayData.m_uRemoteDisplayTimeout) 1333 { 1334 comServer.SetAuthTimeout(newDisplayData.m_uRemoteDisplayTimeout); 1335 fSuccess = comServer.isOk(); 1336 } 1337 /* Save whether remote display server allows multiple connections: */ 1338 if ( fSuccess 1339 && (isMachineOffline() || isMachineSaved()) 1340 && (newDisplayData.m_fRemoteDisplayMultiConnAllowed != oldDisplayData.m_fRemoteDisplayMultiConnAllowed)) 1341 { 1342 comServer.SetAllowMultiConnection(newDisplayData.m_fRemoteDisplayMultiConnAllowed); 1343 fSuccess = comServer.isOk(); 1344 } 1345 1346 /* Show error message if necessary: */ 1347 if (!fSuccess) 1348 msgCenter().cannotSaveRemoteDisplayServerSettings(comServer, this); 1349 } 1344 1350 } 1345 1351 /* Return result: */ … … 1476 1482 } 1477 1483 } 1484 1478 1485 /* Show error message if necessary: */ 1479 1486 if (!fSuccess) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r66482 r66555 713 713 fSuccess = m_machine.isOk(); 714 714 } 715 /* Show error message if necessary: */ 716 if (!fSuccess) 717 msgCenter().cannotSaveGeneralSettings(m_machine, this); 718 } 715 } 716 717 /* Show error message if necessary: */ 718 if (!fSuccess) 719 msgCenter().cannotSaveGeneralSettings(m_machine, this); 719 720 } 720 721 /* Return result: */ … … 760 761 fSuccess = m_machine.isOk(); 761 762 } 763 762 764 /* Show error message if necessary: */ 763 765 if (!fSuccess) … … 786 788 fSuccess = m_machine.isOk(); 787 789 } 790 788 791 /* Show error message if necessary: */ 789 792 if (!fSuccess) … … 828 831 fSuccess = m_machine.isOk(); 829 832 } 833 830 834 /* Show error message if necessary: */ 831 835 if (!fSuccess) 832 836 msgCenter().cannotSaveGeneralSettings(m_machine, this); 833 837 834 /* Enumerate attachments: */838 /* For each attachment: */ 835 839 for (int iIndex = 0; fSuccess && iIndex < attachments.size(); ++iIndex) 836 840 { … … 852 856 fSuccess = comAttachment.isOk(); 853 857 } 858 854 859 /* Show error message if necessary: */ 855 860 if (!fSuccess) 856 861 msgCenter().cannotSaveStorageAttachmentSettings(comAttachment, this); 857 858 /* Enumerate hard-drives only: */ 859 if (enmType != KDeviceType_HardDisk) 860 continue; 861 862 /* Get medium id for further activities: */ 863 QString strMediumId; 864 if (fSuccess) 862 else 865 863 { 866 strMediumId = comMedium.GetId(); 867 fSuccess = comMedium.isOk(); 864 /* Pass hard-drives only: */ 865 if (enmType != KDeviceType_HardDisk) 866 continue; 867 868 /* Get medium id for further activities: */ 869 QString strMediumId; 870 if (fSuccess) 871 { 872 strMediumId = comMedium.GetId(); 873 fSuccess = comMedium.isOk(); 874 } 875 876 /* Create encryption update progress: */ 877 CProgress comProgress; 878 if (fSuccess) 879 { 880 /* Cipher attribute changed? */ 881 QString strNewCipher; 882 if (newGeneralData.m_fEncryptionCipherChanged) 883 { 884 strNewCipher = newGeneralData.m_fEncryptionEnabled ? 885 m_encryptionCiphers.at(newGeneralData.m_iEncryptionCipherIndex) : QString(); 886 } 887 888 /* Password attribute changed? */ 889 QString strNewPassword; 890 QString strNewPasswordId; 891 if (newGeneralData.m_fEncryptionPasswordChanged) 892 { 893 strNewPassword = newGeneralData.m_fEncryptionEnabled ? 894 newGeneralData.m_strEncryptionPassword : QString(); 895 strNewPasswordId = newGeneralData.m_fEncryptionEnabled ? 896 strMachineName : QString(); 897 } 898 899 /* Get the maps of encrypted mediums and their passwords: */ 900 const EncryptedMediumMap &encryptedMedium = newGeneralData.m_encryptedMediums; 901 const EncryptionPasswordMap &encryptionPasswords = newGeneralData.m_encryptionPasswords; 902 903 /* Check if old password exists/provided: */ 904 const QString strOldPasswordId = encryptedMedium.key(strMediumId); 905 const QString strOldPassword = encryptionPasswords.value(strOldPasswordId); 906 907 /* Create encryption progress: */ 908 comProgress = comMedium.ChangeEncryption(strOldPassword, 909 strNewCipher, 910 strNewPassword, 911 strNewPasswordId); 912 fSuccess = comMedium.isOk(); 913 } 914 915 // TODO: Decide what to do with it (also below). 916 // if (!comMedium.isOk()) 917 // { 918 // QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection, 919 // Q_ARG(QString, UIMessageCenter::formatErrorInfo(comMedium))); 920 // continue; 921 // } 922 923 /* Create encryption update progress dialog: */ 924 QPointer<UIProgress> pDlg; 925 if (fSuccess) 926 { 927 // TODO: Decide what to do with it (also above). 928 // This dialog connected to settings serializer, not to message-center directly. 929 // What's the better approach in that case? Probably connect everything to serializer? 930 pDlg = new UIProgress(comProgress); 931 connect(pDlg, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)), 932 this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)), 933 Qt::QueuedConnection); 934 connect(pDlg, SIGNAL(sigProgressError(QString)), 935 this, SIGNAL(sigOperationProgressError(QString)), 936 Qt::BlockingQueuedConnection); 937 pDlg->run(350); 938 if (pDlg) 939 delete pDlg; 940 else 941 { 942 // Premature application shutdown, 943 // exit immediately: 944 return true; 945 } 946 } 947 948 /* Show error message if necessary: */ 949 if (!fSuccess) 950 msgCenter().cannotSaveStorageMediumSettings(comMedium, this); 868 951 } 869 870 /* Create encryption update progress: */871 CProgress comProgress;872 if (fSuccess)873 {874 /* Cipher attribute changed? */875 QString strNewCipher;876 if (newGeneralData.m_fEncryptionCipherChanged)877 {878 strNewCipher = newGeneralData.m_fEncryptionEnabled ?879 m_encryptionCiphers.at(newGeneralData.m_iEncryptionCipherIndex) : QString();880 }881 882 /* Password attribute changed? */883 QString strNewPassword;884 QString strNewPasswordId;885 if (newGeneralData.m_fEncryptionPasswordChanged)886 {887 strNewPassword = newGeneralData.m_fEncryptionEnabled ?888 newGeneralData.m_strEncryptionPassword : QString();889 strNewPasswordId = newGeneralData.m_fEncryptionEnabled ?890 strMachineName : QString();891 }892 893 /* Get the maps of encrypted mediums and their passwords: */894 const EncryptedMediumMap &encryptedMedium = newGeneralData.m_encryptedMediums;895 const EncryptionPasswordMap &encryptionPasswords = newGeneralData.m_encryptionPasswords;896 897 /* Check if old password exists/provided: */898 const QString strOldPasswordId = encryptedMedium.key(strMediumId);899 const QString strOldPassword = encryptionPasswords.value(strOldPasswordId);900 901 /* Create encryption progress: */902 comProgress = comMedium.ChangeEncryption(strOldPassword,903 strNewCipher,904 strNewPassword,905 strNewPasswordId);906 fSuccess = comMedium.isOk();907 }908 909 // TODO: Decide what to do with it (also below).910 // if (!comMedium.isOk())911 // {912 // QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection,913 // Q_ARG(QString, UIMessageCenter::formatErrorInfo(comMedium)));914 // continue;915 // }916 917 /* Create encryption update progress dialog: */918 QPointer<UIProgress> pDlg;919 if (fSuccess)920 {921 // TODO: Decide what to do with it (also above).922 // This dialog connected to settings serializer, not to message-center directly.923 // What's the better approach in that case? Probably connect everything to serializer?924 pDlg = new UIProgress(comProgress);925 connect(pDlg, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),926 this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),927 Qt::QueuedConnection);928 connect(pDlg, SIGNAL(sigProgressError(QString)),929 this, SIGNAL(sigOperationProgressError(QString)),930 Qt::BlockingQueuedConnection);931 pDlg->run(350);932 if (pDlg)933 delete pDlg;934 else935 {936 // Premature application shutdown,937 // exit immediately:938 return true;939 }940 }941 942 /* Show error message if necessary: */943 if (!fSuccess)944 msgCenter().cannotSaveStorageMediumSettings(comMedium, this);945 952 } 946 953 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r66500 r66555 546 546 m_pGenericPropertiesLabel->setEnabled(m_pParent->isMachineInValidMode()); 547 547 m_pGenericPropertiesTextEdit->setEnabled(m_pParent->isMachineInValidMode()); 548 m_pCableConnectedCheckBox->setEnabled(m_pParent->isMachineInValidMode()); 548 549 m_pPortForwardingButton->setEnabled(m_pParent->isMachineInValidMode() && 549 550 attachmentType() == KNetworkAttachmentType_NAT); … … 1504 1505 CNetworkAdapter comAdapter = m_machine.GetNetworkAdapter(iSlot); 1505 1506 fSuccess = m_machine.isOk() && comAdapter.isNotNull(); 1507 1506 1508 /* Show error message if necessary: */ 1507 1509 if (!fSuccess) 1508 1510 msgCenter().cannotSaveNetworkSettings(m_machine, this); 1509 1510 /* Save whether the adapter is enabled: */ 1511 if (fSuccess && isMachineOffline() && newAdapterData.m_fAdapterEnabled != oldAdapterData.m_fAdapterEnabled) 1511 else 1512 1512 { 1513 comAdapter.SetEnabled(newAdapterData.m_fAdapterEnabled); 1514 fSuccess = comAdapter.isOk(); 1513 /* Save whether the adapter is enabled: */ 1514 if (fSuccess && isMachineOffline() && newAdapterData.m_fAdapterEnabled != oldAdapterData.m_fAdapterEnabled) 1515 { 1516 comAdapter.SetEnabled(newAdapterData.m_fAdapterEnabled); 1517 fSuccess = comAdapter.isOk(); 1518 } 1519 /* Save adapter type: */ 1520 if (fSuccess && isMachineOffline() && newAdapterData.m_adapterType != oldAdapterData.m_adapterType) 1521 { 1522 comAdapter.SetAdapterType(newAdapterData.m_adapterType); 1523 fSuccess = comAdapter.isOk(); 1524 } 1525 /* Save adapter MAC address: */ 1526 if (fSuccess && isMachineOffline() && newAdapterData.m_strMACAddress != oldAdapterData.m_strMACAddress) 1527 { 1528 comAdapter.SetMACAddress(newAdapterData.m_strMACAddress); 1529 fSuccess = comAdapter.isOk(); 1530 } 1531 /* Save adapter attachment type: */ 1532 switch (newAdapterData.m_attachmentType) 1533 { 1534 case KNetworkAttachmentType_Bridged: 1535 { 1536 if (fSuccess && newAdapterData.m_strBridgedAdapterName != oldAdapterData.m_strBridgedAdapterName) 1537 { 1538 comAdapter.SetBridgedInterface(newAdapterData.m_strBridgedAdapterName); 1539 fSuccess = comAdapter.isOk(); 1540 } 1541 break; 1542 } 1543 case KNetworkAttachmentType_Internal: 1544 { 1545 if (fSuccess && newAdapterData.m_strInternalNetworkName != oldAdapterData.m_strInternalNetworkName) 1546 { 1547 comAdapter.SetInternalNetwork(newAdapterData.m_strInternalNetworkName); 1548 fSuccess = comAdapter.isOk(); 1549 } 1550 break; 1551 } 1552 case KNetworkAttachmentType_HostOnly: 1553 { 1554 if (fSuccess && newAdapterData.m_strHostInterfaceName != oldAdapterData.m_strHostInterfaceName) 1555 { 1556 comAdapter.SetHostOnlyInterface(newAdapterData.m_strHostInterfaceName); 1557 fSuccess = comAdapter.isOk(); 1558 } 1559 break; 1560 } 1561 case KNetworkAttachmentType_Generic: 1562 { 1563 if (fSuccess && newAdapterData.m_strGenericDriverName != oldAdapterData.m_strGenericDriverName) 1564 { 1565 comAdapter.SetGenericDriver(newAdapterData.m_strGenericDriverName); 1566 fSuccess = comAdapter.isOk(); 1567 } 1568 if (fSuccess && newAdapterData.m_strGenericProperties != oldAdapterData.m_strGenericProperties) 1569 fSuccess = saveGenericProperties(comAdapter, newAdapterData.m_strGenericProperties); 1570 break; 1571 } 1572 case KNetworkAttachmentType_NATNetwork: 1573 { 1574 if (fSuccess && newAdapterData.m_strNATNetworkName != oldAdapterData.m_strNATNetworkName) 1575 { 1576 comAdapter.SetNATNetwork(newAdapterData.m_strNATNetworkName); 1577 fSuccess = comAdapter.isOk(); 1578 } 1579 break; 1580 } 1581 default: 1582 break; 1583 } 1584 if (fSuccess && newAdapterData.m_attachmentType != oldAdapterData.m_attachmentType) 1585 { 1586 comAdapter.SetAttachmentType(newAdapterData.m_attachmentType); 1587 fSuccess = comAdapter.isOk(); 1588 } 1589 /* Save adapter promiscuous mode: */ 1590 if (fSuccess && newAdapterData.m_promiscuousMode != oldAdapterData.m_promiscuousMode) 1591 { 1592 comAdapter.SetPromiscModePolicy(newAdapterData.m_promiscuousMode); 1593 fSuccess = comAdapter.isOk(); 1594 } 1595 /* Save whether the adapter cable connected: */ 1596 if (fSuccess && newAdapterData.m_fCableConnected != oldAdapterData.m_fCableConnected) 1597 { 1598 comAdapter.SetCableConnected(newAdapterData.m_fCableConnected); 1599 fSuccess = comAdapter.isOk(); 1600 } 1601 /* Save adapter redirect options: */ 1602 if ( fSuccess && newAdapterData.m_redirects != oldAdapterData.m_redirects 1603 && ( oldAdapterData.m_attachmentType == KNetworkAttachmentType_NAT 1604 || newAdapterData.m_attachmentType == KNetworkAttachmentType_NAT)) 1605 { 1606 foreach (const QString &strOldRedirect, comAdapter.GetNATEngine().GetRedirects()) 1607 comAdapter.GetNATEngine().RemoveRedirect(strOldRedirect.section(',', 0, 0)); 1608 foreach (const UIPortForwardingData &newRedirect, newAdapterData.m_redirects) 1609 comAdapter.GetNATEngine().AddRedirect(newRedirect.name, newRedirect.protocol, 1610 newRedirect.hostIp, newRedirect.hostPort.value(), 1611 newRedirect.guestIp, newRedirect.guestPort.value()); 1612 } 1613 1614 /* Show error message if necessary: */ 1615 if (!fSuccess) 1616 msgCenter().cannotSaveNetworkAdapterSettings(comAdapter, this); 1515 1617 } 1516 /* Save adapter type: */1517 if (fSuccess && isMachineOffline() && newAdapterData.m_adapterType != oldAdapterData.m_adapterType)1518 {1519 comAdapter.SetAdapterType(newAdapterData.m_adapterType);1520 fSuccess = comAdapter.isOk();1521 }1522 /* Save adapter MAC address: */1523 if (fSuccess && isMachineOffline() && newAdapterData.m_strMACAddress != oldAdapterData.m_strMACAddress)1524 {1525 comAdapter.SetMACAddress(newAdapterData.m_strMACAddress);1526 fSuccess = comAdapter.isOk();1527 }1528 /* Save adapter attachment type: */1529 switch (newAdapterData.m_attachmentType)1530 {1531 case KNetworkAttachmentType_Bridged:1532 {1533 if (fSuccess && newAdapterData.m_strBridgedAdapterName != oldAdapterData.m_strBridgedAdapterName)1534 {1535 comAdapter.SetBridgedInterface(newAdapterData.m_strBridgedAdapterName);1536 fSuccess = comAdapter.isOk();1537 }1538 break;1539 }1540 case KNetworkAttachmentType_Internal:1541 {1542 if (fSuccess && newAdapterData.m_strInternalNetworkName != oldAdapterData.m_strInternalNetworkName)1543 {1544 comAdapter.SetInternalNetwork(newAdapterData.m_strInternalNetworkName);1545 fSuccess = comAdapter.isOk();1546 }1547 break;1548 }1549 case KNetworkAttachmentType_HostOnly:1550 {1551 if (fSuccess && newAdapterData.m_strHostInterfaceName != oldAdapterData.m_strHostInterfaceName)1552 {1553 comAdapter.SetHostOnlyInterface(newAdapterData.m_strHostInterfaceName);1554 fSuccess = comAdapter.isOk();1555 }1556 break;1557 }1558 case KNetworkAttachmentType_Generic:1559 {1560 if (fSuccess && newAdapterData.m_strGenericDriverName != oldAdapterData.m_strGenericDriverName)1561 {1562 comAdapter.SetGenericDriver(newAdapterData.m_strGenericDriverName);1563 fSuccess = comAdapter.isOk();1564 }1565 if (fSuccess && newAdapterData.m_strGenericProperties != oldAdapterData.m_strGenericProperties)1566 fSuccess = saveGenericProperties(comAdapter, newAdapterData.m_strGenericProperties);1567 break;1568 }1569 case KNetworkAttachmentType_NATNetwork:1570 {1571 if (fSuccess && newAdapterData.m_strNATNetworkName != oldAdapterData.m_strNATNetworkName)1572 {1573 comAdapter.SetNATNetwork(newAdapterData.m_strNATNetworkName);1574 fSuccess = comAdapter.isOk();1575 }1576 break;1577 }1578 default:1579 break;1580 }1581 if (fSuccess && newAdapterData.m_attachmentType != oldAdapterData.m_attachmentType)1582 {1583 comAdapter.SetAttachmentType(newAdapterData.m_attachmentType);1584 fSuccess = comAdapter.isOk();1585 }1586 /* Save adapter promiscuous mode: */1587 if (fSuccess && newAdapterData.m_promiscuousMode != oldAdapterData.m_promiscuousMode)1588 {1589 comAdapter.SetPromiscModePolicy(newAdapterData.m_promiscuousMode);1590 fSuccess = comAdapter.isOk();1591 }1592 /* Save whether the adapter cable connected: */1593 if (fSuccess && newAdapterData.m_fCableConnected != oldAdapterData.m_fCableConnected)1594 {1595 comAdapter.SetCableConnected(newAdapterData.m_fCableConnected);1596 fSuccess = comAdapter.isOk();1597 }1598 /* Save adapter redirect options: */1599 if ( fSuccess && newAdapterData.m_redirects != oldAdapterData.m_redirects1600 && ( oldAdapterData.m_attachmentType == KNetworkAttachmentType_NAT1601 || newAdapterData.m_attachmentType == KNetworkAttachmentType_NAT))1602 {1603 foreach (const QString &strOldRedirect, comAdapter.GetNATEngine().GetRedirects())1604 comAdapter.GetNATEngine().RemoveRedirect(strOldRedirect.section(',', 0, 0));1605 foreach (const UIPortForwardingData &newRedirect, newAdapterData.m_redirects)1606 comAdapter.GetNATEngine().AddRedirect(newRedirect.name, newRedirect.protocol,1607 newRedirect.hostIp, newRedirect.hostPort.value(),1608 newRedirect.guestIp, newRedirect.guestPort.value());1609 }1610 /* Show error message if necessary: */1611 if (!fSuccess)1612 msgCenter().cannotSaveNetworkAdapterSettings(comAdapter, this);1613 1618 } 1614 1619 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r66501 r66555 586 586 CParallelPort comPort = m_machine.GetParallelPort(iPort); 587 587 fSuccess = m_machine.isOk() && comPort.isNotNull(); 588 588 589 /* Show error message if necessary: */ 589 590 if (!fSuccess) 590 591 msgCenter().cannotSaveParallelSettings(m_machine, this); 591 592 /* Save whether the port is enabled: */ 593 if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled) 592 else 594 593 { 595 comPort.SetEnabled(newPortData.m_fPortEnabled); 596 fSuccess = comPort.isOk(); 594 /* Save whether the port is enabled: */ 595 if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled) 596 { 597 comPort.SetEnabled(newPortData.m_fPortEnabled); 598 fSuccess = comPort.isOk(); 599 } 600 /* Save port IRQ: */ 601 if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ) 602 { 603 comPort.SetIRQ(newPortData.m_uIRQ); 604 fSuccess = comPort.isOk(); 605 } 606 /* Save port IO base: */ 607 if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase) 608 { 609 comPort.SetIOBase(newPortData.m_uIOBase); 610 fSuccess = comPort.isOk(); 611 } 612 /* Save port path: */ 613 if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath) 614 { 615 comPort.SetPath(newPortData.m_strPath); 616 fSuccess = comPort.isOk(); 617 } 618 619 /* Show error message if necessary: */ 620 if (!fSuccess) 621 msgCenter().cannotSaveParallelPortSettings(comPort, this); 597 622 } 598 /* Save port IRQ: */599 if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ)600 {601 comPort.SetIRQ(newPortData.m_uIRQ);602 fSuccess = comPort.isOk();603 }604 /* Save port IO base: */605 if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase)606 {607 comPort.SetIOBase(newPortData.m_uIOBase);608 fSuccess = comPort.isOk();609 }610 /* Save port path: */611 if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)612 {613 comPort.SetPath(newPortData.m_strPath);614 fSuccess = comPort.isOk();615 }616 /* Show error message if necessary: */617 if (!fSuccess)618 msgCenter().cannotSaveParallelPortSettings(comPort, this);619 623 } 620 624 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r66540 r66555 866 866 folders = m_machine.GetSharedFolders(); 867 867 fSuccess = m_machine.isOk(); 868 868 869 /* Show error message if necessary: */ 869 870 if (!fSuccess) 870 871 msgCenter().cannotLoadFoldersSettings(m_machine, this); 872 871 873 break; 872 874 } … … 878 880 folders = m_console.GetSharedFolders(); 879 881 fSuccess = m_console.isOk(); 882 880 883 /* Show error message if necessary: */ 881 884 if (!fSuccess) 882 885 msgCenter().cannotLoadFoldersSettings(m_console, this); 886 883 887 break; 884 888 } … … 908 912 fSuccess = comCurrentFolder.isOk(); 909 913 } 914 910 915 /* Show error message if necessary: */ 911 916 if (!fSuccess) … … 934 939 935 940 /* Remove folder marked for 'remove' or 'update': */ 936 if (f olderCache.wasRemoved() || folderCache.wasUpdated())941 if (fSuccess && (folderCache.wasRemoved() || folderCache.wasUpdated())) 937 942 fSuccess = removeSharedFolder(folderCache); 938 943 939 944 /* Create folder marked for 'create' or 'update': */ 940 if (f olderCache.wasCreated() || folderCache.wasUpdated())945 if (fSuccess && (folderCache.wasCreated() || folderCache.wasUpdated())) 941 946 fSuccess = createSharedFolder(folderCache); 942 947 } … … 966 971 CSharedFolder comFolder; 967 972 if (fSuccess) 968 /* fSuccess = */getSharedFolder(strFolderName, folders, comFolder);973 fSuccess = getSharedFolder(strFolderName, folders, comFolder); 969 974 970 975 /* Make sure such folder really exists: */ 971 if ( !comFolder.isNull())976 if (fSuccess && !comFolder.isNull()) 972 977 { 973 978 /* Remove existing folder: */ … … 1013 1018 /* Prepare result: */ 1014 1019 bool fSuccess = true; 1015 /* Remove folder: */1020 /* Create folder: */ 1016 1021 if (fSuccess) 1017 1022 { … … 1032 1037 CSharedFolder comFolder; 1033 1038 if (fSuccess) 1034 /* fSuccess = */getSharedFolder(strFolderName, folders, comFolder);1039 fSuccess = getSharedFolder(strFolderName, folders, comFolder); 1035 1040 1036 1041 /* Make sure such folder doesn't exist: */ 1037 if ( comFolder.isNull())1042 if (fSuccess && comFolder.isNull()) 1038 1043 { 1039 1044 /* Create new folder: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r66502 r66555 643 643 CSerialPort comPort = m_machine.GetSerialPort(iPort); 644 644 fSuccess = m_machine.isOk() && comPort.isNotNull(); 645 645 646 /* Show error message if necessary: */ 646 647 if (!fSuccess) 647 648 msgCenter().cannotSaveSerialSettings(m_machine, this); 648 649 // This *must* be first. 650 // If the requested host mode is changed to disconnected we should do it first. 651 // That allows to automatically fulfill the requirements for some of the settings below. 652 /* Save port host mode: */ 653 if ( fSuccess && isMachineOffline() 654 && newPortData.m_hostMode != oldPortData.m_hostMode 655 && newPortData.m_hostMode == KPortMode_Disconnected) 649 else 656 650 { 657 comPort.SetHostMode(newPortData.m_hostMode); 658 fSuccess = comPort.isOk(); 651 // This *must* be first. 652 // If the requested host mode is changed to disconnected we should do it first. 653 // That allows to automatically fulfill the requirements for some of the settings below. 654 /* Save port host mode: */ 655 if ( fSuccess && isMachineOffline() 656 && newPortData.m_hostMode != oldPortData.m_hostMode 657 && newPortData.m_hostMode == KPortMode_Disconnected) 658 { 659 comPort.SetHostMode(newPortData.m_hostMode); 660 fSuccess = comPort.isOk(); 661 } 662 /* Save whether the port is enabled: */ 663 if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled) 664 { 665 comPort.SetEnabled(newPortData.m_fPortEnabled); 666 fSuccess = comPort.isOk(); 667 } 668 /* Save port IRQ: */ 669 if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ) 670 { 671 comPort.SetIRQ(newPortData.m_uIRQ); 672 fSuccess = comPort.isOk(); 673 } 674 /* Save port IO base: */ 675 if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase) 676 { 677 comPort.SetIOBase(newPortData.m_uIOBase); 678 fSuccess = comPort.isOk(); 679 } 680 /* Save whether the port is server: */ 681 if (fSuccess && isMachineOffline() && newPortData.m_fServer != oldPortData.m_fServer) 682 { 683 comPort.SetServer(newPortData.m_fServer); 684 fSuccess = comPort.isOk(); 685 } 686 /* Save port path: */ 687 if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath) 688 { 689 comPort.SetPath(newPortData.m_strPath); 690 fSuccess = comPort.isOk(); 691 } 692 // This *must* be last. 693 // The host mode will be changed to disconnected if some of the necessary 694 // settings above will not meet the requirements for the selected mode. 695 /* Save port host mode: */ 696 if ( fSuccess && isMachineOffline() 697 && newPortData.m_hostMode != oldPortData.m_hostMode 698 && newPortData.m_hostMode != KPortMode_Disconnected) 699 { 700 comPort.SetHostMode(newPortData.m_hostMode); 701 fSuccess = comPort.isOk(); 702 } 703 704 /* Show error message if necessary: */ 705 if (!fSuccess) 706 msgCenter().cannotSaveSerialPortSettings(comPort, this); 659 707 } 660 /* Save whether the port is enabled: */661 if (fSuccess && isMachineOffline() && newPortData.m_fPortEnabled != oldPortData.m_fPortEnabled)662 {663 comPort.SetEnabled(newPortData.m_fPortEnabled);664 fSuccess = comPort.isOk();665 }666 /* Save port IRQ: */667 if (fSuccess && isMachineOffline() && newPortData.m_uIRQ != oldPortData.m_uIRQ)668 {669 comPort.SetIRQ(newPortData.m_uIRQ);670 fSuccess = comPort.isOk();671 }672 /* Save port IO base: */673 if (fSuccess && isMachineOffline() && newPortData.m_uIOBase != oldPortData.m_uIOBase)674 {675 comPort.SetIOBase(newPortData.m_uIOBase);676 fSuccess = comPort.isOk();677 }678 /* Save whether the port is server: */679 if (fSuccess && isMachineOffline() && newPortData.m_fServer != oldPortData.m_fServer)680 {681 comPort.SetServer(newPortData.m_fServer);682 fSuccess = comPort.isOk();683 }684 /* Save port path: */685 if (fSuccess && isMachineOffline() && newPortData.m_strPath != oldPortData.m_strPath)686 {687 comPort.SetPath(newPortData.m_strPath);688 fSuccess = comPort.isOk();689 }690 // This *must* be last.691 // The host mode will be changed to disconnected if some of the necessary692 // settings above will not meet the requirements for the selected mode.693 /* Save port host mode: */694 if ( fSuccess && isMachineOffline()695 && newPortData.m_hostMode != oldPortData.m_hostMode696 && newPortData.m_hostMode != KPortMode_Disconnected)697 {698 comPort.SetHostMode(newPortData.m_hostMode);699 fSuccess = comPort.isOk();700 }701 /* Show error message if necessary: */702 if (!fSuccess)703 msgCenter().cannotSaveSerialPortSettings(comPort, this);704 708 } 705 709 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r66543 r66555 4012 4012 const UIDataSettingsMachineStorageController &oldControllerData = controllerCache.base(); 4013 4013 4014 /* Make sure controller really exists: */4014 /* Search for a controller with the same name: */ 4015 4015 const CStorageController &comController = m_machine.GetStorageControllerByName(oldControllerData.m_strControllerName); 4016 4016 fSuccess = m_machine.isOk() && comController.isNotNull(); 4017 4017 4018 /* Remove controller with all the attachments at one shot: */4018 /* Make sure controller really exists: */ 4019 4019 if (fSuccess) 4020 4020 { 4021 /* Remove controller with all the attachments at one shot: */ 4021 4022 m_machine.RemoveStorageController(oldControllerData.m_strControllerName); 4022 4023 fSuccess = m_machine.isOk(); 4023 4024 } 4025 4024 4026 /* Show error message if necessary: */ 4025 4027 if (!fSuccess) … … 4040 4042 const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data(); 4041 4043 4042 /* Make sure controller doesn't exist: */4044 /* Search for a controller with the same name: */ 4043 4045 const CMachine comMachine(m_machine); 4044 4046 CStorageController comController = comMachine.GetStorageControllerByName(newControllerData.m_strControllerName); … … 4046 4048 AssertReturn(fSuccess, false); 4047 4049 4048 /* Create controller: */4050 /* Make sure controller doesn't exist: */ 4049 4051 if (fSuccess) 4050 4052 { 4053 /* Create controller: */ 4051 4054 comController = m_machine.AddStorageController(newControllerData.m_strControllerName, newControllerData.m_controllerBus); 4052 4055 fSuccess = m_machine.isOk() && comController.isNotNull(); 4053 4056 } 4057 4054 4058 /* Show error message if necessary: */ 4055 4059 if (!fSuccess) 4056 4060 msgCenter().cannotSaveStorageSettings(m_machine, this); 4057 4058 /* Save controller type: */ 4059 if (fSuccess) 4060 { 4061 comController.SetControllerType(newControllerData.m_controllerType); 4062 fSuccess = comController.isOk(); 4063 } 4064 /* Save whether controller uses host IO cache: */ 4065 if (fSuccess) 4066 { 4067 comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache); 4068 fSuccess = comController.isOk(); 4069 } 4070 /* Save controller port number: */ 4071 if ( fSuccess 4072 && ( newControllerData.m_controllerBus == KStorageBus_SATA 4073 || newControllerData.m_controllerBus == KStorageBus_SAS 4074 || newControllerData.m_controllerBus == KStorageBus_PCIe)) 4075 { 4076 ULONG uNewPortCount = newControllerData.m_uPortCount; 4061 else 4062 { 4063 /* Save controller type: */ 4077 4064 if (fSuccess) 4078 4065 { 4079 uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());4066 comController.SetControllerType(newControllerData.m_controllerType); 4080 4067 fSuccess = comController.isOk(); 4081 4068 } 4069 /* Save whether controller uses host IO cache: */ 4082 4070 if (fSuccess) 4083 4071 { 4084 uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());4072 comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache); 4085 4073 fSuccess = comController.isOk(); 4086 4074 } 4087 if (fSuccess) 4075 /* Save controller port number: */ 4076 if ( fSuccess 4077 && ( newControllerData.m_controllerBus == KStorageBus_SATA 4078 || newControllerData.m_controllerBus == KStorageBus_SAS 4079 || newControllerData.m_controllerBus == KStorageBus_PCIe)) 4088 4080 { 4089 comController.SetPortCount(uNewPortCount); 4090 fSuccess = comController.isOk(); 4081 ULONG uNewPortCount = newControllerData.m_uPortCount; 4082 if (fSuccess) 4083 { 4084 uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount()); 4085 fSuccess = comController.isOk(); 4086 } 4087 if (fSuccess) 4088 { 4089 uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount()); 4090 fSuccess = comController.isOk(); 4091 } 4092 if (fSuccess) 4093 { 4094 comController.SetPortCount(uNewPortCount); 4095 fSuccess = comController.isOk(); 4096 } 4091 4097 } 4092 } 4093 /* Show error message if necessary: */ 4094 if (!fSuccess) 4095 msgCenter().cannotSaveStorageControllerSettings(comController, this); 4096 4097 /* For each attachment: */ 4098 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4099 { 4100 /* Get attachment cache: */ 4101 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4102 4103 /* Create attachment if it was not 'removed': */ 4104 if (!attachmentCache.wasRemoved()) 4105 fSuccess = createStorageAttachment(controllerCache, attachmentCache); 4098 4099 /* Show error message if necessary: */ 4100 if (!fSuccess) 4101 msgCenter().cannotSaveStorageControllerSettings(comController, this); 4102 4103 /* For each attachment: */ 4104 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4105 { 4106 /* Get attachment cache: */ 4107 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4108 4109 /* Create attachment if it was not 'removed': */ 4110 if (!attachmentCache.wasRemoved()) 4111 fSuccess = createStorageAttachment(controllerCache, attachmentCache); 4112 } 4106 4113 } 4107 4114 } … … 4122 4129 const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data(); 4123 4130 4124 /* Make sure controller really exists: */4131 /* Search for a controller with the same name: */ 4125 4132 CStorageController comController = m_machine.GetStorageControllerByName(oldControllerData.m_strControllerName); 4126 4133 fSuccess = m_machine.isOk() && comController.isNotNull(); 4134 4127 4135 /* Show error message if necessary: */ 4128 4136 if (!fSuccess) 4129 4137 msgCenter().cannotSaveStorageSettings(m_machine, this); 4130 4131 /* Save controller type: */ 4132 if (fSuccess && newControllerData.m_controllerType != oldControllerData.m_controllerType) 4133 { 4134 comController.SetControllerType(newControllerData.m_controllerType); 4135 fSuccess = comController.isOk(); 4136 } 4137 /* Save whether controller uses IO cache: */ 4138 if (fSuccess && newControllerData.m_fUseHostIOCache != oldControllerData.m_fUseHostIOCache) 4139 { 4140 comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache); 4141 fSuccess = comController.isOk(); 4142 } 4143 /* Save controller port number: */ 4144 if ( fSuccess 4145 && newControllerData.m_uPortCount != oldControllerData.m_uPortCount 4146 && ( newControllerData.m_controllerBus == KStorageBus_SATA 4147 || newControllerData.m_controllerBus == KStorageBus_SAS 4148 || newControllerData.m_controllerBus == KStorageBus_PCIe)) 4149 { 4150 ULONG uNewPortCount = newControllerData.m_uPortCount; 4151 if (fSuccess) 4138 else 4139 { 4140 /* Save controller type: */ 4141 if (fSuccess && newControllerData.m_controllerType != oldControllerData.m_controllerType) 4152 4142 { 4153 uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount());4143 comController.SetControllerType(newControllerData.m_controllerType); 4154 4144 fSuccess = comController.isOk(); 4155 4145 } 4156 if (fSuccess) 4146 /* Save whether controller uses IO cache: */ 4147 if (fSuccess && newControllerData.m_fUseHostIOCache != oldControllerData.m_fUseHostIOCache) 4157 4148 { 4158 uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount());4149 comController.SetUseHostIOCache(newControllerData.m_fUseHostIOCache); 4159 4150 fSuccess = comController.isOk(); 4160 4151 } 4161 if (fSuccess) 4152 /* Save controller port number: */ 4153 if ( fSuccess 4154 && newControllerData.m_uPortCount != oldControllerData.m_uPortCount 4155 && ( newControllerData.m_controllerBus == KStorageBus_SATA 4156 || newControllerData.m_controllerBus == KStorageBus_SAS 4157 || newControllerData.m_controllerBus == KStorageBus_PCIe)) 4162 4158 { 4163 comController.SetPortCount(uNewPortCount); 4164 fSuccess = comController.isOk(); 4159 ULONG uNewPortCount = newControllerData.m_uPortCount; 4160 if (fSuccess) 4161 { 4162 uNewPortCount = qMax(uNewPortCount, comController.GetMinPortCount()); 4163 fSuccess = comController.isOk(); 4164 } 4165 if (fSuccess) 4166 { 4167 uNewPortCount = qMin(uNewPortCount, comController.GetMaxPortCount()); 4168 fSuccess = comController.isOk(); 4169 } 4170 if (fSuccess) 4171 { 4172 comController.SetPortCount(uNewPortCount); 4173 fSuccess = comController.isOk(); 4174 } 4165 4175 } 4166 } 4167 /* Show error message if necessary: */ 4168 if (!fSuccess) 4169 msgCenter().cannotSaveStorageControllerSettings(comController, this); 4170 4171 /* For each attachment ('removing' step): */ 4172 // We need to separately remove attachments first because 4173 // there could be limited amount of attachments available. 4174 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4175 { 4176 /* Get attachment cache: */ 4177 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4178 4179 /* Remove attachment marked for 'remove' or 'update' (if it can't be updated): */ 4180 if (attachmentCache.wasRemoved() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache))) 4181 fSuccess = removeStorageAttachment(controllerCache, attachmentCache); 4182 } 4183 4184 /* For each attachment ('creating' step): */ 4185 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4186 { 4187 /* Get attachment cache: */ 4188 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4189 4190 /* Create attachment marked for 'create' or 'update' (if it can't be updated): */ 4191 if (attachmentCache.wasCreated() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache))) 4192 fSuccess = createStorageAttachment(controllerCache, attachmentCache); 4193 4194 else 4195 4196 /* Update attachment marked for 'update' (if it can be updated): */ 4197 if (attachmentCache.wasUpdated() && isAttachmentCouldBeUpdated(attachmentCache)) 4198 fSuccess = updateStorageAttachment(controllerCache, attachmentCache); 4176 4177 /* Show error message if necessary: */ 4178 if (!fSuccess) 4179 msgCenter().cannotSaveStorageControllerSettings(comController, this); 4180 4181 /* For each attachment ('removing' step): */ 4182 // We need to separately remove attachments first because 4183 // there could be limited amount of attachments available. 4184 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4185 { 4186 /* Get attachment cache: */ 4187 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4188 4189 /* Remove attachment marked for 'remove' or 'update' (if it can't be updated): */ 4190 if (attachmentCache.wasRemoved() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache))) 4191 fSuccess = removeStorageAttachment(controllerCache, attachmentCache); 4192 } 4193 4194 /* For each attachment ('creating' step): */ 4195 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4196 { 4197 /* Get attachment cache: */ 4198 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4199 4200 /* Create attachment marked for 'create' or 'update' (if it can't be updated): */ 4201 if (attachmentCache.wasCreated() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache))) 4202 fSuccess = createStorageAttachment(controllerCache, attachmentCache); 4203 4204 else 4205 4206 /* Update attachment marked for 'update' (if it can be updated): */ 4207 if (attachmentCache.wasUpdated() && isAttachmentCouldBeUpdated(attachmentCache)) 4208 fSuccess = updateStorageAttachment(controllerCache, attachmentCache); 4209 } 4199 4210 } 4200 4211 } … … 4216 4227 const UIDataSettingsMachineStorageAttachment &oldAttachmentData = attachmentCache.base(); 4217 4228 4218 /* Make sure attachment really exists: */4229 /* Search for an attachment with the same parameters: */ 4219 4230 const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(oldControllerData.m_strControllerName, 4220 4231 oldAttachmentData.m_iAttachmentPort, … … 4222 4233 fSuccess = m_machine.isOk() && comAttachment.isNotNull(); 4223 4234 4224 /* Remove attachment: */4235 /* Make sure attachment really exists: */ 4225 4236 if (fSuccess) 4226 4237 { 4238 /* Remove attachment: */ 4227 4239 m_machine.DetachDevice(oldControllerData.m_strControllerName, 4228 4240 oldAttachmentData.m_iAttachmentPort, … … 4230 4242 fSuccess = m_machine.isOk(); 4231 4243 } 4244 4232 4245 /* Show error message if necessary: */ 4233 4246 if (!fSuccess) … … 4251 4264 const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data(); 4252 4265 4253 /* Make sure attachment doesn't exist: */4266 /* Search for an attachment with the same parameters: */ 4254 4267 const CMachine comMachine(m_machine); 4255 4268 const CMediumAttachment &comAttachment = comMachine.GetMediumAttachment(newControllerData.m_strControllerName, … … 4259 4272 AssertReturn(fSuccess, false); 4260 4273 4261 /* Create attachment: */4274 /* Make sure attachment doesn't exist: */ 4262 4275 if (fSuccess) 4263 4276 { 4277 /* Create attachment: */ 4264 4278 const UIMedium vboxMedium = vboxGlobal().medium(newAttachmentData.m_strAttachmentMediumId); 4265 4279 const CMedium comMedium = vboxMedium.medium(); … … 4271 4285 fSuccess = m_machine.isOk(); 4272 4286 } 4287 4273 4288 if (newAttachmentData.m_attachmentType == KDeviceType_DVD) 4274 4289 { … … 4304 4319 } 4305 4320 } 4321 4306 4322 if (newControllerData.m_controllerBus == KStorageBus_SATA || newControllerData.m_controllerBus == KStorageBus_USB) 4307 4323 { … … 4316 4332 } 4317 4333 } 4334 4318 4335 /* Show error message if necessary: */ 4319 4336 if (!fSuccess) … … 4337 4354 const UIDataSettingsMachineStorageAttachment &newAttachmentData = attachmentCache.data(); 4338 4355 4339 /* Make sure attachment really exists: */4356 /* Search for an attachment with the same parameters: */ 4340 4357 const CMediumAttachment &comAttachment = m_machine.GetMediumAttachment(newControllerData.m_strControllerName, 4341 4358 newAttachmentData.m_iAttachmentPort, 4342 4359 newAttachmentData.m_iAttachmentDevice); 4343 4360 fSuccess = m_machine.isOk() && comAttachment.isNotNull(); 4361 4344 4362 /* Show error message if necessary: */ 4345 4363 if (!fSuccess) 4346 4364 msgCenter().cannotSaveStorageSettings(m_machine, this); 4347 4365 4348 /* Remount attachment: */4366 /* Make sure attachment doesn't exist: */ 4349 4367 if (fSuccess) 4350 4368 { 4369 /* Remount attachment: */ 4351 4370 const UIMedium vboxMedium = vboxGlobal().medium(newAttachmentData.m_strAttachmentMediumId); 4352 4371 const CMedium comMedium = vboxMedium.medium(); … … 4358 4377 fSuccess = m_machine.isOk(); 4359 4378 } 4379 4360 4380 if (newAttachmentData.m_attachmentType == KDeviceType_DVD) 4361 4381 { … … 4391 4411 } 4392 4412 } 4413 4393 4414 if (newControllerData.m_controllerBus == KStorageBus_SATA || newControllerData.m_controllerBus == KStorageBus_USB) 4394 4415 { … … 4403 4424 } 4404 4425 } 4426 4405 4427 /* Show error message if necessary: */ 4406 4428 if (!fSuccess) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r66549 r66555 1136 1136 } 1137 1137 } 1138 1138 1139 /* Show error message if necessary: */ 1139 1140 if (!fSuccess) … … 1174 1175 fSuccess = m_machine.isOk(); 1175 1176 } 1177 1176 1178 /* Show error message if necessary: */ 1177 1179 if (!fSuccess) … … 1212 1214 fSuccess = m_machine.isOk(); 1213 1215 } 1216 1214 1217 /* Show error message if necessary: */ 1215 1218 if (!fSuccess) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r66552 r66555 1012 1012 CUSBDeviceFilters comFiltersObject = m_machine.GetUSBDeviceFilters(); 1013 1013 fSuccess = m_machine.isOk() && comFiltersObject.isNotNull(); 1014 1014 1015 /* Show error message if necessary: */ 1015 1016 if (!fSuccess) 1016 1017 msgCenter().cannotSaveUSBSettings(m_machine, this); 1017 1018 /* For each filter data set: */ 1019 int iOperationPosition = 0; 1020 for (int iFilterIndex = 0; fSuccess && iFilterIndex < m_pCache->childCount(); ++iFilterIndex) 1021 { 1022 /* Check if USB filter data was changed: */ 1023 const UISettingsCacheMachineUSBFilter &filterCache = m_pCache->child(iFilterIndex); 1024 if (filterCache.wasChanged()) 1018 else 1019 { 1020 /* For each filter data set: */ 1021 int iOperationPosition = 0; 1022 for (int iFilterIndex = 0; fSuccess && iFilterIndex < m_pCache->childCount(); ++iFilterIndex) 1025 1023 { 1024 /* Check if USB filter data was changed: */ 1025 const UISettingsCacheMachineUSBFilter &filterCache = m_pCache->child(iFilterIndex); 1026 1026 1027 /* Remove filter marked for 'remove' or 'update': */ 1027 if (f ilterCache.wasRemoved() || filterCache.wasUpdated())1028 if (fSuccess && (filterCache.wasRemoved() || filterCache.wasUpdated())) 1028 1029 { 1029 1030 fSuccess = removeUSBFilter(comFiltersObject, iOperationPosition); … … 1033 1034 1034 1035 /* Create filter marked for 'create' or 'update': */ 1035 if (f ilterCache.wasCreated() || filterCache.wasUpdated())1036 if (fSuccess && (filterCache.wasCreated() || filterCache.wasUpdated())) 1036 1037 fSuccess = createUSBFilter(comFiltersObject, iOperationPosition, filterCache.data()); 1038 1039 /* Advance operation position: */ 1040 ++iOperationPosition; 1037 1041 } 1038 /* Advance operation position: */1039 ++iOperationPosition;1040 1042 } 1041 1043 } … … 1055 1057 const CUSBControllerVector &controllers = m_machine.GetUSBControllers(); 1056 1058 fSuccess = m_machine.isOk(); 1059 1057 1060 /* Show error message if necessary: */ 1058 1061 if (!fSuccess) … … 1079 1082 fSuccess = comController.isOk(); 1080 1083 } 1084 1081 1085 /* Show error message if necessary: */ 1082 1086 if (!fSuccess) 1083 1087 msgCenter().cannotSaveUSBControllerSettings(comController, this); 1084 1085 /* Pass only if requested types were not defined or contains the one we found: */ 1086 if (!types.isEmpty() && !types.contains(enmType)) 1087 continue; 1088 1089 /* Remove controller: */ 1090 if (fSuccess) 1091 { 1092 m_machine.RemoveUSBController(comController.GetName()); 1093 fSuccess = m_machine.isOk(); 1094 } 1095 /* Show error message if necessary: */ 1096 if (!fSuccess) 1097 msgCenter().cannotSaveUSBSettings(m_machine, this); 1088 else 1089 { 1090 /* Pass only if requested types were not defined or contains the one we found: */ 1091 if (!types.isEmpty() && !types.contains(enmType)) 1092 continue; 1093 1094 /* Remove controller: */ 1095 if (fSuccess) 1096 { 1097 m_machine.RemoveUSBController(comController.GetName()); 1098 fSuccess = m_machine.isOk(); 1099 } 1100 1101 /* Show error message if necessary: */ 1102 if (!fSuccess) 1103 msgCenter().cannotSaveUSBSettings(m_machine, this); 1104 } 1098 1105 } 1099 1106 } … … 1128 1135 fSuccess = m_machine.isOk(); 1129 1136 } 1137 1130 1138 /* Show error message if necessary: */ 1131 1139 if (!fSuccess) 1132 1140 msgCenter().cannotSaveUSBSettings(m_machine, this); 1133 1134 /* For requested controller type: */ 1135 switch (enmType) 1136 { 1137 case KUSBControllerType_OHCI: 1138 { 1139 /* Remove excessive controllers: */ 1140 if (cXhciCtls || cEhciCtls) 1141 fSuccess = removeUSBControllers(QSet<KUSBControllerType>() 1142 << KUSBControllerType_XHCI 1143 << KUSBControllerType_EHCI); 1144 1145 /* Add required controller: */ 1146 if (fSuccess && !cOhciCtls) 1141 else 1142 { 1143 /* For requested controller type: */ 1144 switch (enmType) 1145 { 1146 case KUSBControllerType_OHCI: 1147 1147 { 1148 m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI); 1149 fSuccess = m_machine.isOk(); 1148 /* Remove excessive controllers: */ 1149 if (cXhciCtls || cEhciCtls) 1150 fSuccess = removeUSBControllers(QSet<KUSBControllerType>() 1151 << KUSBControllerType_XHCI 1152 << KUSBControllerType_EHCI); 1153 1154 /* Add required controller: */ 1155 if (fSuccess && !cOhciCtls) 1156 { 1157 m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI); 1158 fSuccess = m_machine.isOk(); 1159 1160 /* Show error message if necessary: */ 1161 if (!fSuccess) 1162 msgCenter().cannotSaveUSBSettings(m_machine, this); 1163 } 1164 1165 break; 1150 1166 } 1151 /* Show error message if necessary: */ 1152 if (!fSuccess) 1153 msgCenter().cannotSaveUSBSettings(m_machine, this); 1154 1155 break; 1156 } 1157 case KUSBControllerType_EHCI: 1158 { 1159 /* Remove excessive controllers: */ 1160 if (cXhciCtls) 1161 fSuccess = removeUSBControllers(QSet<KUSBControllerType>() 1162 << KUSBControllerType_XHCI); 1163 1164 /* Add required controllers: */ 1165 if (fSuccess && !cOhciCtls) 1167 case KUSBControllerType_EHCI: 1166 1168 { 1167 m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI); 1168 fSuccess = m_machine.isOk(); 1169 /* Remove excessive controllers: */ 1170 if (cXhciCtls) 1171 fSuccess = removeUSBControllers(QSet<KUSBControllerType>() 1172 << KUSBControllerType_XHCI); 1173 1174 /* Add required controllers: */ 1175 if (fSuccess) 1176 { 1177 if (fSuccess && !cOhciCtls) 1178 { 1179 m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI); 1180 fSuccess = m_machine.isOk(); 1181 } 1182 if (fSuccess && !cEhciCtls) 1183 { 1184 m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI); 1185 fSuccess = m_machine.isOk(); 1186 } 1187 1188 /* Show error message if necessary: */ 1189 if (!fSuccess) 1190 msgCenter().cannotSaveUSBSettings(m_machine, this); 1191 } 1192 1193 break; 1169 1194 } 1170 if (fSuccess && !cEhciCtls)1195 case KUSBControllerType_XHCI: 1171 1196 { 1172 m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI); 1173 fSuccess = m_machine.isOk(); 1197 /* Remove excessive controllers: */ 1198 if (cEhciCtls || cOhciCtls) 1199 fSuccess = removeUSBControllers(QSet<KUSBControllerType>() 1200 << KUSBControllerType_EHCI 1201 << KUSBControllerType_OHCI); 1202 1203 /* Add required controller: */ 1204 if (fSuccess && !cXhciCtls) 1205 { 1206 m_machine.AddUSBController("xHCI", KUSBControllerType_XHCI); 1207 fSuccess = m_machine.isOk(); 1208 1209 /* Show error message if necessary: */ 1210 if (!fSuccess) 1211 msgCenter().cannotSaveUSBSettings(m_machine, this); 1212 } 1213 1214 break; 1174 1215 } 1175 /* Show error message if necessary: */ 1176 if (!fSuccess) 1177 msgCenter().cannotSaveUSBSettings(m_machine, this); 1178 1179 break; 1180 } 1181 case KUSBControllerType_XHCI: 1182 { 1183 /* Remove excessive controllers: */ 1184 if (cEhciCtls || cOhciCtls) 1185 fSuccess = removeUSBControllers(QSet<KUSBControllerType>() 1186 << KUSBControllerType_EHCI 1187 << KUSBControllerType_OHCI); 1188 1189 /* Add required controller: */ 1190 if (fSuccess && !cXhciCtls) 1191 { 1192 m_machine.AddUSBController("xHCI", KUSBControllerType_XHCI); 1193 fSuccess = m_machine.isOk(); 1194 } 1195 /* Show error message if necessary: */ 1196 if (!fSuccess) 1197 msgCenter().cannotSaveUSBSettings(m_machine, this); 1198 1199 break; 1200 } 1201 default: 1202 break; 1216 default: 1217 break; 1218 } 1203 1219 } 1204 1220 } … … 1217 1233 comFiltersObject.RemoveDeviceFilter(iPosition); 1218 1234 fSuccess = comFiltersObject.isOk(); 1235 1219 1236 /* Show error message if necessary: */ 1220 1237 if (!fSuccess) … … 1235 1252 CUSBDeviceFilter comFilter = comFiltersObject.CreateDeviceFilter(filterData.m_strName); 1236 1253 fSuccess = comFiltersObject.isOk() && comFilter.isNotNull(); 1254 1237 1255 /* Show error message if necessary: */ 1238 1256 if (!fSuccess) 1239 1257 msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this); 1240 1241 /* Save whether filter is active: */ 1242 if (fSuccess) 1243 { 1244 comFilter.SetActive(filterData.m_fActive); 1245 fSuccess = comFilter.isOk(); 1246 } 1247 /* Save filter Vendor ID: */ 1248 if (fSuccess) 1249 { 1250 comFilter.SetVendorId(filterData.m_strVendorId); 1251 fSuccess = comFilter.isOk(); 1252 } 1253 /* Save filter Product ID: */ 1254 if (fSuccess) 1255 { 1256 comFilter.SetProductId(filterData.m_strProductId); 1257 fSuccess = comFilter.isOk(); 1258 } 1259 /* Save filter revision: */ 1260 if (fSuccess) 1261 { 1262 comFilter.SetRevision(filterData.m_strRevision); 1263 fSuccess = comFilter.isOk(); 1264 } 1265 /* Save filter manufacturer: */ 1266 if (fSuccess) 1267 { 1268 comFilter.SetManufacturer(filterData.m_strManufacturer); 1269 fSuccess = comFilter.isOk(); 1270 } 1271 /* Save filter product: */ 1272 if (fSuccess) 1273 { 1274 comFilter.SetProduct(filterData.m_strProduct); 1275 fSuccess = comFilter.isOk(); 1276 } 1277 /* Save filter serial number: */ 1278 if (fSuccess) 1279 { 1280 comFilter.SetSerialNumber(filterData.m_strSerialNumber); 1281 fSuccess = comFilter.isOk(); 1282 } 1283 /* Save filter port: */ 1284 if (fSuccess) 1285 { 1286 comFilter.SetPort(filterData.m_strPort); 1287 fSuccess = comFilter.isOk(); 1288 } 1289 /* Save filter remote mode: */ 1290 if (fSuccess) 1291 { 1292 comFilter.SetRemote(filterData.m_strRemote); 1293 fSuccess = comFilter.isOk(); 1294 } 1295 /* Show error message if necessary: */ 1296 if (!fSuccess) 1297 msgCenter().cannotSaveUSBDeviceFilterSettings(comFilter, this); 1298 1299 /* Insert filter onto corresponding position: */ 1300 if (fSuccess) 1301 { 1302 comFiltersObject.InsertDeviceFilter(iPosition, comFilter); 1303 fSuccess = comFiltersObject.isOk(); 1304 } 1305 /* Show error message if necessary: */ 1306 if (!fSuccess) 1307 msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this); 1258 else 1259 { 1260 /* Save whether filter is active: */ 1261 if (fSuccess) 1262 { 1263 comFilter.SetActive(filterData.m_fActive); 1264 fSuccess = comFilter.isOk(); 1265 } 1266 /* Save filter Vendor ID: */ 1267 if (fSuccess) 1268 { 1269 comFilter.SetVendorId(filterData.m_strVendorId); 1270 fSuccess = comFilter.isOk(); 1271 } 1272 /* Save filter Product ID: */ 1273 if (fSuccess) 1274 { 1275 comFilter.SetProductId(filterData.m_strProductId); 1276 fSuccess = comFilter.isOk(); 1277 } 1278 /* Save filter revision: */ 1279 if (fSuccess) 1280 { 1281 comFilter.SetRevision(filterData.m_strRevision); 1282 fSuccess = comFilter.isOk(); 1283 } 1284 /* Save filter manufacturer: */ 1285 if (fSuccess) 1286 { 1287 comFilter.SetManufacturer(filterData.m_strManufacturer); 1288 fSuccess = comFilter.isOk(); 1289 } 1290 /* Save filter product: */ 1291 if (fSuccess) 1292 { 1293 comFilter.SetProduct(filterData.m_strProduct); 1294 fSuccess = comFilter.isOk(); 1295 } 1296 /* Save filter serial number: */ 1297 if (fSuccess) 1298 { 1299 comFilter.SetSerialNumber(filterData.m_strSerialNumber); 1300 fSuccess = comFilter.isOk(); 1301 } 1302 /* Save filter port: */ 1303 if (fSuccess) 1304 { 1305 comFilter.SetPort(filterData.m_strPort); 1306 fSuccess = comFilter.isOk(); 1307 } 1308 /* Save filter remote mode: */ 1309 if (fSuccess) 1310 { 1311 comFilter.SetRemote(filterData.m_strRemote); 1312 fSuccess = comFilter.isOk(); 1313 } 1314 1315 /* Show error message if necessary: */ 1316 if (!fSuccess) 1317 msgCenter().cannotSaveUSBDeviceFilterSettings(comFilter, this); 1318 else 1319 { 1320 /* Insert filter onto corresponding position: */ 1321 comFiltersObject.InsertDeviceFilter(iPosition, comFilter); 1322 fSuccess = comFiltersObject.isOk(); 1323 1324 /* Show error message if necessary: */ 1325 if (!fSuccess) 1326 msgCenter().cannotSaveUSBDeviceFiltersSettings(comFiltersObject, this); 1327 } 1328 } 1308 1329 } 1309 1330 /* Return result: */
Note:
See TracChangeset
for help on using the changeset viewer.

