- Timestamp:
- Dec 3, 2012 3:10:03 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h
r43989 r44016 50 50 signals: 51 51 52 /* Notifier: Preparestuff: */53 void sig ElementUpdateDone();52 /* Notifier: Build stuff: */ 53 void sigBuildDone(); 54 54 55 55 /* Notifiers: Hover stuff: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
r43984 r44016 79 79 setText(newText); 80 80 cleanupThread(); 81 emit sig ElementUpdateDone();81 emit sigBuildDone(); 82 82 } 83 83 … … 232 232 { 233 233 m_pPreview->setMachine(machine()); 234 emit sig ElementUpdateDone();234 emit sigBuildDone(); 235 235 } 236 236 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.cpp
r44012 r44016 27 27 UIGDetailsGroup::UIGDetailsGroup() 28 28 : UIGDetailsItem(0) 29 , m_pStep(0) 30 , m_iStep(0) 29 , m_pBuildStep(0) 31 30 { 32 31 /* Prepare connections: */ … … 40 39 } 41 40 42 void UIGDetailsGroup:: setItems(const QList<UIVMItem*> &machineItems)41 void UIGDetailsGroup::buildGroup(const QList<UIVMItem*> &machineItems) 43 42 { 44 43 /* Remember passed machine-items: */ … … 49 48 delete m_items.last(); 50 49 51 /* Update items: */52 updateItems();53 } 54 55 void UIGDetailsGroup:: updateItems()50 /* Start building group: */ 51 rebuildGroup(); 52 } 53 54 void UIGDetailsGroup::rebuildGroup() 56 55 { 57 56 /* Load settings: */ 58 57 loadSettings(); 59 58 60 /* Cleanup step: */61 delete m_p Step;62 m_p Step = 0;59 /* Cleanup build-step: */ 60 delete m_pBuildStep; 61 m_pBuildStep = 0; 63 62 64 63 /* Generate new group-id: */ 65 64 m_strGroupId = QUuid::createUuid().toString(); 66 65 67 /* Request to prepare first set: */68 emit sig StartFirstStep(m_strGroupId);69 } 70 71 void UIGDetailsGroup::stop PopulatingItems()66 /* Request to build first step: */ 67 emit sigBuildStep(m_strGroupId, 0); 68 } 69 70 void UIGDetailsGroup::stopBuildingGroup() 72 71 { 73 72 /* Generate new group-id: */ … … 75 74 } 76 75 77 void UIGDetailsGroup::slt FirstStep(QString strGroupId)78 { 79 /* Cleanup step: */80 delete m_p Step;81 m_p Step = 0;76 void UIGDetailsGroup::sltBuildStep(QString strStepId, int iStepNumber) 77 { 78 /* Cleanup build-step: */ 79 delete m_pBuildStep; 80 m_pBuildStep = 0; 82 81 83 82 /* Is step id valid? */ 84 if (str GroupId != m_strGroupId)83 if (strStepId != m_strGroupId) 85 84 return; 86 85 87 /* Prepare first set: */ 88 m_iStep = 0; 89 prepareSet(strGroupId); 90 } 91 92 void UIGDetailsGroup::sltNextStep(QString strGroupId) 93 { 94 /* Cleanup step: */ 95 delete m_pStep; 96 m_pStep = 0; 97 98 /* Is step id valid? */ 99 if (strGroupId != m_strGroupId) 100 return; 101 102 /* Prepare next set: */ 103 ++m_iStep; 104 prepareSet(strGroupId); 86 /* Step number feats the bounds: */ 87 if (iStepNumber >= 0 && iStepNumber < m_machineItems.size()) 88 { 89 /* Should we create a new set for this step? */ 90 UIGDetailsSet *pSet = 0; 91 if (iStepNumber > m_items.size() - 1) 92 pSet = new UIGDetailsSet(this); 93 /* Or use existing? */ 94 else 95 pSet = m_items.at(iStepNumber)->toSet(); 96 97 /* Create next build-step: */ 98 m_pBuildStep = new UIBuildStep(this, strStepId, iStepNumber + 1); 99 connect(pSet, SIGNAL(sigBuildDone()), m_pBuildStep, SLOT(sltStepDone()), Qt::QueuedConnection); 100 connect(m_pBuildStep, SIGNAL(sigStepDone(QString, int)), this, SLOT(sltBuildStep(QString, int)), Qt::QueuedConnection); 101 102 /* Build set: */ 103 pSet->buildSet(m_machineItems[iStepNumber], m_machineItems.size() == 1, m_settings); 104 } 105 else 106 { 107 /* Update model: */ 108 model()->updateLayout(); 109 } 105 110 } 106 111 … … 171 176 void UIGDetailsGroup::prepareConnections() 172 177 { 173 connect(this, SIGNAL(sig StartFirstStep(QString)), this, SLOT(sltFirstStep(QString)), Qt::QueuedConnection);178 connect(this, SIGNAL(sigBuildStep(QString, int)), this, SLOT(sltBuildStep(QString, int)), Qt::QueuedConnection); 174 179 } 175 180 … … 196 201 } 197 202 198 void UIGDetailsGroup::prepareSet(QString strGroupId)199 {200 /* Step number feats the bounds: */201 if (m_iStep >= 0 && m_iStep < m_machineItems.size())202 {203 /* Should we create set? */204 UIGDetailsSet *pSet = 0;205 if (m_iStep > m_items.size() - 1)206 pSet = new UIGDetailsSet(this);207 else208 pSet = m_items.at(m_iStep)->toSet();209 /* Create prepare step: */210 m_pStep = new UIPrepareStep(this, strGroupId);211 connect(pSet, SIGNAL(sigSetCreationDone()), m_pStep, SLOT(sltStepDone()), Qt::QueuedConnection);212 connect(m_pStep, SIGNAL(sigStepDone(const QString&)), this, SLOT(sltNextStep(const QString&)), Qt::QueuedConnection);213 /* Configure set: */214 pSet->configure(m_machineItems[m_iStep], m_settings, m_machineItems.size() == 1);215 }216 else217 {218 /* Update model after group update: */219 model()->updateLayout();220 }221 }222 223 203 int UIGDetailsGroup::minimumWidthHint() const 224 204 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.h
r44011 r44016 34 34 signals: 35 35 36 /* Notifier: Preparestuff: */37 void sig StartFirstStep(QString strGroupId);36 /* Notifier: Build stuff: */ 37 void sigBuildStep(QString strStepId, int iStepNumber); 38 38 39 39 public: … … 47 47 ~UIGDetailsGroup(); 48 48 49 /* API: Preparestuff: */50 void setItems(const QList<UIVMItem*> &machineItems);51 void updateItems();52 void stop PopulatingItems();49 /* API: Build stuff: */ 50 void buildGroup(const QList<UIVMItem*> &machineItems); 51 void rebuildGroup(); 52 void stopBuildingGroup(); 53 53 54 54 private slots: 55 55 56 /* Handlers: Prepare stuff: */ 57 void sltFirstStep(QString strGroupId); 58 void sltNextStep(QString strGroupId); 56 /* Handler: Build stuff: */ 57 void sltBuildStep(QString strStepId, int iStepNumber); 59 58 60 59 private: … … 81 80 void prepareConnections(); 82 81 void loadSettings(); 83 void prepareSet(QString strGroupId);84 82 85 83 /* Helpers: Layout stuff: */ … … 91 89 QList<UIGDetailsItem*> m_items; 92 90 QList<UIVMItem*> m_machineItems; 93 UIPrepareStep *m_pStep; 94 int m_iStep; 91 UIBuildStep *m_pBuildStep; 95 92 QString m_strGroupId; 96 93 QStringList m_settings; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.cpp
r43989 r44016 144 144 } 145 145 146 UI PrepareStep::UIPrepareStep(QObject *pParent, const QString &strStepId /* = QString() */)146 UIBuildStep::UIBuildStep(QObject *pParent, const QString &strStepId, int iStepNumber) 147 147 : QObject(pParent) 148 148 , m_strStepId(strStepId) 149 , m_iStepNumber(iStepNumber) 149 150 { 150 151 } 151 152 152 void UI PrepareStep::sltStepDone()153 void UIBuildStep::sltStepDone() 153 154 { 154 emit sigStepDone(m_strStepId );155 emit sigStepDone(m_strStepId, m_iStepNumber); 155 156 } 156 157 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.h
r43989 r44016 91 91 }; 92 92 93 /* Allows to prepare itemsynchronously: */94 class UI PrepareStep : public QObject93 /* Allows to build item content synchronously: */ 94 class UIBuildStep : public QObject 95 95 { 96 96 Q_OBJECT; … … 98 98 signals: 99 99 100 /* Notifier: Preparestuff: */101 void sigStepDone(QString strStepId );100 /* Notifier: Build stuff: */ 101 void sigStepDone(QString strStepId, int iStepNumber); 102 102 103 103 public: 104 104 105 105 /* Constructor: */ 106 UI PrepareStep(QObject *pParent, const QString &strStepId = QString());106 UIBuildStep(QObject *pParent, const QString &strStepId, int iStepNumber); 107 107 108 108 private slots: 109 109 110 /* Handler s: Preparestuff: */110 /* Handler: Build stuff: */ 111 111 void sltStepDone(); 112 112 … … 115 115 /* Variables: */ 116 116 QString m_strStepId; 117 int m_iStepNumber; 117 118 }; 118 119 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.cpp
r43990 r44016 93 93 void UIGDetailsModel::setItems(const QList<UIVMItem*> &items) 94 94 { 95 m_pRoot-> setItems(items);95 m_pRoot->buildGroup(items); 96 96 } 97 97 … … 196 196 } 197 197 vboxGlobal().virtualBox().SetExtraDataStringList(GUI_DetailsPageBoxes, detailsSettings); 198 m_pRoot-> updateItems();198 m_pRoot->rebuildGroup(); 199 199 } 200 200 201 201 void UIGDetailsModel::sltHandleSlidingStarted() 202 202 { 203 m_pRoot->stop PopulatingItems();203 m_pRoot->stopBuildingGroup(); 204 204 } 205 205 206 206 void UIGDetailsModel::sltHandleToggleStarted() 207 207 { 208 m_pRoot->stop PopulatingItems();208 m_pRoot->stopBuildingGroup(); 209 209 } 210 210 211 211 void UIGDetailsModel::sltHandleToggleFinished() 212 212 { 213 m_pRoot-> updateItems();213 m_pRoot->rebuildGroup(); 214 214 } 215 215 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp
r44015 r44016 33 33 : UIGDetailsItem(pParent) 34 34 , m_fFullSet(true) 35 , m_pStep(0) 36 , m_iStep(-1) 35 , m_pBuildStep(0) 37 36 , m_iLastStepNumber(-1) 38 37 { … … 56 55 } 57 56 58 void UIGDetailsSet:: configure(UIVMItem *pItem, const QStringList &settings, bool fFullSet)57 void UIGDetailsSet::buildSet(UIVMItem *pItem, bool fFullSet, const QStringList &settings) 59 58 { 60 59 /* Remember passed arguments: */ … … 82 81 } 83 82 84 /* Create elements step-by-step: */85 prepareElements();86 } 87 88 void UIGDetailsSet::slt FirstStep(QString strSetId)89 { 90 /* Cleanup step: */91 delete m_p Step;92 m_p Step = 0;83 /* Start building set: */ 84 rebuildSet(); 85 } 86 87 void UIGDetailsSet::sltBuildStep(QString strStepId, int iStepNumber) 88 { 89 /* Cleanup build-step: */ 90 delete m_pBuildStep; 91 m_pBuildStep = 0; 93 92 94 93 /* Is step id valid? */ 95 if (strS etId != m_strSetId)94 if (strStepId != m_strSetId) 96 95 return; 97 96 98 /* Prepare first element: */ 99 m_iStep = DetailsElementType_General; 100 prepareElement(strSetId); 101 } 102 103 void UIGDetailsSet::sltNextStep(QString strSetId) 104 { 105 /* Clear step: */ 106 delete m_pStep; 107 m_pStep = 0; 108 109 /* Was that a requested set? */ 110 if (strSetId != m_strSetId) 111 return; 112 113 /* Prepare next element: */ 114 ++m_iStep; 115 prepareElement(strSetId); 116 } 117 118 void UIGDetailsSet::sltSetPrepared() 119 { 120 /* Reset step index: */ 121 m_iStep = -1; 122 /* Notify parent group: */ 123 emit sigSetCreationDone(); 97 /* Step number feats the bounds: */ 98 if (iStepNumber >= 0 && iStepNumber <= m_iLastStepNumber) 99 { 100 /* Load details settings: */ 101 DetailsElementType elementType = (DetailsElementType)iStepNumber; 102 QString strElementTypeOpened = gpConverter->toInternalString(elementType); 103 QString strElementTypeClosed = strElementTypeOpened + "Closed"; 104 /* Should the element be visible? */ 105 bool fVisible = m_settings.contains(strElementTypeOpened) || m_settings.contains(strElementTypeClosed); 106 /* Should the element be opened? */ 107 bool fOpen = m_settings.contains(strElementTypeOpened); 108 109 /* Check if element is present already: */ 110 UIGDetailsElement *pElement = element(elementType); 111 if (pElement && fOpen) 112 pElement->open(false); 113 /* Create element if necessary: */ 114 bool fJustCreated = false; 115 if (!pElement) 116 { 117 fJustCreated = true; 118 pElement = createElement(elementType, fOpen); 119 } 120 121 /* Show element if necessary: */ 122 if (fVisible && !pElement->isVisible()) 123 { 124 /* Show the element: */ 125 pElement->show(); 126 /* Update layout: */ 127 model()->updateLayout(); 128 } 129 /* Hide element if necessary: */ 130 else if (!fVisible && pElement->isVisible()) 131 { 132 /* Hide the element: */ 133 pElement->hide(); 134 /* Update layout: */ 135 model()->updateLayout(); 136 } 137 /* Update model if necessary: */ 138 else if (fJustCreated) 139 model()->updateLayout(); 140 141 /* For visible element: */ 142 if (pElement->isVisible()) 143 { 144 /* Create next build-step: */ 145 m_pBuildStep = new UIBuildStep(this, strStepId, iStepNumber + 1); 146 connect(pElement, SIGNAL(sigBuildDone()), m_pBuildStep, SLOT(sltStepDone()), Qt::QueuedConnection); 147 connect(m_pBuildStep, SIGNAL(sigStepDone(QString, int)), this, SLOT(sltBuildStep(QString, int)), Qt::QueuedConnection); 148 149 /* Build element: */ 150 pElement->updateAppearance(); 151 } 152 /* For invisible element: */ 153 else 154 { 155 /* Just build next step: */ 156 sltBuildStep(strStepId, iStepNumber + 1); 157 } 158 } 159 /* Step number out of bounds: */ 160 else 161 { 162 /* Update model: */ 163 model()->updateLayout(); 164 /* Repaint all the items: */ 165 foreach (UIGDetailsItem *pItem, items()) 166 pItem->update(); 167 /* Notify group about build done: */ 168 emit sigBuildDone(); 169 } 124 170 } 125 171 … … 135 181 136 182 /* Update appearance: */ 137 prepareElements();183 rebuildSet(); 138 184 } 139 185 … … 145 191 146 192 /* Update appearance: */ 147 prepareElements();193 rebuildSet(); 148 194 } 149 195 … … 151 197 { 152 198 /* Update appearance: */ 153 prepareElements();199 rebuildSet(); 154 200 } 155 201 … … 271 317 { 272 318 /* Build connections: */ 273 connect(this, SIGNAL(sigStartFirstStep(QString)), this, SLOT(sltFirstStep(QString)), Qt::QueuedConnection); 274 connect(this, SIGNAL(sigSetPrepared()), this, SLOT(sltSetPrepared()), Qt::QueuedConnection); 319 connect(this, SIGNAL(sigBuildStep(QString, int)), this, SLOT(sltBuildStep(QString, int)), Qt::QueuedConnection); 275 320 276 321 /* Global-events connections: */ … … 474 519 } 475 520 476 void UIGDetailsSet:: prepareElements()477 { 478 /* Cleanup step: */479 delete m_p Step;480 m_p Step = 0;521 void UIGDetailsSet::rebuildSet() 522 { 523 /* Cleanup build-step: */ 524 delete m_pBuildStep; 525 m_pBuildStep = 0; 481 526 482 527 /* Generate new set-id: */ 483 528 m_strSetId = QUuid::createUuid().toString(); 484 529 485 /* Request to prepare first step: */ 486 emit sigStartFirstStep(m_strSetId); 487 } 488 489 void UIGDetailsSet::prepareElement(QString strSetId) 490 { 491 /* Step number feats the bounds: */ 492 if (m_iStep <= m_iLastStepNumber) 493 { 494 /* Load details settings: */ 495 DetailsElementType elementType = (DetailsElementType)m_iStep; 496 QString strElementTypeOpened = gpConverter->toInternalString(elementType); 497 QString strElementTypeClosed = strElementTypeOpened + "Closed"; 498 /* Should be element visible? */ 499 bool fVisible = m_settings.contains(strElementTypeOpened) || m_settings.contains(strElementTypeClosed); 500 /* Should be element opened? */ 501 bool fOpen = m_settings.contains(strElementTypeOpened); 502 503 /* Check if element is present already: */ 504 UIGDetailsElement *pElement = element(elementType); 505 if (pElement && fOpen) 506 pElement->open(false); 507 /* Create element if necessary: */ 508 bool fJustCreated = false; 509 if (!pElement) 510 { 511 fJustCreated = true; 512 pElement = createElement(elementType, fOpen); 513 } 514 515 /* Show element if necessary: */ 516 if (fVisible && !pElement->isVisible()) 517 { 518 /* Show the element: */ 519 pElement->show(); 520 /* Update layout: */ 521 model()->updateLayout(); 522 } 523 /* Hide element if necessary: */ 524 else if (!fVisible && pElement->isVisible()) 525 { 526 /* Hide the element: */ 527 pElement->hide(); 528 /* Update layout: */ 529 model()->updateLayout(); 530 } 531 /* Update model if necessary: */ 532 else if (fJustCreated) 533 model()->updateLayout(); 534 535 /* For visible element: */ 536 if (pElement->isVisible()) 537 { 538 /* Create prepare step: */ 539 m_pStep = new UIPrepareStep(this, strSetId); 540 connect(pElement, SIGNAL(sigElementUpdateDone()), m_pStep, SLOT(sltStepDone()), Qt::QueuedConnection); 541 connect(m_pStep, SIGNAL(sigStepDone(const QString&)), this, SLOT(sltNextStep(const QString&)), Qt::QueuedConnection); 542 543 /* Update element: */ 544 pElement->updateAppearance(); 545 } 546 /* For invisible element: */ 547 else 548 { 549 /* Just go to the next step: */ 550 sltNextStep(strSetId); 551 } 552 } 553 /* Step number out of bounds: */ 554 else 555 { 556 /* Mark whole set prepared: */ 557 model()->updateLayout(); 558 foreach (UIGDetailsItem *pElement, items()) 559 pElement->update(); 560 emit sigSetPrepared(); 561 } 530 /* Request to build first step: */ 531 emit sigBuildStep(m_strSetId, DetailsElementType_General); 562 532 } 563 533 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h
r44015 r44016 39 39 signals: 40 40 41 /* Notifiers: Prepare stuff: */ 42 void sigStartFirstStep(QString strSetId); 43 void sigSetPrepared(); 44 void sigSetCreationDone(); 41 /* Notifiers: Build stuff: */ 42 void sigBuildStep(QString strSetId, int iStepNumber); 43 void sigBuildDone(); 45 44 46 45 public: … … 54 53 ~UIGDetailsSet(); 55 54 56 /* API: Configurestuff: */57 void configure(UIVMItem *pItem, const QStringList &settings, bool fFullSet);55 /* API: Build stuff: */ 56 void buildSet(UIVMItem *pItem, bool fFullSet, const QStringList &settings); 58 57 59 58 /* API: Machine stuff: */ … … 62 61 private slots: 63 62 64 /* Handlers: Prepare stuff: */ 65 void sltFirstStep(QString strSetId); 66 void sltNextStep(QString strSetId); 67 void sltSetPrepared(); 63 /* Handler: Build stuff: */ 64 void sltBuildStep(QString strStepId, int iStepNumber); 68 65 69 66 /* Handlers: Global event stuff: */ … … 104 101 void updateLayout(); 105 102 106 /* Helpers: Prepare stuff: */ 107 void prepareElements(); 108 void prepareElement(QString strSetId); 103 /* Helpers: Build stuff: */ 104 void rebuildSet(); 109 105 UIGDetailsElement* createElement(DetailsElementType elementType, bool fOpen); 110 106 … … 115 111 /* Prepare variables: */ 116 112 bool m_fFullSet; 117 UIPrepareStep *m_pStep; 118 int m_iStep; 113 UIBuildStep *m_pBuildStep; 119 114 int m_iLastStepNumber; 120 115 QString m_strSetId;
Note:
See TracChangeset
for help on using the changeset viewer.