VBoxVMSettingsDlg.ui.h revision b87600db85c23ff385ed03a4409cf7fc55074ae3
/**
*
* VBox frontends: Qt GUI ("VirtualBox"):
* "VM settings" dialog UI include (Qt Designer)
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a 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;
}
/**
* Simple QTableItem subclass to use QComboBox as the cell editor.
* This subclass (as opposed to QComboTableItem) allows to specify the
* EditType::WhenCurrent edit type of the cell (to let it look like a normal
* text cell when not in focus).
*
* Additionally, this subclass supports unicity of a group of values
* among a group of ComboTableItem items that refer to the same list of
* unique values currently being used.
*/
{
{
}
// reimplemented QTableItem members
QWidget *createEditor() const
{
if (mUniqueInUse)
{
/* remove unique values currently in use */
{
}
}
return mComboBoxSelector;
}
{
{
}
else
}
{
{
/* update the list of unique values currently in use */
if (mUniqueInUse)
{
(*mUniqueInUse) += aText;
}
}
}
/*
* Function: rtti()
* Target: required for runtime information about ComboTableItem class
* used for static_cast from QTableItem
*/
int rtti() const { return 1001; }
/*
* Function: getEditor()
* Target: returns pointer to stored combo-box
*/
/*
* QTable doesn't call endEdit() when item's EditType is WhenCurrent and
* the table widget loses focus or gets destroyed (assuming the user will
* hit Enter if he wants to keep the value), so we need to do it ourselves
*/
/*
* Function: focusClearing()
* Target: required for removing focus from combo-box
*/
const QStringList mList;
const QStringList mUnique;
};
/// @todo (dmik) remove?
///**
// * Returns the through position of the item in the list view.
// */
//static int pos (QListView *lv, QListViewItem *li)
//{
// QListViewItemIterator it (lv);
// int p = -1, c = 0;
// while (it.current() && p < 0)
// {
// if (it.current() == li)
// p = c;
// ++ it;
// ++ c;
// }
// return p;
//}
{
, mId (-1) {}
int mId;
};
/**
* Returns the path to the item in the form of 'grandparent > parent > item'
* using the text of the first column of every item.
*/
{
QString p;
while (cur)
{
if (!p.isNull())
p = sep + p;
}
return p;
}
enum
{
/* listView column numbers */
listView_Category = 0,
listView_Id = 1,
listView_Link = 2,
/* lvUSBFilters column numbers */
lvUSBFilters_Name = 0,
};
void VBoxVMSettingsDlg::init()
{
polished = false;
/* all pages are initially valid */
valid = true;
buttonOk->setEnabled( true );
/* disable unselecting items by clicking in the unused area of the list */
/* hide the header and internal columns */
/* sort by the id column (to have pages in the desired order) */
/* disable further sorting (important for network adapters) */
/* set the first item selected */
/* setup status bar icon */
/* page title font is derived from the system font */
f.setBold (true);
titleLabel->setFont (f);
/* setup the what's this label */
QApplication::setGlobalMouseTracking (true);
6 /* seems that RichText adds some margin */ +
6 /* seems that RichText adds some margin */ +
/*
* setup connections and set validation for pages
* ----------------------------------------------------------------------
*/
/* General page */
"select_file_dis_16px.png"));
"delete_dis_16px.png"));
/* HDD Images page */
tr ("When checked, attaches the specified virtual hard disk to the "
"Master slot of the Primary IDE controller."));
tr ("When checked, attaches the specified virtual hard disk to the "
"Slave slot of the Primary IDE controller."));
tr ("When checked, attaches the specified virtual hard disk to the "
"Slave slot of the Secondary IDE controller."));
/* sometimes the weirdness of Qt just kills... */
cbHDA);
cbHDB);
cbHDD);
"and allows to quickly select a different hard disk."));
"and allows to quickly select a different hard disk."));
"and allows to quickly select a different hard disk."));
"and allows to quickly select a different hard disk."));
"and allows to quickly select a different hard disk."));
/* setup iconsets -- qdesigner is not capable... */
"select_file_dis_16px.png"));
"select_file_dis_16px.png"));
"select_file_dis_16px.png"));
"Secondary Master IDE controller of the machine."));
"drive and allows to quickly select a different image."));
/* setup iconsets -- qdesigner is not capable... */
"select_file_dis_16px.png"));
/* Floppy Drive Page */
tr ("When checked, mounts the specified media to the Floppy drive of the "
"virtual machine."));
"drive and allows to quickly select a different image."));
/* setup iconsets -- qdesigner is not capable... */
"select_file_dis_16px.png"));
/* Audio Page */
tr ("When checked, the virtual PCI audio card is plugged into the "
"virtual machine that uses the specified driver to communicate "
"to the host audio card."));
/* Network Page */
/* USB Page */
/* disable sorting */
/* disable unselecting items by clicking in the unused area of the list */
/* create the widget stack for filter settings */
/// @todo (r=dmik) having a separate settings widget for every USB filter
// is not that smart if there are lots of USB filters. The reason for
// stacking here is that the stacked widget is used to temporarily store
// data of the associated USB filter until the dialog window is accepted.
// If we remove stacking, we will have to create a structure to store
// editable data of all USB filters while the dialog is open.
/* create a default (disabled) filter settings widget at index 0 */
/* setup iconsets -- qdesigner is not capable... */
"usb_new_disabled_16px.png"));
"usb_add_disabled_16px.png"));
"usb_remove_disabled_16px.png"));
"usb_moveup_disabled_16px.png"));
"usb_movedown_disabled_16px.png"));
mLastUSBFilterNum = 0;
mUSBFilterListModified = false;
/* VRDP Page */
tr ("When checked, the VM will act as a Remote Desktop "
"Protocol (RDP) server, allowing remote clients to connect "
"and operate the VM (when it is running) "
"using a standard RDP client."));
/*
* set initial values
* ----------------------------------------------------------------------
*/
/* General page */
/* setup the scale so that ticks are at page step boundaries */
/* ensure leRAM value and validation is updated */
/* setup the scale so that ticks are at page step boundaries */
/* ensure leVRAM value and validation is updated */
tblBootOrder->setTopMargin (0);
tblBootOrder->setLeftMargin (0);
{
for (int i = 0; i < tblBootOrder->numRows(); i++)
{
}
}
tblBootOrder->setColumnStretchable (0, true);
// tblBootOrder->setFocusStyle (QTable::FollowStyle);
/* HDD Images page */
/* CD-ROM Drive Page */
/* Audio Page */
#if defined Q_WS_WIN32
#ifdef VBOX_WITH_ALSA
#endif
#endif
/* Network Page */
/*
* update the Ok button state for pages with validation
* (validityChanged() connected to enableNext() will do the job)
*/
wvalHDD->revalidate();
wvalDVD->revalidate();
wvalFloppy->revalidate();
/* VRDP Page */
}
{
if (!object->isWidgetType())
{
{
else
break;
}
{
updateWhatsThis (true /* gotFocus */);
break;
}
default:
break;
}
}
{
/* 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. */
if (polished)
return;
polished = true;
/* resize to the miminum possible size */
resize (minimumSize());
}
const QPoint &/* mousePos */)
{
}
void VBoxVMSettingsDlg::updateShortcuts()
{
/* setup necessary combobox item */
/* check if the enumeration process has been started yet */
if (!vboxGlobal().isMediaEnumerationStarted())
else
{
cbISOFloppy->refresh();
}
}
void VBoxVMSettingsDlg::hdaMediaChanged()
{
/* revailidate */
wvalHDD->revalidate();
}
void VBoxVMSettingsDlg::hdbMediaChanged()
{
/* revailidate */
wvalHDD->revalidate();
}
void VBoxVMSettingsDlg::hddMediaChanged()
{
/* revailidate */
wvalHDD->revalidate();
}
void VBoxVMSettingsDlg::cdMediaChanged()
{
/* revailidate */
wvalDVD->revalidate();
}
void VBoxVMSettingsDlg::fdMediaChanged()
{
/* revailidate */
wvalFloppy->revalidate();
}
{
return notAttached;
}
{
if (!gotFocus)
{
}
else
{
}
/* if the given widget lacks the whats'this text, look at its parent */
{
break;
}
}
{
if (!warningString.isEmpty())
else
updateWhatsThis (true);
}
/**
* Sets up this dialog.
*
* @note Calling this method after the dialog is open has no sense.
*
* @param category
* Category to select when the dialog is open. Must be one of
* values from the hidden '[cat]' column of #listView
* (see VBoxVMSettingsDlg.ui in qdesigner) prepended with the '#'
* sign.
*/
{
if (category)
{
if (item)
}
}
{
}
{
/* detect the overall validity */
bool newValid = true;
{
QObjectListIt it (*l);
{
++it;
}
delete l;
}
{
if (valid)
setWarning(0);
}
}
{
/* do individual validations for pages */
{
valid = true;
{
{
valid = false;
}
}
{
{
valid = false;
}
else
{
if (found)
{
}
if (valid)
else
"to a different slot."));
}
}
{
{
valid = false;
}
else
{
if (found)
{
}
if (valid)
else
"to a different slot."));
}
}
}
{
rbHostDVD->setChecked(true);
if (!valid)
}
else if (pg == pageFloppy)
{
rbHostFloppy->setChecked(true);
if (!valid)
}
else if (pg == pageNetwork)
{
int slot = -1;
{
{
}
}
if (!valid)
}
{
{
}
else
valid = true;
}
}
{
/* name */
/* OS type */
/* RAM size */
/* VRAM size */
/* boot order */
for (int i = 0; i < tblBootOrder->numRows(); i ++)
{
}
/* ACPI */
/* IO APIC */
/* Saved state folder */
/* hard disk images */
{
struct
{
struct {
} data;
}
diskSet[] =
{
};
grbHDA->setChecked (false);
grbHDB->setChecked (false);
grbHDD->setChecked (false);
{
{
{
{
}
}
}
}
}
/* floppy image */
{
/* read out the host floppy drive list and prepare the combobox */
cbHostFloppy->clear();
int id = 0;
{
/** @todo set icon? */
++ id;
}
{
case CEnums::HostDriveCaptured:
{
{
/*
* if the floppy drive is not currently available,
* add it to the end of the list with a special mark
*/
}
else
{
/* this will select the correct item from the prepared list */
}
rbHostFloppy->setChecked (true);
break;
}
case CEnums::ImageMounted:
{
rbISOFloppy->setChecked (true);
break;
}
case CEnums::NotMounted:
{
bgFloppy->setChecked(false);
break;
}
default:
}
}
{
/* read out the host DVD drive list and prepare the combobox */
int id = 0;
{
/// @todo (r=dmik) set icon?
++ id;
}
{
case CEnums::HostDriveCaptured:
{
{
/*
* if the DVD drive is not currently available,
* add it to the end of the list with a special mark
*/
}
else
{
/* this will select the correct item from the prepared list */
}
rbHostDVD->setChecked (true);
break;
}
case CEnums::ImageMounted:
{
rbISODVD->setChecked (true);
break;
}
case CEnums::NotMounted:
{
bgDVD->setChecked(false);
break;
}
default:
}
}
/* audio */
{
}
/* network */
{
{
addNetworkAdapter (adapter, false);
}
}
/* USB */
{
{
/* disable the USB controller category if the USB controller is
* not available (i.e. in VirtualBox OSE) */
if (usbItem)
usbItem->setVisible (false);
/* disable validators if any */
pageUSB->setEnabled (false);
/* Show an error message (if there is any).
* Note that we don't use the generic cannotLoadMachineSettings()
* call here because we want this message to be suppressable. */
}
else
{
/* silly Qt -- doesn't emit currentChanged after adding the
* first item to an empty list */
}
}
/* vrdp */
{
{
/* disable the VRDP category if VRDP is
* not available (i.e. in VirtualBox OSE) */
if (vrdpItem)
vrdpItem->setVisible (false);
/* disable validators if any */
pageVRDP->setEnabled (false);
/* if machine has something to say, show the message */
}
else
{
}
}
/* request for media shortcuts update */
/* revalidate pages with custom validation */
wvalHDD->revalidate();
wvalDVD->revalidate();
wvalFloppy->revalidate();
wvalVRDP->revalidate();
}
{
/* name */
/* OS type */
/* RAM size */
/* VRAM size */
/* boot order */
for (int i = 0; i < tblBootOrder->numRows(); i ++)
{
}
/* ACPI */
/* IO APIC */
/* Saved state folder */
if (leSnapshotFolder->isModified())
/* hard disk images */
{
struct
{
struct {
} data;
}
diskSet[] =
{
};
/*
* first, detach all disks (to ensure we can reattach them to different
* controllers / devices, when appropriate)
*/
{
{
{
}
}
}
/* now, attach new disks */
{
{
}
}
}
/* floppy image */
{
{
}
else if (rbHostFloppy->isChecked())
{
/*
* otherwise the selected drive is not yet available, leave it
* as is
*/
}
else if (rbISOFloppy->isChecked())
{
}
}
{
{
}
{
/*
* otherwise the selected drive is not yet available, leave it
* as is
*/
}
{
}
}
/* audio */
{
}
/* network */
{
{
page->putBackToAdapter();
}
}
/* usb */
{
{
/* the USB controller may be unavailable (i.e. in VirtualBox OSE) */
/*
* first, remove all old filters (only if the list is changed,
* not only individual properties of filters)
*/
ctl.RemoveDeviceFilter (0);
/* then add all new filters */
{
return res;
}
}
mUSBFilterListModified = false;
}
/* vrdp */
{
{
/* VRDP may be unavailable (i.e. in VirtualBox OSE) */
}
}
return COMResult();
}
void VBoxVMSettingsDlg::showImageManagerISOFloppy() { showVDImageManager(&uuidISOFloppy, cbISOFloppy); }
{
else if (cbb == cbISOFloppy)
else
/* revalidate pages with custom validation */
wvalHDD->revalidate();
wvalDVD->revalidate();
wvalFloppy->revalidate();
}
bool /* select */)
{
/* fix the tab order so that main dialog's buttons are always the last */
/* setup validation */
wval->revalidate();
}
{
}
{
}
{
}
{
}
{
/// @todo (dmik) remove?
// CGuestOSType type = vboxGlobal().vmGuestOSType (item);
// txRAMBest->setText (tr ("<qt>Best %1 MB<qt>")
// .arg (type.GetRecommendedRAM()));
// txVRAMBest->setText (tr ("<qt>Best %1 MB</qt>")
// .arg (type.GetRecommendedVRAM()));
}
{
/*
* do this instead of le->setText (QString::null) to cause
* isModified() return true
*/
leSnapshotFolder->del();
}
{
{
/* set the first parent directory that exists as the current */
do
{
}
}
{
/* remove trailing slash */
/*
* do this instead of le->setText (folder) to cause
* isModified() return true
*/
}
}
// USB Filter stuff
////////////////////////////////////////////////////////////////////////////////
{
? lvUSBFilters->currentItem()
: lvUSBFilters->lastItem();
/* fix the tab order so that main dialog's buttons are always the last */
if (isNew)
{
}
/* setup validation */
wval->revalidate();
}
{
if (item)
{
}
else
{
/* raise the disabled widget */
wstUSBFilters->raiseWidget (0);
}
}
{
}
{
.arg (++ mLastUSBFilterNum));
mUSBFilterListModified = true;
}
{
}
{
/* if null then some other item but a USB device is selected */
return;
mUSBFilterListModified = true;
}
{
mUSBFilterListModified = true;
}
{
if (!itemAbove)
{
/* overcome Qt stupidity */
}
else
mUSBFilterListModified = true;
}
{
mUSBFilterListModified = true;
}
#include "VBoxVMSettingsDlg.ui.moc"