54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync/** @file
d34409ad02ea0d28e08a6c4b089a412fdb3b4c9cvboxsync * VBox Qt GUI - UIGDetailsItem class declaration.
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync/*
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2012-2013 Oracle Corporation
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync *
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync * available from http://www.virtualbox.org. This file is free software;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync * you can redistribute it and/or modify it under the terms of the GNU
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync * General Public License (GPL) as published by the Free Software
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync#ifndef __UIGDetailsItem_h__
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync#define __UIGDetailsItem_h__
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync/* GUI includes: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync#include "QIGraphicsWidget.h"
5c6842a1ea283266371775a3763986930313f182vboxsync#include "QIWithRetranslateUI.h"
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync/* Forward declaration: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncclass UIGDetailsModel;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncclass QGraphicsSceneHoverEvent;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncclass QGraphicsSceneMouseEvent;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncclass UIGDetailsGroup;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncclass UIGDetailsSet;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncclass UIGDetailsElement;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync/* UIGDetailsItem types: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncenum UIGDetailsItemType
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync{
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsItemType_Any = QGraphicsItem::UserType,
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsItemType_Group = QGraphicsItem::UserType + 1,
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsItemType_Set = QGraphicsItem::UserType + 2,
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsItemType_Element = QGraphicsItem::UserType + 3,
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsItemType_Preview = QGraphicsItem::UserType + 10
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync};
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync/* Details item interface
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync * for graphics details model/view architecture: */
5c6842a1ea283266371775a3763986930313f182vboxsyncclass UIGDetailsItem : public QIWithRetranslateUI4<QIGraphicsWidget>
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync{
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync Q_OBJECT;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsyncsignals:
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync /* Notifiers: Build stuff: */
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync void sigBuildStep(QString strStepId, int iStepNumber);
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync void sigBuildDone();
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncpublic:
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* Constructor: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsItem(UIGDetailsItem *pParent);
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* API: Cast stuff: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsGroup* toGroup();
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsSet* toSet();
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsElement* toElement();
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* API: Model stuff: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsModel* model() const;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* API: Parent stuff: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsItem* parentItem() const;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* API: Children stuff: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync virtual void addItem(UIGDetailsItem *pItem) = 0;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync virtual void removeItem(UIGDetailsItem *pItem) = 0;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync virtual QList<UIGDetailsItem*> items(UIGDetailsItemType type = UIGDetailsItemType_Any) const = 0;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync virtual bool hasItems(UIGDetailsItemType type = UIGDetailsItemType_Any) const = 0;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync virtual void clearItems(UIGDetailsItemType type = UIGDetailsItemType_Any) = 0;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* API: Layout stuff: */
6214bf5895e49f8d1bb016f5df0100a8277316d4vboxsync void updateGeometry();
4f1d643b0004170541444c4c0e425568b5ba4bcevboxsync virtual int minimumWidthHint() const = 0;
4f1d643b0004170541444c4c0e425568b5ba4bcevboxsync virtual int minimumHeightHint() const = 0;
4f1d643b0004170541444c4c0e425568b5ba4bcevboxsync QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync virtual void updateLayout() = 0;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsyncprotected slots:
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync /* Handler: Build stuff: */
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync virtual void sltBuildStep(QString strStepId, int iStepNumber);
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncprotected:
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
5c6842a1ea283266371775a3763986930313f182vboxsync /* Helper: Translate stuff: */
5c6842a1ea283266371775a3763986930313f182vboxsync void retranslateUi() {}
5c6842a1ea283266371775a3763986930313f182vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* Helpers: Paint stuff: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync static void configurePainterShape(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, int iRadius);
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync static void paintFrameRect(QPainter *pPainter, const QRect &rect, int iRadius);
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync static void paintPixmap(QPainter *pPainter, const QRect &rect, const QPixmap &pixmap);
9be5004fe11e14212cde2f4596a4f56675b11b19vboxsync static void paintText(QPainter *pPainter, QPoint point,
9be5004fe11e14212cde2f4596a4f56675b11b19vboxsync const QFont &font, QPaintDevice *pPaintDevice,
9be5004fe11e14212cde2f4596a4f56675b11b19vboxsync const QString &strText, const QColor &color);
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncprivate:
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* Variables: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync UIGDetailsItem *m_pParent;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync};
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
c6d0c503f95d48f31a8a9fcbcef24d7e56a802c5vboxsync/* Allows to build item content synchronously: */
c6d0c503f95d48f31a8a9fcbcef24d7e56a802c5vboxsyncclass UIBuildStep : public QObject
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync{
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync Q_OBJECT;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncsignals:
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
c6d0c503f95d48f31a8a9fcbcef24d7e56a802c5vboxsync /* Notifier: Build stuff: */
c6d0c503f95d48f31a8a9fcbcef24d7e56a802c5vboxsync void sigStepDone(QString strStepId, int iStepNumber);
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncpublic:
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync /* Constructor: */
0a2ea4969a6ceee3798121b462a0d03a1394065fvboxsync UIBuildStep(QObject *pParent, QObject *pBuildObject, const QString &strStepId, int iStepNumber);
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsyncprivate slots:
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
c6d0c503f95d48f31a8a9fcbcef24d7e56a802c5vboxsync /* Handler: Build stuff: */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync void sltStepDone();
88673d909ab003f20795ffab6bc724d9bd75bbdcvboxsync
88673d909ab003f20795ffab6bc724d9bd75bbdcvboxsyncprivate:
88673d909ab003f20795ffab6bc724d9bd75bbdcvboxsync
88673d909ab003f20795ffab6bc724d9bd75bbdcvboxsync /* Variables: */
88673d909ab003f20795ffab6bc724d9bd75bbdcvboxsync QString m_strStepId;
c6d0c503f95d48f31a8a9fcbcef24d7e56a802c5vboxsync int m_iStepNumber;
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync};
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync#endif /* __UIGDetailsItem_h__ */
54bdb685c29854142c633fceb09a6e0f3bb72132vboxsync