VBoxVMInformationDlg.cpp revision 8e0c2ca3abd721979958f95b9af73b60665478c8
/** @file
*
* VBox frontends: Qt4 GUI ("VirtualBox"):
* VBoxVMInformationDlg class implementation
*/
/*
* 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.
*/
#include <VBoxVMInformationDlg.h>
#include <VBoxGlobal.h>
#include <VBoxConsoleView.h>
/* Qt includes */
#include <QTimer>
{
{
/* Creating new information dialog if there is no one existing */
}
info->activateWindow();
}
#ifdef Q_WS_MAC
#else /* Q_WS_MAC */
#endif /* Q_WS_MAC */
, mIsPolished (false)
, mStatTimer (new QTimer (this))
{
/* Apply UI decorations */
#ifdef Q_WS_MAC
/* No icon for this window on the mac, cause this would act as proxy icon
* which isn't necessary here. */
setWindowIcon (QIcon());
#else
/* Apply window icons */
":/session_info_32px.png", ":/session_info_16px.png"));
#endif
/* Enable size grip without using a status bar. */
setSizeGripEnabled (true);
/* Setup focus-proxy for pages */
/* Setup browsers */
/* For further tuning can be used setViewportMargins method of
* QRichTextEdit extended class: */
#if 0
#endif
/* Setup handlers */
this, SLOT (onPageChanged (int)));
this, SLOT (updateDetails()));
this, SLOT (updateDetails()));
this, SLOT (updateDetails()));
this, SLOT (processStatistics()));
this, SLOT (processStatistics()));
/* Loading language constants */
/* Details page update */
/* Statistics page update */
/* Preload dialog attributes for this vm */
{
mWidth = 400;
mHeight = 450;
mMax = false;
}
else
{
}
/* Make statistics page the default one */
}
{
/* Save dialog attributes for this vm */
}
void VBoxVMInformationDlg::retranslateUi()
{
/* Translate uic generated strings */
/* Setup a dialog caption */
/* Setup a tabwidget page names */
/* Clear counter names initially */
/* IDE HD statistics: */
for (int i = 0; i < 2; ++ i)
for (int j = 0; j < 2; ++ j)
{
/* Names */
/* Units */
/* Belongs to */
}
/* SATA HD statistics: */
for (int i = 0; i < 30; ++ i)
{
/* Names */
= tr ("DMA Transfers");
= tr ("Data Read");
= tr ("Data Written");
/* Units */
/* Belongs to */
}
/* Network Adapters statistics: */
{
const char *name;
switch (ty)
{
name = "E1k";
break;
default:
name = "PCNet";
break;
}
/* Names */
/* Units */
/* Belongs to */
}
/* Statistics page update. */
}
{
{
case QEvent::WindowStateChange:
{
if (mIsPolished)
mMax = isMaximized();
else if (mMax == isMaximized())
mIsPolished = true;
break;
}
default:
break;
}
return result;
}
{
/* Store dialog size for this vm */
if (mIsPolished && !isMaximized())
{
}
}
{
/* 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 (!mIsPolished)
{
/* Load window size and state */
if (mMax)
else
mIsPolished = true;
}
}
void VBoxVMInformationDlg::updateDetails()
{
/* Details page update */
false /* aWithLinks */));
}
{
/* Process selected statistics: */
{
}
/* Statistics page update */
}
{
/* Focusing the browser on shown page */
}
/**
* Opposing to deleteLater() slot this one makes it immediately.
*/
void VBoxVMInformationDlg::suicide()
{
delete this;
}
{
/* Filters the statistic counters body */
{
/* Parse incoming counter and fill the counter-element values. */
{
}
/* Fill the output with the necessary counter's value.
* Currently we are using "c" field of simple counter only. */
}
}
{
return;
"<td colspan=2><nobr><b>%2</b></nobr></td></tr>";
/* Screen & VT-X Runtime Parameters */
{
if (bpp)
else
/* Searching for longest string */
int maxLength = 0;
}
/* Hard Disk Statistics */
{
/* IDE Hard Disk (Primary Master) */
{
}
/* IDE Hard Disk (Primary Slave) */
{
}
/* IDE Hard Disk (Secondary Slave) */
{
}
/* SATA Hard Disks */
for (int i = 0; i < 30; ++ i)
{
{
}
}
/* If there are no Hard Disks */
{
}
}
/* Network Adapters Statistics */
{
/* Network Adapters list */
{
{
}
}
/* If there are no Network Adapters */
{
}
}
}
/**
* Allows left-aligned values formatting in right column.
*
* aValueName - the name of value in the left column.
* aValue - left-aligned value itself in the right column.
* aMaxSize - maximum width (in pixels) of value in right column.
*/
{
"<td align=right><nobr>%2"
"<img src=:/tpixel.png width=%3 height=1></nobr></td></tr>";
}
const QString &aBelongsTo)
{
return result;
}
const QString &aBelongsTo)
{
return result;
}
{
"<td align=right><nobr>%2%3</nobr></td></tr>";
{
{
{
}
}
}
else
return result;
}