Changeset 43919 in vbox
- Timestamp:
- Nov 20, 2012 11:46:25 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r43762 r43919 925 925 return; 926 926 927 /* Remember the paused state .*/927 /* Remember the paused state: */ 928 928 bool fWasPaused = uisession()->isPaused(); 929 929 if (!fWasPaused) … … 935 935 } 936 936 937 /* Get current machine: */ 937 938 CMachine machine = session().GetMachine(); 938 939 939 VBoxTakeSnapshotDlg dlg(activeMachineWindow(), machine); 940 940 /* Create take-snapshot dialog: */ 941 QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(activeMachineWindow(), machine); 942 943 /* Assign corresponding icon: */ 941 944 QString strTypeId = machine.GetOSTypeId(); 942 dlg.mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(strTypeId));943 944 /* Search for the max available filter index .*/945 pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(strTypeId)); 946 947 /* Search for the max available filter index: */ 945 948 QString strNameTemplate = QApplication::translate("UIMachineLogic", "Snapshot %1"); 946 949 int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine, machine.FindSnapshot(QString()), strNameTemplate); 947 dlg.mLeName->setText(strNameTemplate.arg(++ iMaxSnapshotIndex)); 948 949 if (dlg.exec() == QDialog::Accepted) 950 { 951 CConsole console = session().GetConsole(); 952 953 CProgress progress = console.TakeSnapshot(dlg.mLeName->text().trimmed(), dlg.mTeDescription->toPlainText()); 954 955 if (console.isOk()) 956 { 957 /* Show the "Taking Snapshot" progress dialog */ 958 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_create_90px.png", 0, true); 959 960 if (progress.GetResultCode() != 0) 961 msgCenter().cannotTakeSnapshot(progress); 962 } 963 else 964 msgCenter().cannotTakeSnapshot(console); 965 } 966 967 /* Restore the running state if needed. */ 950 pDlg->mLeName->setText(strNameTemplate.arg(++ iMaxSnapshotIndex)); 951 952 /* Exec the dialog: */ 953 bool fDialogAccepted = pDlg->exec() == QDialog::Accepted; 954 955 /* Is the dialog still valid? */ 956 if (pDlg) 957 { 958 /* Acquire variables: */ 959 QString strSnapshotName = pDlg->mLeName->text().trimmed(); 960 QString strSnapshotDescription = pDlg->mTeDescription->toPlainText(); 961 962 /* Destroy dialog early: */ 963 delete pDlg; 964 965 /* Was the dialog accepted? */ 966 if (fDialogAccepted) 967 { 968 /* Prepare the take-snapshot progress: */ 969 CConsole console = session().GetConsole(); 970 CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription); 971 if (console.isOk()) 972 { 973 /* Show the take-snapshot progress: */ 974 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_create_90px.png", 0, true); 975 if (progress.GetResultCode() != 0) 976 msgCenter().cannotTakeSnapshot(progress); 977 } 978 else 979 msgCenter().cannotTakeSnapshot(console); 980 } 981 } 982 983 /* Restore the running state if needed: */ 968 984 if (!fWasPaused) 969 985 {
Note:
See TracChangeset
for help on using the changeset viewer.