Changeset 51768 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 1, 2014 1:11:22 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.cpp
r51532 r51768 66 66 void UIGDetailsGroup::rebuildGroup() 67 67 { 68 /* Load settings: */69 loadSettings();70 71 68 /* Cleanup build-step: */ 72 69 delete m_pBuildStep; … … 111 108 112 109 /* Build set: */ 113 pSet->buildSet(m_machineItems[iStepNumber], m_machineItems.size() == 1, m _settings);110 pSet->buildSet(m_machineItems[iStepNumber], m_machineItems.size() == 1, model()->settings()); 114 111 } 115 112 else … … 191 188 connect(this, SIGNAL(sigMinimumHeightHintChanged(int)), 192 189 model(), SIGNAL(sigRootItemMinimumHeightHintChanged(int))); 193 }194 195 void UIGDetailsGroup::loadSettings()196 {197 /* Load settings: */198 m_settings = gEDataManager->selectorWindowDetailsElements();199 /* If settings are empty: */200 if (m_settings.isEmpty())201 {202 /* Propose the defaults: */203 m_settings[DetailsElementType_General] = true;204 m_settings[DetailsElementType_Preview] = true;205 m_settings[DetailsElementType_System] = true;206 m_settings[DetailsElementType_Display] = true;207 m_settings[DetailsElementType_Storage] = true;208 m_settings[DetailsElementType_Audio] = true;209 m_settings[DetailsElementType_Network] = true;210 m_settings[DetailsElementType_USB] = true;211 m_settings[DetailsElementType_SF] = true;212 m_settings[DetailsElementType_Description] = true;213 gEDataManager->setSelectorWindowDetailsElements(m_settings);214 }215 190 } 216 191 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.h
r51532 r51768 22 22 /* GUI includes: */ 23 23 #include "UIGDetailsItem.h" 24 #include "UIExtraDataDefs.h"25 24 26 25 /* Forward declarations: */ … … 82 81 /* Helpers: Prepare stuff: */ 83 82 void prepareConnections(); 84 void loadSettings();85 83 86 84 /* Helpers: Layout stuff: */ … … 97 95 UIBuildStep *m_pBuildStep; 98 96 QString m_strGroupId; 99 QMap<DetailsElementType, bool> m_settings;100 97 101 98 /* Friends: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.cpp
r51532 r51768 43 43 prepareRoot(); 44 44 45 /* Load settings: */ 46 loadSettings(); 47 45 48 /* Register meta-type: */ 46 49 qRegisterMetaType<DetailsElementType>(); … … 49 52 UIGDetailsModel::~UIGDetailsModel() 50 53 { 54 /* Save settings: */ 55 saveSettings(); 56 51 57 /* Cleanup root: */ 52 58 cleanupRoot(); … … 157 163 updateLayout(); 158 164 159 /* Load elements settings to modify: */ 160 QMap<DetailsElementType, bool> settings = gEDataManager->selectorWindowDetailsElements(); 161 /* If setting for corresponding element type exists: */ 162 if (settings.contains(type)) 163 { 164 /* Update element open/close status: */ 165 settings[type] = fToggled; 166 /* Save elements settings back: */ 167 gEDataManager->setSelectorWindowDetailsElements(settings); 168 } 165 /* Update element open/close status: */ 166 if (m_settings.contains(type)) 167 m_settings[type] = fToggled; 169 168 } 170 169 … … 175 174 DetailsElementType type = pAction->data().value<DetailsElementType>(); 176 175 177 /* Load elements settings to modify: */ 178 QMap<DetailsElementType, bool> settings = gEDataManager->selectorWindowDetailsElements(); 179 /* Toggle element visibility setting: */ 180 if (settings.contains(type)) 181 settings.remove(type); 176 /* Toggle element visibility status: */ 177 if (m_settings.contains(type)) 178 m_settings.remove(type); 182 179 else 183 settings[type] = true; 184 /* Save elements settings back: */ 185 gEDataManager->setSelectorWindowDetailsElements(settings); 180 m_settings[type] = true; 186 181 187 182 /* Rebuild group: */ … … 223 218 { 224 219 m_pRoot = new UIGDetailsGroup(scene()); 220 } 221 222 void UIGDetailsModel::loadSettings() 223 { 224 /* Load settings: */ 225 m_settings = gEDataManager->selectorWindowDetailsElements(); 226 } 227 228 void UIGDetailsModel::saveSettings() 229 { 230 /* If settings are empty: */ 231 if (m_settings.isEmpty()) 232 { 233 /* Propose the defaults: */ 234 m_settings[DetailsElementType_General] = true; 235 m_settings[DetailsElementType_Preview] = true; 236 m_settings[DetailsElementType_System] = true; 237 m_settings[DetailsElementType_Display] = true; 238 m_settings[DetailsElementType_Storage] = true; 239 m_settings[DetailsElementType_Audio] = true; 240 m_settings[DetailsElementType_Network] = true; 241 m_settings[DetailsElementType_USB] = true; 242 m_settings[DetailsElementType_SF] = true; 243 m_settings[DetailsElementType_Description] = true; 244 } 245 246 /* Save settings: */ 247 gEDataManager->setSelectorWindowDetailsElements(m_settings); 225 248 } 226 249 … … 260 283 /* Prepare context-menu: */ 261 284 QMenu contextMenu; 262 /* Load elements settings: */ 263 QMap<DetailsElementType, bool> settings = gEDataManager->selectorWindowDetailsElements(); 285 /* Enumerate elements settings: */ 264 286 for (int iType = DetailsElementType_General; iType <= DetailsElementType_Description; ++iType) 265 287 { … … 267 289 QAction *pAction = contextMenu.addAction(gpConverter->toString(currentElementType), this, SLOT(sltElementTypeToggled())); 268 290 pAction->setCheckable(true); 269 pAction->setChecked( settings.contains(currentElementType));291 pAction->setChecked(m_settings.contains(currentElementType)); 270 292 pAction->setData(QVariant::fromValue(currentElementType)); 271 293 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.h
r51187 r51768 73 73 void setItems(const QList<UIVMItem*> &items); 74 74 75 /** Returns the details settings. */ 76 const QMap<DetailsElementType, bool>& settings() const { return m_settings; } 77 75 78 private slots: 76 79 … … 103 106 void prepareScene(); 104 107 void prepareRoot(); 108 void loadSettings(); 105 109 106 110 /* Helpers: Cleanup stuff: */ 111 void saveSettings(); 107 112 void cleanupRoot(); 108 113 void cleanupScene(); … … 118 123 UIGDetailsGroup *m_pRoot; 119 124 UIGDetailsElementAnimationCallback *m_pAnimationCallback; 125 /** Holds the details settings. */ 126 QMap<DetailsElementType, bool> m_settings; 120 127 }; 121 128
Note:
See TracChangeset
for help on using the changeset viewer.