Changeset 94555 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 11, 2022 1:34:39 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r94534 r94555 689 689 690 690 UIMachineSettingsNetworkPage::UIMachineSettingsNetworkPage() 691 : m_p TabWidget(0)692 , m_p Cache(0)691 : m_pCache(0) 692 , m_pTabWidget(0) 693 693 { 694 694 prepare(); … … 770 770 forwardingData.at(4), 771 771 forwardingData.at(5).toUInt()); 772 773 772 const QString &strForwardingKey = forwardingData.at(0); 774 773 /* Cache old forwarding data: */ … … 800 799 /* Get adapter page: */ 801 800 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot)); 801 AssertPtrReturnVoid(pTab); 802 802 803 803 /* Load old adapter data from cache: */ … … 828 828 /* Get adapter page: */ 829 829 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot)); 830 AssertPtrReturnVoid(pTab); 830 831 831 832 /* Gather new adapter data: */ … … 858 859 { 859 860 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(i)); 860 Assert Msg(pTab, ("Can't get adapter tab!\n"));861 AssertPtrReturn(pTab, false); 861 862 if (!pTab->validate(messages)) 862 863 fValid = false; … … 869 870 void UIMachineSettingsNetworkPage::retranslateUi() 870 871 { 871 for (int i = 0; i < m_pTabWidget->count(); ++i)872 { 873 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(i ));874 Assert (pTab);875 m_pTabWidget->setTabText(i , pTab->tabTitle());872 for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot) 873 { 874 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot)); 875 AssertPtrReturnVoid(pTab); 876 m_pTabWidget->setTabText(iSlot, pTab->tabTitle()); 876 877 } 877 878 } … … 879 880 void UIMachineSettingsNetworkPage::polishPage() 880 881 { 881 /* Get the count of network adapter tabs: */882 882 for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot) 883 883 { … … 888 888 m_pCache->child(iSlot).base().m_fAdapterEnabled)); 889 889 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot)); 890 AssertPtrReturnVoid(pTab); 890 891 pTab->polishTab(); 891 892 } … … 896 897 /* Determine the sender: */ 897 898 UIMachineSettingsNetwork *pSender = qobject_cast<UIMachineSettingsNetwork*>(sender()); 898 Assert Msg(pSender, ("This slot should be called only through signal<->slot mechanism from one of UIMachineSettingsNetwork tabs!\n"));899 AssertPtrReturnVoid(pSender); 899 900 900 901 /* Determine sender's attachment type: */ 901 const KNetworkAttachmentType enmSenderAttachmentType = pSender->attachmentType(); 902 switch (enmSenderAttachmentType) 903 { 904 case KNetworkAttachmentType_Internal: 905 { 906 refreshInternalNetworkList(); 907 break; 908 } 909 case KNetworkAttachmentType_Generic: 910 { 911 refreshGenericDriverList(); 912 break; 913 } 914 default: 915 break; 902 switch (pSender->attachmentType()) 903 { 904 case KNetworkAttachmentType_Internal: refreshInternalNetworkList(); break; 905 case KNetworkAttachmentType_Generic: refreshGenericDriverList(); break; 906 default: break; 916 907 } 917 908 … … 921 912 /* Get the iterated tab: */ 922 913 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot)); 923 Assert Msg(pTab, ("All the tabs of m_pTabWidget should be of the UIMachineSettingsNetwork type!\n"));914 AssertPtrReturnVoid(pTab); 924 915 925 916 /* Update all the tabs (except sender): */ … … 935 926 { 936 927 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot)); 928 AssertPtrReturnVoid(pTab); 937 929 pTab->setAdvancedButtonState(fExpanded); 938 930 } … … 947 939 /* Create main layout: */ 948 940 QVBoxLayout *pLayoutMain = new QVBoxLayout(this); 949 AssertPtrReturnVoid(pLayoutMain);941 if (pLayoutMain) 950 942 { 951 943 /* Creating tab-widget: */ 952 944 m_pTabWidget = new QITabWidget; 953 AssertPtrReturnVoid(m_pTabWidget);945 if (m_pTabWidget) 954 946 { 955 947 /* How many adapters to display: */ … … 965 957 /* Create adapter tab: */ 966 958 UIMachineSettingsNetwork *pTab = new UIMachineSettingsNetwork(this); 967 AssertPtrReturnVoid(pTab);959 if (pTab) 968 960 { 969 961 /* Configure tab: */ … … 1004 996 m_internalNetworkList << m_internalNetworkListSaved; 1005 997 /* Append internal network list with names from all the tabs: */ 1006 for (int iTab = 0; iTab < m_pTabWidget->count(); ++iTab) 1007 { 1008 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iTab)); 1009 if (pTab) 1010 { 1011 const QString strName = pTab->alternativeName(KNetworkAttachmentType_Internal); 1012 if (!strName.isEmpty() && !m_internalNetworkList.contains(strName)) 1013 m_internalNetworkList << strName; 1014 } 998 for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot) 999 { 1000 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot)); 1001 AssertPtrReturnVoid(pTab); 1002 const QString strName = pTab->alternativeName(KNetworkAttachmentType_Internal); 1003 if (!strName.isEmpty() && !m_internalNetworkList.contains(strName)) 1004 m_internalNetworkList << strName; 1015 1005 } 1016 1006 } … … 1047 1037 m_genericDriverList << m_genericDriverListSaved; 1048 1038 /* Append generic driver list with names from all the tabs: */ 1049 for (int iTab = 0; iTab < m_pTabWidget->count(); ++iTab) 1050 { 1051 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iTab)); 1052 if (pTab) 1053 { 1054 const QString strName = pTab->alternativeName(KNetworkAttachmentType_Generic); 1055 if (!strName.isEmpty() && !m_genericDriverList.contains(strName)) 1056 m_genericDriverList << strName; 1057 } 1039 for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot) 1040 { 1041 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot)); 1042 AssertPtrReturnVoid(pTab); 1043 const QString strName = pTab->alternativeName(KNetworkAttachmentType_Generic); 1044 if (!strName.isEmpty() && !m_genericDriverList.contains(strName)) 1045 m_genericDriverList << strName; 1058 1046 } 1059 1047 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r94333 r94555 139 139 bool saveAdapterData(int iSlot); 140 140 141 /** Holds the tab-widget instance. */142 QITabWidget *m_pTabWidget;143 144 141 /** Holds the bridged adapter list. */ 145 142 QStringList m_bridgedAdapterList; … … 167 164 /** Holds the page data cache instance. */ 168 165 UISettingsCacheMachineNetwork *m_pCache; 166 167 /** Holds the tab-widget instance. */ 168 QITabWidget *m_pTabWidget; 169 169 }; 170 170
Note:
See TracChangeset
for help on using the changeset viewer.