Changeset 36920 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- May 3, 2011 7:06:48 AM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r36519 r36920 153 153 UISettingsPageMachine::fetchData(data); 154 154 155 /* Fill internal variables with corresponding values: */ 156 m_cache.m_iCurrentVRAM = m_machine.GetVRAMSize(); 157 m_cache.m_cMonitorCount = m_machine.GetMonitorCount(); 158 m_cache.m_f3dAccelerationEnabled = m_machine.GetAccelerate3DEnabled(); 159 #ifdef VBOX_WITH_VIDEOHWACCEL 160 m_cache.m_f2dAccelerationEnabled = m_machine.GetAccelerate2DVideoEnabled(); 161 #endif 155 /* Prepare display data: */ 156 UIDataSettingsMachineDisplay displayData; 157 158 /* Gather display data: */ 159 displayData.m_iCurrentVRAM = m_machine.GetVRAMSize(); 160 displayData.m_cMonitorCount = m_machine.GetMonitorCount(); 161 displayData.m_f3dAccelerationEnabled = m_machine.GetAccelerate3DEnabled(); 162 #ifdef VBOX_WITH_VIDEOHWACCEL 163 displayData.m_f2dAccelerationEnabled = m_machine.GetAccelerate2DVideoEnabled(); 164 #endif /* VBOX_WITH_VIDEOHWACCEL */ 165 /* Check if VRDE server is valid: */ 162 166 CVRDEServer vrdeServer = m_machine.GetVRDEServer(); 163 m_cache.m_fVRDEServerSupported = !vrdeServer.isNull(); 164 m_cache.m_fVRDEServerEnabled = m_cache.m_fVRDEServerSupported && vrdeServer.GetEnabled(); 165 m_cache.m_strVRDEPort = vrdeServer.GetVRDEProperty("TCP/Ports"); 166 m_cache.m_iVRDEAuthType = vrdeServer.GetAuthType(); 167 m_cache.m_uVRDETimeout = vrdeServer.GetAuthTimeout(); 168 m_cache.m_fMultipleConnectionsAllowed = vrdeServer.GetAllowMultiConnection(); 169 170 /* Other variables: */ 171 m_initialVRAM = RT_MIN(m_cache.m_iCurrentVRAM, m_maxVRAM); 167 displayData.m_fVRDEServerSupported = !vrdeServer.isNull(); 168 if (!vrdeServer.isNull()) 169 { 170 displayData.m_fVRDEServerEnabled = vrdeServer.GetEnabled(); 171 displayData.m_strVRDEPort = vrdeServer.GetVRDEProperty("TCP/Ports"); 172 displayData.m_VRDEAuthType = vrdeServer.GetAuthType(); 173 displayData.m_uVRDETimeout = vrdeServer.GetAuthTimeout(); 174 displayData.m_fMultipleConnectionsAllowed = vrdeServer.GetAllowMultiConnection(); 175 } 176 177 /* Initialize other variables: */ 178 m_initialVRAM = RT_MIN(displayData.m_iCurrentVRAM, m_maxVRAM); 179 180 /* Cache display data: */ 181 m_cache.cacheInitialData(displayData); 172 182 173 183 /* Upload machine to data: */ … … 179 189 void UIMachineSettingsDisplay::getFromCache() 180 190 { 181 /* Apply internal variables data to QWidget(s): */ 182 mSlMonitors->setValue(m_cache.m_cMonitorCount); 191 /* Get display data from cache: */ 192 const UIDataSettingsMachineDisplay &displayData = m_cache.base(); 193 194 /* Load display data to page: */ 195 mSlMonitors->setValue(displayData.m_cMonitorCount); 183 196 mCb3D->setEnabled(vboxGlobal().virtualBox().GetHost().GetAcceleration3DAvailable()); 184 mCb3D->setChecked( m_cache.m_f3dAccelerationEnabled);197 mCb3D->setChecked(displayData.m_f3dAccelerationEnabled); 185 198 #ifdef VBOX_WITH_VIDEOHWACCEL 186 199 mCb2DVideo->setEnabled(VBoxGlobal::isAcceleration2DVideoAvailable()); 187 mCb2DVideo->setChecked( m_cache.m_f2dAccelerationEnabled);188 #endif 200 mCb2DVideo->setChecked(displayData.m_f2dAccelerationEnabled); 201 #endif /* VBOX_WITH_VIDEOHWACCEL */ 189 202 checkVRAMRequirements(); 190 mSlMemory->setValue( m_cache.m_iCurrentVRAM);191 if ( m_cache.m_fVRDEServerSupported)192 { 193 mCbVRDE->setChecked( m_cache.m_fVRDEServerEnabled);194 mLeVRDEPort->setText( m_cache.m_strVRDEPort);195 mCbVRDEMethod->setCurrentIndex(mCbVRDEMethod->findText(vboxGlobal().toString( m_cache.m_iVRDEAuthType)));196 mLeVRDETimeout->setText(QString::number( m_cache.m_uVRDETimeout));197 mCbMultipleConn->setChecked( m_cache.m_fMultipleConnectionsAllowed);203 mSlMemory->setValue(displayData.m_iCurrentVRAM); 204 if (displayData.m_fVRDEServerSupported) 205 { 206 mCbVRDE->setChecked(displayData.m_fVRDEServerEnabled); 207 mLeVRDEPort->setText(displayData.m_strVRDEPort); 208 mCbVRDEMethod->setCurrentIndex(mCbVRDEMethod->findText(vboxGlobal().toString(displayData.m_VRDEAuthType))); 209 mLeVRDETimeout->setText(QString::number(displayData.m_uVRDETimeout)); 210 mCbMultipleConn->setChecked(displayData.m_fMultipleConnectionsAllowed); 198 211 } 199 212 else … … 208 221 void UIMachineSettingsDisplay::putToCache() 209 222 { 210 /* Gather internal variables data from QWidget(s): */ 211 m_cache.m_iCurrentVRAM = mSlMemory->value(); 212 m_cache.m_cMonitorCount = mSlMonitors->value(); 213 m_cache.m_f3dAccelerationEnabled = mCb3D->isChecked(); 214 #ifdef VBOX_WITH_VIDEOHWACCEL 215 m_cache.m_f2dAccelerationEnabled = mCb2DVideo->isChecked(); 216 #endif 217 if (m_cache.m_fVRDEServerSupported) 218 { 219 m_cache.m_fVRDEServerEnabled = mCbVRDE->isChecked(); 220 m_cache.m_strVRDEPort = mLeVRDEPort->text(); 221 m_cache.m_iVRDEAuthType = vboxGlobal().toAuthType(mCbVRDEMethod->currentText()); 222 m_cache.m_uVRDETimeout = mLeVRDETimeout->text().toULong(); 223 m_cache.m_fMultipleConnectionsAllowed = mCbMultipleConn->isChecked(); 224 } 223 /* Prepare audio data: */ 224 UIDataSettingsMachineDisplay displayData = m_cache.base(); 225 226 /* Gather display data: */ 227 displayData.m_iCurrentVRAM = mSlMemory->value(); 228 displayData.m_cMonitorCount = mSlMonitors->value(); 229 displayData.m_f3dAccelerationEnabled = mCb3D->isChecked(); 230 #ifdef VBOX_WITH_VIDEOHWACCEL 231 displayData.m_f2dAccelerationEnabled = mCb2DVideo->isChecked(); 232 #endif /* VBOX_WITH_VIDEOHWACCEL */ 233 if (displayData.m_fVRDEServerSupported) 234 { 235 displayData.m_fVRDEServerEnabled = mCbVRDE->isChecked(); 236 displayData.m_strVRDEPort = mLeVRDEPort->text(); 237 displayData.m_VRDEAuthType = vboxGlobal().toAuthType(mCbVRDEMethod->currentText()); 238 displayData.m_uVRDETimeout = mLeVRDETimeout->text().toULong(); 239 displayData.m_fMultipleConnectionsAllowed = mCbMultipleConn->isChecked(); 240 } 241 242 /* Cache display data: */ 243 m_cache.cacheCurrentData(displayData); 225 244 } 226 245 … … 232 251 UISettingsPageMachine::fetchData(data); 233 252 234 if (isMachineOffline()) 235 { 236 /* Video tab: */ 237 m_machine.SetVRAMSize(m_cache.m_iCurrentVRAM); 238 m_machine.SetMonitorCount(m_cache.m_cMonitorCount); 239 m_machine.SetAccelerate3DEnabled(m_cache.m_f3dAccelerationEnabled); 240 #ifdef VBOX_WITH_VIDEOHWACCEL 241 m_machine.SetAccelerate2DVideoEnabled(m_cache.m_f2dAccelerationEnabled); 253 /* Check if display data was changed: */ 254 if (m_cache.wasChanged()) 255 { 256 /* Get display data from cache: */ 257 const UIDataSettingsMachineDisplay &displayData = m_cache.data(); 258 259 /* Store display data: */ 260 if (isMachineOffline()) 261 { 262 /* Video tab: */ 263 m_machine.SetVRAMSize(displayData.m_iCurrentVRAM); 264 m_machine.SetMonitorCount(displayData.m_cMonitorCount); 265 m_machine.SetAccelerate3DEnabled(displayData.m_f3dAccelerationEnabled); 266 #ifdef VBOX_WITH_VIDEOHWACCEL 267 m_machine.SetAccelerate2DVideoEnabled(displayData.m_f2dAccelerationEnabled); 242 268 #endif /* VBOX_WITH_VIDEOHWACCEL */ 243 } 244 /* VRDE tab: */ 245 CVRDEServer vrdeServer = m_machine.GetVRDEServer(); 246 if (!vrdeServer.isNull()) 247 { 248 if (isMachineInValidMode()) 269 } 270 /* Check if VRDE server still valid: */ 271 CVRDEServer vrdeServer = m_machine.GetVRDEServer(); 272 if (!vrdeServer.isNull()) 249 273 { 250 vrdeServer.SetEnabled(m_cache.m_fVRDEServerEnabled); 251 vrdeServer.SetVRDEProperty("TCP/Ports", m_cache.m_strVRDEPort); 252 vrdeServer.SetAuthType(m_cache.m_iVRDEAuthType); 253 vrdeServer.SetAuthTimeout(m_cache.m_uVRDETimeout); 254 } 255 if (isMachineOffline() || isMachineSaved()) 256 { 257 vrdeServer.SetAllowMultiConnection(m_cache.m_fMultipleConnectionsAllowed); 274 /* Store VRDE data: */ 275 if (isMachineInValidMode()) 276 { 277 vrdeServer.SetEnabled(displayData.m_fVRDEServerEnabled); 278 vrdeServer.SetVRDEProperty("TCP/Ports", displayData.m_strVRDEPort); 279 vrdeServer.SetAuthType(displayData.m_VRDEAuthType); 280 vrdeServer.SetAuthTimeout(displayData.m_uVRDETimeout); 281 } 282 if (isMachineOffline() || isMachineSaved()) 283 { 284 vrdeServer.SetAllowMultiConnection(displayData.m_fMultipleConnectionsAllowed); 285 } 258 286 } 259 287 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
r36357 r36920 24 24 #include "UIMachineSettingsDisplay.gen.h" 25 25 26 /* Machine settings / Display page / Cache: */27 struct UI SettingsCacheMachineDisplay26 /* Machine settings / Display page / Data: */ 27 struct UIDataSettingsMachineDisplay 28 28 { 29 /* Default constructor: */ 30 UIDataSettingsMachineDisplay() 31 : m_iCurrentVRAM(0) 32 , m_cMonitorCount(0) 33 , m_f3dAccelerationEnabled(false) 34 #ifdef VBOX_WITH_VIDEOHWACCEL 35 , m_f2dAccelerationEnabled(false) 36 #endif /* VBOX_WITH_VIDEOHWACCEL */ 37 , m_fVRDEServerSupported(false) 38 , m_fVRDEServerEnabled(false) 39 , m_strVRDEPort(QString()) 40 , m_VRDEAuthType(KAuthType_Null) 41 , m_uVRDETimeout(0) 42 , m_fMultipleConnectionsAllowed(false) {} 43 /* Functions: */ 44 bool equal(const UIDataSettingsMachineDisplay &other) const 45 { 46 return (m_iCurrentVRAM == other.m_iCurrentVRAM) && 47 (m_cMonitorCount == other.m_cMonitorCount) && 48 (m_f3dAccelerationEnabled == other.m_f3dAccelerationEnabled) && 49 #ifdef VBOX_WITH_VIDEOHWACCEL 50 (m_f2dAccelerationEnabled == other.m_f2dAccelerationEnabled) && 51 #endif /* VBOX_WITH_VIDEOHWACCEL */ 52 (m_fVRDEServerSupported == other.m_fVRDEServerSupported) && 53 (m_fVRDEServerEnabled == other.m_fVRDEServerEnabled) && 54 (m_strVRDEPort == other.m_strVRDEPort) && 55 (m_VRDEAuthType == other.m_VRDEAuthType) && 56 (m_uVRDETimeout == other.m_uVRDETimeout) && 57 (m_fMultipleConnectionsAllowed == other.m_fMultipleConnectionsAllowed); 58 } 59 /* Operators: */ 60 bool operator==(const UIDataSettingsMachineDisplay &other) const { return equal(other); } 61 bool operator!=(const UIDataSettingsMachineDisplay &other) const { return !equal(other); } 62 /* Variables: */ 29 63 int m_iCurrentVRAM; 30 64 int m_cMonitorCount; 31 65 bool m_f3dAccelerationEnabled; 66 #ifdef VBOX_WITH_VIDEOHWACCEL 32 67 bool m_f2dAccelerationEnabled; 68 #endif /* VBOX_WITH_VIDEOHWACCEL */ 33 69 bool m_fVRDEServerSupported; 34 70 bool m_fVRDEServerEnabled; 35 71 QString m_strVRDEPort; 36 KAuthType m_ iVRDEAuthType;72 KAuthType m_VRDEAuthType; 37 73 ulong m_uVRDETimeout; 38 74 bool m_fMultipleConnectionsAllowed; 39 75 }; 76 typedef UISettingsCache<UIDataSettingsMachineDisplay> UICacheSettingsMachineDisplay; 40 77 41 78 /* Machine settings / Display page: */ … … 110 147 111 148 /* Cache: */ 112 UI SettingsCacheMachineDisplay m_cache;149 UICacheSettingsMachineDisplay m_cache; 113 150 }; 114 151
Note:
See TracChangeset
for help on using the changeset viewer.