Changeset 42722 in vbox
- Timestamp:
- Aug 9, 2012 6:26:14 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 79931
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r42631 r42722 859 859 } 860 860 } 861 } 862 863 void UISelectorWindow::sltGroupSavingUpdate() 864 { 865 updateActionsAppearance(); 861 866 } 862 867 … … 1346 1351 connect(m_pChooser, SIGNAL(sigSelectionChanged()), this, SLOT(sltCurrentVMItemChanged()), Qt::QueuedConnection); 1347 1352 connect(m_pChooser, SIGNAL(sigSlidingStarted()), m_pDetails, SIGNAL(sigSlidingStarted())); 1353 connect(m_pChooser, SIGNAL(sigGroupSavingStarted()), this, SLOT(sltGroupSavingUpdate())); 1354 connect(m_pChooser, SIGNAL(sigGroupSavingFinished()), this, SLOT(sltGroupSavingUpdate())); 1348 1355 1349 1356 /* Tool-bar connections: */ … … 1608 1615 case UIActionIndexSelector_Simple_Machine_SettingsDialog: 1609 1616 { 1610 /* Check that there is only one item, its accessible 1617 /* Check that we are not saving groups, 1618 * there is only one item, its accessible 1611 1619 * and machine is not in 'stuck' state. */ 1612 return items.size() == 1 && 1620 return !m_pChooser->isGroupSavingInProgress() && 1621 items.size() == 1 && 1613 1622 pItem->accessible() && 1614 1623 pItem->machineState() != KMachineState_Stuck; … … 1633 1642 case UIActionIndexSelector_Simple_Group_RemoveDialog: 1634 1643 { 1644 /* Make sure we are not saving groups: */ 1645 if (m_pChooser->isGroupSavingInProgress()) 1646 return false; 1647 1635 1648 /* Group can be always removed/renamed: */ 1636 1649 return true; … … 1638 1651 case UIActionIndexSelector_Simple_Machine_RemoveDialog: 1639 1652 { 1653 /* Make sure we are not saving groups: */ 1654 if (m_pChooser->isGroupSavingInProgress()) 1655 return false; 1656 1640 1657 /* Check that all machines are NOT accessible 1641 1658 * or session states of all machines are unlocked. */ … … 1647 1664 /* Make sure all items are accessible: */ 1648 1665 if (!isItemsAccessible(items)) 1666 return false; 1667 1668 /* Make sure we are not saving groups: */ 1669 if (m_pChooser->isGroupSavingInProgress()) 1649 1670 return false; 1650 1671 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r42631 r42722 105 105 void sltOpenUrls(QList<QUrl> list = QList<QUrl>()); 106 106 107 /* Handlers: Group saving stuff: */ 108 void sltGroupSavingUpdate(); 109 107 110 private: 108 111 … … 139 142 140 143 /* Helpers: Action stuff: */ 141 staticbool isActionEnabled(int iActionIndex, const QList<UIVMItem*> &items);144 bool isActionEnabled(int iActionIndex, const QList<UIVMItem*> &items); 142 145 static bool isItemsAccessible(const QList<UIVMItem*> &items); 143 146 static bool isItemsInaccessible(const QList<UIVMItem*> &items); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.cpp
r42547 r42722 58 58 prepareConnections(); 59 59 60 /* Loadmodel: */61 m_pChooserModel-> load();60 /* Prepare model: */ 61 m_pChooserModel->prepare(); 62 62 63 63 /* Load last selected item: */ … … 70 70 vboxGlobal().virtualBox().SetExtraData(GUI_LastItemSelected, m_pChooserModel->currentItemDefinition()); 71 71 72 /* Savemodel: */73 m_pChooserModel-> save();72 /* Cleanup model: */ 73 m_pChooserModel->cleanup(); 74 74 } 75 75 … … 106 106 } 107 107 108 bool UIGChooser::isGroupSavingInProgress() const 109 { 110 return m_pChooserModel->isGroupSavingInProgress(); 111 } 112 108 113 void UIGChooser::prepareConnections() 109 114 { … … 113 118 connect(m_pChooserModel, SIGNAL(sigSelectionChanged()), this, SIGNAL(sigSelectionChanged())); 114 119 connect(m_pChooserModel, SIGNAL(sigSlidingStarted()), this, SIGNAL(sigSlidingStarted())); 120 connect(m_pChooserModel, SIGNAL(sigGroupSavingStarted()), this, SIGNAL(sigGroupSavingStarted())); 121 connect(m_pChooserModel, SIGNAL(sigGroupSavingFinished()), this, SIGNAL(sigGroupSavingFinished())); 115 122 116 123 /* Chooser-view connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.h
r42547 r42722 46 46 void sigSlidingStarted(); 47 47 48 /* Notifiers: Group saving stuff: */ 49 void sigGroupSavingStarted(); 50 void sigGroupSavingFinished(); 51 48 52 public: 49 53 … … 61 65 void setStatusBar(QStatusBar *pStatusBar); 62 66 67 /* API: Group saving stuff: */ 68 bool isGroupSavingInProgress() const; 69 63 70 private: 64 71 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
r42710 r42722 219 219 return; 220 220 221 /* Set new name / update model: */ 221 222 m_strName = strNewName; 223 model()->saveGroupSettings(); 222 224 } 223 225 … … 466 468 return; 467 469 470 /* Not while saving groups: */ 471 if (model()->isGroupSavingInProgress()) 472 return; 473 468 474 /* Unlock name-editor: */ 469 475 m_pNameEditor->show(); … … 834 840 bool UIGChooserItemGroup::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const 835 841 { 842 /* No drops while saving groups: */ 843 if (model()->isGroupSavingInProgress()) 844 return false; 836 845 /* Get mime: */ 837 846 const QMimeData *pMimeData = pEvent->mimeData(); … … 927 936 } 928 937 929 /* Update scene: */938 /* Update model: */ 930 939 pModel->updateGroupTree(); 931 940 pModel->updateNavigation(); … … 933 942 pModel->setCurrentItem(pNewGroupItem->parentItem()->toGroupItem()->opened() ? 934 943 pNewGroupItem : pNewGroupItem->parentItem()); 944 pModel->saveGroupSettings(); 935 945 break; 936 946 } … … 978 988 } 979 989 980 /* Update scene: */990 /* Update model: */ 981 991 pModel->updateGroupTree(); 982 992 pModel->updateNavigation(); … … 984 994 pModel->setCurrentItem(pNewMachineItem->parentItem()->toGroupItem()->opened() ? 985 995 pNewMachineItem : pNewMachineItem->parentItem()); 996 pModel->saveGroupSettings(); 986 997 break; 987 998 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
r42710 r42722 403 403 bool UIGChooserItemMachine::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const 404 404 { 405 /* No drops while saving groups: */ 406 if (model()->isGroupSavingInProgress()) 407 return false; 405 408 /* Get mime: */ 406 409 const QMimeData *pMimeData = pEvent->mimeData(); … … 463 466 delete this; 464 467 465 /* Update scene: */468 /* Update model: */ 466 469 pModel->updateGroupTree(); 467 470 pModel->updateNavigation(); 468 471 pModel->updateLayout(); 469 472 pModel->setCurrentItem(pNewGroupItem); 473 pModel->saveGroupSettings(); 470 474 break; 471 475 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r42678 r42722 45 45 #include "CMachine.h" 46 46 #include "CVirtualBox.h" 47 48 /* Type defs: */ 49 typedef QSet<QString> UIStringSet; 47 50 48 51 UIGChooserModel::UIGChooserModel(QObject *pParent) … … 88 91 } 89 92 90 void UIGChooserModel:: load()93 void UIGChooserModel::prepare() 91 94 { 92 95 /* Prepare group-tree: */ … … 94 97 } 95 98 96 void UIGChooserModel:: save()99 void UIGChooserModel::cleanup() 97 100 { 98 101 /* Cleanup group-tree: */ … … 496 499 } 497 500 501 void UIGChooserModel::saveGroupSettings() 502 { 503 emit sigStartGroupSaving(); 504 } 505 506 bool UIGChooserModel::isGroupSavingInProgress() const 507 { 508 return UIGroupsSavingThread::instance(); 509 } 510 498 511 void UIGChooserModel::sltMachineStateChanged(QString strId, KMachineState) 499 512 { … … 650 663 else 651 664 unsetCurrentItem(); 665 saveGroupSettings(); 652 666 } 653 667 … … 750 764 updateLayout(); 751 765 setCurrentItem(pNewGroupItem); 766 saveGroupSettings(); 752 767 } 753 768 … … 844 859 if (singleGroupSelected()) 845 860 sortItems(selectionList().first()); 861 } 862 863 void UIGChooserModel::sltGroupSavingStart() 864 { 865 saveGroupTree(); 866 } 867 868 void UIGChooserModel::sltGroupSavingComplete() 869 { 870 makeSureGroupSavingIsFinished(); 871 emit sigGroupSavingFinished(); 846 872 } 847 873 … … 930 956 connect(gActionPool->action(UIActionIndexSelector_Simple_Group_Sort), SIGNAL(triggered()), 931 957 this, SLOT(sltSortGroup())); 958 959 connect(this, SIGNAL(sigStartGroupSaving()), this, SLOT(sltGroupSavingStart()), Qt::QueuedConnection); 932 960 } 933 961 … … 954 982 void UIGChooserModel::cleanupGroupTree() 955 983 { 956 /* Save group tree: */ 957 saveGroupTree(); 958 /* Save order: */ 984 makeSureGroupSavingIsFinished(); 959 985 saveGroupsOrder(); 960 986 } … … 1113 1139 } 1114 1140 /* Update group definitions: */ 1115 m_groups[machine.GetId()] = UIStringSet::fromList(groups.toList());1141 m_groups[machine.GetId()] = groups.toList(); 1116 1142 } 1117 1143 /* Inaccessible machine: */ … … 1295 1321 void UIGChooserModel::saveGroupTree() 1296 1322 { 1297 /* Prepare machine map: */ 1323 /* Make sure there is no group saving activity: */ 1324 if (UIGroupsSavingThread::instance()) 1325 return; 1326 1327 /* Prepare full group map: */ 1298 1328 QMap<QString, QStringList> groups; 1299 /* Iterate over all the items: */1300 1329 gatherGroupTree(groups, mainRoot()); 1301 /* Saving groups: */ 1302 foreach (const QString &strId, groups.keys()) 1303 { 1304 /* Get new group list: */ 1305 const QStringList &newGroupList = groups.value(strId); 1306 /* Get old group set: */ 1307 AssertMsg(m_groups.contains(strId), ("Invalid group set!")); 1308 const UIStringSet &oldGroupSet = m_groups.value(strId); 1309 /* Get new group set: */ 1310 const UIStringSet &newGroupSet = UIStringSet::fromList(newGroupList); 1311 /* Is group set changed? */ 1312 if (oldGroupSet != newGroupSet) 1313 { 1314 /* Open session to save machine settings: */ 1315 CSession session = vboxGlobal().openSession(strId); 1316 if (session.isNull()) 1317 return; 1318 /* Get machine: */ 1319 CMachine machine = session.GetMachine(); 1320 /* Save groups: */ 1321 // printf(" Saving groups for machine {%s}: {%s}\n", 1322 // machine.GetName().toAscii().constData(), 1323 // newGroupList.join(",").toAscii().constData()); 1324 machine.SetGroups(newGroupList.toVector()); 1325 machine.SaveSettings(); 1326 if (!machine.isOk()) 1327 msgCenter().cannotSaveMachineSettings(machine); 1328 /* Close the session: */ 1329 session.UnlockMachine(); 1330 } 1331 } 1330 1331 /* Save information in other thread: */ 1332 UIGroupsSavingThread::prepare(); 1333 emit sigGroupSavingStarted(); 1334 UIGroupsSavingThread::instance()->configure(this, m_groups, groups); 1335 UIGroupsSavingThread::instance()->start(); 1336 m_groups = groups; 1332 1337 } 1333 1338 … … 1743 1748 } 1744 1749 1750 void UIGChooserModel::makeSureGroupSavingIsFinished() 1751 { 1752 /* Nothing to do if thread is null: */ 1753 if (!UIGroupsSavingThread::instance()) 1754 return; 1755 1756 /* Cleanup thread otherwise: */ 1757 UIGroupsSavingThread::cleanup(); 1758 } 1759 1760 /* static */ 1761 UIGroupsSavingThread* UIGroupsSavingThread::m_spInstance = 0; 1762 1763 /* static */ 1764 UIGroupsSavingThread* UIGroupsSavingThread::instance() 1765 { 1766 return m_spInstance; 1767 } 1768 1769 /* static */ 1770 void UIGroupsSavingThread::prepare() 1771 { 1772 /* Make sure instance not prepared: */ 1773 if (m_spInstance) 1774 return; 1775 1776 /* Crate instance: */ 1777 new UIGroupsSavingThread; 1778 } 1779 1780 /* static */ 1781 void UIGroupsSavingThread::cleanup() 1782 { 1783 /* Make sure instance prepared: */ 1784 if (!m_spInstance) 1785 return; 1786 1787 /* Crate instance: */ 1788 delete m_spInstance; 1789 } 1790 1791 void UIGroupsSavingThread::configure(QObject *pParent, 1792 const QMap<QString, QStringList> &oldLists, 1793 const QMap<QString, QStringList> &newLists) 1794 { 1795 m_oldLists = oldLists; 1796 m_newLists = newLists; 1797 connect(this, SIGNAL(sigComplete()), pParent, SLOT(sltGroupSavingComplete())); 1798 } 1799 1800 UIGroupsSavingThread::UIGroupsSavingThread() 1801 { 1802 /* Assign instance: */ 1803 m_spInstance = this; 1804 } 1805 1806 UIGroupsSavingThread::~UIGroupsSavingThread() 1807 { 1808 /* Wait: */ 1809 wait(); 1810 1811 /* Erase instance: */ 1812 m_spInstance = 0; 1813 } 1814 1815 void UIGroupsSavingThread::run() 1816 { 1817 /* COM prepare: */ 1818 COMBase::InitializeCOM(false); 1819 1820 /* For every particular machine ID: */ 1821 foreach (const QString &strId, m_newLists.keys()) 1822 { 1823 /* Get new group list/set: */ 1824 const QStringList &newGroupList = m_newLists.value(strId); 1825 const UIStringSet &newGroupSet = UIStringSet::fromList(newGroupList); 1826 /* Get old group list/set: */ 1827 const QStringList &oldGroupList = m_oldLists.value(strId); 1828 const UIStringSet &oldGroupSet = UIStringSet::fromList(oldGroupList); 1829 /* Is group set changed? */ 1830 if (newGroupSet != oldGroupSet) 1831 { 1832 /* Open session to save machine settings: */ 1833 CSession session = vboxGlobal().openSession(strId); 1834 AssertMsg(!session.isNull(), ("Can't open session!")); 1835 /* Get machine: */ 1836 CMachine machine = session.GetMachine(); 1837 AssertMsg(!machine.isNull(), ("Can't get machine!")); 1838 /* Save settings: */ 1839 machine.SetGroups(newGroupList.toVector()); 1840 machine.SaveSettings(); 1841 AssertMsg(machine.isOk(), ("Unable to save machine settings!")); 1842 //msgCenter().cannotSaveMachineSettings(machine); 1843 /* Close the session: */ 1844 session.UnlockMachine(); 1845 } 1846 } 1847 1848 /* Notify listeners about completeness: */ 1849 emit sigComplete(); 1850 1851 /* COM cleanup: */ 1852 COMBase::CleanupCOM(); 1853 } 1854 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
r42637 r42722 25 25 #include <QTransform> 26 26 #include <QMap> 27 #include <Q Set>27 #include <QThread> 28 28 29 29 /* GUI includes: */ … … 45 45 class UIGChooserHandlerKeyboard; 46 46 47 /* Type defs: */48 typedef QSet<QString> UIStringSet;49 50 47 /* Context-menu type: */ 51 48 enum UIGraphicsSelectorContextMenuType … … 75 72 void sigSlidingStarted(); 76 73 74 /* Notifiers: Group saving stuff: */ 75 void sigStartGroupSaving(); 76 void sigGroupSavingStarted(); 77 void sigGroupSavingFinished(); 78 77 79 public: 78 80 … … 81 83 ~UIGChooserModel(); 82 84 83 /* API: Load/savestuff: */84 void load();85 void save();85 /* API: Prepare/cleanup stuff: */ 86 void prepare(); 87 void cleanup(); 86 88 87 89 /* API: Scene getter: */ … … 140 142 QString uniqueGroupName(UIGChooserItem *pRoot); 141 143 144 /* API: Group saving stuff: */ 145 void saveGroupSettings(); 146 bool isGroupSavingInProgress() const; 147 142 148 private slots: 143 149 … … 183 189 void sltSortParentGroup(); 184 190 void sltSortGroup(); 191 192 /* Handlers: Group saving stuff: */ 193 void sltGroupSavingStart(); 194 void sltGroupSavingComplete(); 185 195 186 196 private: … … 271 281 void sortItems(UIGChooserItem *pParent, bool fRecursively = false); 272 282 283 /* Helper: Group saving stuff: */ 284 void makeSureGroupSavingIsFinished(); 285 273 286 /* Variables: */ 274 287 QGraphicsScene *m_pScene; … … 280 293 QPointer<UIGChooserItem> m_pAfterSlidingFocus; 281 294 282 QMap<QString, UIStringSet> m_groups;295 QMap<QString, QStringList> m_groups; 283 296 QList<UIGChooserItem*> m_navigationList; 284 297 QList<UIGChooserItem*> m_selectionList; … … 293 306 }; 294 307 308 /* Allows to save group settings asynchronously: */ 309 class UIGroupsSavingThread : public QThread 310 { 311 Q_OBJECT; 312 313 signals: 314 315 /* Notifier: Complete stuff: */ 316 void sigComplete(); 317 318 public: 319 320 /* Singleton stuff: */ 321 static UIGroupsSavingThread* instance(); 322 static void prepare(); 323 static void cleanup(); 324 325 /* API: Configuring stuff: */ 326 void configure(QObject *pParent, 327 const QMap<QString, QStringList> &oldLists, 328 const QMap<QString, QStringList> &newLists); 329 330 private: 331 332 /* Constructor/destructor: */ 333 UIGroupsSavingThread(); 334 ~UIGroupsSavingThread(); 335 336 /* Worker thread stuff: */ 337 void run(); 338 339 /* Variables: */ 340 static UIGroupsSavingThread *m_spInstance; 341 QMap<QString, QStringList> m_oldLists; 342 QMap<QString, QStringList> m_newLists; 343 }; 344 295 345 #endif /* __UIGChooserModel_h__ */ 296 346 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp
r42689 r42722 19 19 20 20 /* Qt includes: */ 21 #include <QApplication> 21 22 #include <QPainter> 22 23 #include <QStyleOptionGraphicsItem> … … 32 33 #include "UIGDetailsModel.h" 33 34 #include "UIGraphicsRotatorButton.h" 34 #include "VBoxGlobal.h"35 #include "UIVirtualBoxEventHandler.h"36 35 #include "UIIconPool.h" 37 36 #include "UIConverter.h" … … 127 126 } 128 127 128 void UIGDetailsElement::updateHoverAccessibility() 129 { 130 /* Check if name-hovering should be available: */ 131 m_fNameHoveringAccessible = machine().isNull() || !machine().GetAccessible() ? false : 132 machine().GetState() != KMachineState_Stuck; 133 } 134 129 135 void UIGDetailsElement::sltElementToggleStart() 130 136 { … … 153 159 model()->updateLayout(); 154 160 update(); 155 }156 157 void UIGDetailsElement::sltMachineStateChange(QString strId)158 {159 /* Is this our VM changed? */160 if (machine().GetId() == strId)161 updateHoverAccessibility();162 163 /* Finally, update appearance: */164 sltShouldWeUpdateAppearance(strId);165 }166 167 void UIGDetailsElement::sltShouldWeUpdateAppearance(QString strId)168 {169 if (machine().GetId() == strId)170 sltUpdateAppearance();171 161 } 172 162 … … 321 311 } 322 312 313 UITextTable UIGDetailsElement::text() const 314 { 315 return m_text; 316 } 317 323 318 void UIGDetailsElement::setText(const UITextTable &text) 324 319 { … … 390 385 m_pHighlightMachine->start(); 391 386 392 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));393 connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltShouldWeUpdateAppearance(QString)));394 connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltShouldWeUpdateAppearance(QString)));395 connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltShouldWeUpdateAppearance(QString)));396 connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltUpdateAppearance()));397 connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltUpdateAppearance()));398 387 connect(this, SIGNAL(sigToggleElement(DetailsElementType, bool)), model(), SLOT(sltToggleElements(DetailsElementType, bool))); 399 388 connect(this, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)), … … 735 724 } 736 725 737 void UIGDetailsElement::updateHoverAccessibility()738 {739 /* Check if name-hovering should be available: */740 m_fNameHoveringAccessible = machine().isNull() || !machine().GetAccessible() ? false :741 machine().GetState() != KMachineState_Stuck;742 }743 744 726 void UIGDetailsElement::updateNameHoverRepresentation(QGraphicsSceneHoverEvent *pEvent) 745 727 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h
r42689 r42722 83 83 virtual int minimumHeightHint() const; 84 84 85 public slots:86 87 85 /* API: Update stuff: */ 88 virtual void sltUpdateAppearance() = 0; 86 void updateHoverAccessibility(); 87 virtual void updateAppearance() = 0; 89 88 90 89 protected: … … 122 121 123 122 /* API: Text stuff: */ 123 UITextTable text() const; 124 124 void setText(const UITextTable &text); 125 125 … … 144 144 void sltElementToggleStart(); 145 145 void sltElementToggleFinish(bool fToggled); 146 147 /* Handlers: Global event stuff: */148 void sltMachineStateChange(QString strId);149 void sltShouldWeUpdateAppearance(QString strId);150 146 151 147 private: … … 181 177 /* Helpers: Mouse stuff: */ 182 178 void updateButtonVisibility(); 183 void updateHoverAccessibility();184 179 void updateNameHoverRepresentation(QGraphicsSceneHoverEvent *pEvent); 185 180 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
r42686 r42722 63 63 } 64 64 65 void UIGDetailsElementInterface:: sltUpdateAppearance()65 void UIGDetailsElementInterface::updateAppearance() 66 66 { 67 67 if (!m_pThread) … … 74 74 } 75 75 76 void UIGDetailsElementInterface::sltUpdateAppearanceFinished(const UITextTable &text) 77 { 78 setText(text); 76 void UIGDetailsElementInterface::sltUpdateAppearanceFinished(const UITextTable &newText) 77 { 78 if (text() != newText) 79 { 80 setText(newText); 81 model()->updateLayout(); 82 update(); 83 } 79 84 cleanupThread(); 80 model()->updateLayout();81 update();82 85 } 83 86 … … 167 170 } 168 171 169 void UIGDetailsElementPreview::sltUpdateAppearance()170 {171 m_pPreview->setMachine(machine());172 }173 174 172 int UIGDetailsElementPreview::minimumWidthHint() const 175 173 { … … 221 219 /* Return result: */ 222 220 return iProposedHeight; 221 } 222 223 void UIGDetailsElementPreview::updateAppearance() 224 { 225 m_pPreview->setMachine(machine()); 223 226 } 224 227 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h
r42529 r42722 70 70 ~UIGDetailsElementInterface(); 71 71 72 protected slots:73 74 /* Handlers: Update stuff: */75 void sltUpdateAppearance();76 virtual void sltUpdateAppearanceFinished(const UITextTable &text);77 78 72 protected: 79 73 80 74 /* Helpers: Update stuff: */ 75 void updateAppearance(); 81 76 virtual UIGDetailsUpdateThread* createUpdateThread() = 0; 77 78 private slots: 79 80 /* Handler: Update stuff: */ 81 virtual void sltUpdateAppearanceFinished(const UITextTable &newText); 82 82 83 83 private: … … 133 133 /* Constructor: */ 134 134 UIGDetailsElementPreview(UIGDetailsSet *pParent, bool fOpened); 135 136 private slots:137 138 /* Handlers: Update stuff: */139 void sltUpdateAppearance();140 135 141 136 private: … … 145 140 int minimumHeightHint(bool fClosed) const; 146 141 142 /* Helpers: Update stuff: */ 143 void updateAppearance(); 144 147 145 /* Helpers: Layout stuff: */ 148 146 void updateLayout(); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp
r42678 r42722 24 24 #include "UIVMItem.h" 25 25 #include "UIConverter.h" 26 #include "UIVirtualBoxEventHandler.h" 27 #include "VBoxGlobal.h" 26 28 27 29 /* COM includes: */ … … 43 45 connect(this, SIGNAL(sigElementPrepared(QString)), this, SLOT(sltNextStep(QString)), Qt::QueuedConnection); 44 46 connect(this, SIGNAL(sigSetPrepared()), this, SLOT(sltSetPrepared()), Qt::QueuedConnection); 47 connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString))); 48 connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString))); 49 connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString))); 50 connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString))); 51 connect(&vboxGlobal(), SIGNAL(mediumEnumStarted()), this, SLOT(sltUpdateAppearance())); 52 connect(&vboxGlobal(), SIGNAL(mediumEnumFinished(const VBoxMediaList &)), this, SLOT(sltUpdateAppearance())); 45 53 } 46 54 … … 97 105 /* Notify parent group: */ 98 106 emit sigSetCreationDone(); 107 } 108 109 void UIGDetailsSet::sltMachineStateChange(QString strId) 110 { 111 /* Is this our VM changed? */ 112 if (machine().GetId() != strId) 113 return; 114 115 /* Update hover accessibility: */ 116 foreach (UIGDetailsItem *pItem, items()) 117 pItem->toElement()->updateHoverAccessibility(); 118 119 /* Update appearance: */ 120 foreach (UIGDetailsItem *pItem, items()) 121 pItem->toElement()->updateAppearance(); 122 } 123 124 void UIGDetailsSet::sltMachineAttributesChange(QString strId) 125 { 126 /* Is this our VM changed? */ 127 if (machine().GetId() != strId) 128 return; 129 130 /* Update appearance: */ 131 foreach (UIGDetailsItem *pItem, items()) 132 pItem->toElement()->updateAppearance(); 133 } 134 135 void UIGDetailsSet::sltUpdateAppearance() 136 { 137 /* Update appearance: */ 138 foreach (UIGDetailsItem *pItem, items()) 139 pItem->toElement()->updateAppearance(); 99 140 } 100 141 … … 456 497 457 498 /* Check if element is present already: */ 499 bool fJustCreated = false; 458 500 UIGDetailsElement *pElement = element(elementType); 459 501 /* Create if necessary: */ 460 502 if (!pElement) 503 { 461 504 pElement = createElement(elementType, fOpen); 505 fJustCreated = true; 506 } 462 507 /* Prepare element: */ 463 508 if (fVisible && !pElement->isVisible()) … … 465 510 else if (!fVisible && pElement->isVisible()) 466 511 pElement->hide(); 467 pElement->sltUpdateAppearance(); 468 /* Update layout: */ 469 model()->updateLayout(); 512 if (pElement->isVisible()) 513 pElement->updateAppearance(); 514 if (fJustCreated) 515 model()->updateLayout(); 470 516 /* Mark element prepared: */ 471 517 emit sigElementPrepared(strSetId); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h
r42608 r42722 68 68 void sltSetPrepared(); 69 69 70 /* Handlers: Global event stuff: */ 71 void sltMachineStateChange(QString strId); 72 void sltMachineAttributesChange(QString strId); 73 74 /* Handler: Update stuff: */ 75 void sltUpdateAppearance(); 76 70 77 private: 71 78
Note:
See TracChangeset
for help on using the changeset viewer.