UIWizardNewVMPageExpert.cpp revision c371a0f6f78033721d8faa94fec7a8b2792fe165
/* $Id$ */
/** @file
*
* VBox frontends: Qt4 GUI ("VirtualBox"):
* UIWizardNewVMPageExpert class implementation
*/
/*
* Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/* Global includes: */
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGroupBox>
#include <QGridLayout>
#include <QSpacerItem>
#include <QLineEdit>
#include <QLabel>
#include <QSpinBox>
#include <QRadioButton>
/* Local includes: */
#include "UIWizardNewVMPageExpert.h"
#include "UIWizardNewVM.h"
#include "UIIconPool.h"
#include "UINameAndSystemEditor.h"
#include "VBoxGuestRAMSlider.h"
#include "VBoxMediaComboBox.h"
#include "QIToolButton.h"
{
/* Create widgets: */
{
m_pNameAndSystemCnt = new QGroupBox(this);
{
{
}
}
m_pMemoryCnt = new QGroupBox(this);
{
{
{
}
{
}
{
}
{
}
{
}
}
}
m_pDiskCnt = new QGroupBox(this);
{
{
{
m_pDiskCreate->setChecked(true);
}
int iWidth = m_pDiskPresent->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, &options, m_pDiskPresent);
{
}
{
m_pVMMButton->setAutoRaise(true);
m_pVMMButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", ":/select_file_disabled_16px.png"));
}
}
}
}
/* Setup connections: */
connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltNameChanged(const QString &)));
connect(m_pDiskSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(sltVirtualDiskSourceChanged()));
/* Register classes: */
/* Register fields: */
}
{
/* Call to base-class: */
/* Fetch recommended RAM value: */
/* Broadcast complete-change: */
}
{
/* Call to base-class: */
/* Fetch recommended RAM value: */
/* Broadcast complete-change: */
}
{
/* Call to base-class: */
/* Broadcast complete-change: */
}
{
/* Call to base-class: */
/* Broadcast complete-change: */
}
{
/* Call to base-class: */
/* Broadcast complete-change: */
}
{
/* Call to base-class: */
}
void UIWizardNewVMPageExpert::retranslateUi()
{
/* Translate widgets: */
m_pRamMin->setText(QString("%1 %2").arg(m_pRamSlider->minRAM()).arg(VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes")));
m_pRamMax->setText(QString("%1 %2").arg(m_pRamSlider->maxRAM()).arg(VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes")));
}
{
/* Translate page: */
}
void UIWizardNewVMPageExpert::cleanupPage()
{
/* Call to base-class: */
}
bool UIWizardNewVMPageExpert::isComplete() const
{
/* Make sure mandatory fields are complete,
* 'ram' field feats the bounds,
* 'virtualDisk' field feats the rules: */
return UIWizardPage::isComplete() &&
(m_pRamSlider->value() >= qMax(1, (int)m_pRamSlider->minRAM()) && m_pRamSlider->value() <= (int)m_pRamSlider->maxRAM()) &&
(m_pDiskSkip->isChecked() || !m_pDiskPresent->isChecked() || !vboxGlobal().medium(m_pDiskSelector->id()).isNull());
}
bool UIWizardNewVMPageExpert::validatePage()
{
/* Initial result: */
bool fResult = true;
/* Lock finish button: */
/* Try to create machine folder: */
if (fResult)
/* Try to assign boot virtual-disk: */
if (fResult)
{
/* Ensure there is no virtual-disk created yet: */
if (fResult)
{
if (m_pDiskCreate->isChecked())
{
/* Show the New Virtual Hard Drive wizard if necessary: */
}
}
}
/* Try to create VM: */
if (fResult)
/* Unlock finish button: */
/* Return result: */
return fResult;
}