本文整理汇总了C++中CConsole::DeleteSnapshot方法的典型用法代码示例。如果您正苦于以下问题:C++ CConsole::DeleteSnapshot方法的具体用法?C++ CConsole::DeleteSnapshot怎么用?C++ CConsole::DeleteSnapshot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConsole
的用法示例。
在下文中一共展示了CConsole::DeleteSnapshot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sltDeleteSnapshot
void VBoxSnapshotsWgt::sltDeleteSnapshot()
{
SnapshotWgtItem *item = !mTreeWidget->currentItem() ? 0 :
static_cast <SnapshotWgtItem*> (mTreeWidget->currentItem());
AssertReturn (item, (void) 0);
QString snapId = item->snapshotId();
AssertReturn (!snapId.isNull(), (void) 0);
CSnapshot snapshot = mMachine.FindSnapshot(snapId);
if (!msgCenter().confirmSnapshotRemoval(snapshot.GetName()))
return;
/** @todo check available space on the target filesystem etc etc. */
#if 0
if (!msgCenter().warnAboutSnapshotRemovalFreeSpace(snapshot.GetName(),
"/home/juser/.VirtualBox/Machines/SampleVM/Snapshots/{01020304-0102-0102-0102-010203040506}.vdi",
"59 GiB",
"15 GiB"))
return;
#endif
/* Open a direct session (this call will handle all errors) */
bool busy = mSessionState != KSessionState_Unlocked;
CSession session;
if (busy)
session = vboxGlobal().openExistingSession(mMachineId);
else
session = vboxGlobal().openSession(mMachineId);
if (session.isNull())
return;
CConsole console = session.GetConsole();
CProgress progress = console.DeleteSnapshot (snapId);
if (console.isOk())
{
/* Show the progress dialog */
msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_discard_90px.png");
if (progress.GetResultCode() != 0)
msgCenter().cannotRemoveSnapshot(progress, snapshot.GetName(), mMachine.GetName());
}
else
msgCenter().cannotRemoveSnapshot(console, snapshot.GetName(), mMachine.GetName());
session.UnlockMachine();
}