- Timestamp:
- Dec 3, 2012 1:42:58 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.cpp
r43989 r44009 55 55 } 56 56 57 void UIGDetailsGroup::addItem(UIGDetailsItem *pItem) 58 { 59 switch (pItem->type()) 60 { 61 case UIGDetailsItemType_Set: m_sets.append(pItem); break; 62 default: AssertMsgFailed(("Invalid item type!")); break; 63 } 64 } 65 66 void UIGDetailsGroup::removeItem(UIGDetailsItem *pItem) 67 { 68 switch (pItem->type()) 69 { 70 case UIGDetailsItemType_Set: m_sets.removeAt(m_sets.indexOf(pItem)); break; 71 default: AssertMsgFailed(("Invalid item type!")); break; 72 } 73 } 74 75 QList<UIGDetailsItem*> UIGDetailsGroup::items(UIGDetailsItemType type /* = UIGDetailsItemType_Set */) const 76 { 77 switch (type) 78 { 79 case UIGDetailsItemType_Any: return items(UIGDetailsItemType_Set); 80 case UIGDetailsItemType_Set: return m_sets; 81 default: AssertMsgFailed(("Invalid item type!")); break; 82 } 83 return QList<UIGDetailsItem*>(); 84 } 85 86 bool UIGDetailsGroup::hasItems(UIGDetailsItemType type /* = UIGDetailsItemType_Set */) const 87 { 88 switch (type) 89 { 90 case UIGDetailsItemType_Any: return hasItems(UIGDetailsItemType_Set); 91 case UIGDetailsItemType_Set: return !m_sets.isEmpty(); 92 default: AssertMsgFailed(("Invalid item type!")); break; 93 } 94 return false; 95 } 96 97 void UIGDetailsGroup::clearItems(UIGDetailsItemType type /* = UIGDetailsItemType_Set */) 98 { 99 switch (type) 100 { 101 case UIGDetailsItemType_Any: clearItems(UIGDetailsItemType_Set); break; 102 case UIGDetailsItemType_Set: while (!m_sets.isEmpty()) { delete m_sets.last(); } break; 103 default: AssertMsgFailed(("Invalid item type!")); break; 104 } 57 void UIGDetailsGroup::sltFirstStep(QString strGroupId) 58 { 59 /* Clear step: */ 60 delete m_pStep; 61 m_pStep = 0; 62 63 /* Was that a requested group? */ 64 if (strGroupId != m_strGroupId) 65 return; 66 67 /* Prepare first set: */ 68 m_iStep = 0; 69 prepareSet(strGroupId); 70 } 71 72 void UIGDetailsGroup::sltNextStep(QString strGroupId) 73 { 74 /* Clear step: */ 75 delete m_pStep; 76 m_pStep = 0; 77 78 /* Was that a requested group? */ 79 if (strGroupId != m_strGroupId) 80 return; 81 82 /* Prepare next set: */ 83 ++m_iStep; 84 prepareSet(strGroupId); 105 85 } 106 86 … … 119 99 } 120 100 121 void UIGDetailsGroup::sltFirstStep(QString strGroupId) 122 { 123 /* Clear step: */ 124 delete m_pStep; 125 m_pStep = 0; 126 127 /* Was that a requested group? */ 128 if (strGroupId != m_strGroupId) 129 return; 130 131 /* Prepare first set: */ 132 m_iStep = 0; 133 prepareSet(strGroupId); 134 } 135 136 void UIGDetailsGroup::sltNextStep(QString strGroupId) 137 { 138 /* Clear step: */ 139 delete m_pStep; 140 m_pStep = 0; 141 142 /* Was that a requested group? */ 143 if (strGroupId != m_strGroupId) 144 return; 145 146 /* Prepare next set: */ 147 ++m_iStep; 148 prepareSet(strGroupId); 101 void UIGDetailsGroup::addItem(UIGDetailsItem *pItem) 102 { 103 switch (pItem->type()) 104 { 105 case UIGDetailsItemType_Set: m_items.append(pItem); break; 106 default: AssertMsgFailed(("Invalid item type!")); break; 107 } 108 } 109 110 void UIGDetailsGroup::removeItem(UIGDetailsItem *pItem) 111 { 112 switch (pItem->type()) 113 { 114 case UIGDetailsItemType_Set: m_items.removeAt(m_items.indexOf(pItem)); break; 115 default: AssertMsgFailed(("Invalid item type!")); break; 116 } 117 } 118 119 QList<UIGDetailsItem*> UIGDetailsGroup::items(UIGDetailsItemType type /* = UIGDetailsItemType_Set */) const 120 { 121 switch (type) 122 { 123 case UIGDetailsItemType_Set: return m_items; 124 case UIGDetailsItemType_Any: return items(UIGDetailsItemType_Set); 125 default: AssertMsgFailed(("Invalid item type!")); break; 126 } 127 return QList<UIGDetailsItem*>(); 128 } 129 130 bool UIGDetailsGroup::hasItems(UIGDetailsItemType type /* = UIGDetailsItemType_Set */) const 131 { 132 switch (type) 133 { 134 case UIGDetailsItemType_Set: return !m_items.isEmpty(); 135 case UIGDetailsItemType_Any: return hasItems(UIGDetailsItemType_Set); 136 default: AssertMsgFailed(("Invalid item type!")); break; 137 } 138 return false; 139 } 140 141 void UIGDetailsGroup::clearItems(UIGDetailsItemType type /* = UIGDetailsItemType_Set */) 142 { 143 switch (type) 144 { 145 case UIGDetailsItemType_Set: while (!m_items.isEmpty()) { delete m_items.last(); } break; 146 case UIGDetailsItemType_Any: clearItems(UIGDetailsItemType_Set); break; 147 default: AssertMsgFailed(("Invalid item type!")); break; 148 } 149 149 } 150 150 … … 171 171 } 172 172 173 void UIGDetailsGroup::prepareSets(const QList<UIVMItem*> &items) 174 { 173 void UIGDetailsGroup::prepareSets(const QList<UIVMItem*> &machineItems) 174 { 175 /* Remember new items: */ 176 m_machineItems = machineItems; 177 175 178 /* Cleanup superflous sets: */ 176 while (m_sets.size() > items.size()) 177 delete m_sets.last(); 178 179 /* Remember new items: */ 180 m_items = items; 179 while (m_items.size() > m_machineItems.size()) 180 delete m_items.last(); 181 181 182 182 /* Update sets: */ … … 201 201 { 202 202 /* Step number feats the bounds: */ 203 if (m_iStep >= 0 && m_iStep < m_ items.size())203 if (m_iStep >= 0 && m_iStep < m_machineItems.size()) 204 204 { 205 205 /* Should we create set? */ 206 206 UIGDetailsSet *pSet = 0; 207 if (m_iStep > m_ sets.size() - 1)207 if (m_iStep > m_items.size() - 1) 208 208 pSet = new UIGDetailsSet(this); 209 209 else 210 pSet = m_ sets.at(m_iStep)->toSet();210 pSet = m_items.at(m_iStep)->toSet(); 211 211 /* Create prepare step: */ 212 212 m_pStep = new UIPrepareStep(this, strGroupId); … … 214 214 connect(m_pStep, SIGNAL(sigStepDone(const QString&)), this, SLOT(sltNextStep(const QString&)), Qt::QueuedConnection); 215 215 /* Configure set: */ 216 pSet->configure(m_ items[m_iStep], m_settings, m_items.size() == 1);216 pSet->configure(m_machineItems[m_iStep], m_settings, m_machineItems.size() == 1); 217 217 } 218 218 else -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.h
r43989 r44009 52 52 void stopPopulatingItems(); 53 53 54 /* API: Children stuff: */55 void addItem(UIGDetailsItem *pItem);56 void removeItem(UIGDetailsItem *pItem);57 QList<UIGDetailsItem*> items(UIGDetailsItemType type = UIGDetailsItemType_Set) const;58 bool hasItems(UIGDetailsItemType type = UIGDetailsItemType_Set) const;59 void clearItems(UIGDetailsItemType type = UIGDetailsItemType_Set);60 61 54 private slots: 62 55 … … 78 71 QVariant data(int iKey) const; 79 72 73 /* Hidden API: Children stuff: */ 74 void addItem(UIGDetailsItem *pItem); 75 void removeItem(UIGDetailsItem *pItem); 76 QList<UIGDetailsItem*> items(UIGDetailsItemType type = UIGDetailsItemType_Set) const; 77 bool hasItems(UIGDetailsItemType type = UIGDetailsItemType_Set) const; 78 void clearItems(UIGDetailsItemType type = UIGDetailsItemType_Set); 79 80 80 /* Helpers: Prepare stuff: */ 81 81 void loadSettings(); … … 90 90 91 91 /* Variables: */ 92 QList<UIGDetailsItem*> m_ sets;93 QList<UIVMItem*> m_ items;92 QList<UIGDetailsItem*> m_items; 93 QList<UIVMItem*> m_machineItems; 94 94 UIPrepareStep *m_pStep; 95 95 int m_iStep;
Note:
See TracChangeset
for help on using the changeset viewer.