Changeset 65684 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 8, 2017 3:42:47 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/global
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
r65678 r65684 53 53 UISettingsPageGlobal::fetchData(data); 54 54 55 /* Load to cache: */ 56 m_cache.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder(); 57 m_cache.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary(); 58 m_cache.m_fHostScreenSaverDisabled = m_settings.hostScreenSaverDisabled(); 55 /* Clear cache initially: */ 56 m_cache.clear(); 57 58 /* Prepare old data: */ 59 UIDataSettingsGlobalGeneral oldData; 60 61 /* Gather old data: */ 62 oldData.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder(); 63 oldData.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary(); 64 oldData.m_fHostScreenSaverDisabled = m_settings.hostScreenSaverDisabled(); 65 66 /* Cache old data: */ 67 m_cache.cacheInitialData(oldData); 59 68 60 69 /* Upload properties & settings to data: */ … … 64 73 void UIGlobalSettingsGeneral::getFromCache() 65 74 { 66 /* Fetch from cache: */ 67 m_pSelectorMachineFolder->setPath(m_cache.m_strDefaultMachineFolder); 68 m_pSelectorVRDPLibName->setPath(m_cache.m_strVRDEAuthLibrary); 69 m_pCheckBoxHostScreenSaver->setChecked(m_cache.m_fHostScreenSaverDisabled); 75 /* Get old data from cache: */ 76 const UIDataSettingsGlobalGeneral &oldData = m_cache.base(); 77 78 /* Load old data from cache: */ 79 m_pSelectorMachineFolder->setPath(oldData.m_strDefaultMachineFolder); 80 m_pSelectorVRDPLibName->setPath(oldData.m_strVRDEAuthLibrary); 81 m_pCheckBoxHostScreenSaver->setChecked(oldData.m_fHostScreenSaverDisabled); 70 82 } 71 83 72 84 void UIGlobalSettingsGeneral::putToCache() 73 85 { 74 /* Upload to cache: */ 75 m_cache.m_strDefaultMachineFolder = m_pSelectorMachineFolder->path(); 76 m_cache.m_strVRDEAuthLibrary = m_pSelectorVRDPLibName->path(); 77 m_cache.m_fHostScreenSaverDisabled = m_pCheckBoxHostScreenSaver->isChecked(); 86 /* Prepare new data: */ 87 UIDataSettingsGlobalGeneral newData = m_cache.base(); 88 89 /* Gather new data: */ 90 newData.m_strDefaultMachineFolder = m_pSelectorMachineFolder->path(); 91 newData.m_strVRDEAuthLibrary = m_pSelectorVRDPLibName->path(); 92 newData.m_fHostScreenSaverDisabled = m_pCheckBoxHostScreenSaver->isChecked(); 93 94 /* Cache new data: */ 95 m_cache.cacheCurrentData(newData); 78 96 } 79 97 … … 83 101 UISettingsPageGlobal::fetchData(data); 84 102 85 /* Save from cache: */ 86 if (m_properties.isOk() && m_pSelectorMachineFolder->isModified()) 87 m_properties.SetDefaultMachineFolder(m_cache.m_strDefaultMachineFolder); 88 if (m_properties.isOk() && m_pSelectorVRDPLibName->isModified()) 89 m_properties.SetVRDEAuthLibrary(m_cache.m_strVRDEAuthLibrary); 90 m_settings.setHostScreenSaverDisabled(m_cache.m_fHostScreenSaverDisabled); 103 /* Save new data from cache: */ 104 if (m_cache.wasChanged()) 105 { 106 if ( m_properties.isOk() 107 && m_cache.data().m_strDefaultMachineFolder != m_cache.base().m_strDefaultMachineFolder) 108 m_properties.SetDefaultMachineFolder(m_cache.data().m_strDefaultMachineFolder); 109 if ( m_properties.isOk() 110 && m_cache.data().m_strVRDEAuthLibrary != m_cache.base().m_strVRDEAuthLibrary) 111 m_properties.SetVRDEAuthLibrary(m_cache.data().m_strVRDEAuthLibrary); 112 if (m_cache.data().m_fHostScreenSaverDisabled != m_cache.base().m_fHostScreenSaverDisabled) 113 m_settings.setHostScreenSaverDisabled(m_cache.data().m_fHostScreenSaverDisabled); 114 } 91 115 92 116 /* Upload properties & settings to data: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
r65678 r65684 24 24 25 25 26 /** Global settings: General page cachestructure. */27 struct UI SettingsCacheGlobalGeneral26 /** Global settings: General page data structure. */ 27 struct UIDataSettingsGlobalGeneral 28 28 { 29 /** Constructs data. */ 30 UIDataSettingsGlobalGeneral() 31 : m_strDefaultMachineFolder(QString()) 32 , m_strVRDEAuthLibrary(QString()) 33 , m_fHostScreenSaverDisabled(false) 34 {} 35 36 /** Returns whether the @a other passed data is equal to this one. */ 37 bool equal(const UIDataSettingsGlobalGeneral &other) const 38 { 39 return true 40 && (m_strDefaultMachineFolder == other.m_strDefaultMachineFolder) 41 && (m_strVRDEAuthLibrary == other.m_strVRDEAuthLibrary) 42 && (m_fHostScreenSaverDisabled == other.m_fHostScreenSaverDisabled) 43 ; 44 } 45 46 /** Returns whether the @a other passed data is equal to this one. */ 47 bool operator==(const UIDataSettingsGlobalGeneral &other) const { return equal(other); } 48 /** Returns whether the @a other passed data is different from this one. */ 49 bool operator!=(const UIDataSettingsGlobalGeneral &other) const { return !equal(other); } 50 29 51 /** Holds the default machine folder path. */ 30 52 QString m_strDefaultMachineFolder; … … 34 56 bool m_fHostScreenSaverDisabled; 35 57 }; 58 typedef UISettingsCache<UIDataSettingsGlobalGeneral> UISettingsCacheGlobalGeneral; 36 59 37 60
Note:
See TracChangeset
for help on using the changeset viewer.