Changeset 37571 in vbox
- Timestamp:
- Jun 21, 2011 11:34:43 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
r37463 r37571 127 127 setCurrentIndex(indexOf(m_pErrBox)); 128 128 } 129 129 130 signals: 130 131 … … 163 164 void createTextPage(); 164 165 void createErrPage(); 166 167 static QString summarizeGenericProperties(const CNetworkAdapter &adapter); 165 168 166 169 /* Private member vars */ … … 461 464 vboxGlobal().virtualBox().SetExtraDataStringList(VBoxDefs::GUI_DetailsPageBoxes, 462 465 boxes); 466 } 467 468 void UIDetailsPagePrivate::retranslateUi() 469 { 470 if (m_pErrLabel) 471 m_pErrLabel->setText(tr( 472 "The selected virtual machine is <i>inaccessible</i>. Please " 473 "inspect the error message shown below and press the " 474 "<b>Refresh</b> button if you want to repeat the accessibility " 475 "check:")); 476 477 if (mRefreshAction && mRefreshButton) 478 { 479 mRefreshButton->setText(mRefreshAction->text()); 480 mRefreshButton->setIcon(mRefreshAction->icon()); 481 mRefreshButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 482 } 483 484 /* General */ 485 { 486 m_secBoxes.value(GeneralSec)->setTitle(tr("General", "details report")); 487 m_actions.value(GeneralSec)->setText(m_secBoxes.value(GeneralSec)->title()); 488 } 489 490 /* System */ 491 { 492 m_secBoxes.value(SystemSec)->setTitle(tr("System", "details report")); 493 m_actions.value(SystemSec)->setText(m_secBoxes.value(SystemSec)->title()); 494 } 495 496 /* Preview */ 497 { 498 m_secBoxes.value(PreviewSec)->setTitle(tr("Preview", "details report")); 499 m_actions.value(PreviewSec)->setText(m_secBoxes.value(PreviewSec)->title()); 500 } 501 502 /* Display */ 503 { 504 m_secBoxes.value(DisplaySec)->setTitle(tr("Display", "details report")); 505 m_actions.value(DisplaySec)->setText(m_secBoxes.value(DisplaySec)->title()); 506 } 507 508 /* Storage */ 509 { 510 m_secBoxes.value(StorageSec)->setTitle(tr("Storage", "details report")); 511 m_actions.value(StorageSec)->setText(m_secBoxes.value(StorageSec)->title()); 512 } 513 514 /* Audio */ 515 { 516 m_secBoxes.value(AudioSec)->setTitle(tr("Audio", "details report")); 517 m_actions.value(AudioSec)->setText(m_secBoxes.value(AudioSec)->title()); 518 } 519 520 /* Network */ 521 { 522 m_secBoxes.value(NetworkSec)->setTitle(tr("Network", "details report")); 523 m_actions.value(NetworkSec)->setText(m_secBoxes.value(NetworkSec)->title()); 524 } 525 526 /* Serial Ports */ 527 { 528 m_secBoxes.value(SerialPortsSec)->setTitle(tr("Serial Ports", "details report")); 529 m_actions.value(SerialPortsSec)->setText(m_secBoxes.value(SerialPortsSec)->title()); 530 } 531 532 #ifdef VBOX_WITH_PARALLEL_PORTS 533 /* Parallel Ports */ 534 { 535 m_secBoxes.value(ParallelPortsSec)->setTitle(tr("Parallel Ports", "details report")); 536 m_actions.value(ParallelPortsSec)->setText(m_secBoxes.value(ParallelPortsSec)->title()); 537 } 538 #endif /* VBOX_WITH_PARALLEL_PORTS */ 539 540 /* USB */ 541 { 542 m_secBoxes.value(USBSec)->setTitle(tr("USB", "details report")); 543 m_actions.value(USBSec)->setText(m_secBoxes.value(USBSec)->title()); 544 } 545 546 /* Shared Folders */ 547 { 548 m_secBoxes.value(SharedFoldersSec)->setTitle(tr("Shared Folders", "details report")); 549 m_actions.value(SharedFoldersSec)->setText(m_secBoxes.value(SharedFoldersSec)->title()); 550 } 551 552 /* Description */ 553 { 554 m_secBoxes.value(DescriptionSec)->setTitle(tr("Description", "details report")); 555 m_actions.value(DescriptionSec)->setText(m_secBoxes.value(DescriptionSec)->title()); 556 } 463 557 } 464 558 … … 716 810 } 717 811 718 /**719 * Return a text summary of the properties of a generic network adapter720 */721 QString summarizeGenericProperties(const CNetworkAdapter &adapter)722 {723 QVector<QString> names;724 QVector<QString> props;725 props = adapter.GetProperties(QString(), names); // all properties, please726 727 QString result;728 for (int i = 0; i < names.size(); i++)729 {730 result += names[i] + "=" + props[i];731 if (i != names.size() - 1)732 result += ", ";733 }734 735 return result;736 }737 738 812 void UIDetailsPagePrivate::sltUpdateNetwork() 739 813 { … … 1088 1162 } 1089 1163 1090 void UIDetailsPagePrivate::retranslateUi() 1091 { 1092 if (m_pErrLabel) 1093 m_pErrLabel->setText(tr( 1094 "The selected virtual machine is <i>inaccessible</i>. Please " 1095 "inspect the error message shown below and press the " 1096 "<b>Refresh</b> button if you want to repeat the accessibility " 1097 "check:")); 1098 1099 if (mRefreshAction && mRefreshButton) 1100 { 1101 mRefreshButton->setText(mRefreshAction->text()); 1102 mRefreshButton->setIcon(mRefreshAction->icon()); 1103 mRefreshButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 1104 } 1105 1106 /* General */ 1107 { 1108 m_secBoxes.value(GeneralSec)->setTitle(tr("General", "details report")); 1109 m_actions.value(GeneralSec)->setText(m_secBoxes.value(GeneralSec)->title()); 1110 } 1111 1112 /* System */ 1113 { 1114 m_secBoxes.value(SystemSec)->setTitle(tr("System", "details report")); 1115 m_actions.value(SystemSec)->setText(m_secBoxes.value(SystemSec)->title()); 1116 } 1117 1118 /* Preview */ 1119 { 1120 m_secBoxes.value(PreviewSec)->setTitle(tr("Preview", "details report")); 1121 m_actions.value(PreviewSec)->setText(m_secBoxes.value(PreviewSec)->title()); 1122 } 1123 1124 /* Display */ 1125 { 1126 m_secBoxes.value(DisplaySec)->setTitle(tr("Display", "details report")); 1127 m_actions.value(DisplaySec)->setText(m_secBoxes.value(DisplaySec)->title()); 1128 } 1129 1130 /* Storage */ 1131 { 1132 m_secBoxes.value(StorageSec)->setTitle(tr("Storage", "details report")); 1133 m_actions.value(StorageSec)->setText(m_secBoxes.value(StorageSec)->title()); 1134 } 1135 1136 /* Audio */ 1137 { 1138 m_secBoxes.value(AudioSec)->setTitle(tr("Audio", "details report")); 1139 m_actions.value(AudioSec)->setText(m_secBoxes.value(AudioSec)->title()); 1140 } 1141 1142 /* Network */ 1143 { 1144 m_secBoxes.value(NetworkSec)->setTitle(tr("Network", "details report")); 1145 m_actions.value(NetworkSec)->setText(m_secBoxes.value(NetworkSec)->title()); 1146 } 1147 1148 /* Serial Ports */ 1149 { 1150 m_secBoxes.value(SerialPortsSec)->setTitle(tr("Serial Ports", "details report")); 1151 m_actions.value(SerialPortsSec)->setText(m_secBoxes.value(SerialPortsSec)->title()); 1152 } 1153 1154 #ifdef VBOX_WITH_PARALLEL_PORTS 1155 /* Parallel Ports */ 1156 { 1157 m_secBoxes.value(ParallelPortsSec)->setTitle(tr("Parallel Ports", "details report")); 1158 m_actions.value(ParallelPortsSec)->setText(m_secBoxes.value(ParallelPortsSec)->title()); 1159 } 1160 #endif /* VBOX_WITH_PARALLEL_PORTS */ 1161 1162 /* USB */ 1163 { 1164 m_secBoxes.value(USBSec)->setTitle(tr("USB", "details report")); 1165 m_actions.value(USBSec)->setText(m_secBoxes.value(USBSec)->title()); 1166 } 1167 1168 /* Shared Folders */ 1169 { 1170 m_secBoxes.value(SharedFoldersSec)->setTitle(tr("Shared Folders", "details report")); 1171 m_actions.value(SharedFoldersSec)->setText(m_secBoxes.value(SharedFoldersSec)->title()); 1172 } 1173 1174 /* Description */ 1175 { 1176 m_secBoxes.value(DescriptionSec)->setTitle(tr("Description", "details report")); 1177 m_actions.value(DescriptionSec)->setText(m_secBoxes.value(DescriptionSec)->title()); 1178 } 1164 /** 1165 * Return a text summary of the properties of a generic network adapter 1166 */ 1167 /* static */ 1168 QString UIDetailsPagePrivate::summarizeGenericProperties(const CNetworkAdapter &adapter) 1169 { 1170 QVector<QString> names; 1171 QVector<QString> props; 1172 props = adapter.GetProperties(QString(), names); 1173 QString strResult; 1174 for (int i = 0; i < names.size(); ++i) 1175 { 1176 strResult += names[i] + "=" + props[i]; 1177 if (i < names.size() - 1) 1178 strResult += ", "; 1179 } 1180 return strResult; 1179 1181 } 1180 1182 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r37200 r37571 80 80 m_pPromiscuousModeLabel->setEnabled(m_pParent->isMachineInValidMode() && 81 81 attachmentType() != KNetworkAttachmentType_Null && 82 attachmentType() != KNetworkAttachmentType_Generic && 82 83 attachmentType() != KNetworkAttachmentType_NAT); 83 84 m_pPromiscuousModeCombo->setEnabled(m_pParent->isMachineInValidMode() && 84 85 attachmentType() != KNetworkAttachmentType_Null && 86 attachmentType() != KNetworkAttachmentType_Generic && 85 87 attachmentType() != KNetworkAttachmentType_NAT); 86 88 m_pMACLabel->setEnabled(m_pParent->isMachineOffline()); … … 141 143 /* Other options: */ 142 144 m_pMACEditor->setText(adapterData.m_strMACAddress); 145 m_pGenericPropertiesTextEdit->setText(adapterData.m_strGenericProperties); 143 146 m_pCableConnectedCheckBox->setChecked(adapterData.m_fCableConnected); 144 147 … … 174 177 case KNetworkAttachmentType_Generic: 175 178 adapterData.m_strGenericDriver = alternativeName(); 179 adapterData.m_strGenericProperties = m_pGenericPropertiesTextEdit->toPlainText(); 176 180 break; 177 181 default: … … 335 339 attachmentType() != KNetworkAttachmentType_NAT); 336 340 m_pPromiscuousModeLabel->setEnabled(attachmentType() != KNetworkAttachmentType_Null && 341 attachmentType() != KNetworkAttachmentType_Generic && 337 342 attachmentType() != KNetworkAttachmentType_NAT); 338 343 m_pPromiscuousModeCombo->setEnabled(attachmentType() != KNetworkAttachmentType_Null && 344 attachmentType() != KNetworkAttachmentType_Generic && 339 345 attachmentType() != KNetworkAttachmentType_NAT); 340 346 … … 416 422 sltUpdateAlternativeName(); 417 423 424 /* Update visibility of "generic" properties editor: */ 425 m_pGenericPropertiesLabel->setVisible(attachmentType() == KNetworkAttachmentType_Generic && 426 m_pAdvancedArrow->isExpanded()); 427 m_pGenericPropertiesTextEdit->setVisible(attachmentType() == KNetworkAttachmentType_Generic && 428 m_pAdvancedArrow->isExpanded()); 429 418 430 /* Update Forwarding rules button availability: */ 419 431 m_pPortForwardingButton->setEnabled(attachmentType() == KNetworkAttachmentType_NAT); … … 489 501 m_pPromiscuousModeLabel->setVisible(m_pAdvancedArrow->isExpanded()); 490 502 m_pPromiscuousModeCombo->setVisible(m_pAdvancedArrow->isExpanded()); 503 m_pGenericPropertiesLabel->setVisible(attachmentType() == KNetworkAttachmentType_Generic && 504 m_pAdvancedArrow->isExpanded()); 505 m_pGenericPropertiesTextEdit->setVisible(attachmentType() == KNetworkAttachmentType_Generic && 506 m_pAdvancedArrow->isExpanded()); 491 507 m_pMACLabel->setVisible(m_pAdvancedArrow->isExpanded()); 492 508 m_pMACEditor->setVisible(m_pAdvancedArrow->isExpanded()); … … 774 790 adapterData.m_promiscuousMode = adapter.GetPromiscModePolicy(); 775 791 adapterData.m_strMACAddress = adapter.GetMACAddress(); 792 adapterData.m_strGenericProperties = summarizeGenericProperties(adapter); 776 793 adapterData.m_fCableConnected = adapter.GetCableConnected(); 777 794 … … 898 915 case KNetworkAttachmentType_Generic: 899 916 adapter.SetGenericDriver(adapterData.m_strGenericDriver); 917 updateGenericProperties(adapter, adapterData.m_strGenericProperties); 900 918 break; 901 919 default: … … 987 1005 } 988 1006 1007 /* static */ 1008 QString UIMachineSettingsNetworkPage::summarizeGenericProperties(const CNetworkAdapter &adapter) 1009 { 1010 /* Prepare formatted string: */ 1011 QVector<QString> names; 1012 QVector<QString> props; 1013 props = adapter.GetProperties(QString(), names); 1014 QString strResult; 1015 /* Load generic properties: */ 1016 for (int i = 0; i < names.size(); ++i) 1017 { 1018 strResult += names[i] + "=" + props[i]; 1019 if (i < names.size() - 1) 1020 strResult += "\n"; 1021 } 1022 /* Return formatted string: */ 1023 return strResult; 1024 } 1025 1026 /* static */ 1027 void UIMachineSettingsNetworkPage::updateGenericProperties(CNetworkAdapter &adapter, const QString &strPropText) 1028 { 1029 /* Parse new properties: */ 1030 QStringList newProps = strPropText.split("\n"); 1031 QHash<QString, QString> hash; 1032 1033 /* Save new properties: */ 1034 for (int i = 0; i < newProps.size(); ++i) 1035 { 1036 QString strLine = newProps[i]; 1037 int iSplitPos = strLine.indexOf("="); 1038 if (iSplitPos) 1039 { 1040 QString strKey = strLine.left(iSplitPos); 1041 QString strVal = strLine.mid(iSplitPos+1); 1042 adapter.SetProperty(strKey, strVal); 1043 hash[strKey] = strVal; 1044 } 1045 } 1046 1047 /* Removing deleted properties: */ 1048 QVector<QString> names; 1049 QVector<QString> props; 1050 props = adapter.GetProperties(QString(), names); 1051 for (int i = 0; i < names.size(); ++i) 1052 { 1053 QString strName = names[i]; 1054 QString strValue = props[i]; 1055 if (strValue != hash[strName]) 1056 adapter.SetProperty(strName, hash[strName]); 1057 } 1058 } 1059 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r37200 r37571 44 44 , m_strHostInterfaceName(QString()) 45 45 , m_strGenericDriver(QString()) 46 , m_strGenericProperties(QString()) 46 47 , m_strMACAddress(QString()) 47 48 , m_fCableConnected(false) … … 59 60 (m_strHostInterfaceName == other.m_strHostInterfaceName) && 60 61 (m_strGenericDriver == other.m_strGenericDriver) && 62 (m_strGenericProperties == other.m_strGenericProperties) && 61 63 (m_strMACAddress == other.m_strMACAddress) && 62 64 (m_fCableConnected == other.m_fCableConnected) && … … 76 78 QString m_strHostInterfaceName; 77 79 QString m_strGenericDriver; 80 QString m_strGenericProperties; 78 81 QString m_strMACAddress; 79 82 bool m_fCableConnected; … … 195 198 void polishPage(); 196 199 200 static QString summarizeGenericProperties(const CNetworkAdapter &adapter); 201 static void updateGenericProperties(CNetworkAdapter &adapter, const QString &strPropText); 202 197 203 QIWidgetValidator *m_pValidator; 198 204 QITabWidget *m_pTwAdapters; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.ui
r36104 r37571 233 233 </widget> 234 234 </item> 235 <item row="6" column="0"> 236 <widget class="QLabel" name="m_pGenericPropertiesLabel"> 237 <property name="text"> 238 <string>Generic Properties:</string> 239 </property> 240 <property name="alignment"> 241 <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignTop</set> 242 </property> 243 </widget> 244 </item> 235 245 <item row="6" column="1" colspan="3"> 246 <widget class="QTextEdit" name="m_pGenericPropertiesTextEdit"> 247 <property name="whatsThis"> 248 <string>Allows to specify the generic properties passed to the generic driver.<br>Please use <b>shift-enter</b> to insert a new line.</string> 249 </property> 250 </widget> 251 </item> 252 <item row="7" column="1" colspan="3"> 236 253 <widget class="QCheckBox" name="m_pCableConnectedCheckBox"> 237 254 <property name="whatsThis"> … … 243 260 </widget> 244 261 </item> 245 <item row=" 7" column="1">262 <item row="8" column="1"> 246 263 <widget class="QPushButton" name="m_pPortForwardingButton"> 247 264 <property name="whatsThis"> … … 253 270 </widget> 254 271 </item> 255 <item row=" 8" column="0" colspan="4">272 <item row="9" column="0" colspan="4"> 256 273 <spacer name="m_pVerticalSpacer"> 257 274 <property name="orientation">
Note:
See TracChangeset
for help on using the changeset viewer.