VBoxNewVMWzd.ui.h revision dcea3eadf1ecc8f4ac868185a05a63be42a199e4
/**
*
* VBox frontends: Qt GUI ("VirtualBox"):
* "New virtual machine" wizard UI include (Qt Designer)
*/
/*
* Copyright (C) 2006-2008 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
/**
* Calculates a suitable page step size for the given max value.
* The returned size is so that there will be no more than 32 pages.
* The minimum returned page size is 4.
*/
static int calcPageStep (int aMax)
{
/* reasonable max. number of page steps is 32 */
/* make it a power of 2 */
while ((p >>= 1))
p2 <<= 1;
p2 <<= 1;
if (p2 < 4)
p2 = 4;
return (int) p2;
}
void VBoxNewVMWzd::init()
{
/* disable help buttons */
helpButton()->setShown (false);
/*
* fix tab order to get the proper direction
*/
/*
* setup connections and set validation for pages
* ----------------------------------------------------------------------
*/
/* setup the label colors for nice scaling */
/* Name and OS page */
/* Memory page */
/* HDD Images page */
/* request to check media accessibility */
mHDCombo->repopulate();
/* Summary page */
/* filter out Enter keys in order to direct them to the default dlg button */
/*
* set initial values
* ----------------------------------------------------------------------
*/
/* Name and OS page */
/* Memory page */
/* setup the scale so that ticks are at page step boundaries */
/*
* initial RAM value is set in cbOS_activated()
*/
/* ensure leRAM value and validation is updated */
/* HDD Images page */
/* Summary page */
/*
* update the next button state for pages with validation
* (validityChanged() connected to enableNext() will do the job)
*/
wvalMemory->revalidate();
/* the finish button on the Summary page is always enabled */
setFinishEnabled (pageSummary, true);
/* setup minimum width for the sizeHint to be calculated correctly */
}
void VBoxNewVMWzd::destroy()
{
}
{
/* one may think that QWidget::polish() is the right place to do things
* below, but apparently, by the time when QWidget::polish() is called,
* the widget style & layout are not fully done, at least the minimum
* size hint is not properly calculated. Since this is sometimes necessary,
* we provide our own "polish" implementation. */
/* resize to the miminum possible size */
resize (minimumSize());
}
{
}
{
/* do individual validations for pages */
}
{
if (page == pageSummary)
{
if (!haveHardDisk)
{
return;
}
/* compose summary */
"<tr><td>Name:</td><td>%1</td></tr>"
"<tr><td>OS Type:</td><td>%2</td></tr>"
"<tr><td>Base Memory:</td><td>%3 MB</td></tr>"))
if (haveHardDisk)
"<tr><td>Boot Hard Disk:</td><td>%4</td></tr>"))
/* set Finish to default */
finishButton()->setDefault( true );
}
else
{
/* always set Next to default */
nextButton()->setDefault( true );
}
/* fix focus on the last page. when we go to the last page having the Next
* in focus the focus goes to the Cancel button because when the Next hides
Finish is not yet shown. */
finishButton()->setFocus();
/* setup focus for individual pages */
if (page == pageNameAndOS)
else if (page == pageMemory)
else if (page == pageSummary)
}
void VBoxNewVMWzd::accept()
{
/* Try to create the machine when the Finish button is pressed. On
* failure, the wizard will remain open to give it another try. */
if (constructMachine())
}
bool VBoxNewVMWzd::constructMachine()
{
/* create a machine with the default settings file location */
{
{
return false;
}
/* The FirstRun wizard is to be shown only when we don't attach any hard
* disk or attach a new (empty) one. Selecting an existing hard disk
* will cancel the wizard. */
}
/* name is set in CreateMachine() */
/* OS type */
if (typeId == "os2warp3" ||
typeId == "os2warp4" ||
typeId == "os2warp45" ||
typeId == "ecs")
/* RAM size */
/* add one network adapter (NAT) by default */
{
#ifdef VBOX_WITH_E1000
/* Default to e1k on solaris */
if (typeId == "solaris" ||
typeId == "opensolaris")
#endif /* VBOX_WITH_E1000 */
cadapter.SetEnabled (true);
cadapter.SetCableConnected (true);
}
/* register the VM prior to attaching hard disks */
{
return false;
}
/* Boot hard disk (IDE Primary Master) */
if (!hardDiskId.isNull())
{
bool ok = false;
{
if (m.isOk())
{
m.SaveSettings();
if (m.isOk())
ok = true;
else
}
else
KStorageBus_IDE, 0, 0);
}
if (!ok)
{
/* unregister on failure */
return false;
}
}
/* ensure we don't try to delete a newly created hard disk on success */
return true;
}
void VBoxNewVMWzd::ensureNewHardDiskDeleted()
{
{
/* remember ID as it may be lost after the deletion */
bool success = false;
{
parentWidget());
success = true;
}
if (success)
else
progress);
}
}
{
return mMachine;
}
void VBoxNewVMWzd::showHardDiskManager()
{
{
{
}
}
}
void VBoxNewVMWzd::showNewHardDiskWizard()
{
{
}
}
{
}
{
}
{
tr ("The recommended base memory size is <b>%1</b> MB.")
tr ("The recommended size of the boot hard disk is <b>%1</b> MB.")
}