VBoxVMSettingsDisplay.cpp revision e64031e20c39650a7bc902a3e1aba613b9415dee
/* $Id$ */
/** @file
*
* VBox frontends: Qt4 GUI ("VirtualBox"):
* VBoxVMSettingsDisplay class implementation
*/
/*
* Copyright (C) 2008-2010 Oracle Corporation
*
* 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.
*/
#include "QIWidgetValidator.h"
#include "VBoxVMSettingsDisplay.h"
#include "VBoxGlobal.h"
#include "VBoxProblemReporter.h"
/**
* 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;
}
{
/* Apply UI decorations */
/* Setup constants */
/* Setup validators */
mLeVRDPPort->setValidator (new QRegExpValidator (QRegExp ("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this));
/* Setup connections */
connect (mLeMemory, SIGNAL (textChanged (const QString&)), this, SLOT (textChangedVRAM (const QString&)));
connect (mLeMonitors, SIGNAL (textChanged (const QString&)), this, SLOT (textChangedMonitors (const QString&)));
/* Setup initial values */
/* Setup the scale so that ticks are at page step boundaries */
mSlMemory->setSnappingEnabled (true);
mSlMonitors->setSnappingEnabled (true);
/* Ensure value and validation is updated */
/* Setup VRDP widget */
/* Initially disabled */
mCbVRDP->setChecked (false);
mCb3D->setEnabled (false);
#ifndef VBOX_WITH_VIDEOHWACCEL
mCb2DVideo->setVisible (false);
#endif
/* Applying language settings */
}
#ifdef VBOX_WITH_VIDEOHWACCEL
bool VBoxVMSettingsDisplay::isAcceleration2DVideoSelected() const
{
return mCb2DVideo->isChecked();
}
#endif
{
/* must come _before_ setting the initial memory value */
/* Memory Size */
/* Monitors Count */
/* 3D Acceleration */
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
/* VRDP Settings */
{
}
else
{
}
}
void VBoxVMSettingsDisplay::putBackTo()
{
/* Memory Size */
/* Monitors Count */
/* 3D Acceleration */
#ifdef VBOX_WITH_VIDEOHWACCEL
/* 2D Video Acceleration */
#endif
/* VRDP Settings */
{
}
}
{
mValidator = aVal;
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
}
{
/* Video RAM amount test */
{
"you have assigned less than <b>%1</b> of video memory which is "
"the minimum amount required to switch the virtual machine to "
"fullscreen or seamless mode.")
return true;
}
#ifdef VBOX_WITH_VIDEOHWACCEL
if (mCb2DVideo->isChecked())
{
{
"you have assigned less than <b>%1</b> of video memory which is "
"the minimum amount required for HD Video to be played efficiently.")
return true;
}
}
#endif
/* 3D Acceleration support test */
// TODO : W8 for NaN //
return true;
}
{
#ifdef VBOX_WITH_VIDEOHWACCEL
#else
#endif
}
void VBoxVMSettingsDisplay::retranslateUi()
{
/* Translate uic generated strings */
mCbVRDPMethod->setItemText (0,
}
{
}
{
}
{
}
{
}
{
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif /* VBOX_WITH_VIDEOHWACCEL */
/* The memory requirements have changed too. */
/* Limit the maximum memory to save careless users from setting useless big values */
if (m_maxVRAMVisible < 128)
m_maxVRAMVisible = 128;
if (m_maxVRAMVisible < m_initialVRAM)
/* ... or just call retranslateUi()? */
}