Changeset 66183 in vbox
- Timestamp:
- Mar 21, 2017 4:26:35 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 23 edited
-
Makefile.kmk (modified) (1 diff)
-
src/settings/machine/UIMachineSettingsAudio.cpp (modified) (11 diffs)
-
src/settings/machine/UIMachineSettingsAudio.h (modified) (3 diffs)
-
src/settings/machine/UIMachineSettingsDisplay.cpp (modified) (14 diffs)
-
src/settings/machine/UIMachineSettingsDisplay.h (modified) (4 diffs)
-
src/settings/machine/UIMachineSettingsGeneral.cpp (modified) (18 diffs)
-
src/settings/machine/UIMachineSettingsGeneral.h (modified) (6 diffs)
-
src/settings/machine/UIMachineSettingsInterface.cpp (modified) (10 diffs)
-
src/settings/machine/UIMachineSettingsInterface.h (modified) (4 diffs)
-
src/settings/machine/UIMachineSettingsNetwork.cpp (modified) (13 diffs)
-
src/settings/machine/UIMachineSettingsNetwork.h (modified) (5 diffs)
-
src/settings/machine/UIMachineSettingsParallel.cpp (modified) (13 diffs)
-
src/settings/machine/UIMachineSettingsParallel.h (modified) (4 diffs)
-
src/settings/machine/UIMachineSettingsSF.cpp (modified) (11 diffs)
-
src/settings/machine/UIMachineSettingsSF.h (modified) (4 diffs)
-
src/settings/machine/UIMachineSettingsSerial.cpp (modified) (13 diffs)
-
src/settings/machine/UIMachineSettingsSerial.h (modified) (4 diffs)
-
src/settings/machine/UIMachineSettingsStorage.cpp (modified) (11 diffs)
-
src/settings/machine/UIMachineSettingsStorage.h (modified) (7 diffs)
-
src/settings/machine/UIMachineSettingsSystem.cpp (modified) (13 diffs)
-
src/settings/machine/UIMachineSettingsSystem.h (modified) (4 diffs)
-
src/settings/machine/UIMachineSettingsUSB.cpp (modified) (15 diffs)
-
src/settings/machine/UIMachineSettingsUSB.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r65381 r66183 555 555 src/selector/UISnapshotPane.cpp \ 556 556 src/settings/global/UIGlobalSettingsInput.cpp \ 557 src/settings/machine/UIMachineSettingsNetwork.cpp \ 558 src/settings/machine/UIMachineSettingsParallel.cpp \ 559 src/settings/machine/UIMachineSettingsSerial.cpp \ 557 560 src/settings/machine/UIMachineSettingsStorage.cpp \ 558 561 src/settings/machine/UIMachineSettingsUSB.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 22 22 /* GUI includes: */ 23 # include "UIConverter.h" 23 24 # include "UIMachineSettingsAudio.h" 24 # include "UIConverter.h"25 25 26 26 /* COM includes: */ … … 30 30 31 31 32 /** Machine settings: Audio page data structure. */ 33 struct UIDataSettingsMachineAudio 34 { 35 /** Constructs data. */ 36 UIDataSettingsMachineAudio() 37 : m_fAudioEnabled(false) 38 , m_audioDriverType(KAudioDriverType_Null) 39 , m_audioControllerType(KAudioControllerType_AC97) 40 {} 41 42 /** Returns whether the @a other passed data is equal to this one. */ 43 bool equal(const UIDataSettingsMachineAudio &other) const 44 { 45 return true 46 && (m_fAudioEnabled == other.m_fAudioEnabled) 47 && (m_audioDriverType == other.m_audioDriverType) 48 && (m_audioControllerType == other.m_audioControllerType) 49 ; 50 } 51 52 /** Returns whether the @a other passed data is equal to this one. */ 53 bool operator==(const UIDataSettingsMachineAudio &other) const { return equal(other); } 54 /** Returns whether the @a other passed data is different from this one. */ 55 bool operator!=(const UIDataSettingsMachineAudio &other) const { return !equal(other); } 56 57 /** Holds whether the audio is enabled. */ 58 bool m_fAudioEnabled; 59 /** Holds the audio driver type. */ 60 KAudioDriverType m_audioDriverType; 61 /** Holds the audio controller type. */ 62 KAudioControllerType m_audioControllerType; 63 }; 64 65 32 66 UIMachineSettingsAudio::UIMachineSettingsAudio() 67 : m_pCache(new UISettingsCacheMachineAudio) 33 68 { 34 69 /* Prepare: */ … … 36 71 } 37 72 73 UIMachineSettingsAudio::~UIMachineSettingsAudio() 74 { 75 /* Cleanup cache: */ 76 delete m_pCache; 77 m_pCache = 0; 78 } 79 80 bool UIMachineSettingsAudio::changed() const 81 { 82 return m_pCache->wasChanged(); 83 } 84 38 85 void UIMachineSettingsAudio::loadToCacheFrom(QVariant &data) 39 86 { … … 42 89 43 90 /* Clear cache initially: */ 44 m_ cache.clear();91 m_pCache->clear(); 45 92 46 93 /* Prepare audio data: */ … … 58 105 59 106 /* Cache audio data: */ 60 m_ cache.cacheInitialData(audioData);107 m_pCache->cacheInitialData(audioData); 61 108 62 109 /* Upload machine to data: */ … … 67 114 { 68 115 /* Get audio data from cache: */ 69 const UIDataSettingsMachineAudio &audioData = m_ cache.base();116 const UIDataSettingsMachineAudio &audioData = m_pCache->base(); 70 117 71 118 /* Load audio data to page: */ … … 81 128 { 82 129 /* Prepare audio data: */ 83 UIDataSettingsMachineAudio audioData = m_ cache.base();130 UIDataSettingsMachineAudio audioData = m_pCache->base(); 84 131 85 132 /* Gather audio data: */ … … 89 136 90 137 /* Cache audio data: */ 91 m_ cache.cacheCurrentData(audioData);138 m_pCache->cacheCurrentData(audioData); 92 139 } 93 140 … … 98 145 99 146 /* Make sure machine is in 'offline' mode & audio data was changed: */ 100 if (isMachineOffline() && m_ cache.wasChanged())147 if (isMachineOffline() && m_pCache->wasChanged()) 101 148 { 102 149 /* Check if adapter still valid: */ … … 105 152 { 106 153 /* Get audio data from cache: */ 107 const UIDataSettingsMachineAudio &audioData = m_ cache.data();154 const UIDataSettingsMachineAudio &audioData = m_pCache->data(); 108 155 109 156 /* Store audio data: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
r66176 r66183 23 23 #include "UIMachineSettingsAudio.gen.h" 24 24 25 26 /** Machine settings: Audio page data structure. */ 27 struct UIDataSettingsMachineAudio 28 { 29 /** Constructs data. */ 30 UIDataSettingsMachineAudio() 31 : m_fAudioEnabled(false) 32 , m_audioDriverType(KAudioDriverType_Null) 33 , m_audioControllerType(KAudioControllerType_AC97) 34 {} 35 36 /** Returns whether the @a other passed data is equal to this one. */ 37 bool equal(const UIDataSettingsMachineAudio &other) const 38 { 39 return true 40 && (m_fAudioEnabled == other.m_fAudioEnabled) 41 && (m_audioDriverType == other.m_audioDriverType) 42 && (m_audioControllerType == other.m_audioControllerType) 43 ; 44 } 45 46 /** Returns whether the @a other passed data is equal to this one. */ 47 bool operator==(const UIDataSettingsMachineAudio &other) const { return equal(other); } 48 /** Returns whether the @a other passed data is different from this one. */ 49 bool operator!=(const UIDataSettingsMachineAudio &other) const { return !equal(other); } 50 51 /** Holds whether the audio is enabled. */ 52 bool m_fAudioEnabled; 53 /** Holds the audio driver type. */ 54 KAudioDriverType m_audioDriverType; 55 /** Holds the audio controller type. */ 56 KAudioControllerType m_audioControllerType; 57 }; 25 /* Forward declarations: */ 26 struct UIDataSettingsMachineAudio; 58 27 typedef UISettingsCache<UIDataSettingsMachineAudio> UISettingsCacheMachineAudio; 59 28 … … 67 36 public: 68 37 69 /* Constructor:*/38 /** Constructs Audio settings page. */ 70 39 UIMachineSettingsAudio(); 40 /** Destructs Audio settings page. */ 41 ~UIMachineSettingsAudio(); 71 42 72 43 protected: 73 44 74 45 /** Returns whether the page content was changed. */ 75 bool changed() const { return m_cache.wasChanged(); }46 bool changed() const /* override */; 76 47 77 48 /** Loads data into the cache from corresponding external object(s), … … 104 75 void prepareComboboxes(); 105 76 106 /* Cache:*/107 UISettingsCacheMachineAudio m_cache;77 /** Holds the page data cache instance. */ 78 UISettingsCacheMachineAudio *m_pCache; 108 79 }; 109 80 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2008-201 6Oracle Corporation7 * Copyright (C) 2008-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 22 22 /* GUI includes: */ 23 23 # include "QIWidgetValidator.h" 24 # include "UI MachineSettingsDisplay.h"24 # include "UIConverter.h" 25 25 # include "UIDesktopWidgetWatchdog.h" 26 26 # include "UIExtraDataManager.h" 27 # include "UI Converter.h"27 # include "UIMachineSettingsDisplay.h" 28 28 # include "VBoxGlobal.h" 29 29 30 30 /* COM includes: */ 31 # include "CExtPack.h" 32 # include "CExtPackManager.h" 31 33 # include "CVRDEServer.h" 32 # include "CExtPackManager.h"33 # include "CExtPack.h"34 34 35 35 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 36 37 38 /** Machine settings: Display page data structure. */ 39 struct UIDataSettingsMachineDisplay 40 { 41 /** Constructs data. */ 42 UIDataSettingsMachineDisplay() 43 : m_iCurrentVRAM(0) 44 , m_cGuestScreenCount(0) 45 , m_dScaleFactor(1.0) 46 #ifdef VBOX_WS_MAC 47 , m_fUseUnscaledHiDPIOutput(false) 48 #endif /* VBOX_WS_MAC */ 49 , m_f3dAccelerationEnabled(false) 50 #ifdef VBOX_WITH_VIDEOHWACCEL 51 , m_f2dAccelerationEnabled(false) 52 #endif /* VBOX_WITH_VIDEOHWACCEL */ 53 , m_fRemoteDisplayServerSupported(false) 54 , m_fRemoteDisplayServerEnabled(false) 55 , m_strRemoteDisplayPort(QString()) 56 , m_remoteDisplayAuthType(KAuthType_Null) 57 , m_uRemoteDisplayTimeout(0) 58 , m_fRemoteDisplayMultiConnAllowed(false) 59 , m_fVideoCaptureEnabled(false) 60 , m_strVideoCaptureFolder(QString()) 61 , m_strVideoCaptureFilePath(QString()) 62 , m_iVideoCaptureFrameWidth(0) 63 , m_iVideoCaptureFrameHeight(0) 64 , m_iVideoCaptureFrameRate(0) 65 , m_iVideoCaptureBitRate(0) 66 {} 67 68 /** Returns whether the @a other passed data is equal to this one. */ 69 bool equal(const UIDataSettingsMachineDisplay &other) const 70 { 71 return true 72 && (m_iCurrentVRAM == other.m_iCurrentVRAM) 73 && (m_cGuestScreenCount == other.m_cGuestScreenCount) 74 && (m_dScaleFactor == other.m_dScaleFactor) 75 #ifdef VBOX_WS_MAC 76 && (m_fUseUnscaledHiDPIOutput == other.m_fUseUnscaledHiDPIOutput) 77 #endif /* VBOX_WS_MAC */ 78 && (m_f3dAccelerationEnabled == other.m_f3dAccelerationEnabled) 79 #ifdef VBOX_WITH_VIDEOHWACCEL 80 && (m_f2dAccelerationEnabled == other.m_f2dAccelerationEnabled) 81 #endif /* VBOX_WITH_VIDEOHWACCEL */ 82 && (m_fRemoteDisplayServerSupported == other.m_fRemoteDisplayServerSupported) 83 && (m_fRemoteDisplayServerEnabled == other.m_fRemoteDisplayServerEnabled) 84 && (m_strRemoteDisplayPort == other.m_strRemoteDisplayPort) 85 && (m_remoteDisplayAuthType == other.m_remoteDisplayAuthType) 86 && (m_uRemoteDisplayTimeout == other.m_uRemoteDisplayTimeout) 87 && (m_fRemoteDisplayMultiConnAllowed == other.m_fRemoteDisplayMultiConnAllowed) 88 && (m_fVideoCaptureEnabled == other.m_fVideoCaptureEnabled) 89 && (m_strVideoCaptureFilePath == other.m_strVideoCaptureFilePath) 90 && (m_iVideoCaptureFrameWidth == other.m_iVideoCaptureFrameWidth) 91 && (m_iVideoCaptureFrameHeight == other.m_iVideoCaptureFrameHeight) 92 && (m_iVideoCaptureFrameRate == other.m_iVideoCaptureFrameRate) 93 && (m_iVideoCaptureBitRate == other.m_iVideoCaptureBitRate) 94 && (m_screens == other.m_screens) 95 ; 96 } 97 98 /** Returns whether the @a other passed data is equal to this one. */ 99 bool operator==(const UIDataSettingsMachineDisplay &other) const { return equal(other); } 100 /** Returns whether the @a other passed data is different from this one. */ 101 bool operator!=(const UIDataSettingsMachineDisplay &other) const { return !equal(other); } 102 103 /** Holds the video RAM amount. */ 104 int m_iCurrentVRAM; 105 /** Holds the guest screen count. */ 106 int m_cGuestScreenCount; 107 /** Holds the guest screen scale-factor. */ 108 double m_dScaleFactor; 109 #ifdef VBOX_WS_MAC 110 /** Holds whether automatic Retina scaling is disabled. */ 111 bool m_fUseUnscaledHiDPIOutput; 112 #endif /* VBOX_WS_MAC */ 113 /** Holds whether the 3D acceleration is enabled. */ 114 bool m_f3dAccelerationEnabled; 115 #ifdef VBOX_WITH_VIDEOHWACCEL 116 /** Holds whether the 2D video acceleration is enabled. */ 117 bool m_f2dAccelerationEnabled; 118 #endif /* VBOX_WITH_VIDEOHWACCEL */ 119 120 /** Holds whether the remote display server is supported. */ 121 bool m_fRemoteDisplayServerSupported; 122 /** Holds whether the remote display server is enabled. */ 123 bool m_fRemoteDisplayServerEnabled; 124 /** Holds the remote display server port. */ 125 QString m_strRemoteDisplayPort; 126 /** Holds the remote display server auth type. */ 127 KAuthType m_remoteDisplayAuthType; 128 /** Holds the remote display server timeout. */ 129 ulong m_uRemoteDisplayTimeout; 130 /** Holds whether the remote display server allows multiple connections. */ 131 bool m_fRemoteDisplayMultiConnAllowed; 132 133 /** Holds whether the video capture is enabled. */ 134 bool m_fVideoCaptureEnabled; 135 /** Holds the video capture folder. */ 136 QString m_strVideoCaptureFolder; 137 /** Holds the video capture file path. */ 138 QString m_strVideoCaptureFilePath; 139 /** Holds the video capture frame width. */ 140 int m_iVideoCaptureFrameWidth; 141 /** Holds the video capture frame height. */ 142 int m_iVideoCaptureFrameHeight; 143 /** Holds the video capture frame rate. */ 144 int m_iVideoCaptureFrameRate; 145 /** Holds the video capture bit rate. */ 146 int m_iVideoCaptureBitRate; 147 /** Holds which of the guest screens should be captured. */ 148 QVector<BOOL> m_screens; 149 }; 150 36 151 37 152 UIMachineSettingsDisplay::UIMachineSettingsDisplay() … … 46 161 , m_fWddmModeSupported(false) 47 162 #endif /* VBOX_WITH_CRHGSMI */ 163 , m_pCache(new UISettingsCacheMachineDisplay) 48 164 { 49 165 /* Prepare: */ 50 166 prepare(); 167 } 168 169 UIMachineSettingsDisplay::~UIMachineSettingsDisplay() 170 { 171 /* Cleanup cache: */ 172 delete m_pCache; 173 m_pCache = 0; 51 174 } 52 175 … … 85 208 #endif /* VBOX_WITH_VIDEOHWACCEL */ 86 209 210 bool UIMachineSettingsDisplay::changed() const 211 { 212 return m_pCache->wasChanged(); 213 } 214 87 215 void UIMachineSettingsDisplay::loadToCacheFrom(QVariant &data) 88 216 { … … 91 219 92 220 /* Clear cache initially: */ 93 m_ cache.clear();221 m_pCache->clear(); 94 222 95 223 /* Prepare display data: */ … … 135 263 136 264 /* Cache display data: */ 137 m_ cache.cacheInitialData(displayData);265 m_pCache->cacheInitialData(displayData); 138 266 139 267 /* Upload machine to data: */ … … 144 272 { 145 273 /* Get display data from cache: */ 146 const UIDataSettingsMachineDisplay &displayData = m_ cache.base();274 const UIDataSettingsMachineDisplay &displayData = m_pCache->base(); 147 275 148 276 /* Load Screen data to page: */ … … 190 318 { 191 319 /* Prepare display data: */ 192 UIDataSettingsMachineDisplay displayData = m_ cache.base();320 UIDataSettingsMachineDisplay displayData = m_pCache->base(); 193 321 194 322 /* Gather Screen data from page: */ … … 225 353 226 354 /* Cache display data: */ 227 m_ cache.cacheCurrentData(displayData);355 m_pCache->cacheCurrentData(displayData); 228 356 } 229 357 … … 234 362 235 363 /* Make sure machine is in valid mode & display data was changed: */ 236 if (isMachineInValidMode() && m_ cache.wasChanged())364 if (isMachineInValidMode() && m_pCache->wasChanged()) 237 365 { 238 366 /* Get display data from cache: */ 239 const UIDataSettingsMachineDisplay &displayData = m_ cache.data();367 const UIDataSettingsMachineDisplay &displayData = m_pCache->data(); 240 368 241 369 /* Store Screen data: */ … … 275 403 { 276 404 /* If Video Capture is *enabled* now: */ 277 if (m_ cache.base().m_fVideoCaptureEnabled)405 if (m_pCache->base().m_fVideoCaptureEnabled) 278 406 { 279 407 /* We can still save the *screens* option: */ … … 507 635 { 508 636 /* Get system data from cache: */ 509 const UIDataSettingsMachineDisplay &displayData = m_ cache.base();637 const UIDataSettingsMachineDisplay &displayData = m_pCache->base(); 510 638 511 639 /* Screen tab: */ … … 630 758 * 2. Machine is in 'online' state, check-box is checked, and video recording is *disabled* currently. */ 631 759 bool fIsVideoCaptureOptionsEnabled = ((isMachineOffline() || isMachineSaved()) && m_pCheckboxVideoCapture->isChecked()) || 632 (isMachineOnline() && !m_ cache.base().m_fVideoCaptureEnabled && m_pCheckboxVideoCapture->isChecked());760 (isMachineOnline() && !m_pCache->base().m_fVideoCaptureEnabled && m_pCheckboxVideoCapture->isChecked()); 633 761 634 762 /* Video Capture Screens option should be enabled only if: … … 1002 1130 { 1003 1131 /* Update copy of the cached item to get the desired result: */ 1004 QVector<BOOL> screens = m_ cache.base().m_screens;1132 QVector<BOOL> screens = m_pCache->base().m_screens; 1005 1133 screens.resize(m_pEditorVideoScreenCount->value()); 1006 1134 m_pScrollerVideoCaptureScreens->setValue(screens); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r66176 r66183 28 28 /* Forward declarations: */ 29 29 class UIActionPool; 30 31 32 /** Machine settings: Display page data structure. */ 33 struct UIDataSettingsMachineDisplay 34 { 35 /** Constructs data. */ 36 UIDataSettingsMachineDisplay() 37 : m_iCurrentVRAM(0) 38 , m_cGuestScreenCount(0) 39 , m_dScaleFactor(1.0) 40 #ifdef VBOX_WS_MAC 41 , m_fUseUnscaledHiDPIOutput(false) 42 #endif /* VBOX_WS_MAC */ 43 , m_f3dAccelerationEnabled(false) 44 #ifdef VBOX_WITH_VIDEOHWACCEL 45 , m_f2dAccelerationEnabled(false) 46 #endif /* VBOX_WITH_VIDEOHWACCEL */ 47 , m_fRemoteDisplayServerSupported(false) 48 , m_fRemoteDisplayServerEnabled(false) 49 , m_strRemoteDisplayPort(QString()) 50 , m_remoteDisplayAuthType(KAuthType_Null) 51 , m_uRemoteDisplayTimeout(0) 52 , m_fRemoteDisplayMultiConnAllowed(false) 53 , m_fVideoCaptureEnabled(false) 54 , m_strVideoCaptureFolder(QString()) 55 , m_strVideoCaptureFilePath(QString()) 56 , m_iVideoCaptureFrameWidth(0) 57 , m_iVideoCaptureFrameHeight(0) 58 , m_iVideoCaptureFrameRate(0) 59 , m_iVideoCaptureBitRate(0) 60 {} 61 62 /** Returns whether the @a other passed data is equal to this one. */ 63 bool equal(const UIDataSettingsMachineDisplay &other) const 64 { 65 return true 66 && (m_iCurrentVRAM == other.m_iCurrentVRAM) 67 && (m_cGuestScreenCount == other.m_cGuestScreenCount) 68 && (m_dScaleFactor == other.m_dScaleFactor) 69 #ifdef VBOX_WS_MAC 70 && (m_fUseUnscaledHiDPIOutput == other.m_fUseUnscaledHiDPIOutput) 71 #endif /* VBOX_WS_MAC */ 72 && (m_f3dAccelerationEnabled == other.m_f3dAccelerationEnabled) 73 #ifdef VBOX_WITH_VIDEOHWACCEL 74 && (m_f2dAccelerationEnabled == other.m_f2dAccelerationEnabled) 75 #endif /* VBOX_WITH_VIDEOHWACCEL */ 76 && (m_fRemoteDisplayServerSupported == other.m_fRemoteDisplayServerSupported) 77 && (m_fRemoteDisplayServerEnabled == other.m_fRemoteDisplayServerEnabled) 78 && (m_strRemoteDisplayPort == other.m_strRemoteDisplayPort) 79 && (m_remoteDisplayAuthType == other.m_remoteDisplayAuthType) 80 && (m_uRemoteDisplayTimeout == other.m_uRemoteDisplayTimeout) 81 && (m_fRemoteDisplayMultiConnAllowed == other.m_fRemoteDisplayMultiConnAllowed) 82 && (m_fVideoCaptureEnabled == other.m_fVideoCaptureEnabled) 83 && (m_strVideoCaptureFilePath == other.m_strVideoCaptureFilePath) 84 && (m_iVideoCaptureFrameWidth == other.m_iVideoCaptureFrameWidth) 85 && (m_iVideoCaptureFrameHeight == other.m_iVideoCaptureFrameHeight) 86 && (m_iVideoCaptureFrameRate == other.m_iVideoCaptureFrameRate) 87 && (m_iVideoCaptureBitRate == other.m_iVideoCaptureBitRate) 88 && (m_screens == other.m_screens) 89 ; 90 } 91 92 /** Returns whether the @a other passed data is equal to this one. */ 93 bool operator==(const UIDataSettingsMachineDisplay &other) const { return equal(other); } 94 /** Returns whether the @a other passed data is different from this one. */ 95 bool operator!=(const UIDataSettingsMachineDisplay &other) const { return !equal(other); } 96 97 /** Holds the video RAM amount. */ 98 int m_iCurrentVRAM; 99 /** Holds the guest screen count. */ 100 int m_cGuestScreenCount; 101 /** Holds the guest screen scale-factor. */ 102 double m_dScaleFactor; 103 #ifdef VBOX_WS_MAC 104 /** Holds whether automatic Retina scaling is disabled. */ 105 bool m_fUseUnscaledHiDPIOutput; 106 #endif /* VBOX_WS_MAC */ 107 /** Holds whether the 3D acceleration is enabled. */ 108 bool m_f3dAccelerationEnabled; 109 #ifdef VBOX_WITH_VIDEOHWACCEL 110 /** Holds whether the 2D video acceleration is enabled. */ 111 bool m_f2dAccelerationEnabled; 112 #endif /* VBOX_WITH_VIDEOHWACCEL */ 113 114 /** Holds whether the remote display server is supported. */ 115 bool m_fRemoteDisplayServerSupported; 116 /** Holds whether the remote display server is enabled. */ 117 bool m_fRemoteDisplayServerEnabled; 118 /** Holds the remote display server port. */ 119 QString m_strRemoteDisplayPort; 120 /** Holds the remote display server auth type. */ 121 KAuthType m_remoteDisplayAuthType; 122 /** Holds the remote display server timeout. */ 123 ulong m_uRemoteDisplayTimeout; 124 /** Holds whether the remote display server allows multiple connections. */ 125 bool m_fRemoteDisplayMultiConnAllowed; 126 127 /** Holds whether the video capture is enabled. */ 128 bool m_fVideoCaptureEnabled; 129 /** Holds the video capture folder. */ 130 QString m_strVideoCaptureFolder; 131 /** Holds the video capture file path. */ 132 QString m_strVideoCaptureFilePath; 133 /** Holds the video capture frame width. */ 134 int m_iVideoCaptureFrameWidth; 135 /** Holds the video capture frame height. */ 136 int m_iVideoCaptureFrameHeight; 137 /** Holds the video capture frame rate. */ 138 int m_iVideoCaptureFrameRate; 139 /** Holds the video capture bit rate. */ 140 int m_iVideoCaptureBitRate; 141 /** Holds which of the guest screens should be captured. */ 142 QVector<BOOL> m_screens; 143 }; 30 struct UIDataSettingsMachineDisplay; 144 31 typedef UISettingsCache<UIDataSettingsMachineDisplay> UISettingsCacheMachineDisplay; 145 32 … … 153 40 public: 154 41 155 /** Construct or. */42 /** Constructs Display settings page. */ 156 43 UIMachineSettingsDisplay(); 44 /** Destructs Display settings page. */ 45 ~UIMachineSettingsDisplay(); 157 46 158 47 /* API: Correlation stuff: */ … … 165 54 166 55 /** Returns whether the page content was changed. */ 167 bool changed() const { return m_cache.wasChanged(); }56 bool changed() const /* override */; 168 57 169 58 /** Loads data into the cache from corresponding external object(s), … … 259 148 #endif /* VBOX_WITH_CRHGSMI */ 260 149 261 /* Cache:*/262 UISettingsCacheMachineDisplay m_cache;150 /** Holds the page data cache instance. */ 151 UISettingsCacheMachineDisplay *m_pCache; 263 152 }; 264 153 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r62493 r66183 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 # include <precomp.h> 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Qt includes: */ 22 23 # include <QDir> 23 24 # include <QLineEdit> 25 24 26 /* GUI includes: */ 25 27 # include "QIWidgetValidator.h" 28 # include "UIConverter.h" 26 29 # include "UIMachineSettingsGeneral.h" 30 # include "UIMessageCenter.h" 27 31 # include "UIModalWindowManager.h" 28 32 # include "UIProgressDialog.h" 29 # include "UIMessageCenter.h" 30 # include "UIConverter.h" 33 31 34 /* COM includes: */ 32 # include "CMedium.h"33 35 # include "CExtPack.h" 34 36 # include "CExtPackManager.h" 37 # include "CMedium.h" 35 38 # include "CMediumAttachment.h" 39 36 40 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 41 42 43 /** Machine settings: General page data structure. */ 44 struct UIDataSettingsMachineGeneral 45 { 46 /** Constructs data. */ 47 UIDataSettingsMachineGeneral() 48 : m_strName(QString()) 49 , m_strGuestOsTypeId(QString()) 50 , m_strSnapshotsFolder(QString()) 51 , m_strSnapshotsHomeDir(QString()) 52 , m_clipboardMode(KClipboardMode_Disabled) 53 , m_dndMode(KDnDMode_Disabled) 54 , m_strDescription(QString()) 55 , m_fEncryptionEnabled(false) 56 , m_fEncryptionCipherChanged(false) 57 , m_fEncryptionPasswordChanged(false) 58 , m_iEncryptionCipherIndex(-1) 59 , m_strEncryptionPassword(QString()) 60 {} 61 62 /** Returns whether the @a other passed data is equal to this one. */ 63 bool equal(const UIDataSettingsMachineGeneral &other) const 64 { 65 return true 66 && (m_strName == other.m_strName) 67 && (m_strGuestOsTypeId == other.m_strGuestOsTypeId) 68 && (m_strSnapshotsFolder == other.m_strSnapshotsFolder) 69 && (m_strSnapshotsHomeDir == other.m_strSnapshotsHomeDir) 70 && (m_clipboardMode == other.m_clipboardMode) 71 && (m_dndMode == other.m_dndMode) 72 && (m_strDescription == other.m_strDescription) 73 && (m_fEncryptionEnabled == other.m_fEncryptionEnabled) 74 && (m_fEncryptionCipherChanged == other.m_fEncryptionCipherChanged) 75 && (m_fEncryptionPasswordChanged == other.m_fEncryptionPasswordChanged) 76 ; 77 } 78 79 /** Returns whether the @a other passed data is equal to this one. */ 80 bool operator==(const UIDataSettingsMachineGeneral &other) const { return equal(other); } 81 /** Returns whether the @a other passed data is different from this one. */ 82 bool operator!=(const UIDataSettingsMachineGeneral &other) const { return !equal(other); } 83 84 /** Holds the VM name. */ 85 QString m_strName; 86 /** Holds the VM OS type ID. */ 87 QString m_strGuestOsTypeId; 88 89 /** Holds the VM snapshot folder. */ 90 QString m_strSnapshotsFolder; 91 /** Holds the default VM snapshot folder. */ 92 QString m_strSnapshotsHomeDir; 93 /** Holds the VM shared clipboard mode. */ 94 KClipboardMode m_clipboardMode; 95 /** Holds the VM drag&drop mode. */ 96 KDnDMode m_dndMode; 97 98 /** Holds the VM description. */ 99 QString m_strDescription; 100 101 /** Holds whether the encryption is enabled. */ 102 bool m_fEncryptionEnabled; 103 /** Holds whether the encryption cipher was changed. */ 104 bool m_fEncryptionCipherChanged; 105 /** Holds whether the encryption password was changed. */ 106 bool m_fEncryptionPasswordChanged; 107 /** Holds the encryption cipher index. */ 108 int m_iEncryptionCipherIndex; 109 /** Holds the encryption password. */ 110 QString m_strEncryptionPassword; 111 /** Holds the encrypted medium ids. */ 112 EncryptedMediumMap m_encryptedMediums; 113 /** Holds the encryption passwords. */ 114 EncryptionPasswordMap m_encryptionPasswords; 115 }; 116 37 117 38 118 UIMachineSettingsGeneral::UIMachineSettingsGeneral() … … 40 120 , m_fEncryptionCipherChanged(false) 41 121 , m_fEncryptionPasswordChanged(false) 122 , m_pCache(new UISettingsCacheMachineGeneral) 42 123 { 43 124 /* Prepare: */ … … 46 127 /* Translate: */ 47 128 retranslateUi(); 129 } 130 131 UIMachineSettingsGeneral::~UIMachineSettingsGeneral() 132 { 133 /* Cleanup cache: */ 134 delete m_pCache; 135 m_pCache = 0; 48 136 } 49 137 … … 81 169 } 82 170 171 bool UIMachineSettingsGeneral::changed() const 172 { 173 return m_pCache->wasChanged(); 174 } 175 83 176 void UIMachineSettingsGeneral::loadToCacheFrom(QVariant &data) 84 177 { … … 87 180 88 181 /* Clear cache initially: */ 89 m_ cache.clear();182 m_pCache->clear(); 90 183 91 184 /* Prepare general data: */ … … 143 236 144 237 /* Cache general data: */ 145 m_ cache.cacheInitialData(generalData);238 m_pCache->cacheInitialData(generalData); 146 239 147 240 /* Upload machine to data: */ … … 152 245 { 153 246 /* Get general data from cache: */ 154 const UIDataSettingsMachineGeneral &generalData = m_ cache.base();247 const UIDataSettingsMachineGeneral &generalData = m_pCache->base(); 155 248 156 249 /* 'Basic' tab data: */ … … 190 283 { 191 284 /* Prepare general data: */ 192 UIDataSettingsMachineGeneral generalData = m_ cache.base();285 UIDataSettingsMachineGeneral generalData = m_pCache->base(); 193 286 194 287 /* 'Basic' tab data: */ … … 220 313 generalData.m_strEncryptionPassword = m_pEditorEncryptionPassword->text(); 221 314 /* If encryption status, cipher or password is changed: */ 222 if (generalData.m_fEncryptionEnabled != m_ cache.base().m_fEncryptionEnabled ||223 generalData.m_fEncryptionCipherChanged != m_ cache.base().m_fEncryptionCipherChanged ||224 generalData.m_fEncryptionPasswordChanged != m_ cache.base().m_fEncryptionPasswordChanged)315 if (generalData.m_fEncryptionEnabled != m_pCache->base().m_fEncryptionEnabled || 316 generalData.m_fEncryptionCipherChanged != m_pCache->base().m_fEncryptionCipherChanged || 317 generalData.m_fEncryptionPasswordChanged != m_pCache->base().m_fEncryptionPasswordChanged) 225 318 { 226 319 /* Ask for the disk encryption passwords if necessary: */ 227 if (!m_ cache.base().m_encryptedMediums.isEmpty())320 if (!m_pCache->base().m_encryptedMediums.isEmpty()) 228 321 { 229 322 /* Create corresponding dialog: */ … … 243 336 244 337 /* Cache general data: */ 245 m_ cache.cacheCurrentData(generalData);338 m_pCache->cacheCurrentData(generalData); 246 339 } 247 340 … … 252 345 253 346 /* Check if general data was changed: */ 254 if (m_ cache.wasChanged())347 if (m_pCache->wasChanged()) 255 348 { 256 349 /* Get general data from cache: */ 257 const UIDataSettingsMachineGeneral &generalData = m_ cache.data();350 const UIDataSettingsMachineGeneral &generalData = m_pCache->data(); 258 351 259 352 if (isMachineInValidMode()) 260 353 { 261 354 /* 'Advanced' tab data: */ 262 if (generalData.m_clipboardMode != m_ cache.base().m_clipboardMode)355 if (generalData.m_clipboardMode != m_pCache->base().m_clipboardMode) 263 356 m_machine.SetClipboardMode(generalData.m_clipboardMode); 264 if (generalData.m_dndMode != m_ cache.base().m_dndMode)357 if (generalData.m_dndMode != m_pCache->base().m_dndMode) 265 358 m_machine.SetDnDMode(generalData.m_dndMode); 266 359 267 360 /* 'Description' tab: */ 268 if (generalData.m_strDescription != m_ cache.base().m_strDescription)361 if (generalData.m_strDescription != m_pCache->base().m_strDescription) 269 362 m_machine.SetDescription(generalData.m_strDescription); 270 363 } … … 273 366 { 274 367 /* 'Basic' tab data: Must update long mode CPU feature bit when os type changes. */ 275 if (generalData.m_strGuestOsTypeId != m_ cache.base().m_strGuestOsTypeId)368 if (generalData.m_strGuestOsTypeId != m_pCache->base().m_strGuestOsTypeId) 276 369 { 277 370 m_machine.SetOSTypeId(generalData.m_strGuestOsTypeId); … … 282 375 283 376 /* 'Advanced' tab data: */ 284 if (generalData.m_strSnapshotsFolder != m_ cache.base().m_strSnapshotsFolder)377 if (generalData.m_strSnapshotsFolder != m_pCache->base().m_strSnapshotsFolder) 285 378 m_machine.SetSnapshotFolder(generalData.m_strSnapshotsFolder); 286 379 … … 289 382 * can collide with other settings in the config, 290 383 * especially with the snapshot folder: */ 291 if (generalData.m_strName != m_ cache.base().m_strName)384 if (generalData.m_strName != m_pCache->base().m_strName) 292 385 m_machine.SetName(generalData.m_strName); 293 386 … … 295 388 * Make sure it either encryption is changed itself, 296 389 * or the encryption was already enabled and either cipher or password is changed. */ 297 if ( generalData.m_fEncryptionEnabled != m_ cache.base().m_fEncryptionEnabled298 || ( m_ cache.base().m_fEncryptionEnabled299 && ( generalData.m_fEncryptionCipherChanged != m_ cache.base().m_fEncryptionCipherChanged300 || generalData.m_fEncryptionPasswordChanged != m_ cache.base().m_fEncryptionPasswordChanged)))390 if ( generalData.m_fEncryptionEnabled != m_pCache->base().m_fEncryptionEnabled 391 || ( m_pCache->base().m_fEncryptionEnabled 392 && ( generalData.m_fEncryptionCipherChanged != m_pCache->base().m_fEncryptionCipherChanged 393 || generalData.m_fEncryptionPasswordChanged != m_pCache->base().m_fEncryptionPasswordChanged))) 301 394 { 302 395 /* Cipher attribute changed? */ … … 418 511 /* Cipher should be chosen if once changed: */ 419 512 AssertPtrReturn(m_pComboCipher, false); 420 if (!m_ cache.base().m_fEncryptionEnabled ||513 if (!m_pCache->base().m_fEncryptionEnabled || 421 514 m_fEncryptionCipherChanged) 422 515 { … … 429 522 AssertPtrReturn(m_pEditorEncryptionPassword, false); 430 523 AssertPtrReturn(m_pEditorEncryptionPasswordConfirm, false); 431 if (!m_ cache.base().m_fEncryptionEnabled ||524 if (!m_pCache->base().m_fEncryptionEnabled || 432 525 m_fEncryptionPasswordChanged) 433 526 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
r66176 r66183 20 20 21 21 /* GUI includes: */ 22 #include "UIAddDiskEncryptionPasswordDialog.h" 22 23 #include "UISettingsPage.h" 23 24 #include "UIMachineSettingsGeneral.gen.h" 24 #include "UIAddDiskEncryptionPasswordDialog.h"25 25 26 27 /** Machine settings: General page data structure. */ 28 struct UIDataSettingsMachineGeneral 29 { 30 /** Constructs data. */ 31 UIDataSettingsMachineGeneral() 32 : m_strName(QString()) 33 , m_strGuestOsTypeId(QString()) 34 , m_strSnapshotsFolder(QString()) 35 , m_strSnapshotsHomeDir(QString()) 36 , m_clipboardMode(KClipboardMode_Disabled) 37 , m_dndMode(KDnDMode_Disabled) 38 , m_strDescription(QString()) 39 , m_fEncryptionEnabled(false) 40 , m_fEncryptionCipherChanged(false) 41 , m_fEncryptionPasswordChanged(false) 42 , m_iEncryptionCipherIndex(-1) 43 , m_strEncryptionPassword(QString()) 44 {} 45 46 /** Returns whether the @a other passed data is equal to this one. */ 47 bool equal(const UIDataSettingsMachineGeneral &other) const 48 { 49 return true 50 && (m_strName == other.m_strName) 51 && (m_strGuestOsTypeId == other.m_strGuestOsTypeId) 52 && (m_strSnapshotsFolder == other.m_strSnapshotsFolder) 53 && (m_strSnapshotsHomeDir == other.m_strSnapshotsHomeDir) 54 && (m_clipboardMode == other.m_clipboardMode) 55 && (m_dndMode == other.m_dndMode) 56 && (m_strDescription == other.m_strDescription) 57 && (m_fEncryptionEnabled == other.m_fEncryptionEnabled) 58 && (m_fEncryptionCipherChanged == other.m_fEncryptionCipherChanged) 59 && (m_fEncryptionPasswordChanged == other.m_fEncryptionPasswordChanged) 60 ; 61 } 62 63 /** Returns whether the @a other passed data is equal to this one. */ 64 bool operator==(const UIDataSettingsMachineGeneral &other) const { return equal(other); } 65 /** Returns whether the @a other passed data is different from this one. */ 66 bool operator!=(const UIDataSettingsMachineGeneral &other) const { return !equal(other); } 67 68 /** Holds the VM name. */ 69 QString m_strName; 70 /** Holds the VM OS type ID. */ 71 QString m_strGuestOsTypeId; 72 73 /** Holds the VM snapshot folder. */ 74 QString m_strSnapshotsFolder; 75 /** Holds the default VM snapshot folder. */ 76 QString m_strSnapshotsHomeDir; 77 /** Holds the VM shared clipboard mode. */ 78 KClipboardMode m_clipboardMode; 79 /** Holds the VM drag&drop mode. */ 80 KDnDMode m_dndMode; 81 82 /** Holds the VM description. */ 83 QString m_strDescription; 84 85 /** Holds whether the encryption is enabled. */ 86 bool m_fEncryptionEnabled; 87 /** Holds whether the encryption cipher was changed. */ 88 bool m_fEncryptionCipherChanged; 89 /** Holds whether the encryption password was changed. */ 90 bool m_fEncryptionPasswordChanged; 91 /** Holds the encryption cipher index. */ 92 int m_iEncryptionCipherIndex; 93 /** Holds the encryption password. */ 94 QString m_strEncryptionPassword; 95 /** Holds the encrypted medium ids. */ 96 EncryptedMediumMap m_encryptedMediums; 97 /** Holds the encryption passwords. */ 98 EncryptionPasswordMap m_encryptionPasswords; 99 }; 26 /* Forward declarations: */ 27 struct UIDataSettingsMachineGeneral; 100 28 typedef UISettingsCache<UIDataSettingsMachineGeneral> UISettingsCacheMachineGeneral; 101 29 … … 109 37 public: 110 38 111 /** Construct or. */39 /** Constructs General settings page. */ 112 40 UIMachineSettingsGeneral(); 41 /** Destructs General settings page. */ 42 ~UIMachineSettingsGeneral(); 113 43 114 44 /** Returns the VM OS type ID. */ … … 126 56 protected: 127 57 58 /** Returns whether the page content was changed. */ 59 bool changed() const /* override */; 60 128 61 /** Loads data into the cache from the corresponding external object(s). 129 62 * @note This task COULD be performed in other than GUI thread. */ … … 132 65 * @note This task SHOULD be performed in GUI thread only! */ 133 66 void getFromCache(); 134 135 /** Returns whether the page was changed: */136 bool changed() const { return m_cache.wasChanged(); }137 67 138 68 /** Saves the data from the corresponding widgets into the cache, … … 175 105 void polishPage(); 176 106 177 /** Holds the page cache. */178 UISettingsCacheMachineGeneral m_cache;179 180 107 /** Holds whether HW virtualization extension is enabled. */ 181 108 bool m_fHWVirtExEnabled; … … 193 120 * We are hard-coding it because there is no place we can get it from. */ 194 121 QStringList m_encryptionCiphers; 122 123 /** Holds the page data cache instance. */ 124 UISettingsCacheMachineGeneral *m_pCache; 195 125 }; 196 126 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2008-201 6Oracle Corporation7 * Copyright (C) 2008-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 22 22 /* GUI includes: */ 23 # include "UIActionPool.h" 24 # include "UIExtraDataManager.h" 23 25 # include "UIMachineSettingsInterface.h" 24 # include "UIExtraDataManager.h"25 # include "UIActionPool.h"26 26 27 27 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 28 29 30 /** Machine settings: User Interface page data structure. */ 31 struct UIDataSettingsMachineInterface 32 { 33 /** Constructs data. */ 34 UIDataSettingsMachineInterface() 35 : m_fStatusBarEnabled(false) 36 #ifndef VBOX_WS_MAC 37 , m_fMenuBarEnabled(false) 38 #endif /* !VBOX_WS_MAC */ 39 , m_restrictionsOfMenuBar(UIExtraDataMetaDefs::MenuType_Invalid) 40 , m_restrictionsOfMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Invalid) 41 , m_restrictionsOfMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid) 42 , m_restrictionsOfMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid) 43 , m_restrictionsOfMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid) 44 , m_restrictionsOfMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid) 45 #ifdef VBOX_WITH_DEBUGGER_GUI 46 , m_restrictionsOfMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid) 47 #endif /* VBOX_WITH_DEBUGGER_GUI */ 48 #ifdef VBOX_WS_MAC 49 , m_restrictionsOfMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType_Invalid) 50 #endif /* VBOX_WS_MAC */ 51 , m_restrictionsOfMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Invalid) 52 #ifndef VBOX_WS_MAC 53 , m_fShowMiniToolBar(false) 54 , m_fMiniToolBarAtTop(false) 55 #endif /* !VBOX_WS_MAC */ 56 {} 57 58 /** Returns whether the @a other passed data is equal to this one. */ 59 bool equal(const UIDataSettingsMachineInterface &other) const 60 { 61 return true 62 && (m_fStatusBarEnabled == other.m_fStatusBarEnabled) 63 && (m_statusBarRestrictions == other.m_statusBarRestrictions) 64 && (m_statusBarOrder == other.m_statusBarOrder) 65 #ifndef VBOX_WS_MAC 66 && (m_fMenuBarEnabled == other.m_fMenuBarEnabled) 67 #endif /* !VBOX_WS_MAC */ 68 && (m_restrictionsOfMenuBar == other.m_restrictionsOfMenuBar) 69 && (m_restrictionsOfMenuApplication == other.m_restrictionsOfMenuApplication) 70 && (m_restrictionsOfMenuMachine == other.m_restrictionsOfMenuMachine) 71 && (m_restrictionsOfMenuView == other.m_restrictionsOfMenuView) 72 && (m_restrictionsOfMenuInput == other.m_restrictionsOfMenuInput) 73 && (m_restrictionsOfMenuDevices == other.m_restrictionsOfMenuDevices) 74 #ifdef VBOX_WITH_DEBUGGER_GUI 75 && (m_restrictionsOfMenuDebug == other.m_restrictionsOfMenuDebug) 76 #endif /* VBOX_WITH_DEBUGGER_GUI */ 77 #ifdef VBOX_WS_MAC 78 && (m_restrictionsOfMenuWindow == other.m_restrictionsOfMenuWindow) 79 #endif /* VBOX_WS_MAC */ 80 && (m_restrictionsOfMenuHelp == other.m_restrictionsOfMenuHelp) 81 #ifndef VBOX_WS_MAC 82 && (m_fShowMiniToolBar == other.m_fShowMiniToolBar) 83 && (m_fMiniToolBarAtTop == other.m_fMiniToolBarAtTop) 84 #endif /* !VBOX_WS_MAC */ 85 ; 86 } 87 88 /** Returns whether the @a other passed data is equal to this one. */ 89 bool operator==(const UIDataSettingsMachineInterface &other) const { return equal(other); } 90 /** Returns whether the @a other passed data is different from this one. */ 91 bool operator!=(const UIDataSettingsMachineInterface &other) const { return !equal(other); } 92 93 /** Holds whether the status-bar is enabled. */ 94 bool m_fStatusBarEnabled; 95 /** Holds the status-bar indicator restrictions. */ 96 QList<IndicatorType> m_statusBarRestrictions; 97 /** Holds the status-bar indicator order. */ 98 QList<IndicatorType> m_statusBarOrder; 99 100 #ifndef VBOX_WS_MAC 101 /** Holds whether the menu-bar is enabled. */ 102 bool m_fMenuBarEnabled; 103 #endif /* !VBOX_WS_MAC */ 104 /** Holds the menu-bar menu restrictions. */ 105 UIExtraDataMetaDefs::MenuType m_restrictionsOfMenuBar; 106 /** Holds the Application menu restrictions. */ 107 UIExtraDataMetaDefs::MenuApplicationActionType m_restrictionsOfMenuApplication; 108 /** Holds the Machine menu restrictions. */ 109 UIExtraDataMetaDefs::RuntimeMenuMachineActionType m_restrictionsOfMenuMachine; 110 /** Holds the View menu restrictions. */ 111 UIExtraDataMetaDefs::RuntimeMenuViewActionType m_restrictionsOfMenuView; 112 /** Holds the Input menu restrictions. */ 113 UIExtraDataMetaDefs::RuntimeMenuInputActionType m_restrictionsOfMenuInput; 114 /** Holds the Devices menu restrictions. */ 115 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType m_restrictionsOfMenuDevices; 116 #ifdef VBOX_WITH_DEBUGGER_GUI 117 /** Holds the Debug menu restrictions. */ 118 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType m_restrictionsOfMenuDebug; 119 #endif /* VBOX_WITH_DEBUGGER_GUI */ 120 #ifdef VBOX_WS_MAC 121 /** Holds the Window menu restrictions. */ 122 UIExtraDataMetaDefs::MenuWindowActionType m_restrictionsOfMenuWindow; 123 #endif /* VBOX_WS_MAC */ 124 /** Holds the Help menu restrictions. */ 125 UIExtraDataMetaDefs::MenuHelpActionType m_restrictionsOfMenuHelp; 126 127 #ifndef VBOX_WS_MAC 128 /** Holds whether the mini-toolbar is enabled. */ 129 bool m_fShowMiniToolBar; 130 /** Holds whether the mini-toolbar should be aligned at top of screen. */ 131 bool m_fMiniToolBarAtTop; 132 #endif /* !VBOX_WS_MAC */ 133 }; 134 28 135 29 136 UIMachineSettingsInterface::UIMachineSettingsInterface(const QString strMachineID) 30 137 : m_strMachineID(strMachineID) 31 138 , m_pActionPool(0) 139 , m_pCache(new UISettingsCacheMachineInterface) 32 140 { 33 141 /* Prepare: */ … … 41 149 } 42 150 151 bool UIMachineSettingsInterface::changed() const 152 { 153 return m_pCache->wasChanged(); 154 } 155 43 156 void UIMachineSettingsInterface::loadToCacheFrom(QVariant &data) 44 157 { … … 47 160 48 161 /* Clear cache initially: */ 49 m_ cache.clear();162 m_pCache->clear(); 50 163 51 164 /* Prepare interface data: */ … … 78 191 79 192 /* Cache interface data: */ 80 m_ cache.cacheInitialData(interfaceData);193 m_pCache->cacheInitialData(interfaceData); 81 194 82 195 /* Upload machine to data: */ … … 87 200 { 88 201 /* Get interface data from cache: */ 89 const UIDataSettingsMachineInterface &interfaceData = m_ cache.base();202 const UIDataSettingsMachineInterface &interfaceData = m_pCache->base(); 90 203 91 204 /* Prepare interface data: */ … … 124 237 { 125 238 /* Prepare interface data: */ 126 UIDataSettingsMachineInterface interfaceData = m_ cache.base();239 UIDataSettingsMachineInterface interfaceData = m_pCache->base(); 127 240 128 241 /* Gather interface data from page: */ … … 152 265 153 266 /* Cache interface data: */ 154 m_ cache.cacheCurrentData(interfaceData);267 m_pCache->cacheCurrentData(interfaceData); 155 268 } 156 269 … … 161 274 162 275 /* Make sure machine is in valid mode & interface data was changed: */ 163 if (isMachineInValidMode() && m_ cache.wasChanged())276 if (isMachineInValidMode() && m_pCache->wasChanged()) 164 277 { 165 278 /* Get interface data from cache: */ 166 const UIDataSettingsMachineInterface &interfaceData = m_ cache.data();279 const UIDataSettingsMachineInterface &interfaceData = m_pCache->data(); 167 280 168 281 /* Store interface data: */ … … 249 362 /* Destroy personal action-pool: */ 250 363 UIActionPool::destroy(m_pActionPool); 251 } 252 364 365 /* Cleanup cache: */ 366 delete m_pCache; 367 m_pCache = 0; 368 } 369 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
r66176 r66183 25 25 /* Forward declarations: */ 26 26 class UIActionPool; 27 28 29 /** Machine settings: User Interface page data structure. */ 30 struct UIDataSettingsMachineInterface 31 { 32 /** Constructs data. */ 33 UIDataSettingsMachineInterface() 34 : m_fStatusBarEnabled(false) 35 #ifndef VBOX_WS_MAC 36 , m_fMenuBarEnabled(false) 37 #endif /* !VBOX_WS_MAC */ 38 , m_restrictionsOfMenuBar(UIExtraDataMetaDefs::MenuType_Invalid) 39 , m_restrictionsOfMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Invalid) 40 , m_restrictionsOfMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid) 41 , m_restrictionsOfMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid) 42 , m_restrictionsOfMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid) 43 , m_restrictionsOfMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid) 44 #ifdef VBOX_WITH_DEBUGGER_GUI 45 , m_restrictionsOfMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid) 46 #endif /* VBOX_WITH_DEBUGGER_GUI */ 47 #ifdef VBOX_WS_MAC 48 , m_restrictionsOfMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType_Invalid) 49 #endif /* VBOX_WS_MAC */ 50 , m_restrictionsOfMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Invalid) 51 #ifndef VBOX_WS_MAC 52 , m_fShowMiniToolBar(false) 53 , m_fMiniToolBarAtTop(false) 54 #endif /* !VBOX_WS_MAC */ 55 {} 56 57 /** Returns whether the @a other passed data is equal to this one. */ 58 bool equal(const UIDataSettingsMachineInterface &other) const 59 { 60 return true 61 && (m_fStatusBarEnabled == other.m_fStatusBarEnabled) 62 && (m_statusBarRestrictions == other.m_statusBarRestrictions) 63 && (m_statusBarOrder == other.m_statusBarOrder) 64 #ifndef VBOX_WS_MAC 65 && (m_fMenuBarEnabled == other.m_fMenuBarEnabled) 66 #endif /* !VBOX_WS_MAC */ 67 && (m_restrictionsOfMenuBar == other.m_restrictionsOfMenuBar) 68 && (m_restrictionsOfMenuApplication == other.m_restrictionsOfMenuApplication) 69 && (m_restrictionsOfMenuMachine == other.m_restrictionsOfMenuMachine) 70 && (m_restrictionsOfMenuView == other.m_restrictionsOfMenuView) 71 && (m_restrictionsOfMenuInput == other.m_restrictionsOfMenuInput) 72 && (m_restrictionsOfMenuDevices == other.m_restrictionsOfMenuDevices) 73 #ifdef VBOX_WITH_DEBUGGER_GUI 74 && (m_restrictionsOfMenuDebug == other.m_restrictionsOfMenuDebug) 75 #endif /* VBOX_WITH_DEBUGGER_GUI */ 76 #ifdef VBOX_WS_MAC 77 && (m_restrictionsOfMenuWindow == other.m_restrictionsOfMenuWindow) 78 #endif /* VBOX_WS_MAC */ 79 && (m_restrictionsOfMenuHelp == other.m_restrictionsOfMenuHelp) 80 #ifndef VBOX_WS_MAC 81 && (m_fShowMiniToolBar == other.m_fShowMiniToolBar) 82 && (m_fMiniToolBarAtTop == other.m_fMiniToolBarAtTop) 83 #endif /* !VBOX_WS_MAC */ 84 ; 85 } 86 87 /** Returns whether the @a other passed data is equal to this one. */ 88 bool operator==(const UIDataSettingsMachineInterface &other) const { return equal(other); } 89 /** Returns whether the @a other passed data is different from this one. */ 90 bool operator!=(const UIDataSettingsMachineInterface &other) const { return !equal(other); } 91 92 /** Holds whether the status-bar is enabled. */ 93 bool m_fStatusBarEnabled; 94 /** Holds the status-bar indicator restrictions. */ 95 QList<IndicatorType> m_statusBarRestrictions; 96 /** Holds the status-bar indicator order. */ 97 QList<IndicatorType> m_statusBarOrder; 98 99 #ifndef VBOX_WS_MAC 100 /** Holds whether the menu-bar is enabled. */ 101 bool m_fMenuBarEnabled; 102 #endif /* !VBOX_WS_MAC */ 103 /** Holds the menu-bar menu restrictions. */ 104 UIExtraDataMetaDefs::MenuType m_restrictionsOfMenuBar; 105 /** Holds the Application menu restrictions. */ 106 UIExtraDataMetaDefs::MenuApplicationActionType m_restrictionsOfMenuApplication; 107 /** Holds the Machine menu restrictions. */ 108 UIExtraDataMetaDefs::RuntimeMenuMachineActionType m_restrictionsOfMenuMachine; 109 /** Holds the View menu restrictions. */ 110 UIExtraDataMetaDefs::RuntimeMenuViewActionType m_restrictionsOfMenuView; 111 /** Holds the Input menu restrictions. */ 112 UIExtraDataMetaDefs::RuntimeMenuInputActionType m_restrictionsOfMenuInput; 113 /** Holds the Devices menu restrictions. */ 114 UIExtraDataMetaDefs::RuntimeMenuDevicesActionType m_restrictionsOfMenuDevices; 115 #ifdef VBOX_WITH_DEBUGGER_GUI 116 /** Holds the Debug menu restrictions. */ 117 UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType m_restrictionsOfMenuDebug; 118 #endif /* VBOX_WITH_DEBUGGER_GUI */ 119 #ifdef VBOX_WS_MAC 120 /** Holds the Window menu restrictions. */ 121 UIExtraDataMetaDefs::MenuWindowActionType m_restrictionsOfMenuWindow; 122 #endif /* VBOX_WS_MAC */ 123 /** Holds the Help menu restrictions. */ 124 UIExtraDataMetaDefs::MenuHelpActionType m_restrictionsOfMenuHelp; 125 126 #ifndef VBOX_WS_MAC 127 /** Holds whether the mini-toolbar is enabled. */ 128 bool m_fShowMiniToolBar; 129 /** Holds whether the mini-toolbar should be aligned at top of screen. */ 130 bool m_fMiniToolBarAtTop; 131 #endif /* !VBOX_WS_MAC */ 132 }; 27 struct UIDataSettingsMachineInterface; 133 28 typedef UISettingsCache<UIDataSettingsMachineInterface> UISettingsCacheMachineInterface; 134 29 … … 142 37 public: 143 38 144 /** Construct or, early takes @a strMachineID into account for size-hint calculation. */39 /** Constructs User Interface settings page. */ 145 40 UIMachineSettingsInterface(const QString strMachineID); 146 /** Destruct or. */41 /** Destructs User Interface settings page. */ 147 42 ~UIMachineSettingsInterface(); 148 43 … … 150 45 151 46 /** Returns whether the page content was changed. */ 152 bool changed() const { return m_cache.wasChanged(); }47 bool changed() const /* override */; 153 48 154 49 /** Loads data into the cache from corresponding external object(s), … … 183 78 void cleanup(); 184 79 185 /* Cache: */186 UISettingsCacheMachineInterface m_cache;187 188 80 /** Holds the machine ID copy. */ 189 81 const QString m_strMachineID; 190 82 /** Holds the action-pool instance. */ 191 83 UIActionPool *m_pActionPool; 84 85 /** Holds the page data cache instance. */ 86 UISettingsCacheMachineInterface *m_pCache; 192 87 }; 193 88 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2008-201 6Oracle Corporation7 * Copyright (C) 2008-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 22 22 /* GUI includes: */ 23 # include "QIArrowButtonSwitch.h" 24 # include "QITabWidget.h" 23 25 # include "QIWidgetValidator.h" 24 # include "QIArrowButtonSwitch.h"25 # include "UIMachineSettingsNetwork.h"26 # include "QITabWidget.h"27 # include "VBoxGlobal.h"28 26 # include "UIConverter.h" 29 27 # include "UIIconPool.h" 28 # include "UIMachineSettingsNetwork.h" 29 # include "VBoxGlobal.h" 30 30 31 31 /* COM includes: */ … … 52 52 return strInputString.isEmpty() ? QString() : strInputString; 53 53 } 54 55 56 /** Machine settings: Network Adapter data structure. */ 57 struct UIDataSettingsMachineNetworkAdapter 58 { 59 /** Constructs data. */ 60 UIDataSettingsMachineNetworkAdapter() 61 : m_iSlot(0) 62 , m_fAdapterEnabled(false) 63 , m_adapterType(KNetworkAdapterType_Null) 64 , m_attachmentType(KNetworkAttachmentType_Null) 65 , m_promiscuousMode(KNetworkAdapterPromiscModePolicy_Deny) 66 , m_strBridgedAdapterName(QString()) 67 , m_strInternalNetworkName(QString()) 68 , m_strHostInterfaceName(QString()) 69 , m_strGenericDriverName(QString()) 70 , m_strGenericProperties(QString()) 71 , m_strNATNetworkName(QString()) 72 , m_strMACAddress(QString()) 73 , m_fCableConnected(false) 74 , m_redirects(UIPortForwardingDataList()) 75 {} 76 77 /** Returns whether the @a other passed data is equal to this one. */ 78 bool equal(const UIDataSettingsMachineNetworkAdapter &other) const 79 { 80 return true 81 && (m_iSlot == other.m_iSlot) 82 && (m_fAdapterEnabled == other.m_fAdapterEnabled) 83 && (m_adapterType == other.m_adapterType) 84 && (m_attachmentType == other.m_attachmentType) 85 && (m_promiscuousMode == other.m_promiscuousMode) 86 && (m_strBridgedAdapterName == other.m_strBridgedAdapterName) 87 && (m_strInternalNetworkName == other.m_strInternalNetworkName) 88 && (m_strHostInterfaceName == other.m_strHostInterfaceName) 89 && (m_strGenericDriverName == other.m_strGenericDriverName) 90 && (m_strGenericProperties == other.m_strGenericProperties) 91 && (m_strNATNetworkName == other.m_strNATNetworkName) 92 && (m_strMACAddress == other.m_strMACAddress) 93 && (m_fCableConnected == other.m_fCableConnected) 94 && (m_redirects == other.m_redirects) 95 ; 96 } 97 98 /** Returns whether the @a other passed data is equal to this one. */ 99 bool operator==(const UIDataSettingsMachineNetworkAdapter &other) const { return equal(other); } 100 /** Returns whether the @a other passed data is different from this one. */ 101 bool operator!=(const UIDataSettingsMachineNetworkAdapter &other) const { return !equal(other); } 102 103 /** Holds the network adapter slot number. */ 104 int m_iSlot; 105 /** Holds whether the network adapter is enabled. */ 106 bool m_fAdapterEnabled; 107 /** Holds the network adapter type. */ 108 KNetworkAdapterType m_adapterType; 109 /** Holds the network attachment type. */ 110 KNetworkAttachmentType m_attachmentType; 111 /** Holds the network promiscuous mode policy. */ 112 KNetworkAdapterPromiscModePolicy m_promiscuousMode; 113 /** Holds the bridged adapter name. */ 114 QString m_strBridgedAdapterName; 115 /** Holds the internal network name. */ 116 QString m_strInternalNetworkName; 117 /** Holds the host interface name. */ 118 QString m_strHostInterfaceName; 119 /** Holds the generic driver name. */ 120 QString m_strGenericDriverName; 121 /** Holds the generic driver properties. */ 122 QString m_strGenericProperties; 123 /** Holds the NAT network name. */ 124 QString m_strNATNetworkName; 125 /** Holds the network adapter MAC address. */ 126 QString m_strMACAddress; 127 /** Holds whether the network adapter is connected. */ 128 bool m_fCableConnected; 129 /** Holds the set of network redirection rules. */ 130 UIPortForwardingDataList m_redirects; 131 }; 132 133 134 /** Machine settings: Network page data structure. */ 135 struct UIDataSettingsMachineNetwork 136 { 137 /** Constructs data. */ 138 UIDataSettingsMachineNetwork() {} 139 140 /** Returns whether the @a other passed data is equal to this one. */ 141 bool operator==(const UIDataSettingsMachineNetwork & /* other */) const { return true; } 142 /** Returns whether the @a other passed data is different from this one. */ 143 bool operator!=(const UIDataSettingsMachineNetwork & /* other */) const { return false; } 144 }; 145 146 147 /** Machine settings: Network Adapter tab. */ 148 class UIMachineSettingsNetwork : public QIWithRetranslateUI<QWidget>, 149 public Ui::UIMachineSettingsNetwork 150 { 151 Q_OBJECT; 152 153 public: 154 155 /* Constructor: */ 156 UIMachineSettingsNetwork(UIMachineSettingsNetworkPage *pParent); 157 158 /* Load / Save API: */ 159 void fetchAdapterCache(const UISettingsCacheMachineNetworkAdapter &adapterCache); 160 void uploadAdapterCache(UISettingsCacheMachineNetworkAdapter &adapterCache); 161 162 /** Performs validation, updates @a messages list if something is wrong. */ 163 bool validate(QList<UIValidationMessage> &messages); 164 165 /* Navigation stuff: */ 166 QWidget* setOrderAfter(QWidget *pAfter); 167 168 /* Other public stuff: */ 169 QString tabTitle() const; 170 KNetworkAttachmentType attachmentType() const; 171 QString alternativeName(int iType = -1) const; 172 void polishTab(); 173 void reloadAlternative(); 174 175 /** Defines whether the advanced button is @a fExpanded. */ 176 void setAdvancedButtonState(bool fExpanded); 177 178 signals: 179 180 /* Signal to notify listeners about tab content changed: */ 181 void sigTabUpdated(); 182 183 /** Notifies about the advanced button has @a fExpanded. */ 184 void sigNotifyAdvancedButtonStateChange(bool fExpanded); 185 186 protected: 187 188 /** Handles translation event. */ 189 void retranslateUi(); 190 191 private slots: 192 193 /* Different handlers: */ 194 void sltHandleAdapterActivityChange(); 195 void sltHandleAttachmentTypeChange(); 196 void sltHandleAlternativeNameChange(); 197 void sltHandleAdvancedButtonStateChange(); 198 void sltGenerateMac(); 199 void sltOpenPortForwardingDlg(); 200 201 private: 202 203 /* Helper: Prepare stuff: */ 204 void prepareValidation(); 205 206 /* Helping stuff: */ 207 void populateComboboxes(); 208 void updateAlternativeList(); 209 void updateAlternativeName(); 210 211 /** Handles advanced button state change. */ 212 void handleAdvancedButtonStateChange(); 213 214 /* Various static stuff: */ 215 static int position(QComboBox *pComboBox, int iData); 216 static int position(QComboBox *pComboBox, const QString &strText); 217 218 /* Parent page: */ 219 UIMachineSettingsNetworkPage *m_pParent; 220 221 /* Other variables: */ 222 int m_iSlot; 223 QString m_strBridgedAdapterName; 224 QString m_strInternalNetworkName; 225 QString m_strHostInterfaceName; 226 QString m_strGenericDriverName; 227 QString m_strNATNetworkName; 228 UIPortForwardingDataList m_portForwardingRules; 229 }; 230 54 231 55 232 UIMachineSettingsNetwork::UIMachineSettingsNetwork(UIMachineSettingsNetworkPage *pParent) … … 816 993 UIMachineSettingsNetworkPage::UIMachineSettingsNetworkPage() 817 994 : m_pTwAdapters(0) 995 , m_pCache(new UISettingsCacheMachineNetwork) 818 996 { 819 997 /* Setup main layout: */ … … 842 1020 } 843 1021 1022 UIMachineSettingsNetworkPage::~UIMachineSettingsNetworkPage() 1023 { 1024 /* Cleanup cache: */ 1025 delete m_pCache; 1026 m_pCache = 0; 1027 } 1028 1029 bool UIMachineSettingsNetworkPage::changed() const 1030 { 1031 return m_pCache->wasChanged(); 1032 } 1033 844 1034 void UIMachineSettingsNetworkPage::loadToCacheFrom(QVariant &data) 845 1035 { … … 848 1038 849 1039 /* Clear cache initially: */ 850 m_ cache.clear();1040 m_pCache->clear(); 851 1041 852 1042 /* Cache name lists: */ … … 900 1090 901 1091 /* Cache adapter data: */ 902 m_ cache.child(iSlot).cacheInitialData(adapterData);1092 m_pCache->child(iSlot).cacheInitialData(adapterData); 903 1093 } 904 1094 … … 921 1111 922 1112 /* Load adapter data to page: */ 923 pTab->fetchAdapterCache(m_ cache.child(iSlot));1113 pTab->fetchAdapterCache(m_pCache->child(iSlot)); 924 1114 925 1115 /* Setup tab order: */ … … 946 1136 947 1137 /* Gather & cache adapter data: */ 948 pTab->uploadAdapterCache(m_ cache.child(iSlot));1138 pTab->uploadAdapterCache(m_pCache->child(iSlot)); 949 1139 } 950 1140 } … … 956 1146 957 1147 /* Check if network data was changed: */ 958 if (m_ cache.wasChanged())1148 if (m_pCache->wasChanged()) 959 1149 { 960 1150 /* For each network adapter: */ … … 962 1152 { 963 1153 /* Check if adapter data was changed: */ 964 const UISettingsCacheMachineNetworkAdapter &adapterCache = m_ cache.child(iSlot);1154 const UISettingsCacheMachineNetworkAdapter &adapterCache = m_pCache->child(iSlot); 965 1155 if (adapterCache.wasChanged()) 966 1156 { … … 1117 1307 m_pTwAdapters->setTabEnabled(iSlot, 1118 1308 isMachineOffline() || 1119 (isMachineInValidMode() && m_ cache.child(iSlot).base().m_fAdapterEnabled));1309 (isMachineInValidMode() && m_pCache->child(iSlot).base().m_fAdapterEnabled)); 1120 1310 UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot)); 1121 1311 pTab->polishTab(); … … 1272 1462 } 1273 1463 1464 # include "UIMachineSettingsNetwork.moc" 1465 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
r66176 r66183 25 25 26 26 /* Forward declarations: */ 27 class QITabWidget; 27 28 class UIMachineSettingsNetworkPage; 28 class QITabWidget; 29 30 31 /** Machine settings: Network Adapter data structure. */ 32 struct UIDataSettingsMachineNetworkAdapter 33 { 34 /** Constructs data. */ 35 UIDataSettingsMachineNetworkAdapter() 36 : m_iSlot(0) 37 , m_fAdapterEnabled(false) 38 , m_adapterType(KNetworkAdapterType_Null) 39 , m_attachmentType(KNetworkAttachmentType_Null) 40 , m_promiscuousMode(KNetworkAdapterPromiscModePolicy_Deny) 41 , m_strBridgedAdapterName(QString()) 42 , m_strInternalNetworkName(QString()) 43 , m_strHostInterfaceName(QString()) 44 , m_strGenericDriverName(QString()) 45 , m_strGenericProperties(QString()) 46 , m_strNATNetworkName(QString()) 47 , m_strMACAddress(QString()) 48 , m_fCableConnected(false) 49 , m_redirects(UIPortForwardingDataList()) 50 {} 51 52 /** Returns whether the @a other passed data is equal to this one. */ 53 bool equal(const UIDataSettingsMachineNetworkAdapter &other) const 54 { 55 return true 56 && (m_iSlot == other.m_iSlot) 57 && (m_fAdapterEnabled == other.m_fAdapterEnabled) 58 && (m_adapterType == other.m_adapterType) 59 && (m_attachmentType == other.m_attachmentType) 60 && (m_promiscuousMode == other.m_promiscuousMode) 61 && (m_strBridgedAdapterName == other.m_strBridgedAdapterName) 62 && (m_strInternalNetworkName == other.m_strInternalNetworkName) 63 && (m_strHostInterfaceName == other.m_strHostInterfaceName) 64 && (m_strGenericDriverName == other.m_strGenericDriverName) 65 && (m_strGenericProperties == other.m_strGenericProperties) 66 && (m_strNATNetworkName == other.m_strNATNetworkName) 67 && (m_strMACAddress == other.m_strMACAddress) 68 && (m_fCableConnected == other.m_fCableConnected) 69 && (m_redirects == other.m_redirects) 70 ; 71 } 72 73 /** Returns whether the @a other passed data is equal to this one. */ 74 bool operator==(const UIDataSettingsMachineNetworkAdapter &other) const { return equal(other); } 75 /** Returns whether the @a other passed data is different from this one. */ 76 bool operator!=(const UIDataSettingsMachineNetworkAdapter &other) const { return !equal(other); } 77 78 /** Holds the network adapter slot number. */ 79 int m_iSlot; 80 /** Holds whether the network adapter is enabled. */ 81 bool m_fAdapterEnabled; 82 /** Holds the network adapter type. */ 83 KNetworkAdapterType m_adapterType; 84 /** Holds the network attachment type. */ 85 KNetworkAttachmentType m_attachmentType; 86 /** Holds the network promiscuous mode policy. */ 87 KNetworkAdapterPromiscModePolicy m_promiscuousMode; 88 /** Holds the bridged adapter name. */ 89 QString m_strBridgedAdapterName; 90 /** Holds the internal network name. */ 91 QString m_strInternalNetworkName; 92 /** Holds the host interface name. */ 93 QString m_strHostInterfaceName; 94 /** Holds the generic driver name. */ 95 QString m_strGenericDriverName; 96 /** Holds the generic driver properties. */ 97 QString m_strGenericProperties; 98 /** Holds the NAT network name. */ 99 QString m_strNATNetworkName; 100 /** Holds the network adapter MAC address. */ 101 QString m_strMACAddress; 102 /** Holds whether the network adapter is connected. */ 103 bool m_fCableConnected; 104 /** Holds the set of network redirection rules. */ 105 UIPortForwardingDataList m_redirects; 106 }; 29 struct UIDataSettingsMachineNetwork; 30 struct UIDataSettingsMachineNetworkAdapter; 107 31 typedef UISettingsCache<UIDataSettingsMachineNetworkAdapter> UISettingsCacheMachineNetworkAdapter; 108 109 110 /** Machine settings: Network page data structure. */111 struct UIDataSettingsMachineNetwork112 {113 /** Constructs data. */114 UIDataSettingsMachineNetwork() {}115 116 /** Returns whether the @a other passed data is equal to this one. */117 bool operator==(const UIDataSettingsMachineNetwork & /* other */) const { return true; }118 /** Returns whether the @a other passed data is different from this one. */119 bool operator!=(const UIDataSettingsMachineNetwork & /* other */) const { return false; }120 };121 32 typedef UISettingsCachePool<UIDataSettingsMachineNetwork, UISettingsCacheMachineNetworkAdapter> UISettingsCacheMachineNetwork; 122 123 124 /** Machine settings: Network Adapter tab. */125 class UIMachineSettingsNetwork : public QIWithRetranslateUI<QWidget>,126 public Ui::UIMachineSettingsNetwork127 {128 Q_OBJECT;129 130 public:131 132 /* Constructor: */133 UIMachineSettingsNetwork(UIMachineSettingsNetworkPage *pParent);134 135 /* Load / Save API: */136 void fetchAdapterCache(const UISettingsCacheMachineNetworkAdapter &adapterCache);137 void uploadAdapterCache(UISettingsCacheMachineNetworkAdapter &adapterCache);138 139 /** Performs validation, updates @a messages list if something is wrong. */140 bool validate(QList<UIValidationMessage> &messages);141 142 /* Navigation stuff: */143 QWidget* setOrderAfter(QWidget *pAfter);144 145 /* Other public stuff: */146 QString tabTitle() const;147 KNetworkAttachmentType attachmentType() const;148 QString alternativeName(int iType = -1) const;149 void polishTab();150 void reloadAlternative();151 152 /** Defines whether the advanced button is @a fExpanded. */153 void setAdvancedButtonState(bool fExpanded);154 155 signals:156 157 /* Signal to notify listeners about tab content changed: */158 void sigTabUpdated();159 160 /** Notifies about the advanced button has @a fExpanded. */161 void sigNotifyAdvancedButtonStateChange(bool fExpanded);162 163 protected:164 165 /** Handles translation event. */166 void retranslateUi();167 168 private slots:169 170 /* Different handlers: */171 void sltHandleAdapterActivityChange();172 void sltHandleAttachmentTypeChange();173 void sltHandleAlternativeNameChange();174 void sltHandleAdvancedButtonStateChange();175 void sltGenerateMac();176 void sltOpenPortForwardingDlg();177 178 private:179 180 /* Helper: Prepare stuff: */181 void prepareValidation();182 183 /* Helping stuff: */184 void populateComboboxes();185 void updateAlternativeList();186 void updateAlternativeName();187 188 /** Handles advanced button state change. */189 void handleAdvancedButtonStateChange();190 191 /* Various static stuff: */192 static int position(QComboBox *pComboBox, int iData);193 static int position(QComboBox *pComboBox, const QString &strText);194 195 /* Parent page: */196 UIMachineSettingsNetworkPage *m_pParent;197 198 /* Other variables: */199 int m_iSlot;200 QString m_strBridgedAdapterName;201 QString m_strInternalNetworkName;202 QString m_strHostInterfaceName;203 QString m_strGenericDriverName;204 QString m_strNATNetworkName;205 UIPortForwardingDataList m_portForwardingRules;206 };207 33 208 34 … … 214 40 public: 215 41 216 /* Constructor:*/42 /** Constructs Network settings page. */ 217 43 UIMachineSettingsNetworkPage(); 44 /** Destructs Network settings page. */ 45 ~UIMachineSettingsNetworkPage(); 218 46 219 47 /* Bridged adapter list: */ … … 230 58 protected: 231 59 60 /** Returns whether the page content was changed. */ 61 bool changed() const /* override */; 62 232 63 /** Loads data into the cache from corresponding external object(s), 233 64 * this task COULD be performed in other than the GUI thread. */ … … 243 74 * this task COULD be performed in other than the GUI thread. */ 244 75 void saveFromCacheTo(QVariant &data); 245 246 /** Returns whether the page content was changed. */247 bool changed() const { return m_cache.wasChanged(); }248 76 249 77 /** Performs validation, updates @a messages list if something is wrong. */ … … 287 115 QStringList m_natNetworkList; 288 116 289 /* Cache:*/290 UISettingsCacheMachineNetwork m_cache;117 /** Holds the page data cache instance. */ 118 UISettingsCacheMachineNetwork *m_pCache; 291 119 }; 292 120 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 25 25 /* GUI includes: */ 26 # include "QIWidgetValidator.h" 27 # include "QITabWidget.h" 26 28 # include "UIMachineSettingsParallel.h" 27 # include "QIWidgetValidator.h"28 29 # include "VBoxGlobal.h" 29 # include "QITabWidget.h"30 30 31 31 /* COM includes: */ … … 33 33 34 34 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 35 36 37 /** Machine settings: Parallel Port tab data structure. */ 38 struct UIDataSettingsMachineParallelPort 39 { 40 /** Constructs data. */ 41 UIDataSettingsMachineParallelPort() 42 : m_iSlot(-1) 43 , m_fPortEnabled(false) 44 , m_uIRQ(0) 45 , m_uIOBase(0) 46 , m_strPath(QString()) 47 {} 48 49 /** Returns whether the @a other passed data is equal to this one. */ 50 bool equal(const UIDataSettingsMachineParallelPort &other) const 51 { 52 return true 53 && (m_iSlot == other.m_iSlot) 54 && (m_fPortEnabled == other.m_fPortEnabled) 55 && (m_uIRQ == other.m_uIRQ) 56 && (m_uIOBase == other.m_uIOBase) 57 && (m_strPath == other.m_strPath) 58 ; 59 } 60 61 /** Returns whether the @a other passed data is equal to this one. */ 62 bool operator==(const UIDataSettingsMachineParallelPort &other) const { return equal(other); } 63 /** Returns whether the @a other passed data is different from this one. */ 64 bool operator!=(const UIDataSettingsMachineParallelPort &other) const { return !equal(other); } 65 66 /** Holds the parallel port slot number. */ 67 int m_iSlot; 68 /** Holds whether the parallel port is enabled. */ 69 bool m_fPortEnabled; 70 /** Holds the parallel port IRQ. */ 71 ulong m_uIRQ; 72 /** Holds the parallel port IO base. */ 73 ulong m_uIOBase; 74 /** Holds the parallel port path. */ 75 QString m_strPath; 76 }; 77 78 79 /** Machine settings: Parallel page data structure. */ 80 struct UIDataSettingsMachineParallel 81 { 82 /** Constructs data. */ 83 UIDataSettingsMachineParallel() {} 84 85 /** Returns whether the @a other passed data is equal to this one. */ 86 bool operator==(const UIDataSettingsMachineParallel & /* other */) const { return true; } 87 /** Returns whether the @a other passed data is different from this one. */ 88 bool operator!=(const UIDataSettingsMachineParallel & /* other */) const { return false; } 89 }; 90 91 92 /** Machine settings: Parallel Port tab. */ 93 class UIMachineSettingsParallel : public QIWithRetranslateUI<QWidget>, 94 public Ui::UIMachineSettingsParallel 95 { 96 Q_OBJECT; 97 98 public: 99 100 UIMachineSettingsParallel(UIMachineSettingsParallelPage *pParent); 101 102 void polishTab(); 103 104 void fetchPortData(const UISettingsCacheMachineParallelPort &portCache); 105 void uploadPortData(UISettingsCacheMachineParallelPort &portCache); 106 107 QWidget* setOrderAfter (QWidget *aAfter); 108 109 QString pageTitle() const; 110 bool isUserDefined(); 111 112 protected: 113 114 void retranslateUi(); 115 116 private slots: 117 118 void mGbParallelToggled (bool aOn); 119 void mCbNumberActivated (const QString &aText); 120 121 private: 122 123 /* Helper: Prepare stuff: */ 124 void prepareValidation(); 125 126 UIMachineSettingsParallelPage *m_pParent; 127 int m_iSlot; 128 }; 35 129 36 130 … … 188 282 UIMachineSettingsParallelPage::UIMachineSettingsParallelPage() 189 283 : mTabWidget(0) 284 , m_pCache(new UISettingsCacheMachineParallel) 190 285 { 191 286 /* TabWidget creation */ … … 206 301 } 207 302 303 UIMachineSettingsParallelPage::~UIMachineSettingsParallelPage() 304 { 305 /* Cleanup cache: */ 306 delete m_pCache; 307 m_pCache = 0; 308 } 309 310 bool UIMachineSettingsParallelPage::changed() const 311 { 312 return m_pCache->wasChanged(); 313 } 314 208 315 void UIMachineSettingsParallelPage::loadToCacheFrom(QVariant &data) 209 316 { … … 212 319 213 320 /* Clear cache initially: */ 214 m_ cache.clear();321 m_pCache->clear(); 215 322 216 323 /* For each parallel port: */ … … 233 340 234 341 /* Cache port data: */ 235 m_ cache.child(iSlot).cacheInitialData(portData);342 m_pCache->child(iSlot).cacheInitialData(portData); 236 343 } 237 344 … … 254 361 255 362 /* Load port data to page: */ 256 pPage->fetchPortData(m_ cache.child(iPort));363 pPage->fetchPortData(m_pCache->child(iPort)); 257 364 258 365 /* Setup tab order: */ … … 279 386 280 387 /* Gather & cache port data: */ 281 pPage->uploadPortData(m_ cache.child(iPort));388 pPage->uploadPortData(m_pCache->child(iPort)); 282 389 } 283 390 } … … 289 396 290 397 /* Check if ports data was changed: */ 291 if (m_ cache.wasChanged())398 if (m_pCache->wasChanged()) 292 399 { 293 400 /* For each parallel port: */ … … 295 402 { 296 403 /* Check if port data was changed: */ 297 const UISettingsCacheMachineParallelPort &portCache = m_ cache.child(iPort);404 const UISettingsCacheMachineParallelPort &portCache = m_pCache->child(iPort); 298 405 if (portCache.wasChanged()) 299 406 { … … 405 512 mTabWidget->setTabEnabled(iPort, 406 513 isMachineOffline() || 407 (isMachineInValidMode() && m_ cache.child(iPort).base().m_fPortEnabled));514 (isMachineInValidMode() && m_pCache->child(iPort).base().m_fPortEnabled)); 408 515 UIMachineSettingsParallel *pTab = qobject_cast<UIMachineSettingsParallel*>(mTabWidget->widget(iPort)); 409 516 pTab->polishTab(); … … 411 518 } 412 519 520 # include "UIMachineSettingsParallel.moc" 521 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h
r66176 r66183 24 24 25 25 /* Forward declarations: */ 26 class QITabWidget; 26 27 class UIMachineSettingsParallelPage; 27 class QITabWidget; 28 29 30 /** Machine settings: Parallel Port tab data structure. */ 31 struct UIDataSettingsMachineParallelPort 32 { 33 /** Constructs data. */ 34 UIDataSettingsMachineParallelPort() 35 : m_iSlot(-1) 36 , m_fPortEnabled(false) 37 , m_uIRQ(0) 38 , m_uIOBase(0) 39 , m_strPath(QString()) 40 {} 41 42 /** Returns whether the @a other passed data is equal to this one. */ 43 bool equal(const UIDataSettingsMachineParallelPort &other) const 44 { 45 return true 46 && (m_iSlot == other.m_iSlot) 47 && (m_fPortEnabled == other.m_fPortEnabled) 48 && (m_uIRQ == other.m_uIRQ) 49 && (m_uIOBase == other.m_uIOBase) 50 && (m_strPath == other.m_strPath) 51 ; 52 } 53 54 /** Returns whether the @a other passed data is equal to this one. */ 55 bool operator==(const UIDataSettingsMachineParallelPort &other) const { return equal(other); } 56 /** Returns whether the @a other passed data is different from this one. */ 57 bool operator!=(const UIDataSettingsMachineParallelPort &other) const { return !equal(other); } 58 59 /** Holds the parallel port slot number. */ 60 int m_iSlot; 61 /** Holds whether the parallel port is enabled. */ 62 bool m_fPortEnabled; 63 /** Holds the parallel port IRQ. */ 64 ulong m_uIRQ; 65 /** Holds the parallel port IO base. */ 66 ulong m_uIOBase; 67 /** Holds the parallel port path. */ 68 QString m_strPath; 69 }; 28 struct UIDataSettingsMachineParallel; 29 struct UIDataSettingsMachineParallelPort; 70 30 typedef UISettingsCache<UIDataSettingsMachineParallelPort> UISettingsCacheMachineParallelPort; 71 72 73 /** Machine settings: Parallel page data structure. */74 struct UIDataSettingsMachineParallel75 {76 /** Constructs data. */77 UIDataSettingsMachineParallel() {}78 79 /** Returns whether the @a other passed data is equal to this one. */80 bool operator==(const UIDataSettingsMachineParallel & /* other */) const { return true; }81 /** Returns whether the @a other passed data is different from this one. */82 bool operator!=(const UIDataSettingsMachineParallel & /* other */) const { return false; }83 };84 31 typedef UISettingsCachePool<UIDataSettingsMachineParallel, UISettingsCacheMachineParallelPort> UISettingsCacheMachineParallel; 85 86 87 /** Machine settings: Parallel Port tab. */88 class UIMachineSettingsParallel : public QIWithRetranslateUI<QWidget>,89 public Ui::UIMachineSettingsParallel90 {91 Q_OBJECT;92 93 public:94 95 UIMachineSettingsParallel(UIMachineSettingsParallelPage *pParent);96 97 void polishTab();98 99 void fetchPortData(const UISettingsCacheMachineParallelPort &portCache);100 void uploadPortData(UISettingsCacheMachineParallelPort &portCache);101 102 QWidget* setOrderAfter (QWidget *aAfter);103 104 QString pageTitle() const;105 bool isUserDefined();106 107 protected:108 109 void retranslateUi();110 111 private slots:112 113 void mGbParallelToggled (bool aOn);114 void mCbNumberActivated (const QString &aText);115 116 private:117 118 /* Helper: Prepare stuff: */119 void prepareValidation();120 121 UIMachineSettingsParallelPage *m_pParent;122 int m_iSlot;123 };124 32 125 33 … … 131 39 public: 132 40 41 /** Constructs Parallel settings page. */ 133 42 UIMachineSettingsParallelPage(); 43 /** Destructs Parallel settings page. */ 44 ~UIMachineSettingsParallelPage(); 134 45 135 46 protected: 47 48 /** Returns whether the page content was changed. */ 49 bool changed() const /* override */; 136 50 137 51 /** Loads data into the cache from corresponding external object(s), … … 149 63 void saveFromCacheTo(QVariant &data); 150 64 151 /** Returns whether the page content was changed. */152 bool changed() const { return m_cache.wasChanged(); }153 154 65 /** Performs validation, updates @a messages list if something is wrong. */ 155 66 bool validate(QList<UIValidationMessage> &messages); … … 164 75 QITabWidget *mTabWidget; 165 76 166 /* Cache:*/167 UISettingsCacheMachineParallel m_cache;77 /** Holds the page data cache instance. */ 78 UISettingsCacheMachineParallel *m_pCache; 168 79 }; 169 80 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2008-201 6Oracle Corporation7 * Copyright (C) 2008-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Local includes */ 22 /* Qt includes: */ 23 # include <QHeaderView> 24 # include <QTimer> 25 26 /* GUI includes: */ 23 27 # include "UIIconPool.h" 24 # include "VBoxGlobal.h"25 # include "UIMessageCenter.h"26 # include "VBoxUtils.h"27 28 # include "UIMachineSettingsSF.h" 28 29 # include "UIMachineSettingsSFDetails.h" 29 30 /* Global includes */ 31 # include <QHeaderView> 32 # include <QTimer> 30 # include "UIMessageCenter.h" 31 # include "VBoxGlobal.h" 32 # include "VBoxUtils.h" 33 33 34 34 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 35 36 37 /** Machine settings: Shared Folder data structure. */ 38 struct UIDataSettingsSharedFolder 39 { 40 /** Constructs data. */ 41 UIDataSettingsSharedFolder() 42 : m_type(MachineType) 43 , m_strName(QString()) 44 , m_strHostPath(QString()) 45 , m_fAutoMount(false) 46 , m_fWritable(false) 47 {} 48 49 /** Returns whether the @a other passed data is equal to this one. */ 50 bool equal(const UIDataSettingsSharedFolder &other) const 51 { 52 return true 53 && (m_type == other.m_type) 54 && (m_strName == other.m_strName) 55 && (m_strHostPath == other.m_strHostPath) 56 && (m_fAutoMount == other.m_fAutoMount) 57 && (m_fWritable == other.m_fWritable) 58 ; 59 } 60 61 /** Returns whether the @a other passed data is equal to this one. */ 62 bool operator==(const UIDataSettingsSharedFolder &other) const { return equal(other); } 63 /** Returns whether the @a other passed data is different from this one. */ 64 bool operator!=(const UIDataSettingsSharedFolder &other) const { return !equal(other); } 65 66 /** Holds the shared folder type. */ 67 UISharedFolderType m_type; 68 /** Holds the shared folder name. */ 69 QString m_strName; 70 /** Holds the shared folder path. */ 71 QString m_strHostPath; 72 /** Holds whether the shared folder should be auto-mounted at startup. */ 73 bool m_fAutoMount; 74 /** Holds whether the shared folder should be writeable. */ 75 bool m_fWritable; 76 }; 77 78 79 /** Machine settings: Shared Folders page data structure. */ 80 struct UIDataSettingsSharedFolders 81 { 82 /** Constructs data. */ 83 UIDataSettingsSharedFolders() {} 84 85 /** Returns whether the @a other passed data is equal to this one. */ 86 bool operator==(const UIDataSettingsSharedFolders & /* other */) const { return true; } 87 /** Returns whether the @a other passed data is different from this one. */ 88 bool operator!=(const UIDataSettingsSharedFolders & /* other */) const { return false; } 89 }; 35 90 36 91 … … 183 238 UIMachineSettingsSF::UIMachineSettingsSF() 184 239 : mNewAction(0), mEdtAction(0), mDelAction(0) 240 , m_pCache(new UISettingsCacheSharedFolders) 185 241 { 186 242 /* Apply UI decorations */ … … 233 289 } 234 290 291 UIMachineSettingsSF::~UIMachineSettingsSF() 292 { 293 /* Cleanup cache: */ 294 delete m_pCache; 295 m_pCache = 0; 296 } 297 235 298 void UIMachineSettingsSF::resizeEvent (QResizeEvent *aEvent) 236 299 { … … 239 302 } 240 303 304 bool UIMachineSettingsSF::changed() const 305 { 306 return m_pCache->wasChanged(); 307 } 308 241 309 void UIMachineSettingsSF::loadToCacheFrom(QVariant &data) 242 310 { … … 245 313 246 314 /* Clear cache initially: */ 247 m_ cache.clear();315 m_pCache->clear(); 248 316 249 317 /* Load machine (permanent) shared folders into shared folders cache if possible: */ … … 285 353 286 354 /* Cache shared folder data: */ 287 m_ cache.child(strSharedFolderKey).cacheInitialData(sharedFolderData);355 m_pCache->child(strSharedFolderKey).cacheInitialData(sharedFolderData); 288 356 } 289 357 } … … 298 366 299 367 /* Load shared folders data: */ 300 for (int iFolderIndex = 0; iFolderIndex < m_ cache.childCount(); ++iFolderIndex)368 for (int iFolderIndex = 0; iFolderIndex < m_pCache->childCount(); ++iFolderIndex) 301 369 { 302 370 /* Get shared folder data: */ 303 const UIDataSettingsSharedFolder &sharedFolderData = m_ cache.child(iFolderIndex).base();371 const UIDataSettingsSharedFolder &sharedFolderData = m_pCache->child(iFolderIndex).base(); 304 372 /* Prepare item fields: */ 305 373 QStringList fields; … … 338 406 sharedFolderData.m_fAutoMount = pFolderItem->getText(2) == mTrYes ? true : false; 339 407 sharedFolderData.m_fWritable = pFolderItem->getText(3) == mTrFull ? true : false; 340 m_ cache.child(sharedFolderData.m_strName).cacheCurrentData(sharedFolderData);408 m_pCache->child(sharedFolderData.m_strName).cacheCurrentData(sharedFolderData); 341 409 } 342 410 } … … 349 417 350 418 /* Check if shared folders data was changed at all: */ 351 if (m_ cache.wasChanged())419 if (m_pCache->wasChanged()) 352 420 { 353 421 /* Save machine (permanent) shared folders if possible: */ … … 366 434 { 367 435 /* For each shared folder data set: */ 368 for (int iSharedFolderIndex = 0; iSharedFolderIndex < m_ cache.childCount(); ++iSharedFolderIndex)436 for (int iSharedFolderIndex = 0; iSharedFolderIndex < m_pCache->childCount(); ++iSharedFolderIndex) 369 437 { 370 438 /* Check if this shared folder data was actually changed: */ 371 const UISettingsCacheSharedFolder &sharedFolderCache = m_ cache.child(iSharedFolderIndex);439 const UISettingsCacheSharedFolder &sharedFolderCache = m_pCache->child(iSharedFolderIndex); 372 440 if (sharedFolderCache.wasChanged()) 373 441 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h
r66176 r66183 28 28 /* Forward declarations: */ 29 29 class SFTreeViewItem; 30 30 struct UIDataSettingsSharedFolder; 31 struct UIDataSettingsSharedFolders; 31 32 enum UISharedFolderType { MachineType, ConsoleType }; 32 typedef QPair <QString, UISharedFolderType> SFolderName;33 typedef QList <SFolderName> SFoldersNameList;34 35 36 /** Machine settings: Shared Folder data structure. */37 struct UIDataSettingsSharedFolder38 {39 /** Constructs data. */40 UIDataSettingsSharedFolder()41 : m_type(MachineType)42 , m_strName(QString())43 , m_strHostPath(QString())44 , m_fAutoMount(false)45 , m_fWritable(false)46 {}47 48 /** Returns whether the @a other passed data is equal to this one. */49 bool equal(const UIDataSettingsSharedFolder &other) const50 {51 return true52 && (m_type == other.m_type)53 && (m_strName == other.m_strName)54 && (m_strHostPath == other.m_strHostPath)55 && (m_fAutoMount == other.m_fAutoMount)56 && (m_fWritable == other.m_fWritable)57 ;58 }59 60 /** Returns whether the @a other passed data is equal to this one. */61 bool operator==(const UIDataSettingsSharedFolder &other) const { return equal(other); }62 /** Returns whether the @a other passed data is different from this one. */63 bool operator!=(const UIDataSettingsSharedFolder &other) const { return !equal(other); }64 65 /** Holds the shared folder type. */66 UISharedFolderType m_type;67 /** Holds the shared folder name. */68 QString m_strName;69 /** Holds the shared folder path. */70 QString m_strHostPath;71 /** Holds whether the shared folder should be auto-mounted at startup. */72 bool m_fAutoMount;73 /** Holds whether the shared folder should be writeable. */74 bool m_fWritable;75 };76 33 typedef UISettingsCache<UIDataSettingsSharedFolder> UISettingsCacheSharedFolder; 77 78 79 /** Machine settings: Shared Folders page data structure. */80 struct UIDataSettingsSharedFolders81 {82 /** Constructs data. */83 UIDataSettingsSharedFolders() {}84 85 /** Returns whether the @a other passed data is equal to this one. */86 bool operator==(const UIDataSettingsSharedFolders & /* other */) const { return true; }87 /** Returns whether the @a other passed data is different from this one. */88 bool operator!=(const UIDataSettingsSharedFolders & /* other */) const { return false; }89 };90 34 typedef UISettingsCachePool<UIDataSettingsSharedFolders, UISettingsCacheSharedFolder> UISettingsCacheSharedFolders; 35 typedef QPair<QString, UISharedFolderType> SFolderName; 36 typedef QList<SFolderName> SFoldersNameList; 91 37 92 38 … … 99 45 public: 100 46 47 /** Constructs Shared Folders settings page. */ 101 48 UIMachineSettingsSF(); 49 /** Destructs Shared Folders settings page. */ 50 ~UIMachineSettingsSF(); 102 51 103 52 protected: 53 54 /** Returns whether the page content was changed. */ 55 bool changed() const /* override */; 104 56 105 57 /** Loads data into the cache from corresponding external object(s), … … 120 72 * this task COULD be performed in other than the GUI thread. */ 121 73 void saveFromCacheTo(UISharedFolderType sharedFoldersType); 122 123 /** Returns whether the page content was changed. */124 bool changed() const { return m_cache.wasChanged(); }125 74 126 75 /** Defines TAB order. */ … … 170 119 QString mTrYes; 171 120 172 /* Cache:*/173 UISettingsCacheSharedFolders m_cache;121 /** Holds the page data cache instance. */ 122 UISettingsCacheSharedFolders *m_pCache; 174 123 }; 175 124 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 25 25 /* GUI includes: */ 26 # include "QITabWidget.h" 27 # include "QIWidgetValidator.h" 28 # include "UIConverter.h" 26 29 # include "UIMachineSettingsSerial.h" 27 # include "QIWidgetValidator.h"28 30 # include "VBoxGlobal.h" 29 # include "QITabWidget.h"30 # include "UIConverter.h"31 31 32 32 /* COM includes: */ … … 34 34 35 35 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 36 37 38 /** Machine settings: Serial Port tab data structure. */ 39 struct UIDataSettingsMachineSerialPort 40 { 41 /** Constructs data. */ 42 UIDataSettingsMachineSerialPort() 43 : m_iSlot(-1) 44 , m_fPortEnabled(false) 45 , m_uIRQ(0) 46 , m_uIOBase(0) 47 , m_hostMode(KPortMode_Disconnected) 48 , m_fServer(false) 49 , m_strPath(QString()) 50 {} 51 52 /** Returns whether the @a other passed data is equal to this one. */ 53 bool equal(const UIDataSettingsMachineSerialPort &other) const 54 { 55 return true 56 && (m_iSlot == other.m_iSlot) 57 && (m_fPortEnabled == other.m_fPortEnabled) 58 && (m_uIRQ == other.m_uIRQ) 59 && (m_uIOBase == other.m_uIOBase) 60 && (m_hostMode == other.m_hostMode) 61 && (m_fServer == other.m_fServer) 62 && (m_strPath == other.m_strPath) 63 ; 64 } 65 66 /** Returns whether the @a other passed data is equal to this one. */ 67 bool operator==(const UIDataSettingsMachineSerialPort &other) const { return equal(other); } 68 /** Returns whether the @a other passed data is different from this one. */ 69 bool operator!=(const UIDataSettingsMachineSerialPort &other) const { return !equal(other); } 70 71 /** Holds the serial port slot number. */ 72 int m_iSlot; 73 /** Holds whether the serial port is enabled. */ 74 bool m_fPortEnabled; 75 /** Holds the serial port IRQ. */ 76 ulong m_uIRQ; 77 /** Holds the serial port IO base. */ 78 ulong m_uIOBase; 79 /** Holds the serial port host mode. */ 80 KPortMode m_hostMode; 81 /** Holds whether the serial port is server. */ 82 bool m_fServer; 83 /** Holds the serial port path. */ 84 QString m_strPath; 85 }; 86 87 88 /** Machine settings: Serial page data structure. */ 89 struct UIDataSettingsMachineSerial 90 { 91 /** Constructs data. */ 92 UIDataSettingsMachineSerial() {} 93 94 /** Returns whether the @a other passed data is equal to this one. */ 95 bool operator==(const UIDataSettingsMachineSerial & /* other */) const { return true; } 96 /** Returns whether the @a other passed data is different from this one. */ 97 bool operator!=(const UIDataSettingsMachineSerial & /* other */) const { return false; } 98 }; 99 100 101 /** Machine settings: Serial Port tab. */ 102 class UIMachineSettingsSerial : public QIWithRetranslateUI<QWidget>, 103 public Ui::UIMachineSettingsSerial 104 { 105 Q_OBJECT; 106 107 public: 108 109 UIMachineSettingsSerial(UIMachineSettingsSerialPage *pParent); 110 111 void polishTab(); 112 113 void fetchPortData(const UISettingsCacheMachineSerialPort &data); 114 void uploadPortData(UISettingsCacheMachineSerialPort &data); 115 116 QWidget* setOrderAfter (QWidget *aAfter); 117 118 QString pageTitle() const; 119 bool isUserDefined(); 120 121 protected: 122 123 void retranslateUi(); 124 125 private slots: 126 127 void mGbSerialToggled (bool aOn); 128 void mCbNumberActivated (const QString &aText); 129 void mCbModeActivated (const QString &aText); 130 131 private: 132 133 /* Helper: Prepare stuff: */ 134 void prepareValidation(); 135 136 UIMachineSettingsSerialPage *m_pParent; 137 int m_iSlot; 138 }; 36 139 37 140 … … 227 330 UIMachineSettingsSerialPage::UIMachineSettingsSerialPage() 228 331 : mTabWidget(0) 332 , m_pCache(new UISettingsCacheMachineSerial) 229 333 { 230 334 /* TabWidget creation */ … … 245 349 } 246 350 351 UIMachineSettingsSerialPage::~UIMachineSettingsSerialPage() 352 { 353 /* Cleanup cache: */ 354 delete m_pCache; 355 m_pCache = 0; 356 } 357 358 bool UIMachineSettingsSerialPage::changed() const 359 { 360 return m_pCache->wasChanged(); 361 } 362 247 363 void UIMachineSettingsSerialPage::loadToCacheFrom(QVariant &data) 248 364 { … … 251 367 252 368 /* Clear cache initially: */ 253 m_ cache.clear();369 m_pCache->clear(); 254 370 255 371 /* For each serial port: */ … … 274 390 275 391 /* Cache port data: */ 276 m_ cache.child(iSlot).cacheInitialData(portData);392 m_pCache->child(iSlot).cacheInitialData(portData); 277 393 } 278 394 … … 295 411 296 412 /* Load port data to page: */ 297 pPage->fetchPortData(m_ cache.child(iPort));413 pPage->fetchPortData(m_pCache->child(iPort)); 298 414 299 415 /* Setup tab order: */ … … 320 436 321 437 /* Gather & cache port data: */ 322 pPage->uploadPortData(m_ cache.child(iPort));438 pPage->uploadPortData(m_pCache->child(iPort)); 323 439 } 324 440 } … … 330 446 331 447 /* Check if ports data was changed: */ 332 if (m_ cache.wasChanged())448 if (m_pCache->wasChanged()) 333 449 { 334 450 /* For each serial port: */ … … 336 452 { 337 453 /* Check if port data was changed: */ 338 const UISettingsCacheMachineSerialPort &portCache = m_ cache.child(iPort);454 const UISettingsCacheMachineSerialPort &portCache = m_pCache->child(iPort); 339 455 if (portCache.wasChanged()) 340 456 { … … 458 574 mTabWidget->setTabEnabled(iPort, 459 575 isMachineOffline() || 460 (isMachineInValidMode() && m_ cache.child(iPort).base().m_fPortEnabled));576 (isMachineInValidMode() && m_pCache->child(iPort).base().m_fPortEnabled)); 461 577 UIMachineSettingsSerial *pTab = qobject_cast<UIMachineSettingsSerial*>(mTabWidget->widget(iPort)); 462 578 pTab->polishTab(); … … 464 580 } 465 581 582 # include "UIMachineSettingsSerial.moc" 583 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
r66176 r66183 24 24 25 25 /* Forward declarations: */ 26 class QITabWidget; 26 27 class UIMachineSettingsSerialPage; 27 class QITabWidget; 28 29 30 /** Machine settings: Serial Port tab data structure. */ 31 struct UIDataSettingsMachineSerialPort 32 { 33 /** Constructs data. */ 34 UIDataSettingsMachineSerialPort() 35 : m_iSlot(-1) 36 , m_fPortEnabled(false) 37 , m_uIRQ(0) 38 , m_uIOBase(0) 39 , m_hostMode(KPortMode_Disconnected) 40 , m_fServer(false) 41 , m_strPath(QString()) 42 {} 43 44 /** Returns whether the @a other passed data is equal to this one. */ 45 bool equal(const UIDataSettingsMachineSerialPort &other) const 46 { 47 return true 48 && (m_iSlot == other.m_iSlot) 49 && (m_fPortEnabled == other.m_fPortEnabled) 50 && (m_uIRQ == other.m_uIRQ) 51 && (m_uIOBase == other.m_uIOBase) 52 && (m_hostMode == other.m_hostMode) 53 && (m_fServer == other.m_fServer) 54 && (m_strPath == other.m_strPath) 55 ; 56 } 57 58 /** Returns whether the @a other passed data is equal to this one. */ 59 bool operator==(const UIDataSettingsMachineSerialPort &other) const { return equal(other); } 60 /** Returns whether the @a other passed data is different from this one. */ 61 bool operator!=(const UIDataSettingsMachineSerialPort &other) const { return !equal(other); } 62 63 /** Holds the serial port slot number. */ 64 int m_iSlot; 65 /** Holds whether the serial port is enabled. */ 66 bool m_fPortEnabled; 67 /** Holds the serial port IRQ. */ 68 ulong m_uIRQ; 69 /** Holds the serial port IO base. */ 70 ulong m_uIOBase; 71 /** Holds the serial port host mode. */ 72 KPortMode m_hostMode; 73 /** Holds whether the serial port is server. */ 74 bool m_fServer; 75 /** Holds the serial port path. */ 76 QString m_strPath; 77 }; 28 struct UIDataSettingsMachineSerial; 29 struct UIDataSettingsMachineSerialPort; 78 30 typedef UISettingsCache<UIDataSettingsMachineSerialPort> UISettingsCacheMachineSerialPort; 79 80 81 /** Machine settings: Serial page data structure. */82 struct UIDataSettingsMachineSerial83 {84 /** Constructs data. */85 UIDataSettingsMachineSerial() {}86 87 /** Returns whether the @a other passed data is equal to this one. */88 bool operator==(const UIDataSettingsMachineSerial & /* other */) const { return true; }89 /** Returns whether the @a other passed data is different from this one. */90 bool operator!=(const UIDataSettingsMachineSerial & /* other */) const { return false; }91 };92 31 typedef UISettingsCachePool<UIDataSettingsMachineSerial, UISettingsCacheMachineSerialPort> UISettingsCacheMachineSerial; 93 94 95 /** Machine settings: Serial Port tab. */96 class UIMachineSettingsSerial : public QIWithRetranslateUI<QWidget>,97 public Ui::UIMachineSettingsSerial98 {99 Q_OBJECT;100 101 public:102 103 UIMachineSettingsSerial(UIMachineSettingsSerialPage *pParent);104 105 void polishTab();106 107 void fetchPortData(const UISettingsCacheMachineSerialPort &data);108 void uploadPortData(UISettingsCacheMachineSerialPort &data);109 110 QWidget* setOrderAfter (QWidget *aAfter);111 112 QString pageTitle() const;113 bool isUserDefined();114 115 protected:116 117 void retranslateUi();118 119 private slots:120 121 void mGbSerialToggled (bool aOn);122 void mCbNumberActivated (const QString &aText);123 void mCbModeActivated (const QString &aText);124 125 private:126 127 /* Helper: Prepare stuff: */128 void prepareValidation();129 130 UIMachineSettingsSerialPage *m_pParent;131 int m_iSlot;132 };133 32 134 33 … … 140 39 public: 141 40 41 /** Constructs Serial settings page. */ 142 42 UIMachineSettingsSerialPage(); 43 /** Destructs Serial settings page. */ 44 ~UIMachineSettingsSerialPage(); 143 45 144 46 protected: 47 48 /** Returns whether the page content was changed. */ 49 bool changed() const /* override */; 145 50 146 51 /** Loads data into the cache from corresponding external object(s), … … 158 63 void saveFromCacheTo(QVariant &data); 159 64 160 /** Returns whether the page content was changed. */161 bool changed() const { return m_cache.wasChanged(); }162 163 65 /** Performs validation, updates @a messages list if something is wrong. */ 164 66 bool validate(QList<UIValidationMessage> &messages); … … 173 75 QITabWidget *mTabWidget; 174 76 175 /* Cache:*/176 UISettingsCacheMachineSerial m_cache;77 /** Holds the page data cache instance. */ 78 UISettingsCacheMachineSerial *m_pCache; 177 79 }; 178 80 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r66163 r66183 54 54 return QString ("<nobr><compact elipsis=\"end\">%1</compact></nobr>").arg (aText); 55 55 } 56 57 58 /** Machine settings: Storage Attachment data structure. */ 59 struct UIDataSettingsMachineStorageAttachment 60 { 61 /** Constructs data. */ 62 UIDataSettingsMachineStorageAttachment() 63 : m_attachmentType(KDeviceType_Null) 64 , m_iAttachmentPort(-1) 65 , m_iAttachmentDevice(-1) 66 , m_strAttachmentMediumId(QString()) 67 , m_fAttachmentPassthrough(false) 68 , m_fAttachmentTempEject(false) 69 , m_fAttachmentNonRotational(false) 70 , m_fAttachmentHotPluggable(false) 71 {} 72 73 /** Returns whether the @a other passed data is equal to this one. */ 74 bool equal(const UIDataSettingsMachineStorageAttachment &other) const 75 { 76 return true 77 && (m_attachmentType == other.m_attachmentType) 78 && (m_iAttachmentPort == other.m_iAttachmentPort) 79 && (m_iAttachmentDevice == other.m_iAttachmentDevice) 80 && (m_strAttachmentMediumId == other.m_strAttachmentMediumId) 81 && (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough) 82 && (m_fAttachmentTempEject == other.m_fAttachmentTempEject) 83 && (m_fAttachmentNonRotational == other.m_fAttachmentNonRotational) 84 && (m_fAttachmentHotPluggable == other.m_fAttachmentHotPluggable) 85 ; 86 } 87 88 /** Returns whether the @a other passed data is equal to this one. */ 89 bool operator==(const UIDataSettingsMachineStorageAttachment &other) const { return equal(other); } 90 /** Returns whether the @a other passed data is different from this one. */ 91 bool operator!=(const UIDataSettingsMachineStorageAttachment &other) const { return !equal(other); } 92 93 /** Holds the attachment type. */ 94 KDeviceType m_attachmentType; 95 /** Holds the attachment port. */ 96 LONG m_iAttachmentPort; 97 /** Holds the attachment device. */ 98 LONG m_iAttachmentDevice; 99 /** Holds the attachment medium ID. */ 100 QString m_strAttachmentMediumId; 101 /** Holds whether the attachment being passed through. */ 102 bool m_fAttachmentPassthrough; 103 /** Holds whether the attachment being temporarily eject. */ 104 bool m_fAttachmentTempEject; 105 /** Holds whether the attachment is solid-state. */ 106 bool m_fAttachmentNonRotational; 107 /** Holds whether the attachment is hot-pluggable. */ 108 bool m_fAttachmentHotPluggable; 109 }; 110 111 112 /** Machine settings: Storage Controller data structure. */ 113 struct UIDataSettingsMachineStorageController 114 { 115 /** Constructs data. */ 116 UIDataSettingsMachineStorageController() 117 : m_strControllerName(QString()) 118 , m_controllerBus(KStorageBus_Null) 119 , m_controllerType(KStorageControllerType_Null) 120 , m_uPortCount(0) 121 , m_fUseHostIOCache(false) 122 {} 123 124 /** Returns whether the @a other passed data is equal to this one. */ 125 bool equal(const UIDataSettingsMachineStorageController &other) const 126 { 127 return true 128 && (m_strControllerName == other.m_strControllerName) 129 && (m_controllerBus == other.m_controllerBus) 130 && (m_controllerType == other.m_controllerType) 131 && (m_uPortCount == other.m_uPortCount) 132 && (m_fUseHostIOCache == other.m_fUseHostIOCache) 133 ; 134 } 135 136 /** Returns whether the @a other passed data is equal to this one. */ 137 bool operator==(const UIDataSettingsMachineStorageController &other) const { return equal(other); } 138 /** Returns whether the @a other passed data is different from this one. */ 139 bool operator!=(const UIDataSettingsMachineStorageController &other) const { return !equal(other); } 140 141 /** Holds the controller name. */ 142 QString m_strControllerName; 143 /** Holds the controller bus. */ 144 KStorageBus m_controllerBus; 145 /** Holds the controller type. */ 146 KStorageControllerType m_controllerType; 147 /** Holds the controller port count. */ 148 uint m_uPortCount; 149 /** Holds whether the controller uses host IO cache. */ 150 bool m_fUseHostIOCache; 151 }; 152 153 154 /** Machine settings: Storage page data structure. */ 155 struct UIDataSettingsMachineStorage 156 { 157 /** Constructs data. */ 158 UIDataSettingsMachineStorage() {} 159 160 /** Returns whether the @a other passed data is equal to this one. */ 161 bool operator==(const UIDataSettingsMachineStorage& /* other */) const { return true; } 162 /** Returns whether the @a other passed data is different from this one. */ 163 bool operator!=(const UIDataSettingsMachineStorage& /* other */) const { return false; } 164 }; 56 165 57 166 … … 2010 2119 , mIsPolished(false) 2011 2120 , mDisableStaticControls(0) 2121 , m_pCache(new UISettingsCacheMachineStorage) 2012 2122 { 2013 2123 /* Apply UI decorations */ … … 2180 2290 /* Destroy icon-pool: */ 2181 2291 UIIconPoolStorageSettings::destroy(); 2292 2293 /* Cleanup cache: */ 2294 delete m_pCache; 2295 m_pCache = 0; 2182 2296 } 2183 2297 … … 2196 2310 } 2197 2311 2312 bool UIMachineSettingsStorage::changed() const 2313 { 2314 return m_pCache->wasChanged(); 2315 } 2316 2198 2317 void UIMachineSettingsStorage::loadToCacheFrom(QVariant &data) 2199 2318 { … … 2202 2321 2203 2322 /* Clear cache initially: */ 2204 m_ cache.clear();2323 m_pCache->clear(); 2205 2324 2206 2325 /* Gather storage data: */ … … 2262 2381 2263 2382 /* Cache storage attachment data: */ 2264 m_ cache.child(iControllerIndex).child(iAttachmentIndex).cacheInitialData(storageAttachmentData);2383 m_pCache->child(iControllerIndex).child(iAttachmentIndex).cacheInitialData(storageAttachmentData); 2265 2384 } 2266 2385 } 2267 2386 2268 2387 /* Cache storage controller data: */ 2269 m_ cache.child(iControllerIndex).cacheInitialData(storageControllerData);2388 m_pCache->child(iControllerIndex).cacheInitialData(storageControllerData); 2270 2389 } 2271 2390 … … 2283 2402 2284 2403 /* For each storage controller: */ 2285 for (int iControllerIndex = 0; iControllerIndex < m_ cache.childCount(); ++iControllerIndex)2404 for (int iControllerIndex = 0; iControllerIndex < m_pCache->childCount(); ++iControllerIndex) 2286 2405 { 2287 2406 /* Get storage controller cache: */ 2288 const UISettingsCacheMachineStorageController &controllerCache = m_ cache.child(iControllerIndex);2407 const UISettingsCacheMachineStorageController &controllerCache = m_pCache->child(iControllerIndex); 2289 2408 /* Get storage controller data from cache: */ 2290 2409 const UIDataSettingsMachineStorageController &controllerData = controllerCache.base(); … … 2335 2454 { 2336 2455 /* Prepare storage data: */ 2337 UIDataSettingsMachineStorage storageData = m_ cache.base();2456 UIDataSettingsMachineStorage storageData = m_pCache->base(); 2338 2457 2339 2458 /* For each storage controller: */ … … 2371 2490 2372 2491 /* Recache storage attachment data: */ 2373 m_ cache.child(iControllerIndex).child(iAttachmentIndex).cacheCurrentData(attachmentData);2492 m_pCache->child(iControllerIndex).child(iAttachmentIndex).cacheCurrentData(attachmentData); 2374 2493 } 2375 2494 2376 2495 /* Recache storage controller data: */ 2377 m_ cache.child(iControllerIndex).cacheCurrentData(controllerData);2496 m_pCache->child(iControllerIndex).cacheCurrentData(controllerData); 2378 2497 } 2379 2498 2380 2499 /* Recache storage data: */ 2381 m_ cache.cacheCurrentData(storageData);2500 m_pCache->cacheCurrentData(storageData); 2382 2501 } 2383 2502 … … 3576 3695 { 3577 3696 /* Check if storage data was changed: */ 3578 if (m_ cache.wasChanged())3697 if (m_pCache->wasChanged()) 3579 3698 { 3580 3699 /* For each controller (removing step): */ 3581 for (int iControllerIndex = 0; fSuccess && iControllerIndex < m_ cache.childCount(); ++iControllerIndex)3700 for (int iControllerIndex = 0; fSuccess && iControllerIndex < m_pCache->childCount(); ++iControllerIndex) 3582 3701 { 3583 3702 /* Get controller cache: */ 3584 const UISettingsCacheMachineStorageController &controllerCache = m_ cache.child(iControllerIndex);3703 const UISettingsCacheMachineStorageController &controllerCache = m_pCache->child(iControllerIndex); 3585 3704 3586 3705 /* Remove controllers marked for 'remove' and 'update' (if they can't be updated): */ … … 3607 3726 3608 3727 /* For each controller (creating step): */ 3609 for (int iControllerIndex = 0; fSuccess && iControllerIndex < m_ cache.childCount(); ++iControllerIndex)3728 for (int iControllerIndex = 0; fSuccess && iControllerIndex < m_pCache->childCount(); ++iControllerIndex) 3610 3729 { 3611 3730 /* Get controller cache: */ 3612 const UISettingsCacheMachineStorageController &controllerCache = m_ cache.child(iControllerIndex);3731 const UISettingsCacheMachineStorageController &controllerCache = m_pCache->child(iControllerIndex); 3613 3732 3614 3733 /* Create controllers marked for 'create' or 'update' (if they can't be updated): */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r66176 r66183 38 38 class ControllerItem; 39 39 class UIMediumIDHolder; 40 struct UIDataSettingsMachineStorage; 41 struct UIDataSettingsMachineStorageController; 42 struct UIDataSettingsMachineStorageAttachment; 43 typedef UISettingsCache<UIDataSettingsMachineStorageAttachment> UISettingsCacheMachineStorageAttachment; 44 typedef UISettingsCachePool<UIDataSettingsMachineStorageController, UISettingsCacheMachineStorageAttachment> UISettingsCacheMachineStorageController; 45 typedef UISettingsCachePool<UIDataSettingsMachineStorage, UISettingsCacheMachineStorageController> UISettingsCacheMachineStorage; 40 46 41 47 /* Internal Types */ … … 46 52 Q_DECLARE_METATYPE (DeviceTypeList); 47 53 Q_DECLARE_METATYPE (ControllerTypeList); 54 48 55 49 56 /** Known item states. */ … … 589 596 590 597 591 /** Machine settings: Storage Attachment data structure. */592 struct UIDataSettingsMachineStorageAttachment593 {594 /** Constructs data. */595 UIDataSettingsMachineStorageAttachment()596 : m_attachmentType(KDeviceType_Null)597 , m_iAttachmentPort(-1)598 , m_iAttachmentDevice(-1)599 , m_strAttachmentMediumId(QString())600 , m_fAttachmentPassthrough(false)601 , m_fAttachmentTempEject(false)602 , m_fAttachmentNonRotational(false)603 , m_fAttachmentHotPluggable(false)604 {}605 606 /** Returns whether the @a other passed data is equal to this one. */607 bool equal(const UIDataSettingsMachineStorageAttachment &other) const608 {609 return true610 && (m_attachmentType == other.m_attachmentType)611 && (m_iAttachmentPort == other.m_iAttachmentPort)612 && (m_iAttachmentDevice == other.m_iAttachmentDevice)613 && (m_strAttachmentMediumId == other.m_strAttachmentMediumId)614 && (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough)615 && (m_fAttachmentTempEject == other.m_fAttachmentTempEject)616 && (m_fAttachmentNonRotational == other.m_fAttachmentNonRotational)617 && (m_fAttachmentHotPluggable == other.m_fAttachmentHotPluggable)618 ;619 }620 621 /** Returns whether the @a other passed data is equal to this one. */622 bool operator==(const UIDataSettingsMachineStorageAttachment &other) const { return equal(other); }623 /** Returns whether the @a other passed data is different from this one. */624 bool operator!=(const UIDataSettingsMachineStorageAttachment &other) const { return !equal(other); }625 626 /** Holds the attachment type. */627 KDeviceType m_attachmentType;628 /** Holds the attachment port. */629 LONG m_iAttachmentPort;630 /** Holds the attachment device. */631 LONG m_iAttachmentDevice;632 /** Holds the attachment medium ID. */633 QString m_strAttachmentMediumId;634 /** Holds whether the attachment being passed through. */635 bool m_fAttachmentPassthrough;636 /** Holds whether the attachment being temporarily eject. */637 bool m_fAttachmentTempEject;638 /** Holds whether the attachment is solid-state. */639 bool m_fAttachmentNonRotational;640 /** Holds whether the attachment is hot-pluggable. */641 bool m_fAttachmentHotPluggable;642 };643 typedef UISettingsCache<UIDataSettingsMachineStorageAttachment> UISettingsCacheMachineStorageAttachment;644 645 646 /** Machine settings: Storage Controller data structure. */647 struct UIDataSettingsMachineStorageController648 {649 /** Constructs data. */650 UIDataSettingsMachineStorageController()651 : m_strControllerName(QString())652 , m_controllerBus(KStorageBus_Null)653 , m_controllerType(KStorageControllerType_Null)654 , m_uPortCount(0)655 , m_fUseHostIOCache(false)656 {}657 658 /** Returns whether the @a other passed data is equal to this one. */659 bool equal(const UIDataSettingsMachineStorageController &other) const660 {661 return true662 && (m_strControllerName == other.m_strControllerName)663 && (m_controllerBus == other.m_controllerBus)664 && (m_controllerType == other.m_controllerType)665 && (m_uPortCount == other.m_uPortCount)666 && (m_fUseHostIOCache == other.m_fUseHostIOCache)667 ;668 }669 670 /** Returns whether the @a other passed data is equal to this one. */671 bool operator==(const UIDataSettingsMachineStorageController &other) const { return equal(other); }672 /** Returns whether the @a other passed data is different from this one. */673 bool operator!=(const UIDataSettingsMachineStorageController &other) const { return !equal(other); }674 675 /** Holds the controller name. */676 QString m_strControllerName;677 /** Holds the controller bus. */678 KStorageBus m_controllerBus;679 /** Holds the controller type. */680 KStorageControllerType m_controllerType;681 /** Holds the controller port count. */682 uint m_uPortCount;683 /** Holds whether the controller uses host IO cache. */684 bool m_fUseHostIOCache;685 };686 typedef UISettingsCachePool<UIDataSettingsMachineStorageController, UISettingsCacheMachineStorageAttachment> UISettingsCacheMachineStorageController;687 688 689 /** Machine settings: Storage page data structure. */690 struct UIDataSettingsMachineStorage691 {692 /** Constructs data. */693 UIDataSettingsMachineStorage() {}694 695 /** Returns whether the @a other passed data is equal to this one. */696 bool operator==(const UIDataSettingsMachineStorage& /* other */) const { return true; }697 /** Returns whether the @a other passed data is different from this one. */698 bool operator!=(const UIDataSettingsMachineStorage& /* other */) const { return false; }699 };700 typedef UISettingsCachePool<UIDataSettingsMachineStorage, UISettingsCacheMachineStorageController> UISettingsCacheMachineStorage;701 702 703 598 /** Machine settings: Storage page. */ 704 599 class UIMachineSettingsStorage : public UISettingsPageMachine, … … 709 604 public: 710 605 606 /** Constructs Storage settings page. */ 711 607 UIMachineSettingsStorage(); 608 /** Destructs Storage settings page. */ 712 609 ~UIMachineSettingsStorage(); 713 610 … … 719 616 720 617 protected: 618 619 /** Returns whether the page content was changed. */ 620 bool changed() const /* override */; 721 621 722 622 /** Loads data into the cache from corresponding external object(s), … … 733 633 * this task COULD be performed in other than the GUI thread. */ 734 634 void saveFromCacheTo(QVariant &data); 735 736 /** Returns whether the page content was changed. */737 bool changed() const { return m_cache.wasChanged(); }738 635 739 636 /** Performs validation, updates @a messages list if something is wrong. */ … … 857 754 bool mDisableStaticControls; 858 755 859 /* Cache:*/860 UISettingsCacheMachineStorage m_cache;756 /** Holds the page data cache instance. */ 757 UISettingsCacheMachineStorage *m_pCache; 861 758 }; 862 759 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2008-201 6Oracle Corporation7 * Copyright (C) 2008-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 /* GUI includes: */ 26 26 # include "QIWidgetValidator.h" 27 # include "UIConverter.h" 27 28 # include "UIIconPool.h" 29 # include "UIMachineSettingsSystem.h" 28 30 # include "VBoxGlobal.h" 29 # include "UIMachineSettingsSystem.h"30 # include "UIConverter.h"31 31 32 32 /* COM includes: */ … … 37 37 38 38 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 39 40 41 /** Machine settings: System Boot data structure. */ 42 struct UIBootItemData 43 { 44 /** Constructs data. */ 45 UIBootItemData() 46 : m_type(KDeviceType_Null) 47 , m_fEnabled(false) 48 {} 49 50 /** Returns whether the @a other passed data is equal to this one. */ 51 bool operator==(const UIBootItemData &other) const 52 { 53 return true 54 && (m_type == other.m_type) 55 && (m_fEnabled == other.m_fEnabled) 56 ; 57 } 58 59 /** Holds the boot device type. */ 60 KDeviceType m_type; 61 /** Holds whether the boot device enabled. */ 62 bool m_fEnabled; 63 }; 64 65 66 /** Machine settings: System page data structure. */ 67 struct UIDataSettingsMachineSystem 68 { 69 /** Constructs data. */ 70 UIDataSettingsMachineSystem() 71 /* Support flags: */ 72 : m_fSupportedPAE(false) 73 , m_fSupportedHwVirtEx(false) 74 /* Motherboard data: */ 75 , m_iMemorySize(-1) 76 , m_bootItems(QList<UIBootItemData>()) 77 , m_chipsetType(KChipsetType_Null) 78 , m_pointingHIDType(KPointingHIDType_None) 79 , m_fEnabledIoApic(false) 80 , m_fEnabledEFI(false) 81 , m_fEnabledUTC(false) 82 /* CPU data: */ 83 , m_cCPUCount(-1) 84 , m_iCPUExecCap(-1) 85 , m_fEnabledPAE(false) 86 /* Acceleration data: */ 87 , m_paravirtProvider(KParavirtProvider_None) 88 , m_fEnabledHwVirtEx(false) 89 , m_fEnabledNestedPaging(false) 90 {} 91 92 /** Returns whether the @a other passed data is equal to this one. */ 93 bool equal(const UIDataSettingsMachineSystem &other) const 94 { 95 return true 96 /* Support flags: */ 97 && (m_fSupportedPAE == other.m_fSupportedPAE) 98 && (m_fSupportedHwVirtEx == other.m_fSupportedHwVirtEx) 99 /* Motherboard data: */ 100 && (m_iMemorySize == other.m_iMemorySize) 101 && (m_bootItems == other.m_bootItems) 102 && (m_chipsetType == other.m_chipsetType) 103 && (m_pointingHIDType == other.m_pointingHIDType) 104 && (m_fEnabledIoApic == other.m_fEnabledIoApic) 105 && (m_fEnabledEFI == other.m_fEnabledEFI) 106 && (m_fEnabledUTC == other.m_fEnabledUTC) 107 /* CPU data: */ 108 && (m_cCPUCount == other.m_cCPUCount) 109 && (m_iCPUExecCap == other.m_iCPUExecCap) 110 && (m_fEnabledPAE == other.m_fEnabledPAE) 111 /* Acceleration data: */ 112 && (m_paravirtProvider == other.m_paravirtProvider) 113 && (m_fEnabledHwVirtEx == other.m_fEnabledHwVirtEx) 114 && (m_fEnabledNestedPaging == other.m_fEnabledNestedPaging) 115 ; 116 } 117 118 /** Returns whether the @a other passed data is equal to this one. */ 119 bool operator==(const UIDataSettingsMachineSystem &other) const { return equal(other); } 120 /** Returns whether the @a other passed data is different from this one. */ 121 bool operator!=(const UIDataSettingsMachineSystem &other) const { return !equal(other); } 122 123 /** Holds whether the PAE is supported. */ 124 bool m_fSupportedPAE; 125 /** Holds whether the HW Virt Ex is supported. */ 126 bool m_fSupportedHwVirtEx; 127 128 /** Holds the RAM size. */ 129 int m_iMemorySize; 130 /** Holds the boot items. */ 131 QList<UIBootItemData> m_bootItems; 132 /** Holds the chipset type. */ 133 KChipsetType m_chipsetType; 134 /** Holds the pointing HID type. */ 135 KPointingHIDType m_pointingHIDType; 136 /** Holds whether the IO APIC is enabled. */ 137 bool m_fEnabledIoApic; 138 /** Holds whether the EFI is enabled. */ 139 bool m_fEnabledEFI; 140 /** Holds whether the UTC is enabled. */ 141 bool m_fEnabledUTC; 142 143 /** Holds the CPU count. */ 144 int m_cCPUCount; 145 /** Holds the CPU execution cap. */ 146 int m_iCPUExecCap; 147 /** Holds whether the PAE is enabled. */ 148 bool m_fEnabledPAE; 149 150 /** Holds the paravirtualization provider. */ 151 KParavirtProvider m_paravirtProvider; 152 /** Holds whether the HW Virt Ex is enabled. */ 153 bool m_fEnabledHwVirtEx; 154 /** Holds whether the Nested Paging is enabled. */ 155 bool m_fEnabledNestedPaging; 156 }; 39 157 40 158 … … 43 161 , m_uMinGuestCPUExecCap(0), m_uMedGuestCPUExecCap(0), m_uMaxGuestCPUExecCap(0) 44 162 , m_fIsUSBEnabled(false) 163 , m_pCache(new UISettingsCacheMachineSystem) 45 164 { 46 165 /* Prepare: */ 47 166 prepare(); 167 } 168 169 UIMachineSettingsSystem::~UIMachineSettingsSystem() 170 { 171 /* Cleanup cache: */ 172 delete m_pCache; 173 m_pCache = 0; 48 174 } 49 175 … … 76 202 } 77 203 204 bool UIMachineSettingsSystem::changed() const 205 { 206 return m_pCache->wasChanged(); 207 } 208 78 209 void UIMachineSettingsSystem::loadToCacheFrom(QVariant &data) 79 210 { … … 82 213 83 214 /* Clear cache initially: */ 84 m_ cache.clear();215 m_pCache->clear(); 85 216 86 217 /* Prepare system data: */ … … 137 268 138 269 /* Cache system data: */ 139 m_ cache.cacheInitialData(systemData);270 m_pCache->cacheInitialData(systemData); 140 271 141 272 /* Upload machine to data: */ … … 146 277 { 147 278 /* Get system data from cache: */ 148 const UIDataSettingsMachineSystem &systemData = m_ cache.base();279 const UIDataSettingsMachineSystem &systemData = m_pCache->base(); 149 280 150 281 /* Repopulate 'pointing HID type' combo. … … 196 327 { 197 328 /* Prepare system data: */ 198 UIDataSettingsMachineSystem systemData = m_ cache.base();329 UIDataSettingsMachineSystem systemData = m_pCache->base(); 199 330 200 331 /* Gather motherboard data: */ … … 229 360 230 361 /* Cache system data: */ 231 m_ cache.cacheCurrentData(systemData);362 m_pCache->cacheCurrentData(systemData); 232 363 } 233 364 … … 238 369 239 370 /* Check if system data was changed: */ 240 if (m_ cache.wasChanged())371 if (m_pCache->wasChanged()) 241 372 { 242 373 /* Get system data from cache: */ 243 const UIDataSettingsMachineSystem &systemData = m_ cache.data();374 const UIDataSettingsMachineSystem &systemData = m_pCache->data(); 244 375 245 376 /* Store system data: */ … … 457 588 { 458 589 /* Get system data from cache: */ 459 const UIDataSettingsMachineSystem &systemData = m_ cache.base();590 const UIDataSettingsMachineSystem &systemData = m_pCache->base(); 460 591 461 592 /* Motherboard tab: */ … … 751 882 752 883 /* Repopulate combo taking into account currently cached value: */ 753 KPointingHIDType cachedValue = m_ cache.base().m_pointingHIDType;884 KPointingHIDType cachedValue = m_pCache->base().m_pointingHIDType; 754 885 { 755 886 /* "PS/2 Mouse" value is always here: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
r66176 r66183 23 23 #include "UIMachineSettingsSystem.gen.h" 24 24 25 26 /** Machine settings: System Boot data structure. */ 27 struct UIBootItemData 28 { 29 /** Constructs data. */ 30 UIBootItemData() 31 : m_type(KDeviceType_Null) 32 , m_fEnabled(false) 33 {} 34 35 /** Returns whether the @a other passed data is equal to this one. */ 36 bool operator==(const UIBootItemData &other) const 37 { 38 return true 39 && (m_type == other.m_type) 40 && (m_fEnabled == other.m_fEnabled) 41 ; 42 } 43 44 /** Holds the boot device type. */ 45 KDeviceType m_type; 46 /** Holds whether the boot device enabled. */ 47 bool m_fEnabled; 48 }; 49 50 51 /** Machine settings: System page data structure. */ 52 struct UIDataSettingsMachineSystem 53 { 54 /** Constructs data. */ 55 UIDataSettingsMachineSystem() 56 /* Support flags: */ 57 : m_fSupportedPAE(false) 58 , m_fSupportedHwVirtEx(false) 59 /* Motherboard data: */ 60 , m_iMemorySize(-1) 61 , m_bootItems(QList<UIBootItemData>()) 62 , m_chipsetType(KChipsetType_Null) 63 , m_pointingHIDType(KPointingHIDType_None) 64 , m_fEnabledIoApic(false) 65 , m_fEnabledEFI(false) 66 , m_fEnabledUTC(false) 67 /* CPU data: */ 68 , m_cCPUCount(-1) 69 , m_iCPUExecCap(-1) 70 , m_fEnabledPAE(false) 71 /* Acceleration data: */ 72 , m_paravirtProvider(KParavirtProvider_None) 73 , m_fEnabledHwVirtEx(false) 74 , m_fEnabledNestedPaging(false) 75 {} 76 77 /** Returns whether the @a other passed data is equal to this one. */ 78 bool equal(const UIDataSettingsMachineSystem &other) const 79 { 80 return true 81 /* Support flags: */ 82 && (m_fSupportedPAE == other.m_fSupportedPAE) 83 && (m_fSupportedHwVirtEx == other.m_fSupportedHwVirtEx) 84 /* Motherboard data: */ 85 && (m_iMemorySize == other.m_iMemorySize) 86 && (m_bootItems == other.m_bootItems) 87 && (m_chipsetType == other.m_chipsetType) 88 && (m_pointingHIDType == other.m_pointingHIDType) 89 && (m_fEnabledIoApic == other.m_fEnabledIoApic) 90 && (m_fEnabledEFI == other.m_fEnabledEFI) 91 && (m_fEnabledUTC == other.m_fEnabledUTC) 92 /* CPU data: */ 93 && (m_cCPUCount == other.m_cCPUCount) 94 && (m_iCPUExecCap == other.m_iCPUExecCap) 95 && (m_fEnabledPAE == other.m_fEnabledPAE) 96 /* Acceleration data: */ 97 && (m_paravirtProvider == other.m_paravirtProvider) 98 && (m_fEnabledHwVirtEx == other.m_fEnabledHwVirtEx) 99 && (m_fEnabledNestedPaging == other.m_fEnabledNestedPaging) 100 ; 101 } 102 103 /** Returns whether the @a other passed data is equal to this one. */ 104 bool operator==(const UIDataSettingsMachineSystem &other) const { return equal(other); } 105 /** Returns whether the @a other passed data is different from this one. */ 106 bool operator!=(const UIDataSettingsMachineSystem &other) const { return !equal(other); } 107 108 /** Holds whether the PAE is supported. */ 109 bool m_fSupportedPAE; 110 /** Holds whether the HW Virt Ex is supported. */ 111 bool m_fSupportedHwVirtEx; 112 113 /** Holds the RAM size. */ 114 int m_iMemorySize; 115 /** Holds the boot items. */ 116 QList<UIBootItemData> m_bootItems; 117 /** Holds the chipset type. */ 118 KChipsetType m_chipsetType; 119 /** Holds the pointing HID type. */ 120 KPointingHIDType m_pointingHIDType; 121 /** Holds whether the IO APIC is enabled. */ 122 bool m_fEnabledIoApic; 123 /** Holds whether the EFI is enabled. */ 124 bool m_fEnabledEFI; 125 /** Holds whether the UTC is enabled. */ 126 bool m_fEnabledUTC; 127 128 /** Holds the CPU count. */ 129 int m_cCPUCount; 130 /** Holds the CPU execution cap. */ 131 int m_iCPUExecCap; 132 /** Holds whether the PAE is enabled. */ 133 bool m_fEnabledPAE; 134 135 /** Holds the paravirtualization provider. */ 136 KParavirtProvider m_paravirtProvider; 137 /** Holds whether the HW Virt Ex is enabled. */ 138 bool m_fEnabledHwVirtEx; 139 /** Holds whether the Nested Paging is enabled. */ 140 bool m_fEnabledNestedPaging; 141 }; 25 /* Forward declarations: */ 26 struct UIDataSettingsMachineSystem; 142 27 typedef UISettingsCache<UIDataSettingsMachineSystem> UISettingsCacheMachineSystem; 143 28 … … 151 36 public: 152 37 153 /* Constructor:*/38 /** Constructs System settings page. */ 154 39 UIMachineSettingsSystem(); 40 /** Destructs System settings page. */ 41 ~UIMachineSettingsSystem(); 155 42 156 43 /* API: Correlation stuff: */ … … 163 50 164 51 /** Returns whether the page content was changed. */ 165 bool changed() const { return m_cache.wasChanged(); }52 bool changed() const /* override */; 166 53 167 54 /** Loads data into the cache from corresponding external object(s), … … 242 129 bool m_fIsUSBEnabled; 243 130 244 /* Cache:*/245 UISettingsCacheMachineSystem m_cache;131 /** Holds the page data cache instance. */ 132 UISettingsCacheMachineSystem *m_pCache; 246 133 }; 247 134 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r66163 r66183 5 5 6 6 /* 7 * Copyright (C) 2006-201 6Oracle Corporation7 * Copyright (C) 2006-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 27 27 /* GUI includes: */ 28 28 # include "QIWidgetValidator.h" 29 # include "UIConverter.h" 29 30 # include "UIIconPool.h" 30 # include "VBoxGlobal.h" 31 # include "UIMachineSettingsUSB.h" 32 # include "UIMachineSettingsUSBFilterDetails.h" 31 33 # include "UIMessageCenter.h" 32 34 # include "UIToolBar.h" 33 # include "UIMachineSettingsUSB.h" 34 # include "UIMachineSettingsUSBFilterDetails.h" 35 # include "UIConverter.h" 35 # include "VBoxGlobal.h" 36 36 37 37 /* COM includes: */ … … 54 54 # include "VirtualBox_XPCOM.h" 55 55 #endif /* VBOX_WITH_XPCOM */ 56 57 58 /** Machine settings: USB filter data structure. */ 59 struct UIDataSettingsMachineUSBFilter 60 { 61 /** Constructs data. */ 62 UIDataSettingsMachineUSBFilter() 63 : m_fActive(false) 64 , m_strName(QString()) 65 , m_strVendorId(QString()) 66 , m_strProductId(QString()) 67 , m_strRevision(QString()) 68 , m_strManufacturer(QString()) 69 , m_strProduct(QString()) 70 , m_strSerialNumber(QString()) 71 , m_strPort(QString()) 72 , m_strRemote(QString()) 73 , m_action(KUSBDeviceFilterAction_Null) 74 , m_fHostUSBDevice(false) 75 , m_hostUSBDeviceState(KUSBDeviceState_NotSupported) 76 {} 77 78 /** Returns whether the @a other passed data is equal to this one. */ 79 bool equal(const UIDataSettingsMachineUSBFilter &other) const 80 { 81 return true 82 && (m_fActive == other.m_fActive) 83 && (m_strName == other.m_strName) 84 && (m_strVendorId == other.m_strVendorId) 85 && (m_strProductId == other.m_strProductId) 86 && (m_strRevision == other.m_strRevision) 87 && (m_strManufacturer == other.m_strManufacturer) 88 && (m_strProduct == other.m_strProduct) 89 && (m_strSerialNumber == other.m_strSerialNumber) 90 && (m_strPort == other.m_strPort) 91 && (m_strRemote == other.m_strRemote) 92 && (m_action == other.m_action) 93 && (m_hostUSBDeviceState == other.m_hostUSBDeviceState) 94 ; 95 } 96 97 /** Returns whether the @a other passed data is equal to this one. */ 98 bool operator==(const UIDataSettingsMachineUSBFilter &other) const { return equal(other); } 99 /** Returns whether the @a other passed data is different from this one. */ 100 bool operator!=(const UIDataSettingsMachineUSBFilter &other) const { return !equal(other); } 101 102 /** Holds whether the USB filter is enabled. */ 103 bool m_fActive; 104 /** Holds the USB filter name. */ 105 QString m_strName; 106 /** Holds the USB filter vendor ID. */ 107 QString m_strVendorId; 108 /** Holds the USB filter product ID. */ 109 QString m_strProductId; 110 /** Holds the USB filter revision. */ 111 QString m_strRevision; 112 /** Holds the USB filter manufacturer. */ 113 QString m_strManufacturer; 114 /** Holds the USB filter product. */ 115 QString m_strProduct; 116 /** Holds the USB filter serial number. */ 117 QString m_strSerialNumber; 118 /** Holds the USB filter port. */ 119 QString m_strPort; 120 /** Holds the USB filter remote. */ 121 QString m_strRemote; 122 123 /** Holds the USB filter action. */ 124 KUSBDeviceFilterAction m_action; 125 /** Holds whether the USB filter is host USB device. */ 126 bool m_fHostUSBDevice; 127 /** Holds the USB device state. */ 128 KUSBDeviceState m_hostUSBDeviceState; 129 }; 130 131 132 /** Machine settings: USB page data structure. */ 133 struct UIDataSettingsMachineUSB 134 { 135 /** Constructs data. */ 136 UIDataSettingsMachineUSB() 137 : m_fUSBEnabled(false) 138 , m_USBControllerType(KUSBControllerType_Null) 139 {} 140 141 /** Returns whether the @a other passed data is equal to this one. */ 142 bool equal(const UIDataSettingsMachineUSB &other) const 143 { 144 return true 145 && (m_fUSBEnabled == other.m_fUSBEnabled) 146 && (m_USBControllerType == other.m_USBControllerType) 147 ; 148 } 149 150 /** Returns whether the @a other passed data is equal to this one. */ 151 bool operator==(const UIDataSettingsMachineUSB &other) const { return equal(other); } 152 /** Returns whether the @a other passed data is different from this one. */ 153 bool operator!=(const UIDataSettingsMachineUSB &other) const { return !equal(other); } 154 155 /** Holds whether the USB is enabled. */ 156 bool m_fUSBEnabled; 157 /** Holds the USB controller type. */ 158 KUSBControllerType m_USBControllerType; 159 }; 56 160 57 161 … … 176 280 , mMupAction(0), mMdnAction(0) 177 281 , mUSBDevicesMenu(0) 282 , m_pCache(new UISettingsCacheMachineUSB) 178 283 { 179 284 /* Apply UI decorations */ … … 267 372 { 268 373 delete mUSBDevicesMenu; 374 375 /* Cleanup cache: */ 376 delete m_pCache; 377 m_pCache = 0; 269 378 } 270 379 … … 272 381 { 273 382 return mGbUSB->isChecked(); 383 } 384 385 bool UIMachineSettingsUSB::changed() const 386 { 387 return m_pCache->wasChanged(); 274 388 } 275 389 … … 280 394 281 395 /* Clear cache initially: */ 282 m_ cache.clear();396 m_pCache->clear(); 283 397 284 398 /* Prepare USB data: */ … … 320 434 321 435 /* Cache USB filter data: */ 322 m_ cache.child(iFilterIndex).cacheInitialData(usbFilterData);436 m_pCache->child(iFilterIndex).cacheInitialData(usbFilterData); 323 437 } 324 438 } 325 439 326 440 /* Cache USB data: */ 327 m_ cache.cacheInitialData(usbData);441 m_pCache->cacheInitialData(usbData); 328 442 329 443 /* Upload properties & settings or machine to data: */ … … 338 452 339 453 /* Get USB data from cache: */ 340 const UIDataSettingsMachineUSB &usbData = m_ cache.base();454 const UIDataSettingsMachineUSB &usbData = m_pCache->base(); 341 455 /* Load USB data to page: */ 342 456 mGbUSB->setChecked(usbData.m_fUSBEnabled); … … 350 464 351 465 /* For each USB filter => load it to the page: */ 352 for (int iFilterIndex = 0; iFilterIndex < m_ cache.childCount(); ++iFilterIndex)353 addUSBFilter(m_ cache.child(iFilterIndex).base(), false /* its new? */);466 for (int iFilterIndex = 0; iFilterIndex < m_pCache->childCount(); ++iFilterIndex) 467 addUSBFilter(m_pCache->child(iFilterIndex).base(), false /* its new? */); 354 468 355 469 /* Choose first filter as current: */ … … 369 483 { 370 484 /* Prepare USB data: */ 371 UIDataSettingsMachineUSB usbData = m_ cache.base();485 UIDataSettingsMachineUSB usbData = m_pCache->base(); 372 486 373 487 /* Is USB controller enabled? */ … … 387 501 388 502 /* Update USB cache: */ 389 m_ cache.cacheCurrentData(usbData);503 m_pCache->cacheCurrentData(usbData); 390 504 391 505 /* For each USB filter => recache USB filter data: */ 392 506 for (int iFilterIndex = 0; iFilterIndex < m_filters.size(); ++iFilterIndex) 393 m_ cache.child(iFilterIndex).cacheCurrentData(m_filters[iFilterIndex]);507 m_pCache->child(iFilterIndex).cacheCurrentData(m_filters[iFilterIndex]); 394 508 } 395 509 … … 400 514 401 515 /* Check if USB data really changed: */ 402 if (m_ cache.wasChanged())516 if (m_pCache->wasChanged()) 403 517 { 404 518 /* Check if controller is valid: */ … … 407 521 { 408 522 /* Get USB data from cache: */ 409 const UIDataSettingsMachineUSB &usbData = m_ cache.data();523 const UIDataSettingsMachineUSB &usbData = m_pCache->data(); 410 524 /* Store USB data: */ 411 525 if (isMachineOffline()) … … 506 620 /* For each USB filter data set: */ 507 621 int iOperationPosition = 0; 508 for (int iFilterIndex = 0; iFilterIndex < m_ cache.childCount(); ++iFilterIndex)622 for (int iFilterIndex = 0; iFilterIndex < m_pCache->childCount(); ++iFilterIndex) 509 623 { 510 624 /* Check if USB filter data really changed: */ 511 const UISettingsCacheMachineUSBFilter &usbFilterCache = m_ cache.child(iFilterIndex);625 const UISettingsCacheMachineUSBFilter &usbFilterCache = m_pCache->child(iFilterIndex); 512 626 if (usbFilterCache.wasChanged()) 513 627 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
r66176 r66183 26 26 class VBoxUSBMenu; 27 27 class UIToolBar; 28 29 30 /** Machine settings: USB filter data structure. */ 31 struct UIDataSettingsMachineUSBFilter 32 { 33 /** Constructs data. */ 34 UIDataSettingsMachineUSBFilter() 35 : m_fActive(false) 36 , m_strName(QString()) 37 , m_strVendorId(QString()) 38 , m_strProductId(QString()) 39 , m_strRevision(QString()) 40 , m_strManufacturer(QString()) 41 , m_strProduct(QString()) 42 , m_strSerialNumber(QString()) 43 , m_strPort(QString()) 44 , m_strRemote(QString()) 45 , m_action(KUSBDeviceFilterAction_Null) 46 , m_fHostUSBDevice(false) 47 , m_hostUSBDeviceState(KUSBDeviceState_NotSupported) 48 {} 49 50 /** Returns whether the @a other passed data is equal to this one. */ 51 bool equal(const UIDataSettingsMachineUSBFilter &other) const 52 { 53 return true 54 && (m_fActive == other.m_fActive) 55 && (m_strName == other.m_strName) 56 && (m_strVendorId == other.m_strVendorId) 57 && (m_strProductId == other.m_strProductId) 58 && (m_strRevision == other.m_strRevision) 59 && (m_strManufacturer == other.m_strManufacturer) 60 && (m_strProduct == other.m_strProduct) 61 && (m_strSerialNumber == other.m_strSerialNumber) 62 && (m_strPort == other.m_strPort) 63 && (m_strRemote == other.m_strRemote) 64 && (m_action == other.m_action) 65 && (m_hostUSBDeviceState == other.m_hostUSBDeviceState) 66 ; 67 } 68 69 /** Returns whether the @a other passed data is equal to this one. */ 70 bool operator==(const UIDataSettingsMachineUSBFilter &other) const { return equal(other); } 71 /** Returns whether the @a other passed data is different from this one. */ 72 bool operator!=(const UIDataSettingsMachineUSBFilter &other) const { return !equal(other); } 73 74 /** Holds whether the USB filter is enabled. */ 75 bool m_fActive; 76 /** Holds the USB filter name. */ 77 QString m_strName; 78 /** Holds the USB filter vendor ID. */ 79 QString m_strVendorId; 80 /** Holds the USB filter product ID. */ 81 QString m_strProductId; 82 /** Holds the USB filter revision. */ 83 QString m_strRevision; 84 /** Holds the USB filter manufacturer. */ 85 QString m_strManufacturer; 86 /** Holds the USB filter product. */ 87 QString m_strProduct; 88 /** Holds the USB filter serial number. */ 89 QString m_strSerialNumber; 90 /** Holds the USB filter port. */ 91 QString m_strPort; 92 /** Holds the USB filter remote. */ 93 QString m_strRemote; 94 95 /** Holds the USB filter action. */ 96 KUSBDeviceFilterAction m_action; 97 /** Holds whether the USB filter is host USB device. */ 98 bool m_fHostUSBDevice; 99 /** Holds the USB device state. */ 100 KUSBDeviceState m_hostUSBDeviceState; 101 }; 28 struct UIDataSettingsMachineUSB; 29 struct UIDataSettingsMachineUSBFilter; 102 30 typedef UISettingsCache<UIDataSettingsMachineUSBFilter> UISettingsCacheMachineUSBFilter; 103 104 105 /** Machine settings: USB page data structure. */106 struct UIDataSettingsMachineUSB107 {108 /** Constructs data. */109 UIDataSettingsMachineUSB()110 : m_fUSBEnabled(false)111 , m_USBControllerType(KUSBControllerType_Null)112 {}113 114 /** Returns whether the @a other passed data is equal to this one. */115 bool equal(const UIDataSettingsMachineUSB &other) const116 {117 return true118 && (m_fUSBEnabled == other.m_fUSBEnabled)119 && (m_USBControllerType == other.m_USBControllerType)120 ;121 }122 123 /** Returns whether the @a other passed data is equal to this one. */124 bool operator==(const UIDataSettingsMachineUSB &other) const { return equal(other); }125 /** Returns whether the @a other passed data is different from this one. */126 bool operator!=(const UIDataSettingsMachineUSB &other) const { return !equal(other); }127 128 /** Holds whether the USB is enabled. */129 bool m_fUSBEnabled;130 /** Holds the USB controller type. */131 KUSBControllerType m_USBControllerType;132 };133 31 typedef UISettingsCachePool<UIDataSettingsMachineUSB, UISettingsCacheMachineUSBFilter> UISettingsCacheMachineUSB; 134 32 … … 149 47 }; 150 48 49 /** Constructs USB settings page. */ 151 50 UIMachineSettingsUSB(); 51 /** Destructs USB settings page. */ 152 52 ~UIMachineSettingsUSB(); 153 53 … … 155 55 156 56 protected: 57 58 /** Returns whether the page content was changed. */ 59 bool changed() const /* override */; 157 60 158 61 /** Loads data into the cache from corresponding external object(s), … … 169 72 * this task COULD be performed in other than the GUI thread. */ 170 73 void saveFromCacheTo(QVariant &data); 171 172 /** Returns whether the page content was changed. */173 bool changed() const { return m_cache.wasChanged(); }174 74 175 75 /** Performs validation, updates @a messages list if something is wrong. */ … … 221 121 QList<UIDataSettingsMachineUSBFilter> m_filters; 222 122 223 /* Cache:*/224 UISettingsCacheMachineUSB m_cache;123 /** Holds the page data cache instance. */ 124 UISettingsCacheMachineUSB *m_pCache; 225 125 }; 226 126
Note:
See TracChangeset
for help on using the changeset viewer.

