Changeset 66245 in vbox
- Timestamp:
- Mar 24, 2017 1:43:51 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114166
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r64130 r66245 389 389 { 390 390 pSettingsPage = new UIMachineSettingsStorage; 391 connect(pSettingsPage, SIGNAL(s torageChanged()), this, SLOT(sltResetFirstRunFlag()));391 connect(pSettingsPage, SIGNAL(sigStorageChanged()), this, SLOT(sltResetFirstRunFlag())); 392 392 addItem(":/hd_32px.png", ":/hd_24px.png", ":/hd_16px.png", 393 393 iPageIndex, "#storage", pSettingsPage); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r66243 r66245 174 174 } 175 175 176 void UIMachineSettingsDisplay::setGuestOSType(CGuestOSType guestOSType)176 void UIMachineSettingsDisplay::setGuestOSType(CGuestOSType comGuestOSType) 177 177 { 178 178 /* Check if guest os type changed: */ 179 if (m_ guestOSType == guestOSType)179 if (m_comGuestOSType == comGuestOSType) 180 180 return; 181 181 182 182 /* Remember new guest os type: */ 183 m_ guestOSType = guestOSType;183 m_comGuestOSType = comGuestOSType; 184 184 185 185 #ifdef VBOX_WITH_VIDEOHWACCEL 186 186 /* Check if 2D video acceleration supported by the guest OS type: */ 187 QString strguestOSTypeFamily = m_guestOSType.GetFamilyId();188 m_f2DVideoAccelerationSupported = str guestOSTypeFamily == "Windows";187 const QString strGuestOSTypeFamily = m_comGuestOSType.GetFamilyId(); 188 m_f2DVideoAccelerationSupported = strGuestOSTypeFamily == "Windows"; 189 189 #endif /* VBOX_WITH_VIDEOHWACCEL */ 190 190 #ifdef VBOX_WITH_CRHGSMI 191 191 /* Check if WDDM mode supported by the guest OS type: */ 192 QString strguestOSTypeId = m_guestOSType.GetId();193 m_fWddmModeSupported = VBoxGlobal::isWddmCompatibleOsType(str guestOSTypeId);192 const QString strGuestOSTypeId = m_comGuestOSType.GetId(); 193 m_fWddmModeSupported = VBoxGlobal::isWddmCompatibleOsType(strGuestOSTypeId); 194 194 #endif /* VBOX_WITH_CRHGSMI */ 195 195 … … 466 466 467 467 /* Video RAM amount test: */ 468 if (shouldWeWarnAboutLowV ideoMemory() && !m_guestOSType.isNull())468 if (shouldWeWarnAboutLowVRAM() && !m_comGuestOSType.isNull()) 469 469 { 470 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_ guestOSType.GetId(), m_pEditorVideoScreenCount->value());470 quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_comGuestOSType.GetId(), m_pEditorVideoScreenCount->value()); 471 471 472 472 /* Basic video RAM amount test: */ … … 629 629 m_pLabelVideoCaptureQualityMax->setText(tr("high", "quality")); 630 630 631 updateVideoCapture SizeHint();631 updateVideoCaptureFileSizeHint(); 632 632 } 633 633 … … 702 702 } 703 703 704 void UIMachineSettingsDisplay::sltHandle VideoScreenCountSliderChange()704 void UIMachineSettingsDisplay::sltHandleGuestScreenCountSliderChange() 705 705 { 706 706 /* Apply proposed screen-count: */ … … 713 713 714 714 /* Update Video Capture tab screen count: */ 715 update VideoCaptureScreenCount();715 updateGuestScreenCount(); 716 716 717 717 /* Revalidate: */ … … 719 719 } 720 720 721 void UIMachineSettingsDisplay::sltHandle VideoScreenCountEditorChange()721 void UIMachineSettingsDisplay::sltHandleGuestScreenCountEditorChange() 722 722 { 723 723 /* Apply proposed screen-count: */ … … 730 730 731 731 /* Update Video Capture tab screen count: */ 732 update VideoCaptureScreenCount();732 updateGuestScreenCount(); 733 733 734 734 /* Revalidate: */ … … 757 757 * 1. Machine is in 'offline' or 'saved' state and check-box is checked, 758 758 * 2. Machine is in 'online' state, check-box is checked, and video recording is *disabled* currently. */ 759 bool fIsVideoCaptureOptionsEnabled = ((isMachineOffline() || isMachineSaved()) && m_pCheckboxVideoCapture->isChecked()) ||760 (isMachineOnline() && !m_pCache->base().m_fVideoCaptureEnabled && m_pCheckboxVideoCapture->isChecked());759 const bool fIsVideoCaptureOptionsEnabled = ((isMachineOffline() || isMachineSaved()) && m_pCheckboxVideoCapture->isChecked()) || 760 (isMachineOnline() && !m_pCache->base().m_fVideoCaptureEnabled && m_pCheckboxVideoCapture->isChecked()); 761 761 762 762 /* Video Capture Screens option should be enabled only if: 763 763 * Machine is in *any* valid state and check-box is checked. */ 764 bool fIsVideoCaptureScreenOptionEnabled = isMachineInValidMode() && m_pCheckboxVideoCapture->isChecked();764 const bool fIsVideoCaptureScreenOptionEnabled = isMachineInValidMode() && m_pCheckboxVideoCapture->isChecked(); 765 765 766 766 m_pLabelVideoCapturePath->setEnabled(fIsVideoCaptureOptionsEnabled); … … 788 788 { 789 789 /* Get the proposed size: */ 790 int iCurrentIndex = m_pComboVideoCaptureSize->currentIndex();791 QSize videoCaptureSize = m_pComboVideoCaptureSize->itemData(iCurrentIndex).toSize();790 const int iCurrentIndex = m_pComboVideoCaptureSize->currentIndex(); 791 const QSize videoCaptureSize = m_pComboVideoCaptureSize->itemData(iCurrentIndex).toSize(); 792 792 793 793 /* Make sure its valid: */ … … 803 803 { 804 804 /* Look for preset: */ 805 lookForCorresponding SizePreset();805 lookForCorrespondingFrameSizePreset(); 806 806 /* Update quality and bit-rate: */ 807 807 sltHandleVideoCaptureQualitySliderChange(); … … 811 811 { 812 812 /* Look for preset: */ 813 lookForCorresponding SizePreset();813 lookForCorrespondingFrameSizePreset(); 814 814 /* Update quality and bit-rate: */ 815 815 sltHandleVideoCaptureQualitySliderChange(); … … 845 845 m_pSliderVideoCaptureQuality->value())); 846 846 m_pEditorVideoCaptureBitRate->blockSignals(false); 847 updateVideoCapture SizeHint();847 updateVideoCaptureFileSizeHint(); 848 848 } 849 849 … … 857 857 m_pEditorVideoCaptureBitRate->value())); 858 858 m_pSliderVideoCaptureQuality->blockSignals(false); 859 updateVideoCapture SizeHint();859 updateVideoCaptureFileSizeHint(); 860 860 } 861 861 … … 877 877 { 878 878 /* Prepare memory-size slider: */ 879 CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();879 const CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties(); 880 880 m_iMinVRAM = sys.GetMinGuestVRAM(); 881 881 m_iMaxVRAM = sys.GetMaxGuestVRAM(); … … 884 884 m_pSliderVideoMemorySize->setMinimum(m_iMinVRAM); 885 885 m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible); 886 m_pSliderVideoMemorySize->setPageStep(calc PageStep(m_iMaxVRAMVisible));886 m_pSliderVideoMemorySize->setPageStep(calculatePageStep(m_iMaxVRAMVisible)); 887 887 m_pSliderVideoMemorySize->setSingleStep(m_pSliderVideoMemorySize->pageStep() / 4); 888 888 m_pSliderVideoMemorySize->setTickInterval(m_pSliderVideoMemorySize->pageStep()); … … 908 908 m_pSliderVideoScreenCount->setOptimalHint(cMinGuestScreens, cHostScreens); 909 909 m_pSliderVideoScreenCount->setWarningHint(cHostScreens, cMaxGuestScreensForSlider); 910 connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandle VideoScreenCountSliderChange()));910 connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountSliderChange())); 911 911 912 912 /* Prepare screen-count editor: */ … … 914 914 m_pEditorVideoScreenCount->setMinimum(1); 915 915 m_pEditorVideoScreenCount->setMaximum(cMaxGuestScreens); 916 connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandle VideoScreenCountEditorChange()));916 connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountEditorChange())); 917 917 918 918 /* Prepare scale-factor slider: */ … … 1040 1040 { 1041 1041 /* Make sure guest OS type is set: */ 1042 if (m_ guestOSType.isNull())1042 if (m_comGuestOSType.isNull()) 1043 1043 return; 1044 1044 1045 1045 /* Get monitors count and base video memory requirements: */ 1046 int cGuestScreenCount = m_pEditorVideoScreenCount->value();1047 quint64 uNeedMBytes = VBoxGlobal::requiredVideoMemory(m_ guestOSType.GetId(), cGuestScreenCount) / _1M;1046 const int cGuestScreenCount = m_pEditorVideoScreenCount->value(); 1047 quint64 uNeedMBytes = VBoxGlobal::requiredVideoMemory(m_comGuestOSType.GetId(), cGuestScreenCount) / _1M; 1048 1048 1049 1049 /* Initial value: */ … … 1081 1081 m_pEditorVideoMemorySize->setMaximum(m_iMaxVRAMVisible); 1082 1082 m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible); 1083 m_pSliderVideoMemorySize->setPageStep(calc PageStep(m_iMaxVRAMVisible));1083 m_pSliderVideoMemorySize->setPageStep(calculatePageStep(m_iMaxVRAMVisible)); 1084 1084 m_pSliderVideoMemorySize->setWarningHint(1, qMin((int)uNeedMBytes, m_iMaxVRAMVisible)); 1085 1085 m_pSliderVideoMemorySize->setOptimalHint(qMin((int)uNeedMBytes, m_iMaxVRAMVisible), m_iMaxVRAMVisible); … … 1087 1087 } 1088 1088 1089 bool UIMachineSettingsDisplay::shouldWeWarnAboutLowV ideoMemory()1089 bool UIMachineSettingsDisplay::shouldWeWarnAboutLowVRAM() 1090 1090 { 1091 1091 bool fResult = true; … … 1093 1093 QStringList excludingOSList = QStringList() 1094 1094 << "Other" << "DOS" << "Netware" << "L4" << "QNX" << "JRockitVE"; 1095 if (excludingOSList.contains(m_ guestOSType.GetId()))1095 if (excludingOSList.contains(m_comGuestOSType.GetId())) 1096 1096 fResult = false; 1097 1097 … … 1100 1100 1101 1101 /* static */ 1102 int UIMachineSettingsDisplay::calc PageStep(int iMax)1102 int UIMachineSettingsDisplay::calculatePageStep(int iMax) 1103 1103 { 1104 1104 /* Reasonable max. number of page steps is 32. */ 1105 uint page = ((uint)iMax + 31) / 32;1105 uint uPage = ((uint)iMax + 31) / 32; 1106 1106 /* Make it a power of 2: */ 1107 uint p = page, p2 = 0x1;1108 while (( p>>= 1))1107 uint uP = uPage, p2 = 0x1; 1108 while ((uP >>= 1)) 1109 1109 p2 <<= 1; 1110 if ( page != p2)1110 if (uPage != p2) 1111 1111 p2 <<= 1; 1112 1112 if (p2 < 4) … … 1115 1115 } 1116 1116 1117 void UIMachineSettingsDisplay::lookForCorresponding SizePreset()1117 void UIMachineSettingsDisplay::lookForCorrespondingFrameSizePreset() 1118 1118 { 1119 1119 /* Look for video-capture size preset: */ … … 1123 1123 } 1124 1124 1125 void UIMachineSettingsDisplay::update VideoCaptureScreenCount()1125 void UIMachineSettingsDisplay::updateGuestScreenCount() 1126 1126 { 1127 1127 /* Update copy of the cached item to get the desired result: */ … … 1131 1131 } 1132 1132 1133 void UIMachineSettingsDisplay::updateVideoCapture SizeHint()1133 void UIMachineSettingsDisplay::updateVideoCaptureFileSizeHint() 1134 1134 { 1135 1135 m_pLabelVideoCaptureSizeHint->setText(tr("<i>About %1MB per 5 minute video</i>").arg(m_pEditorVideoCaptureBitRate->value() * 300 / 8 / 1024)); … … 1137 1137 1138 1138 /* static */ 1139 void UIMachineSettingsDisplay::lookForCorrespondingPreset(QComboBox *p Where, const QVariant &whichData)1139 void UIMachineSettingsDisplay::lookForCorrespondingPreset(QComboBox *pComboBox, const QVariant &data) 1140 1140 { 1141 1141 /* Use passed iterator to look for corresponding preset of passed combo-box: */ 1142 int iLookupResult = pWhere->findData(whichData);1143 if (iLookupResult != -1 && p Where->currentIndex() != iLookupResult)1144 p Where->setCurrentIndex(iLookupResult);1145 else if (iLookupResult == -1 && p Where->currentIndex() != 0)1146 p Where->setCurrentIndex(0);1142 const int iLookupResult = pComboBox->findData(data); 1143 if (iLookupResult != -1 && pComboBox->currentIndex() != iLookupResult) 1144 pComboBox->setCurrentIndex(iLookupResult); 1145 else if (iLookupResult == -1 && pComboBox->currentIndex() != 0) 1146 pComboBox->setCurrentIndex(0); 1147 1147 } 1148 1148 … … 1151 1151 { 1152 1152 /* Linear quality<=>bit-rate scale-factor: */ 1153 double dResult = (double)iQuality1154 * (double)iFrameWidth * (double)iFrameHeight * (double)iFrameRate1155 / (double)10 /* translate quality to [%] */1156 / (double)1024 /* translate bit-rate to [kbps] */1157 / (double)18.75 /* linear scale factor */;1153 const double dResult = (double)iQuality 1154 * (double)iFrameWidth * (double)iFrameHeight * (double)iFrameRate 1155 / (double)10 /* translate quality to [%] */ 1156 / (double)1024 /* translate bit-rate to [kbps] */ 1157 / (double)18.75 /* linear scale factor */; 1158 1158 return (int)dResult; 1159 1159 } … … 1163 1163 { 1164 1164 /* Linear bit-rate<=>quality scale-factor: */ 1165 double dResult = (double)iBitRate1166 / (double)iFrameWidth / (double)iFrameHeight / (double)iFrameRate1167 * (double)10 /* translate quality to [%] */1168 * (double)1024 /* translate bit-rate to [kbps] */1169 * (double)18.75 /* linear scale factor */;1165 const double dResult = (double)iBitRate 1166 / (double)iFrameWidth / (double)iFrameHeight / (double)iFrameRate 1167 * (double)10 /* translate quality to [%] */ 1168 * (double)1024 /* translate bit-rate to [kbps] */ 1169 * (double)18.75 /* linear scale factor */; 1170 1170 return (int)dResult; 1171 1171 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r66243 r66245 46 46 47 47 /* API: Correlation stuff: */ 48 void setGuestOSType(CGuestOSType guestOSType);48 void setGuestOSType(CGuestOSType comGuestOSType); 49 49 50 50 #ifdef VBOX_WITH_VIDEOHWACCEL … … 88 88 void sltHandleVideoMemorySizeSliderChange(); 89 89 void sltHandleVideoMemorySizeEditorChange(); 90 void sltHandle VideoScreenCountSliderChange();91 void sltHandle VideoScreenCountEditorChange();90 void sltHandleGuestScreenCountSliderChange(); 91 void sltHandleGuestScreenCountEditorChange(); 92 92 void sltHandleGuestScreenScaleSliderChange(); 93 93 void sltHandleGuestScreenScaleEditorChange(); … … 116 116 /* Helpers: Video stuff: */ 117 117 void checkVRAMRequirements(); 118 bool shouldWeWarnAboutLowV ideoMemory();119 static int calc PageStep(int iMax);118 bool shouldWeWarnAboutLowVRAM(); 119 static int calculatePageStep(int iMax); 120 120 121 121 /* Helpers: Video Capture stuff: */ 122 void lookForCorresponding SizePreset();123 void update VideoCaptureScreenCount();124 void updateVideoCapture SizeHint();125 static void lookForCorrespondingPreset(QComboBox *p Where, const QVariant &whichData);122 void lookForCorrespondingFrameSizePreset(); 123 void updateGuestScreenCount(); 124 void updateVideoCaptureFileSizeHint(); 125 static void lookForCorrespondingPreset(QComboBox *pComboBox, const QVariant &data); 126 126 static int calculateBitRate(int iFrameWidth, int iFrameHeight, int iFrameRate, int iQuality); 127 127 static int calculateQuality(int iFrameWidth, int iFrameHeight, int iFrameRate, int iBitRate); 128 128 129 129 /* Guest OS type id: */ 130 CGuestOSType m_guestOSType;130 CGuestOSType m_comGuestOSType; 131 131 /* System minimum lower limit of VRAM (MiB). */ 132 int m_iMinVRAM;132 int m_iMinVRAM; 133 133 /* System maximum limit of VRAM (MiB). */ 134 int m_iMaxVRAM;134 int m_iMaxVRAM; 135 135 /* Upper limit of VRAM in MiB for this dialog. This value is lower than 136 136 * m_maxVRAM to save careless users from setting useless big values. */ 137 int m_iMaxVRAMVisible;137 int m_iMaxVRAMVisible; 138 138 /* Initial VRAM value when the dialog is opened. */ 139 int m_iInitialVRAM;139 int m_iInitialVRAM; 140 140 #ifdef VBOX_WITH_VIDEOHWACCEL 141 141 /* Specifies whether the guest OS supports 2D video-acceleration: */ 142 bool m_f2DVideoAccelerationSupported;142 bool m_f2DVideoAccelerationSupported; 143 143 #endif /* VBOX_WITH_VIDEOHWACCEL */ 144 144 #ifdef VBOX_WITH_CRHGSMI 145 145 /* Specifies whether the guest OS supports WDDM: */ 146 bool m_fWddmModeSupported;146 bool m_fWddmModeSupported; 147 147 #endif /* VBOX_WITH_CRHGSMI */ 148 148 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r66190 r66245 106 106 107 107 /** Holds whether HW virtualization extension is enabled. */ 108 bool m_fHWVirtExEnabled;108 bool m_fHWVirtExEnabled; 109 109 110 110 /** Holds whether the encryption cipher was changed. 111 111 * We are holding that argument here because we do not know 112 112 * the old <i>cipher</i> for sure to compare the new one with. */ 113 bool m_fEncryptionCipherChanged;113 bool m_fEncryptionCipherChanged; 114 114 /** Holds whether the encryption password was changed. 115 115 * We are holding that argument here because we do not know 116 116 * the old <i>password</i> at all to compare the new one with. */ 117 bool m_fEncryptionPasswordChanged;117 bool m_fEncryptionPasswordChanged; 118 118 119 119 /** Holds the hard-coded encryption cipher list. 120 120 * We are hard-coding it because there is no place we can get it from. */ 121 QStringList m_encryptionCiphers;121 QStringList m_encryptionCiphers; 122 122 123 123 /** Holds the page data cache instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
r66243 r66245 134 134 135 135 136 UIMachineSettingsInterface::UIMachineSettingsInterface(const QString strMachineI D)137 : m_strMachineI D(strMachineID)136 UIMachineSettingsInterface::UIMachineSettingsInterface(const QString strMachineId) 137 : m_strMachineId(strMachineId) 138 138 , m_pActionPool(0) 139 139 , m_pCache(new UISettingsCacheMachineInterface) … … 344 344 345 345 /* Assign corresponding machine ID: */ 346 m_pMenuBarEditor->setMachineID(m_strMachineI D);347 m_pStatusBarEditor->setMachineID(m_strMachineI D);346 m_pMenuBarEditor->setMachineID(m_strMachineId); 347 m_pStatusBarEditor->setMachineID(m_strMachineId); 348 348 349 349 /* Translate finally: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
r66243 r66245 38 38 39 39 /** Constructs User Interface settings page. */ 40 UIMachineSettingsInterface(const QString strMachineI D);40 UIMachineSettingsInterface(const QString strMachineId); 41 41 /** Destructs User Interface settings page. */ 42 42 ~UIMachineSettingsInterface(); … … 76 76 77 77 /** Holds the machine ID copy. */ 78 const QString m_strMachineID;78 const QString m_strMachineId; 79 79 /** Holds the action-pool instance. */ 80 UIActionPool *m_pActionPool;80 UIActionPool *m_pActionPool; 81 81 82 82 /** Holds the page data cache instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r66190 r66245 259 259 connect(m_pMACButton, SIGNAL(clicked()), this, SLOT(sltGenerateMac())); 260 260 connect(m_pPortForwardingButton, SIGNAL(clicked()), this, SLOT(sltOpenPortForwardingDlg())); 261 connect(this, SIGNAL(sigTabUpdated()), m_pParent, SLOT(sltHandle UpdatedTab()));261 connect(this, SIGNAL(sigTabUpdated()), m_pParent, SLOT(sltHandleTabUpdate())); 262 262 263 263 /* Prepare validation: */ … … 992 992 /* UIMachineSettingsNetworkPage Stuff: */ 993 993 UIMachineSettingsNetworkPage::UIMachineSettingsNetworkPage() 994 : m_pT wAdapters(0)994 : m_pTabWidgetAdapters(0) 995 995 , m_pCache(new UISettingsCacheMachineNetwork) 996 996 { … … 1000 1000 1001 1001 /* Creating tab-widget: */ 1002 m_pT wAdapters = new QITabWidget(this);1003 pMainLayout->addWidget(m_pT wAdapters);1002 m_pTabWidgetAdapters = new QITabWidget(this); 1003 pMainLayout->addWidget(m_pTabWidgetAdapters); 1004 1004 1005 1005 /* How many adapters to display: */ … … 1016 1016 connect(pTab, SIGNAL(sigNotifyAdvancedButtonStateChange(bool)), 1017 1017 this, SLOT(sltHandleAdvancedButtonStateChange(bool))); 1018 m_pT wAdapters->addTab(pTab, pTab->tabTitle());1018 m_pTabWidgetAdapters->addTab(pTab, pTab->tabTitle()); 1019 1019 } 1020 1020 } … … 1048 1048 1049 1049 /* For each network adapter: */ 1050 for (int iSlot = 0; iSlot < m_pT wAdapters->count(); ++iSlot)1050 for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot) 1051 1051 { 1052 1052 /* Prepare adapter data: */ … … 1071 1071 adapterData.m_promiscuousMode = adapter.GetPromiscModePolicy(); 1072 1072 adapterData.m_strMACAddress = adapter.GetMACAddress(); 1073 adapterData.m_strGenericProperties = summarizeGenericProperties(adapter);1073 adapterData.m_strGenericProperties = loadGenericProperties(adapter); 1074 1074 adapterData.m_fCableConnected = adapter.GetCableConnected(); 1075 1075 … … 1101 1101 /* Setup tab order: */ 1102 1102 Assert(firstWidget()); 1103 setTabOrder(firstWidget(), m_pT wAdapters->focusProxy());1104 QWidget *pLastFocusWidget = m_pT wAdapters->focusProxy();1103 setTabOrder(firstWidget(), m_pTabWidgetAdapters->focusProxy()); 1104 QWidget *pLastFocusWidget = m_pTabWidgetAdapters->focusProxy(); 1105 1105 1106 1106 /* For each network adapter: */ 1107 for (int iSlot = 0; iSlot < m_pT wAdapters->count(); ++iSlot)1107 for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot) 1108 1108 { 1109 1109 /* Get adapter page: */ 1110 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(iSlot));1110 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot)); 1111 1111 1112 1112 /* Load adapter data to page: */ … … 1130 1130 { 1131 1131 /* For each network adapter: */ 1132 for (int iSlot = 0; iSlot < m_pT wAdapters->count(); ++iSlot)1132 for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot) 1133 1133 { 1134 1134 /* Get adapter page: */ 1135 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(iSlot));1135 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot)); 1136 1136 1137 1137 /* Gather & cache adapter data: */ … … 1149 1149 { 1150 1150 /* For each network adapter: */ 1151 for (int iSlot = 0; iSlot < m_pT wAdapters->count(); ++iSlot)1151 for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot) 1152 1152 { 1153 1153 /* Check if adapter data was changed: */ … … 1186 1186 case KNetworkAttachmentType_Generic: 1187 1187 adapter.SetGenericDriver(adapterData.m_strGenericDriverName); 1188 updateGenericProperties(adapter, adapterData.m_strGenericProperties);1188 saveGenericProperties(adapter, adapterData.m_strGenericProperties); 1189 1189 break; 1190 1190 case KNetworkAttachmentType_NATNetwork: … … 1231 1231 1232 1232 /* Delegate validation to adapter tabs: */ 1233 for (int i = 0; i < m_pT wAdapters->count(); ++i)1234 { 1235 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(i));1233 for (int i = 0; i < m_pTabWidgetAdapters->count(); ++i) 1234 { 1235 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(i)); 1236 1236 AssertMsg(pTab, ("Can't get adapter tab!\n")); 1237 1237 if (!pTab->validate(messages)) … … 1245 1245 void UIMachineSettingsNetworkPage::retranslateUi() 1246 1246 { 1247 for (int i = 0; i < m_pT wAdapters->count(); ++i)1248 { 1249 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(i));1247 for (int i = 0; i < m_pTabWidgetAdapters->count(); ++i) 1248 { 1249 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(i)); 1250 1250 Assert(pTab); 1251 m_pT wAdapters->setTabText(i, pTab->tabTitle());1251 m_pTabWidgetAdapters->setTabText(i, pTab->tabTitle()); 1252 1252 } 1253 1253 } … … 1256 1256 { 1257 1257 /* Get the count of network adapter tabs: */ 1258 for (int iSlot = 0; iSlot < m_pT wAdapters->count(); ++iSlot)1259 { 1260 m_pT wAdapters->setTabEnabled(iSlot,1261 isMachineOffline() ||1262 (isMachineInValidMode() && m_pCache->child(iSlot).base().m_fAdapterEnabled));1263 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(iSlot));1258 for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot) 1259 { 1260 m_pTabWidgetAdapters->setTabEnabled(iSlot, 1261 isMachineOffline() || 1262 (isMachineInValidMode() && m_pCache->child(iSlot).base().m_fAdapterEnabled)); 1263 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot)); 1264 1264 pTab->polishTab(); 1265 1265 } 1266 1266 } 1267 1267 1268 void UIMachineSettingsNetworkPage::sltHandle UpdatedTab()1268 void UIMachineSettingsNetworkPage::sltHandleTabUpdate() 1269 1269 { 1270 1270 /* Determine the sender: */ … … 1273 1273 1274 1274 /* Determine sender's attachment type: */ 1275 KNetworkAttachmentType senderAttachmentType = pSender->attachmentType();1276 switch ( senderAttachmentType)1275 const KNetworkAttachmentType enmSenderAttachmentType = pSender->attachmentType(); 1276 switch (enmSenderAttachmentType) 1277 1277 { 1278 1278 case KNetworkAttachmentType_Internal: … … 1291 1291 1292 1292 /* Update all the tabs except the sender: */ 1293 for (int iSlot = 0; iSlot < m_pT wAdapters->count(); ++iSlot)1293 for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot) 1294 1294 { 1295 1295 /* Get the iterated tab: */ 1296 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(iSlot));1297 AssertMsg(pTab, ("All the tabs of m_pT wAdapters should be of the UIMachineSettingsNetwork type!\n"));1296 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot)); 1297 AssertMsg(pTab, ("All the tabs of m_pTabWidgetAdapters should be of the UIMachineSettingsNetwork type!\n")); 1298 1298 1299 1299 /* Update all the tabs (except sender) with the same attachment type as sender have: */ 1300 if (pTab != pSender && pTab->attachmentType() == senderAttachmentType)1300 if (pTab != pSender && pTab->attachmentType() == enmSenderAttachmentType) 1301 1301 pTab->reloadAlternative(); 1302 1302 } … … 1306 1306 { 1307 1307 /* Update the advanced button states for all the pages: */ 1308 for (int iSlot = 0; iSlot < m_pT wAdapters->count(); ++iSlot)1309 { 1310 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(iSlot));1308 for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot) 1309 { 1310 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot)); 1311 1311 pTab->setAdvancedButtonState(fExpanded); 1312 1312 } … … 1334 1334 m_internalNetworkList << otherInternalNetworkList(); 1335 1335 /* Append internal network list with names from all the tabs: */ 1336 for (int iTab = 0; iTab < m_pT wAdapters->count(); ++iTab)1337 { 1338 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(iTab));1336 for (int iTab = 0; iTab < m_pTabWidgetAdapters->count(); ++iTab) 1337 { 1338 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iTab)); 1339 1339 if (pTab) 1340 1340 { 1341 QString strName = pTab->alternativeName(KNetworkAttachmentType_Internal);1341 const QString strName = pTab->alternativeName(KNetworkAttachmentType_Internal); 1342 1342 if (!strName.isEmpty() && !m_internalNetworkList.contains(strName)) 1343 1343 m_internalNetworkList << strName; … … 1367 1367 m_genericDriverList << otherGenericDriverList(); 1368 1368 /* Append generic driver list with names from all the tabs: */ 1369 for (int iTab = 0; iTab < m_pT wAdapters->count(); ++iTab)1370 { 1371 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pT wAdapters->widget(iTab));1369 for (int iTab = 0; iTab < m_pTabWidgetAdapters->count(); ++iTab) 1370 { 1371 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iTab)); 1372 1372 if (pTab) 1373 1373 { 1374 QString strName = pTab->alternativeName(KNetworkAttachmentType_Generic);1374 const QString strName = pTab->alternativeName(KNetworkAttachmentType_Generic); 1375 1375 if (!strName.isEmpty() && !m_genericDriverList.contains(strName)) 1376 1376 m_genericDriverList << strName; … … 1395 1395 { 1396 1396 /* Load total internal network list of all VMs: */ 1397 CVirtualBox vbox = vboxGlobal().virtualBox();1398 QStringList otherInternalNetworks(QList<QString>::fromVector(vbox.GetInternalNetworks()));1397 const CVirtualBox vbox = vboxGlobal().virtualBox(); 1398 const QStringList otherInternalNetworks(QList<QString>::fromVector(vbox.GetInternalNetworks())); 1399 1399 return otherInternalNetworks; 1400 1400 } … … 1404 1404 { 1405 1405 /* Load total generic driver list of all VMs: */ 1406 CVirtualBox vbox = vboxGlobal().virtualBox();1407 QStringList otherGenericDrivers(QList<QString>::fromVector(vbox.GetGenericNetworkDrivers()));1406 const CVirtualBox vbox = vboxGlobal().virtualBox(); 1407 const QStringList otherGenericDrivers(QList<QString>::fromVector(vbox.GetGenericNetworkDrivers())); 1408 1408 return otherGenericDrivers; 1409 1409 } 1410 1410 1411 1411 /* static */ 1412 QString UIMachineSettingsNetworkPage:: summarizeGenericProperties(const CNetworkAdapter &adapter)1412 QString UIMachineSettingsNetworkPage::loadGenericProperties(const CNetworkAdapter &adapter) 1413 1413 { 1414 1414 /* Prepare formatted string: */ … … 1429 1429 1430 1430 /* static */ 1431 void UIMachineSettingsNetworkPage:: updateGenericProperties(CNetworkAdapter &adapter, const QString &strPropText)1431 void UIMachineSettingsNetworkPage::saveGenericProperties(CNetworkAdapter &adapter, const QString &strProperties) 1432 1432 { 1433 1433 /* Parse new properties: */ 1434 QStringList newProps = strPropText.split("\n");1434 const QStringList newProps = strProperties.split("\n"); 1435 1435 QHash<QString, QString> hash; 1436 1436 … … 1438 1438 for (int i = 0; i < newProps.size(); ++i) 1439 1439 { 1440 QString strLine = newProps[i];1441 int iSplitPos = strLine.indexOf("=");1440 const QString strLine = newProps[i]; 1441 const int iSplitPos = strLine.indexOf("="); 1442 1442 if (iSplitPos) 1443 1443 { 1444 QString strKey = strLine.left(iSplitPos);1445 QString strVal = strLine.mid(iSplitPos+1);1444 const QString strKey = strLine.left(iSplitPos); 1445 const QString strVal = strLine.mid(iSplitPos + 1); 1446 1446 adapter.SetProperty(strKey, strVal); 1447 1447 hash[strKey] = strVal; … … 1455 1455 for (int i = 0; i < names.size(); ++i) 1456 1456 { 1457 QString strName = names[i];1458 QString strValue = props[i];1457 const QString strName = names[i]; 1458 const QString strValue = props[i]; 1459 1459 if (strValue != hash[strName]) 1460 1460 adapter.SetProperty(strName, hash[strName]); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r66190 r66245 46 46 47 47 /* Bridged adapter list: */ 48 const QStringList &bridgedAdapterList() const { return m_bridgedAdapterList; }48 const QStringList &bridgedAdapterList() const { return m_bridgedAdapterList; } 49 49 /* Internal network list: */ 50 const QStringList &internalNetworkList() const { return m_internalNetworkList; }50 const QStringList &internalNetworkList() const { return m_internalNetworkList; } 51 51 /* Host-only interface list: */ 52 const QStringList &hostInterfaceList() const { return m_hostInterfaceList; }52 const QStringList &hostInterfaceList() const { return m_hostInterfaceList; } 53 53 /* Generic driver list: */ 54 const QStringList &genericDriverList() const { return m_genericDriverList; }54 const QStringList &genericDriverList() const { return m_genericDriverList; } 55 55 /* NAT network list: */ 56 const QStringList &natNetworkList() const { return m_natNetworkList; }56 const QStringList &natNetworkList() const { return m_natNetworkList; } 57 57 58 58 protected: … … 87 87 88 88 /* Handles tab updates: */ 89 void sltHandle UpdatedTab();89 void sltHandleTabUpdate(); 90 90 91 91 /** Handles advanced button state change to @a fExpanded. */ … … 104 104 static QStringList otherInternalNetworkList(); 105 105 static QStringList otherGenericDriverList(); 106 static QString summarizeGenericProperties(const CNetworkAdapter &adapter);107 static void updateGenericProperties(CNetworkAdapter &adapter, const QString &strPropText);106 static QString loadGenericProperties(const CNetworkAdapter &adapter); 107 static void saveGenericProperties(CNetworkAdapter &adapter, const QString &strProperties); 108 108 109 109 /* Tab holder: */ 110 QITabWidget *m_pT wAdapters;110 QITabWidget *m_pTabWidgetAdapters; 111 111 112 112 /* Alternative-name lists: */ 113 QStringList m_bridgedAdapterList;114 QStringList m_internalNetworkList;115 QStringList m_hostInterfaceList;116 QStringList m_genericDriverList;117 QStringList m_natNetworkList;113 QStringList m_bridgedAdapterList; 114 QStringList m_internalNetworkList; 115 QStringList m_hostInterfaceList; 116 QStringList m_genericDriverList; 117 QStringList m_natNetworkList; 118 118 119 119 /** Holds the page data cache instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r66243 r66245 443 443 /* Get current tab/page: */ 444 444 QWidget *pTab = mTabWidget->widget(iIndex); 445 UIMachineSettingsParallel *pPage = static_cast<UIMachineSettingsParallel*> 445 UIMachineSettingsParallel *pPage = static_cast<UIMachineSettingsParallel*>(pTab); 446 446 if (!pPage->mGbParallel->isChecked()) 447 447 continue; … … 455 455 const QString strIOPort(pPage->mLeIOPort->text()); 456 456 const QString strPath(pPage->mLePath->text()); 457 QPair<QString, QString> pair(strIRQ, strIOPort);457 const QPair<QString, QString> pair(strIRQ, strIOPort); 458 458 459 459 if (strIRQ.isEmpty()) … … 497 497 void UIMachineSettingsParallelPage::retranslateUi() 498 498 { 499 for (int i = 0; i < mTabWidget->count(); ++ 500 { 501 UIMachineSettingsParallel *p age =502 static_cast<UIMachineSettingsParallel*> (mTabWidget->widget(i));503 mTabWidget->setTabText (i, page->pageTitle());499 for (int i = 0; i < mTabWidget->count(); ++i) 500 { 501 UIMachineSettingsParallel *pPage = 502 static_cast<UIMachineSettingsParallel*>(mTabWidget->widget(i)); 503 mTabWidget->setTabText(i, pPage->pageTitle()); 504 504 } 505 505 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r66243 r66245 238 238 239 239 UIMachineSettingsSF::UIMachineSettingsSF() 240 : m NewAction(0), mEdtAction(0), mDelAction(0)240 : m_pActionAdd(0), m_pActionEdit(0), m_pActionRemove(0) 241 241 , m_pCache(new UISettingsCacheSharedFolders) 242 242 { … … 245 245 246 246 /* Prepare actions */ 247 m NewAction= new QAction (this);248 m EdtAction= new QAction (this);249 m DelAction= new QAction (this);250 251 m NewAction->setShortcut (QKeySequence ("Ins"));252 m EdtAction->setShortcut (QKeySequence ("Ctrl+Space"));253 m DelAction->setShortcut (QKeySequence ("Del"));254 255 m NewAction->setIcon(UIIconPool::iconSet(":/sf_add_16px.png",247 m_pActionAdd = new QAction (this); 248 m_pActionEdit = new QAction (this); 249 m_pActionRemove = new QAction (this); 250 251 m_pActionAdd->setShortcut (QKeySequence ("Ins")); 252 m_pActionEdit->setShortcut (QKeySequence ("Ctrl+Space")); 253 m_pActionRemove->setShortcut (QKeySequence ("Del")); 254 255 m_pActionAdd->setIcon(UIIconPool::iconSet(":/sf_add_16px.png", 256 256 ":/sf_add_disabled_16px.png")); 257 m EdtAction->setIcon(UIIconPool::iconSet(":/sf_edit_16px.png",257 m_pActionEdit->setIcon(UIIconPool::iconSet(":/sf_edit_16px.png", 258 258 ":/sf_edit_disabled_16px.png")); 259 m DelAction->setIcon(UIIconPool::iconSet(":/sf_remove_16px.png",259 m_pActionRemove->setIcon(UIIconPool::iconSet(":/sf_remove_16px.png", 260 260 ":/sf_remove_disabled_16px.png")); 261 261 … … 267 267 m_pFoldersToolBar->setIconSize(QSize(iIconMetric, iIconMetric)); 268 268 m_pFoldersToolBar->setOrientation(Qt::Vertical); 269 m_pFoldersToolBar->addAction(m NewAction);270 m_pFoldersToolBar->addAction(m EdtAction);271 m_pFoldersToolBar->addAction(m DelAction);269 m_pFoldersToolBar->addAction(m_pActionAdd); 270 m_pFoldersToolBar->addAction(m_pActionEdit); 271 m_pFoldersToolBar->addAction(m_pActionRemove); 272 272 273 273 /* Setup connections */ … … 277 277 mTwFolders->header()->setMovable (false); 278 278 #endif /* QT_VERSION < 0x050000 */ 279 connect (m NewAction, SIGNAL (triggered (bool)), this, SLOT (addTriggered()));280 connect (m EdtAction, SIGNAL (triggered (bool)), this, SLOT (edtTriggered()));281 connect (m DelAction, SIGNAL (triggered (bool)), this, SLOT (delTriggered()));279 connect (m_pActionAdd, SIGNAL (triggered (bool)), this, SLOT (sltAddSharedFolder())); 280 connect (m_pActionEdit, SIGNAL (triggered (bool)), this, SLOT (sltEditSharedFolder())); 281 connect (m_pActionRemove, SIGNAL (triggered (bool)), this, SLOT (sltDeleteSharedFolder())); 282 282 connect (mTwFolders, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), 283 this, SLOT ( processCurrentChanged(QTreeWidgetItem *)));283 this, SLOT (sltHandleCurrentItemChange (QTreeWidgetItem *))); 284 284 connect (mTwFolders, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)), 285 this, SLOT ( processDoubleClick (QTreeWidgetItem *)));285 this, SLOT (sltHandleDoubleClick (QTreeWidgetItem *))); 286 286 connect (mTwFolders, SIGNAL (customContextMenuRequested (const QPoint &)), 287 this, SLOT (s howContextMenu(const QPoint &)));287 this, SLOT (sltHandleContextMenuRequest (const QPoint &))); 288 288 289 289 retranslateUi(); … … 321 321 } 322 322 323 void UIMachineSettingsSF::loadToCacheFrom(UISharedFolderType sharedFoldersType)323 void UIMachineSettingsSF::loadToCacheFrom(UISharedFolderType enmSharedFoldersType) 324 324 { 325 325 /* Get current shared folders: */ 326 CSharedFolderVector sharedFolders = getSharedFolders( sharedFoldersType);326 CSharedFolderVector sharedFolders = getSharedFolders(enmSharedFoldersType); 327 327 328 328 /* For each shared folder: */ … … 338 338 { 339 339 /* Gather shared folder values: */ 340 sharedFolderData.m_type = sharedFoldersType;340 sharedFolderData.m_type = enmSharedFoldersType; 341 341 sharedFolderData.m_strName = folder.GetName(); 342 342 sharedFolderData.m_strHostPath = folder.GetHostPath(); … … 369 369 fields << sharedFolderData.m_strName 370 370 << sharedFolderData.m_strHostPath 371 << (sharedFolderData.m_fAutoMount ? m TrYes : "")372 << (sharedFolderData.m_fWritable ? m TrFull : mTrReadOnly);371 << (sharedFolderData.m_fAutoMount ? m_strTrYes : "") 372 << (sharedFolderData.m_fWritable ? m_strTrFull : m_strTrReadOnly); 373 373 /* Create new shared folders item: */ 374 374 new SFTreeViewItem(root(sharedFolderData.m_type), fields, SFTreeViewItem::EllipsisFile); … … 376 376 /* Ensure current item fetched: */ 377 377 mTwFolders->setCurrentItem(mTwFolders->topLevelItem(0)); 378 processCurrentChanged(mTwFolders->currentItem());378 sltHandleCurrentItemChange(mTwFolders->currentItem()); 379 379 380 380 /* Polish page finally: */ … … 399 399 sharedFolderData.m_strName = pFolderItem->getText(0); 400 400 sharedFolderData.m_strHostPath = pFolderItem->getText(1); 401 sharedFolderData.m_fAutoMount = pFolderItem->getText(2) == m TrYes ? true : false;402 sharedFolderData.m_fWritable = pFolderItem->getText(3) == m TrFull ? true : false;401 sharedFolderData.m_fAutoMount = pFolderItem->getText(2) == m_strTrYes ? true : false; 402 sharedFolderData.m_fWritable = pFolderItem->getText(3) == m_strTrFull ? true : false; 403 403 m_pCache->child(sharedFolderData.m_strName).cacheCurrentData(sharedFolderData); 404 404 } … … 426 426 } 427 427 428 void UIMachineSettingsSF::saveFromCacheTo(UISharedFolderType sharedFoldersType)428 void UIMachineSettingsSF::saveFromCacheTo(UISharedFolderType enmSharedFoldersType) 429 429 { 430 430 /* For each shared folder data set: */ … … 441 441 const UIDataSettingsSharedFolder &sharedFolderData = sharedFolderCache.base(); 442 442 /* Check if thats shared folder of required type before removing: */ 443 if (sharedFolderData.m_type == sharedFoldersType)443 if (sharedFolderData.m_type == enmSharedFoldersType) 444 444 removeSharedFolder(sharedFolderCache); 445 445 } … … 451 451 const UIDataSettingsSharedFolder &sharedFolderData = sharedFolderCache.data(); 452 452 /* Check if thats shared folder of required type before creating: */ 453 if (sharedFolderData.m_type == sharedFoldersType)453 if (sharedFolderData.m_type == enmSharedFoldersType) 454 454 createSharedFolder(sharedFolderCache); 455 455 } … … 461 461 const UIDataSettingsSharedFolder &sharedFolderData = sharedFolderCache.data(); 462 462 /* Check if thats shared folder of required type before recreating: */ 463 if (sharedFolderData.m_type == sharedFoldersType)463 if (sharedFolderData.m_type == enmSharedFoldersType) 464 464 { 465 465 removeSharedFolder(sharedFolderCache); … … 476 476 Ui::UIMachineSettingsSF::retranslateUi(this); 477 477 478 m NewAction->setText(tr("Add Shared Folder"));479 m EdtAction->setText(tr("Edit Shared Folder"));480 m DelAction->setText(tr("Remove Shared Folder"));481 482 m NewAction->setWhatsThis(tr("Adds new shared folder."));483 m EdtAction->setWhatsThis(tr("Edits selected shared folder."));484 m DelAction->setWhatsThis(tr("Removes selected shared folder."));485 486 m NewAction->setToolTip(mNewAction->whatsThis());487 m EdtAction->setToolTip(mEdtAction->whatsThis());488 m DelAction->setToolTip(mDelAction->whatsThis());489 490 m TrFull = tr("Full");491 m TrReadOnly = tr("Read-only");492 m TrYes = tr("Yes");478 m_pActionAdd->setText(tr("Add Shared Folder")); 479 m_pActionEdit->setText(tr("Edit Shared Folder")); 480 m_pActionRemove->setText(tr("Remove Shared Folder")); 481 482 m_pActionAdd->setWhatsThis(tr("Adds new shared folder.")); 483 m_pActionEdit->setWhatsThis(tr("Edits selected shared folder.")); 484 m_pActionRemove->setWhatsThis(tr("Removes selected shared folder.")); 485 486 m_pActionAdd->setToolTip(m_pActionAdd->whatsThis()); 487 m_pActionEdit->setToolTip(m_pActionEdit->whatsThis()); 488 m_pActionRemove->setToolTip(m_pActionRemove->whatsThis()); 489 490 m_strTrFull = tr("Full"); 491 m_strTrReadOnly = tr("Read-only"); 492 m_strTrYes = tr("Yes"); 493 493 } 494 494 … … 504 504 } 505 505 506 void UIMachineSettingsSF::showEvent (QShowEvent *aEvent) 507 { 508 UISettingsPageMachine::showEvent (aEvent); 509 510 /* Connect header-resize signal just before widget is shown after all the items properly loaded and initialized. */ 511 connect (mTwFolders->header(), SIGNAL (sectionResized (int, int, int)), this, SLOT (adjustFields())); 512 513 /* Adjusting size after all pending show events are processed. */ 514 QTimer::singleShot (0, this, SLOT (adjustList())); 515 } 516 517 void UIMachineSettingsSF::resizeEvent (QResizeEvent *aEvent) 518 { 519 NOREF(aEvent); 520 adjustList(); 521 } 522 523 void UIMachineSettingsSF::addTriggered() 524 { 525 /* Invoke Add-Box Dialog */ 526 UIMachineSettingsSFDetails dlg (UIMachineSettingsSFDetails::AddType, isSharedFolderTypeSupported(ConsoleType), usedList (true), this); 506 void UIMachineSettingsSF::showEvent(QShowEvent *pEvent) 507 { 508 UISettingsPageMachine::showEvent(pEvent); 509 510 /* Connect header-resize signal just before widget is shown after all the items properly loaded and initialized: */ 511 connect(mTwFolders->header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(sltAdjustTreeFields())); 512 513 /* Adjusting size after all pending show events are processed: */ 514 QTimer::singleShot(0, this, SLOT(sltAdjustTree())); 515 } 516 517 void UIMachineSettingsSF::resizeEvent(QResizeEvent * /* pEvent */) 518 { 519 sltAdjustTree(); 520 } 521 522 void UIMachineSettingsSF::sltAddSharedFolder() 523 { 524 /* Invoke Add-Box Dialog: */ 525 UIMachineSettingsSFDetails dlg(UIMachineSettingsSFDetails::AddType, isSharedFolderTypeSupported(ConsoleType), usedList(true), this); 527 526 if (dlg.exec() == QDialog::Accepted) 528 527 { 529 QString name = dlg.name();530 QString path = dlg.path();531 bool isPermanent = dlg.isPermanent();532 /* Shared folder's name & path could not be empty */533 Assert (!name.isEmpty() && !path.isEmpty());534 /* Appending a new listview item to the root */528 const QString strName = dlg.name(); 529 const QString strPath = dlg.path(); 530 const bool fPermanent = dlg.isPermanent(); 531 /* Shared folder's name & path could not be empty: */ 532 Assert(!strName.isEmpty() && !strPath.isEmpty()); 533 /* Appending a new listview item to the root: */ 535 534 QStringList fields; 536 fields << name /* name */ << path /* path */537 << (dlg.isAutoMounted() ? m TrYes : "" /* auto mount? */)538 << (dlg.isWriteable() ? m TrFull : mTrReadOnly /* writable? */);539 SFTreeViewItem * item = new SFTreeViewItem (root(isPermanent ? MachineType : ConsoleType),535 fields << strName /* name */ << strPath /* path */ 536 << (dlg.isAutoMounted() ? m_strTrYes : "" /* auto mount? */) 537 << (dlg.isWriteable() ? m_strTrFull : m_strTrReadOnly /* writable? */); 538 SFTreeViewItem *pItem = new SFTreeViewItem(root(fPermanent ? MachineType : ConsoleType), 540 539 fields, SFTreeViewItem::EllipsisFile); 541 mTwFolders->sortItems 542 mTwFolders->scrollToItem (item);543 mTwFolders->setCurrentItem (item);544 processCurrentChanged (item);540 mTwFolders->sortItems(0, Qt::AscendingOrder); 541 mTwFolders->scrollToItem(pItem); 542 mTwFolders->setCurrentItem(pItem); 543 sltHandleCurrentItemChange(pItem); 545 544 mTwFolders->setFocus(); 546 adjustList();547 } 548 } 549 550 void UIMachineSettingsSF:: edtTriggered()551 { 552 /* Check selected item */553 QTreeWidgetItem * selectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems()[0] : 0;554 SFTreeViewItem * item = selectedItem ? static_cast <SFTreeViewItem*> (selectedItem) : 0;555 Assert (item);556 Assert (item->parentItem());557 558 /* Invoke Edit-Box Dialog */559 UIMachineSettingsSFDetails dlg (UIMachineSettingsSFDetails::EditType, isSharedFolderTypeSupported(ConsoleType), usedList(false), this);560 dlg.setPath (item->getText(1));561 dlg.setName (item->getText(0));562 dlg.setPermanent ((UISharedFolderType)item->parentItem()->text(1).toInt() != ConsoleType);563 dlg.setAutoMount (item->getText (2) == mTrYes);564 dlg.setWriteable (item->getText (3) == mTrFull);545 sltAdjustTree(); 546 } 547 } 548 549 void UIMachineSettingsSF::sltEditSharedFolder() 550 { 551 /* Check selected item: */ 552 QTreeWidgetItem *pSelectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems()[0] : 0; 553 SFTreeViewItem *pItem = pSelectedItem ? static_cast<SFTreeViewItem*>(pSelectedItem) : 0; 554 Assert(pItem); 555 Assert(pItem->parentItem()); 556 557 /* Invoke Edit-Box Dialog: */ 558 UIMachineSettingsSFDetails dlg(UIMachineSettingsSFDetails::EditType, isSharedFolderTypeSupported(ConsoleType), usedList(false), this); 559 dlg.setPath(pItem->getText(1)); 560 dlg.setName(pItem->getText(0)); 561 dlg.setPermanent((UISharedFolderType)pItem->parentItem()->text(1).toInt() != ConsoleType); 562 dlg.setAutoMount(pItem->getText(2) == m_strTrYes); 563 dlg.setWriteable(pItem->getText(3) == m_strTrFull); 565 564 if (dlg.exec() == QDialog::Accepted) 566 565 { 567 QString name = dlg.name();568 QString path = dlg.path();569 bool isPermanent = dlg.isPermanent();570 /* Shared folder's name & path could not be empty */571 Assert (!name.isEmpty() && !path.isEmpty());572 /* Searching new root for the selected listview item */573 SFTreeViewItem *pRoot = root( isPermanent ? MachineType : ConsoleType);574 /* Updating an edited listview item */566 const QString strName = dlg.name(); 567 const QString strPath = dlg.path(); 568 const bool fPermanent = dlg.isPermanent(); 569 /* Shared folder's name & path could not be empty: */ 570 Assert(!strName.isEmpty() && !strPath.isEmpty()); 571 /* Searching new root for the selected listview item: */ 572 SFTreeViewItem *pRoot = root(fPermanent ? MachineType : ConsoleType); 573 /* Updating an edited listview item: */ 575 574 QStringList fields; 576 fields << name /* name */ << path /* path */577 << (dlg.isAutoMounted() ? m TrYes : "" /* auto mount? */)578 << (dlg.isWriteable() ? m TrFull : mTrReadOnly /* writable? */);579 item->updateText(fields);580 mTwFolders->sortItems 581 if ( item->parentItem() != pRoot)582 { 583 /* Move the selected item into new location */584 item->parentItem()->takeChild (item->parentItem()->indexOfChild (item));585 pRoot->insertChild (pRoot->childCount(), item);586 mTwFolders->scrollToItem (item);587 mTwFolders->setCurrentItem (item);588 processCurrentChanged (item);575 fields << strName /* name */ << strPath /* path */ 576 << (dlg.isAutoMounted() ? m_strTrYes : "" /* auto mount? */) 577 << (dlg.isWriteable() ? m_strTrFull : m_strTrReadOnly /* writable? */); 578 pItem->updateText(fields); 579 mTwFolders->sortItems(0, Qt::AscendingOrder); 580 if (pItem->parentItem() != pRoot) 581 { 582 /* Move the selected item into new location: */ 583 pItem->parentItem()->takeChild(pItem->parentItem()->indexOfChild(pItem)); 584 pRoot->insertChild(pRoot->childCount(), pItem); 585 mTwFolders->scrollToItem(pItem); 586 mTwFolders->setCurrentItem(pItem); 587 sltHandleCurrentItemChange(pItem); 589 588 mTwFolders->setFocus(); 590 589 } 591 adjustList();592 } 593 } 594 595 void UIMachineSettingsSF:: delTriggered()596 { 597 QTreeWidgetItem * selectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems()[0] : 0;598 Assert (selectedItem);599 delete selectedItem;600 adjustList();601 } 602 603 void UIMachineSettingsSF:: processCurrentChanged (QTreeWidgetItem *aCurrentItem)604 { 605 if ( aCurrentItem && aCurrentItem->parent() && !aCurrentItem->isSelected())606 aCurrentItem->setSelected(true);607 bool addEnabled = aCurrentItem;608 bool removeEnabled = addEnabled && aCurrentItem->parent();609 m NewAction->setEnabled (addEnabled);610 m EdtAction->setEnabled (removeEnabled);611 m DelAction->setEnabled (removeEnabled);612 } 613 614 void UIMachineSettingsSF:: processDoubleClick (QTreeWidgetItem *aItem)615 { 616 bool editEnabled = aItem && aItem->parent();617 if ( editEnabled)618 edtTriggered();619 } 620 621 void UIMachineSettingsSF::s howContextMenu(const QPoint &pos)590 sltAdjustTree(); 591 } 592 } 593 594 void UIMachineSettingsSF::sltDeleteSharedFolder() 595 { 596 QTreeWidgetItem *pSelectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems()[0] : 0; 597 Assert(pSelectedItem); 598 delete pSelectedItem; 599 sltAdjustTree(); 600 } 601 602 void UIMachineSettingsSF::sltHandleCurrentItemChange(QTreeWidgetItem *pCurrentItem) 603 { 604 if (pCurrentItem && pCurrentItem->parent() && !pCurrentItem->isSelected()) 605 pCurrentItem->setSelected(true); 606 const bool fAddEnabled = pCurrentItem; 607 const bool fRemoveEnabled = fAddEnabled && pCurrentItem->parent(); 608 m_pActionAdd->setEnabled(fAddEnabled); 609 m_pActionEdit->setEnabled(fRemoveEnabled); 610 m_pActionRemove->setEnabled(fRemoveEnabled); 611 } 612 613 void UIMachineSettingsSF::sltHandleDoubleClick(QTreeWidgetItem *pItem) 614 { 615 const bool fEditEnabled = pItem && pItem->parent(); 616 if (fEditEnabled) 617 sltEditSharedFolder(); 618 } 619 620 void UIMachineSettingsSF::sltHandleContextMenuRequest(const QPoint &position) 622 621 { 623 622 QMenu menu; 624 QTreeWidgetItem *pItem = mTwFolders->itemAt(pos );623 QTreeWidgetItem *pItem = mTwFolders->itemAt(position); 625 624 if (mTwFolders->isEnabled() && pItem && pItem->flags() & Qt::ItemIsSelectable) 626 625 { 627 menu.addAction(m EdtAction);628 menu.addAction(m DelAction);626 menu.addAction(m_pActionEdit); 627 menu.addAction(m_pActionRemove); 629 628 } 630 629 else 631 630 { 632 menu.addAction(m NewAction);631 menu.addAction(m_pActionAdd); 633 632 } 634 633 if (!menu.isEmpty()) 635 menu.exec(mTwFolders->viewport()->mapToGlobal(pos ));636 } 637 638 void UIMachineSettingsSF:: adjustList()634 menu.exec(mTwFolders->viewport()->mapToGlobal(position)); 635 } 636 637 void UIMachineSettingsSF::sltAdjustTree() 639 638 { 640 639 /* … … 648 647 * 3 = Writable flag 649 648 */ 650 QAbstractItemView * itemView = mTwFolders;651 QHeaderView * itemHeader = mTwFolders->header();652 int total = mTwFolders->viewport()->width();653 654 int mw0 = qMax (itemView->sizeHintForColumn (0), itemHeader->sectionSizeHint(0));655 int mw2 = qMax (itemView->sizeHintForColumn (2), itemHeader->sectionSizeHint(2));656 int mw3 = qMax (itemView->sizeHintForColumn (3), itemHeader->sectionSizeHint(3));657 658 int w0 = mw0 < total / 4 ? mw0 : total / 4;659 int w2 = mw2 < total / 4 ? mw2 : total / 4;660 int w3 = mw3 < total / 4 ? mw3 : total / 4;649 QAbstractItemView *pItemView = mTwFolders; 650 QHeaderView *pItemHeader = mTwFolders->header(); 651 const int iTotal = mTwFolders->viewport()->width(); 652 653 const int mw0 = qMax(pItemView->sizeHintForColumn(0), pItemHeader->sectionSizeHint(0)); 654 const int mw2 = qMax(pItemView->sizeHintForColumn(2), pItemHeader->sectionSizeHint(2)); 655 const int mw3 = qMax(pItemView->sizeHintForColumn(3), pItemHeader->sectionSizeHint(3)); 656 657 const int w0 = mw0 < iTotal / 4 ? mw0 : iTotal / 4; 658 const int w2 = mw2 < iTotal / 4 ? mw2 : iTotal / 4; 659 const int w3 = mw3 < iTotal / 4 ? mw3 : iTotal / 4; 661 660 662 661 /* Giving 1st column all the available space. */ 663 mTwFolders->setColumnWidth 664 mTwFolders->setColumnWidth (1, total - w0 - w2 - w3);665 mTwFolders->setColumnWidth 666 mTwFolders->setColumnWidth 667 } 668 669 void UIMachineSettingsSF:: adjustFields()670 { 671 QTreeWidgetItem * mainRoot = mTwFolders->invisibleRootItem();672 for (int i = 0; i < mainRoot->childCount(); ++i)673 { 674 QTreeWidgetItem * subRoot = mainRoot->child(i);675 for (int j = 0; j < subRoot->childCount(); ++j)676 { 677 SFTreeViewItem * item = subRoot->child (j) ? static_cast <SFTreeViewItem*> (subRoot->child(j)) : 0;678 if ( item)679 item->adjustText();680 } 681 } 682 } 683 684 SFTreeViewItem * UIMachineSettingsSF::root(UISharedFolderType sharedFolderType)662 mTwFolders->setColumnWidth(0, w0); 663 mTwFolders->setColumnWidth(1, iTotal - w0 - w2 - w3); 664 mTwFolders->setColumnWidth(2, w2); 665 mTwFolders->setColumnWidth(3, w3); 666 } 667 668 void UIMachineSettingsSF::sltAdjustTreeFields() 669 { 670 QTreeWidgetItem *pMainRoot = mTwFolders->invisibleRootItem(); 671 for (int i = 0; i < pMainRoot->childCount(); ++i) 672 { 673 QTreeWidgetItem *pSubRoot = pMainRoot->child(i); 674 for (int j = 0; j < pSubRoot->childCount(); ++j) 675 { 676 SFTreeViewItem *pItem = pSubRoot->child(j) ? static_cast <SFTreeViewItem*>(pSubRoot->child(j)) : 0; 677 if (pItem) 678 pItem->adjustText(); 679 } 680 } 681 } 682 683 SFTreeViewItem *UIMachineSettingsSF::root(UISharedFolderType enmSharedFolderType) 685 684 { 686 685 /* Search for the corresponding root item among all the top-level items: */ … … 692 691 QTreeWidgetItem *pIteratedItem = pMainRootItem->child(iFolderTypeIndex); 693 692 /* If iterated item type is what we are looking for: */ 694 if (pIteratedItem->text(1).toInt() == sharedFolderType)693 if (pIteratedItem->text(1).toInt() == enmSharedFolderType) 695 694 { 696 695 /* Remember the item: */ … … 704 703 } 705 704 706 SFoldersNameList UIMachineSettingsSF::usedList (bool aIncludeSelected)705 SFoldersNameList UIMachineSettingsSF::usedList(bool fIncludeSelected) 707 706 { 708 707 /* Make the used names list: */ 709 708 SFoldersNameList list; 710 QTreeWidgetItemIterator it 709 QTreeWidgetItemIterator it(mTwFolders); 711 710 while (*it) 712 711 { 713 if ((*it)->parent() && ( aIncludeSelected || !(*it)->isSelected()))714 { 715 SFTreeViewItem * item = static_cast <SFTreeViewItem*>(*it);716 UISharedFolderType type = (UISharedFolderType) item->parentItem()->text(1).toInt();717 list << qMakePair (item->getText(0), type);718 } 719 ++ 712 if ((*it)->parent() && (fIncludeSelected || !(*it)->isSelected())) 713 { 714 SFTreeViewItem *pItem = static_cast <SFTreeViewItem*>(*it); 715 UISharedFolderType type = (UISharedFolderType)pItem->parentItem()->text(1).toInt(); 716 list << qMakePair(pItem->getText(0), type); 717 } 718 ++it; 720 719 } 721 720 return list; 722 721 } 723 722 724 bool UIMachineSettingsSF::isSharedFolderTypeSupported(UISharedFolderType sharedFolderType) const723 bool UIMachineSettingsSF::isSharedFolderTypeSupported(UISharedFolderType enmSharedFolderType) const 725 724 { 726 725 bool fIsSharedFolderTypeSupported = false; 727 switch ( sharedFolderType)726 switch (enmSharedFolderType) 728 727 { 729 728 case MachineType: … … 747 746 } 748 747 749 void UIMachineSettingsSF::setRootItemVisible(UISharedFolderType sharedFolderType, bool fVisible)748 void UIMachineSettingsSF::setRootItemVisible(UISharedFolderType enmSharedFolderType, bool fVisible) 750 749 { 751 750 /* Search for the corresponding root item among all the top-level items: */ 752 SFTreeViewItem *pRootItem = root( sharedFolderType);751 SFTreeViewItem *pRootItem = root(enmSharedFolderType); 753 752 /* If root item, we are looking for, still not found: */ 754 753 if (!pRootItem) … … 757 756 QStringList fields; 758 757 /* Depending on folder type: */ 759 switch ( sharedFolderType)758 switch (enmSharedFolderType) 760 759 { 761 760 case MachineType: … … 777 776 } 778 777 779 CSharedFolderVector UIMachineSettingsSF::getSharedFolders(UISharedFolderType sharedFoldersType)778 CSharedFolderVector UIMachineSettingsSF::getSharedFolders(UISharedFolderType enmSharedFoldersType) 780 779 { 781 780 CSharedFolderVector sharedFolders; 782 if (isSharedFolderTypeSupported( sharedFoldersType))783 { 784 switch ( sharedFoldersType)781 if (isSharedFolderTypeSupported(enmSharedFoldersType)) 782 { 783 switch (enmSharedFoldersType) 785 784 { 786 785 case MachineType: … … 807 806 /* Get shared folder data: */ 808 807 const UIDataSettingsSharedFolder &folderData = folderCache.data(); 809 QString strName = folderData.m_strName;810 QString strPath = folderData.m_strHostPath;811 bool fIsWritable = folderData.m_fWritable;812 bool fIsAutoMount = folderData.m_fAutoMount;813 UISharedFolderType sharedFoldersType = folderData.m_type;808 const QString strName = folderData.m_strName; 809 const QString strPath = folderData.m_strHostPath; 810 const bool fIsWritable = folderData.m_fWritable; 811 const bool fIsAutoMount = folderData.m_fAutoMount; 812 const UISharedFolderType enmSharedFoldersType = folderData.m_type; 814 813 815 814 /* Get current shared folders: */ 816 CSharedFolderVector sharedFolders = getSharedFolders(sharedFoldersType);815 const CSharedFolderVector sharedFolders = getSharedFolders(enmSharedFoldersType); 817 816 /* Check if such shared folder do not exists: */ 818 817 CSharedFolder sharedFolder; … … 823 822 { 824 823 /* Create new shared folder: */ 825 switch( sharedFoldersType)824 switch(enmSharedFoldersType) 826 825 { 827 826 case MachineType: 828 827 { 828 /* Create new shared folder: */ 829 829 m_machine.CreateSharedFolder(strName, strPath, fIsWritable, fIsAutoMount); 830 830 if (!m_machine.isOk()) … … 865 865 /* Get shared folder data: */ 866 866 const UIDataSettingsSharedFolder &folderData = folderCache.base(); 867 QString strName = folderData.m_strName;868 QString strPath = folderData.m_strHostPath;869 UISharedFolderType sharedFoldersType = folderData.m_type;867 const QString strName = folderData.m_strName; 868 const QString strPath = folderData.m_strHostPath; 869 const UISharedFolderType enmSharedFoldersType = folderData.m_type; 870 870 871 871 /* Get current shared folders: */ 872 CSharedFolderVector sharedFolders = getSharedFolders(sharedFoldersType);872 const CSharedFolderVector sharedFolders = getSharedFolders(enmSharedFoldersType); 873 873 /* Check that such shared folder really exists: */ 874 874 CSharedFolder sharedFolder; … … 879 879 { 880 880 /* Remove existing shared folder: */ 881 switch( sharedFoldersType)881 switch(enmSharedFoldersType) 882 882 { 883 883 case MachineType: 884 884 { 885 /* Remove existing shared folder: */ 885 886 m_machine.RemoveSharedFolder(strName); 886 887 if (!m_machine.isOk()) … … 897 898 case ConsoleType: 898 899 { 900 /* Remove existing shared folder: */ 899 901 m_console.RemoveSharedFolder(strName); 900 902 if (!m_console.isOk()) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h
r66243 r66245 87 87 private slots: 88 88 89 void addTriggered();90 void edtTriggered();91 void delTriggered();89 void sltAddSharedFolder(); 90 void sltEditSharedFolder(); 91 void sltDeleteSharedFolder(); 92 92 93 void processCurrentChanged (QTreeWidgetItem *aCurrentItem);94 void processDoubleClick (QTreeWidgetItem *aItem);95 void s howContextMenu (const QPoint &aPos);93 void sltHandleCurrentItemChange(QTreeWidgetItem *pCurrentItem); 94 void sltHandleDoubleClick(QTreeWidgetItem *pItem); 95 void sltHandleContextMenuRequest(const QPoint &position); 96 96 97 void adjustList();98 void adjustFields();97 void sltAdjustTree(); 98 void sltAdjustTreeFields(); 99 99 100 100 private: 101 101 102 SFTreeViewItem *root(UISharedFolderType type);103 SFoldersNameList usedList 102 SFTreeViewItem *root(UISharedFolderType type); 103 SFoldersNameList usedList(bool aIncludeSelected); 104 104 105 105 bool isSharedFolderTypeSupported(UISharedFolderType sharedFolderType) const; … … 112 112 bool removeSharedFolder(const UISettingsCacheSharedFolder &folderCache); 113 113 114 QAction *mNewAction; 115 QAction *mEdtAction; 116 QAction *mDelAction; 117 QString mTrFull; 118 QString mTrReadOnly; 119 QString mTrYes; 114 QAction *m_pActionAdd; 115 QAction *m_pActionEdit; 116 QAction *m_pActionRemove; 117 118 QString m_strTrFull; 119 QString m_strTrReadOnly; 120 QString m_strTrYes; 120 121 121 122 /** Holds the page data cache instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r66183 r66245 498 498 /* Get current tab/page: */ 499 499 QWidget *pTab = mTabWidget->widget(iIndex); 500 UIMachineSettingsSerial *p age = static_cast<UIMachineSettingsSerial*>(pTab);501 if (!p age->mGbSerial->isChecked())500 UIMachineSettingsSerial *pPage = static_cast<UIMachineSettingsSerial*>(pTab); 501 if (!pPage->mGbSerial->isChecked()) 502 502 continue; 503 503 … … 507 507 508 508 /* Check the port attribute emptiness & uniqueness: */ 509 const QString strIRQ(p age->mLeIRQ->text());510 const QString strIOPort(p age->mLeIOPort->text());511 QPair<QString, QString> pair(strIRQ, strIOPort);509 const QString strIRQ(pPage->mLeIRQ->text()); 510 const QString strIOPort(pPage->mLeIOPort->text()); 511 const QPair<QString, QString> pair(strIRQ, strIOPort); 512 512 513 513 if (strIRQ.isEmpty()) … … 529 529 ports << pair; 530 530 531 KPortMode mode = gpConverter->fromString<KPortMode>(page->mCbMode->currentText());532 if ( mode != KPortMode_Disconnected)531 const KPortMode enmMode = gpConverter->fromString<KPortMode>(pPage->mCbMode->currentText()); 532 if (enmMode != KPortMode_Disconnected) 533 533 { 534 const QString strPath(p age->mLePath->text());534 const QString strPath(pPage->mLePath->text()); 535 535 536 536 if (strPath.isEmpty()) … … 559 559 void UIMachineSettingsSerialPage::retranslateUi() 560 560 { 561 for (int i = 0; i < mTabWidget->count(); ++ 562 { 563 UIMachineSettingsSerial *p age =564 static_cast<UIMachineSettingsSerial*> (mTabWidget->widget(i));565 mTabWidget->setTabText (i, page->pageTitle());561 for (int i = 0; i < mTabWidget->count(); ++i) 562 { 563 UIMachineSettingsSerial *pPage = 564 static_cast<UIMachineSettingsSerial*>(mTabWidget->widget(i)); 565 mTabWidget->setTabText(i, pPage->pageTitle()); 566 566 } 567 567 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r66243 r66245 2125 2125 */ 2126 2126 UIMachineSettingsStorage::UIMachineSettingsStorage() 2127 : m StorageModel(0)2128 , m AddCtrAction(0), mDelCtrAction(0)2129 , m AddIDECtrAction(0), mAddSATACtrAction(0), mAddSCSICtrAction(0), mAddSASCtrAction(0), mAddFloppyCtrAction(0), mAddUSBCtrAction(0), mAddNVMeCtrAction(0)2130 , m AddAttAction(0), mDelAttAction(0)2131 , m AddHDAttAction(0), mAddCDAttAction(0), mAddFDAttAction(0)2127 : m_pModelStorage(0) 2128 , m_pActionAddController(0), m_pActionRemoveController(0) 2129 , m_pActionAddControllerIDE(0), m_pActionAddControllerSATA(0), m_pActionAddControllerSCSI(0), m_pActionAddControllerSAS(0), m_pActionAddControllerFloppy(0), m_pActionAddControllerUSB(0), m_pActionAddControllerNVMe(0) 2130 , m_pActionAddAttachment(0), m_pActionRemoveAttachment(0) 2131 , m_pActionAddAttachmentHD(0), m_pActionAddAttachmentCD(0), m_pActionAddAttachmentFD(0) 2132 2132 , m_pMediumIdHolder(new UIMediumIDHolder(this)) 2133 , m IsPolished(false)2134 , m IsLoadingInProgress(0)2133 , m_fPolished(false) 2134 , m_fLoadingInProgress(0) 2135 2135 , m_pCache(new UISettingsCacheMachineStorage) 2136 2136 { … … 2147 2147 2148 2148 /* Controller Actions */ 2149 m AddCtrAction= new QAction (this);2150 m AddCtrAction->setIcon(iconPool()->icon(ControllerAddEn, ControllerAddDis));2151 2152 m AddIDECtrAction= new QAction (this);2153 m AddIDECtrAction->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));2154 2155 m AddSATACtrAction= new QAction (this);2156 m AddSATACtrAction->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));2157 2158 m AddSCSICtrAction= new QAction (this);2159 m AddSCSICtrAction->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis));2160 2161 m AddFloppyCtrAction= new QAction (this);2162 m AddFloppyCtrAction->setIcon(iconPool()->icon(FloppyControllerAddEn, FloppyControllerAddDis));2163 2164 m AddSASCtrAction= new QAction (this);2165 m AddSASCtrAction->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));2166 2167 m AddUSBCtrAction= new QAction (this);2168 m AddUSBCtrAction->setIcon(iconPool()->icon(USBControllerAddEn, USBControllerAddDis));2169 2170 m AddNVMeCtrAction= new QAction (this);2171 m AddNVMeCtrAction->setIcon(iconPool()->icon(NVMeControllerAddEn, NVMeControllerAddDis));2172 2173 m DelCtrAction= new QAction (this);2174 m DelCtrAction->setIcon(iconPool()->icon(ControllerDelEn, ControllerDelDis));2149 m_pActionAddController = new QAction (this); 2150 m_pActionAddController->setIcon(iconPool()->icon(ControllerAddEn, ControllerAddDis)); 2151 2152 m_pActionAddControllerIDE = new QAction (this); 2153 m_pActionAddControllerIDE->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis)); 2154 2155 m_pActionAddControllerSATA = new QAction (this); 2156 m_pActionAddControllerSATA->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis)); 2157 2158 m_pActionAddControllerSCSI = new QAction (this); 2159 m_pActionAddControllerSCSI->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis)); 2160 2161 m_pActionAddControllerFloppy = new QAction (this); 2162 m_pActionAddControllerFloppy->setIcon(iconPool()->icon(FloppyControllerAddEn, FloppyControllerAddDis)); 2163 2164 m_pActionAddControllerSAS = new QAction (this); 2165 m_pActionAddControllerSAS->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis)); 2166 2167 m_pActionAddControllerUSB = new QAction (this); 2168 m_pActionAddControllerUSB->setIcon(iconPool()->icon(USBControllerAddEn, USBControllerAddDis)); 2169 2170 m_pActionAddControllerNVMe = new QAction (this); 2171 m_pActionAddControllerNVMe->setIcon(iconPool()->icon(NVMeControllerAddEn, NVMeControllerAddDis)); 2172 2173 m_pActionRemoveController = new QAction (this); 2174 m_pActionRemoveController->setIcon(iconPool()->icon(ControllerDelEn, ControllerDelDis)); 2175 2175 2176 2176 /* Attachment Actions */ 2177 m AddAttAction= new QAction (this);2178 m AddAttAction->setIcon(iconPool()->icon(AttachmentAddEn, AttachmentAddDis));2179 2180 m AddHDAttAction= new QAction (this);2181 m AddHDAttAction->setIcon(iconPool()->icon(HDAttachmentAddEn, HDAttachmentAddDis));2182 2183 m AddCDAttAction= new QAction (this);2184 m AddCDAttAction->setIcon(iconPool()->icon(CDAttachmentAddEn, CDAttachmentAddDis));2185 2186 m AddFDAttAction= new QAction (this);2187 m AddFDAttAction->setIcon(iconPool()->icon(FDAttachmentAddEn, FDAttachmentAddDis));2188 2189 m DelAttAction= new QAction (this);2190 m DelAttAction->setIcon(iconPool()->icon(AttachmentDelEn, AttachmentDelDis));2177 m_pActionAddAttachment = new QAction (this); 2178 m_pActionAddAttachment->setIcon(iconPool()->icon(AttachmentAddEn, AttachmentAddDis)); 2179 2180 m_pActionAddAttachmentHD = new QAction (this); 2181 m_pActionAddAttachmentHD->setIcon(iconPool()->icon(HDAttachmentAddEn, HDAttachmentAddDis)); 2182 2183 m_pActionAddAttachmentCD = new QAction (this); 2184 m_pActionAddAttachmentCD->setIcon(iconPool()->icon(CDAttachmentAddEn, CDAttachmentAddDis)); 2185 2186 m_pActionAddAttachmentFD = new QAction (this); 2187 m_pActionAddAttachmentFD->setIcon(iconPool()->icon(FDAttachmentAddEn, FDAttachmentAddDis)); 2188 2189 m_pActionRemoveAttachment = new QAction (this); 2190 m_pActionRemoveAttachment->setIcon(iconPool()->icon(AttachmentDelEn, AttachmentDelDis)); 2191 2191 2192 2192 /* Create storage-view: */ 2193 m TwStorageTree = new QITreeView(this);2193 m_pTreeStorage = new QITreeView(this); 2194 2194 { 2195 2195 /* Configure storage-view: */ 2196 mLsLeftPane->setBuddy(m TwStorageTree);2196 mLsLeftPane->setBuddy(m_pTreeStorage); 2197 2197 /* Add storage-view into layout: */ 2198 mLtStorage->insertWidget(0, m TwStorageTree);2198 mLtStorage->insertWidget(0, m_pTreeStorage); 2199 2199 } 2200 2200 2201 2201 /* Create storage-model: */ 2202 m StorageModel = new StorageModel (mTwStorageTree);2203 StorageDelegate *storageDelegate = new StorageDelegate (m TwStorageTree);2204 m TwStorageTree->setMouseTracking (true);2205 m TwStorageTree->setContextMenuPolicy (Qt::CustomContextMenu);2206 m TwStorageTree->setModel (mStorageModel);2207 m TwStorageTree->setItemDelegate (storageDelegate);2208 m TwStorageTree->setRootIndex (mStorageModel->root());2209 m TwStorageTree->setCurrentIndex (mStorageModel->root());2202 m_pModelStorage = new StorageModel (m_pTreeStorage); 2203 StorageDelegate *storageDelegate = new StorageDelegate (m_pTreeStorage); 2204 m_pTreeStorage->setMouseTracking (true); 2205 m_pTreeStorage->setContextMenuPolicy (Qt::CustomContextMenu); 2206 m_pTreeStorage->setModel (m_pModelStorage); 2207 m_pTreeStorage->setItemDelegate (storageDelegate); 2208 m_pTreeStorage->setRootIndex (m_pModelStorage->root()); 2209 m_pTreeStorage->setCurrentIndex (m_pModelStorage->root()); 2210 2210 2211 2211 /* Determine icon metric: */ … … 2215 2215 /* Storage ToolBar */ 2216 2216 mTbStorageBar->setIconSize (QSize (iIconMetric, iIconMetric)); 2217 mTbStorageBar->addAction (m AddAttAction);2218 mTbStorageBar->addAction (m DelAttAction);2219 mTbStorageBar->addAction (m AddCtrAction);2220 mTbStorageBar->addAction (m DelCtrAction);2217 mTbStorageBar->addAction (m_pActionAddAttachment); 2218 mTbStorageBar->addAction (m_pActionRemoveAttachment); 2219 mTbStorageBar->addAction (m_pActionAddController); 2220 mTbStorageBar->addAction (m_pActionRemoveController); 2221 2221 2222 2222 #ifdef VBOX_WS_MAC … … 2249 2249 connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)), 2250 2250 this, SLOT(sltHandleMediumDeleted(const QString&))); 2251 connect (m AddCtrAction, SIGNAL (triggered (bool)), this, SLOT (addController()));2252 connect (m AddIDECtrAction, SIGNAL (triggered (bool)), this, SLOT (addIDEController()));2253 connect (m AddSATACtrAction, SIGNAL (triggered (bool)), this, SLOT (addSATAController()));2254 connect (m AddSCSICtrAction, SIGNAL (triggered (bool)), this, SLOT (addSCSIController()));2255 connect (m AddSASCtrAction, SIGNAL (triggered (bool)), this, SLOT (addSASController()));2256 connect (m AddFloppyCtrAction, SIGNAL (triggered (bool)), this, SLOT (addFloppyController()));2257 connect (m AddUSBCtrAction, SIGNAL (triggered (bool)), this, SLOT (addUSBController()));2258 connect (m AddNVMeCtrAction, SIGNAL (triggered (bool)), this, SLOT (addNVMeController()));2259 connect (m DelCtrAction, SIGNAL (triggered (bool)), this, SLOT (delController()));2260 connect (m AddAttAction, SIGNAL (triggered (bool)), this, SLOT (addAttachment()));2261 connect (m AddHDAttAction, SIGNAL (triggered (bool)), this, SLOT (addHDAttachment()));2262 connect (m AddCDAttAction, SIGNAL (triggered (bool)), this, SLOT (addCDAttachment()));2263 connect (m AddFDAttAction, SIGNAL (triggered (bool)), this, SLOT (addFDAttachment()));2264 connect (m DelAttAction, SIGNAL (triggered (bool)), this, SLOT (delAttachment()));2265 connect (m StorageModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),2266 this, SLOT ( onRowInserted(const QModelIndex&, int)));2267 connect (m StorageModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),2268 this, SLOT ( onRowRemoved()));2269 connect (m TwStorageTree, SIGNAL (currentItemChanged (const QModelIndex&, const QModelIndex&)),2270 this, SLOT ( onCurrentItemChanged()));2271 connect (m TwStorageTree, SIGNAL (customContextMenuRequested (const QPoint&)),2272 this, SLOT ( onContextMenuRequested(const QPoint&)));2273 connect (m TwStorageTree, SIGNAL (drawItemBranches (QPainter*, const QRect&, const QModelIndex&)),2274 this, SLOT ( onDrawItemBranches (QPainter *, const QRect &, const QModelIndex &)));2275 connect (m TwStorageTree, SIGNAL (mouseMoved (QMouseEvent*)),2276 this, SLOT ( onMouseMoved(QMouseEvent*)));2277 connect (m TwStorageTree, SIGNAL (mousePressed (QMouseEvent*)),2278 this, SLOT ( onMouseClicked(QMouseEvent*)));2279 connect (m TwStorageTree, SIGNAL (mouseDoubleClicked (QMouseEvent*)),2280 this, SLOT ( onMouseClicked(QMouseEvent*)));2281 connect (mLeName, SIGNAL (textEdited (const QString&)), this, SLOT (s etInformation()));2282 connect (mCbType, SIGNAL (activated (int)), this, SLOT (s etInformation()));2283 connect (mCbSlot, SIGNAL (activated (int)), this, SLOT (s etInformation()));2284 connect (mSbPortCount, SIGNAL (valueChanged (int)), this, SLOT (s etInformation()));2285 connect (mCbIoCache, SIGNAL (stateChanged (int)), this, SLOT (s etInformation()));2286 connect (m_pMediumIdHolder, SIGNAL (sigChanged()), this, SLOT (s etInformation()));2251 connect (m_pActionAddController, SIGNAL (triggered (bool)), this, SLOT (sltAddController())); 2252 connect (m_pActionAddControllerIDE, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerIDE())); 2253 connect (m_pActionAddControllerSATA, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSATA())); 2254 connect (m_pActionAddControllerSCSI, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSCSI())); 2255 connect (m_pActionAddControllerSAS, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSAS())); 2256 connect (m_pActionAddControllerFloppy, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerFloppy())); 2257 connect (m_pActionAddControllerUSB, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerUSB())); 2258 connect (m_pActionAddControllerNVMe, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerNVMe())); 2259 connect (m_pActionRemoveController, SIGNAL (triggered (bool)), this, SLOT (sltRemoveController())); 2260 connect (m_pActionAddAttachment, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachment())); 2261 connect (m_pActionAddAttachmentHD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentHD())); 2262 connect (m_pActionAddAttachmentCD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentCD())); 2263 connect (m_pActionAddAttachmentFD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentFD())); 2264 connect (m_pActionRemoveAttachment, SIGNAL (triggered (bool)), this, SLOT (sltRemoveAttachment())); 2265 connect (m_pModelStorage, SIGNAL (rowsInserted (const QModelIndex&, int, int)), 2266 this, SLOT (sltHandleRowInsertion (const QModelIndex&, int))); 2267 connect (m_pModelStorage, SIGNAL (rowsRemoved (const QModelIndex&, int, int)), 2268 this, SLOT (sltHandleRowRemoval())); 2269 connect (m_pTreeStorage, SIGNAL (currentItemChanged (const QModelIndex&, const QModelIndex&)), 2270 this, SLOT (sltHandleCurrentItemChange())); 2271 connect (m_pTreeStorage, SIGNAL (customContextMenuRequested (const QPoint&)), 2272 this, SLOT (sltHandleContextMenuRequest (const QPoint&))); 2273 connect (m_pTreeStorage, SIGNAL (drawItemBranches (QPainter*, const QRect&, const QModelIndex&)), 2274 this, SLOT (sltHandleDrawItemBranches (QPainter *, const QRect &, const QModelIndex &))); 2275 connect (m_pTreeStorage, SIGNAL (mouseMoved (QMouseEvent*)), 2276 this, SLOT (sltHandleMouseMove (QMouseEvent*))); 2277 connect (m_pTreeStorage, SIGNAL (mousePressed (QMouseEvent*)), 2278 this, SLOT (sltHandleMouseClick (QMouseEvent*))); 2279 connect (m_pTreeStorage, SIGNAL (mouseDoubleClicked (QMouseEvent*)), 2280 this, SLOT (sltHandleMouseClick (QMouseEvent*))); 2281 connect (mLeName, SIGNAL (textEdited (const QString&)), this, SLOT (sltSetInformation())); 2282 connect (mCbType, SIGNAL (activated (int)), this, SLOT (sltSetInformation())); 2283 connect (mCbSlot, SIGNAL (activated (int)), this, SLOT (sltSetInformation())); 2284 connect (mSbPortCount, SIGNAL (valueChanged (int)), this, SLOT (sltSetInformation())); 2285 connect (mCbIoCache, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation())); 2286 connect (m_pMediumIdHolder, SIGNAL (sigChanged()), this, SLOT (sltSetInformation())); 2287 2287 connect (mTbOpen, SIGNAL (clicked (bool)), mTbOpen, SLOT (showMenu())); 2288 2288 connect (pOpenMediumMenu, SIGNAL (aboutToShow()), this, SLOT (sltPrepareOpenMediumMenu())); 2289 connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (s etInformation()));2290 connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (s etInformation()));2291 connect (mCbNonRotational, SIGNAL (stateChanged (int)), this, SLOT (s etInformation()));2292 connect(m_pCheckBoxHotPluggable, SIGNAL(stateChanged(int)), this, SLOT(s etInformation()));2289 connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation())); 2290 connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation())); 2291 connect (mCbNonRotational, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation())); 2292 connect(m_pCheckBoxHotPluggable, SIGNAL(stateChanged(int)), this, SLOT(sltSetInformation())); 2293 2293 2294 2294 /* Applying language settings */ … … 2310 2310 } 2311 2311 2312 void UIMachineSettingsStorage::setChipsetType(KChipsetType type)2312 void UIMachineSettingsStorage::setChipsetType(KChipsetType enmType) 2313 2313 { 2314 2314 /* Make sure chipset type has changed: */ 2315 if (m StorageModel->chipsetType() == type)2315 if (m_pModelStorage->chipsetType() == enmType) 2316 2316 return; 2317 2317 2318 2318 /* Update chipset type value: */ 2319 m StorageModel->setChipsetType(type);2320 updateActionsState();2319 m_pModelStorage->setChipsetType(enmType); 2320 sltUpdateActionsState(); 2321 2321 2322 2322 /* Revalidate: */ … … 2410 2410 { 2411 2411 /* Clear model initially: */ 2412 m StorageModel->clear();2412 m_pModelStorage->clear(); 2413 2413 2414 2414 /* Load storage data to page: */ 2415 m StorageModel->setMachineId(m_strMachineId);2415 m_pModelStorage->setMachineId(m_strMachineId); 2416 2416 2417 2417 /* For each storage controller: */ … … 2424 2424 2425 2425 /* Load storage controller data to page: */ 2426 QModelIndex controllerIndex = m StorageModel->addController(controllerData.m_strControllerName,2426 QModelIndex controllerIndex = m_pModelStorage->addController(controllerData.m_strControllerName, 2427 2427 controllerData.m_controllerBus, 2428 2428 controllerData.m_controllerType); 2429 QUuid controllerId = QUuid(m StorageModel->data(controllerIndex, StorageModel::R_ItemId).toString());2430 m StorageModel->setData(controllerIndex, controllerData.m_uPortCount, StorageModel::R_CtrPortCount);2431 m StorageModel->setData(controllerIndex, controllerData.m_fUseHostIOCache, StorageModel::R_CtrIoCache);2429 QUuid controllerId = QUuid(m_pModelStorage->data(controllerIndex, StorageModel::R_ItemId).toString()); 2430 m_pModelStorage->setData(controllerIndex, controllerData.m_uPortCount, StorageModel::R_CtrPortCount); 2431 m_pModelStorage->setData(controllerIndex, controllerData.m_fUseHostIOCache, StorageModel::R_CtrIoCache); 2432 2432 2433 2433 /* For each storage attachment: */ … … 2440 2440 2441 2441 /* Load storage attachment data to page: */ 2442 QModelIndex attachmentIndex = m StorageModel->addAttachment(controllerId, attachmentData.m_attachmentType, attachmentData.m_strAttachmentMediumId);2442 QModelIndex attachmentIndex = m_pModelStorage->addAttachment(controllerId, attachmentData.m_attachmentType, attachmentData.m_strAttachmentMediumId); 2443 2443 StorageSlot attachmentStorageSlot(controllerData.m_controllerBus, 2444 2444 attachmentData.m_iAttachmentPort, 2445 2445 attachmentData.m_iAttachmentDevice); 2446 m StorageModel->setData(attachmentIndex, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);2447 m StorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough);2448 m StorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject);2449 m StorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentNonRotational, StorageModel::R_AttIsNonRotational);2450 m StorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentHotPluggable, StorageModel::R_AttIsHotPluggable);2446 m_pModelStorage->setData(attachmentIndex, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot); 2447 m_pModelStorage->setData(attachmentIndex, attachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough); 2448 m_pModelStorage->setData(attachmentIndex, attachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject); 2449 m_pModelStorage->setData(attachmentIndex, attachmentData.m_fAttachmentNonRotational, StorageModel::R_AttIsNonRotational); 2450 m_pModelStorage->setData(attachmentIndex, attachmentData.m_fAttachmentHotPluggable, StorageModel::R_AttIsHotPluggable); 2451 2451 } 2452 2452 } 2453 2453 /* Set the first controller as current if present */ 2454 if (m StorageModel->rowCount(mStorageModel->root()) > 0)2455 m TwStorageTree->setCurrentIndex(mStorageModel->index(0, 0, mStorageModel->root()));2454 if (m_pModelStorage->rowCount(m_pModelStorage->root()) > 0) 2455 m_pTreeStorage->setCurrentIndex(m_pModelStorage->index(0, 0, m_pModelStorage->root())); 2456 2456 2457 2457 /* Update actions: */ 2458 updateActionsState();2458 sltUpdateActionsState(); 2459 2459 2460 2460 /* Polish page finally: */ … … 2471 2471 2472 2472 /* For each storage controller: */ 2473 QModelIndex rootIndex = m StorageModel->root();2474 for (int iControllerIndex = 0; iControllerIndex < m StorageModel->rowCount(rootIndex); ++iControllerIndex)2473 QModelIndex rootIndex = m_pModelStorage->root(); 2474 for (int iControllerIndex = 0; iControllerIndex < m_pModelStorage->rowCount(rootIndex); ++iControllerIndex) 2475 2475 { 2476 2476 /* Prepare storage controller data & key: */ … … 2478 2478 2479 2479 /* Gather storage controller data: */ 2480 QModelIndex controllerIndex = m StorageModel->index(iControllerIndex, 0, rootIndex);2481 controllerData.m_strControllerName = m StorageModel->data(controllerIndex, StorageModel::R_CtrName).toString();2482 controllerData.m_controllerBus = m StorageModel->data(controllerIndex, StorageModel::R_CtrBusType).value<KStorageBus>();2483 controllerData.m_controllerType = m StorageModel->data(controllerIndex, StorageModel::R_CtrType).value<KStorageControllerType>();2484 controllerData.m_uPortCount = m StorageModel->data(controllerIndex, StorageModel::R_CtrPortCount).toUInt();2485 controllerData.m_fUseHostIOCache = m StorageModel->data(controllerIndex, StorageModel::R_CtrIoCache).toBool();2480 QModelIndex controllerIndex = m_pModelStorage->index(iControllerIndex, 0, rootIndex); 2481 controllerData.m_strControllerName = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrName).toString(); 2482 controllerData.m_controllerBus = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrBusType).value<KStorageBus>(); 2483 controllerData.m_controllerType = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrType).value<KStorageControllerType>(); 2484 controllerData.m_uPortCount = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrPortCount).toUInt(); 2485 controllerData.m_fUseHostIOCache = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrIoCache).toBool(); 2486 2486 2487 2487 /* For each storage attachment: */ 2488 for (int iAttachmentIndex = 0; iAttachmentIndex < m StorageModel->rowCount(controllerIndex); ++iAttachmentIndex)2488 for (int iAttachmentIndex = 0; iAttachmentIndex < m_pModelStorage->rowCount(controllerIndex); ++iAttachmentIndex) 2489 2489 { 2490 2490 /* Prepare storage attachment data & key: */ … … 2492 2492 2493 2493 /* Gather storage controller data: */ 2494 QModelIndex attachmentIndex = m StorageModel->index(iAttachmentIndex, 0, controllerIndex);2495 attachmentData.m_attachmentType = m StorageModel->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>();2496 StorageSlot attachmentSlot = m StorageModel->data(attachmentIndex, StorageModel::R_AttSlot).value<StorageSlot>();2494 QModelIndex attachmentIndex = m_pModelStorage->index(iAttachmentIndex, 0, controllerIndex); 2495 attachmentData.m_attachmentType = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>(); 2496 StorageSlot attachmentSlot = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttSlot).value<StorageSlot>(); 2497 2497 attachmentData.m_iAttachmentPort = attachmentSlot.port; 2498 2498 attachmentData.m_iAttachmentDevice = attachmentSlot.device; 2499 attachmentData.m_fAttachmentPassthrough = m StorageModel->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool();2500 attachmentData.m_fAttachmentTempEject = m StorageModel->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool();2501 attachmentData.m_fAttachmentNonRotational = m StorageModel->data(attachmentIndex, StorageModel::R_AttIsNonRotational).toBool();2502 attachmentData.m_fAttachmentHotPluggable = m StorageModel->data(attachmentIndex, StorageModel::R_AttIsHotPluggable).toBool();2503 attachmentData.m_strAttachmentMediumId = m StorageModel->data(attachmentIndex, StorageModel::R_AttMediumId).toString();2499 attachmentData.m_fAttachmentPassthrough = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool(); 2500 attachmentData.m_fAttachmentTempEject = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool(); 2501 attachmentData.m_fAttachmentNonRotational = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsNonRotational).toBool(); 2502 attachmentData.m_fAttachmentHotPluggable = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsHotPluggable).toBool(); 2503 attachmentData.m_strAttachmentMediumId = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttMediumId).toString(); 2504 2504 2505 2505 /* Recache storage attachment data: */ … … 2537 2537 /* Check controllers for name emptiness & coincidence. 2538 2538 * Check attachments for the hd presence / uniqueness. */ 2539 QModelIndex rootIndex = mStorageModel->root();2539 const QModelIndex rootIndex = m_pModelStorage->root(); 2540 2540 QMap <QString, QString> config; 2541 2541 QMap<int, QString> names; 2542 2542 /* For each controller: */ 2543 for (int i = 0; i < m StorageModel->rowCount (rootIndex); ++i)2544 { 2545 QModelIndex ctrIndex = rootIndex.child(i, 0);2546 QString ctrName = mStorageModel->data(ctrIndex, StorageModel::R_CtrName).toString();2543 for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i) 2544 { 2545 const QModelIndex ctrIndex = rootIndex.child(i, 0); 2546 const QString ctrName = m_pModelStorage->data(ctrIndex, StorageModel::R_CtrName).toString(); 2547 2547 2548 2548 /* Check for name emptiness: */ … … 2563 2563 2564 2564 /* For each attachment: */ 2565 for (int j = 0; j < m StorageModel->rowCount (ctrIndex); ++j)2566 { 2567 QModelIndex attIndex = ctrIndex.child(j, 0);2568 StorageSlot attSlot = mStorageModel->data(attIndex, StorageModel::R_AttSlot).value <StorageSlot>();2569 KDeviceType attDevice = mStorageModel->data(attIndex, StorageModel::R_AttDevice).value <KDeviceType>();2570 QString key (mStorageModel->data(attIndex, StorageModel::R_AttMediumId).toString());2571 QString value (QString ("%1 (%2)").arg (ctrName, gpConverter->toString(attSlot)));2565 for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j) 2566 { 2567 const QModelIndex attIndex = ctrIndex.child(j, 0); 2568 const StorageSlot attSlot = m_pModelStorage->data(attIndex, StorageModel::R_AttSlot).value <StorageSlot>(); 2569 const KDeviceType enmAttDevice = m_pModelStorage->data(attIndex, StorageModel::R_AttDevice).value <KDeviceType>(); 2570 const QString key(m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString()); 2571 const QString value(QString("%1 (%2)").arg(ctrName, gpConverter->toString(attSlot))); 2572 2572 /* Check for emptiness: */ 2573 if (vboxGlobal().medium(key).isNull() && attDevice == KDeviceType_HardDisk)2573 if (vboxGlobal().medium(key).isNull() && enmAttDevice == KDeviceType_HardDisk) 2574 2574 { 2575 message.second << tr("No hard disk is selected for <i>%1</i>.").arg 2575 message.second << tr("No hard disk is selected for <i>%1</i>.").arg(value); 2576 2576 fPass = false; 2577 2577 } 2578 2578 /* Check for coincidence: */ 2579 if (!vboxGlobal().medium(key).isNull() && config.contains 2579 if (!vboxGlobal().medium(key).isNull() && config.contains(key)) 2580 2580 { 2581 2581 message.second << tr("<i>%1</i> is using a disk that is already attached to <i>%2</i>.") 2582 .arg (value).arg (config[key]);2582 .arg(value).arg(config[key]); 2583 2583 fPass = false; 2584 2584 } 2585 2585 else 2586 config.insert 2586 config.insert(key, value); 2587 2587 } 2588 2588 } … … 2590 2590 /* Check for excessive controllers on Storage page controllers list: */ 2591 2591 QStringList excessiveList; 2592 QMap<KStorageBus, int> currentType = mStorageModel->currentControllerTypes();2593 QMap<KStorageBus, int> maximumType = mStorageModel->maximumControllerTypes();2592 const QMap<KStorageBus, int> currentType = m_pModelStorage->currentControllerTypes(); 2593 const QMap<KStorageBus, int> maximumType = m_pModelStorage->maximumControllerTypes(); 2594 2594 for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_USB; ++iStorageBusType) 2595 2595 { … … 2609 2609 "Please change the chipset type on the System settings page or reduce the number " 2610 2610 "of the following storage controllers on the Storage settings page: %2") 2611 .arg(gpConverter->toString(m StorageModel->chipsetType()))2611 .arg(gpConverter->toString(m_pModelStorage->chipsetType())) 2612 2612 .arg(excessiveList.join(", ")); 2613 2613 fPass = false; … … 2622 2622 } 2623 2623 2624 void UIMachineSettingsStorage::setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel)2624 void UIMachineSettingsStorage::setConfigurationAccessLevel(ConfigurationAccessLevel enmLevel) 2625 2625 { 2626 2626 /* Update model 'configuration access level': */ 2627 m StorageModel->setConfigurationAccessLevel(newConfigurationAccessLevel);2627 m_pModelStorage->setConfigurationAccessLevel(enmLevel); 2628 2628 /* Update 'configuration access level' of base class: */ 2629 UISettingsPageMachine::setConfigurationAccessLevel( newConfigurationAccessLevel);2629 UISettingsPageMachine::setConfigurationAccessLevel(enmLevel); 2630 2630 } 2631 2631 … … 2636 2636 2637 2637 /* Translate storage-view: */ 2638 m TwStorageTree->setWhatsThis(tr("Lists all storage controllers for this machine and "2638 m_pTreeStorage->setWhatsThis(tr("Lists all storage controllers for this machine and " 2639 2639 "the virtual images and host drives attached to them.")); 2640 2640 2641 2641 /* Translate tool-bar: */ 2642 m AddCtrAction->setShortcut(QKeySequence("Ins"));2643 m DelCtrAction->setShortcut(QKeySequence("Del"));2644 m AddAttAction->setShortcut(QKeySequence("+"));2645 m DelAttAction->setShortcut(QKeySequence("-"));2646 2647 m AddCtrAction->setText(tr("Add Controller"));2648 m AddIDECtrAction->setText(tr("Add IDE Controller"));2649 m AddSATACtrAction->setText(tr("Add SATA Controller"));2650 m AddSCSICtrAction->setText(tr("Add SCSI Controller"));2651 m AddSASCtrAction->setText(tr("Add SAS Controller"));2652 m AddFloppyCtrAction->setText(tr("Add Floppy Controller"));2653 m AddUSBCtrAction->setText(tr("Add USB Controller"));2654 m AddNVMeCtrAction->setText(tr("Add NVMe Controller"));2655 m DelCtrAction->setText(tr("Remove Controller"));2656 m AddAttAction->setText(tr("Add Attachment"));2657 m AddHDAttAction->setText(tr("Add Hard Disk"));2658 m AddCDAttAction->setText(tr("Add Optical Drive"));2659 m AddFDAttAction->setText(tr("Add Floppy Drive"));2660 m DelAttAction->setText(tr("Remove Attachment"));2661 2662 m AddCtrAction->setWhatsThis(tr("Adds new storage controller."));2663 m DelCtrAction->setWhatsThis(tr("Removes selected storage controller."));2664 m AddAttAction->setWhatsThis(tr("Adds new storage attachment."));2665 m DelAttAction->setWhatsThis(tr("Removes selected storage attachment."));2666 2667 m AddCtrAction->setToolTip(mAddCtrAction->whatsThis());2668 m DelCtrAction->setToolTip(mDelCtrAction->whatsThis());2669 m AddAttAction->setToolTip(mAddAttAction->whatsThis());2670 m DelAttAction->setToolTip(mDelAttAction->whatsThis());2642 m_pActionAddController->setShortcut(QKeySequence("Ins")); 2643 m_pActionRemoveController->setShortcut(QKeySequence("Del")); 2644 m_pActionAddAttachment->setShortcut(QKeySequence("+")); 2645 m_pActionRemoveAttachment->setShortcut(QKeySequence("-")); 2646 2647 m_pActionAddController->setText(tr("Add Controller")); 2648 m_pActionAddControllerIDE->setText(tr("Add IDE Controller")); 2649 m_pActionAddControllerSATA->setText(tr("Add SATA Controller")); 2650 m_pActionAddControllerSCSI->setText(tr("Add SCSI Controller")); 2651 m_pActionAddControllerSAS->setText(tr("Add SAS Controller")); 2652 m_pActionAddControllerFloppy->setText(tr("Add Floppy Controller")); 2653 m_pActionAddControllerUSB->setText(tr("Add USB Controller")); 2654 m_pActionAddControllerNVMe->setText(tr("Add NVMe Controller")); 2655 m_pActionRemoveController->setText(tr("Remove Controller")); 2656 m_pActionAddAttachment->setText(tr("Add Attachment")); 2657 m_pActionAddAttachmentHD->setText(tr("Add Hard Disk")); 2658 m_pActionAddAttachmentCD->setText(tr("Add Optical Drive")); 2659 m_pActionAddAttachmentFD->setText(tr("Add Floppy Drive")); 2660 m_pActionRemoveAttachment->setText(tr("Remove Attachment")); 2661 2662 m_pActionAddController->setWhatsThis(tr("Adds new storage controller.")); 2663 m_pActionRemoveController->setWhatsThis(tr("Removes selected storage controller.")); 2664 m_pActionAddAttachment->setWhatsThis(tr("Adds new storage attachment.")); 2665 m_pActionRemoveAttachment->setWhatsThis(tr("Removes selected storage attachment.")); 2666 2667 m_pActionAddController->setToolTip(m_pActionAddController->whatsThis()); 2668 m_pActionRemoveController->setToolTip(m_pActionRemoveController->whatsThis()); 2669 m_pActionAddAttachment->setToolTip(m_pActionAddAttachment->whatsThis()); 2670 m_pActionRemoveAttachment->setToolTip(m_pActionRemoveAttachment->whatsThis()); 2671 2671 } 2672 2672 … … 2674 2674 { 2675 2675 /* Declare required variables: */ 2676 QModelIndex index = mTwStorageTree->currentIndex();2677 KDeviceType device = mStorageModel->data(index, StorageModel::R_AttDevice).value<KDeviceType>();2676 const QModelIndex index = m_pTreeStorage->currentIndex(); 2677 const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value<KDeviceType>(); 2678 2678 2679 2679 /* Left pane: */ 2680 2680 mLsLeftPane->setEnabled(isMachineInValidMode()); 2681 m TwStorageTree->setEnabled(isMachineInValidMode());2681 m_pTreeStorage->setEnabled(isMachineInValidMode()); 2682 2682 /* Empty information pane: */ 2683 2683 mLsEmpty->setEnabled(isMachineInValidMode()); … … 2694 2694 /* Attachments pane: */ 2695 2695 mLsAttributes->setEnabled(isMachineInValidMode()); 2696 mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));2696 mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && enmDevice != KDeviceType_HardDisk)); 2697 2697 mCbSlot->setEnabled(isMachineOffline()); 2698 mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));2698 mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && enmDevice != KDeviceType_HardDisk)); 2699 2699 mCbPassthrough->setEnabled(isMachineOffline()); 2700 2700 mCbTempEject->setEnabled(isMachineInValidMode()); … … 2722 2722 2723 2723 /* Update action states: */ 2724 updateActionsState();2724 sltUpdateActionsState(); 2725 2725 } 2726 2726 2727 2727 void UIMachineSettingsStorage::showEvent(QShowEvent *pEvent) 2728 2728 { 2729 if (!m IsPolished)2730 { 2731 m IsPolished = true;2732 2733 /* First column indent */2734 mLtEmpty->setColumnMinimumWidth 2735 mLtController->setColumnMinimumWidth 2736 mLtAttachment->setColumnMinimumWidth 2729 if (!m_fPolished) 2730 { 2731 m_fPolished = true; 2732 2733 /* First column indent: */ 2734 mLtEmpty->setColumnMinimumWidth(0, 10); 2735 mLtController->setColumnMinimumWidth(0, 10); 2736 mLtAttachment->setColumnMinimumWidth(0, 10); 2737 2737 #if 0 2738 2738 /* Second column indent minimum width */ … … 2742 2742 << mLbLocation << mLbUsage; 2743 2743 int maxWidth = 0; 2744 QFontMetrics metrics 2744 QFontMetrics metrics(font()); 2745 2745 foreach (QLabel *label, labelsList) 2746 2746 { 2747 int width = metrics.width 2747 int width = metrics.width(label->text()); 2748 2748 maxWidth = width > maxWidth ? width : maxWidth; 2749 2749 } 2750 mLtAttachment->setColumnMinimumWidth 2750 mLtAttachment->setColumnMinimumWidth(1, maxWidth); 2751 2751 #endif 2752 2752 } … … 2754 2754 } 2755 2755 2756 void UIMachineSettingsStorage::sltHandleMediumEnumerated(const QString &strMediumI D)2756 void UIMachineSettingsStorage::sltHandleMediumEnumerated(const QString &strMediumId) 2757 2757 { 2758 2758 /* Search for corresponding medium: */ 2759 UIMedium medium = vboxGlobal().medium(strMediumID);2760 2761 QModelIndex rootIndex = mStorageModel->root();2762 for (int i = 0; i < m StorageModel->rowCount(rootIndex); ++i)2763 { 2764 QModelIndex ctrIndex = rootIndex.child(i, 0);2765 for (int j = 0; j < m StorageModel->rowCount(ctrIndex); ++j)2766 { 2767 QModelIndex attIndex = ctrIndex.child(j, 0);2768 QString attMediumId = mStorageModel->data(attIndex, StorageModel::R_AttMediumId).toString();2759 const UIMedium medium = vboxGlobal().medium(strMediumId); 2760 2761 const QModelIndex rootIndex = m_pModelStorage->root(); 2762 for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i) 2763 { 2764 const QModelIndex ctrIndex = rootIndex.child(i, 0); 2765 for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j) 2766 { 2767 const QModelIndex attIndex = ctrIndex.child(j, 0); 2768 const QString attMediumId = m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString(); 2769 2769 if (attMediumId == medium.id()) 2770 2770 { 2771 m StorageModel->setData(attIndex, attMediumId, StorageModel::R_AttMediumId);2771 m_pModelStorage->setData(attIndex, attMediumId, StorageModel::R_AttMediumId); 2772 2772 2773 2773 /* Revalidate: */ … … 2778 2778 } 2779 2779 2780 void UIMachineSettingsStorage::sltHandleMediumDeleted(const QString &strMediumI D)2781 { 2782 QModelIndex rootIndex = m StorageModel->root();2783 for (int i = 0; i < m StorageModel->rowCount(rootIndex); ++i)2780 void UIMachineSettingsStorage::sltHandleMediumDeleted(const QString &strMediumId) 2781 { 2782 QModelIndex rootIndex = m_pModelStorage->root(); 2783 for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i) 2784 2784 { 2785 2785 QModelIndex ctrIndex = rootIndex.child(i, 0); 2786 for (int j = 0; j < m StorageModel->rowCount(ctrIndex); ++j)2786 for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j) 2787 2787 { 2788 2788 QModelIndex attIndex = ctrIndex.child(j, 0); 2789 QString attMediumId = m StorageModel->data(attIndex, StorageModel::R_AttMediumId).toString();2790 if (attMediumId == strMediumI D)2789 QString attMediumId = m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString(); 2790 if (attMediumId == strMediumId) 2791 2791 { 2792 m StorageModel->setData(attIndex, UIMedium().id(), StorageModel::R_AttMediumId);2792 m_pModelStorage->setData(attIndex, UIMedium().id(), StorageModel::R_AttMediumId); 2793 2793 2794 2794 /* Revalidate: */ … … 2799 2799 } 2800 2800 2801 void UIMachineSettingsStorage:: addController()2801 void UIMachineSettingsStorage::sltAddController() 2802 2802 { 2803 2803 QMenu menu; 2804 menu.addAction (mAddIDECtrAction);2805 menu.addAction (mAddSATACtrAction);2806 menu.addAction (mAddSCSICtrAction);2807 menu.addAction (mAddSASCtrAction);2808 menu.addAction (mAddFloppyCtrAction);2809 menu.addAction (mAddUSBCtrAction);2810 menu.addAction (mAddNVMeCtrAction);2811 menu.exec 2812 } 2813 2814 void UIMachineSettingsStorage:: addIDEController()2815 { 2816 addControllerWrapper (generateUniqueName("IDE"), KStorageBus_IDE, KStorageControllerType_PIIX4);2817 } 2818 2819 void UIMachineSettingsStorage:: addSATAController()2820 { 2821 addControllerWrapper (generateUniqueName("SATA"), KStorageBus_SATA, KStorageControllerType_IntelAhci);2822 } 2823 2824 void UIMachineSettingsStorage:: addSCSIController()2825 { 2826 addControllerWrapper (generateUniqueName("SCSI"), KStorageBus_SCSI, KStorageControllerType_LsiLogic);2827 } 2828 2829 void UIMachineSettingsStorage:: addFloppyController()2830 { 2831 addControllerWrapper (generateUniqueName("Floppy"), KStorageBus_Floppy, KStorageControllerType_I82078);2832 } 2833 2834 void UIMachineSettingsStorage:: addSASController()2835 { 2836 addControllerWrapper (generateUniqueName("SAS"), KStorageBus_SAS, KStorageControllerType_LsiLogicSas);2837 } 2838 2839 void UIMachineSettingsStorage:: addUSBController()2840 { 2841 addControllerWrapper (generateUniqueName("USB"), KStorageBus_USB, KStorageControllerType_USB);2842 } 2843 2844 void UIMachineSettingsStorage:: addNVMeController()2845 { 2846 addControllerWrapper (generateUniqueName("NVMe"), KStorageBus_PCIe, KStorageControllerType_NVMe);2847 } 2848 2849 void UIMachineSettingsStorage:: delController()2850 { 2851 QModelIndex index = mTwStorageTree->currentIndex();2852 if (!m StorageModel->data(index, StorageModel::R_IsController).toBool())2804 menu.addAction(m_pActionAddControllerIDE); 2805 menu.addAction(m_pActionAddControllerSATA); 2806 menu.addAction(m_pActionAddControllerSCSI); 2807 menu.addAction(m_pActionAddControllerSAS); 2808 menu.addAction(m_pActionAddControllerFloppy); 2809 menu.addAction(m_pActionAddControllerUSB); 2810 menu.addAction(m_pActionAddControllerNVMe); 2811 menu.exec(QCursor::pos()); 2812 } 2813 2814 void UIMachineSettingsStorage::sltAddControllerIDE() 2815 { 2816 addControllerWrapper(generateUniqueControllerName("IDE"), KStorageBus_IDE, KStorageControllerType_PIIX4); 2817 } 2818 2819 void UIMachineSettingsStorage::sltAddControllerSATA() 2820 { 2821 addControllerWrapper(generateUniqueControllerName("SATA"), KStorageBus_SATA, KStorageControllerType_IntelAhci); 2822 } 2823 2824 void UIMachineSettingsStorage::sltAddControllerSCSI() 2825 { 2826 addControllerWrapper(generateUniqueControllerName("SCSI"), KStorageBus_SCSI, KStorageControllerType_LsiLogic); 2827 } 2828 2829 void UIMachineSettingsStorage::sltAddControllerFloppy() 2830 { 2831 addControllerWrapper(generateUniqueControllerName("Floppy"), KStorageBus_Floppy, KStorageControllerType_I82078); 2832 } 2833 2834 void UIMachineSettingsStorage::sltAddControllerSAS() 2835 { 2836 addControllerWrapper(generateUniqueControllerName("SAS"), KStorageBus_SAS, KStorageControllerType_LsiLogicSas); 2837 } 2838 2839 void UIMachineSettingsStorage::sltAddControllerUSB() 2840 { 2841 addControllerWrapper(generateUniqueControllerName("USB"), KStorageBus_USB, KStorageControllerType_USB); 2842 } 2843 2844 void UIMachineSettingsStorage::sltAddControllerNVMe() 2845 { 2846 addControllerWrapper(generateUniqueControllerName("NVMe"), KStorageBus_PCIe, KStorageControllerType_NVMe); 2847 } 2848 2849 void UIMachineSettingsStorage::sltRemoveController() 2850 { 2851 const QModelIndex index = m_pTreeStorage->currentIndex(); 2852 if (!m_pModelStorage->data(index, StorageModel::R_IsController).toBool()) 2853 2853 return; 2854 2854 2855 m StorageModel->delController (QUuid (mStorageModel->data(index, StorageModel::R_ItemId).toString()));2856 emit s torageChanged();2855 m_pModelStorage->delController(QUuid(m_pModelStorage->data(index, StorageModel::R_ItemId).toString())); 2856 emit sigStorageChanged(); 2857 2857 2858 2858 /* Revalidate: */ … … 2860 2860 } 2861 2861 2862 void UIMachineSettingsStorage:: addAttachment()2863 { 2864 QModelIndex index = mTwStorageTree->currentIndex();2865 Assert (mStorageModel->data(index, StorageModel::R_IsController).toBool());2866 2867 DeviceTypeList deviceTypeList (mStorageModel->data(index, StorageModel::R_CtrDevices).value <DeviceTypeList>());2868 bool justTrigger = deviceTypeList.size() == 1;2869 bool showMenu = deviceTypeList.size() > 1;2862 void UIMachineSettingsStorage::sltAddAttachment() 2863 { 2864 const QModelIndex index = m_pTreeStorage->currentIndex(); 2865 Assert(m_pModelStorage->data(index, StorageModel::R_IsController).toBool()); 2866 2867 const DeviceTypeList deviceTypeList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value <DeviceTypeList>()); 2868 const bool fJustTrigger = deviceTypeList.size() == 1; 2869 const bool fShowMenu = deviceTypeList.size() > 1; 2870 2870 QMenu menu; 2871 2871 foreach (const KDeviceType &deviceType, deviceTypeList) … … 2874 2874 { 2875 2875 case KDeviceType_HardDisk: 2876 if ( justTrigger)2877 m AddHDAttAction->trigger();2878 if ( showMenu)2879 menu.addAction (mAddHDAttAction);2876 if (fJustTrigger) 2877 m_pActionAddAttachmentHD->trigger(); 2878 if (fShowMenu) 2879 menu.addAction(m_pActionAddAttachmentHD); 2880 2880 break; 2881 2881 case KDeviceType_DVD: 2882 if ( justTrigger)2883 m AddCDAttAction->trigger();2884 if ( showMenu)2885 menu.addAction (mAddCDAttAction);2882 if (fJustTrigger) 2883 m_pActionAddAttachmentCD->trigger(); 2884 if (fShowMenu) 2885 menu.addAction(m_pActionAddAttachmentCD); 2886 2886 break; 2887 2887 case KDeviceType_Floppy: 2888 if ( justTrigger)2889 m AddFDAttAction->trigger();2890 if ( showMenu)2891 menu.addAction (mAddFDAttAction);2888 if (fJustTrigger) 2889 m_pActionAddAttachmentFD->trigger(); 2890 if (fShowMenu) 2891 menu.addAction(m_pActionAddAttachmentFD); 2892 2892 break; 2893 2893 default: … … 2895 2895 } 2896 2896 } 2897 if ( showMenu)2898 menu.exec 2899 } 2900 2901 void UIMachineSettingsStorage:: addHDAttachment()2902 { 2903 addAttachmentWrapper 2904 } 2905 2906 void UIMachineSettingsStorage:: addCDAttachment()2907 { 2908 addAttachmentWrapper 2909 } 2910 2911 void UIMachineSettingsStorage:: addFDAttachment()2912 { 2913 addAttachmentWrapper 2914 } 2915 2916 void UIMachineSettingsStorage:: delAttachment()2917 { 2918 QModelIndex index = mTwStorageTree->currentIndex();2919 2920 KDeviceType device = mStorageModel->data(index, StorageModel::R_AttDevice).value <KDeviceType>();2897 if (fShowMenu) 2898 menu.exec(QCursor::pos()); 2899 } 2900 2901 void UIMachineSettingsStorage::sltAddAttachmentHD() 2902 { 2903 addAttachmentWrapper(KDeviceType_HardDisk); 2904 } 2905 2906 void UIMachineSettingsStorage::sltAddAttachmentCD() 2907 { 2908 addAttachmentWrapper(KDeviceType_DVD); 2909 } 2910 2911 void UIMachineSettingsStorage::sltAddAttachmentFD() 2912 { 2913 addAttachmentWrapper(KDeviceType_Floppy); 2914 } 2915 2916 void UIMachineSettingsStorage::sltRemoveAttachment() 2917 { 2918 const QModelIndex index = m_pTreeStorage->currentIndex(); 2919 2920 const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value <KDeviceType>(); 2921 2921 /* Check if this would be the last DVD. If so let the user confirm this again. */ 2922 if ( device == KDeviceType_DVD2923 && deviceCount 2922 if ( enmDevice == KDeviceType_DVD 2923 && deviceCount(KDeviceType_DVD) == 1) 2924 2924 { 2925 2925 if (!msgCenter().confirmRemovingOfLastDVDDevice(this)) … … 2927 2927 } 2928 2928 2929 QModelIndex parent = index.parent();2929 const QModelIndex parent = index.parent(); 2930 2930 if (!index.isValid() || !parent.isValid() || 2931 !m StorageModel->data(index, StorageModel::R_IsAttachment).toBool() ||2932 !m StorageModel->data(parent, StorageModel::R_IsController).toBool())2931 !m_pModelStorage->data(index, StorageModel::R_IsAttachment).toBool() || 2932 !m_pModelStorage->data(parent, StorageModel::R_IsController).toBool()) 2933 2933 return; 2934 2934 2935 m StorageModel->delAttachment (QUuid (mStorageModel->data(parent, StorageModel::R_ItemId).toString()),2936 QUuid (mStorageModel->data(index, StorageModel::R_ItemId).toString()));2937 emit s torageChanged();2935 m_pModelStorage->delAttachment(QUuid(m_pModelStorage->data(parent, StorageModel::R_ItemId).toString()), 2936 QUuid(m_pModelStorage->data(index, StorageModel::R_ItemId).toString())); 2937 emit sigStorageChanged(); 2938 2938 2939 2939 /* Revalidate: */ … … 2941 2941 } 2942 2942 2943 void UIMachineSettingsStorage:: getInformation()2944 { 2945 m IsLoadingInProgress = true;2946 2947 QModelIndex index = mTwStorageTree->currentIndex();2948 if (!index.isValid() || index == m StorageModel->root())2949 { 2950 /* Showing Initial Page */2951 mSwRightPane->setCurrentIndex 2943 void UIMachineSettingsStorage::sltGetInformation() 2944 { 2945 m_fLoadingInProgress = true; 2946 2947 const QModelIndex index = m_pTreeStorage->currentIndex(); 2948 if (!index.isValid() || index == m_pModelStorage->root()) 2949 { 2950 /* Showing Initial Page: */ 2951 mSwRightPane->setCurrentIndex(0); 2952 2952 } 2953 2953 else 2954 2954 { 2955 switch (m StorageModel->data(index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())2955 switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value <AbstractItem::ItemType>()) 2956 2956 { 2957 2957 case AbstractItem::Type_ControllerItem: 2958 2958 { 2959 /* Getting Controller Name */2960 mLeName->setText (mStorageModel->data(index, StorageModel::R_CtrName).toString());2959 /* Getting Controller Name: */ 2960 mLeName->setText(m_pModelStorage->data(index, StorageModel::R_CtrName).toString()); 2961 2961 2962 2962 /* Getting Controller Sub type */ 2963 2963 mCbType->clear(); 2964 ControllerTypeList controllerTypeList (mStorageModel->data(index, StorageModel::R_CtrTypes).value <ControllerTypeList>());2965 for (int i = 0; i < controllerTypeList.size(); ++ 2966 mCbType->insertItem (mCbType->count(), gpConverter->toString (controllerTypeList[i]));2967 KStorageControllerType type = mStorageModel->data(index, StorageModel::R_CtrType).value <KStorageControllerType>();2968 int ctrPos = mCbType->findText (gpConverter->toString (type));2969 mCbType->setCurrentIndex (ctrPos == -1 ? 0 : ctrPos);2970 2971 KStorageBus bus = mStorageModel->data(index, StorageModel::R_CtrBusType).value <KStorageBus>();2972 mLbPortCount->setVisible (bus == KStorageBus_SATA || bus == KStorageBus_SAS);2973 mSbPortCount->setVisible (bus == KStorageBus_SATA || bus == KStorageBus_SAS);2974 uint uPortCount = mStorageModel->data(index, StorageModel::R_CtrPortCount).toUInt();2975 uint uMaxPortCount = mStorageModel->data(index, StorageModel::R_CtrMaxPortCount).toUInt();2964 const ControllerTypeList controllerTypeList(m_pModelStorage->data(index, StorageModel::R_CtrTypes).value <ControllerTypeList>()); 2965 for (int i = 0; i < controllerTypeList.size(); ++i) 2966 mCbType->insertItem(mCbType->count(), gpConverter->toString(controllerTypeList[i])); 2967 const KStorageControllerType enmType = m_pModelStorage->data(index, StorageModel::R_CtrType).value <KStorageControllerType>(); 2968 const int iCtrPos = mCbType->findText(gpConverter->toString(enmType)); 2969 mCbType->setCurrentIndex(iCtrPos == -1 ? 0 : iCtrPos); 2970 2971 const KStorageBus enmBus = m_pModelStorage->data(index, StorageModel::R_CtrBusType).value <KStorageBus>(); 2972 mLbPortCount->setVisible(enmBus == KStorageBus_SATA || enmBus == KStorageBus_SAS); 2973 mSbPortCount->setVisible(enmBus == KStorageBus_SATA || enmBus == KStorageBus_SAS); 2974 const uint uPortCount = m_pModelStorage->data(index, StorageModel::R_CtrPortCount).toUInt(); 2975 const uint uMaxPortCount = m_pModelStorage->data(index, StorageModel::R_CtrMaxPortCount).toUInt(); 2976 2976 mSbPortCount->setMaximum(uMaxPortCount); 2977 mSbPortCount->setValue 2978 2979 bool isUseIoCache = mStorageModel->data(index, StorageModel::R_CtrIoCache).toBool();2980 mCbIoCache->setChecked( isUseIoCache);2977 mSbPortCount->setValue(uPortCount); 2978 2979 const bool fUseIoCache = m_pModelStorage->data(index, StorageModel::R_CtrIoCache).toBool(); 2980 mCbIoCache->setChecked(fUseIoCache); 2981 2981 2982 2982 /* Showing Controller Page */ 2983 mSwRightPane->setCurrentIndex 2983 mSwRightPane->setCurrentIndex(1); 2984 2984 break; 2985 2985 } … … 2988 2988 /* Getting Attachment Slot */ 2989 2989 mCbSlot->clear(); 2990 SlotsList slotsList (mStorageModel->data(index, StorageModel::R_AttSlots).value <SlotsList>());2991 for (int i = 0; i < slotsList.size(); ++ 2992 mCbSlot->insertItem (mCbSlot->count(), gpConverter->toString (slotsList[i]));2993 StorageSlot slt = mStorageModel->data(index, StorageModel::R_AttSlot).value <StorageSlot>();2994 int attSlotPos = mCbSlot->findText (gpConverter->toString(slt));2995 mCbSlot->setCurrentIndex (attSlotPos == -1 ? 0 : attSlotPos);2996 mCbSlot->setToolTip (mCbSlot->itemText(mCbSlot->currentIndex()));2990 const SlotsList slotsList(m_pModelStorage->data(index, StorageModel::R_AttSlots).value <SlotsList>()); 2991 for (int i = 0; i < slotsList.size(); ++i) 2992 mCbSlot->insertItem(mCbSlot->count(), gpConverter->toString(slotsList[i])); 2993 const StorageSlot slt = m_pModelStorage->data(index, StorageModel::R_AttSlot).value <StorageSlot>(); 2994 const int iAttSlotPos = mCbSlot->findText(gpConverter->toString(slt)); 2995 mCbSlot->setCurrentIndex(iAttSlotPos == -1 ? 0 : iAttSlotPos); 2996 mCbSlot->setToolTip(mCbSlot->itemText(mCbSlot->currentIndex())); 2997 2997 2998 2998 /* Getting Attachment Medium */ 2999 KDeviceType device = mStorageModel->data(index, StorageModel::R_AttDevice).value <KDeviceType>();3000 switch ( device)2999 const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value <KDeviceType>(); 3000 switch (enmDevice) 3001 3001 { 3002 3002 case KDeviceType_HardDisk: … … 3025 3025 3026 3026 /* Get hot-pluggable state: */ 3027 bool fIsHotPluggable = mStorageModel->data(index, StorageModel::R_AttIsHotPluggable).toBool();3027 const bool fIsHotPluggable = m_pModelStorage->data(index, StorageModel::R_AttIsHotPluggable).toBool(); 3028 3028 3029 3029 /* Fetch device-type, medium-id: */ 3030 m_pMediumIdHolder->setType(mediumTypeToLocal( device));3031 m_pMediumIdHolder->setId(m StorageModel->data(index, StorageModel::R_AttMediumId).toString());3030 m_pMediumIdHolder->setType(mediumTypeToLocal(enmDevice)); 3031 m_pMediumIdHolder->setId(m_pModelStorage->data(index, StorageModel::R_AttMediumId).toString()); 3032 3032 3033 3033 /* Get/fetch editable state: */ 3034 bool fIsEditable = (isMachineOffline())3035 || (isMachineOnline() && device != KDeviceType_HardDisk)3036 || (isMachineOnline() && device == KDeviceType_HardDisk && fIsHotPluggable);3034 const bool fIsEditable = (isMachineOffline()) 3035 || (isMachineOnline() && enmDevice != KDeviceType_HardDisk) 3036 || (isMachineOnline() && enmDevice == KDeviceType_HardDisk && fIsHotPluggable); 3037 3037 mLbMedium->setEnabled(fIsEditable); 3038 3038 mTbOpen->setEnabled(fIsEditable); 3039 3039 3040 3040 /* Getting Passthrough state */ 3041 bool isHostDrive = mStorageModel->data(index, StorageModel::R_AttIsHostDrive).toBool();3042 mCbPassthrough->setVisible (device == KDeviceType_DVD && isHostDrive);3043 mCbPassthrough->setChecked (isHostDrive && mStorageModel->data(index, StorageModel::R_AttIsPassthrough).toBool());3041 const bool isHostDrive = m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool(); 3042 mCbPassthrough->setVisible(enmDevice == KDeviceType_DVD && isHostDrive); 3043 mCbPassthrough->setChecked(isHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsPassthrough).toBool()); 3044 3044 3045 3045 /* Getting TempEject state */ 3046 mCbTempEject->setVisible (device == KDeviceType_DVD && !isHostDrive);3047 mCbTempEject->setChecked (!isHostDrive && mStorageModel->data(index, StorageModel::R_AttIsTempEject).toBool());3046 mCbTempEject->setVisible(enmDevice == KDeviceType_DVD && !isHostDrive); 3047 mCbTempEject->setChecked(!isHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsTempEject).toBool()); 3048 3048 3049 3049 /* Getting NonRotational state */ 3050 mCbNonRotational->setVisible (device == KDeviceType_HardDisk);3051 mCbNonRotational->setChecked (mStorageModel->data(index, StorageModel::R_AttIsNonRotational).toBool());3050 mCbNonRotational->setVisible(enmDevice == KDeviceType_HardDisk); 3051 mCbNonRotational->setChecked(m_pModelStorage->data(index, StorageModel::R_AttIsNonRotational).toBool()); 3052 3052 3053 3053 /* Fetch hot-pluggable state: */ … … 3056 3056 3057 3057 /* Update optional widgets visibility */ 3058 updateAdditional Objects (device);3058 updateAdditionalDetails(enmDevice); 3059 3059 3060 3060 /* Getting Other Information */ 3061 mLbHDFormatValue->setText (compressText (mStorageModel->data(index, StorageModel::R_AttFormat).toString()));3062 mLbCDFDTypeValue->setText (compressText (mStorageModel->data(index, StorageModel::R_AttFormat).toString()));3063 mLbHDVirtualSizeValue->setText (compressText (mStorageModel->data(index, StorageModel::R_AttLogicalSize).toString()));3064 mLbHDActualSizeValue->setText (compressText (mStorageModel->data(index, StorageModel::R_AttSize).toString()));3065 mLbSizeValue->setText (compressText (mStorageModel->data(index, StorageModel::R_AttSize).toString()));3066 mLbHDDetailsValue->setText (compressText (mStorageModel->data(index, StorageModel::R_AttDetails).toString()));3067 mLbLocationValue->setText (compressText (mStorageModel->data(index, StorageModel::R_AttLocation).toString()));3068 mLbUsageValue->setText (compressText (mStorageModel->data(index, StorageModel::R_AttUsage).toString()));3069 m_pLabelEncryptionValue->setText(compressText(m StorageModel->data(index, StorageModel::R_AttEncryptionPasswordID).toString()));3061 mLbHDFormatValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString())); 3062 mLbCDFDTypeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString())); 3063 mLbHDVirtualSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLogicalSize).toString())); 3064 mLbHDActualSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString())); 3065 mLbSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString())); 3066 mLbHDDetailsValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttDetails).toString())); 3067 mLbLocationValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLocation).toString())); 3068 mLbUsageValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttUsage).toString())); 3069 m_pLabelEncryptionValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttEncryptionPasswordID).toString())); 3070 3070 3071 3071 /* Showing Attachment Page */ 3072 mSwRightPane->setCurrentIndex 3072 mSwRightPane->setCurrentIndex(2); 3073 3073 break; 3074 3074 } … … 3081 3081 revalidate(); 3082 3082 3083 m IsLoadingInProgress = false;3084 } 3085 3086 void UIMachineSettingsStorage::s etInformation()3087 { 3088 QModelIndex index = mTwStorageTree->currentIndex();3089 if (m IsLoadingInProgress || !index.isValid() || index == mStorageModel->root())3083 m_fLoadingInProgress = false; 3084 } 3085 3086 void UIMachineSettingsStorage::sltSetInformation() 3087 { 3088 const QModelIndex index = m_pTreeStorage->currentIndex(); 3089 if (m_fLoadingInProgress || !index.isValid() || index == m_pModelStorage->root()) 3090 3090 return; 3091 3091 3092 QObject * sdr = sender();3093 switch (m StorageModel->data(index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())3092 QObject *pSdr = sender(); 3093 switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value <AbstractItem::ItemType>()) 3094 3094 { 3095 3095 case AbstractItem::Type_ControllerItem: 3096 3096 { 3097 /* Setting Controller Name */3098 if ( sdr == mLeName)3099 m StorageModel->setData(index, mLeName->text(), StorageModel::R_CtrName);3100 /* Setting Controller Sub-Type */3101 else if ( sdr == mCbType)3102 m StorageModel->setData (index, QVariant::fromValue (gpConverter->fromString<KStorageControllerType>(mCbType->currentText())),3097 /* Setting Controller Name: */ 3098 if (pSdr == mLeName) 3099 m_pModelStorage->setData(index, mLeName->text(), StorageModel::R_CtrName); 3100 /* Setting Controller Sub-Type: */ 3101 else if (pSdr == mCbType) 3102 m_pModelStorage->setData(index, QVariant::fromValue(gpConverter->fromString<KStorageControllerType>(mCbType->currentText())), 3103 3103 StorageModel::R_CtrType); 3104 else if ( sdr == mSbPortCount)3105 m StorageModel->setData(index, mSbPortCount->value(), StorageModel::R_CtrPortCount);3106 else if ( sdr == mCbIoCache)3107 m StorageModel->setData(index, mCbIoCache->isChecked(), StorageModel::R_CtrIoCache);3104 else if (pSdr == mSbPortCount) 3105 m_pModelStorage->setData(index, mSbPortCount->value(), StorageModel::R_CtrPortCount); 3106 else if (pSdr == mCbIoCache) 3107 m_pModelStorage->setData(index, mCbIoCache->isChecked(), StorageModel::R_CtrIoCache); 3108 3108 break; 3109 3109 } 3110 3110 case AbstractItem::Type_AttachmentItem: 3111 3111 { 3112 /* Setting Attachment Slot */3113 if ( sdr == mCbSlot)3112 /* Setting Attachment Slot: */ 3113 if (pSdr == mCbSlot) 3114 3114 { 3115 QModelIndex controllerIndex = m StorageModel->parent(index);3115 QModelIndex controllerIndex = m_pModelStorage->parent(index); 3116 3116 StorageSlot attachmentStorageSlot = gpConverter->fromString<StorageSlot>(mCbSlot->currentText()); 3117 m StorageModel->setData(index, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);3118 QModelIndex theSameIndexAtNewPosition = m StorageModel->attachmentBySlot(controllerIndex, attachmentStorageSlot);3117 m_pModelStorage->setData(index, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot); 3118 QModelIndex theSameIndexAtNewPosition = m_pModelStorage->attachmentBySlot(controllerIndex, attachmentStorageSlot); 3119 3119 AssertMsg(theSameIndexAtNewPosition.isValid(), ("Current attachment disappears!\n")); 3120 m TwStorageTree->setCurrentIndex(theSameIndexAtNewPosition);3120 m_pTreeStorage->setCurrentIndex(theSameIndexAtNewPosition); 3121 3121 } 3122 3122 /* Setting Attachment Medium */ 3123 else if ( sdr == m_pMediumIdHolder)3124 m StorageModel->setData(index, m_pMediumIdHolder->id(), StorageModel::R_AttMediumId);3125 else if ( sdr == mCbPassthrough)3123 else if (pSdr == m_pMediumIdHolder) 3124 m_pModelStorage->setData(index, m_pMediumIdHolder->id(), StorageModel::R_AttMediumId); 3125 else if (pSdr == mCbPassthrough) 3126 3126 { 3127 if (m StorageModel->data(index, StorageModel::R_AttIsHostDrive).toBool())3128 m StorageModel->setData(index, mCbPassthrough->isChecked(), StorageModel::R_AttIsPassthrough);3127 if (m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool()) 3128 m_pModelStorage->setData(index, mCbPassthrough->isChecked(), StorageModel::R_AttIsPassthrough); 3129 3129 } 3130 else if ( sdr == mCbTempEject)3130 else if (pSdr == mCbTempEject) 3131 3131 { 3132 if (!m StorageModel->data(index, StorageModel::R_AttIsHostDrive).toBool())3133 m StorageModel->setData(index, mCbTempEject->isChecked(), StorageModel::R_AttIsTempEject);3132 if (!m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool()) 3133 m_pModelStorage->setData(index, mCbTempEject->isChecked(), StorageModel::R_AttIsTempEject); 3134 3134 } 3135 else if ( sdr == mCbNonRotational)3135 else if (pSdr == mCbNonRotational) 3136 3136 { 3137 m StorageModel->setData(index, mCbNonRotational->isChecked(), StorageModel::R_AttIsNonRotational);3137 m_pModelStorage->setData(index, mCbNonRotational->isChecked(), StorageModel::R_AttIsNonRotational); 3138 3138 } 3139 else if ( sdr == m_pCheckBoxHotPluggable)3139 else if (pSdr == m_pCheckBoxHotPluggable) 3140 3140 { 3141 m StorageModel->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable);3141 m_pModelStorage->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable); 3142 3142 } 3143 3143 break; … … 3147 3147 } 3148 3148 3149 emit s torageChanged();3150 getInformation();3149 emit sigStorageChanged(); 3150 sltGetInformation(); 3151 3151 } 3152 3152 … … 3215 3215 void UIMachineSettingsStorage::sltCreateNewHardDisk() 3216 3216 { 3217 QString strMediumId = getWithNewHDWizard();3217 const QString strMediumId = getWithNewHDWizard(); 3218 3218 if (!strMediumId.isNull()) 3219 3219 m_pMediumIdHolder->setId(strMediumId); … … 3227 3227 void UIMachineSettingsStorage::sltChooseExistingMedium() 3228 3228 { 3229 QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());3230 QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(m_pMediumIdHolder->type(), this, strMachineFolder);3229 const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath()); 3230 const QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(m_pMediumIdHolder->type(), this, strMachineFolder); 3231 3231 if (!strMediumId.isNull()) 3232 3232 m_pMediumIdHolder->setId(strMediumId); … … 3250 3250 { 3251 3251 /* Get recent medium type & name: */ 3252 QStringList mediumInfoList = pChooseRecentMediumAction->data().toString().split(',');3253 UIMediumType mediumType = (UIMediumType)mediumInfoList[0].toUInt();3254 QString strMediumLocation = mediumInfoList[1];3255 QString strMediumId = vboxGlobal().openMedium(mediumType, strMediumLocation, this);3252 const QStringList mediumInfoList = pChooseRecentMediumAction->data().toString().split(','); 3253 const UIMediumType enmMediumType = (UIMediumType)mediumInfoList[0].toUInt(); 3254 const QString strMediumLocation = mediumInfoList[1]; 3255 const QString strMediumId = vboxGlobal().openMedium(enmMediumType, strMediumLocation, this); 3256 3256 if (!strMediumId.isNull()) 3257 3257 m_pMediumIdHolder->setId(strMediumId); … … 3259 3259 } 3260 3260 3261 void UIMachineSettingsStorage:: updateActionsState()3262 { 3263 QModelIndex index = mTwStorageTree->currentIndex();3264 3265 bool isIDEPossible = mStorageModel->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool();3266 bool isSATAPossible = mStorageModel->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool();3267 bool isSCSIPossible = mStorageModel->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool();3268 bool isFloppyPossible = mStorageModel->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool();3269 bool isSASPossible = mStorageModel->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool();3270 bool isUSBPossible = mStorageModel->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool();3271 bool isNVMePossible = mStorageModel->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool();3272 3273 bool isController = mStorageModel->data(index, StorageModel::R_IsController).toBool();3274 bool isAttachment = mStorageModel->data(index, StorageModel::R_IsAttachment).toBool();3275 bool isAttachmentsPossible = mStorageModel->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool();3276 bool fIsAttachmentHotPluggable = mStorageModel->data(index, StorageModel::R_AttIsHotPluggable).toBool();3261 void UIMachineSettingsStorage::sltUpdateActionsState() 3262 { 3263 const QModelIndex index = m_pTreeStorage->currentIndex(); 3264 3265 const bool fIDEPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool(); 3266 const bool fSATAPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool(); 3267 const bool fSCSIPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool(); 3268 const bool fFloppyPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool(); 3269 const bool fSASPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool(); 3270 const bool fUSBPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool(); 3271 const bool fNVMePossible = m_pModelStorage->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool(); 3272 3273 const bool fController = m_pModelStorage->data(index, StorageModel::R_IsController).toBool(); 3274 const bool fAttachment = m_pModelStorage->data(index, StorageModel::R_IsAttachment).toBool(); 3275 const bool fAttachmentsPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool(); 3276 const bool fIsAttachmentHotPluggable = m_pModelStorage->data(index, StorageModel::R_AttIsHotPluggable).toBool(); 3277 3277 3278 3278 /* Configure "add controller" actions: */ 3279 m AddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible || isSASPossible || isUSBPossible || isNVMePossible);3280 m AddIDECtrAction->setEnabled (isIDEPossible);3281 m AddSATACtrAction->setEnabled (isSATAPossible);3282 m AddSCSICtrAction->setEnabled (isSCSIPossible);3283 m AddFloppyCtrAction->setEnabled (isFloppyPossible);3284 m AddSASCtrAction->setEnabled (isSASPossible);3285 m AddUSBCtrAction->setEnabled (isUSBPossible);3286 m AddNVMeCtrAction->setEnabled (isNVMePossible);3279 m_pActionAddController->setEnabled(fIDEPossible || fSATAPossible || fSCSIPossible || fFloppyPossible || fSASPossible || fUSBPossible || fNVMePossible); 3280 m_pActionAddControllerIDE->setEnabled(fIDEPossible); 3281 m_pActionAddControllerSATA->setEnabled(fSATAPossible); 3282 m_pActionAddControllerSCSI->setEnabled(fSCSIPossible); 3283 m_pActionAddControllerFloppy->setEnabled(fFloppyPossible); 3284 m_pActionAddControllerSAS->setEnabled(fSASPossible); 3285 m_pActionAddControllerUSB->setEnabled(fUSBPossible); 3286 m_pActionAddControllerNVMe->setEnabled(fNVMePossible); 3287 3287 3288 3288 /* Configure "add attachment" actions: */ 3289 m AddAttAction->setEnabled (isController && isAttachmentsPossible);3290 m AddHDAttAction->setEnabled (isController && isAttachmentsPossible);3291 m AddCDAttAction->setEnabled (isController && isAttachmentsPossible);3292 m AddFDAttAction->setEnabled (isController && isAttachmentsPossible);3289 m_pActionAddAttachment->setEnabled(fController && fAttachmentsPossible); 3290 m_pActionAddAttachmentHD->setEnabled(fController && fAttachmentsPossible); 3291 m_pActionAddAttachmentCD->setEnabled(fController && fAttachmentsPossible); 3292 m_pActionAddAttachmentFD->setEnabled(fController && fAttachmentsPossible); 3293 3293 3294 3294 /* Configure "delete controller" action: */ 3295 bool fControllerInSuitableState = isMachineOffline();3296 m DelCtrAction->setEnabled(isController && fControllerInSuitableState);3295 const bool fControllerInSuitableState = isMachineOffline(); 3296 m_pActionRemoveController->setEnabled(fController && fControllerInSuitableState); 3297 3297 3298 3298 /* Configure "delete attachment" action: */ 3299 bool fAttachmentInSuitableState = isMachineOffline() ||3300 (isMachineOnline() && fIsAttachmentHotPluggable);3301 m DelAttAction->setEnabled(isAttachment && fAttachmentInSuitableState);3302 } 3303 3304 void UIMachineSettingsStorage:: onRowInserted (const QModelIndex &aParent, int aPosition)3305 { 3306 QModelIndex index = mStorageModel->index (aPosition, 0, aParent);3307 3308 switch (m StorageModel->data (index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())3299 const bool fAttachmentInSuitableState = isMachineOffline() || 3300 (isMachineOnline() && fIsAttachmentHotPluggable); 3301 m_pActionRemoveAttachment->setEnabled(fAttachment && fAttachmentInSuitableState); 3302 } 3303 3304 void UIMachineSettingsStorage::sltHandleRowInsertion(const QModelIndex &parent, int iPosition) 3305 { 3306 const QModelIndex index = m_pModelStorage->index(iPosition, 0, parent); 3307 3308 switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>()) 3309 3309 { 3310 3310 case AbstractItem::Type_ControllerItem: 3311 3311 { 3312 /* Select the newly created Controller Item */3313 m TwStorageTree->setCurrentIndex(index);3312 /* Select the newly created Controller Item: */ 3313 m_pTreeStorage->setCurrentIndex(index); 3314 3314 break; 3315 3315 } 3316 3316 case AbstractItem::Type_AttachmentItem: 3317 3317 { 3318 /* Expand parent if it is not expanded yet */3319 if (!m TwStorageTree->isExpanded (aParent))3320 m TwStorageTree->setExpanded (aParent, true);3318 /* Expand parent if it is not expanded yet: */ 3319 if (!m_pTreeStorage->isExpanded(parent)) 3320 m_pTreeStorage->setExpanded(parent, true); 3321 3321 break; 3322 3322 } … … 3325 3325 } 3326 3326 3327 updateActionsState(); 3328 getInformation(); 3329 } 3330 3331 void UIMachineSettingsStorage::onRowRemoved() 3332 { 3333 if (mStorageModel->rowCount (mStorageModel->root()) == 0) 3334 mTwStorageTree->setCurrentIndex (mStorageModel->root()); 3335 3336 updateActionsState(); 3337 getInformation(); 3338 } 3339 3340 void UIMachineSettingsStorage::onCurrentItemChanged() 3341 { 3342 updateActionsState(); 3343 getInformation(); 3344 } 3345 3346 void UIMachineSettingsStorage::onContextMenuRequested (const QPoint &aPosition) 3347 { 3348 QModelIndex index = mTwStorageTree->indexAt (aPosition); 3349 if (!index.isValid()) return addController(); 3327 sltUpdateActionsState(); 3328 sltGetInformation(); 3329 } 3330 3331 void UIMachineSettingsStorage::sltHandleRowRemoval() 3332 { 3333 if (m_pModelStorage->rowCount (m_pModelStorage->root()) == 0) 3334 m_pTreeStorage->setCurrentIndex (m_pModelStorage->root()); 3335 3336 sltUpdateActionsState(); 3337 sltGetInformation(); 3338 } 3339 3340 void UIMachineSettingsStorage::sltHandleCurrentItemChange() 3341 { 3342 sltUpdateActionsState(); 3343 sltGetInformation(); 3344 } 3345 3346 void UIMachineSettingsStorage::sltHandleContextMenuRequest(const QPoint &position) 3347 { 3348 const QModelIndex index = m_pTreeStorage->indexAt(position); 3349 if (!index.isValid()) 3350 return sltAddController(); 3350 3351 3351 3352 QMenu menu; 3352 switch (m StorageModel->data (index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())3353 switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>()) 3353 3354 { 3354 3355 case AbstractItem::Type_ControllerItem: 3355 3356 { 3356 DeviceTypeList deviceTypeList (mStorageModel->data (index, StorageModel::R_CtrDevices).value<DeviceTypeList>());3357 const DeviceTypeList deviceTypeList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>()); 3357 3358 foreach (KDeviceType deviceType, deviceTypeList) 3358 3359 { … … 3360 3361 { 3361 3362 case KDeviceType_HardDisk: 3362 menu.addAction (mAddHDAttAction);3363 menu.addAction(m_pActionAddAttachmentHD); 3363 3364 break; 3364 3365 case KDeviceType_DVD: 3365 menu.addAction (mAddCDAttAction);3366 menu.addAction(m_pActionAddAttachmentCD); 3366 3367 break; 3367 3368 case KDeviceType_Floppy: 3368 menu.addAction (mAddFDAttAction);3369 menu.addAction(m_pActionAddAttachmentFD); 3369 3370 break; 3370 3371 default: … … 3372 3373 } 3373 3374 } 3374 menu.addAction (mDelCtrAction);3375 menu.addAction(m_pActionRemoveController); 3375 3376 break; 3376 3377 } 3377 3378 case AbstractItem::Type_AttachmentItem: 3378 3379 { 3379 menu.addAction (mDelAttAction);3380 menu.addAction(m_pActionRemoveAttachment); 3380 3381 break; 3381 3382 } … … 3384 3385 } 3385 3386 if (!menu.isEmpty()) 3386 menu.exec (mTwStorageTree->viewport()->mapToGlobal (aPosition));3387 } 3388 3389 void UIMachineSettingsStorage:: onDrawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex)3390 { 3391 if (! aIndex.parent().isValid() || !aIndex.parent().parent().isValid())3387 menu.exec(m_pTreeStorage->viewport()->mapToGlobal(position)); 3388 } 3389 3390 void UIMachineSettingsStorage::sltHandleDrawItemBranches(QPainter *pPainter, const QRect &rect, const QModelIndex &index) 3391 { 3392 if (!index.parent().isValid() || !index.parent().parent().isValid()) 3392 3393 return; 3393 3394 3394 aPainter->save();3395 pPainter->save(); 3395 3396 QStyleOption options; 3396 options.initFrom (mTwStorageTree);3397 options.rect = aRect;3397 options.initFrom(m_pTreeStorage); 3398 options.rect = rect; 3398 3399 options.state |= QStyle::State_Item; 3399 if ( aIndex.row() < mStorageModel->rowCount (aIndex.parent()) - 1)3400 if (index.row() < m_pModelStorage->rowCount(index.parent()) - 1) 3400 3401 options.state |= QStyle::State_Sibling; 3401 3402 /* This pen is commonly used by different 3402 3403 * look and feel styles to paint tree-view branches. */ 3403 QPen pen (QBrush(options.palette.dark().color(), Qt::Dense4Pattern), 0);3404 aPainter->setPen(pen);3404 const QPen pen(QBrush(options.palette.dark().color(), Qt::Dense4Pattern), 0); 3405 pPainter->setPen(pen); 3405 3406 /* If we want tree-view branches to be always painted we have to use QCommonStyle::drawPrimitive() 3406 3407 * because QCommonStyle performs branch painting as opposed to particular inherited sub-classing styles. */ 3407 qobject_cast <QCommonStyle*> (style())->QCommonStyle::drawPrimitive (QStyle::PE_IndicatorBranch, &options, aPainter);3408 aPainter->restore();3409 } 3410 3411 void UIMachineSettingsStorage:: onMouseMoved (QMouseEvent *aEvent)3412 { 3413 QModelIndex index = mTwStorageTree->indexAt (aEvent->pos());3414 QRect indexRect = mTwStorageTree->visualRect(index);3408 qobject_cast<QCommonStyle*>(style())->QCommonStyle::drawPrimitive(QStyle::PE_IndicatorBranch, &options, pPainter); 3409 pPainter->restore(); 3410 } 3411 3412 void UIMachineSettingsStorage::sltHandleMouseMove(QMouseEvent *pEvent) 3413 { 3414 const QModelIndex index = m_pTreeStorage->indexAt(pEvent->pos()); 3415 const QRect indexRect = m_pTreeStorage->visualRect(index); 3415 3416 3416 3417 /* Expander tool-tip */ 3417 if (m StorageModel->data(index, StorageModel::R_IsController).toBool())3418 { 3419 QRect expanderRect = m StorageModel->data(index, StorageModel::R_ItemPixmapRect).toRect();3420 expanderRect.translate 3421 if (expanderRect.contains (aEvent->pos()))3422 { 3423 aEvent->setAccepted(true);3424 if (m StorageModel->data (index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ExpanderToolTip)3425 m StorageModel->setData (index, QVariant::fromValue(StorageModel::ExpanderToolTip), StorageModel::R_ToolTipType);3418 if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool()) 3419 { 3420 QRect expanderRect = m_pModelStorage->data(index, StorageModel::R_ItemPixmapRect).toRect(); 3421 expanderRect.translate(indexRect.x(), indexRect.y()); 3422 if (expanderRect.contains(pEvent->pos())) 3423 { 3424 pEvent->setAccepted(true); 3425 if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ExpanderToolTip) 3426 m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::ExpanderToolTip), StorageModel::R_ToolTipType); 3426 3427 return; 3427 3428 } … … 3429 3430 3430 3431 /* Adder tool-tip */ 3431 if (m StorageModel->data(index, StorageModel::R_IsController).toBool() &&3432 m TwStorageTree->currentIndex() == index)3433 { 3434 DeviceTypeList devicesList (mStorageModel->data (index, StorageModel::R_CtrDevices).value<DeviceTypeList>());3432 if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool() && 3433 m_pTreeStorage->currentIndex() == index) 3434 { 3435 const DeviceTypeList devicesList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>()); 3435 3436 for (int i = 0; i < devicesList.size(); ++ i) 3436 3437 { 3437 KDeviceType deviceType = devicesList[i];3438 const KDeviceType enmDeviceType = devicesList[i]; 3438 3439 3439 3440 QRect deviceRect; 3440 switch ( deviceType)3441 switch (enmDeviceType) 3441 3442 { 3442 3443 case KDeviceType_HardDisk: 3443 3444 { 3444 deviceRect = m StorageModel->data(index, StorageModel::R_HDPixmapRect).toRect();3445 deviceRect = m_pModelStorage->data(index, StorageModel::R_HDPixmapRect).toRect(); 3445 3446 break; 3446 3447 } 3447 3448 case KDeviceType_DVD: 3448 3449 { 3449 deviceRect = m StorageModel->data (index, StorageModel::R_CDPixmapRect).toRect();3450 deviceRect = m_pModelStorage->data (index, StorageModel::R_CDPixmapRect).toRect(); 3450 3451 break; 3451 3452 } 3452 3453 case KDeviceType_Floppy: 3453 3454 { 3454 deviceRect = m StorageModel->data (index, StorageModel::R_FDPixmapRect).toRect();3455 deviceRect = m_pModelStorage->data (index, StorageModel::R_FDPixmapRect).toRect(); 3455 3456 break; 3456 3457 } … … 3458 3459 break; 3459 3460 } 3460 deviceRect.translate 3461 3462 if (deviceRect.contains (aEvent->pos()))3461 deviceRect.translate(indexRect.x() + indexRect.width(), indexRect.y()); 3462 3463 if (deviceRect.contains(pEvent->pos())) 3463 3464 { 3464 aEvent->setAccepted(true);3465 switch ( deviceType)3465 pEvent->setAccepted(true); 3466 switch (enmDeviceType) 3466 3467 { 3467 3468 case KDeviceType_HardDisk: 3468 3469 { 3469 if (m StorageModel->data (index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::HDAdderToolTip)3470 m StorageModel->setData (index, QVariant::fromValue(StorageModel::HDAdderToolTip), StorageModel::R_ToolTipType);3470 if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::HDAdderToolTip) 3471 m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::HDAdderToolTip), StorageModel::R_ToolTipType); 3471 3472 break; 3472 3473 } 3473 3474 case KDeviceType_DVD: 3474 3475 { 3475 if (m StorageModel->data (index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::CDAdderToolTip)3476 m StorageModel->setData (index, QVariant::fromValue(StorageModel::CDAdderToolTip), StorageModel::R_ToolTipType);3476 if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::CDAdderToolTip) 3477 m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::CDAdderToolTip), StorageModel::R_ToolTipType); 3477 3478 break; 3478 3479 } 3479 3480 case KDeviceType_Floppy: 3480 3481 { 3481 if (m StorageModel->data (index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::FDAdderToolTip)3482 m StorageModel->setData (index, QVariant::fromValue(StorageModel::FDAdderToolTip), StorageModel::R_ToolTipType);3482 if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::FDAdderToolTip) 3483 m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::FDAdderToolTip), StorageModel::R_ToolTipType); 3483 3484 break; 3484 3485 } … … 3492 3493 3493 3494 /* Default tool-tip */ 3494 if (m StorageModel->data (index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::DefaultToolTip)3495 m StorageModel->setData(index, StorageModel::DefaultToolTip, StorageModel::R_ToolTipType);3496 } 3497 3498 void UIMachineSettingsStorage:: onMouseClicked (QMouseEvent *aEvent)3499 { 3500 QModelIndex index = mTwStorageTree->indexAt (aEvent->pos());3501 QRect indexRect = mTwStorageTree->visualRect(index);3495 if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::DefaultToolTip) 3496 m_pModelStorage->setData(index, StorageModel::DefaultToolTip, StorageModel::R_ToolTipType); 3497 } 3498 3499 void UIMachineSettingsStorage::sltHandleMouseClick(QMouseEvent *pEvent) 3500 { 3501 const QModelIndex index = m_pTreeStorage->indexAt(pEvent->pos()); 3502 const QRect indexRect = m_pTreeStorage->visualRect(index); 3502 3503 3503 3504 /* Expander icon */ 3504 if (m StorageModel->data(index, StorageModel::R_IsController).toBool())3505 { 3506 QRect expanderRect = m StorageModel->data(index, StorageModel::R_ItemPixmapRect).toRect();3507 expanderRect.translate 3508 if (expanderRect.contains (aEvent->pos()))3509 { 3510 aEvent->setAccepted(true);3511 m TwStorageTree->setExpanded (index, !mTwStorageTree->isExpanded(index));3505 if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool()) 3506 { 3507 QRect expanderRect = m_pModelStorage->data(index, StorageModel::R_ItemPixmapRect).toRect(); 3508 expanderRect.translate(indexRect.x(), indexRect.y()); 3509 if (expanderRect.contains(pEvent->pos())) 3510 { 3511 pEvent->setAccepted(true); 3512 m_pTreeStorage->setExpanded(index, !m_pTreeStorage->isExpanded(index)); 3512 3513 return; 3513 3514 } … … 3515 3516 3516 3517 /* Adder icons */ 3517 if (m StorageModel->data(index, StorageModel::R_IsController).toBool() &&3518 m TwStorageTree->currentIndex() == index)3519 { 3520 DeviceTypeList devicesList (mStorageModel->data(index, StorageModel::R_CtrDevices).value <DeviceTypeList>());3518 if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool() && 3519 m_pTreeStorage->currentIndex() == index) 3520 { 3521 const DeviceTypeList devicesList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value <DeviceTypeList>()); 3521 3522 for (int i = 0; i < devicesList.size(); ++ i) 3522 3523 { 3523 KDeviceType deviceType = devicesList[i];3524 const KDeviceType enmDeviceType = devicesList[i]; 3524 3525 3525 3526 QRect deviceRect; 3526 switch ( deviceType)3527 switch (enmDeviceType) 3527 3528 { 3528 3529 case KDeviceType_HardDisk: 3529 3530 { 3530 deviceRect = m StorageModel->data(index, StorageModel::R_HDPixmapRect).toRect();3531 deviceRect = m_pModelStorage->data(index, StorageModel::R_HDPixmapRect).toRect(); 3531 3532 break; 3532 3533 } 3533 3534 case KDeviceType_DVD: 3534 3535 { 3535 deviceRect = m StorageModel->data (index, StorageModel::R_CDPixmapRect).toRect();3536 deviceRect = m_pModelStorage->data (index, StorageModel::R_CDPixmapRect).toRect(); 3536 3537 break; 3537 3538 } 3538 3539 case KDeviceType_Floppy: 3539 3540 { 3540 deviceRect = m StorageModel->data (index, StorageModel::R_FDPixmapRect).toRect();3541 deviceRect = m_pModelStorage->data (index, StorageModel::R_FDPixmapRect).toRect(); 3541 3542 break; 3542 3543 } … … 3544 3545 break; 3545 3546 } 3546 deviceRect.translate 3547 3548 if (deviceRect.contains (aEvent->pos()))3547 deviceRect.translate(indexRect.x() + indexRect.width(), indexRect.y()); 3548 3549 if (deviceRect.contains(pEvent->pos())) 3549 3550 { 3550 aEvent->setAccepted(true);3551 if (m AddAttAction->isEnabled())3552 addAttachmentWrapper (deviceType);3551 pEvent->setAccepted(true); 3552 if (m_pActionAddAttachment->isEnabled()) 3553 addAttachmentWrapper(enmDeviceType); 3553 3554 return; 3554 3555 } … … 3557 3558 } 3558 3559 3559 void UIMachineSettingsStorage::addControllerWrapper (const QString &aName, KStorageBus aBus, KStorageControllerType aType)3560 void UIMachineSettingsStorage::addControllerWrapper(const QString &strName, KStorageBus enmBus, KStorageControllerType enmType) 3560 3561 { 3561 3562 #ifdef RT_STRICT 3562 QModelIndex index = mTwStorageTree->currentIndex();3563 switch ( aBus)3563 const QModelIndex index = m_pTreeStorage->currentIndex(); 3564 switch (enmBus) 3564 3565 { 3565 3566 case KStorageBus_IDE: 3566 Assert (mStorageModel->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool());3567 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool()); 3567 3568 break; 3568 3569 case KStorageBus_SATA: 3569 Assert (mStorageModel->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool());3570 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool()); 3570 3571 break; 3571 3572 case KStorageBus_SCSI: 3572 Assert (mStorageModel->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool());3573 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool()); 3573 3574 break; 3574 3575 case KStorageBus_SAS: 3575 Assert (mStorageModel->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool());3576 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool()); 3576 3577 break; 3577 3578 case KStorageBus_Floppy: 3578 Assert (mStorageModel->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool());3579 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool()); 3579 3580 break; 3580 3581 case KStorageBus_USB: 3581 Assert (mStorageModel->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool());3582 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool()); 3582 3583 break; 3583 3584 case KStorageBus_PCIe: 3584 Assert (mStorageModel->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool());3585 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool()); 3585 3586 break; 3586 3587 default: … … 3589 3590 #endif 3590 3591 3591 m StorageModel->addController (aName, aBus, aType);3592 emit s torageChanged();3593 } 3594 3595 void UIMachineSettingsStorage::addAttachmentWrapper(KDeviceType deviceType)3596 { 3597 QModelIndex index = mTwStorageTree->currentIndex();3598 Assert(m StorageModel->data(index, StorageModel::R_IsController).toBool());3599 Assert(m StorageModel->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool());3600 QString strControllerName(mStorageModel->data(index, StorageModel::R_CtrName).toString());3601 QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());3592 m_pModelStorage->addController(strName, enmBus, enmType); 3593 emit sigStorageChanged(); 3594 } 3595 3596 void UIMachineSettingsStorage::addAttachmentWrapper(KDeviceType enmDevice) 3597 { 3598 const QModelIndex index = m_pTreeStorage->currentIndex(); 3599 Assert(m_pModelStorage->data(index, StorageModel::R_IsController).toBool()); 3600 Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool()); 3601 const QString strControllerName(m_pModelStorage->data(index, StorageModel::R_CtrName).toString()); 3602 const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath()); 3602 3603 3603 3604 QString strMediumId; 3604 switch ( deviceType)3605 switch (enmDevice) 3605 3606 { 3606 3607 case KDeviceType_HardDisk: 3607 3608 { 3608 int iAnswer = msgCenter().confirmHardDiskAttachmentCreation(strControllerName, this);3609 const int iAnswer = msgCenter().confirmHardDiskAttachmentCreation(strControllerName, this); 3609 3610 if (iAnswer == AlertButton_Choice1) 3610 3611 strMediumId = getWithNewHDWizard(); … … 3636 3637 if (!strMediumId.isEmpty()) 3637 3638 { 3638 m StorageModel->addAttachment(QUuid(mStorageModel->data(index, StorageModel::R_ItemId).toString()), deviceType, strMediumId);3639 m StorageModel->sort();3640 emit s torageChanged();3639 m_pModelStorage->addAttachment(QUuid(m_pModelStorage->data(index, StorageModel::R_ItemId).toString()), enmDevice, strMediumId); 3640 m_pModelStorage->sort(); 3641 emit sigStorageChanged(); 3641 3642 3642 3643 /* Revalidate: */ … … 3648 3649 { 3649 3650 /* Initialize variables: */ 3650 CGuestOSType guestOSType = vboxGlobal().virtualBox().GetGuestOSType(m_strMachineGuestOSTypeId);3651 QFileInfo fileInfo(m_strMachineSettingsFilePath);3651 const CGuestOSType comGuestOSType = vboxGlobal().virtualBox().GetGuestOSType(m_strMachineGuestOSTypeId); 3652 const QFileInfo fileInfo(m_strMachineSettingsFilePath); 3652 3653 /* Show New VD wizard: */ 3653 UISafePointerWizardNewVD pWizard = new UIWizardNewVD(this, QString(), fileInfo.absolutePath(), guestOSType.GetRecommendedHDD());3654 UISafePointerWizardNewVD pWizard = new UIWizardNewVD(this, QString(), fileInfo.absolutePath(), comGuestOSType.GetRecommendedHDD()); 3654 3655 pWizard->prepare(); 3655 QString strResult = pWizard->exec() == QDialog::Accepted ? pWizard->virtualDisk().GetId() : QString();3656 const QString strResult = pWizard->exec() == QDialog::Accepted ? pWizard->virtualDisk().GetId() : QString(); 3656 3657 if (pWizard) 3657 3658 delete pWizard; … … 3659 3660 } 3660 3661 3661 void UIMachineSettingsStorage::updateAdditional Objects (KDeviceType aType)3662 { 3663 mLbHDFormat->setVisible (aType == KDeviceType_HardDisk);3664 mLbHDFormatValue->setVisible (aType == KDeviceType_HardDisk);3665 3666 mLbCDFDType->setVisible (aType != KDeviceType_HardDisk);3667 mLbCDFDTypeValue->setVisible (aType != KDeviceType_HardDisk);3668 3669 mLbHDVirtualSize->setVisible (aType == KDeviceType_HardDisk);3670 mLbHDVirtualSizeValue->setVisible (aType == KDeviceType_HardDisk);3671 3672 mLbHDActualSize->setVisible (aType == KDeviceType_HardDisk);3673 mLbHDActualSizeValue->setVisible (aType == KDeviceType_HardDisk);3674 3675 mLbSize->setVisible (aType != KDeviceType_HardDisk);3676 mLbSizeValue->setVisible (aType != KDeviceType_HardDisk);3677 3678 mLbHDDetails->setVisible (aType == KDeviceType_HardDisk);3679 mLbHDDetailsValue->setVisible (aType == KDeviceType_HardDisk);3680 3681 m_pLabelEncryption->setVisible( aType == KDeviceType_HardDisk);3682 m_pLabelEncryptionValue->setVisible( aType == KDeviceType_HardDisk);3683 } 3684 3685 QString UIMachineSettingsStorage::generateUnique Name (const QString &aTemplate) const3686 { 3687 int maxNumber = 0;3688 QModelIndex rootIndex = mStorageModel->root();3689 for (int i = 0; i < m StorageModel->rowCount (rootIndex); ++i)3690 { 3691 QModelIndex ctrIndex = rootIndex.child(i, 0);3692 QString ctrName = mStorageModel->data(ctrIndex, StorageModel::R_CtrName).toString();3693 if (ctrName.startsWith (aTemplate))3694 { 3695 QString stringNumber (ctrName.right (ctrName.size() - aTemplate.size()));3696 bool isConverted = false;3697 int number = stringNumber.toInt (&isConverted);3698 maxNumber = isConverted && (number > maxNumber) ? number : 1;3699 } 3700 } 3701 return maxNumber ? QString ("%1 %2").arg (aTemplate).arg (++ maxNumber) : aTemplate;3702 } 3703 3704 uint32_t UIMachineSettingsStorage::deviceCount (KDeviceType aType) const3662 void UIMachineSettingsStorage::updateAdditionalDetails(KDeviceType enmType) 3663 { 3664 mLbHDFormat->setVisible(enmType == KDeviceType_HardDisk); 3665 mLbHDFormatValue->setVisible(enmType == KDeviceType_HardDisk); 3666 3667 mLbCDFDType->setVisible(enmType != KDeviceType_HardDisk); 3668 mLbCDFDTypeValue->setVisible(enmType != KDeviceType_HardDisk); 3669 3670 mLbHDVirtualSize->setVisible(enmType == KDeviceType_HardDisk); 3671 mLbHDVirtualSizeValue->setVisible(enmType == KDeviceType_HardDisk); 3672 3673 mLbHDActualSize->setVisible(enmType == KDeviceType_HardDisk); 3674 mLbHDActualSizeValue->setVisible(enmType == KDeviceType_HardDisk); 3675 3676 mLbSize->setVisible(enmType != KDeviceType_HardDisk); 3677 mLbSizeValue->setVisible(enmType != KDeviceType_HardDisk); 3678 3679 mLbHDDetails->setVisible(enmType == KDeviceType_HardDisk); 3680 mLbHDDetailsValue->setVisible(enmType == KDeviceType_HardDisk); 3681 3682 m_pLabelEncryption->setVisible(enmType == KDeviceType_HardDisk); 3683 m_pLabelEncryptionValue->setVisible(enmType == KDeviceType_HardDisk); 3684 } 3685 3686 QString UIMachineSettingsStorage::generateUniqueControllerName(const QString &strTemplate) const 3687 { 3688 int iMaxNumber = 0; 3689 const QModelIndex rootIndex = m_pModelStorage->root(); 3690 for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i) 3691 { 3692 const QModelIndex ctrIndex = rootIndex.child(i, 0); 3693 const QString ctrName = m_pModelStorage->data(ctrIndex, StorageModel::R_CtrName).toString(); 3694 if (ctrName.startsWith(strTemplate)) 3695 { 3696 const QString stringNumber(ctrName.right(ctrName.size() - strTemplate.size())); 3697 bool fConverted = false; 3698 const int iNumber = stringNumber.toInt(&fConverted); 3699 iMaxNumber = fConverted && (iNumber > iMaxNumber) ? iNumber : 1; 3700 } 3701 } 3702 return iMaxNumber ? QString("%1 %2").arg(strTemplate).arg(++iMaxNumber) : strTemplate; 3703 } 3704 3705 uint32_t UIMachineSettingsStorage::deviceCount(KDeviceType enmType) const 3705 3706 { 3706 3707 uint32_t cDevices = 0; 3707 QModelIndex rootIndex = mStorageModel->root();3708 for (int i = 0; i < m StorageModel->rowCount (rootIndex); ++i)3709 { 3710 QModelIndex ctrIndex = rootIndex.child(i, 0);3711 for (int j = 0; j < m StorageModel->rowCount (ctrIndex); ++j)3712 { 3713 QModelIndex attIndex = ctrIndex.child(j, 0);3714 KDeviceType attDevice = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value<KDeviceType>();3715 if ( attDevice == aType)3708 const QModelIndex rootIndex = m_pModelStorage->root(); 3709 for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i) 3710 { 3711 const QModelIndex ctrIndex = rootIndex.child(i, 0); 3712 for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j) 3713 { 3714 const QModelIndex attIndex = ctrIndex.child(j, 0); 3715 const KDeviceType enmAttDevice = m_pModelStorage->data(attIndex, StorageModel::R_AttDevice).value<KDeviceType>(); 3716 if (enmAttDevice == enmType) 3716 3717 ++cDevices; 3717 3718 } … … 3730 3731 void UIMachineSettingsStorage::addChooseHostDriveActions(QMenu *pOpenMediumMenu) 3731 3732 { 3732 foreach (const QString &strMediumI D, vboxGlobal().mediumIDs())3733 { 3734 const UIMedium medium = vboxGlobal().medium(strMediumI D);3733 foreach (const QString &strMediumId, vboxGlobal().mediumIDs()) 3734 { 3735 const UIMedium medium = vboxGlobal().medium(strMediumId); 3735 3736 if (medium.isHostDrive() && m_pMediumIdHolder->type() == medium.type()) 3736 3737 { … … 3742 3743 } 3743 3744 3744 void UIMachineSettingsStorage::addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType recentMediumType)3745 void UIMachineSettingsStorage::addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType enmRecentMediumType) 3745 3746 { 3746 3747 /* Get recent-medium list: */ 3747 3748 QStringList recentMediumList; 3748 switch ( recentMediumType)3749 switch (enmRecentMediumType) 3749 3750 { 3750 3751 case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break; … … 3754 3755 } 3755 3756 /* For every list-item: */ 3756 for (int i ndex = 0; index < recentMediumList.size(); ++index)3757 for (int iIndex = 0; iIndex < recentMediumList.size(); ++iIndex) 3757 3758 { 3758 3759 /* Prepare corresponding action: */ 3759 QString strRecentMediumLocation = recentMediumList[index];3760 const QString &strRecentMediumLocation = recentMediumList.at(iIndex); 3760 3761 if (QFile::exists(strRecentMediumLocation)) 3761 3762 { 3762 3763 QAction *pChooseRecentMediumAction = pOpenMediumMenu->addAction(QFileInfo(strRecentMediumLocation).fileName(), 3763 3764 this, SLOT(sltChooseRecentMedium())); 3764 pChooseRecentMediumAction->setData(QString("%1,%2").arg( recentMediumType).arg(strRecentMediumLocation));3765 pChooseRecentMediumAction->setData(QString("%1,%2").arg(enmRecentMediumType).arg(strRecentMediumLocation)); 3765 3766 } 3766 3767 } … … 3836 3837 3837 3838 /* Get storage controller name: */ 3838 QString strControllerName = controllerData.m_strControllerName;3839 const QString strControllerName = controllerData.m_strControllerName; 3839 3840 3840 3841 /* Check that storage controller exists: */ … … 3865 3866 3866 3867 /* Get storage controller attributes: */ 3867 QString strControllerName = controllerData.m_strControllerName;3868 KStorageBus controllerBus = controllerData.m_controllerBus;3869 KStorageControllerType controllerType = controllerData.m_controllerType;3870 bool fUseHostIOCache = controllerData.m_fUseHostIOCache;3868 const QString strControllerName = controllerData.m_strControllerName; 3869 const KStorageBus enmControllerBus = controllerData.m_controllerBus; 3870 const KStorageControllerType enmControllerType = controllerData.m_controllerType; 3871 const bool fUseHostIOCache = controllerData.m_fUseHostIOCache; 3871 3872 ULONG uPortCount = controllerData.m_uPortCount; 3872 3873 … … 3879 3880 { 3880 3881 /* Create new storage controller: */ 3881 controller = m_machine.AddStorageController(strControllerName, controllerBus);3882 controller = m_machine.AddStorageController(strControllerName, enmControllerBus); 3882 3883 /* Check that machine is OK: */ 3883 3884 fSuccess = m_machine.isOk(); … … 3886 3887 { 3887 3888 /* Set storage controller attributes: */ 3888 controller.SetControllerType( controllerType);3889 controller.SetControllerType(enmControllerType); 3889 3890 controller.SetUseHostIOCache(fUseHostIOCache); 3890 if ( controllerBus == KStorageBus_SATA || controllerBus == KStorageBus_SAS || controllerBus == KStorageBus_PCIe)3891 if (enmControllerBus == KStorageBus_SATA || enmControllerBus == KStorageBus_SAS || enmControllerBus == KStorageBus_PCIe) 3891 3892 { 3892 3893 uPortCount = qMax(uPortCount, controller.GetMinPortCount()); … … 3921 3922 3922 3923 /* Get storage controller attributes: */ 3923 QString strControllerName = controllerData.m_strControllerName;3924 KStorageBus controllerBus = controllerData.m_controllerBus;3925 KStorageControllerType controllerType = controllerData.m_controllerType;3926 bool fUseHostIOCache = controllerData.m_fUseHostIOCache;3924 const QString strControllerName = controllerData.m_strControllerName; 3925 const KStorageBus enmControllerBus = controllerData.m_controllerBus; 3926 const KStorageControllerType enmControllerType = controllerData.m_controllerType; 3927 const bool fUseHostIOCache = controllerData.m_fUseHostIOCache; 3927 3928 ULONG uPortCount = controllerData.m_uPortCount; 3928 3929 … … 3935 3936 { 3936 3937 /* Set storage controller attributes: */ 3937 controller.SetControllerType( controllerType);3938 controller.SetControllerType(enmControllerType); 3938 3939 controller.SetUseHostIOCache(fUseHostIOCache); 3939 if ( controllerBus == KStorageBus_SATA || controllerBus == KStorageBus_SAS)3940 if (enmControllerBus == KStorageBus_SATA || enmControllerBus == KStorageBus_SAS) 3940 3941 { 3941 3942 uPortCount = qMax(uPortCount, controller.GetMinPortCount()); … … 3978 3979 3979 3980 /* Get storage controller attributes: */ 3980 QString strControllerName = controllerData.m_strControllerName;3981 const QString strControllerName = controllerData.m_strControllerName; 3981 3982 /* Get storage attachment attributes: */ 3982 int iAttachmentPort = attachmentData.m_iAttachmentPort;3983 int iAttachmentDevice = attachmentData.m_iAttachmentDevice;3983 const int iAttachmentPort = attachmentData.m_iAttachmentPort; 3984 const int iAttachmentDevice = attachmentData.m_iAttachmentDevice; 3984 3985 3985 3986 /* Check that storage attachment exists: */ … … 4013 4014 4014 4015 /* Get storage controller attributes: */ 4015 QString strControllerName = controllerData.m_strControllerName;4016 KStorageBus controllerBus = controllerData.m_controllerBus;4016 const QString strControllerName = controllerData.m_strControllerName; 4017 const KStorageBus enmControllerBus = controllerData.m_controllerBus; 4017 4018 /* Get storage attachment attributes: */ 4018 int iAttachmentPort = attachmentData.m_iAttachmentPort;4019 int iAttachmentDevice = attachmentData.m_iAttachmentDevice;4020 KDeviceType attachmentDeviceType = attachmentData.m_attachmentType;4021 QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId;4022 bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;4023 bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;4024 bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational;4025 bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable;4019 const int iAttachmentPort = attachmentData.m_iAttachmentPort; 4020 const int iAttachmentDevice = attachmentData.m_iAttachmentDevice; 4021 const KDeviceType enmAttachmentDeviceType = attachmentData.m_attachmentType; 4022 const QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId; 4023 const bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough; 4024 const bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject; 4025 const bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational; 4026 const bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable; 4026 4027 /* Get GUI medium object: */ 4027 UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId);4028 const UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId); 4028 4029 /* Get COM medium object: */ 4029 CMedium comMedium = vboxMedium.medium();4030 const CMedium comMedium = vboxMedium.medium(); 4030 4031 4031 4032 /* Check that storage attachment doesn't exists: */ … … 4037 4038 { 4038 4039 /* Create storage attachment: */ 4039 m_machine.AttachDevice(strControllerName, iAttachmentPort, iAttachmentDevice, attachmentDeviceType, comMedium);4040 m_machine.AttachDevice(strControllerName, iAttachmentPort, iAttachmentDevice, enmAttachmentDeviceType, comMedium); 4040 4041 /* Check that machine is OK: */ 4041 4042 fSuccess = m_machine.isOk(); 4042 4043 if (fSuccess) 4043 4044 { 4044 if ( attachmentDeviceType == KDeviceType_DVD)4045 if (enmAttachmentDeviceType == KDeviceType_DVD) 4045 4046 { 4046 4047 if (fSuccess && isMachineOffline()) … … 4057 4058 } 4058 4059 } 4059 else if ( attachmentDeviceType == KDeviceType_HardDisk)4060 else if (enmAttachmentDeviceType == KDeviceType_HardDisk) 4060 4061 { 4061 4062 if (fSuccess && isMachineOffline()) … … 4066 4067 } 4067 4068 } 4068 if (( controllerBus == KStorageBus_SATA) || (controllerBus == KStorageBus_USB))4069 if ((enmControllerBus == KStorageBus_SATA) || (enmControllerBus == KStorageBus_USB)) 4069 4070 { 4070 4071 if (fSuccess && isMachineOffline()) … … 4079 4080 { 4080 4081 /* Show error message: */ 4081 msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal( attachmentDeviceType),4082 msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal(enmAttachmentDeviceType), 4082 4083 vboxMedium.location(), 4083 StorageSlot( controllerBus, iAttachmentPort, iAttachmentDevice), this);4084 StorageSlot(enmControllerBus, iAttachmentPort, iAttachmentDevice), this); 4084 4085 } 4085 4086 } … … 4102 4103 4103 4104 /* Get storage controller attributes: */ 4104 QString strControllerName = controllerData.m_strControllerName;4105 KStorageBus controllerBus = controllerData.m_controllerBus;4105 const QString strControllerName = controllerData.m_strControllerName; 4106 const KStorageBus enmControllerBus = controllerData.m_controllerBus; 4106 4107 /* Get storage attachment attributes: */ 4107 int iAttachmentPort = attachmentData.m_iAttachmentPort;4108 int iAttachmentDevice = attachmentData.m_iAttachmentDevice;4109 QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId;4110 bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;4111 bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;4112 bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational;4113 bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable;4114 KDeviceType attachmentDeviceType = attachmentData.m_attachmentType;4108 const int iAttachmentPort = attachmentData.m_iAttachmentPort; 4109 const int iAttachmentDevice = attachmentData.m_iAttachmentDevice; 4110 const QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId; 4111 const bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough; 4112 const bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject; 4113 const bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational; 4114 const bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable; 4115 const KDeviceType enmAttachmentDeviceType = attachmentData.m_attachmentType; 4115 4116 4116 4117 /* Check that storage attachment exists: */ 4117 CMediumAttachment attachment = m_machine.GetMediumAttachment(strControllerName, iAttachmentPort, iAttachmentDevice);4118 const CMediumAttachment attachment = m_machine.GetMediumAttachment(strControllerName, iAttachmentPort, iAttachmentDevice); 4118 4119 /* Check that machine is OK: */ 4119 4120 fSuccess = m_machine.isOk(); … … 4122 4123 { 4123 4124 /* Get GUI medium object: */ 4124 UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId);4125 const UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId); 4125 4126 /* Get COM medium object: */ 4126 CMedium comMedium = vboxMedium.medium();4127 const CMedium comMedium = vboxMedium.medium(); 4127 4128 /* Remount storage attachment: */ 4128 4129 m_machine.MountMedium(strControllerName, iAttachmentPort, iAttachmentDevice, comMedium, true /* force? */); … … 4131 4132 if (fSuccess) 4132 4133 { 4133 if ( attachmentDeviceType == KDeviceType_DVD)4134 if (enmAttachmentDeviceType == KDeviceType_DVD) 4134 4135 { 4135 4136 if (fSuccess && isMachineOffline()) … … 4146 4147 } 4147 4148 } 4148 else if ( attachmentDeviceType == KDeviceType_HardDisk)4149 else if (enmAttachmentDeviceType == KDeviceType_HardDisk) 4149 4150 { 4150 4151 if (fSuccess && isMachineOffline()) … … 4155 4156 } 4156 4157 } 4157 if (( controllerBus == KStorageBus_SATA) || (controllerBus == KStorageBus_USB))4158 if ((enmControllerBus == KStorageBus_SATA) || (enmControllerBus == KStorageBus_USB)) 4158 4159 { 4159 4160 if (fSuccess && isMachineOffline()) … … 4168 4169 { 4169 4170 /* Show error message: */ 4170 msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal( attachmentDeviceType),4171 msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal(enmAttachmentDeviceType), 4171 4172 vboxMedium.location(), 4172 StorageSlot( controllerBus, iAttachmentPort, iAttachmentDevice), this);4173 StorageSlot(enmControllerBus, iAttachmentPort, iAttachmentDevice), this); 4173 4174 } 4174 4175 } … … 4198 4199 const UIDataSettingsMachineStorageAttachment &initialAttachmentData = attachmentCache.base(); 4199 4200 const UIDataSettingsMachineStorageAttachment ¤tAttachmentData = attachmentCache.data(); 4200 KDeviceType initialAttachmentDeviceType = initialAttachmentData.m_attachmentType;4201 KDeviceType currentAttachmentDeviceType = currentAttachmentData.m_attachmentType;4202 LONG iInitialAttachmentDevice = initialAttachmentData.m_iAttachmentDevice;4203 LONG iCurrentAttachmentDevice = currentAttachmentData.m_iAttachmentDevice;4204 LONG iInitialAttachmentPort = initialAttachmentData.m_iAttachmentPort;4205 LONG iCurrentAttachmentPort = currentAttachmentData.m_iAttachmentPort;4206 return ( currentAttachmentDeviceType == initialAttachmentDeviceType) &&4201 const KDeviceType enmInitialAttachmentDeviceType = initialAttachmentData.m_attachmentType; 4202 const KDeviceType enmCurrentAttachmentDeviceType = currentAttachmentData.m_attachmentType; 4203 const LONG iInitialAttachmentDevice = initialAttachmentData.m_iAttachmentDevice; 4204 const LONG iCurrentAttachmentDevice = currentAttachmentData.m_iAttachmentDevice; 4205 const LONG iInitialAttachmentPort = initialAttachmentData.m_iAttachmentPort; 4206 const LONG iCurrentAttachmentPort = currentAttachmentData.m_iAttachmentPort; 4207 return (enmCurrentAttachmentDeviceType == enmInitialAttachmentDeviceType) && 4207 4208 (iCurrentAttachmentDevice == iInitialAttachmentDevice) && 4208 4209 (iCurrentAttachmentPort == iInitialAttachmentPort) && 4209 ( currentAttachmentDeviceType == KDeviceType_Floppy || currentAttachmentDeviceType == KDeviceType_DVD);4210 (enmCurrentAttachmentDeviceType == KDeviceType_Floppy || enmCurrentAttachmentDeviceType == KDeviceType_DVD); 4210 4211 } 4211 4212 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r66243 r66245 602 602 signals: 603 603 604 void s torageChanged();604 void sigStorageChanged(); 605 605 606 606 public: … … 611 611 ~UIMachineSettingsStorage(); 612 612 613 void setChipsetType(KChipsetType type);613 void setChipsetType(KChipsetType enmType); 614 614 615 615 protected: … … 650 650 651 651 /* Handlers: Medium-processing stuff: */ 652 void sltHandleMediumEnumerated(const QString &strMediumI D);653 void sltHandleMediumDeleted(const QString &strMediumI D);654 655 void addController();656 void addIDEController();657 void addSATAController();658 void addSCSIController();659 void addFloppyController();660 void addSASController();661 void addUSBController();662 void addNVMeController();663 void delController();664 665 void addAttachment();666 void addHDAttachment();667 void addCDAttachment();668 void addFDAttachment();669 void delAttachment();670 671 void getInformation();672 void s etInformation();652 void sltHandleMediumEnumerated(const QString &strMediumId); 653 void sltHandleMediumDeleted(const QString &strMediumId); 654 655 void sltAddController(); 656 void sltAddControllerIDE(); 657 void sltAddControllerSATA(); 658 void sltAddControllerSCSI(); 659 void sltAddControllerFloppy(); 660 void sltAddControllerSAS(); 661 void sltAddControllerUSB(); 662 void sltAddControllerNVMe(); 663 void sltRemoveController(); 664 665 void sltAddAttachment(); 666 void sltAddAttachmentHD(); 667 void sltAddAttachmentCD(); 668 void sltAddAttachmentFD(); 669 void sltRemoveAttachment(); 670 671 void sltGetInformation(); 672 void sltSetInformation(); 673 673 674 674 void sltPrepareOpenMediumMenu(); … … 679 679 void sltChooseRecentMedium(); 680 680 681 void updateActionsState();682 683 void onRowInserted (const QModelIndex &aParent, int aIndex);684 void onRowRemoved();685 686 void onCurrentItemChanged();687 688 void onContextMenuRequested (const QPoint &aPosition);689 690 void onDrawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex);691 692 void onMouseMoved (QMouseEvent *aEvent);693 void onMouseClicked (QMouseEvent *aEvent);694 695 private: 696 697 void addControllerWrapper (const QString &aName, KStorageBus aBus, KStorageControllerType aType);698 void addAttachmentWrapper (KDeviceType aDevice);681 void sltUpdateActionsState(); 682 683 void sltHandleRowInsertion(const QModelIndex &parent, int iPosition); 684 void sltHandleRowRemoval(); 685 686 void sltHandleCurrentItemChange(); 687 688 void sltHandleContextMenuRequest(const QPoint &position); 689 690 void sltHandleDrawItemBranches(QPainter *pPainter, const QRect &rect, const QModelIndex &index); 691 692 void sltHandleMouseMove(QMouseEvent *pEvent); 693 void sltHandleMouseClick(QMouseEvent *pEvent); 694 695 private: 696 697 void addControllerWrapper(const QString &strName, KStorageBus enmBus, KStorageControllerType enmType); 698 void addAttachmentWrapper(KDeviceType enmDevice); 699 699 700 700 QString getWithNewHDWizard(); 701 701 702 void updateAdditional Objects (KDeviceType aType);703 704 QString generateUnique Name (const QString &aTemplate) const;705 706 uint32_t deviceCount (KDeviceType aType) const;702 void updateAdditionalDetails(KDeviceType enmType); 703 704 QString generateUniqueControllerName(const QString &strTemplate) const; 705 706 uint32_t deviceCount(KDeviceType enmType) const; 707 707 708 708 void addChooseExistingMediumAction(QMenu *pOpenMediumMenu, const QString &strActionName); 709 709 void addChooseHostDriveActions(QMenu *pOpenMediumMenu); 710 void addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType recentMediumType);710 void addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType enmRecentMediumType); 711 711 712 712 bool updateStorageData(); … … 723 723 bool isAttachmentCouldBeUpdated(const UISettingsCacheMachineStorageAttachment &attachmentCache) const; 724 724 725 QString m_strMachineId;726 QString m_strMachineSettingsFilePath;727 QString m_strMachineGuestOSTypeId;725 QString m_strMachineId; 726 QString m_strMachineSettingsFilePath; 727 QString m_strMachineGuestOSTypeId; 728 728 729 729 /** Holds the storage-tree instance. */ 730 QITreeView *mTwStorageTree;730 QITreeView *m_pTreeStorage; 731 731 /** Holds the storage-model instance. */ 732 StorageModel *m StorageModel;733 734 QAction *m AddCtrAction;735 QAction *m DelCtrAction;736 QAction *m AddIDECtrAction;737 QAction *m AddSATACtrAction;738 QAction *m AddSCSICtrAction;739 QAction *m AddSASCtrAction;740 QAction *m AddFloppyCtrAction;741 QAction *m AddUSBCtrAction;742 QAction *m AddNVMeCtrAction;743 QAction *m AddAttAction;744 QAction *m DelAttAction;745 QAction *m AddHDAttAction;746 QAction *m AddCDAttAction;747 QAction *m AddFDAttAction;732 StorageModel *m_pModelStorage; 733 734 QAction *m_pActionAddController; 735 QAction *m_pActionRemoveController; 736 QAction *m_pActionAddControllerIDE; 737 QAction *m_pActionAddControllerSATA; 738 QAction *m_pActionAddControllerSCSI; 739 QAction *m_pActionAddControllerSAS; 740 QAction *m_pActionAddControllerFloppy; 741 QAction *m_pActionAddControllerUSB; 742 QAction *m_pActionAddControllerNVMe; 743 QAction *m_pActionAddAttachment; 744 QAction *m_pActionRemoveAttachment; 745 QAction *m_pActionAddAttachmentHD; 746 QAction *m_pActionAddAttachmentCD; 747 QAction *m_pActionAddAttachmentFD; 748 748 749 749 UIMediumIDHolder *m_pMediumIdHolder; 750 750 751 bool m IsPolished;752 bool m IsLoadingInProgress;751 bool m_fPolished; 752 bool m_fLoadingInProgress; 753 753 754 754 /** Holds the page data cache instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r66243 r66245 430 430 431 431 /* RAM amount test: */ 432 ulong uFullSize = vboxGlobal().host().GetMemorySize();432 const ulong uFullSize = vboxGlobal().host().GetMemorySize(); 433 433 if (m_pSliderMemorySize->value() > (int)m_pSliderMemorySize->maxRAMAlw()) 434 434 { … … 479 479 480 480 /* VCPU amount test: */ 481 int cTotalCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();481 const int cTotalCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount(); 482 482 if (m_pSliderCPUCount->value() > 2 * cTotalCPUs) 483 483 { … … 651 651 mTwBootOrder->setCurrentItem(mTwBootOrder->item(0)); 652 652 else 653 slt CurrentBootItemChanged(mTwBootOrder->currentRow());653 sltHandleCurrentBootItemChange(mTwBootOrder->currentRow()); 654 654 mTwBootOrder->currentItem()->setSelected(true); 655 655 } … … 694 694 } 695 695 696 void UIMachineSettingsSystem::slt CurrentBootItemChanged(int iCurrentItem)696 void UIMachineSettingsSystem::sltHandleCurrentBootItemChange(int iCurrentItem) 697 697 { 698 698 /* Update boot-order tool-buttons: */ 699 bool fEnabledUP = iCurrentItem > 0;700 bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1;699 const bool fEnabledUP = iCurrentItem > 0; 700 const bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1; 701 701 if ((mTbBootItemUp->hasFocus() && !fEnabledUP) || 702 702 (mTbBootItemDown->hasFocus() && !fEnabledDOWN)) … … 767 767 { 768 768 /* Load configuration: */ 769 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();769 const CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); 770 770 771 771 /* Preconfigure memory-size editor: */ … … 796 796 * Until there will be separate Main getter for list of supported boot device types, 797 797 * this list will be hard-coded here... */ 798 int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition());798 const int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition()); 799 799 for (int iBootPosition = 1; iBootPosition <= iPossibleBootListSize; ++iBootPosition) 800 800 { … … 831 831 connect(mTbBootItemUp, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemUp())); 832 832 connect(mTbBootItemDown, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemDown())); 833 connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(slt CurrentBootItemChanged(int)));833 connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(sltHandleCurrentBootItemChange(int))); 834 834 835 835 /* Advanced options: */ … … 840 840 { 841 841 /* Load configuration: */ 842 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();843 uint hostCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();842 const CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); 843 const uint hostCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount(); 844 844 m_uMinGuestCPU = properties.GetMinGuestCPUCount(); 845 845 m_uMaxGuestCPU = qMin(2 * hostCPUs, (uint)properties.GetMaxGuestCPUCount()); … … 907 907 { 908 908 /* Is there any value currently present/selected? */ 909 KPointingHIDType currentValue = KPointingHIDType_None;910 { 911 int iCurrentIndex = m_pComboPointingHIDType->currentIndex();909 KPointingHIDType enmCurrentValue = KPointingHIDType_None; 910 { 911 const int iCurrentIndex = m_pComboPointingHIDType->currentIndex(); 912 912 if (iCurrentIndex != -1) 913 currentValue = (KPointingHIDType)m_pComboPointingHIDType->itemData(iCurrentIndex).toInt();913 enmCurrentValue = (KPointingHIDType)m_pComboPointingHIDType->itemData(iCurrentIndex).toInt(); 914 914 } 915 915 … … 918 918 919 919 /* Repopulate combo taking into account currently cached value: */ 920 KPointingHIDType cachedValue = m_pCache->base().m_pointingHIDType;920 const KPointingHIDType enmCachedValue = m_pCache->base().m_pointingHIDType; 921 921 { 922 922 /* "PS/2 Mouse" value is always here: */ … … 924 924 925 925 /* "USB Mouse" value is here only if it is currently selected: */ 926 if ( cachedValue == KPointingHIDType_USBMouse)926 if (enmCachedValue == KPointingHIDType_USBMouse) 927 927 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMouse), (int)KPointingHIDType_USBMouse); 928 928 … … 931 931 932 932 /* "PS/2 and USB Mouse" value is here only if it is currently selected: */ 933 if ( cachedValue == KPointingHIDType_ComboMouse)933 if (enmCachedValue == KPointingHIDType_ComboMouse) 934 934 m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_ComboMouse), (int)KPointingHIDType_ComboMouse); 935 935 … … 939 939 940 940 /* Was there any value previously present/selected? */ 941 if ( currentValue != KPointingHIDType_None)942 { 943 int iPreviousIndex = m_pComboPointingHIDType->findData((int) currentValue);941 if (enmCurrentValue != KPointingHIDType_None) 942 { 943 int iPreviousIndex = m_pComboPointingHIDType->findData((int)enmCurrentValue); 944 944 if (iPreviousIndex != -1) 945 945 m_pComboPointingHIDType->setCurrentIndex(iPreviousIndex); … … 953 953 { 954 954 /* Cast to the corresponding type: */ 955 KChipsetType type = (KChipsetType)iIndex;955 const KChipsetType enmType = (KChipsetType)iIndex; 956 956 /* Look for the corresponding item: */ 957 int iCorrespondingIndex = m_pComboChipsetType->findData((int)type);957 const int iCorrespondingIndex = m_pComboChipsetType->findData((int)enmType); 958 958 /* Re-translate if corresponding item was found: */ 959 959 if (iCorrespondingIndex != -1) 960 m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString( type));960 m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString(enmType)); 961 961 } 962 962 } … … 968 968 { 969 969 /* Cast to the corresponding type: */ 970 KPointingHIDType type = (KPointingHIDType)iIndex;970 const KPointingHIDType enmType = (KPointingHIDType)iIndex; 971 971 /* Look for the corresponding item: */ 972 int iCorrespondingIndex = m_pComboPointingHIDType->findData((int)type);972 const int iCorrespondingIndex = m_pComboPointingHIDType->findData((int)enmType); 973 973 /* Re-translate if corresponding item was found: */ 974 974 if (iCorrespondingIndex != -1) 975 m_pComboPointingHIDType->setItemText(iCorrespondingIndex, gpConverter->toString( type));975 m_pComboPointingHIDType->setItemText(iCorrespondingIndex, gpConverter->toString(enmType)); 976 976 } 977 977 } … … 983 983 { 984 984 /* Cast to the corresponding type: */ 985 KParavirtProvider type = (KParavirtProvider)iIndex;985 const KParavirtProvider enmType = (KParavirtProvider)iIndex; 986 986 /* Look for the corresponding item: */ 987 int iCorrespondingIndex = m_pComboParavirtProvider->findData((int)type);987 const int iCorrespondingIndex = m_pComboParavirtProvider->findData((int)enmType); 988 988 /* Re-translate if corresponding item was found: */ 989 989 if (iCorrespondingIndex != -1) 990 m_pComboParavirtProvider->setItemText(iCorrespondingIndex, gpConverter->toString( type));990 m_pComboParavirtProvider->setItemText(iCorrespondingIndex, gpConverter->toString(enmType)); 991 991 } 992 992 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r66243 r66245 43 43 /* API: Correlation stuff: */ 44 44 bool isHWVirtExEnabled() const; 45 45 46 bool isHIDEnabled() const; 47 46 48 KChipsetType chipsetType() const; 49 47 50 void setUSBEnabled(bool fEnabled); 48 51 … … 88 91 89 92 /* Handler: Boot-table stuff: */ 90 void slt CurrentBootItemChanged(int iCurrentIndex);93 void sltHandleCurrentBootItemChange(int iCurrentIndex); 91 94 92 95 /* Handlers: CPU stuff: */ … … 116 119 117 120 /* Variable: Boot-table stuff: */ 118 QList<KDeviceType> m_possibleBootItems;121 QList<KDeviceType> m_possibleBootItems; 119 122 120 123 /* Variables: CPU stuff: */ 121 uint m_uMinGuestCPU;122 uint m_uMaxGuestCPU;123 uint m_uMinGuestCPUExecCap;124 uint m_uMedGuestCPUExecCap;125 uint m_uMaxGuestCPUExecCap;124 uint m_uMinGuestCPU; 125 uint m_uMaxGuestCPU; 126 uint m_uMinGuestCPUExecCap; 127 uint m_uMedGuestCPUExecCap; 128 uint m_uMaxGuestCPUExecCap; 126 129 127 130 /* Variable: Correlation stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r66243 r66245 277 277 UIMachineSettingsUSB::UIMachineSettingsUSB() 278 278 : m_pToolBar(0) 279 , m NewAction(0), mAddAction(0), mEdtAction(0), mDelAction(0)280 , m MupAction(0), mMdnAction(0)281 , m USBDevicesMenu(0)279 , m_pActionNew(0), m_pActionAdd(0), m_pActionEdit(0), m_pActionRemove(0) 280 , m_pActionMoveUp(0), m_pActionMoveDown(0) 281 , m_pMenuUSBDevices(0) 282 282 , m_pCache(new UISettingsCacheMachineUSB) 283 283 { 284 284 /* Apply UI decorations */ 285 Ui::UIMachineSettingsUSB::setupUi 285 Ui::UIMachineSettingsUSB::setupUi(this); 286 286 287 287 /* Prepare actions */ 288 m NewAction = new QAction(mTwFilters);289 m AddAction = new QAction(mTwFilters);290 m EdtAction = new QAction(mTwFilters);291 m DelAction = new QAction(mTwFilters);292 m MupAction = new QAction(mTwFilters);293 m MdnAction = new QAction(mTwFilters);294 295 m NewAction->setShortcut (QKeySequence ("Ins"));296 m AddAction->setShortcut (QKeySequence ("Alt+Ins"));297 m EdtAction->setShortcut (QKeySequence ("Ctrl+Return"));298 m DelAction->setShortcut (QKeySequence ("Del"));299 m MupAction->setShortcut (QKeySequence ("Ctrl+Up"));300 m MdnAction->setShortcut (QKeySequence ("Ctrl+Down"));301 302 m NewAction->setIcon(UIIconPool::iconSet(":/usb_new_16px.png",288 m_pActionNew = new QAction(mTwFilters); 289 m_pActionAdd = new QAction(mTwFilters); 290 m_pActionEdit = new QAction(mTwFilters); 291 m_pActionRemove = new QAction(mTwFilters); 292 m_pActionMoveUp = new QAction(mTwFilters); 293 m_pActionMoveDown = new QAction(mTwFilters); 294 295 m_pActionNew->setShortcut (QKeySequence ("Ins")); 296 m_pActionAdd->setShortcut (QKeySequence ("Alt+Ins")); 297 m_pActionEdit->setShortcut (QKeySequence ("Ctrl+Return")); 298 m_pActionRemove->setShortcut (QKeySequence ("Del")); 299 m_pActionMoveUp->setShortcut (QKeySequence ("Ctrl+Up")); 300 m_pActionMoveDown->setShortcut (QKeySequence ("Ctrl+Down")); 301 302 m_pActionNew->setIcon(UIIconPool::iconSet(":/usb_new_16px.png", 303 303 ":/usb_new_disabled_16px.png")); 304 m AddAction->setIcon(UIIconPool::iconSet(":/usb_add_16px.png",304 m_pActionAdd->setIcon(UIIconPool::iconSet(":/usb_add_16px.png", 305 305 ":/usb_add_disabled_16px.png")); 306 m EdtAction->setIcon(UIIconPool::iconSet(":/usb_filter_edit_16px.png",306 m_pActionEdit->setIcon(UIIconPool::iconSet(":/usb_filter_edit_16px.png", 307 307 ":/usb_filter_edit_disabled_16px.png")); 308 m DelAction->setIcon(UIIconPool::iconSet(":/usb_remove_16px.png",308 m_pActionRemove->setIcon(UIIconPool::iconSet(":/usb_remove_16px.png", 309 309 ":/usb_remove_disabled_16px.png")); 310 m MupAction->setIcon(UIIconPool::iconSet(":/usb_moveup_16px.png",310 m_pActionMoveUp->setIcon(UIIconPool::iconSet(":/usb_moveup_16px.png", 311 311 ":/usb_moveup_disabled_16px.png")); 312 m MdnAction->setIcon(UIIconPool::iconSet(":/usb_movedown_16px.png",312 m_pActionMoveDown->setIcon(UIIconPool::iconSet(":/usb_movedown_16px.png", 313 313 ":/usb_movedown_disabled_16px.png")); 314 314 … … 320 320 m_pFiltersToolBar->setIconSize(QSize(iIconMetric, iIconMetric)); 321 321 m_pFiltersToolBar->setOrientation(Qt::Vertical); 322 m_pFiltersToolBar->addAction(m NewAction);323 m_pFiltersToolBar->addAction(m AddAction);324 m_pFiltersToolBar->addAction(m EdtAction);325 m_pFiltersToolBar->addAction(m DelAction);326 m_pFiltersToolBar->addAction(m MupAction);327 m_pFiltersToolBar->addAction(m MdnAction);322 m_pFiltersToolBar->addAction(m_pActionNew); 323 m_pFiltersToolBar->addAction(m_pActionAdd); 324 m_pFiltersToolBar->addAction(m_pActionEdit); 325 m_pFiltersToolBar->addAction(m_pActionRemove); 326 m_pFiltersToolBar->addAction(m_pActionMoveUp); 327 m_pFiltersToolBar->addAction(m_pActionMoveDown); 328 328 329 329 /* Setup connections */ … … 334 334 335 335 connect (mGbUSB, SIGNAL (toggled (bool)), 336 this, SLOT ( usbAdapterToggled(bool)));336 this, SLOT (sltHandleUsbAdapterToggle (bool))); 337 337 connect (mTwFilters, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)), 338 this, SLOT ( currentChanged(QTreeWidgetItem*)));338 this, SLOT (sltHandleCurrentItemChange (QTreeWidgetItem*))); 339 339 connect (mTwFilters, SIGNAL (customContextMenuRequested (const QPoint &)), 340 this, SLOT (s howContextMenu(const QPoint &)));340 this, SLOT (sltHandleContextMenuRequest (const QPoint &))); 341 341 connect (mTwFilters, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)), 342 this, SLOT ( edtClicked()));342 this, SLOT (sltEditFilter())); 343 343 connect (mTwFilters, SIGNAL (itemChanged (QTreeWidgetItem *, int)), 344 this, SLOT (slt UpdateActivityState(QTreeWidgetItem *)));345 346 m USBDevicesMenu= new VBoxUSBMenu (this);347 connect (m USBDevicesMenu, SIGNAL (triggered (QAction*)),348 this, SLOT ( addConfirmed (QAction *)));349 connect (m NewAction, SIGNAL (triggered (bool)),350 this, SLOT ( newClicked()));351 connect (m AddAction, SIGNAL (triggered (bool)),352 this, SLOT ( addClicked()));353 connect (m EdtAction, SIGNAL (triggered (bool)),354 this, SLOT ( edtClicked()));355 connect (m DelAction, SIGNAL (triggered (bool)),356 this, SLOT ( delClicked()));357 connect (m MupAction, SIGNAL (triggered (bool)),358 this, SLOT ( mupClicked()));359 connect (m MdnAction, SIGNAL (triggered (bool)),360 this, SLOT ( mdnClicked()));344 this, SLOT (sltHandleActivityStateChange(QTreeWidgetItem *))); 345 346 m_pMenuUSBDevices = new VBoxUSBMenu (this); 347 connect (m_pMenuUSBDevices, SIGNAL (triggered (QAction*)), 348 this, SLOT (sltAddFilterConfirmed (QAction *))); 349 connect (m_pActionNew, SIGNAL (triggered (bool)), 350 this, SLOT (sltNewFilter())); 351 connect (m_pActionAdd, SIGNAL (triggered (bool)), 352 this, SLOT (sltAddFilter())); 353 connect (m_pActionEdit, SIGNAL (triggered (bool)), 354 this, SLOT (sltEditFilter())); 355 connect (m_pActionRemove, SIGNAL (triggered (bool)), 356 this, SLOT (sltRemoveFilter())); 357 connect (m_pActionMoveUp, SIGNAL (triggered (bool)), 358 this, SLOT (sltMoveFilterUp())); 359 connect (m_pActionMoveDown, SIGNAL (triggered (bool)), 360 this, SLOT (sltMoveFilterDown())); 361 361 362 362 /* Setup dialog */ … … 373 373 UIMachineSettingsUSB::~UIMachineSettingsUSB() 374 374 { 375 delete m USBDevicesMenu;375 delete m_pMenuUSBDevices; 376 376 377 377 /* Cleanup cache: */ … … 473 473 474 474 /* Update page: */ 475 usbAdapterToggled(mGbUSB->isChecked());475 sltHandleUsbAdapterToggle(mGbUSB->isChecked()); 476 476 477 477 /* Polish page finally: */ … … 676 676 #ifdef VBOX_WITH_EXTPACK 677 677 /* USB 2.0/3.0 Extension Pack presence test: */ 678 CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);678 const CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName); 679 679 if ( mGbUSB->isChecked() 680 680 && (mRbUSB2->isChecked() || mRbUSB3->isChecked()) … … 698 698 } 699 699 700 void UIMachineSettingsUSB::setOrderAfter (QWidget *aWidget)701 { 702 setTabOrder (aWidget, mGbUSB);703 setTabOrder 704 setTabOrder 705 setTabOrder 706 setTabOrder 700 void UIMachineSettingsUSB::setOrderAfter(QWidget *pWidget) 701 { 702 setTabOrder(pWidget, mGbUSB); 703 setTabOrder(mGbUSB, mRbUSB1); 704 setTabOrder(mRbUSB1, mRbUSB2); 705 setTabOrder(mRbUSB2, mRbUSB3); 706 setTabOrder(mRbUSB3, mTwFilters); 707 707 } 708 708 … … 712 712 Ui::UIMachineSettingsUSB::retranslateUi(this); 713 713 714 m NewAction->setText(tr("Add Empty Filter"));715 m AddAction->setText(tr("Add Filter From Device"));716 m EdtAction->setText(tr("Edit Filter"));717 m DelAction->setText(tr("Remove Filter"));718 m MupAction->setText(tr("Move Filter Up"));719 m MdnAction->setText(tr("Move Filter Down"));720 721 m NewAction->setWhatsThis(tr("Adds new USB filter with all fields initially set to empty strings. "714 m_pActionNew->setText(tr("Add Empty Filter")); 715 m_pActionAdd->setText(tr("Add Filter From Device")); 716 m_pActionEdit->setText(tr("Edit Filter")); 717 m_pActionRemove->setText(tr("Remove Filter")); 718 m_pActionMoveUp->setText(tr("Move Filter Up")); 719 m_pActionMoveDown->setText(tr("Move Filter Down")); 720 721 m_pActionNew->setWhatsThis(tr("Adds new USB filter with all fields initially set to empty strings. " 722 722 "Note that such a filter will match any attached USB device.")); 723 m AddAction->setWhatsThis(tr("Adds new USB filter with all fields set to the values of the "723 m_pActionAdd->setWhatsThis(tr("Adds new USB filter with all fields set to the values of the " 724 724 "selected USB device attached to the host PC.")); 725 m EdtAction->setWhatsThis(tr("Edits selected USB filter."));726 m DelAction->setWhatsThis(tr("Removes selected USB filter."));727 m MupAction->setWhatsThis(tr("Moves selected USB filter up."));728 m MdnAction->setWhatsThis(tr("Moves selected USB filter down."));729 730 m NewAction->setToolTip(mNewAction->whatsThis());731 m AddAction->setToolTip(mAddAction->whatsThis());732 m EdtAction->setToolTip(mEdtAction->whatsThis());733 m DelAction->setToolTip(mDelAction->whatsThis());734 m MupAction->setToolTip(mMupAction->whatsThis());735 m MdnAction->setToolTip(mMdnAction->whatsThis());736 737 m USBFilterName = tr("New Filter %1", "usb");725 m_pActionEdit->setWhatsThis(tr("Edits selected USB filter.")); 726 m_pActionRemove->setWhatsThis(tr("Removes selected USB filter.")); 727 m_pActionMoveUp->setWhatsThis(tr("Moves selected USB filter up.")); 728 m_pActionMoveDown->setWhatsThis(tr("Moves selected USB filter down.")); 729 730 m_pActionNew->setToolTip(m_pActionNew->whatsThis()); 731 m_pActionAdd->setToolTip(m_pActionAdd->whatsThis()); 732 m_pActionEdit->setToolTip(m_pActionEdit->whatsThis()); 733 m_pActionRemove->setToolTip(m_pActionRemove->whatsThis()); 734 m_pActionMoveUp->setToolTip(m_pActionMoveUp->whatsThis()); 735 m_pActionMoveDown->setToolTip(m_pActionMoveDown->whatsThis()); 736 737 m_strTrUSBFilterName = tr("New Filter %1", "usb"); 738 738 } 739 739 … … 747 747 } 748 748 749 void UIMachineSettingsUSB:: usbAdapterToggled(bool fEnabled)749 void UIMachineSettingsUSB::sltHandleUsbAdapterToggle(bool fEnabled) 750 750 { 751 751 /* Enable/disable USB children: */ … … 761 761 } 762 762 /* Update current item: */ 763 currentChanged(mTwFilters->currentItem());764 } 765 766 void UIMachineSettingsUSB:: currentChanged(QTreeWidgetItem *aItem)763 sltHandleCurrentItemChange(mTwFilters->currentItem()); 764 } 765 766 void UIMachineSettingsUSB::sltHandleCurrentItemChange(QTreeWidgetItem *pCurrentItem) 767 767 { 768 768 /* Get selected items: */ … … 777 777 778 778 /* Select item if requested: */ 779 if ( aItem)780 aItem->setSelected(true);779 if (pCurrentItem) 780 pCurrentItem->setSelected(true); 781 781 782 782 /* Update corresponding action states: */ 783 m EdtAction->setEnabled(aItem);784 m DelAction->setEnabled(aItem);785 m MupAction->setEnabled(aItem && mTwFilters->itemAbove(aItem));786 m MdnAction->setEnabled(aItem && mTwFilters->itemBelow(aItem));787 } 788 789 void UIMachineSettingsUSB::s howContextMenu(const QPoint &pos)783 m_pActionEdit->setEnabled(pCurrentItem); 784 m_pActionRemove->setEnabled(pCurrentItem); 785 m_pActionMoveUp->setEnabled(pCurrentItem && mTwFilters->itemAbove(pCurrentItem)); 786 m_pActionMoveDown->setEnabled(pCurrentItem && mTwFilters->itemBelow(pCurrentItem)); 787 } 788 789 void UIMachineSettingsUSB::sltHandleContextMenuRequest(const QPoint &pos) 790 790 { 791 791 QMenu menu; 792 792 if (mTwFilters->isEnabled()) 793 793 { 794 menu.addAction(m NewAction);795 menu.addAction(m AddAction);794 menu.addAction(m_pActionNew); 795 menu.addAction(m_pActionAdd); 796 796 menu.addSeparator(); 797 menu.addAction(m EdtAction);797 menu.addAction(m_pActionEdit); 798 798 menu.addSeparator(); 799 menu.addAction(m DelAction);799 menu.addAction(m_pActionRemove); 800 800 menu.addSeparator(); 801 menu.addAction(m MupAction);802 menu.addAction(m MdnAction);801 menu.addAction(m_pActionMoveUp); 802 menu.addAction(m_pActionMoveDown); 803 803 } 804 804 if (!menu.isEmpty()) … … 806 806 } 807 807 808 void UIMachineSettingsUSB::slt UpdateActivityState(QTreeWidgetItem *pChangedItem)808 void UIMachineSettingsUSB::sltHandleActivityStateChange(QTreeWidgetItem *pChangedItem) 809 809 { 810 810 /* Check changed USB filter item: */ … … 816 816 } 817 817 818 void UIMachineSettingsUSB:: newClicked()818 void UIMachineSettingsUSB::sltNewFilter() 819 819 { 820 820 /* Search for the max available filter index: */ 821 821 int iMaxFilterIndex = 0; 822 QRegExp regExp(QString("^") + mUSBFilterName.arg("([0-9]+)") + QString("$"));822 const QRegExp regExp(QString("^") + m_strTrUSBFilterName.arg("([0-9]+)") + QString("$")); 823 823 QTreeWidgetItemIterator iterator(mTwFilters); 824 824 while (*iterator) 825 825 { 826 QString filterName = (*iterator)->text(0);827 int pos = regExp.indexIn(filterName);826 const QString filterName = (*iterator)->text(0); 827 const int pos = regExp.indexIn(filterName); 828 828 if (pos != -1) 829 829 iMaxFilterIndex = regExp.cap(1).toInt() > iMaxFilterIndex ? … … 835 835 UIDataSettingsMachineUSBFilter usbFilterData; 836 836 usbFilterData.m_fActive = true; 837 usbFilterData.m_strName = m USBFilterName.arg(iMaxFilterIndex + 1);837 usbFilterData.m_strName = m_strTrUSBFilterName.arg(iMaxFilterIndex + 1); 838 838 usbFilterData.m_fHostUSBDevice = false; 839 839 … … 845 845 } 846 846 847 void UIMachineSettingsUSB:: addClicked()848 { 849 m USBDevicesMenu->exec(QCursor::pos());850 } 851 852 void UIMachineSettingsUSB:: addConfirmed(QAction *pAction)847 void UIMachineSettingsUSB::sltAddFilter() 848 { 849 m_pMenuUSBDevices->exec(QCursor::pos()); 850 } 851 852 void UIMachineSettingsUSB::sltAddFilterConfirmed(QAction *pAction) 853 853 { 854 854 /* Get USB device: */ 855 CUSBDevice usb = mUSBDevicesMenu->getUSB(pAction);855 const CUSBDevice usb = m_pMenuUSBDevices->getUSB(pAction); 856 856 if (usb.isNull()) 857 857 return; … … 884 884 } 885 885 886 void UIMachineSettingsUSB:: edtClicked()886 void UIMachineSettingsUSB::sltEditFilter() 887 887 { 888 888 /* Get current USB filter item: */ … … 932 932 } 933 933 934 void UIMachineSettingsUSB:: delClicked()934 void UIMachineSettingsUSB::sltRemoveFilter() 935 935 { 936 936 /* Get current USB filter item: */ … … 943 943 944 944 /* Update current item: */ 945 currentChanged(mTwFilters->currentItem());945 sltHandleCurrentItemChange(mTwFilters->currentItem()); 946 946 947 947 /* Revalidate: */ … … 949 949 } 950 950 951 void UIMachineSettingsUSB:: mupClicked()952 { 953 QTreeWidgetItem * item = mTwFilters->currentItem();954 Assert (item);955 956 int index = mTwFilters->indexOfTopLevelItem (item);957 QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem 958 Assert (item == takenItem);959 mTwFilters->insertTopLevelItem 960 m_filters.swap 961 962 mTwFilters->setCurrentItem 963 } 964 965 void UIMachineSettingsUSB:: mdnClicked()966 { 967 QTreeWidgetItem * item = mTwFilters->currentItem();968 Assert (item);969 970 int index = mTwFilters->indexOfTopLevelItem (item);971 QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem 972 Assert (item == takenItem);973 mTwFilters->insertTopLevelItem 974 m_filters.swap 975 976 mTwFilters->setCurrentItem 977 } 978 979 void UIMachineSettingsUSB::addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool f IsNew)951 void UIMachineSettingsUSB::sltMoveFilterUp() 952 { 953 QTreeWidgetItem *pItem = mTwFilters->currentItem(); 954 Assert(pItem); 955 956 const int index = mTwFilters->indexOfTopLevelItem(pItem); 957 QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem(index); 958 Assert(pItem == takenItem); 959 mTwFilters->insertTopLevelItem(index - 1, takenItem); 960 m_filters.swap(index, index - 1); 961 962 mTwFilters->setCurrentItem(takenItem); 963 } 964 965 void UIMachineSettingsUSB::sltMoveFilterDown() 966 { 967 QTreeWidgetItem *pItem = mTwFilters->currentItem(); 968 Assert(pItem); 969 970 const int index = mTwFilters->indexOfTopLevelItem(pItem); 971 QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem(index); 972 Assert(pItem == takenItem); 973 mTwFilters->insertTopLevelItem(index + 1, takenItem); 974 m_filters.swap(index, index + 1); 975 976 mTwFilters->setCurrentItem(takenItem); 977 } 978 979 void UIMachineSettingsUSB::addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fChoose) 980 980 { 981 981 /* Append internal list with data: */ … … 990 990 991 991 /* Select this item if its new: */ 992 if (f IsNew)992 if (fChoose) 993 993 mTwFilters->setCurrentItem(pItem); 994 994 } … … 1000 1000 QString strToolTip; 1001 1001 1002 QString strVendorId = usbFilterData.m_strVendorId;1002 const QString strVendorId = usbFilterData.m_strVendorId; 1003 1003 if (!strVendorId.isEmpty()) 1004 1004 strToolTip += tr("<nobr>Vendor ID: %1</nobr>", "USB filter tooltip").arg(strVendorId); 1005 1005 1006 QString strProductId = usbFilterData.m_strProductId;1006 const QString strProductId = usbFilterData.m_strProductId; 1007 1007 if (!strProductId.isEmpty()) 1008 1008 strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Product ID: %2</nobr>", "USB filter tooltip").arg(strProductId); 1009 1009 1010 QString strRevision = usbFilterData.m_strRevision;1010 const QString strRevision = usbFilterData.m_strRevision; 1011 1011 if (!strRevision.isEmpty()) 1012 1012 strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Revision: %3</nobr>", "USB filter tooltip").arg(strRevision); 1013 1013 1014 QString strProduct = usbFilterData.m_strProduct;1014 const QString strProduct = usbFilterData.m_strProduct; 1015 1015 if (!strProduct.isEmpty()) 1016 1016 strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Product: %4</nobr>", "USB filter tooltip").arg(strProduct); 1017 1017 1018 QString strManufacturer = usbFilterData.m_strManufacturer;1018 const QString strManufacturer = usbFilterData.m_strManufacturer; 1019 1019 if (!strManufacturer.isEmpty()) 1020 1020 strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Manufacturer: %5</nobr>", "USB filter tooltip").arg(strManufacturer); 1021 1021 1022 QString strSerial = usbFilterData.m_strSerialNumber;1022 const QString strSerial = usbFilterData.m_strSerialNumber; 1023 1023 if (!strSerial.isEmpty()) 1024 1024 strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Serial No.: %1</nobr>", "USB filter tooltip").arg(strSerial); 1025 1025 1026 QString strPort = usbFilterData.m_strPort;1026 const QString strPort = usbFilterData.m_strPort; 1027 1027 if (!strPort.isEmpty()) 1028 1028 strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Port: %1</nobr>", "USB filter tooltip").arg(strPort); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
r66243 r66245 82 82 private slots: 83 83 84 void usbAdapterToggled(bool fEnabled);84 void sltHandleUsbAdapterToggle(bool fEnabled); 85 85 86 void currentChanged (QTreeWidgetItem *aItem = 0);87 void s howContextMenu(const QPoint &pos);88 void slt UpdateActivityState(QTreeWidgetItem *pChangedItem);86 void sltHandleCurrentItemChange(QTreeWidgetItem *pCurrentItem); 87 void sltHandleContextMenuRequest(const QPoint &position); 88 void sltHandleActivityStateChange(QTreeWidgetItem *pChangedItem); 89 89 90 void newClicked();91 void addClicked();92 void edtClicked();93 void addConfirmed (QAction *aAction);94 void delClicked();95 void mupClicked();96 void mdnClicked();90 void sltNewFilter(); 91 void sltAddFilter(); 92 void sltEditFilter(); 93 void sltAddFilterConfirmed(QAction *pAction); 94 void sltRemoveFilter(); 95 void sltMoveFilterUp(); 96 void sltMoveFilterDown(); 97 97 98 98 private: 99 99 100 void addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool f IsNew);100 void addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fChoose); 101 101 102 102 /* Returns the multi-line description of the given USB filter: */ … … 104 104 105 105 /* Other variables: */ 106 UIToolBar *m_pToolBar;107 QAction *mNewAction;108 QAction *mAddAction;109 QAction *mEdtAction;110 QAction *mDelAction;111 QAction *mMupAction;112 QAction *mMdnAction;113 VBoxUSBMenu *m USBDevicesMenu;106 UIToolBar *m_pToolBar; 107 QAction *m_pActionNew; 108 QAction *m_pActionAdd; 109 QAction *m_pActionEdit; 110 QAction *m_pActionRemove; 111 QAction *m_pActionMoveUp; 112 QAction *m_pActionMoveDown; 113 VBoxUSBMenu *m_pMenuUSBDevices; 114 114 115 QString mUSBFilterName;115 QString m_strTrUSBFilterName; 116 116 117 QList<UIDataSettingsMachineUSBFilter> m_filters;117 QList<UIDataSettingsMachineUSBFilter> m_filters; 118 118 119 119 /** Holds the page data cache instance. */
Note:
See TracChangeset
for help on using the changeset viewer.