Changeset 55214 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 13, 2015 3:53:01 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99520
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp
r55140 r55214 5 5 6 6 /* 7 * Copyright (C) 2012-201 4Oracle Corporation7 * Copyright (C) 2012-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 73 73 case KMachineState_Stuck: return QColor(Qt::darkMagenta); 74 74 case KMachineState_Teleporting: return QColor(Qt::blue); 75 case KMachineState_Snapshotting: return QColor(Qt::green); 76 case KMachineState_OnlineSnapshotting: return QColor(Qt::green); 75 77 case KMachineState_LiveSnapshotting: return QColor(Qt::green); 76 78 case KMachineState_Starting: return QColor(Qt::green); … … 108 110 case KMachineState_Stuck: return UIIconPool::iconSet(":/state_stuck_16px.png"); 109 111 case KMachineState_Teleporting: return UIIconPool::iconSet(":/state_running_16px.png"); 112 case KMachineState_Snapshotting: return UIIconPool::iconSet(":/state_saving_16px.png"); 113 case KMachineState_OnlineSnapshotting: return UIIconPool::iconSet(":/state_running_16px.png"); 110 114 case KMachineState_LiveSnapshotting: return UIIconPool::iconSet(":/state_running_16px.png"); 111 115 case KMachineState_Starting: return UIIconPool::iconSet(":/state_running_16px.png"); … … 143 147 case KMachineState_Stuck: return QApplication::translate("VBoxGlobal", "Guru Meditation", "MachineState"); 144 148 case KMachineState_Teleporting: return QApplication::translate("VBoxGlobal", "Teleporting", "MachineState"); 149 case KMachineState_Snapshotting: return QApplication::translate("VBoxGlobal", "Taking Snapshot", "MachineState"); 150 case KMachineState_OnlineSnapshotting: return QApplication::translate("VBoxGlobal", "Taking Online Snapshot", "MachineState"); 145 151 case KMachineState_LiveSnapshotting: return QApplication::translate("VBoxGlobal", "Taking Live Snapshot", "MachineState"); 146 152 case KMachineState_Starting: return QApplication::translate("VBoxGlobal", "Starting", "MachineState"); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r55115 r55214 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 766 766 } 767 767 768 void UIMessageCenter::cannotDiscardSavedState(const C Console &console) const768 void UIMessageCenter::cannotDiscardSavedState(const CMachine &machine) const 769 769 { 770 770 error(0, MessageType_Error, 771 771 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.") 772 .arg( CConsole(console).GetMachine().GetName()),773 formatErrorInfo( console));774 } 775 776 void UIMessageCenter::cannotSaveMachineState(const C Console &console)772 .arg(machine.GetName()), 773 formatErrorInfo(machine)); 774 } 775 776 void UIMessageCenter::cannotSaveMachineState(const CMachine &machine) 777 777 { 778 778 error(0, MessageType_Error, 779 779 tr("Failed to save the state of the virtual machine <b>%1</b>.") 780 .arg( CConsole(console).GetMachine().GetName()),781 formatErrorInfo( console));780 .arg(machine.GetName()), 781 formatErrorInfo(machine)); 782 782 } 783 783 … … 866 866 } 867 867 868 void UIMessageCenter::cannotTakeSnapshot(const C Console &console, const QString &strMachineName, QWidget *pParent /* = 0*/) const868 void UIMessageCenter::cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent /* = 0*/) const 869 869 { 870 870 error(pParent, MessageType_Error, 871 871 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 872 872 .arg(strMachineName), 873 formatErrorInfo( console));873 formatErrorInfo(machine)); 874 874 } 875 875 … … 882 882 } 883 883 884 bool UIMessageCenter::cannotRestoreSnapshot(const C Console &console, const QString &strSnapshotName, const QString &strMachineName) const884 bool UIMessageCenter::cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const 885 885 { 886 886 error(0, MessageType_Error, 887 887 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 888 888 .arg(strSnapshotName, strMachineName), 889 formatErrorInfo( console));889 formatErrorInfo(machine)); 890 890 return false; 891 891 } … … 900 900 } 901 901 902 void UIMessageCenter::cannotRemoveSnapshot(const C Console &console, const QString &strSnapshotName, const QString &strMachineName) const902 void UIMessageCenter::cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const 903 903 { 904 904 error(0, MessageType_Error, 905 905 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 906 906 .arg(strSnapshotName, strMachineName), 907 formatErrorInfo( console));907 formatErrorInfo(machine)); 908 908 } 909 909 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r54937 r55214 4 4 5 5 /* 6 * Copyright (C) 2006-201 3Oracle Corporation6 * Copyright (C) 2006-2014 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 191 191 void cannotPauseMachine(const CConsole &console) const; 192 192 void cannotResumeMachine(const CConsole &console) const; 193 void cannotDiscardSavedState(const C Console &console) const;194 void cannotSaveMachineState(const C Console &console);193 void cannotDiscardSavedState(const CMachine &machine) const; 194 void cannotSaveMachineState(const CMachine &machine); 195 195 void cannotSaveMachineState(const CProgress &progress, const QString &strMachineName); 196 196 void cannotACPIShutdownMachine(const CConsole &console) const; … … 203 203 bool warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, const QString &strTargetImageName, 204 204 const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree) const; 205 void cannotTakeSnapshot(const C Console &console, const QString &strMachineName, QWidget *pParent = 0) const;205 void cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent = 0) const; 206 206 void cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const; 207 bool cannotRestoreSnapshot(const C Console &console, const QString &strSnapshotName, const QString &strMachineName) const;207 bool cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const; 208 208 bool cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const; 209 void cannotRemoveSnapshot(const C Console &console, const QString &strSnapshotName, const QString &strMachineName) const;209 void cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const; 210 210 void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const; 211 211 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r53046 r55214 62 62 CSnapshot snapshot = machine.GetCurrentSnapshot(); 63 63 64 /* Open corresponding console: */65 CConsole console = session.GetConsole();66 64 /* Prepare restore-snapshot progress: */ 67 CProgress progress = console.RestoreSnapshot(snapshot);68 if (! console.isOk())69 return msgCenter().cannotRestoreSnapshot( console, snapshot.GetName(), machine.GetName());65 CProgress progress = machine.RestoreSnapshot(snapshot); 66 if (!machine.isOk()) 67 return msgCenter().cannotRestoreSnapshot(machine, snapshot.GetName(), machine.GetName()); 70 68 71 69 /* Show the snapshot-discarding progress: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r55170 r55214 1391 1391 return; 1392 1392 1393 /* Remember the paused state: */1394 bool fWasPaused = uisession()->isPaused();1395 if (!fWasPaused)1396 {1397 /* Suspend the VM and ignore the close event if failed to do so.1398 * pause() will show the error message to the user. */1399 if (!uisession()->pause())1400 return;1401 }1402 1403 1393 /* Create take-snapshot dialog: */ 1404 1394 QWidget *pDlgParent = windowManager().realParentWindow(activeMachineWindow()); … … 1433 1423 { 1434 1424 /* Prepare the take-snapshot progress: */ 1435 CProgress progress = console().TakeSnapshot(strSnapshotName, strSnapshotDescription);1436 if ( console().isOk())1425 CProgress progress = machine().TakeSnapshot(strSnapshotName, strSnapshotDescription, true); 1426 if (machine().isOk()) 1437 1427 { 1438 1428 /* Show the take-snapshot progress: */ … … 1442 1432 } 1443 1433 else 1444 msgCenter().cannotTakeSnapshot(console(), machineName()); 1445 } 1446 1447 /* Restore the running state if needed: */ 1448 if (!fWasPaused) 1449 { 1450 /* Make sure machine-state-change callback is processed: */ 1451 QApplication::sendPostedEvents(uisession(), UIConsoleEventType_StateChange); 1452 /* Unpause VM: */ 1453 uisession()->unpause(); 1434 msgCenter().cannotTakeSnapshot(machine(), machineName()); 1454 1435 } 1455 1436 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r55155 r55214 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 300 300 { 301 301 /* Prepare the saving progress: */ 302 CProgress progress = console().SaveState();303 if ( console().isOk())302 CProgress progress = machine().SaveState(); 303 if (machine().isOk()) 304 304 { 305 305 /* Show the saving progress: */ … … 315 315 { 316 316 /* Failed in console: */ 317 msgCenter().cannotSaveMachineState( console());317 msgCenter().cannotSaveMachineState(machine()); 318 318 return false; 319 319 } … … 408 408 do 409 409 { 410 /* Acquire console for this session: */411 C Console cons = sess.GetConsole();412 if ( cons.isNull())410 /* Acquire machine for this session: */ 411 CMachine machine = sess.GetMachine(); 412 if (machine.isNull()) 413 413 { 414 /* Unable to acquire console: */414 /* Unable to acquire machine: */ 415 415 break; 416 416 } 417 417 418 418 /* Prepare the snapshot-discard progress: */ 419 const CSnapshot snap = mach .GetCurrentSnapshot();420 CProgress prog = cons.RestoreSnapshot(snap);421 if (! cons.isOk() || prog.isNull())419 const CSnapshot snap = machine.GetCurrentSnapshot(); 420 CProgress prog = machine.RestoreSnapshot(snap); 421 if (!machine.isOk() || prog.isNull()) 422 422 { 423 423 /* Unable to restore snapshot: */ 424 msgCenter().cannotRestoreSnapshot( cons, snap.GetName(), machineName());424 msgCenter().cannotRestoreSnapshot(machine, snap.GetName(), machineName()); 425 425 break; 426 426 } 427 427 428 428 /* Show the snapshot-discard progress: */ 429 msgCenter().showModalProgressDialog(prog, mach .GetName(), ":/progress_snapshot_discard_90px.png");429 msgCenter().showModalProgressDialog(prog, machine.GetName(), ":/progress_snapshot_discard_90px.png"); 430 430 if (prog.GetResultCode() != 0) 431 431 { 432 432 /* Unable to restore snapshot: */ 433 msgCenter().cannotRestoreSnapshot(prog, snap.GetName(), mach .GetName());433 msgCenter().cannotRestoreSnapshot(prog, snap.GetName(), machine.GetName()); 434 434 break; 435 435 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r55170 r55214 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 498 498 return; 499 499 500 /* Get session console: */501 C Console console = session.GetConsole();502 console.DiscardSavedState(true);503 if (! console.isOk())504 msgCenter().cannotDiscardSavedState( console);500 /* Get session machine: */ 501 CMachine machine = session.GetMachine(); 502 machine.DiscardSavedState(true); 503 if (!machine.isOk()) 504 msgCenter().cannotDiscardSavedState(machine); 505 505 506 506 /* Unlock machine finally: */ … … 623 623 /* Get session console: */ 624 624 CConsole console = session.GetConsole(); 625 /* Get session machine: */ 626 CMachine machine = session.GetMachine(); 625 627 /* Pause VM first: */ 626 628 console.Pause(); … … 628 630 { 629 631 /* Prepare machine state saving: */ 630 CProgress progress = console.SaveState();631 if ( console.isOk())632 CProgress progress = machine.SaveState(); 633 if (machine.isOk()) 632 634 { 633 635 /* Show machine state saving progress: */ 634 CMachine machine = session.GetMachine();635 636 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_state_save_90px.png"); 636 637 if (!progress.isOk() || progress.GetResultCode() != 0) … … 638 639 } 639 640 else 640 msgCenter().cannotSaveMachineState( console);641 msgCenter().cannotSaveMachineState(machine); 641 642 } 642 643 else -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
r54774 r55214 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 641 641 642 642 /* Restore chosen snapshot: */ 643 C Console console = session.GetConsole();644 CProgress progress = console.RestoreSnapshot(snapshot);645 if ( console.isOk())643 CMachine machine = session.GetMachine(); 644 CProgress progress = machine.RestoreSnapshot(snapshot); 645 if (machine.isOk()) 646 646 { 647 647 msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_restore_90px.png"); … … 650 650 } 651 651 else 652 msgCenter().cannotRestoreSnapshot( console, snapshot.GetName(), mMachine.GetName());652 msgCenter().cannotRestoreSnapshot(machine, snapshot.GetName(), mMachine.GetName()); 653 653 654 654 /* Unlock machine finally: */ … … 688 688 return; 689 689 690 CConsole console = session.GetConsole(); 691 CProgress progress = console.DeleteSnapshot (snapId); 692 if (console.isOk()) 690 /* Remove chosen snapshot: */ 691 CMachine machine = session.GetMachine(); 692 CProgress progress = machine.DeleteSnapshot(snapId); 693 if (machine.isOk()) 693 694 { 694 695 /* Show the progress dialog */ … … 699 700 } 700 701 else 701 msgCenter().cannotRemoveSnapshot( console, snapshot.GetName(), mMachine.GetName());702 msgCenter().cannotRemoveSnapshot(machine, snapshot.GetName(), mMachine.GetName()); 702 703 703 704 session.UnlockMachine(); … … 829 830 if (fIsValid) 830 831 { 831 /* Get corresponding console object also: */ 832 CConsole console = session.GetConsole(); 833 /* Remember runtime state: */ 834 bool fAtRuntime = mMachine.GetState() == KMachineState_Running; 835 /* Remember paused state: */ 836 bool fWasPaused = mMachine.GetState() == KMachineState_Paused || 837 mMachine.GetState() == KMachineState_TeleportingPausedVM; 838 839 /* Pause VM if necessary: */ 840 if (fIsValid && fAtRuntime && !fWasPaused) 841 { 842 /* Pausing VM: */ 843 console.Pause(); 844 if (!console.isOk()) 832 /* Get corresponding machine object also: */ 833 CMachine machine = session.GetMachine(); 834 835 /* Create take-snapshot dialog: */ 836 QWidget *pDlgParent = windowManager().realParentWindow(this); 837 QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, mMachine); 838 windowManager().registerNewParent(pDlg, pDlgParent); 839 840 /* Assign corresponding icon: */ 841 pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(mMachine.GetOSTypeId())); 842 843 /* Search for the max available snapshot index: */ 844 int iMaxSnapShotIndex = 0; 845 QString snapShotName = tr("Snapshot %1"); 846 QRegExp regExp(QString("^") + snapShotName.arg("([0-9]+)") + QString("$")); 847 QTreeWidgetItemIterator iterator(mTreeWidget); 848 while (*iterator) 849 { 850 QString snapShot = static_cast<SnapshotWgtItem*>(*iterator)->text(0); 851 int pos = regExp.indexIn(snapShot); 852 if (pos != -1) 853 iMaxSnapShotIndex = regExp.cap(1).toInt() > iMaxSnapShotIndex ? regExp.cap(1).toInt() : iMaxSnapShotIndex; 854 ++iterator; 855 } 856 pDlg->mLeName->setText(snapShotName.arg(iMaxSnapShotIndex + 1)); 857 858 /* Exec the dialog: */ 859 bool fDialogAccepted = pDlg->exec() == QDialog::Accepted; 860 861 /* Is the dialog still valid? */ 862 if (pDlg) 863 { 864 /* Acquire variables: */ 865 QString strSnapshotName = pDlg->mLeName->text().trimmed(); 866 QString strSnapshotDescription = pDlg->mTeDescription->toPlainText(); 867 868 /* Destroy dialog early: */ 869 delete pDlg; 870 871 /* Was the dialog accepted? */ 872 if (fDialogAccepted) 845 873 { 846 msgCenter().cannotPauseMachine(console); 847 fIsValid = false; 848 } 849 } 850 851 if (fIsValid) 852 { 853 /* Create take-snapshot dialog: */ 854 QWidget *pDlgParent = windowManager().realParentWindow(this); 855 QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, mMachine); 856 windowManager().registerNewParent(pDlg, pDlgParent); 857 858 /* Assign corresponding icon: */ 859 pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(mMachine.GetOSTypeId())); 860 861 /* Search for the max available snapshot index: */ 862 int iMaxSnapShotIndex = 0; 863 QString snapShotName = tr("Snapshot %1"); 864 QRegExp regExp(QString("^") + snapShotName.arg("([0-9]+)") + QString("$")); 865 QTreeWidgetItemIterator iterator(mTreeWidget); 866 while (*iterator) 867 { 868 QString snapShot = static_cast<SnapshotWgtItem*>(*iterator)->text(0); 869 int pos = regExp.indexIn(snapShot); 870 if (pos != -1) 871 iMaxSnapShotIndex = regExp.cap(1).toInt() > iMaxSnapShotIndex ? regExp.cap(1).toInt() : iMaxSnapShotIndex; 872 ++iterator; 873 } 874 pDlg->mLeName->setText(snapShotName.arg(iMaxSnapShotIndex + 1)); 875 876 /* Exec the dialog: */ 877 bool fDialogAccepted = pDlg->exec() == QDialog::Accepted; 878 879 /* Is the dialog still valid? */ 880 if (pDlg) 881 { 882 /* Acquire variables: */ 883 QString strSnapshotName = pDlg->mLeName->text().trimmed(); 884 QString strSnapshotDescription = pDlg->mTeDescription->toPlainText(); 885 886 /* Destroy dialog early: */ 887 delete pDlg; 888 889 /* Was the dialog accepted? */ 890 if (fDialogAccepted) 874 /* Prepare the take-snapshot progress: */ 875 CProgress progress = machine.TakeSnapshot(strSnapshotName, strSnapshotDescription, true); 876 if (machine.isOk()) 891 877 { 892 /* Preparethe take-snapshot progress: */893 CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription);894 if ( console.isOk())878 /* Show the take-snapshot progress: */ 879 msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_create_90px.png"); 880 if (!progress.isOk() || progress.GetResultCode() != 0) 895 881 { 896 /* Show the take-snapshot progress: */ 897 msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_create_90px.png"); 898 if (!progress.isOk() || progress.GetResultCode() != 0) 899 { 900 msgCenter().cannotTakeSnapshot(progress, mMachine.GetName()); 901 fIsValid = false; 902 } 903 } 904 else 905 { 906 msgCenter().cannotTakeSnapshot(console, mMachine.GetName()); 882 msgCenter().cannotTakeSnapshot(progress, mMachine.GetName()); 907 883 fIsValid = false; 908 884 } 909 885 } 910 886 else 887 { 888 msgCenter().cannotTakeSnapshot(machine, mMachine.GetName()); 911 889 fIsValid = false; 890 } 912 891 } 913 892 else 914 893 fIsValid = false; 915 894 } 916 917 /* Resume VM if necessary: */ 918 if (fIsValid && fAtRuntime && !fWasPaused) 919 { 920 /* Resuming VM: */ 921 console.Resume(); 922 if (!console.isOk()) 923 { 924 msgCenter().cannotResumeMachine(console); 925 fIsValid = false; 926 } 927 } 895 else 896 fIsValid = false; 928 897 929 898 /* Unlock machine finally: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
r52730 r55214 5 5 6 6 /* 7 * Copyright (C) 2011-201 3Oracle Corporation7 * Copyright (C) 2011-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 79 79 return false; 80 80 81 /* Prepare console: */82 C Console console = session.GetConsole();81 /* Prepare machine: */ 82 CMachine machine = session.GetMachine(); 83 83 84 84 /* Take the snapshot: */ 85 85 QString strSnapshotName = tr("Linked Base for %1 and %2").arg(m_machine.GetName()).arg(strName); 86 CProgress progress = console.TakeSnapshot(strSnapshotName, "");87 88 if ( console.isOk())86 CProgress progress = machine.TakeSnapshot(strSnapshotName, "", true); 87 88 if (machine.isOk()) 89 89 { 90 90 /* Show the "Taking Snapshot" progress dialog: */ … … 99 99 else 100 100 { 101 msgCenter().cannotTakeSnapshot( console, m_machine.GetName(), this);101 msgCenter().cannotTakeSnapshot(machine, m_machine.GetName(), this); 102 102 return false; 103 103 }
Note:
See TracChangeset
for help on using the changeset viewer.