Changeset 90645 in vbox
- Timestamp:
- Aug 12, 2021 9:49:54 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 146257
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90606 r90645 1015 1015 } 1016 1016 1017 /* Acquire session state: */1018 const KSessionState enmSessionState = m_comMachine.GetSessionState();1019 if (!m_comMachine.isOk())1020 {1021 comResult = m_comMachine;1022 return CProgress();1023 }1024 1025 /* Open a session thru which we will modify the machine: */1026 if (enmSessionState != KSessionState_Unlocked)1027 m_comSession = uiCommon().openExistingSession(uId);1028 else1029 m_comSession = uiCommon().openSession(uId);1030 if (m_comSession.isNull())1031 return CProgress();1032 1033 1017 /* Get session machine: */ 1034 CMachine comMachine = m_comSession.GetMachine(); 1035 if (!m_comSession.isOk()) 1036 { 1037 comResult = m_comSession; 1038 m_comSession.UnlockMachine(); 1039 return CProgress(); 1018 CMachine comMachine; 1019 1020 /* For Manager UI: */ 1021 switch (uiCommon().uiType()) 1022 { 1023 case UICommon::UIType_SelectorUI: 1024 { 1025 /* Acquire session state: */ 1026 const KSessionState enmSessionState = m_comMachine.GetSessionState(); 1027 if (!m_comMachine.isOk()) 1028 { 1029 comResult = m_comMachine; 1030 return CProgress(); 1031 } 1032 1033 /* Open a session thru which we will modify the machine: */ 1034 if (enmSessionState != KSessionState_Unlocked) 1035 m_comSession = uiCommon().openExistingSession(uId); 1036 else 1037 m_comSession = uiCommon().openSession(uId); 1038 if (m_comSession.isNull()) 1039 return CProgress(); 1040 1041 /* Get session machine: */ 1042 comMachine = m_comSession.GetMachine(); 1043 if (!m_comSession.isOk()) 1044 { 1045 comResult = m_comSession; 1046 m_comSession.UnlockMachine(); 1047 return CProgress(); 1048 } 1049 1050 break; 1051 } 1052 case UICommon::UIType_RuntimeUI: 1053 { 1054 /* Get passed machine: */ 1055 comMachine = m_comMachine; 1056 1057 break; 1058 } 1040 1059 } 1041 1060 … … 1053 1072 void UINotificationProgressSnapshotTake::sltHandleProgressFinished() 1054 1073 { 1055 m_comSession.UnlockMachine(); 1074 if (m_comSession.isNotNull()) 1075 m_comSession.UnlockMachine(); 1056 1076 } 1057 1077 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r90627 r90645 1803 1803 1804 1804 /* Search for the max available filter index: */ 1805 QString strNameTemplate = UITakeSnapshotDialog::tr("Snapshot %1");1805 const QString strNameTemplate = UITakeSnapshotDialog::tr("Snapshot %1"); 1806 1806 int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine(), machine().FindSnapshot(QString()), strNameTemplate); 1807 1807 pDlg->setName(strNameTemplate.arg(++ iMaxSnapshotIndex)); 1808 1808 1809 1809 /* Exec the dialog: */ 1810 bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;1810 const bool fDialogAccepted = pDlg->exec() == QDialog::Accepted; 1811 1811 1812 1812 /* Make sure dialog still valid: */ … … 1815 1815 1816 1816 /* Acquire variables: */ 1817 QString strSnapshotName = pDlg->name().trimmed();1818 QString strSnapshotDescription = pDlg->description();1817 const QString strSnapshotName = pDlg->name().trimmed(); 1818 const QString strSnapshotDescription = pDlg->description(); 1819 1819 1820 1820 /* Destroy dialog early: */ … … 1822 1822 1823 1823 /* Was the dialog accepted? */ 1824 if (fDialogAccepted) 1825 { 1826 QUuid uSnapshotId; 1827 /* Prepare the take-snapshot progress: */ 1828 CProgress progress = machine().TakeSnapshot(strSnapshotName, strSnapshotDescription, true, uSnapshotId); 1829 if (machine().isOk()) 1830 { 1831 /* Show the take-snapshot progress: */ 1832 const bool fStillValid = msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_snapshot_create_90px.png"); 1833 if (!fStillValid) 1834 return; 1835 if (!progress.isOk() || progress.GetResultCode() != 0) 1836 msgCenter().cannotTakeSnapshot(progress, machineName()); 1837 } 1838 else 1839 msgCenter().cannotTakeSnapshot(machine(), machineName()); 1840 } 1824 if (!fDialogAccepted) 1825 return; 1826 1827 /* Take snapshot: */ 1828 UINotificationProgressSnapshotTake *pNotification = new UINotificationProgressSnapshotTake(machine(), 1829 strSnapshotName, 1830 strSnapshotDescription); 1831 gpNotificationCenter->append(pNotification); 1841 1832 } 1842 1833
Note:
See TracChangeset
for help on using the changeset viewer.