Changeset 67424 in vbox
- Timestamp:
- Jun 15, 2017 1:46:34 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116151
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp
r67419 r67424 99 99 bool isCurrentStateItem() const { return m_fCurrentStateItem; } 100 100 101 /** Returns whether this is the current snapshotitem. */101 /** Returns whether this is the "current snapshot" item. */ 102 102 bool isCurrentSnapshotItem() const { return m_fCurrentSnapshotItem; } 103 103 /** Defines whether this is the @a fCurrent snapshot item. */ … … 138 138 CMachine m_comMachine; 139 139 140 /** Holds the current snapshotID. */140 /** Holds the "current snapshot" ID. */ 141 141 QString m_strSnapshotID; 142 /** Holds whether the current snapshotis online one. */142 /** Holds whether the "current snapshot" is online one. */ 143 143 bool m_fOnline; 144 144 … … 219 219 { 220 220 /* Set the bold font state 221 * for current stateitem: */221 * for "current state" item: */ 222 222 QFont myFont = font(Column_Name); 223 223 myFont.setBold(true); … … 236 236 { 237 237 /* Set the bold font state 238 * for current stateitem: */238 * for "current state" item: */ 239 239 QFont myFont = font(Column_Name); 240 240 myFont.setBold(true); … … 263 263 264 264 /* Set/clear the bold font state 265 * for current snapshotitem: */265 * for "current snapshot" item: */ 266 266 QFont myFont = font(Column_Name); 267 267 myFont.setBold(fCurrent); … … 471 471 , m_pSnapshotTree(0) 472 472 , m_pCurrentSnapshotItem(0) 473 , m_pCurrentStateItem(0) 473 474 , m_pDetailsWidget(0) 474 475 { … … 491 492 if (m_comMachine.isNull()) 492 493 { 493 m_strMachineI D= QString();494 m_strMachineId = QString(); 494 495 m_enmSessionState = KSessionState_Null; 495 496 m_fShapshotOperationsAllowed = false; … … 497 498 else 498 499 { 499 m_strMachineI D= comMachine.GetId();500 m_strMachineId = comMachine.GetId(); 500 501 m_enmSessionState = comMachine.GetSessionState(); 501 m_fShapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(m_strMachineI D);502 m_fShapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(m_strMachineId); 502 503 } 503 504 … … 580 581 } 581 582 582 void UISnapshotPane::sltHandleMachineDataChange(QString strMachineI D)583 void UISnapshotPane::sltHandleMachineDataChange(QString strMachineId) 583 584 { 584 585 /* Make sure it's our VM: */ 585 if (strMachineI D != m_strMachineID)586 if (strMachineId != m_strMachineId) 586 587 return; 587 588 … … 589 590 QWriteLocker locker(m_pLockReadWrite); 590 591 591 /* Recache currentitem data: */592 currentStateItem()->recache();593 } 594 595 void UISnapshotPane::sltHandleMachineStateChange(QString strMachineI D, KMachineState enmState)592 /* Recache "current state" item data: */ 593 m_pCurrentStateItem->recache(); 594 } 595 596 void UISnapshotPane::sltHandleMachineStateChange(QString strMachineId, KMachineState enmState) 596 597 { 597 598 /* Make sure it's our VM: */ 598 if (strMachineI D != m_strMachineID)599 if (strMachineId != m_strMachineId) 599 600 return; 600 601 … … 602 603 QWriteLocker locker(m_pLockReadWrite); 603 604 604 /* Recache currentitem data and machine-state: */605 currentStateItem()->recache();606 currentStateItem()->setMachineState(enmState);607 } 608 609 void UISnapshotPane::sltHandleSessionStateChange(QString strMachineI D, KSessionState enmState)605 /* Recache "current state" item data and machine-state: */ 606 m_pCurrentStateItem->recache(); 607 m_pCurrentStateItem->setMachineState(enmState); 608 } 609 610 void UISnapshotPane::sltHandleSessionStateChange(QString strMachineId, KSessionState enmState) 610 611 { 611 612 /* Make sure it's our VM: */ 612 if (strMachineI D != m_strMachineID)613 if (strMachineId != m_strMachineId) 613 614 return; 614 615 … … 623 624 } 624 625 625 void UISnapshotPane::sltHandleSnapshotChange(QString strMachineI D)626 void UISnapshotPane::sltHandleSnapshotChange(QString strMachineId) 626 627 { 627 628 /* Make sure it's our VM: */ 628 if (strMachineI D != m_strMachineID)629 if (strMachineId != m_strMachineId) 629 630 return; 630 631 … … 664 665 if (m_pDetailsWidget->isVisible()) 665 666 { 666 /* Acquire current snapshotitem: */667 /* Acquire "current snapshot" item: */ 667 668 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 668 669 /* Update details-widget: */ … … 680 681 m_pActionCommitSnapshotDetails->setEnabled(false); 681 682 682 /* Acquire current snapshotitem: */683 /* Acquire "current snapshot" item: */ 683 684 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 684 685 AssertPtr(pSnapshotItem); … … 725 726 void UISnapshotPane::sltHandleCurrentItemChange() 726 727 { 727 /* Acquire current snapshotitem: */728 /* Acquire "current snapshot" item: */ 728 729 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 729 730 … … 1066 1067 /* Populate snapshot tree: */ 1067 1068 populateSnapshots(comSnapshot, 0); 1068 /* And make sure it has current snapshotitem: */1069 /* And make sure it has "current snapshot" item: */ 1069 1070 Assert(m_pCurrentSnapshotItem); 1070 1071 1071 /* Add the "current state" item as a child to current snapshotitem: */1072 UISnapshotItem *pCsi= new UISnapshotItem(this, m_pCurrentSnapshotItem, m_comMachine);1073 pCsi->recache();1072 /* Add the "current state" item as a child to "current snapshot" item: */ 1073 m_pCurrentStateItem = new UISnapshotItem(this, m_pCurrentSnapshotItem, m_comMachine); 1074 m_pCurrentStateItem->recache(); 1074 1075 1075 1076 /* Search for a previously selected item: */ … … 1078 1079 pCurrentItem = findItem(strFirstChildOfSelectedItem); 1079 1080 if (pCurrentItem == 0) 1080 pCurrentItem = currentStateItem();1081 pCurrentItem = m_pCurrentStateItem; 1081 1082 1082 1083 /* Choose current item: */ … … 1088 1089 else 1089 1090 { 1090 /* There is no current snapshotitem: */1091 /* There is no "current snapshot" item: */ 1091 1092 m_pCurrentSnapshotItem = 0; 1092 1093 1093 1094 /* Add the "current state" item as a child of snapshot tree: */ 1094 UISnapshotItem *pCsi= new UISnapshotItem(this, m_pSnapshotTree, m_comMachine);1095 pCsi->recache();1095 m_pCurrentStateItem = new UISnapshotItem(this, m_pSnapshotTree, m_comMachine); 1096 m_pCurrentStateItem->recache(); 1096 1097 1097 1098 /* Choose current item: */ 1098 m_pSnapshotTree->setCurrentItem( pCsi);1099 m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem); 1099 1100 sltHandleCurrentItemChange(); 1100 1101 } … … 1155 1156 void UISnapshotPane::updateActionStates() 1156 1157 { 1157 /* Acquire current snapshotitem: */1158 /* Acquire "current snapshot" item: */ 1158 1159 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1159 1160 … … 1163 1164 /* Acquire machine-state of the "current state" item: */ 1164 1165 KMachineState enmState = KMachineState_Null; 1165 if ( currentStateItem())1166 enmState = currentStateItem()->machineState();1166 if (m_pCurrentStateItem) 1167 enmState = m_pCurrentStateItem->machineState(); 1167 1168 1168 1169 /* Determine whether taking or deleting snapshots is possible: */ … … 1229 1230 CSession comSession; 1230 1231 if (m_enmSessionState != KSessionState_Unlocked) 1231 comSession = vboxGlobal().openExistingSession(m_strMachineI D);1232 comSession = vboxGlobal().openExistingSession(m_strMachineId); 1232 1233 else 1233 comSession = vboxGlobal().openSession(m_strMachineI D);1234 comSession = vboxGlobal().openSession(m_strMachineId); 1234 1235 if (comSession.isNull()) 1235 1236 break; … … 1324 1325 do 1325 1326 { 1326 /* Acquire current snapshotitem: */1327 /* Acquire "current snapshot" item: */ 1327 1328 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1328 1329 AssertPtr(pSnapshotItem); … … 1352 1353 CSession comSession; 1353 1354 if (m_enmSessionState != KSessionState_Unlocked) 1354 comSession = vboxGlobal().openExistingSession(m_strMachineI D);1355 comSession = vboxGlobal().openExistingSession(m_strMachineId); 1355 1356 else 1356 comSession = vboxGlobal().openSession(m_strMachineI D);1357 comSession = vboxGlobal().openSession(m_strMachineId); 1357 1358 if (comSession.isNull()) 1358 1359 break; … … 1401 1402 do 1402 1403 { 1403 /* Acquire current snapshotitem: */1404 /* Acquire "current snapshot" item: */ 1404 1405 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1405 1406 AssertPtr(pSnapshotItem); … … 1425 1426 { 1426 1427 /* Take snapshot of changed current state: */ 1427 m_pSnapshotTree->setCurrentItem( currentStateItem());1428 m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem); 1428 1429 if (!takeSnapshot()) 1429 1430 break; … … 1432 1433 1433 1434 /* Open a direct session (this call will handle all errors): */ 1434 CSession comSession = vboxGlobal().openSession(m_strMachineI D);1435 CSession comSession = vboxGlobal().openSession(m_strMachineId); 1435 1436 if (comSession.isNull()) 1436 1437 break; … … 1475 1476 void UISnapshotPane::cloneSnapshot() 1476 1477 { 1477 /* Acquire current snapshotitem: */1478 /* Acquire "current snapshot" item: */ 1478 1479 const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem()); 1479 1480 AssertReturnVoid(pSnapshotItem); … … 1534 1535 } 1535 1536 1536 UISnapshotItem *UISnapshotPane::currentStateItem() const1537 {1538 /* Last child of the current snapshot item if any or first child of invisible root item otherwise: */1539 QTreeWidgetItem *pCsi = m_pCurrentSnapshotItem ?1540 m_pCurrentSnapshotItem->child(m_pCurrentSnapshotItem->childCount() - 1) :1541 m_pSnapshotTree->invisibleRootItem()->child(0);1542 return static_cast<UISnapshotItem*>(pCsi);1543 }1544 1545 1537 SnapshotAgeFormat UISnapshotPane::traverseSnapshotAge(QTreeWidgetItem *pItem) const 1546 1538 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h
r67419 r67424 69 69 protected: 70 70 71 /** @name Event-handling stuff.71 /** @name Qt event handlers. 72 72 * @{ */ 73 73 /** Handles translation event. */ … … 85 85 /** @name Main event handlers. 86 86 * @{ */ 87 /** Handles machine data change for machine with @a strMachineI D. */88 void sltHandleMachineDataChange(QString strMachineI D);89 /** Handles machine @a enmState change for machine with @a strMachineI D. */90 void sltHandleMachineStateChange(QString strMachineI D, KMachineState enmState);91 92 /** Handles session @a enmState change for machine with @a strMachineI D. */93 void sltHandleSessionStateChange(QString strMachineI D, KSessionState enmState);94 95 /** Handles any snapshot change for machine with @a strMachineI D. */96 void sltHandleSnapshotChange(QString strMachineI D);87 /** Handles machine data change for machine with @a strMachineId. */ 88 void sltHandleMachineDataChange(QString strMachineId); 89 /** Handles machine @a enmState change for machine with @a strMachineId. */ 90 void sltHandleMachineStateChange(QString strMachineId, KMachineState enmState); 91 92 /** Handles session @a enmState change for machine with @a strMachineId. */ 93 void sltHandleSessionStateChange(QString strMachineId, KSessionState enmState); 94 95 /** Handles any snapshot change for machine with @a strMachineId. */ 96 void sltHandleSnapshotChange(QString strMachineId); 97 97 /** @} */ 98 98 … … 177 177 /** Searches for an item with corresponding @a strSnapshotID. */ 178 178 UISnapshotItem *findItem(const QString &strSnapshotID) const; 179 /** Returns the "current state" item. */180 UISnapshotItem *currentStateItem() const;181 179 182 180 /** Searches for smallest snapshot age starting with @a pItem as parent. */ … … 189 187 CMachine m_comMachine; 190 188 /** Holds the machine object ID. */ 191 QString m_strMachineI D;189 QString m_strMachineId; 192 190 /** Holds the cached session state. */ 193 191 KSessionState m_enmSessionState; … … 227 225 /** Holds the snapshot tree instance. */ 228 226 UISnapshotTree *m_pSnapshotTree; 229 /** Holds the current snapshotitem reference. */227 /** Holds the "current snapshot" item reference. */ 230 228 UISnapshotItem *m_pCurrentSnapshotItem; 229 /** Holds the "current state" item reference. */ 230 UISnapshotItem *m_pCurrentStateItem; 231 231 232 232 /** Holds the details-widget instance. */
Note:
See TracChangeset
for help on using the changeset viewer.