8d8dfc00d014a62894327907a04f148b00a08529vboxsync/* $Id$ */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync/** @file
ca87590cb28f22bccab88dc2f87c5ce2682b1ba1vboxsync * VBox Qt GUI - UIWizardNewVMPageExpert class implementation.
8d8dfc00d014a62894327907a04f148b00a08529vboxsync */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync/*
ec36440940ba71033f9d8853bb1ba3758f34d8e2vboxsync * Copyright (C) 2006-2013 Oracle Corporation
8d8dfc00d014a62894327907a04f148b00a08529vboxsync *
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * available from http://www.virtualbox.org. This file is free software;
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * you can redistribute it and/or modify it under the terms of the GNU
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * General Public License (GPL) as published by the Free Software
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8d8dfc00d014a62894327907a04f148b00a08529vboxsync */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync#ifdef VBOX_WITH_PRECOMPILED_HEADERS
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <precomp.h>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync/* Global includes: */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QVBoxLayout>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QHBoxLayout>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QGroupBox>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QGridLayout>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QSpacerItem>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QLineEdit>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QLabel>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QSpinBox>
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include <QRadioButton>
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync/* Local includes: */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIWizardNewVMPageExpert.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIWizardNewVM.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIIconPool.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UINameAndSystemEditor.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "VBoxGuestRAMSlider.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "VBoxMediaComboBox.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "QIToolButton.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync# include "UIMedium.h"
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
a9b62afc62b28da7a1a77f34259f8013892d9664vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
1f37cfc44ea630e28fd964240a80b6255ed6d64dvboxsyncUIWizardNewVMPageExpert::UIWizardNewVMPageExpert(const QString &strGroup)
1f37cfc44ea630e28fd964240a80b6255ed6d64dvboxsync : UIWizardNewVMPage1(strGroup)
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Create widgets: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync QVBoxLayout *pMainLayout = new QVBoxLayout(this);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync pMainLayout->setContentsMargins(8, 6, 8, 6);
ec36440940ba71033f9d8853bb1ba3758f34d8e2vboxsync pMainLayout->setSpacing(10);
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync m_pNameAndSystemCnt = new QGroupBox(this);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync m_pNameAndSystemCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync QHBoxLayout *pNameAndSystemCntLayout = new QHBoxLayout(m_pNameAndSystemCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync m_pNameAndSystemEditor = new UINameAndSystemEditor(m_pNameAndSystemCnt);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pNameAndSystemCntLayout->addWidget(m_pNameAndSystemEditor);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pMemoryCnt = new QGroupBox(this);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pMemoryCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync QGridLayout *pMemoryCntLayout = new QGridLayout(m_pMemoryCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamSlider = new VBoxGuestRAMSlider(m_pMemoryCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamSlider->setOrientation(Qt::Horizontal);
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync m_pRamSlider->setValue(m_pNameAndSystemEditor->type().GetRecommendedRAM());
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync m_pRamEditor = new QSpinBox(m_pMemoryCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync m_pRamEditor->setMinimum(m_pRamSlider->minRAM());
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync m_pRamEditor->setMaximum(m_pRamSlider->maxRAM());
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pRamEditor, 5);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamUnits = new QLabel(m_pMemoryCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamUnits->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamMin = new QLabel(m_pMemoryCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamMin->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamMax = new QLabel(m_pMemoryCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamMax->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pMemoryCntLayout->addWidget(m_pRamSlider, 0, 0, 1, 3);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pMemoryCntLayout->addWidget(m_pRamEditor, 0, 3);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pMemoryCntLayout->addWidget(m_pRamUnits, 0, 4);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pMemoryCntLayout->addWidget(m_pRamMin, 1, 0);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pMemoryCntLayout->setColumnStretch(1, 1);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pMemoryCntLayout->addWidget(m_pRamMax, 1, 2);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pDiskCnt = new QGroupBox(this);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pDiskCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync QGridLayout *pDiskCntLayout = new QGridLayout(m_pDiskCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
5d74c7672f6c2d1f2ab95efcb6713e97ca361113vboxsync m_pDiskSkip = new QRadioButton(m_pDiskCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pDiskCreate = new QRadioButton(m_pDiskCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pDiskCreate->setChecked(true);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pDiskPresent = new QRadioButton(m_pDiskCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync QStyleOptionButton options;
5d74c7672f6c2d1f2ab95efcb6713e97ca361113vboxsync options.initFrom(m_pDiskPresent);
5d74c7672f6c2d1f2ab95efcb6713e97ca361113vboxsync int iWidth = m_pDiskPresent->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, &options, m_pDiskPresent);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pDiskCntLayout->setColumnMinimumWidth(0, iWidth);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pDiskSelector = new VBoxMediaComboBox(m_pDiskCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
4d5a2d10140117cca0a93d7e1b4d71304701d6e1vboxsync m_pDiskSelector->setType(UIMediumType_HardDisk);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pDiskSelector->repopulate();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pVMMButton = new QIToolButton(m_pDiskCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pVMMButton->setAutoRaise(true);
17c97778b6d189200ba110f10f016b3d973c5595vboxsync m_pVMMButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", ":/select_file_disabled_16px.png"));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pDiskCntLayout->addWidget(m_pDiskSkip, 0, 0, 1, 3);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pDiskCntLayout->addWidget(m_pDiskCreate, 1, 0, 1, 3);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pDiskCntLayout->addWidget(m_pDiskPresent, 2, 0, 1, 3);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pDiskCntLayout->addWidget(m_pDiskSelector, 3, 1);
8217a57ae45881066a43752d7ab6ba5d9c2d1d38vboxsync pDiskCntLayout->addWidget(m_pVMMButton, 3, 2);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync pMainLayout->addWidget(m_pNameAndSystemCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync pMainLayout->addWidget(m_pMemoryCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync pMainLayout->addWidget(m_pDiskCnt);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync pMainLayout->addStretch();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync updateVirtualDiskSource();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Setup connections: */
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)), this, SLOT(sltNameChanged(const QString &)));
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(sltOsTypeChanged()));
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync connect(m_pRamSlider, SIGNAL(valueChanged(int)), this, SLOT(sltRamSliderValueChanged()));
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync connect(m_pRamEditor, SIGNAL(valueChanged(int)), this, SLOT(sltRamEditorValueChanged()));
5d74c7672f6c2d1f2ab95efcb6713e97ca361113vboxsync connect(m_pDiskSkip, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync connect(m_pDiskCreate, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync connect(m_pDiskPresent, SIGNAL(toggled(bool)), this, SLOT(sltVirtualDiskSourceChanged()));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync connect(m_pDiskSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(sltVirtualDiskSourceChanged()));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync connect(m_pVMMButton, SIGNAL(clicked()), this, SLOT(sltGetWithFileOpenDialog()));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Register classes: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync qRegisterMetaType<CMedium>();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Register fields: */
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync registerField("name*", m_pNameAndSystemEditor, "name", SIGNAL(sigNameChanged(const QString &)));
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync registerField("type", m_pNameAndSystemEditor, "type", SIGNAL(sigOsTypeChanged()));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync registerField("machineFolder", this, "machineFolder");
8d8dfc00d014a62894327907a04f148b00a08529vboxsync registerField("machineBaseName", this, "machineBaseName");
8d8dfc00d014a62894327907a04f148b00a08529vboxsync registerField("ram", m_pRamSlider, "value", SIGNAL(valueChanged(int)));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync registerField("virtualDisk", this, "virtualDisk");
8d8dfc00d014a62894327907a04f148b00a08529vboxsync registerField("virtualDiskId", this, "virtualDiskId");
8d8dfc00d014a62894327907a04f148b00a08529vboxsync registerField("virtualDiskLocation", this, "virtualDiskLocation");
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncvoid UIWizardNewVMPageExpert::sltNameChanged(const QString &strNewText)
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Call to base-class: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync onNameChanged(strNewText);
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Fetch recommended RAM value: */
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync CGuestOSType type = m_pNameAndSystemEditor->type();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamSlider->setValue(type.GetRecommendedRAM());
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync m_pRamEditor->setValue(type.GetRecommendedRAM());
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Broadcast complete-change: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync emit completeChanged();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncvoid UIWizardNewVMPageExpert::sltOsTypeChanged()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Call to base-class: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync onOsTypeChanged();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Fetch recommended RAM value: */
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync CGuestOSType type = m_pNameAndSystemEditor->type();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamSlider->setValue(type.GetRecommendedRAM());
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync m_pRamEditor->setValue(type.GetRecommendedRAM());
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Broadcast complete-change: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync emit completeChanged();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsyncvoid UIWizardNewVMPageExpert::sltRamSliderValueChanged()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Call to base-class: */
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync onRamSliderValueChanged();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Broadcast complete-change: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync emit completeChanged();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsyncvoid UIWizardNewVMPageExpert::sltRamEditorValueChanged()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Call to base-class: */
c6d3207fc42ec44a5c8256687f406bf2f20bc33evboxsync onRamEditorValueChanged();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Broadcast complete-change: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync emit completeChanged();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncvoid UIWizardNewVMPageExpert::sltVirtualDiskSourceChanged()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Call to base-class: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync updateVirtualDiskSource();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Broadcast complete-change: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync emit completeChanged();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncvoid UIWizardNewVMPageExpert::sltGetWithFileOpenDialog()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Call to base-class: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync getWithFileOpenDialog();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncvoid UIWizardNewVMPageExpert::retranslateUi()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Translate widgets: */
6e9130e5552f77fc3e844b0d6f12332a1f1003bcvboxsync m_pNameAndSystemCnt->setTitle(UIWizardNewVM::tr("Name and operating system"));
9ab0743fd2e00994c4657ca9e67ab5dafa78e1afvboxsync m_pMemoryCnt->setTitle(UIWizardNewVM::tr("&Memory size"));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamUnits->setText(VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes"));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamMin->setText(QString("%1 %2").arg(m_pRamSlider->minRAM()).arg(VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes")));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync m_pRamMax->setText(QString("%1 %2").arg(m_pRamSlider->maxRAM()).arg(VBoxGlobal::tr("MB", "size suffix MBytes=1024 KBytes")));
5d74c7672f6c2d1f2ab95efcb6713e97ca361113vboxsync m_pDiskCnt->setTitle(UIWizardNewVM::tr("Hard drive"));
a3d33059b39a600e1e4595dc37b58104840f0910vboxsync m_pDiskSkip->setText(UIWizardNewVM::tr("&Do not add a virtual hard drive"));
a3d33059b39a600e1e4595dc37b58104840f0910vboxsync m_pDiskCreate->setText(UIWizardNewVM::tr("&Create a virtual hard drive now"));
a3d33059b39a600e1e4595dc37b58104840f0910vboxsync m_pDiskPresent->setText(UIWizardNewVM::tr("&Use an existing virtual hard drive file"));
9ab0743fd2e00994c4657ca9e67ab5dafa78e1afvboxsync m_pVMMButton->setToolTip(UIWizardNewVM::tr("Choose a virtual hard drive file..."));
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncvoid UIWizardNewVMPageExpert::initializePage()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Translate page: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync retranslateUi();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncvoid UIWizardNewVMPageExpert::cleanupPage()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Call to base-class: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync ensureNewVirtualDiskDeleted();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync cleanupMachineFolder();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncbool UIWizardNewVMPageExpert::isComplete() const
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Make sure mandatory fields are complete,
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * 'ram' field feats the bounds,
8d8dfc00d014a62894327907a04f148b00a08529vboxsync * 'virtualDisk' field feats the rules: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync return UIWizardPage::isComplete() &&
8d8dfc00d014a62894327907a04f148b00a08529vboxsync (m_pRamSlider->value() >= qMax(1, (int)m_pRamSlider->minRAM()) && m_pRamSlider->value() <= (int)m_pRamSlider->maxRAM()) &&
c371a0f6f78033721d8faa94fec7a8b2792fe165vboxsync (m_pDiskSkip->isChecked() || !m_pDiskPresent->isChecked() || !vboxGlobal().medium(m_pDiskSelector->id()).isNull());
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsyncbool UIWizardNewVMPageExpert::validatePage()
8d8dfc00d014a62894327907a04f148b00a08529vboxsync{
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Initial result: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync bool fResult = true;
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Lock finish button: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync startProcessing();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Try to create machine folder: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync if (fResult)
8d8dfc00d014a62894327907a04f148b00a08529vboxsync fResult = createMachineFolder();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Try to assign boot virtual-disk: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync if (fResult)
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Ensure there is no virtual-disk created yet: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync Assert(m_virtualDisk.isNull());
8d8dfc00d014a62894327907a04f148b00a08529vboxsync if (fResult)
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
5d74c7672f6c2d1f2ab95efcb6713e97ca361113vboxsync if (m_pDiskCreate->isChecked())
8d8dfc00d014a62894327907a04f148b00a08529vboxsync {
9ab0743fd2e00994c4657ca9e67ab5dafa78e1afvboxsync /* Show the New Virtual Hard Drive wizard if necessary: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync fResult = getWithNewVirtualDiskWizard();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync }
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Try to create VM: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync if (fResult)
8d8dfc00d014a62894327907a04f148b00a08529vboxsync fResult = qobject_cast<UIWizardNewVM*>(wizard())->createVM();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Unlock finish button: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync endProcessing();
8d8dfc00d014a62894327907a04f148b00a08529vboxsync
8d8dfc00d014a62894327907a04f148b00a08529vboxsync /* Return result: */
8d8dfc00d014a62894327907a04f148b00a08529vboxsync return fResult;
8d8dfc00d014a62894327907a04f148b00a08529vboxsync}
8d8dfc00d014a62894327907a04f148b00a08529vboxsync