UIWarningPane.cpp revision d67a5f90076d3e208810415abb792f5c42081c97
/* $Id$ */
/** @file
*
* VBox frontends: Qt4 GUI ("VirtualBox"):
* UIWarningPane class implementation
*/
/*
* Copyright (C) 2009-2013 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.
*/
/* Qt includes: */
#include <QHBoxLayout>
#include <QLabel>
#include <QEvent>
/* GUI includes: */
#include "UIWarningPane.h"
#include "QIWidgetValidator.h"
/* Other VBox includes: */
, m_pWarningLabel(0)
{
/* Prepare: */
prepare();
}
{
}
{
/* Make sure validator is set! */
/* Makre sure validator is not registered yet: */
{
AssertMsgFailed(("Validator is registered already!\n"));
return;
}
/* Register validator: */
/* Create icon-label for newly registered validator: */
{
/* Add icon-label into list: */
m_icons << pIconLabel;
/* Add icon-label into layout: */
/* Configure icon-label: */
pIconLabel->setMouseTracking(true);
pIconLabel->installEventFilter(this);
}
/* Mark icon as 'non-hovered': */
m_hovered << false;
}
void UIWarningPane::prepare()
{
/* Prepare content: */
}
void UIWarningPane::prepareContent()
{
/* Create main-layout: */
{
/* Configure layout: */
pMainLayout->setContentsMargins(0, 0, 0, 0);
/* Add left stretch: */
/* Create warning-label: */
m_pWarningLabel = new QLabel;
{
/* Add into main-layout: */
}
/* Create layout: */
m_pLayout = new QHBoxLayout;
{
/* Configure layout: */
m_pLayout->setContentsMargins(0, 0, 0, 0);
/* Add into main-layout: */
}
/* Add right stretch: */
}
}
{
/* Depending on event-type: */
{
/* One of icons hovered: */
{
/* Cast object to label: */
{
/* Search for the corresponding icon: */
{
/* Mark icon-label hovered if not yet: */
if (!m_hovered[iIconLabelPosition])
{
m_hovered[iIconLabelPosition] = true;
}
}
}
break;
}
/* One of icons unhovered: */
{
/* Cast object to label: */
{
/* Search for the corresponding icon: */
{
/* Mark icon-label unhovered if not yet: */
if (m_hovered[iIconLabelPosition])
{
m_hovered[iIconLabelPosition] = false;
}
}
}
break;
}
/* Default case: */
default: break;
}
/* Call to base-class: */
}