VBoxVMSettingsDlg.ui.h revision 40f816668d362e859601b6e450ffea01a6f0e5e5
/**
*
* VBox frontends: Qt GUI ("VirtualBox"):
* "VM settings" dialog 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 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.
*****************************************************************************/
/**
* QDialog class reimplementation to use for adding network interface.
* It has one line-edit field for entering network interface's name and
*/
{
mLeName (0)
{
/* Setup Input layout */
/* Setup Button layout */
/* resize to fit the aIfaceName in one string */
inputLayout->spacing() +
/* Validate interface name field */
validate();
}
~VBoxAddNIDialog() {}
void validate()
{
}
{
setFixedHeight (height());
}
};
/**
* 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;
}
/**
* QListView class reimplementation to use as boot items table.
* It has one unsorted column without header with automated width
* resize management.
* Keymapping handlers for ctrl-up & ctrl-down are translated into
*/
{
{
setSorting (-1);
setColumnWidthMode (0, Maximum);
"Use checkboxes to the left to enable or disable "
"individual boot devices. Move items up and down to "
"change the device order."));
}
~BootItemsTable() {}
void moveItemUp();
void moveItemDown();
void itemToggled();
{
if (!aItem)
setSelected (currentItem(), true);
}
{
{
{
emit moveItemUp();
return;
emit moveItemDown();
return;
default:
break;
}
}
}
};
/**
* QWidget class reimplementation to use as boot items widget.
* It contains BootItemsTable and two tool-buttons for moving
* to boot sequience.
*/
{
{
void stateChange (bool)
{
table->emitItemToggled();
}
};
{
/* Setup main widget layout */
/* Setup settings layout */
/* Setup button's layout */
mBtnUp->setAutoRaise (true);
mBtnDown->setAutoRaise (true);
"list_moveup_disabled_16px.png"));
"list_movedown_disabled_16px.png"));
/* Setup focus proxy for BootItemsList */
}
~BootItemsList() {}
void fixTabStops()
{
/* fix focus order for BootItemsList */
}
{
/* Load boot-items of current VM */
int minimumWidth = 0;
for (int i = 1; i <= 4; ++ i)
{
{
uniqueList << name;
}
}
/* Load other unique boot-items */
{
{
uniqueList << name;
}
}
4 /* viewport margin */);
4 /* viewport margin */);
}
{
QCheckListItem *item = 0;
/* Search for checked items */
int index = 1;
while (item)
{
{
}
}
/* Search for non-checked items */
while (item)
{
}
}
{
if (aWidget == mBootTable)
{
}
{
}
}
void bootSequenceChanged();
void moveItemUp()
{
if (!itemAbove) return;
}
void moveItemDown()
{
if (!itemBelow) return;
}
void onItemToggled()
{
}
{
mBootTable->setFocus();
}
};
/// @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;
mResetFirstRunFlag = 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);
#ifndef DEBUG
/* Enforce rich text format to avoid jumping margins (margins of plain
* text labels seem to be smaller). We don't do it in the DEBUG builds to
* be able to immediately catch badly formatted text (i.e. text that
* contains HTML tags but doesn't start with <qt> so that Qt isn't able to
* recognize it as rich text and draws all tags as is instead of doing
* formatting). We want to catch this text because this is how it will look
* in the whatsthis balloon where we cannot enforce rich text. */
#endif
whatsThisLabel->setMaxHeightMode (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"));
"eraser_disabled_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 */
#ifndef Q_WS_WIN
gbInterfaceList->setHidden (true);
#endif
/* setup tab widget */
/* setup iconsets */
"add_host_iface_disabled_16px.png"));
"remove_host_iface_disabled_16px.png"));
/* setup languages */
/* 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"));
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."));
/* Shared Folders Page */
/*
* 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 */
/* Boot-order table */
/* Fixing focus order for BootItemsList */
/* Shared Clipboard mode */
/* HDD Images page */
/* CD-ROM Drive Page */
/* Audio Page */
#if defined Q_WS_WIN32
#ifdef VBOX_WITH_WINMM
#endif
#elif defined Q_OS_LINUX
#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;
/* update geometry for the dynamically added usb-page to ensure proper
* sizeHint calculation by the Qt layout manager */
/* let our toplevel widget calculate its sizeHint properly */
QApplication::sendPostedEvents (0, 0);
/* resize to the miminum possible size */
resize (minimumSize());
}
void VBoxVMSettingsDlg::updateShortcuts()
{
/* setup necessary combobox item */
/* check if the enumeration process has been started yet */
if (!vboxGlobal().isMediaEnumerationStarted())
else
{
cbISOFloppy->refresh();
}
}
void VBoxVMSettingsDlg::loadInterfacesList()
{
#if defined Q_WS_WIN
/* clear inner list */
/* load current inner list */
/* save current list item name */
/* load current list items */
lbHostInterface->clear();
if (mInterfaceList.count())
else
/* select current list item */
if (index == -1)
index = 0;
#endif
}
void VBoxVMSettingsDlg::hostInterfaceAdd()
{
#if defined Q_WS_WIN
/* allow the started helper process to make itself the foreground window */
/* search for the max available interface index */
int ifaceNumber = 0;
{
if (pos != -1)
}
/* creating add host interface dialog */
return;
/* create interface */
{
if (progress.GetResultCode() == 0)
{
/* add&select newly created interface */
mInterfaceList += iName;
/* enable interface delete button */
pbHostRemove->setEnabled (true);
}
else
}
else
/* allow the started helper process to make itself the foreground window */
#endif
}
void VBoxVMSettingsDlg::hostInterfaceRemove()
{
#if defined Q_WS_WIN
/* allow the started helper process to make itself the foreground window */
/* check interface name */
return;
/* asking user about deleting selected network interface */
tr ("<p>Do you want to remove the selected host network interface "
"<nobr><b>%1</b>?</nobr></p>"
"<p><b>Note:</b> This interface may be in use by one or more "
"network adapters of this or another VM. After it is removed, these "
"adapters will no longer work until you correct their settings by "
"either choosing a different interface name or a different adapter "
0, /* autoConfirmId */
return;
{
/* delete interface */
{
if (progress.GetResultCode() == 0)
{
{
/* disable interface delete button */
pbHostRemove->setEnabled (false);
}
}
else
}
}
#endif
}
{
if (!aWidget) return;
#if defined Q_WS_WIN
set->revalidate();
#endif
}
void VBoxVMSettingsDlg::resetFirstRunFlag()
{
mResetFirstRunFlag = true;
}
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.
*
* If @a aCategory is non-null, it should be one of values from the hidden
* '[cat]' column of #listView (see VBoxVMSettingsDlg.ui in qdesigner)
* prepended with the '#' sign. In this case, the specified category page
* will be activated when the dialog is open.
*
* If @a aWidget is non-null, it should be a name of one of widgets
* from the given category page. In this case, the specified widget
* will get focus when the dialog is open.
*
* @note Calling this method after the dialog is open has no sense.
*
* @param aCategory Category to select when the dialog is open or null.
* @param aWidget Category to select when the dialog is open or null.
*/
{
{
/* search for a list view item corresponding to the category */
if (item)
{
/* search for a widget with the given name */
{
{
QWidget *p = w;
while ((p = p->parentWidget()) != NULL)
{
{
/* the tab contents widget is two steps down
* (QTabWidget -> QWidgetStack -> QWidget) */
if (c)
if (c)
}
}
w->setFocus();
}
}
}
}
}
{
}
{
/* 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 index = 0;
{
if (!valid) break;
}
if (!valid)
}
{
{
}
else
valid = true;
}
}
{
/* name */
/* OS type */
/* RAM size */
/* VRAM size */
/* Boot-order */
/* ACPI */
/* IO APIC */
chbVTX->setNoChange();
/* Saved state folder */
/* Description */
/* Shared clipboard mode */
/* other features */
/* 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? */
name :
++ id;
}
{
case CEnums::HostDriveCaptured:
{
name :
{
/*
* 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?
name :
++ id;
}
{
case CEnums::HostDriveCaptured:
{
name :
{
/*
* 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 */
{
{
}
}
/* 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
{
}
}
/* shared folders */
{
}
/* 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 */
/* ACPI */
/* IO APIC */
/* Saved state folder */
if (leSnapshotFolder->isModified())
/* Description */
/* Shared clipboard mode */
/* other features */
/* 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())
{
}
}
{
{
dvd.SetPassthrough (false);
}
{
/*
* otherwise the selected drive is not yet available, leave it
* as is
*/
}
{
dvd.SetPassthrough (false);
}
}
/* Clear the "GUI_FirstRun" extra data key in case if the boot order
if (mResetFirstRunFlag)
/* 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) */
}
}
/* shared folders */
{
}
return COMResult();
}
void VBoxVMSettingsDlg::showImageManagerISOFloppy() { showVDImageManager(&uuidISOFloppy, cbISOFloppy); }
{
else if (cbb == cbISOFloppy)
else
{
}
else
{
}
/* revalidate pages with custom validation */
wvalHDD->revalidate();
wvalDVD->revalidate();
wvalFloppy->revalidate();
}
{
/* fix the tab order so that main dialog's buttons are always the last */
/* setup validation */
page->revalidate();
#ifdef Q_WS_WIN
/* fix focus order (make sure the Host Interface list UI goes after the
* last network adapter UI item) */
#endif
}
{
}
{
}
{
}
{
}
{
/// @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();
}
{
if (settingsFolder.isNull())
return;
/* remove trailing slash if any */
/*
* 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);
}
}
{
}
{
/* search for the max available filter index */
int maxFilterIndex = 0;
while (*iterator)
{
if (pos != -1)
++ iterator;
}
/* creating new usb filter */
mUSBFilterListModified = true;
}
{
}
{
/* if null then some other item but a USB device is selected */
return;
/* The port property depends on the host computer rather than on the USB
* device itself; for this reason only a few people will want to use it in
* the filter since the same device plugged into a different socket will
* not match the filter in this case. */
#if 0
/// @todo set it anyway if Alt is currently pressed
#endif
mUSBFilterListModified = true;
}
{
mUSBFilterListModified = true;
}
{
if (!itemAbove)
{
/* overcome Qt stupidity */
}
else
mUSBFilterListModified = true;
}
{
mUSBFilterListModified = true;
}
#include "VBoxVMSettingsDlg.ui.moc"