VBoxNewVMWzd.ui.h revision df30dbdfdbce7bc58d1a71d98772953017bc3269
//Added by qt3to4:
#include <QShowEvent>
/**
*
* VBox frontends: Qt GUI ("VirtualBox"):
* "New virtual machine" wizard UI include (Qt Designer)
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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.
*/
/****************************************************************************
** 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 */
// grbHDALayout->addMultiCellWidget (mediaCombo, 0, 0, 0, 2);
if (!vboxGlobal().isMediaEnumerationStarted())
else
mediaCombo->refresh();
/// @todo (dmik) remove?
/* Summary page */
// summaryLayout->insertWidget (1, teSummary);
/* 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();
wvalHDD->revalidate();
/* the finish button on the Summary page is always enabled */
setFinishEnabled (pageSummary, true);
/* setup minimum width for the sizeHint to be calculated correctly */
int wid = 1;
// int wid = widthSpacer->minimumSize().width();
}
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 (!mediaCombo->currentItem())
{
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 (mediaCombo->currentItem())
"<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)
mediaCombo->setFocus();
else if (page == pageSummary)
}
void VBoxNewVMWzd::accept()
{
/*
* Try to create the machine when the Finish button is pressed.
* On failure, the wisard will remain open to give it another try.
*/
if (constructMachine())
}
bool VBoxNewVMWzd::constructMachine()
{
/* create a machine with the default settings file location */
{
{
return false;
}
}
/* name is set in CreateMachine() */
/* OS type */
/* RAM size */
/* add one network adapter (NAT) by default */
{
cadapter.SetEnabled (true);
cadapter.SetCableConnected (true);
}
/* register the VM prior to attaching hard disks */
{
return false;
}
/* Boot hard disk (Primary Master) */
{
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 delete a newly created hard disk on success */
return true;
}
void VBoxNewVMWzd::ensureNewHardDiskDeleted()
{
{
chd.GetLocation());
else
{
{
vdi.DeleteImage();
}
}
}
}
{
return cmachine;
}
void VBoxNewVMWzd::showVDIManager()
{
{
}
mediaCombo->setFocus();
/* revailidate */
wvalHDD->revalidate();
}
void VBoxNewVMWzd::showNewVDIWizard()
{
{
/* update media combobox */
mediaCombo->setFocus();
/* revailidate */
wvalHDD->revalidate();
}
}
{
}
{
}
{
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.")
}
void VBoxNewVMWzd::currentMediaChanged (int)
{
/* revailidate */
wvalHDD->revalidate();
}