/* $Id$ */
/** @file
* VBox Qt GUI - 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.
*/
# include <precomp.h>
#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
/* Qt includes: */
# include <QHBoxLayout>
# include <QLabel>
# include <QEvent>
# include <QTimer>
/* GUI includes: */
# include "UIWarningPane.h"
# include "QIWidgetValidator.h"
/* Other VBox includes: */
#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
, m_pIconLayout(0)
, m_pTextLabel(0)
, m_pHoverTimer(0)
{
/* Prepare: */
prepare();
}
{
/* Assign passed text directly to warning-label: */
}
{
/* Make sure validator exists: */
/* Make 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: */
/* Add icon-label into layout: */
/* Configure icon-label: */
pIconLabel->setMouseTracking(true);
pIconLabel->installEventFilter(this);
}
/* Mark icon as 'unhovered': */
m_hovered << false;
}
{
/* Notify listeners about hovering: */
}
{
/* Prepare content: */
}
{
/* Create main-layout: */
{
/* Configure layout: */
pMainLayout->setContentsMargins(0, 0, 0, 0);
/* Add left stretch: */
/* Create text-label: */
m_pTextLabel = new QLabel;
{
/* Add into main-layout: */
}
/* Create layout: */
m_pIconLayout = new QHBoxLayout;
{
/* Configure layout: */
m_pIconLayout->setContentsMargins(0, 0, 0, 0);
/* Add into main-layout: */
}
/* Create hover-timer: */
m_pHoverTimer = new QTimer(this);
{
/* Configure timer: */
m_pHoverTimer->setSingleShot(true);
}
/* 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;
m_pHoverTimer->start();
}
}
}
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;
if (m_pHoverTimer->isActive())
{
m_pHoverTimer->stop();
}
else
}
}
}
break;
}
/* Default case: */
default: break;
}
/* Call to base-class: */
}