[vbox-dev] [PATCH] VirtualBox GUI improvement - hides disabled options

Alexey Eromenko al4321 at gmail.com
Thu Jun 23 18:02:36 GMT 2011


Hi,

This patch hides some GUI elements:
a. hide SMP + accel. tab on non-VT-x hosts.
b. hide "Port Forwarding" on non-NAT backends.
c. hide "Promisc. Mode" on user-space backends.

MIT licensed.
-- 
-Alexey Eromenko "Technologov"
-------------- next part --------------
Binary files ../1/src//VBox/Additions/common/crOpenGL/entrypoints.pyc and src//VBox/Additions/common/crOpenGL/entrypoints.pyc differ
diff -uNr ../1/src//VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp src//VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
--- ../1/src//VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp	2011-06-23 05:16:35.000000000 -0400
+++ src//VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp	2011-06-23 13:43:37.000000000 -0400
@@ -77,20 +77,23 @@
     /* Advanced attributes: */
     m_pAdapterTypeLabel->setEnabled(m_pParent->isMachineOffline());
     m_pAdapterTypeCombo->setEnabled(m_pParent->isMachineOffline());
-    m_pPromiscuousModeLabel->setEnabled(m_pParent->isMachineInValidMode() &&
+    m_pPromiscuousModeLabel->setVisible(m_pParent->isMachineInValidMode() &&
                                         attachmentType() != KNetworkAttachmentType_Null &&
                                         attachmentType() != KNetworkAttachmentType_Generic &&
-                                        attachmentType() != KNetworkAttachmentType_NAT);
-    m_pPromiscuousModeCombo->setEnabled(m_pParent->isMachineInValidMode() &&
+                                        attachmentType() != KNetworkAttachmentType_NAT &&
+                                        m_pAdvancedArrow->isExpanded());
+    m_pPromiscuousModeCombo->setVisible(m_pParent->isMachineInValidMode() &&
                                         attachmentType() != KNetworkAttachmentType_Null &&
                                         attachmentType() != KNetworkAttachmentType_Generic &&
-                                        attachmentType() != KNetworkAttachmentType_NAT);
+                                        attachmentType() != KNetworkAttachmentType_NAT &&
+                                        m_pAdvancedArrow->isExpanded());
     m_pMACLabel->setEnabled(m_pParent->isMachineOffline());
     m_pMACEditor->setEnabled(m_pParent->isMachineOffline());
     m_pMACButton->setEnabled(m_pParent->isMachineOffline());
 
-    m_pPortForwardingButton->setEnabled(m_pParent->isMachineInValidMode() &&
-                                        attachmentType() == KNetworkAttachmentType_NAT);
+    m_pPortForwardingButton->setVisible(m_pParent->isMachineInValidMode() &&
+                                        attachmentType() == KNetworkAttachmentType_NAT &&
+                                        m_pAdvancedArrow->isExpanded());
 
     /* Postprocessing: */
     if ((m_pParent->isMachineSaved() || m_pParent->isMachineOnline()) && !m_pAdvancedArrow->isExpanded())
@@ -337,12 +340,14 @@
                                     attachmentType() != KNetworkAttachmentType_NAT);
     m_pAdapterNameCombo->setEnabled(attachmentType() != KNetworkAttachmentType_Null &&
                                     attachmentType() != KNetworkAttachmentType_NAT);
-    m_pPromiscuousModeLabel->setEnabled(attachmentType() != KNetworkAttachmentType_Null &&
+    m_pPromiscuousModeLabel->setVisible(attachmentType() != KNetworkAttachmentType_Null &&
                                         attachmentType() != KNetworkAttachmentType_Generic &&
-                                        attachmentType() != KNetworkAttachmentType_NAT);
-    m_pPromiscuousModeCombo->setEnabled(attachmentType() != KNetworkAttachmentType_Null &&
+                                        attachmentType() != KNetworkAttachmentType_NAT &&
+                                        m_pAdvancedArrow->isExpanded());
+    m_pPromiscuousModeCombo->setVisible(attachmentType() != KNetworkAttachmentType_Null &&
                                         attachmentType() != KNetworkAttachmentType_Generic &&
-                                        attachmentType() != KNetworkAttachmentType_NAT);
+                                        attachmentType() != KNetworkAttachmentType_NAT &&
+                                        m_pAdvancedArrow->isExpanded());
 
     /* Refresh list: */
     m_pAdapterNameCombo->clear();
@@ -428,7 +433,8 @@
                                              m_pAdvancedArrow->isExpanded());
 
     /* Update Forwarding rules button availability: */
-    m_pPortForwardingButton->setEnabled(attachmentType() == KNetworkAttachmentType_NAT);
+    m_pPortForwardingButton->setVisible(attachmentType() == KNetworkAttachmentType_NAT &&
+                                        m_pAdvancedArrow->isExpanded());
 
     /* Unblocking signals as content is changed already: */
     m_pAdapterNameCombo->blockSignals(false);
@@ -498,8 +504,14 @@
 {
     m_pAdapterTypeLabel->setVisible(m_pAdvancedArrow->isExpanded());
     m_pAdapterTypeCombo->setVisible(m_pAdvancedArrow->isExpanded());
-    m_pPromiscuousModeLabel->setVisible(m_pAdvancedArrow->isExpanded());
-    m_pPromiscuousModeCombo->setVisible(m_pAdvancedArrow->isExpanded());
+    m_pPromiscuousModeLabel->setVisible(m_pAdvancedArrow->isExpanded() &&
+                                        attachmentType() != KNetworkAttachmentType_Null &&
+                                        attachmentType() != KNetworkAttachmentType_Generic &&
+                                        attachmentType() != KNetworkAttachmentType_NAT);
+    m_pPromiscuousModeCombo->setVisible(m_pAdvancedArrow->isExpanded() &&
+                                        attachmentType() != KNetworkAttachmentType_Null &&
+                                        attachmentType() != KNetworkAttachmentType_Generic &&
+                                        attachmentType() != KNetworkAttachmentType_NAT);
     m_pGenericPropertiesLabel->setVisible(attachmentType() == KNetworkAttachmentType_Generic &&
                                           m_pAdvancedArrow->isExpanded());
     m_pGenericPropertiesTextEdit->setVisible(attachmentType() == KNetworkAttachmentType_Generic &&
@@ -508,7 +520,7 @@
     m_pMACEditor->setVisible(m_pAdvancedArrow->isExpanded());
     m_pMACButton->setVisible(m_pAdvancedArrow->isExpanded());
     m_pCableConnectedCheckBox->setVisible(m_pAdvancedArrow->isExpanded());
-    m_pPortForwardingButton->setVisible(m_pAdvancedArrow->isExpanded());
+    m_pPortForwardingButton->setVisible(m_pAdvancedArrow->isExpanded() && attachmentType() == KNetworkAttachmentType_NAT);
 }
 
 void UIMachineSettingsNetwork::sltGenerateMac()
diff -uNr ../1/src//VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp src//VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
--- ../1/src//VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp	2011-06-23 05:16:35.000000000 -0400
+++ src//VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp	2011-06-23 12:43:25.000000000 -0400
@@ -601,10 +601,17 @@
     mLbCPUMax->setEnabled(isMachineOffline());
     mSlCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported);
     mLeCPU->setEnabled(isMachineOffline() && systemData.m_fPFHwVirtExSupported);
+    mLbCPU->setVisible(systemData.m_fPFHwVirtExSupported);
+    mLbCPUMin->setVisible(systemData.m_fPFHwVirtExSupported);
+    mLbCPUMax->setVisible(systemData.m_fPFHwVirtExSupported);
+    mSlCPU->setVisible(systemData.m_fPFHwVirtExSupported);
+    mLeCPU->setVisible(systemData.m_fPFHwVirtExSupported);
     mLbProcessorExtended->setEnabled(isMachineOffline());
     mCbPae->setEnabled(isMachineOffline() && systemData.m_fPFPAESupported);
     /* Acceleration tab: */
     mTwSystem->setTabEnabled(2, systemData.m_fPFHwVirtExSupported);
+    if (!systemData.m_fPFHwVirtExSupported)
+        mTwSystem->removeTab(2);
     mLbVirt->setEnabled(isMachineOffline());
     mCbVirt->setEnabled(isMachineOffline());
     mCbNestedPaging->setEnabled(isMachineOffline() && mCbVirt->isChecked());
Binary files ../1/src//VBox/GuestHost/OpenGL/glapi_parser/apiutil.pyc and src//VBox/GuestHost/OpenGL/glapi_parser/apiutil.pyc differ
Binary files ../1/src//VBox/GuestHost/OpenGL/packer/pack_currenttypes.pyc and src//VBox/GuestHost/OpenGL/packer/pack_currenttypes.pyc differ
Binary files ../1/src//VBox/GuestHost/OpenGL/state_tracker/convert.pyc and src//VBox/GuestHost/OpenGL/state_tracker/convert.pyc differ
Binary files ../1/src//VBox/HostServices/SharedOpenGL/crserverlib/get_components.pyc and src//VBox/HostServices/SharedOpenGL/crserverlib/get_components.pyc differ
Binary files ../1/src//VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.pyc and src//VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.pyc differ


More information about the vbox-dev mailing list