Changeset 66169 in vbox
- Timestamp:
- Mar 20, 2017 2:18:54 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/global
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
r65681 r66169 27 27 28 28 29 /** Global settings: Display page data structure. */ 30 struct UIDataSettingsGlobalDisplay 31 { 32 /** Constructs data. */ 33 UIDataSettingsGlobalDisplay() 34 : m_strMaxGuestResolution(QString()) 35 , m_fActivateHoveredMachineWindow(false) 36 {} 37 38 /** Returns whether the @a other passed data is equal to this one. */ 39 bool equal(const UIDataSettingsGlobalDisplay &other) const 40 { 41 return true 42 && (m_strMaxGuestResolution == other.m_strMaxGuestResolution) 43 && (m_fActivateHoveredMachineWindow == other.m_fActivateHoveredMachineWindow) 44 ; 45 } 46 47 /** Returns whether the @a other passed data is equal to this one. */ 48 bool operator==(const UIDataSettingsGlobalDisplay &other) const { return equal(other); } 49 /** Returns whether the @a other passed data is different from this one. */ 50 bool operator!=(const UIDataSettingsGlobalDisplay &other) const { return !equal(other); } 51 52 /** Holds the maximum guest resolution or preset name. */ 53 QString m_strMaxGuestResolution; 54 /** Holds whether we should automatically activate machine window under the mouse cursor. */ 55 bool m_fActivateHoveredMachineWindow; 56 }; 57 58 29 59 UIGlobalSettingsDisplay::UIGlobalSettingsDisplay() 60 : m_pCache(new UISettingsCacheGlobalDisplay) 30 61 { 31 62 /* Apply UI decorations: */ … … 48 79 } 49 80 81 UIGlobalSettingsDisplay::~UIGlobalSettingsDisplay() 82 { 83 /* Cleanup cache: */ 84 delete m_pCache; 85 m_pCache = 0; 86 } 87 50 88 void UIGlobalSettingsDisplay::loadToCacheFrom(QVariant &data) 51 89 { … … 54 92 55 93 /* Clear cache initially: */ 56 m_ cache.clear();94 m_pCache->clear(); 57 95 58 96 /* Prepare old data: */ … … 64 102 65 103 /* Cache old data: */ 66 m_ cache.cacheInitialData(oldData);104 m_pCache->cacheInitialData(oldData); 67 105 68 106 /* Upload properties & settings to data: */ … … 73 111 { 74 112 /* Get old data from cache: */ 75 const UIDataSettingsGlobalDisplay &oldData = m_ cache.base();113 const UIDataSettingsGlobalDisplay &oldData = m_pCache->base(); 76 114 77 115 /* Load old data from cache: */ … … 104 142 { 105 143 /* Prepare new data: */ 106 UIDataSettingsGlobalDisplay newData = m_ cache.base();144 UIDataSettingsGlobalDisplay newData = m_pCache->base(); 107 145 108 146 /* Gather new data: */ … … 127 165 128 166 /* Cache new data: */ 129 m_ cache.cacheCurrentData(newData);167 m_pCache->cacheCurrentData(newData); 130 168 } 131 169 … … 136 174 137 175 /* Save new data from cache: */ 138 if (m_ cache.wasChanged())139 { 140 if (m_ cache.data().m_strMaxGuestResolution != m_cache.base().m_strMaxGuestResolution)141 m_settings.setMaxGuestRes(m_ cache.data().m_strMaxGuestResolution);142 if (m_ cache.data().m_fActivateHoveredMachineWindow != m_cache.base().m_fActivateHoveredMachineWindow)143 gEDataManager->setActivateHoveredMachineWindow(m_ cache.data().m_fActivateHoveredMachineWindow);176 if (m_pCache->wasChanged()) 177 { 178 if (m_pCache->data().m_strMaxGuestResolution != m_pCache->base().m_strMaxGuestResolution) 179 m_settings.setMaxGuestRes(m_pCache->data().m_strMaxGuestResolution); 180 if (m_pCache->data().m_fActivateHoveredMachineWindow != m_pCache->base().m_fActivateHoveredMachineWindow) 181 gEDataManager->setActivateHoveredMachineWindow(m_pCache->data().m_fActivateHoveredMachineWindow); 144 182 } 145 183 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h
r66163 r66169 23 23 #include "UIGlobalSettingsDisplay.gen.h" 24 24 25 26 /** Global settings: Display page data structure. */ 27 struct UIDataSettingsGlobalDisplay 28 { 29 /** Constructs data. */ 30 UIDataSettingsGlobalDisplay() 31 : m_strMaxGuestResolution(QString()) 32 , m_fActivateHoveredMachineWindow(false) 33 {} 34 35 /** Returns whether the @a other passed data is equal to this one. */ 36 bool equal(const UIDataSettingsGlobalDisplay &other) const 37 { 38 return true 39 && (m_strMaxGuestResolution == other.m_strMaxGuestResolution) 40 && (m_fActivateHoveredMachineWindow == other.m_fActivateHoveredMachineWindow) 41 ; 42 } 43 44 /** Returns whether the @a other passed data is equal to this one. */ 45 bool operator==(const UIDataSettingsGlobalDisplay &other) const { return equal(other); } 46 /** Returns whether the @a other passed data is different from this one. */ 47 bool operator!=(const UIDataSettingsGlobalDisplay &other) const { return !equal(other); } 48 49 /** Holds the maximum guest resolution or preset name. */ 50 QString m_strMaxGuestResolution; 51 /** Holds whether we should automatically activate machine window under the mouse cursor. */ 52 bool m_fActivateHoveredMachineWindow; 53 }; 25 /* Forward declarations: */ 26 struct UIDataSettingsGlobalDisplay; 54 27 typedef UISettingsCache<UIDataSettingsGlobalDisplay> UISettingsCacheGlobalDisplay; 55 28 … … 62 35 public: 63 36 64 /* Constructor:*/37 /** Constructs Display settings page. */ 65 38 UIGlobalSettingsDisplay(); 39 /** Destructs Display settings page. */ 40 ~UIGlobalSettingsDisplay(); 66 41 67 42 protected: … … 97 72 void populate(); 98 73 99 /* Cache:*/100 UISettingsCacheGlobalDisplay m_cache;74 /** Holds the page data cache instance. */ 75 UISettingsCacheGlobalDisplay *m_pCache; 101 76 }; 102 77 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
r65690 r66169 39 39 40 40 41 /** Global settings: Extension page item data structure. */ 42 struct UIDataSettingsGlobalExtensionItem 43 { 44 /** Constructs data. */ 45 UIDataSettingsGlobalExtensionItem() 46 : m_strName(QString()) 47 , m_strDescription(QString()) 48 , m_strVersion(QString()) 49 , m_uRevision(0) 50 , m_fIsUsable(false) 51 , m_strWhyUnusable(QString()) 52 {} 53 54 /** Returns whether the @a other passed data is equal to this one. */ 55 bool equal(const UIDataSettingsGlobalExtensionItem &other) const 56 { 57 return true 58 && (m_strName == other.m_strName) 59 && (m_strDescription == other.m_strDescription) 60 && (m_strVersion == other.m_strVersion) 61 && (m_uRevision == other.m_uRevision) 62 && (m_fIsUsable == other.m_fIsUsable) 63 && (m_strWhyUnusable == other.m_strWhyUnusable) 64 ; 65 } 66 67 /** Returns whether the @a other passed data is equal to this one. */ 68 bool operator==(const UIDataSettingsGlobalExtensionItem &other) const { return equal(other); } 69 /** Returns whether the @a other passed data is different from this one. */ 70 bool operator!=(const UIDataSettingsGlobalExtensionItem &other) const { return !equal(other); } 71 72 /** Holds the extension item name. */ 73 QString m_strName; 74 /** Holds the extension item description. */ 75 QString m_strDescription; 76 /** Holds the extension item version. */ 77 QString m_strVersion; 78 /** Holds the extension item revision. */ 79 ULONG m_uRevision; 80 /** Holds whether the extension item usable. */ 81 bool m_fIsUsable; 82 /** Holds why the extension item is unusable. */ 83 QString m_strWhyUnusable; 84 }; 85 86 87 /** Global settings: Extension page data structure. */ 88 struct UIDataSettingsGlobalExtension 89 { 90 /** Constructs data. */ 91 UIDataSettingsGlobalExtension() 92 : m_items(QList<UIDataSettingsGlobalExtensionItem>()) 93 {} 94 95 /** Returns whether the @a other passed data is equal to this one. */ 96 bool equal(const UIDataSettingsGlobalExtension &other) const 97 { 98 return true 99 && (m_items == other.m_items) 100 ; 101 } 102 103 /** Returns whether the @a other passed data is equal to this one. */ 104 bool operator==(const UIDataSettingsGlobalExtension &other) const { return equal(other); } 105 /** Returns whether the @a other passed data is different from this one. */ 106 bool operator!=(const UIDataSettingsGlobalExtension &other) const { return !equal(other); } 107 108 /** Holds the extension items. */ 109 QList<UIDataSettingsGlobalExtensionItem> m_items; 110 }; 111 112 41 113 /* Extension package item: */ 42 114 class UIExtensionPackageItem : public QITreeWidgetItem … … 100 172 UIGlobalSettingsExtension::UIGlobalSettingsExtension() 101 173 : m_pActionAdd(0), m_pActionRemove(0) 174 , m_pCache(new UISettingsCacheGlobalExtension) 102 175 { 103 176 /* Apply UI decorations: */ … … 140 213 } 141 214 215 UIGlobalSettingsExtension::~UIGlobalSettingsExtension() 216 { 217 /* Cleanup cache: */ 218 delete m_pCache; 219 m_pCache = 0; 220 } 221 142 222 /* static */ 143 223 void UIGlobalSettingsExtension::doInstallation(QString const &strFilePath, QString const &strDigest, … … 243 323 244 324 /* Clear cache initially: */ 245 m_ cache.clear();325 m_pCache->clear(); 246 326 247 327 /* Prepare old data: */ … … 252 332 const CExtPackVector &packages = manager.GetInstalledExtPacks(); 253 333 for (int i = 0; i < packages.size(); ++i) 254 oldData.m_items << fetchData(packages[i]); 334 { 335 UIDataSettingsGlobalExtensionItem item; 336 fetchData(packages[i], item); 337 oldData.m_items << item; 338 } 255 339 256 340 /* Cache old data: */ 257 m_ cache.cacheInitialData(oldData);341 m_pCache->cacheInitialData(oldData); 258 342 259 343 /* Upload properties & settings to data: */ … … 264 348 { 265 349 /* Get old data from cache: */ 266 const UIDataSettingsGlobalExtension &oldData = m_ cache.base();350 const UIDataSettingsGlobalExtension &oldData = m_pCache->base(); 267 351 268 352 /* Load old data from cache: */ … … 378 462 { 379 463 /* Remove it from the cache. */ 380 for (int i = 0; i < m_ cache.data().m_items.size(); ++i)464 for (int i = 0; i < m_pCache->data().m_items.size(); ++i) 381 465 { 382 if (!strExtPackName.compare(m_ cache.data().m_items.at(i).m_strName, Qt::CaseInsensitive))466 if (!strExtPackName.compare(m_pCache->data().m_items.at(i).m_strName, Qt::CaseInsensitive)) 383 467 { 384 m_ cache.data().m_items.removeAt(i);468 m_pCache->data().m_items.removeAt(i); 385 469 break; 386 470 } … … 404 488 if (package.isOk()) 405 489 { 406 m_cache.data().m_items << fetchData(package); 407 408 UIExtensionPackageItem *pItem = new UIExtensionPackageItem(m_pPackagesTree, m_cache.data().m_items.last()); 490 UIDataSettingsGlobalExtensionItem item; 491 fetchData(package, item); 492 m_pCache->data().m_items << item; 493 494 UIExtensionPackageItem *pItem = new UIExtensionPackageItem(m_pPackagesTree, m_pCache->data().m_items.last()); 409 495 m_pPackagesTree->setCurrentItem(pItem); 410 496 m_pPackagesTree->sortByColumn(1, Qt::AscendingOrder); … … 447 533 { 448 534 /* Remove selected package from cache: */ 449 for (int i = 0; i < m_ cache.data().m_items.size(); ++i)535 for (int i = 0; i < m_pCache->data().m_items.size(); ++i) 450 536 { 451 if (!strSelectedPackageName.compare(m_ cache.data().m_items.at(i).m_strName, Qt::CaseInsensitive))537 if (!strSelectedPackageName.compare(m_pCache->data().m_items.at(i).m_strName, Qt::CaseInsensitive)) 452 538 { 453 m_ cache.data().m_items.removeAt(i);539 m_pCache->data().m_items.removeAt(i); 454 540 break; 455 541 } … … 467 553 } 468 554 469 UIDataSettingsGlobalExtensionItem UIGlobalSettingsExtension::fetchData(const CExtPack &package) const 470 { 471 UIDataSettingsGlobalExtensionItem item; 555 void UIGlobalSettingsExtension::fetchData(const CExtPack &package, UIDataSettingsGlobalExtensionItem &item) const 556 { 472 557 item.m_strName = package.GetName(); 473 558 item.m_strDescription = package.GetDescription(); … … 477 562 if (!item.m_fIsUsable) 478 563 item.m_strWhyUnusable = package.GetWhyUnusable(); 479 return item; 480 } 481 564 } 565 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.h
r66163 r66169 23 23 #include "UIGlobalSettingsExtension.gen.h" 24 24 25 26 /** Global settings: Extension page item data structure. */ 27 struct UIDataSettingsGlobalExtensionItem 28 { 29 /** Constructs data. */ 30 UIDataSettingsGlobalExtensionItem() 31 : m_strName(QString()) 32 , m_strDescription(QString()) 33 , m_strVersion(QString()) 34 , m_uRevision(0) 35 , m_fIsUsable(false) 36 , m_strWhyUnusable(QString()) 37 {} 38 39 /** Returns whether the @a other passed data is equal to this one. */ 40 bool equal(const UIDataSettingsGlobalExtensionItem &other) const 41 { 42 return true 43 && (m_strName == other.m_strName) 44 && (m_strDescription == other.m_strDescription) 45 && (m_strVersion == other.m_strVersion) 46 && (m_uRevision == other.m_uRevision) 47 && (m_fIsUsable == other.m_fIsUsable) 48 && (m_strWhyUnusable == other.m_strWhyUnusable) 49 ; 50 } 51 52 /** Returns whether the @a other passed data is equal to this one. */ 53 bool operator==(const UIDataSettingsGlobalExtensionItem &other) const { return equal(other); } 54 /** Returns whether the @a other passed data is different from this one. */ 55 bool operator!=(const UIDataSettingsGlobalExtensionItem &other) const { return !equal(other); } 56 57 /** Holds the extension item name. */ 58 QString m_strName; 59 /** Holds the extension item description. */ 60 QString m_strDescription; 61 /** Holds the extension item version. */ 62 QString m_strVersion; 63 /** Holds the extension item revision. */ 64 ULONG m_uRevision; 65 /** Holds whether the extension item usable. */ 66 bool m_fIsUsable; 67 /** Holds why the extension item is unusable. */ 68 QString m_strWhyUnusable; 69 }; 70 71 72 /** Global settings: Extension page data structure. */ 73 struct UIDataSettingsGlobalExtension 74 { 75 /** Constructs data. */ 76 UIDataSettingsGlobalExtension() 77 : m_items(QList<UIDataSettingsGlobalExtensionItem>()) 78 {} 79 80 /** Returns whether the @a other passed data is equal to this one. */ 81 bool equal(const UIDataSettingsGlobalExtension &other) const 82 { 83 return true 84 && (m_items == other.m_items) 85 ; 86 } 87 88 /** Returns whether the @a other passed data is equal to this one. */ 89 bool operator==(const UIDataSettingsGlobalExtension &other) const { return equal(other); } 90 /** Returns whether the @a other passed data is different from this one. */ 91 bool operator!=(const UIDataSettingsGlobalExtension &other) const { return !equal(other); } 92 93 /** Holds the extension items. */ 94 QList<UIDataSettingsGlobalExtensionItem> m_items; 95 }; 25 /* Forward declarations: */ 26 struct UIDataSettingsGlobalExtension; 27 struct UIDataSettingsGlobalExtensionItem; 96 28 typedef UISettingsCache<UIDataSettingsGlobalExtension> UISettingsCacheGlobalExtension; 97 29 … … 104 36 public: 105 37 106 /* Constructor:*/38 /** Constructs Extension settings page. */ 107 39 UIGlobalSettingsExtension(); 40 /** Destructs Extension settings page. */ 41 ~UIGlobalSettingsExtension(); 108 42 109 43 static void doInstallation(QString const &strFilePath, QString const &strDigest, QWidget *pParent, QString *pstrExtPackName); … … 144 78 145 79 /* Prepare UIDataSettingsGlobalExtensionItem basing on CExtPack: */ 146 UIDataSettingsGlobalExtensionItem fetchData(const CExtPack &package) const;80 void fetchData(const CExtPack &package, UIDataSettingsGlobalExtensionItem &item) const; 147 81 148 82 /* Variables: Actions: */ … … 150 84 QAction *m_pActionRemove; 151 85 152 /* Cache:*/153 UISettingsCacheGlobalExtension m_cache;86 /** Holds the page data cache instance. */ 87 UISettingsCacheGlobalExtension *m_pCache; 154 88 }; 155 89 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
r65684 r66169 30 30 31 31 32 /** Global settings: General page data structure. */ 33 struct UIDataSettingsGlobalGeneral 34 { 35 /** Constructs data. */ 36 UIDataSettingsGlobalGeneral() 37 : m_strDefaultMachineFolder(QString()) 38 , m_strVRDEAuthLibrary(QString()) 39 , m_fHostScreenSaverDisabled(false) 40 {} 41 42 /** Returns whether the @a other passed data is equal to this one. */ 43 bool equal(const UIDataSettingsGlobalGeneral &other) const 44 { 45 return true 46 && (m_strDefaultMachineFolder == other.m_strDefaultMachineFolder) 47 && (m_strVRDEAuthLibrary == other.m_strVRDEAuthLibrary) 48 && (m_fHostScreenSaverDisabled == other.m_fHostScreenSaverDisabled) 49 ; 50 } 51 52 /** Returns whether the @a other passed data is equal to this one. */ 53 bool operator==(const UIDataSettingsGlobalGeneral &other) const { return equal(other); } 54 /** Returns whether the @a other passed data is different from this one. */ 55 bool operator!=(const UIDataSettingsGlobalGeneral &other) const { return !equal(other); } 56 57 /** Holds the default machine folder path. */ 58 QString m_strDefaultMachineFolder; 59 /** Holds the VRDE authentication library name. */ 60 QString m_strVRDEAuthLibrary; 61 /** Holds whether host screen-saver should be disabled. */ 62 bool m_fHostScreenSaverDisabled; 63 }; 64 65 32 66 UIGlobalSettingsGeneral::UIGlobalSettingsGeneral() 67 : m_pCache(new UISettingsCacheGlobalGeneral) 33 68 { 34 69 /* Apply UI decorations: */ … … 48 83 } 49 84 85 UIGlobalSettingsGeneral::~UIGlobalSettingsGeneral() 86 { 87 /* Cleanup cache: */ 88 delete m_pCache; 89 m_pCache = 0; 90 } 91 50 92 void UIGlobalSettingsGeneral::loadToCacheFrom(QVariant &data) 51 93 { … … 54 96 55 97 /* Clear cache initially: */ 56 m_ cache.clear();98 m_pCache->clear(); 57 99 58 100 /* Prepare old data: */ … … 65 107 66 108 /* Cache old data: */ 67 m_ cache.cacheInitialData(oldData);109 m_pCache->cacheInitialData(oldData); 68 110 69 111 /* Upload properties & settings to data: */ … … 74 116 { 75 117 /* Get old data from cache: */ 76 const UIDataSettingsGlobalGeneral &oldData = m_ cache.base();118 const UIDataSettingsGlobalGeneral &oldData = m_pCache->base(); 77 119 78 120 /* Load old data from cache: */ … … 85 127 { 86 128 /* Prepare new data: */ 87 UIDataSettingsGlobalGeneral newData = m_ cache.base();129 UIDataSettingsGlobalGeneral newData = m_pCache->base(); 88 130 89 131 /* Gather new data: */ … … 93 135 94 136 /* Cache new data: */ 95 m_ cache.cacheCurrentData(newData);137 m_pCache->cacheCurrentData(newData); 96 138 } 97 139 … … 102 144 103 145 /* Save new data from cache: */ 104 if (m_ cache.wasChanged())146 if (m_pCache->wasChanged()) 105 147 { 106 148 if ( m_properties.isOk() 107 && m_ cache.data().m_strDefaultMachineFolder != m_cache.base().m_strDefaultMachineFolder)108 m_properties.SetDefaultMachineFolder(m_ cache.data().m_strDefaultMachineFolder);149 && m_pCache->data().m_strDefaultMachineFolder != m_pCache->base().m_strDefaultMachineFolder) 150 m_properties.SetDefaultMachineFolder(m_pCache->data().m_strDefaultMachineFolder); 109 151 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);152 && m_pCache->data().m_strVRDEAuthLibrary != m_pCache->base().m_strVRDEAuthLibrary) 153 m_properties.SetVRDEAuthLibrary(m_pCache->data().m_strVRDEAuthLibrary); 154 if (m_pCache->data().m_fHostScreenSaverDisabled != m_pCache->base().m_fHostScreenSaverDisabled) 155 m_settings.setHostScreenSaverDisabled(m_pCache->data().m_fHostScreenSaverDisabled); 114 156 } 115 157 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
r66163 r66169 23 23 #include "UIGlobalSettingsGeneral.gen.h" 24 24 25 26 /** Global settings: General page data structure. */ 27 struct UIDataSettingsGlobalGeneral 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 51 /** Holds the default machine folder path. */ 52 QString m_strDefaultMachineFolder; 53 /** Holds the VRDE authentication library name. */ 54 QString m_strVRDEAuthLibrary; 55 /** Holds whether host screen-saver should be disabled. */ 56 bool m_fHostScreenSaverDisabled; 57 }; 25 /* Forward declarations: */ 26 struct UIDataSettingsGlobalGeneral; 58 27 typedef UISettingsCache<UIDataSettingsGlobalGeneral> UISettingsCacheGlobalGeneral; 59 28 … … 66 35 public: 67 36 68 /* Constructor:*/37 /** Constructs General settings page. */ 69 38 UIGlobalSettingsGeneral(); 39 /** Destructs General settings page. */ 40 ~UIGlobalSettingsGeneral(); 70 41 71 42 protected: … … 93 64 private: 94 65 95 /* Cache:*/96 UISettingsCacheGlobalGeneral m_cache;66 /** Holds the page data cache instance. */ 67 UISettingsCacheGlobalGeneral *m_pCache; 97 68 }; 98 69 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
r66163 r66169 46 46 public: 47 47 48 /* Constructor:*/48 /** Constructs Input settings page. */ 49 49 UIGlobalSettingsInput(); 50 /* Destructor:*/50 /** Destructs Input settings page. */ 51 51 ~UIGlobalSettingsInput(); 52 52 … … 89 89 UIHotKeyTable *m_pMachineTable; 90 90 91 /** Holds the cache instance. */91 /** Holds the page data cache instance. */ 92 92 UISettingsCacheGlobalInput *m_pCache; 93 93 }; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp
r66163 r66169 48 48 49 49 50 /** Global settings: Language page data structure. */ 51 struct UIDataSettingsGlobalLanguage 52 { 53 /** Constructs data. */ 54 UIDataSettingsGlobalLanguage() 55 : m_strLanguageId(QString()) 56 {} 57 58 /** Returns whether the @a other passed data is equal to this one. */ 59 bool equal(const UIDataSettingsGlobalLanguage &other) const 60 { 61 return true 62 && (m_strLanguageId == other.m_strLanguageId) 63 ; 64 } 65 66 /** Returns whether the @a other passed data is equal to this one. */ 67 bool operator==(const UIDataSettingsGlobalLanguage &other) const { return equal(other); } 68 /** Returns whether the @a other passed data is different from this one. */ 69 bool operator!=(const UIDataSettingsGlobalLanguage &other) const { return !equal(other); } 70 71 /** Holds the current language id. */ 72 QString m_strLanguageId; 73 }; 74 75 50 76 /* Language item: */ 51 77 class UILanguageItem : public QITreeWidgetItem … … 181 207 UIGlobalSettingsLanguage::UIGlobalSettingsLanguage() 182 208 : m_fPolished(false) 209 , m_pCache(new UISettingsCacheGlobalLanguage) 183 210 { 184 211 /* Apply UI decorations: */ … … 204 231 } 205 232 233 UIGlobalSettingsLanguage::~UIGlobalSettingsLanguage() 234 { 235 /* Cleanup cache: */ 236 delete m_pCache; 237 m_pCache = 0; 238 } 239 206 240 void UIGlobalSettingsLanguage::loadToCacheFrom(QVariant &data) 207 241 { … … 210 244 211 245 /* Clear cache initially: */ 212 m_ cache.clear();246 m_pCache->clear(); 213 247 214 248 /* Prepare old data: */ … … 219 253 220 254 /* Cache old data: */ 221 m_ cache.cacheInitialData(oldData);255 m_pCache->cacheInitialData(oldData); 222 256 223 257 /* Upload properties & settings to data: */ … … 228 262 { 229 263 /* Get old data from cache: */ 230 const UIDataSettingsGlobalLanguage &oldData = m_ cache.base();264 const UIDataSettingsGlobalLanguage &oldData = m_pCache->base(); 231 265 232 266 /* Load old data from cache: */ … … 237 271 { 238 272 /* Prepare new data: */ 239 UIDataSettingsGlobalLanguage newData = m_ cache.base();273 UIDataSettingsGlobalLanguage newData = m_pCache->base(); 240 274 241 275 /* Gather new data: */ … … 246 280 247 281 /* Cache new data: */ 248 m_ cache.cacheCurrentData(newData);282 m_pCache->cacheCurrentData(newData); 249 283 } 250 284 … … 255 289 256 290 /* Save new data from cache: */ 257 if (m_ cache.wasChanged())291 if (m_pCache->wasChanged()) 258 292 { 259 293 /* Save from cache: */ 260 if (m_ cache.data().m_strLanguageId != m_cache.base().m_strLanguageId)261 m_settings.setLanguageId(m_ cache.data().m_strLanguageId);294 if (m_pCache->data().m_strLanguageId != m_pCache->base().m_strLanguageId) 295 m_settings.setLanguageId(m_pCache->data().m_strLanguageId); 262 296 } 263 297 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h
r66163 r66169 23 23 #include "UIGlobalSettingsLanguage.gen.h" 24 24 25 26 /** Global settings: Language page data structure. */ 27 struct UIDataSettingsGlobalLanguage 28 { 29 /** Constructs data. */ 30 UIDataSettingsGlobalLanguage() 31 : m_strLanguageId(QString()) 32 {} 33 34 /** Returns whether the @a other passed data is equal to this one. */ 35 bool equal(const UIDataSettingsGlobalLanguage &other) const 36 { 37 return true 38 && (m_strLanguageId == other.m_strLanguageId) 39 ; 40 } 41 42 /** Returns whether the @a other passed data is equal to this one. */ 43 bool operator==(const UIDataSettingsGlobalLanguage &other) const { return equal(other); } 44 /** Returns whether the @a other passed data is different from this one. */ 45 bool operator!=(const UIDataSettingsGlobalLanguage &other) const { return !equal(other); } 46 47 /** Holds the current language id. */ 48 QString m_strLanguageId; 49 }; 25 /* Forward declartions: */ 26 struct UIDataSettingsGlobalLanguage; 50 27 typedef UISettingsCache<UIDataSettingsGlobalLanguage> UISettingsCacheGlobalLanguage; 51 28 … … 58 35 public: 59 36 60 /* Constructor:*/37 /** Constructs Language settings page. */ 61 38 UIGlobalSettingsLanguage(); 39 /** Destructs Language settings page. */ 40 ~UIGlobalSettingsLanguage(); 62 41 63 42 protected: … … 104 83 bool m_fPolished; 105 84 106 /* Cache:*/107 UISettingsCacheGlobalLanguage m_cache;85 /** Holds the page data cache instance. */ 86 UISettingsCacheGlobalLanguage *m_pCache; 108 87 }; 109 88 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r66163 r66169 43 43 /* COM includes: */ 44 44 #include "CDHCPServer.h" 45 46 47 /** Global settings: Network page data structure. */ 48 struct UIDataSettingsGlobalNetwork 49 { 50 /** Constructs data. */ 51 UIDataSettingsGlobalNetwork() 52 : m_networksNAT(QList<UIDataSettingsGlobalNetworkNAT>()) 53 , m_networksHost(QList<UIDataSettingsGlobalNetworkHost>()) 54 {} 55 56 /** Returns whether the @a other passed data is equal to this one. */ 57 bool equal(const UIDataSettingsGlobalNetwork &other) const 58 { 59 return true 60 && (m_networksNAT == other.m_networksNAT) 61 && (m_networksHost == other.m_networksHost) 62 ; 63 } 64 65 /** Returns whether the @a other passed data is equal to this one. */ 66 bool operator==(const UIDataSettingsGlobalNetwork &other) const { return equal(other); } 67 /** Returns whether the @a other passed data is different from this one. */ 68 bool operator!=(const UIDataSettingsGlobalNetwork &other) const { return !equal(other); } 69 70 /** Holds the NAT network data. */ 71 QList<UIDataSettingsGlobalNetworkNAT> m_networksNAT; 72 /** Holds the host network data. */ 73 QList<UIDataSettingsGlobalNetworkHost> m_networksHost; 74 }; 45 75 46 76 … … 393 423 : m_pActionAddNetworkNAT(0), m_pActionDelNetworkNAT(0), m_pActionEditNetworkNAT(0) 394 424 , m_pActionAddNetworkHost(0), m_pActionDelNetworkHost(0), m_pActionEditNetworkHost(0) 425 , m_pCache(new UISettingsCacheGlobalNetwork) 395 426 { 396 427 /* Apply UI decorations: */ … … 511 542 } 512 543 544 UIGlobalSettingsNetwork::~UIGlobalSettingsNetwork() 545 { 546 /* Cleanup cache: */ 547 delete m_pCache; 548 m_pCache = 0; 549 } 550 513 551 void UIGlobalSettingsNetwork::loadToCacheFrom(QVariant &data) 514 552 { … … 517 555 518 556 /* Clear cache initially: */ 519 m_ cache.clear();557 m_pCache->clear(); 520 558 521 559 /* Prepare old data: */ … … 524 562 /* Gather old data: */ 525 563 foreach (const CNATNetwork &network, vboxGlobal().virtualBox().GetNATNetworks()) 526 oldData.m_networksNAT << generateDataNetworkNAT(network); 564 { 565 UIDataSettingsGlobalNetworkNAT data; 566 generateDataNetworkNAT(network, data); 567 oldData.m_networksNAT << data; 568 } 527 569 foreach (const CHostNetworkInterface &iface, vboxGlobal().host().GetNetworkInterfaces()) 528 570 if (iface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly) 529 oldData.m_networksHost << generateDataNetworkHost(iface); 571 { 572 UIDataSettingsGlobalNetworkHost data; 573 generateDataNetworkHost(iface, data); 574 oldData.m_networksHost << data; 575 } 530 576 531 577 /* Cache old data: */ 532 m_ cache.cacheInitialData(oldData);578 m_pCache->cacheInitialData(oldData); 533 579 534 580 /* Upload properties & settings to data: */ … … 539 585 { 540 586 /* Get old data from cache: */ 541 const UIDataSettingsGlobalNetwork &oldData = m_ cache.base();587 const UIDataSettingsGlobalNetwork &oldData = m_pCache->base(); 542 588 543 589 /* Load old data from cache: */ … … 560 606 { 561 607 /* Prepare new data: */ 562 UIDataSettingsGlobalNetwork newData = m_ cache.base();608 UIDataSettingsGlobalNetwork newData = m_pCache->base(); 563 609 564 610 /* Gather new data: */ … … 581 627 582 628 /* Cache new data: */ 583 m_ cache.cacheCurrentData(newData);629 m_pCache->cacheCurrentData(newData); 584 630 } 585 631 … … 590 636 591 637 /* Save new data from cache: */ 592 if (m_ cache.wasChanged())593 { 594 if (m_ cache.data().m_networksNAT != m_cache.base().m_networksNAT)595 foreach (const UIDataSettingsGlobalNetworkNAT &data, m_ cache.data().m_networksNAT)638 if (m_pCache->wasChanged()) 639 { 640 if (m_pCache->data().m_networksNAT != m_pCache->base().m_networksNAT) 641 foreach (const UIDataSettingsGlobalNetworkNAT &data, m_pCache->data().m_networksNAT) 596 642 saveCacheItemNetworkNAT(data); 597 if (m_ cache.data().m_networksHost != m_cache.base().m_networksHost)598 foreach (const UIDataSettingsGlobalNetworkHost &data, m_ cache.data().m_networksHost)643 if (m_pCache->data().m_networksHost != m_pCache->base().m_networksHost) 644 foreach (const UIDataSettingsGlobalNetworkHost &data, m_pCache->data().m_networksHost) 599 645 saveCacheItemNetworkHost(data); 600 646 } … … 750 796 751 797 /* Update tree: */ 752 createTreeItemNetworkNAT(generateDataNetworkNAT(network), true); 798 UIDataSettingsGlobalNetworkNAT data; 799 generateDataNetworkNAT(network, data); 800 createTreeItemNetworkNAT(data, true); 753 801 m_pTreeNetworkNAT->sortByColumn(1, Qt::AscendingOrder); 754 802 } … … 839 887 840 888 /* Update tree: */ 841 createTreeItemNetworkHost(generateDataNetworkHost(iface), true); 889 UIDataSettingsGlobalNetworkHost data; 890 generateDataNetworkHost(iface, data); 891 createTreeItemNetworkHost(data, true); 842 892 m_pTreeNetworkHost->sortByColumn(0, Qt::AscendingOrder); 843 893 } … … 956 1006 } 957 1007 958 UIDataSettingsGlobalNetworkNAT UIGlobalSettingsNetwork::generateDataNetworkNAT(const CNATNetwork &network) 959 { 960 /* Prepare data: */ 961 UIDataSettingsGlobalNetworkNAT data; 962 1008 void UIGlobalSettingsNetwork::generateDataNetworkNAT(const CNATNetwork &network, UIDataSettingsGlobalNetworkNAT &data) 1009 { 963 1010 /* Load NAT network settings: */ 964 1011 data.m_fEnabled = network.GetEnabled(); … … 1017 1064 rules[5].toUInt()); 1018 1065 } 1019 1020 /* Return data: */1021 return data;1022 1066 } 1023 1067 … … 1075 1119 } 1076 1120 1077 UIDataSettingsGlobalNetworkHost UIGlobalSettingsNetwork::generateDataNetworkHost(const CHostNetworkInterface &iface) 1078 { 1079 /* Prepare data: */ 1080 UIDataSettingsGlobalNetworkHost data; 1081 1121 void UIGlobalSettingsNetwork::generateDataNetworkHost(const CHostNetworkInterface &iface, UIDataSettingsGlobalNetworkHost &data) 1122 { 1082 1123 /* Get DHCP server (create if necessary): */ 1083 1124 CDHCPServer dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName()); … … 1089 1130 { 1090 1131 msgCenter().cannotCreateDHCPServer(vbox, this); 1091 return data;1132 return; 1092 1133 } 1093 1134 dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName()); … … 1095 1136 Assert(!dhcp.isNull()); 1096 1137 if (dhcp.isNull()) 1097 return data;1138 return; 1098 1139 1099 1140 /* Host interface settings: */ … … 1112 1153 data.m_dhcpserver.m_strDhcpLowerAddress = dhcp.GetLowerIP(); 1113 1154 data.m_dhcpserver.m_strDhcpUpperAddress = dhcp.GetUpperIP(); 1114 1115 /* Return data: */1116 return data;1117 1155 } 1118 1156 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h
r66163 r66169 22 22 #include "UISettingsPage.h" 23 23 #include "UIGlobalSettingsNetwork.gen.h" 24 #include "UIPortForwardingTable.h"25 24 26 25 /* Forward declarations: */ 27 26 class UIItemNetworkNAT; 28 27 class UIItemNetworkHost; 29 30 31 /** Global settings: Network page: NAT network data structure. */ 32 struct UIDataSettingsGlobalNetworkNAT 33 { 34 /** Constructs data. */ 35 UIDataSettingsGlobalNetworkNAT() 36 : m_fEnabled(false) 37 , m_strName(QString()) 38 , m_strNewName(QString()) 39 , m_strCIDR(QString()) 40 , m_fSupportsDHCP(false) 41 , m_fSupportsIPv6(false) 42 , m_fAdvertiseDefaultIPv6Route(false) 43 , m_ipv4rules(QList<UIPortForwardingData>()) 44 , m_ipv6rules(QList<UIPortForwardingData>()) 45 {} 46 47 /** Returns whether the @a other passed data is equal to this one. */ 48 bool equal(const UIDataSettingsGlobalNetworkNAT &other) const 49 { 50 return true 51 && (m_fEnabled == other.m_fEnabled) 52 && (m_strName == other.m_strName) 53 && (m_strNewName == other.m_strNewName) 54 && (m_strCIDR == other.m_strCIDR) 55 && (m_fSupportsDHCP == other.m_fSupportsDHCP) 56 && (m_fSupportsIPv6 == other.m_fSupportsIPv6) 57 && (m_fAdvertiseDefaultIPv6Route == other.m_fAdvertiseDefaultIPv6Route) 58 && (m_ipv4rules == other.m_ipv4rules) 59 && (m_ipv6rules == other.m_ipv6rules) 60 ; 61 } 62 63 /** Returns whether the @a other passed data is equal to this one. */ 64 bool operator==(const UIDataSettingsGlobalNetworkNAT &other) const { return equal(other); } 65 /** Returns whether the @a other passed data is different from this one. */ 66 bool operator!=(const UIDataSettingsGlobalNetworkNAT &other) const { return !equal(other); } 67 68 /** Holds whether this network enabled. */ 69 bool m_fEnabled; 70 /** Holds network name. */ 71 QString m_strName; 72 /** Holds new network name. */ 73 QString m_strNewName; 74 /** Holds network CIDR. */ 75 QString m_strCIDR; 76 /** Holds whether this network supports DHCP. */ 77 bool m_fSupportsDHCP; 78 /** Holds whether this network supports IPv6. */ 79 bool m_fSupportsIPv6; 80 /** Holds whether this network advertised as default IPv6 route. */ 81 bool m_fAdvertiseDefaultIPv6Route; 82 /** Holds IPv4 port forwarding rules. */ 83 UIPortForwardingDataList m_ipv4rules; 84 /** Holds IPv6 port forwarding rules. */ 85 UIPortForwardingDataList m_ipv6rules; 86 }; 87 88 89 /** Global settings: Network page: Host interface data structure. */ 90 struct UIDataSettingsGlobalNetworkHostInterface 91 { 92 /** Constructs data. */ 93 UIDataSettingsGlobalNetworkHostInterface() 94 : m_strName(QString()) 95 , m_fDhcpClientEnabled(false) 96 , m_strInterfaceAddress(QString()) 97 , m_strInterfaceMask(QString()) 98 , m_fIpv6Supported(false) 99 , m_strInterfaceAddress6(QString()) 100 , m_strInterfaceMaskLength6(QString()) 101 {} 102 103 /** Returns whether the @a other passed data is equal to this one. */ 104 bool equal(const UIDataSettingsGlobalNetworkHostInterface &other) const 105 { 106 return true 107 && (m_strName == other.m_strName) 108 && (m_fDhcpClientEnabled == other.m_fDhcpClientEnabled) 109 && (m_strInterfaceAddress == other.m_strInterfaceAddress) 110 && (m_strInterfaceMask == other.m_strInterfaceMask) 111 && (m_fIpv6Supported == other.m_fIpv6Supported) 112 && (m_strInterfaceAddress6 == other.m_strInterfaceAddress6) 113 && (m_strInterfaceMaskLength6 == other.m_strInterfaceMaskLength6) 114 ; 115 } 116 117 /** Returns whether the @a other passed data is equal to this one. */ 118 bool operator==(const UIDataSettingsGlobalNetworkHostInterface &other) const { return equal(other); } 119 /** Returns whether the @a other passed data is different from this one. */ 120 bool operator!=(const UIDataSettingsGlobalNetworkHostInterface &other) const { return !equal(other); } 121 122 /** Holds host interface name. */ 123 QString m_strName; 124 /** Holds whether DHCP client enabled. */ 125 bool m_fDhcpClientEnabled; 126 /** Holds IPv4 interface address. */ 127 QString m_strInterfaceAddress; 128 /** Holds IPv4 interface mask. */ 129 QString m_strInterfaceMask; 130 /** Holds whether IPv6 protocol supported. */ 131 bool m_fIpv6Supported; 132 /** Holds IPv6 interface address. */ 133 QString m_strInterfaceAddress6; 134 /** Holds IPv6 interface mask length. */ 135 QString m_strInterfaceMaskLength6; 136 }; 137 138 139 /** Global settings: Network page: DHCP server data structure. */ 140 struct UIDataSettingsGlobalNetworkDHCPServer 141 { 142 /** Constructs data. */ 143 UIDataSettingsGlobalNetworkDHCPServer() 144 : m_fDhcpServerEnabled(false) 145 , m_strDhcpServerAddress(QString()) 146 , m_strDhcpServerMask(QString()) 147 , m_strDhcpLowerAddress(QString()) 148 , m_strDhcpUpperAddress(QString()) 149 {} 150 151 /** Returns whether the @a other passed data is equal to this one. */ 152 bool equal(const UIDataSettingsGlobalNetworkDHCPServer &other) const 153 { 154 return true 155 && (m_fDhcpServerEnabled == other.m_fDhcpServerEnabled) 156 && (m_strDhcpServerAddress == other.m_strDhcpServerAddress) 157 && (m_strDhcpServerMask == other.m_strDhcpServerMask) 158 && (m_strDhcpLowerAddress == other.m_strDhcpLowerAddress) 159 && (m_strDhcpUpperAddress == other.m_strDhcpUpperAddress) 160 ; 161 } 162 163 /** Returns whether the @a other passed data is equal to this one. */ 164 bool operator==(const UIDataSettingsGlobalNetworkDHCPServer &other) const { return equal(other); } 165 /** Returns whether the @a other passed data is different from this one. */ 166 bool operator!=(const UIDataSettingsGlobalNetworkDHCPServer &other) const { return !equal(other); } 167 168 /** Holds whether DHCP server enabled. */ 169 bool m_fDhcpServerEnabled; 170 /** Holds DHCP server address. */ 171 QString m_strDhcpServerAddress; 172 /** Holds DHCP server mask. */ 173 QString m_strDhcpServerMask; 174 /** Holds DHCP server lower address. */ 175 QString m_strDhcpLowerAddress; 176 /** Holds DHCP server upper address. */ 177 QString m_strDhcpUpperAddress; 178 }; 179 180 181 /** Global settings: Network page: Host network data structure. */ 182 struct UIDataSettingsGlobalNetworkHost 183 { 184 /** Constructs data. */ 185 UIDataSettingsGlobalNetworkHost() 186 : m_interface(UIDataSettingsGlobalNetworkHostInterface()) 187 , m_dhcpserver(UIDataSettingsGlobalNetworkDHCPServer()) 188 {} 189 190 /** Returns whether the @a other passed data is equal to this one. */ 191 bool equal(const UIDataSettingsGlobalNetworkHost &other) const 192 { 193 return true 194 && (m_interface == other.m_interface) 195 && (m_dhcpserver == other.m_dhcpserver) 196 ; 197 } 198 199 /** Returns whether the @a other passed data is equal to this one. */ 200 bool operator==(const UIDataSettingsGlobalNetworkHost &other) const { return equal(other); } 201 /** Returns whether the @a other passed data is different from this one. */ 202 bool operator!=(const UIDataSettingsGlobalNetworkHost &other) const { return !equal(other); } 203 204 /** Holds the host interface data. */ 205 UIDataSettingsGlobalNetworkHostInterface m_interface; 206 /** Holds the DHCP server data. */ 207 UIDataSettingsGlobalNetworkDHCPServer m_dhcpserver; 208 }; 209 210 211 /** Global settings: Network page data structure. */ 212 struct UIDataSettingsGlobalNetwork 213 { 214 /** Constructs data. */ 215 UIDataSettingsGlobalNetwork() 216 : m_networksNAT(QList<UIDataSettingsGlobalNetworkNAT>()) 217 , m_networksHost(QList<UIDataSettingsGlobalNetworkHost>()) 218 {} 219 220 /** Returns whether the @a other passed data is equal to this one. */ 221 bool equal(const UIDataSettingsGlobalNetwork &other) const 222 { 223 return true 224 && (m_networksNAT == other.m_networksNAT) 225 && (m_networksHost == other.m_networksHost) 226 ; 227 } 228 229 /** Returns whether the @a other passed data is equal to this one. */ 230 bool operator==(const UIDataSettingsGlobalNetwork &other) const { return equal(other); } 231 /** Returns whether the @a other passed data is different from this one. */ 232 bool operator!=(const UIDataSettingsGlobalNetwork &other) const { return !equal(other); } 233 234 /** Holds the NAT network data. */ 235 QList<UIDataSettingsGlobalNetworkNAT> m_networksNAT; 236 /** Holds the host network data. */ 237 QList<UIDataSettingsGlobalNetworkHost> m_networksHost; 238 }; 28 struct UIDataSettingsGlobalNetwork; 29 struct UIDataSettingsGlobalNetworkNAT; 30 struct UIDataSettingsGlobalNetworkHost; 239 31 typedef UISettingsCache<UIDataSettingsGlobalNetwork> UISettingsCacheGlobalNetwork; 240 32 … … 247 39 public: 248 40 249 /* Constructor:*/41 /** Constructs Network settings page. */ 250 42 UIGlobalSettingsNetwork(); 43 /** Destructs Network settings page. */ 44 ~UIGlobalSettingsNetwork(); 251 45 252 46 protected: … … 295 89 296 90 /* Helpers: NAT network cache stuff: */ 297 UIDataSettingsGlobalNetworkNAT generateDataNetworkNAT(const CNATNetwork &network);91 void generateDataNetworkNAT(const CNATNetwork &network, UIDataSettingsGlobalNetworkNAT &data); 298 92 void saveCacheItemNetworkNAT(const UIDataSettingsGlobalNetworkNAT &data); 299 93 … … 303 97 304 98 /* Helpers: Host network cache stuff: */ 305 UIDataSettingsGlobalNetworkHost generateDataNetworkHost(const CHostNetworkInterface &iface);99 void generateDataNetworkHost(const CHostNetworkInterface &iface, UIDataSettingsGlobalNetworkHost &data); 306 100 void saveCacheItemNetworkHost(const UIDataSettingsGlobalNetworkHost &data); 307 101 … … 320 114 QAction *m_pActionEditNetworkHost; 321 115 322 /* Variable: Cache:*/323 UISettingsCacheGlobalNetwork m_cache;116 /** Holds the page data cache instance. */ 117 UISettingsCacheGlobalNetwork *m_pCache; 324 118 }; 325 119 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.h
r65629 r66169 19 19 #define __UIGlobalSettingsNetworkDetailsHost_h__ 20 20 21 /* Local includes*/21 /* GUI includes: */ 22 22 #include "QIDialog.h" 23 23 #include "QIWithRetranslateUI.h" 24 24 #include "UIGlobalSettingsNetworkDetailsHost.gen.h" 25 25 26 /* Forward decalrations: */ 27 struct UIDataSettingsGlobalNetworkHost; 26 27 /** Global settings: Network page: Host interface data structure. */ 28 struct UIDataSettingsGlobalNetworkHostInterface 29 { 30 /** Constructs data. */ 31 UIDataSettingsGlobalNetworkHostInterface() 32 : m_strName(QString()) 33 , m_fDhcpClientEnabled(false) 34 , m_strInterfaceAddress(QString()) 35 , m_strInterfaceMask(QString()) 36 , m_fIpv6Supported(false) 37 , m_strInterfaceAddress6(QString()) 38 , m_strInterfaceMaskLength6(QString()) 39 {} 40 41 /** Returns whether the @a other passed data is equal to this one. */ 42 bool equal(const UIDataSettingsGlobalNetworkHostInterface &other) const 43 { 44 return true 45 && (m_strName == other.m_strName) 46 && (m_fDhcpClientEnabled == other.m_fDhcpClientEnabled) 47 && (m_strInterfaceAddress == other.m_strInterfaceAddress) 48 && (m_strInterfaceMask == other.m_strInterfaceMask) 49 && (m_fIpv6Supported == other.m_fIpv6Supported) 50 && (m_strInterfaceAddress6 == other.m_strInterfaceAddress6) 51 && (m_strInterfaceMaskLength6 == other.m_strInterfaceMaskLength6) 52 ; 53 } 54 55 /** Returns whether the @a other passed data is equal to this one. */ 56 bool operator==(const UIDataSettingsGlobalNetworkHostInterface &other) const { return equal(other); } 57 /** Returns whether the @a other passed data is different from this one. */ 58 bool operator!=(const UIDataSettingsGlobalNetworkHostInterface &other) const { return !equal(other); } 59 60 /** Holds host interface name. */ 61 QString m_strName; 62 /** Holds whether DHCP client enabled. */ 63 bool m_fDhcpClientEnabled; 64 /** Holds IPv4 interface address. */ 65 QString m_strInterfaceAddress; 66 /** Holds IPv4 interface mask. */ 67 QString m_strInterfaceMask; 68 /** Holds whether IPv6 protocol supported. */ 69 bool m_fIpv6Supported; 70 /** Holds IPv6 interface address. */ 71 QString m_strInterfaceAddress6; 72 /** Holds IPv6 interface mask length. */ 73 QString m_strInterfaceMaskLength6; 74 }; 75 76 77 /** Global settings: Network page: DHCP server data structure. */ 78 struct UIDataSettingsGlobalNetworkDHCPServer 79 { 80 /** Constructs data. */ 81 UIDataSettingsGlobalNetworkDHCPServer() 82 : m_fDhcpServerEnabled(false) 83 , m_strDhcpServerAddress(QString()) 84 , m_strDhcpServerMask(QString()) 85 , m_strDhcpLowerAddress(QString()) 86 , m_strDhcpUpperAddress(QString()) 87 {} 88 89 /** Returns whether the @a other passed data is equal to this one. */ 90 bool equal(const UIDataSettingsGlobalNetworkDHCPServer &other) const 91 { 92 return true 93 && (m_fDhcpServerEnabled == other.m_fDhcpServerEnabled) 94 && (m_strDhcpServerAddress == other.m_strDhcpServerAddress) 95 && (m_strDhcpServerMask == other.m_strDhcpServerMask) 96 && (m_strDhcpLowerAddress == other.m_strDhcpLowerAddress) 97 && (m_strDhcpUpperAddress == other.m_strDhcpUpperAddress) 98 ; 99 } 100 101 /** Returns whether the @a other passed data is equal to this one. */ 102 bool operator==(const UIDataSettingsGlobalNetworkDHCPServer &other) const { return equal(other); } 103 /** Returns whether the @a other passed data is different from this one. */ 104 bool operator!=(const UIDataSettingsGlobalNetworkDHCPServer &other) const { return !equal(other); } 105 106 /** Holds whether DHCP server enabled. */ 107 bool m_fDhcpServerEnabled; 108 /** Holds DHCP server address. */ 109 QString m_strDhcpServerAddress; 110 /** Holds DHCP server mask. */ 111 QString m_strDhcpServerMask; 112 /** Holds DHCP server lower address. */ 113 QString m_strDhcpLowerAddress; 114 /** Holds DHCP server upper address. */ 115 QString m_strDhcpUpperAddress; 116 }; 117 118 119 /** Global settings: Network page: Host network data structure. */ 120 struct UIDataSettingsGlobalNetworkHost 121 { 122 /** Constructs data. */ 123 UIDataSettingsGlobalNetworkHost() 124 : m_interface(UIDataSettingsGlobalNetworkHostInterface()) 125 , m_dhcpserver(UIDataSettingsGlobalNetworkDHCPServer()) 126 {} 127 128 /** Returns whether the @a other passed data is equal to this one. */ 129 bool equal(const UIDataSettingsGlobalNetworkHost &other) const 130 { 131 return true 132 && (m_interface == other.m_interface) 133 && (m_dhcpserver == other.m_dhcpserver) 134 ; 135 } 136 137 /** Returns whether the @a other passed data is equal to this one. */ 138 bool operator==(const UIDataSettingsGlobalNetworkHost &other) const { return equal(other); } 139 /** Returns whether the @a other passed data is different from this one. */ 140 bool operator!=(const UIDataSettingsGlobalNetworkHost &other) const { return !equal(other); } 141 142 /** Holds the host interface data. */ 143 UIDataSettingsGlobalNetworkHostInterface m_interface; 144 /** Holds the DHCP server data. */ 145 UIDataSettingsGlobalNetworkDHCPServer m_dhcpserver; 146 }; 147 28 148 29 149 /* Global settings / Network page / Details sub-dialog: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h
r65629 r66169 19 19 #define __UIGlobalSettingsNetworkDetailsNAT_h__ 20 20 21 /* Local includes*/21 /* GUI includes: */ 22 22 #include "QIDialog.h" 23 23 #include "QIWithRetranslateUI.h" 24 24 #include "UIGlobalSettingsNetworkDetailsNAT.gen.h" 25 #include "UIPortForwardingTable.h" 25 26 26 /* Forward decalrations: */ 27 struct UIDataSettingsGlobalNetworkNAT; 27 28 /** Global settings: Network page: NAT network data structure. */ 29 struct UIDataSettingsGlobalNetworkNAT 30 { 31 /** Constructs data. */ 32 UIDataSettingsGlobalNetworkNAT() 33 : m_fEnabled(false) 34 , m_strName(QString()) 35 , m_strNewName(QString()) 36 , m_strCIDR(QString()) 37 , m_fSupportsDHCP(false) 38 , m_fSupportsIPv6(false) 39 , m_fAdvertiseDefaultIPv6Route(false) 40 , m_ipv4rules(QList<UIPortForwardingData>()) 41 , m_ipv6rules(QList<UIPortForwardingData>()) 42 {} 43 44 /** Returns whether the @a other passed data is equal to this one. */ 45 bool equal(const UIDataSettingsGlobalNetworkNAT &other) const 46 { 47 return true 48 && (m_fEnabled == other.m_fEnabled) 49 && (m_strName == other.m_strName) 50 && (m_strNewName == other.m_strNewName) 51 && (m_strCIDR == other.m_strCIDR) 52 && (m_fSupportsDHCP == other.m_fSupportsDHCP) 53 && (m_fSupportsIPv6 == other.m_fSupportsIPv6) 54 && (m_fAdvertiseDefaultIPv6Route == other.m_fAdvertiseDefaultIPv6Route) 55 && (m_ipv4rules == other.m_ipv4rules) 56 && (m_ipv6rules == other.m_ipv6rules) 57 ; 58 } 59 60 /** Returns whether the @a other passed data is equal to this one. */ 61 bool operator==(const UIDataSettingsGlobalNetworkNAT &other) const { return equal(other); } 62 /** Returns whether the @a other passed data is different from this one. */ 63 bool operator!=(const UIDataSettingsGlobalNetworkNAT &other) const { return !equal(other); } 64 65 /** Holds whether this network enabled. */ 66 bool m_fEnabled; 67 /** Holds network name. */ 68 QString m_strName; 69 /** Holds new network name. */ 70 QString m_strNewName; 71 /** Holds network CIDR. */ 72 QString m_strCIDR; 73 /** Holds whether this network supports DHCP. */ 74 bool m_fSupportsDHCP; 75 /** Holds whether this network supports IPv6. */ 76 bool m_fSupportsIPv6; 77 /** Holds whether this network advertised as default IPv6 route. */ 78 bool m_fAdvertiseDefaultIPv6Route; 79 /** Holds IPv4 port forwarding rules. */ 80 UIPortForwardingDataList m_ipv4rules; 81 /** Holds IPv6 port forwarding rules. */ 82 UIPortForwardingDataList m_ipv6rules; 83 }; 84 28 85 29 86 /* Global settings / Network page / Details sub-dialog: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
r65688 r66169 31 31 32 32 33 /** Global settings: Proxy page data structure. */ 34 struct UIDataSettingsGlobalProxy 35 { 36 /** Constructs data. */ 37 UIDataSettingsGlobalProxy() 38 : m_enmProxyState(UIProxyManager::ProxyState_Auto) 39 , m_strProxyHost(QString()) 40 , m_strProxyPort(QString()) 41 {} 42 43 /** Returns whether the @a other passed data is equal to this one. */ 44 bool equal(const UIDataSettingsGlobalProxy &other) const 45 { 46 return true 47 && (m_enmProxyState == other.m_enmProxyState) 48 && (m_strProxyHost == other.m_strProxyHost) 49 && (m_strProxyPort == other.m_strProxyPort) 50 ; 51 } 52 53 /** Returns whether the @a other passed data is equal to this one. */ 54 bool operator==(const UIDataSettingsGlobalProxy &other) const { return equal(other); } 55 /** Returns whether the @a other passed data is different from this one. */ 56 bool operator!=(const UIDataSettingsGlobalProxy &other) const { return !equal(other); } 57 58 /** Holds the proxy state. */ 59 UIProxyManager::ProxyState m_enmProxyState; 60 /** Holds the proxy host. */ 61 QString m_strProxyHost; 62 /** Holds the proxy port. */ 63 QString m_strProxyPort; 64 }; 65 66 33 67 UIGlobalSettingsProxy::UIGlobalSettingsProxy() 68 : m_pCache(new UISettingsCacheGlobalProxy) 34 69 { 35 70 /* Apply UI decorations: */ … … 54 89 } 55 90 91 UIGlobalSettingsProxy::~UIGlobalSettingsProxy() 92 { 93 /* Cleanup cache: */ 94 delete m_pCache; 95 m_pCache = 0; 96 } 97 56 98 void UIGlobalSettingsProxy::loadToCacheFrom(QVariant &data) 57 99 { … … 60 102 61 103 /* Clear cache initially: */ 62 m_ cache.clear();104 m_pCache->clear(); 63 105 64 106 /* Prepare old data: */ … … 72 114 73 115 /* Cache old data: */ 74 m_ cache.cacheInitialData(oldData);116 m_pCache->cacheInitialData(oldData); 75 117 76 118 /* Upload properties & settings to data: */ … … 81 123 { 82 124 /* Get old data from cache: */ 83 const UIDataSettingsGlobalProxy &oldData = m_ cache.base();125 const UIDataSettingsGlobalProxy &oldData = m_pCache->base(); 84 126 85 127 /* Load old data from cache: */ … … 101 143 { 102 144 /* Prepare new data: */ 103 UIDataSettingsGlobalProxy newData = m_ cache.base();145 UIDataSettingsGlobalProxy newData = m_pCache->base(); 104 146 105 147 /* Gather new data: */ … … 111 153 112 154 /* Cache new data: */ 113 m_ cache.cacheCurrentData(newData);155 m_pCache->cacheCurrentData(newData); 114 156 } 115 157 … … 120 162 121 163 /* Save new data from cache: */ 122 if (m_ cache.wasChanged())164 if (m_pCache->wasChanged()) 123 165 { 124 166 UIProxyManager proxyManager; 125 proxyManager.setProxyState(m_ cache.data().m_enmProxyState);126 proxyManager.setProxyHost(m_ cache.data().m_strProxyHost);127 proxyManager.setProxyPort(m_ cache.data().m_strProxyPort);167 proxyManager.setProxyState(m_pCache->data().m_enmProxyState); 168 proxyManager.setProxyHost(m_pCache->data().m_strProxyHost); 169 proxyManager.setProxyPort(m_pCache->data().m_strProxyPort); 128 170 m_settings.setProxySettings(proxyManager.toString()); 129 171 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
r66163 r66169 24 24 #include "VBoxUtils.h" 25 25 26 27 /** Global settings: Proxy page data structure. */ 28 struct UIDataSettingsGlobalProxy 29 { 30 /** Constructs data. */ 31 UIDataSettingsGlobalProxy() 32 : m_enmProxyState(UIProxyManager::ProxyState_Auto) 33 , m_strProxyHost(QString()) 34 , m_strProxyPort(QString()) 35 {} 36 37 /** Returns whether the @a other passed data is equal to this one. */ 38 bool equal(const UIDataSettingsGlobalProxy &other) const 39 { 40 return true 41 && (m_enmProxyState == other.m_enmProxyState) 42 && (m_strProxyHost == other.m_strProxyHost) 43 && (m_strProxyPort == other.m_strProxyPort) 44 ; 45 } 46 47 /** Returns whether the @a other passed data is equal to this one. */ 48 bool operator==(const UIDataSettingsGlobalProxy &other) const { return equal(other); } 49 /** Returns whether the @a other passed data is different from this one. */ 50 bool operator!=(const UIDataSettingsGlobalProxy &other) const { return !equal(other); } 51 52 /** Holds the proxy state. */ 53 UIProxyManager::ProxyState m_enmProxyState; 54 /** Holds the proxy host. */ 55 QString m_strProxyHost; 56 /** Holds the proxy port. */ 57 QString m_strProxyPort; 58 }; 26 /* Forward declarations: */ 27 struct UIDataSettingsGlobalProxy; 59 28 typedef UISettingsCache<UIDataSettingsGlobalProxy> UISettingsCacheGlobalProxy; 60 29 … … 67 36 public: 68 37 69 /* Constructor:*/38 /** Constructs Proxy settings page. */ 70 39 UIGlobalSettingsProxy(); 40 /** Destructs Proxy settings page. */ 41 ~UIGlobalSettingsProxy(); 71 42 72 43 protected: … … 102 73 private: 103 74 104 /* Cache:*/105 UISettingsCacheGlobalProxy m_cache;75 /** Holds the page data cache instance. */ 76 UISettingsCacheGlobalProxy *m_pCache; 106 77 }; 107 78 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp
r65689 r66169 28 28 29 29 30 /** Global settings: Update page data structure. */ 31 struct UIDataSettingsGlobalUpdate 32 { 33 /** Constructs data. */ 34 UIDataSettingsGlobalUpdate() 35 : m_fCheckEnabled(false) 36 , m_periodIndex(VBoxUpdateData::PeriodUndefined) 37 , m_branchIndex(VBoxUpdateData::BranchStable) 38 , m_strDate(QString()) 39 {} 40 41 /** Returns whether the @a other passed data is equal to this one. */ 42 bool equal(const UIDataSettingsGlobalUpdate &other) const 43 { 44 return true 45 && (m_fCheckEnabled == other.m_fCheckEnabled) 46 && (m_periodIndex == other.m_periodIndex) 47 && (m_branchIndex == other.m_branchIndex) 48 && (m_strDate == other.m_strDate) 49 ; 50 } 51 52 /** Returns whether the @a other passed data is equal to this one. */ 53 bool operator==(const UIDataSettingsGlobalUpdate &other) const { return equal(other); } 54 /** Returns whether the @a other passed data is different from this one. */ 55 bool operator!=(const UIDataSettingsGlobalUpdate &other) const { return !equal(other); } 56 57 /** Holds whether the update check is enabled. */ 58 bool m_fCheckEnabled; 59 /** Holds the update check period. */ 60 VBoxUpdateData::PeriodType m_periodIndex; 61 /** Holds the update branch type. */ 62 VBoxUpdateData::BranchType m_branchIndex; 63 /** Holds the next update date. */ 64 QString m_strDate; 65 }; 66 67 30 68 UIGlobalSettingsUpdate::UIGlobalSettingsUpdate() 31 69 : m_pLastChosenRadio(0) 70 , m_pCache(new UISettingsCacheGlobalUpdate) 32 71 { 33 72 /* Apply UI decorations: */ … … 42 81 } 43 82 83 UIGlobalSettingsUpdate::~UIGlobalSettingsUpdate() 84 { 85 /* Cleanup cache: */ 86 delete m_pCache; 87 m_pCache = 0; 88 } 89 44 90 void UIGlobalSettingsUpdate::loadToCacheFrom(QVariant &data) 45 91 { … … 48 94 49 95 /* Clear cache initially: */ 50 m_ cache.clear();96 m_pCache->clear(); 51 97 52 98 /* Prepare old data: */ … … 61 107 62 108 /* Cache old data: */ 63 m_ cache.cacheInitialData(oldData);109 m_pCache->cacheInitialData(oldData); 64 110 65 111 /* Upload properties & settings to data: */ … … 70 116 { 71 117 /* Get old data from cache: */ 72 const UIDataSettingsGlobalUpdate &oldData = m_ cache.base();118 const UIDataSettingsGlobalUpdate &oldData = m_pCache->base(); 73 119 74 120 /* Load old data from cache: */ … … 91 137 { 92 138 /* Prepare new data: */ 93 UIDataSettingsGlobalUpdate newData = m_ cache.base();139 UIDataSettingsGlobalUpdate newData = m_pCache->base(); 94 140 95 141 /* Gather new data: */ … … 98 144 99 145 /* Cache new data: */ 100 m_ cache.cacheCurrentData(newData);146 m_pCache->cacheCurrentData(newData); 101 147 } 102 148 … … 107 153 108 154 /* Save new data from cache: */ 109 if (m_ cache.wasChanged())155 if (m_pCache->wasChanged()) 110 156 { 111 157 /* Gather corresponding values from internal variables: */ 112 VBoxUpdateData newData(m_ cache.data().m_periodIndex, m_cache.data().m_branchIndex);158 VBoxUpdateData newData(m_pCache->data().m_periodIndex, m_pCache->data().m_branchIndex); 113 159 gEDataManager->setApplicationUpdateData(newData.data()); 114 160 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h
r66163 r66169 24 24 #include "UIUpdateDefs.h" 25 25 26 27 /** Global settings: Update page data structure. */ 28 struct UIDataSettingsGlobalUpdate 29 { 30 /** Constructs data. */ 31 UIDataSettingsGlobalUpdate() 32 : m_fCheckEnabled(false) 33 , m_periodIndex(VBoxUpdateData::PeriodUndefined) 34 , m_branchIndex(VBoxUpdateData::BranchStable) 35 , m_strDate(QString()) 36 {} 37 38 /** Returns whether the @a other passed data is equal to this one. */ 39 bool equal(const UIDataSettingsGlobalUpdate &other) const 40 { 41 return true 42 && (m_fCheckEnabled == other.m_fCheckEnabled) 43 && (m_periodIndex == other.m_periodIndex) 44 && (m_branchIndex == other.m_branchIndex) 45 && (m_strDate == other.m_strDate) 46 ; 47 } 48 49 /** Returns whether the @a other passed data is equal to this one. */ 50 bool operator==(const UIDataSettingsGlobalUpdate &other) const { return equal(other); } 51 /** Returns whether the @a other passed data is different from this one. */ 52 bool operator!=(const UIDataSettingsGlobalUpdate &other) const { return !equal(other); } 53 54 /** Holds whether the update check is enabled. */ 55 bool m_fCheckEnabled; 56 /** Holds the update check period. */ 57 VBoxUpdateData::PeriodType m_periodIndex; 58 /** Holds the update branch type. */ 59 VBoxUpdateData::BranchType m_branchIndex; 60 /** Holds the next update date. */ 61 QString m_strDate; 62 }; 26 /* Forward declarations: */ 27 struct UIDataSettingsGlobalUpdate; 63 28 typedef UISettingsCache<UIDataSettingsGlobalUpdate> UISettingsCacheGlobalUpdate; 64 29 … … 71 36 public: 72 37 73 /* Constructor:*/38 /** Constructs Update settings page. */ 74 39 UIGlobalSettingsUpdate(); 40 /** Destructs Update settings page. */ 41 ~UIGlobalSettingsUpdate(); 75 42 76 43 protected: … … 111 78 QRadioButton *m_pLastChosenRadio; 112 79 113 /* Cache:*/114 UISettingsCacheGlobalUpdate m_cache;80 /** Holds the page data cache instance. */ 81 UISettingsCacheGlobalUpdate *m_pCache; 115 82 }; 116 83
Note:
See TracChangeset
for help on using the changeset viewer.