Changeset 94530 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 8, 2022 12:20:59 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r94358 r94530 1145 1145 { 1146 1146 /* Prepare editor: */ 1147 UINetworkAttachmentEditor *pEditor = new UINetworkAttachmentEditor(pPopup , true /* with label */);1147 UINetworkAttachmentEditor *pEditor = new UINetworkAttachmentEditor(pPopup); 1148 1148 if (pEditor) 1149 1149 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINetworkAttachmentEditor.cpp
r94058 r94530 43 43 QString UINetworkAttachmentEditor::s_strEmptyItemId = QString("#empty#"); 44 44 45 UINetworkAttachmentEditor::UINetworkAttachmentEditor(QWidget *pParent /* = 0 */ , bool fWithLabels /* = false */)45 UINetworkAttachmentEditor::UINetworkAttachmentEditor(QWidget *pParent /* = 0 */) 46 46 : QIWithRetranslateUI<QWidget>(pParent) 47 , m_fWithLabels(fWithLabels)48 47 , m_enmRestrictedNetworkAttachmentTypes(UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid) 49 48 , m_enmType(KNetworkAttachmentType_Max) … … 58 57 void UINetworkAttachmentEditor::setValueType(KNetworkAttachmentType enmType) 59 58 { 60 /* Make sure combo is there: */ 61 if (!m_pComboType) 62 return; 63 /* Make sure type is changed: */ 64 if (m_enmType == enmType) 65 return; 66 67 /* Remember requested type: */ 68 m_enmType = enmType; 69 /* Repopulate finally, supported values might change: */ 70 populateTypeCombo(); 59 if (m_enmType != enmType) 60 { 61 m_enmType = enmType; 62 populateTypeCombo(); 63 } 71 64 } 72 65 … … 91 84 m_name[enmType] = strName; 92 85 93 /* Make sure combo is there: */94 if (!m_pComboName)95 return;96 97 86 /* If value type is the same, update the combo as well: */ 98 87 if (valueType() == enmType) 99 88 { 100 const int iIndex = m_pComboName->findText(strName); 101 if (iIndex != -1) 102 m_pComboName->setCurrentIndex(iIndex); 89 /* Make sure combo is there: */ 90 if (m_pComboName) 91 { 92 const int iIndex = m_pComboName->findText(strName); 93 if (iIndex != -1) 94 m_pComboName->setCurrentIndex(iIndex); 95 } 103 96 } 104 97 } … … 194 187 { 195 188 const KNetworkAttachmentType enmType = m_pComboType->itemData(i).value<KNetworkAttachmentType>(); 196 const QString strName = gpConverter->toString(enmType); 197 m_pComboType->setItemData(i, strName, Qt::ToolTipRole); 198 m_pComboType->setItemText(i, strName); 199 } 200 m_pComboType->setToolTip(tr("Selects how this virtual adapter is attached to the real network of the Host OS.")); 201 } 202 203 /* Translate name combo: */ 204 if (m_pComboName) 205 m_pComboName->setToolTip(tr("Selects the network or adapter name associated with this virtual adapter.")); 189 m_pComboType->setItemText(i, gpConverter->toString(enmType)); 190 } 191 m_pComboType->setToolTip(tr("Holds how this virtual adapter is attached to the real network of the Host OS.")); 192 } 206 193 207 194 /* Translate name combo: */ … … 273 260 pMainLayout->setContentsMargins(0, 0, 0, 0); 274 261 275 int iColumn = 0;276 277 262 /* Create type label: */ 278 if (m_fWithLabels)279 {280 m_pLabelType = new QLabel(this);263 m_pLabelType = new QLabel(this); 264 if (m_pLabelType) 265 { 281 266 m_pLabelType->setAlignment(Qt::AlignVCenter | Qt::AlignRight); 282 } 283 if (m_pLabelType) 284 pMainLayout->addWidget(m_pLabelType, 0, iColumn++); 285 267 pMainLayout->addWidget(m_pLabelType, 0, 0); 268 } 286 269 /* Create type combo layout: */ 287 270 QHBoxLayout *pComboLayout = new QHBoxLayout; … … 303 286 304 287 /* Add combo-layout into main-layout: */ 305 pMainLayout->addLayout(pComboLayout, 0, iColumn++); 306 } 307 308 iColumn = 0; 288 pMainLayout->addLayout(pComboLayout, 0, 1); 289 } 309 290 310 291 /* Create name label: */ 311 if (m_fWithLabels) 312 { 313 m_pLabelName = new QLabel(this); 314 m_pLabelName->setAlignment(Qt::AlignVCenter | Qt::AlignRight); 315 } 292 m_pLabelName = new QLabel(this); 293 m_pLabelName->setAlignment(Qt::AlignVCenter | Qt::AlignRight); 316 294 if (m_pLabelName) 317 pMainLayout->addWidget(m_pLabelName, 1, iColumn++); 318 295 pMainLayout->addWidget(m_pLabelName, 1, 0); 319 296 /* Create name combo: */ 320 297 m_pComboName = new QComboBox(this); … … 328 305 connect(m_pComboName, &QComboBox::editTextChanged, 329 306 this, &UINetworkAttachmentEditor::sltHandleCurrentNameChanged); 330 pMainLayout->addWidget(m_pComboName, 1, iColumn++);307 pMainLayout->addWidget(m_pComboName, 1, 1); 331 308 } 332 309 } … … 354 331 CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties(); 355 332 QVector<KNetworkAttachmentType> supportedTypes = comProperties.GetSupportedNetworkAttachmentTypes(); 356 /* Take currently requested type into account if it's sane: */333 /* Take currently requested type into account if it's different from initial one: */ 357 334 if (!supportedTypes.contains(m_enmType) && m_enmType != KNetworkAttachmentType_Max) 358 335 supportedTypes.prepend(m_enmType); … … 367 344 m_pComboType->insertItem(iAttachmentTypeIndex, gpConverter->toString(enmType)); 368 345 m_pComboType->setItemData(iAttachmentTypeIndex, QVariant::fromValue(enmType)); 369 m_pComboType->setItemData(iAttachmentTypeIndex, m_pComboType->itemText(iAttachmentTypeIndex), Qt::ToolTipRole);370 346 ++iAttachmentTypeIndex; 371 347 } … … 450 426 { 451 427 case KNetworkAttachmentType_Bridged: 452 m_pComboName->set WhatsThis(tr("Selects the network adapter on the host system that traffic "453 428 m_pComboName->setToolTip(tr("Holds the network adapter on the host system that traffic " 429 "to and from this network card will go through.")); 454 430 break; 455 431 case KNetworkAttachmentType_Internal: 456 m_pComboName->set WhatsThis(tr("Holds the name of the internal network that this network card "457 458 459 432 m_pComboName->setToolTip(tr("Holds the name of the internal network that this network card " 433 "will be connected to. You can create a new internal network by " 434 "choosing a name which is not used by any other network cards " 435 "in this virtual machine or others.")); 460 436 break; 461 437 case KNetworkAttachmentType_HostOnly: 462 m_pComboName->set WhatsThis(tr("Selects the virtual network adapter on the host system that traffic "463 464 465 438 m_pComboName->setToolTip(tr("Holds the virtual network adapter on the host system that traffic " 439 "to and from this network card will go through. " 440 "You can create and remove adapters using the global network " 441 "settings in the virtual machine manager window.")); 466 442 break; 467 443 case KNetworkAttachmentType_Generic: 468 m_pComboName->set WhatsThis(tr("Selects the driver to be used with this network card."));444 m_pComboName->setToolTip(tr("Holds the driver to be used with this network card.")); 469 445 break; 470 446 case KNetworkAttachmentType_NATNetwork: 471 m_pComboName->set WhatsThis(tr("Holds the name of the NAT network that this network card "472 473 474 447 m_pComboName->setToolTip(tr("Holds the name of the NAT network that this network card " 448 "will be connected to. You can create and remove networks " 449 "using the Network Manager tool in the virtual machine " 450 "manager window.")); 475 451 break; 476 452 #ifdef VBOX_WITH_CLOUD_NET 477 453 case KNetworkAttachmentType_Cloud: 478 m_pComboName->set WhatsThis(tr("(experimental) Holds the name of the cloud network that this network card "479 480 481 454 m_pComboName->setToolTip(tr("(experimental) Holds the name of the cloud network that this network card " 455 "will be connected to. You can add and remove networks " 456 "using the Cloud Profile Manager tool in the virtual machine " 457 "manager window.")); 482 458 break; 483 459 #endif /* VBOX_WITH_CLOUD_NET */ 484 460 #ifdef VBOX_WITH_VMNET 485 461 case KNetworkAttachmentType_HostOnlyNetwork: 486 m_pComboName->set WhatsThis(tr("Holds the name of the host-only network that this network card "487 488 489 462 m_pComboName->setToolTip(tr("Holds the name of the host-only network that this network card " 463 "will be connected to. You can add and remove networks " 464 "using the Network Manager tool in the virtual machine " 465 "manager window.")); 490 466 break; 491 467 #endif /* VBOX_WITH_VMNET */ 492 468 default: 493 m_pComboName->set WhatsThis(QString());469 m_pComboName->setToolTip(QString()); 494 470 break; 495 471 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINetworkAttachmentEditor.h
r94395 r94530 54 54 public: 55 55 56 /** Constructs editor passing @a pParent to the base-class. 57 * @param fWithLabels Brings whether we should add labels ourselves. */ 58 UINetworkAttachmentEditor(QWidget *pParent = 0, bool fWithLabels = false); 56 /** Constructs editor passing @a pParent to the base-class. */ 57 UINetworkAttachmentEditor(QWidget *pParent = 0); 59 58 60 59 /** Defines value @a enmType. */ … … 120 119 121 120 /** Holds the empty item data id. */ 122 static QString s_strEmptyItemId; 123 124 /** Holds whether descriptive labels should be created. */ 125 bool m_fWithLabels; 121 static QString s_strEmptyItemId; 126 122 127 123 /** Holds the attachment type restrictions. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r94527 r94530 643 643 644 644 /* Prepare attachment type editor: */ 645 m_pEditorAttachmentType = new UINetworkAttachmentEditor(m_pWidgetAdapterSettings , true);645 m_pEditorAttachmentType = new UINetworkAttachmentEditor(m_pWidgetAdapterSettings); 646 646 if (m_pEditorAttachmentType) 647 647 pLayoutAdapterSettings->addWidget(m_pEditorAttachmentType);
Note:
See TracChangeset
for help on using the changeset viewer.