本文整理汇总了C++中CConsole::Resume方法的典型用法代码示例。如果您正苦于以下问题:C++ CConsole::Resume方法的具体用法?C++ CConsole::Resume怎么用?C++ CConsole::Resume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConsole
的用法示例。
在下文中一共展示了CConsole::Resume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: takeSnapshot
//.........这里部分代码省略.........
bool fWasPaused = mMachine.GetState() == KMachineState_Paused ||
mMachine.GetState() == KMachineState_TeleportingPausedVM;
/* Pause VM if necessary: */
if (fIsValid && fAtRuntime && !fWasPaused)
{
/* Pausing VM: */
console.Pause();
if (!console.isOk())
{
msgCenter().cannotPauseMachine(console);
fIsValid = false;
}
}
if (fIsValid)
{
/* Create take-snapshot dialog: */
QWidget *pDlgParent = windowManager().realParentWindow(this);
QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, mMachine);
windowManager().registerNewParent(pDlg, pDlgParent);
/* Assign corresponding icon: */
pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(mMachine.GetOSTypeId()));
/* Search for the max available snapshot index: */
int iMaxSnapShotIndex = 0;
QString snapShotName = tr("Snapshot %1");
QRegExp regExp(QString("^") + snapShotName.arg("([0-9]+)") + QString("$"));
QTreeWidgetItemIterator iterator(mTreeWidget);
while (*iterator)
{
QString snapShot = static_cast<SnapshotWgtItem*>(*iterator)->text(0);
int pos = regExp.indexIn(snapShot);
if (pos != -1)
iMaxSnapShotIndex = regExp.cap(1).toInt() > iMaxSnapShotIndex ? regExp.cap(1).toInt() : iMaxSnapShotIndex;
++iterator;
}
pDlg->mLeName->setText(snapShotName.arg(iMaxSnapShotIndex + 1));
/* Exec the dialog: */
bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;
/* Is the dialog still valid? */
if (pDlg)
{
/* Acquire variables: */
QString strSnapshotName = pDlg->mLeName->text().trimmed();
QString strSnapshotDescription = pDlg->mTeDescription->toPlainText();
/* Destroy dialog early: */
delete pDlg;
/* Was the dialog accepted? */
if (fDialogAccepted)
{
/* Prepare the take-snapshot progress: */
CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription);
if (console.isOk())
{
/* Show the take-snapshot progress: */
msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_create_90px.png");
if (!progress.isOk() || progress.GetResultCode() != 0)
{
msgCenter().cannotTakeSnapshot(progress, mMachine.GetName());
fIsValid = false;
}
}
else
{
msgCenter().cannotTakeSnapshot(console, mMachine.GetName());
fIsValid = false;
}
}
else
fIsValid = false;
}
else
fIsValid = false;
}
/* Resume VM if necessary: */
if (fIsValid && fAtRuntime && !fWasPaused)
{
/* Resuming VM: */
console.Resume();
if (!console.isOk())
{
msgCenter().cannotResumeMachine(console);
fIsValid = false;
}
}
/* Unlock machine finally: */
session.UnlockMachine();
}
/* Return result: */
return fIsValid;
}