Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItem.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItem.cpp	(revision 42553)
+++ 	(revision )
@@ -1,426 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGSelectorItem class definition
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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 <QApplication>
-#include <QStyle>
-#include <QPainter>
-#include <QGraphicsScene>
-#include <QStyleOptionFocusRect>
-#include <QGraphicsSceneMouseEvent>
-#include <QStateMachine>
-#include <QPropertyAnimation>
-#include <QSignalTransition>
-
-/* GUI includes: */
-#include "UIGSelectorItem.h"
-#include "UIGraphicsSelectorModel.h"
-#include "UIGSelectorItemGroup.h"
-#include "UIGSelectorItemMachine.h"
-
-UIGSelectorItem::UIGSelectorItem(UIGSelectorItem *pParent)
-    : QIGraphicsWidget(pParent)
-    , m_pParent(pParent)
-    , m_dragTokenPlace(DragToken_Off)
-    , m_pHighlightMachine(0)
-    , m_pForwardAnimation(0)
-    , m_pBackwardAnimation(0)
-    , m_iAnimationDuration(300)
-    , m_iDefaultDarkness(115)
-    , m_iHighlightDarkness(90)
-    , m_iGradient(m_iDefaultDarkness)
-{
-    /* Basic item setup: */
-    setOwnedByLayout(false);
-    setAcceptDrops(true);
-    setFocusPolicy(Qt::NoFocus);
-    setFlag(QGraphicsItem::ItemIsSelectable, false);
-
-    /* Non-root item? */
-    if (parentItem())
-    {
-        /* Non-root item setup: */
-        setAcceptHoverEvents(true);
-
-        /* Create state machine: */
-        m_pHighlightMachine = new QStateMachine(this);
-        /* Create 'default' state: */
-        QState *pStateDefault = new QState(m_pHighlightMachine);
-        /* Create 'highlighted' state: */
-        QState *pStateHighlighted = new QState(m_pHighlightMachine);
-
-        /* Forward animation: */
-        m_pForwardAnimation = new QPropertyAnimation(this, "gradient", this);
-        m_pForwardAnimation->setDuration(m_iAnimationDuration);
-        m_pForwardAnimation->setStartValue(m_iDefaultDarkness);
-        m_pForwardAnimation->setEndValue(m_iHighlightDarkness);
-
-        /* Backward animation: */
-        m_pBackwardAnimation = new QPropertyAnimation(this, "gradient", this);
-        m_pBackwardAnimation->setDuration(m_iAnimationDuration);
-        m_pBackwardAnimation->setStartValue(m_iHighlightDarkness);
-        m_pBackwardAnimation->setEndValue(m_iDefaultDarkness);
-
-        /* Add state transitions: */
-        QSignalTransition *pDefaultToHighlighted = pStateDefault->addTransition(this, SIGNAL(sigHoverEnter()), pStateHighlighted);
-        pDefaultToHighlighted->addAnimation(m_pForwardAnimation);
-        QSignalTransition *pHighlightedToDefault = pStateHighlighted->addTransition(this, SIGNAL(sigHoverLeave()), pStateDefault);
-        pHighlightedToDefault->addAnimation(m_pBackwardAnimation);
-
-        /* Setup connections: */
-        connect(this, SIGNAL(sigHoverEnter()), this, SLOT(sltUnhoverParent()));
-
-        /* Initial state is 'default': */
-        m_pHighlightMachine->setInitialState(pStateDefault);
-        /* Start state-machine: */
-        m_pHighlightMachine->start();
-    }
-}
-
-UIGSelectorItem::~UIGSelectorItem()
-{
-    /* If that item is focused: */
-    if (model()->focusItem() == this)
-    {
-        /* Unset the focus/selection: */
-        model()->setFocusItem(0, true);
-    }
-    /* If that item is NOT focused, but selected: */
-    else if (model()->selectionList().contains(this))
-    {
-        /* Remove item from the selection list: */
-        model()->removeFromSelectionList(this);
-    }
-    /* Remove item from the navigation list: */
-    model()->removeFromNavigationList(this);
-}
-
-UIGSelectorItemGroup* UIGSelectorItem::toGroupItem()
-{
-    UIGSelectorItemGroup *pItem = qgraphicsitem_cast<UIGSelectorItemGroup*>(this);
-    AssertMsg(pItem, ("Trying to cast invalid item type to UIGSelectorItemGroup!"));
-    return pItem;
-}
-
-UIGSelectorItemMachine* UIGSelectorItem::toMachineItem()
-{
-    UIGSelectorItemMachine *pItem = qgraphicsitem_cast<UIGSelectorItemMachine*>(this);
-    AssertMsg(pItem, ("Trying to cast invalid item type to UIGSelectorItemMachine!"));
-    return pItem;
-}
-
-UIGraphicsSelectorModel* UIGSelectorItem::model() const
-{
-    UIGraphicsSelectorModel *pModel = qobject_cast<UIGraphicsSelectorModel*>(QIGraphicsWidget::scene()->parent());
-    AssertMsg(pModel, ("Incorrect graphics scene parent set!"));
-    return pModel;
-}
-
-UIGSelectorItem* UIGSelectorItem::parentItem() const
-{
-    return m_pParent;
-}
-
-void UIGSelectorItem::makeSureItsVisible()
-{
-    /* If item is not visible: */
-    if (!isVisible())
-    {
-        /* Get parrent item, assert if can't: */
-        if (UIGSelectorItemGroup *pParentItem = parentItem()->toGroupItem())
-        {
-            /* We should make parent visible: */
-            pParentItem->makeSureItsVisible();
-            /* And make sure its opened: */
-            if (pParentItem->closed())
-                pParentItem->open();
-        }
-    }
-}
-
-void UIGSelectorItem::releaseHover()
-{
-    emit sigHoverLeave();
-}
-
-void UIGSelectorItem::setDragTokenPlace(DragToken where)
-{
-    /* Something changed? */
-    if (m_dragTokenPlace != where)
-    {
-        m_dragTokenPlace = where;
-        update();
-    }
-}
-
-DragToken UIGSelectorItem::dragTokenPlace() const
-{
-    return m_dragTokenPlace;
-}
-
-void UIGSelectorItem::hoverEnterEvent(QGraphicsSceneHoverEvent*)
-{
-    emit sigHoverEnter();
-}
-
-void UIGSelectorItem::hoverLeaveEvent(QGraphicsSceneHoverEvent*)
-{
-    emit sigHoverLeave();
-}
-
-void UIGSelectorItem::mousePressEvent(QGraphicsSceneMouseEvent *pEvent)
-{
-    /* By default, non-moveable and non-selectable items
-     * can't grab mouse-press events which is required
-     * to grab further mouse-move events which we wants... */
-    if (parentItem())
-        pEvent->accept();
-    else
-        pEvent->ignore();
-}
-
-void UIGSelectorItem::mouseMoveEvent(QGraphicsSceneMouseEvent *pEvent)
-{
-    /* Make sure item is really dragged: */
-    if (QLineF(pEvent->screenPos(),
-               pEvent->buttonDownScreenPos(Qt::LeftButton)).length() <
-        QApplication::startDragDistance())
-        return;
-
-    /* Initialize dragging: */
-    QDrag *pDrag = new QDrag(pEvent->widget());
-    model()->setCurrentDragObject(pDrag);
-    pDrag->setPixmap(toPixmap());
-    pDrag->setMimeData(createMimeData());
-    pDrag->exec(Qt::MoveAction | Qt::CopyAction, Qt::MoveAction);
-}
-
-void UIGSelectorItem::dragMoveEvent(QGraphicsSceneDragDropEvent *pEvent)
-{
-    /* Make sure we are non-root: */
-    if (parentItem())
-    {
-        /* Allow drag tokens only for the same item type as current: */
-        bool fAllowDragToken = false;
-        if ((type() == UIGSelectorItemType_Group &&
-             pEvent->mimeData()->hasFormat(UIGSelectorItemGroup::className())) ||
-            (type() == UIGSelectorItemType_Machine &&
-             pEvent->mimeData()->hasFormat(UIGSelectorItemMachine::className())))
-            fAllowDragToken = true;
-        /* Do we need a drag-token? */
-        if (fAllowDragToken)
-        {
-            QPoint p = pEvent->pos().toPoint();
-            if (p.y() < 10)
-                setDragTokenPlace(DragToken_Up);
-            else if (p.y() > minimumSizeHint().toSize().height() - 10)
-                setDragTokenPlace(DragToken_Down);
-            else
-                setDragTokenPlace(DragToken_Off);
-        }
-    }
-    /* Check if drop is allowed: */
-    pEvent->setAccepted(isDropAllowed(pEvent, dragTokenPlace()));
-}
-
-void UIGSelectorItem::dragLeaveEvent(QGraphicsSceneDragDropEvent*)
-{
-    resetDragToken();
-}
-
-void UIGSelectorItem::dropEvent(QGraphicsSceneDragDropEvent *pEvent)
-{
-    /* Do we have token active? */
-    switch (dragTokenPlace())
-    {
-        case DragToken_Off:
-        {
-            /* Its our drop, processing: */
-            processDrop(pEvent);
-            break;
-        }
-        default:
-        {
-            /* Its parent drop, passing: */
-            parentItem()->processDrop(pEvent, this, dragTokenPlace());
-            break;
-        }
-    }
-}
-
-/* static */
-void UIGSelectorItem::configurePainterShape(QPainter *pPainter,
-                                            const QStyleOptionGraphicsItem *pOption,
-                                            int iRadius)
-{
-    /* Rounded corners? */
-    if (iRadius)
-    {
-        /* Setup clipping: */
-        QPainterPath roundedPath;
-        roundedPath.addRoundedRect(pOption->rect, iRadius, iRadius);
-        pPainter->setRenderHint(QPainter::Antialiasing);
-        pPainter->setClipPath(roundedPath);
-    }
-}
-
-/* static */
-void UIGSelectorItem::paintBackground(QPainter *pPainter, const QRect &rect,
-                                      bool fHasParent, bool fIsSelected,
-                                      int iGradientDarkness, DragToken dragTokenWhere,
-                                      int iRadius)
-{
-    /* Save painter: */
-    pPainter->save();
-
-    /* Fill rectangle with brush/color: */
-    QPalette pal = QApplication::palette();
-    QBrush brush = pal.brush(QPalette::Active, QPalette::Base);
-    pPainter->fillRect(rect, brush);
-    pPainter->fillRect(rect, Qt::white);
-
-    /* Prepare color: */
-    QColor base = pal.color(QPalette::Active, fIsSelected ? QPalette::Highlight : QPalette::Window);
-
-    /* Non-root item: */
-    if (fHasParent)
-    {
-        /* Make even less rectangle: */
-        QRect backGroundRect = rect;
-        backGroundRect.setTopLeft(backGroundRect.topLeft() + QPoint(2, 2));
-        backGroundRect.setBottomRight(backGroundRect.bottomRight() - QPoint(2, 2));
-        /* Add even more clipping: */
-        QPainterPath roundedPath;
-        roundedPath.addRoundedRect(backGroundRect, iRadius, iRadius);
-        pPainter->setClipPath(roundedPath);
-
-        /* Calculate top rectangle: */
-        QRect tRect = backGroundRect;
-        tRect.setBottom(tRect.top() + tRect.height() / 3);
-        /* Calculate bottom rectangle: */
-        QRect bRect = backGroundRect;
-        bRect.setTop(bRect.bottom() - bRect.height() / 3);
-        /* Calculate middle rectangle: */
-        QRect midRect = QRect(tRect.bottomLeft(), bRect.topRight());
-
-        /* Prepare top gradient: */
-        QLinearGradient tGradient(tRect.bottomLeft(), tRect.topLeft());
-        tGradient.setColorAt(0, base.darker(104));
-        tGradient.setColorAt(1, base.darker(iGradientDarkness));
-        /* Prepare bottom gradient: */
-        QLinearGradient bGradient(bRect.topLeft(), bRect.bottomLeft());
-        bGradient.setColorAt(0, base.darker(104));
-        bGradient.setColorAt(1, base.darker(iGradientDarkness));
-
-        /* Paint all the stuff: */
-        pPainter->fillRect(midRect, base.darker(104));
-        pPainter->fillRect(tRect, tGradient);
-        pPainter->fillRect(bRect, bGradient);
-
-        /* Paint drag token UP? */
-        if (dragTokenWhere != DragToken_Off)
-        {
-            QLinearGradient dragTokenGradient;
-            QRect dragTokenRect = backGroundRect;
-            if (dragTokenWhere == DragToken_Up)
-            {
-                dragTokenRect.setHeight(5);
-                dragTokenGradient.setStart(dragTokenRect.bottomLeft());
-                dragTokenGradient.setFinalStop(dragTokenRect.topLeft());
-            }
-            else if (dragTokenWhere == DragToken_Down)
-            {
-                dragTokenRect.setTopLeft(dragTokenRect.bottomLeft() - QPoint(0, 5));
-                dragTokenGradient.setStart(dragTokenRect.topLeft());
-                dragTokenGradient.setFinalStop(dragTokenRect.bottomLeft());
-            }
-            dragTokenGradient.setColorAt(0, base.darker(110));
-            dragTokenGradient.setColorAt(1, base.darker(150));
-            pPainter->fillRect(dragTokenRect, dragTokenGradient);
-        }
-    }
-    /* Root item: */
-    else
-    {
-        /* Simple and clear: */
-        pPainter->fillRect(rect, base.darker(100));
-    }
-
-    /* Restore painter: */
-    pPainter->restore();
-}
-
-/* static */
-void UIGSelectorItem::paintFrameRect(QPainter *pPainter, const QRect &rect, bool fIsSelected, int iRadius)
-{
-    pPainter->save();
-    QPalette pal = QApplication::palette();
-    QColor base = pal.color(QPalette::Active, fIsSelected ? QPalette::Highlight : QPalette::Window);
-    pPainter->setPen(base.darker(160));
-    if (iRadius)
-        pPainter->drawRoundedRect(rect, iRadius, iRadius);
-    else
-        pPainter->drawRect(rect);
-    pPainter->restore();
-}
-
-/* static */
-void UIGSelectorItem::paintPixmap(QPainter *pPainter, const QRect &rect, const QPixmap &pixmap)
-{
-    pPainter->drawPixmap(rect, pixmap);
-}
-
-/* static */
-void UIGSelectorItem::paintText(QPainter *pPainter, const QRect &rect, const QFont &font, const QString &strText)
-{
-    pPainter->setFont(font);
-    pPainter->drawText(rect, strText);
-}
-
-/* static */
-void UIGSelectorItem::paintFocus(QPainter *pPainter, const QRect &rect)
-{
-    QStyleOptionFocusRect option;
-    option.rect = rect;
-    QApplication::style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, pPainter);
-}
-
-void UIGSelectorItem::sltUnhoverParent()
-{
-    AssertMsg(parentItem(), ("There should be a parent!"));
-    parentItem()->releaseHover();
-}
-
-UIGSelectorItemMimeData::UIGSelectorItemMimeData(UIGSelectorItem *pItem)
-    : m_pItem(pItem)
-{
-}
-
-bool UIGSelectorItemMimeData::hasFormat(const QString &strMimeType) const
-{
-    if (strMimeType == QString(m_pItem->metaObject()->className()))
-        return true;
-    return false;
-}
-
-UIGSelectorItem* UIGSelectorItemMimeData::item() const
-{
-    return m_pItem;
-}
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItem.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItem.h	(revision 42553)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGSelectorItem class declaration
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-#ifndef __UIGSelectorItem_h__
-#define __UIGSelectorItem_h__
-
-/* Qt includes: */
-#include <QMimeData>
-
-/* GUI includes: */
-#include "QIGraphicsWidget.h"
-
-/* Forward declaration: */
-class UIGraphicsSelectorModel;
-class UIGSelectorItemGroup;
-class UIGSelectorItemMachine;
-class QGraphicsSceneHoverEvent;
-class QGraphicsSceneMouseEvent;
-class QGraphicsSceneDragDropEvent;
-class QStateMachine;
-class QPropertyAnimation;
-
-/* UIGSelectorItem types: */
-enum UIGSelectorItemType
-{
-    UIGSelectorItemType_Any     = QGraphicsItem::UserType,
-    UIGSelectorItemType_Group   = QGraphicsItem::UserType + 1,
-    UIGSelectorItemType_Machine = QGraphicsItem::UserType + 2
-};
-
-/* Drag token placement: */
-enum DragToken { DragToken_Off, DragToken_Up, DragToken_Down };
-
-/* Graphics item interface
- * for graphics selector model/view architecture: */
-class UIGSelectorItem : public QIGraphicsWidget
-{
-    Q_OBJECT;
-    Q_PROPERTY(int gradient READ gradient WRITE setGradient);
-
-signals:
-
-    /* Hover signals: */
-    void sigHoverEnter();
-    void sigHoverLeave();
-
-public:
-
-    /* Constructor/destructor: */
-    UIGSelectorItem(UIGSelectorItem *pParent);
-    ~UIGSelectorItem();
-
-    /* API: Cast stuff: */
-    UIGSelectorItemGroup* toGroupItem();
-    UIGSelectorItemMachine* toMachineItem();
-
-    /* API: Model stuff: */
-    UIGraphicsSelectorModel* model() const;
-
-    /* API: Parent stuff: */
-    UIGSelectorItem* parentItem() const;
-
-    /* API: Basic stuff: */
-    virtual void startEditing() = 0;
-    virtual QString name() const = 0;
-
-    /* API: Children stuff: */
-    virtual void addItem(UIGSelectorItem *pItem, int iPosition) = 0;
-    virtual void removeItem(UIGSelectorItem *pItem) = 0;
-    virtual void moveItemTo(UIGSelectorItem *pItem, int iPosition) = 0;
-    virtual QList<UIGSelectorItem*> items(UIGSelectorItemType type = UIGSelectorItemType_Any) const = 0;
-    virtual bool hasItems(UIGSelectorItemType type = UIGSelectorItemType_Any) const = 0;
-    virtual void clearItems(UIGSelectorItemType type = UIGSelectorItemType_Any) = 0;
-
-    /* API: Layout stuff: */
-    virtual void updateSizeHint() = 0;
-    virtual void updateLayout() = 0;
-    virtual int minimumWidthHint() const = 0;
-    virtual int minimumHeightHint() const = 0;
-
-    /* API: Navigation stuff: */
-    virtual void makeSureItsVisible();
-
-    /* API: Hover stuff: */
-    void releaseHover();
-
-    /* API: Drag and drop stuff: */
-    virtual QPixmap toPixmap() = 0;
-    virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where = DragToken_Off) const = 0;
-    virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIGSelectorItem *pFromWho = 0, DragToken where = DragToken_Off) = 0;
-    virtual void resetDragToken() = 0;
-    void setDragTokenPlace(DragToken where);
-    DragToken dragTokenPlace() const;
-
-protected:
-
-    /* Hover-enter event: */
-    void hoverEnterEvent(QGraphicsSceneHoverEvent *pEvent);
-    /* Hover-leave event: */
-    void hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent);
-    /* Mouse-press event: */
-    void mousePressEvent(QGraphicsSceneMouseEvent *pEvent);
-    /* Mouse-move event: */
-    void mouseMoveEvent(QGraphicsSceneMouseEvent *pEvent);
-    /* Drag-move event: */
-    void dragMoveEvent(QGraphicsSceneDragDropEvent *pEvent);
-    /* Drag-leave event: */
-    void dragLeaveEvent(QGraphicsSceneDragDropEvent *pEvent);
-    /* Drop event: */
-    void dropEvent(QGraphicsSceneDragDropEvent *pEvent);
-
-    /* Static paint stuff: */
-    static void configurePainterShape(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, int iRadius);
-    static void paintBackground(QPainter *pPainter, const QRect &rect,
-                                bool fHasParent, bool fIsSelected,
-                                int iGradientDarkness, DragToken dragTokenWhere,
-                                int iRadius);
-    static void paintFrameRect(QPainter *pPainter, const QRect &rect, bool fIsSelected, int iRadius);
-    static void paintPixmap(QPainter *pPainter, const QRect &rect, const QPixmap &pixmap);
-    static void paintText(QPainter *pPainter, const QRect &rect, const QFont &font, const QString &strText);
-    static void paintFocus(QPainter *pPainter, const QRect &rect);
-
-    /* Helpers: Drag and drop stuff: */
-    virtual QMimeData* createMimeData() = 0;
-
-    /* Gradient animation (property) stuff: */
-    int gradient() const { return m_iGradient; }
-    void setGradient(int iGradient) { m_iGradient = iGradient; update(); }
-
-private slots:
-
-    /* Private handlers: Hover stuff: */
-    void sltUnhoverParent();
-
-private:
-
-    /* Variables: */
-    UIGSelectorItem *m_pParent;
-    DragToken m_dragTokenPlace;
-
-    /* Highlight animation stuff: */
-    QStateMachine *m_pHighlightMachine;
-    QPropertyAnimation *m_pForwardAnimation;
-    QPropertyAnimation *m_pBackwardAnimation;
-    int m_iAnimationDuration;
-    int m_iDefaultDarkness;
-    int m_iHighlightDarkness;
-    int m_iGradient;
-};
-
-/* Mime-data for graphics item interface: */
-class UIGSelectorItemMimeData : public QMimeData
-{
-    Q_OBJECT;
-
-public:
-
-    /* Constructor: */
-    UIGSelectorItemMimeData(UIGSelectorItem *pItem);
-
-    /* API: Format checker: */
-    bool hasFormat(const QString &strMimeType) const;
-
-    /* API: Item getter: */
-    UIGSelectorItem* item() const;
-
-private:
-
-    /* Variables: */
-    UIGSelectorItem *m_pItem;
-};
-
-#endif /* __UIGSelectorItem_h__ */
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItemGroup.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItemGroup.cpp	(revision 42553)
+++ 	(revision )
@@ -1,1042 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGSelectorItemGroup class implementation
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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 <QPainter>
-#include <QStyleOptionGraphicsItem>
-#include <QGraphicsSceneDragDropEvent>
-#include <QPropertyAnimation>
-#include <QLineEdit>
-#include <QGraphicsProxyWidget>
-
-/* GUI includes: */
-#include "UIGSelectorItemGroup.h"
-#include "UIGSelectorItemMachine.h"
-#include "UIGraphicsSelectorModel.h"
-#include "UIIconPool.h"
-#include "UIGraphicsRotatorButton.h"
-
-/* static */
-QString UIGSelectorItemGroup::className() { return "UIGSelectorItemGroup"; }
-
-UIGSelectorItemGroup::UIGSelectorItemGroup(UIGSelectorItem *pParent /* = 0 */,
-                                           const QString &strName /* = QString() */,
-                                           int iPosition /* = -1 */)
-    : UIGSelectorItem(pParent)
-    , m_strName(strName)
-    , m_fClosed(parentItem() ? true : false)
-    , m_pButton(0)
-    , m_pNameEditorWidget(0)
-    , m_pNameEditor(0)
-    , m_iAdditionalHeight(0)
-    , m_iCornerRadius(6)
-{
-    /* Prepare: */
-    prepare();
-
-    /* Add item to the parent: */
-    if (parentItem())
-        parentItem()->addItem(this, iPosition);
-}
-
-UIGSelectorItemGroup::UIGSelectorItemGroup(UIGSelectorItem *pParent,
-                                           UIGSelectorItemGroup *pCopyFrom,
-                                           int iPosition /* = -1 */)
-    : UIGSelectorItem(pParent)
-    , m_strName(pCopyFrom->name())
-    , m_fClosed(pCopyFrom->closed())
-    , m_pButton(0)
-    , m_pNameEditorWidget(0)
-    , m_pNameEditor(0)
-    , m_iAdditionalHeight(0)
-    , m_iCornerRadius(6)
-{
-    /* Prepare: */
-    prepare();
-
-    /* Copy content to 'this': */
-    copyContent(pCopyFrom, this);
-
-    /* Add item to the parent: */
-    if (parentItem())
-        parentItem()->addItem(this, iPosition);
-}
-
-UIGSelectorItemGroup::~UIGSelectorItemGroup()
-{
-    /* Delete all the items: */
-    clearItems();
-
-    /* Remove item from the parent: */
-    if (parentItem())
-        parentItem()->removeItem(this);
-}
-
-QString UIGSelectorItemGroup::name() const
-{
-    return m_strName;
-}
-
-bool UIGSelectorItemGroup::closed() const
-{
-    return m_fClosed;
-}
-
-bool UIGSelectorItemGroup::opened() const
-{
-    return !m_fClosed;
-}
-
-void UIGSelectorItemGroup::close()
-{
-    AssertMsg(parentItem(), ("Can't close root-item!"));
-    m_pButton->setToggled(false);
-}
-
-void UIGSelectorItemGroup::open()
-{
-    AssertMsg(parentItem(), ("Can't open root-item!"));
-    m_pButton->setToggled(true);
-}
-
-void UIGSelectorItemGroup::sltOpen()
-{
-    AssertMsg(parentItem(), ("Can't open root-item!"));
-    m_pButton->setToggled(true, false);
-}
-
-bool UIGSelectorItemGroup::contains(const QString &strId, bool fRecursively /* = false */) const
-{
-    /* Check machine items: */
-    foreach (UIGSelectorItem *pItem, m_machineItems)
-        if (pItem->toMachineItem()->id() == strId)
-            return true;
-    /* If recursively => check group items: */
-    if (fRecursively)
-        foreach (UIGSelectorItem *pItem, m_groupItems)
-            if (pItem->toGroupItem()->contains(strId, fRecursively))
-                return true;
-    return false;
-}
-
-void UIGSelectorItemGroup::sltNameEditingFinished()
-{
-    /* Lock name-editor: */
-    m_pNameEditor->hide();
-
-    /* Update group name: */
-    QString strNewName = m_pNameEditorWidget->text();
-    if (!strNewName.isEmpty())
-        m_strName = strNewName;
-}
-
-void UIGSelectorItemGroup::sltGroupToggleStart()
-{
-    /* Not for root-item: */
-    AssertMsg(parentItem(), ("Can't toggle root-item!"));
-
-    /* Setup animation: */
-    updateAnimationParameters();
-
-    /* Group closed, we are opening it: */
-    if (m_fClosed)
-    {
-        /* Toggle-state and navigation will be
-         * updated on toggle finish signal! */
-    }
-    /* Group opened, we are closing it: */
-    else
-    {
-        /* Update toggle-state: */
-        m_fClosed = true;
-        /* Update navigation: */
-        model()->updateNavigation();
-        /* Relayout model: */
-        model()->updateLayout();
-    }
-}
-
-void UIGSelectorItemGroup::sltGroupToggleFinish(bool fToggled)
-{
-    /* Not for root-item: */
-    AssertMsg(parentItem(), ("Can't toggle root-item!"));
-
-    /* Update toggle-state: */
-    m_fClosed = !fToggled;
-    /* Update navigation: */
-    model()->updateNavigation();
-    /* Relayout model: */
-    model()->updateLayout();
-}
-
-QVariant UIGSelectorItemGroup::data(int iKey) const
-{
-    /* Provide other members with required data: */
-    switch (iKey)
-    {
-        /* Layout hints: */
-        case GroupItemData_HorizonalMargin: return parentItem() ? 8 : 1;
-        case GroupItemData_VerticalMargin: return parentItem() ? 2 : 1;
-        case GroupItemData_MajorSpacing: return parentItem() ? 10 : 0;
-        case GroupItemData_MinorSpacing: return 1;
-        /* Pixmaps: */
-        case GroupItemData_ButtonPixmap: return UIIconPool::iconSet(":/arrow_right_10px.png");
-        case GroupItemData_GroupPixmap: return UIIconPool::iconSet(":/nw_16px.png");
-        case GroupItemData_MachinePixmap: return UIIconPool::iconSet(":/machine_16px.png");
-        /* Fonts: */
-        case GroupItemData_NameFont:
-        {
-            QFont nameFont = font();
-            nameFont.setWeight(QFont::Bold);
-            return nameFont;
-        }
-        case GroupItemData_InfoFont:
-        {
-            QFont infoFont = font();
-            return infoFont;
-        }
-        /* Texts: */
-        case GroupItemData_Name: return m_strName;
-        case GroupItemData_GroupCountText: return QString::number(m_groupItems.size());
-        case GroupItemData_MachineCountText: return QString::number(m_machineItems.size());
-        /* Sizes: */
-        case GroupItemData_ButtonSize: return m_pButton ? m_pButton->minimumSizeHint() : QSizeF(0, 0);
-        case GroupItemData_NameSize:
-        {
-            if (!parentItem())
-                return QSizeF(0, 0);
-            QFontMetrics fm(data(GroupItemData_NameFont).value<QFont>());
-            return QSize(fm.width(data(GroupItemData_Name).toString()), fm.height());
-        }
-        case GroupItemData_NameEditorSize:
-        {
-            if (!parentItem())
-                return QSizeF(0, 0);
-            return m_pNameEditorWidget->minimumSizeHint();
-        }
-        case GroupItemData_GroupPixmapSize:
-            return parentItem() ? data(GroupItemData_GroupPixmap).value<QIcon>().availableSizes().at(0) : QSizeF(0, 0);
-        case GroupItemData_MachinePixmapSize:
-            return parentItem() ? data(GroupItemData_MachinePixmap).value<QIcon>().availableSizes().at(0) : QSizeF(0, 0);
-        case GroupItemData_GroupCountTextSize:
-        {
-            if (!parentItem())
-                return QSizeF(0, 0);
-            QFontMetrics fm(data(GroupItemData_InfoFont).value<QFont>());
-            return QSize(fm.width(data(GroupItemData_GroupCountText).toString()), fm.height());
-        }
-        case GroupItemData_MachineCountTextSize:
-        {
-            if (!parentItem())
-                return QSizeF(0, 0);
-            QFontMetrics fm(data(GroupItemData_InfoFont).value<QFont>());
-            return QSize(fm.width(data(GroupItemData_MachineCountText).toString()), fm.height());
-        }
-        case GroupItemData_FullHeaderSize:
-        {
-            /* Prepare variables: */
-            int iMajorSpacing = data(GroupItemData_MajorSpacing).toInt();
-            int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
-            QSize buttonSize = data(GroupItemData_ButtonSize).toSize();
-            QSize nameSize = data(GroupItemData_NameSize).toSize();
-            QSize nameEditorSize = data(GroupItemData_NameEditorSize).toSize();
-            QSize groupPixmapSize = data(GroupItemData_GroupPixmapSize).toSize();
-            QSize machinePixmapSize = data(GroupItemData_MachinePixmapSize).toSize();
-            QSize groupCountTextSize = data(GroupItemData_GroupCountTextSize).toSize();
-            QSize machineCountTextSize = data(GroupItemData_MachineCountTextSize).toSize();
-
-            /* Calculate minimum width: */
-            int iGroupItemHeaderWidth = /* Button width: */
-                                        buttonSize.width() +
-                                        /* Spacing between button and name: */
-                                        iMajorSpacing +
-                                        /* Some hardcoded magic: */
-                                        1 /* frame width from Qt sources */ +
-                                        2 /* internal QLineEdit margin from Qt sources */ +
-                                        1 /* internal QLineEdit align shifting from Qt sources */ +
-                                        /* Name width: */
-                                        nameSize.width() +
-                                        /* Spacing between name and info: */
-                                        iMajorSpacing +
-                                        /* Group stuff width: */
-                                        groupPixmapSize.width() + iMinorSpacing +
-                                        groupCountTextSize.width() + iMinorSpacing +
-                                        /* Machine stuff width: */
-                                        machinePixmapSize.width() + iMinorSpacing +
-                                        machineCountTextSize.width();
-
-            /* Search for maximum height: */
-            QList<int> heights;
-            heights << buttonSize.height()
-                    << nameSize.height() << nameEditorSize.height()
-                    << groupPixmapSize.height() << machinePixmapSize.height()
-                    << groupCountTextSize.height() << machineCountTextSize.height();
-            int iGroupItemHeaderHeight = 0;
-            foreach (int iHeight, heights)
-                iGroupItemHeaderHeight = qMax(iGroupItemHeaderHeight, iHeight);
-
-            /* Return result: */
-            return QSize(iGroupItemHeaderWidth, iGroupItemHeaderHeight);
-        }
-        /* Default: */
-        default: break;
-    }
-    return QVariant();
-}
-
-void UIGSelectorItemGroup::startEditing()
-{
-    /* Not for root-item: */
-    AssertMsg(parentItem(), ("Can't edit root-item!"));
-    /* Unlock name-editor: */
-    m_pNameEditor->show();
-    m_pNameEditorWidget->setFocus();
-}
-
-void UIGSelectorItemGroup::addItem(UIGSelectorItem *pItem, int iPosition)
-{
-    /* Check item type: */
-    switch (pItem->type())
-    {
-        case UIGSelectorItemType_Group:
-        {
-            if (iPosition < 0 || iPosition >= m_groupItems.size())
-                m_groupItems.append(pItem);
-            else
-                m_groupItems.insert(iPosition, pItem);
-            break;
-        }
-        case UIGSelectorItemType_Machine:
-        {
-            if (iPosition < 0 || iPosition >= m_machineItems.size())
-                m_machineItems.append(pItem);
-            else
-                m_machineItems.insert(iPosition, pItem);
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed(("Invalid item type!"));
-            break;
-        }
-    }
-}
-
-void UIGSelectorItemGroup::removeItem(UIGSelectorItem *pItem)
-{
-    /* Check item type: */
-    switch (pItem->type())
-    {
-        case UIGSelectorItemType_Group:
-        {
-            m_groupItems.removeAt(m_groupItems.indexOf(pItem));
-            break;
-        }
-        case UIGSelectorItemType_Machine:
-        {
-            m_machineItems.removeAt(m_machineItems.indexOf(pItem));
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed(("Invalid item type!"));
-            break;
-        }
-    }
-}
-
-void UIGSelectorItemGroup::moveItemTo(UIGSelectorItem *pItem, int iPosition)
-{
-    /* Check item type: */
-    switch (pItem->type())
-    {
-        case UIGSelectorItemType_Group:
-        {
-            AssertMsg(m_groupItems.contains(pItem), ("Passed item is not our child!"));
-            m_groupItems.removeAt(m_groupItems.indexOf(pItem));
-            if (iPosition < 0 || iPosition >= m_groupItems.size())
-                m_groupItems.append(pItem);
-            else
-                m_groupItems.insert(iPosition, pItem);
-            break;
-        }
-        case UIGSelectorItemType_Machine:
-        {
-            AssertMsg(m_machineItems.contains(pItem), ("Passed item is not our child!"));
-            m_machineItems.removeAt(m_machineItems.indexOf(pItem));
-            if (iPosition < 0 || iPosition >= m_machineItems.size())
-                m_machineItems.append(pItem);
-            else
-                m_machineItems.insert(iPosition, pItem);
-            break;
-        }
-        default:
-        {
-            AssertMsgFailed(("Invalid item type!"));
-            break;
-        }
-    }
-}
-
-QList<UIGSelectorItem*> UIGSelectorItemGroup::items(UIGSelectorItemType type) const
-{
-    switch (type)
-    {
-        case UIGSelectorItemType_Any: return items(UIGSelectorItemType_Group) + items(UIGSelectorItemType_Machine);
-        case UIGSelectorItemType_Group: return m_groupItems;
-        case UIGSelectorItemType_Machine: return m_machineItems;
-        default: break;
-    }
-    return QList<UIGSelectorItem*>();
-}
-
-bool UIGSelectorItemGroup::hasItems(UIGSelectorItemType type /* = UIGSelectorItemType_Any */) const
-{
-    switch (type)
-    {
-        case UIGSelectorItemType_Any:
-            return hasItems(UIGSelectorItemType_Group) || hasItems(UIGSelectorItemType_Machine);
-        case UIGSelectorItemType_Group:
-            return !m_groupItems.isEmpty();
-        case UIGSelectorItemType_Machine:
-            return !m_machineItems.isEmpty();
-    }
-    return false;
-}
-
-void UIGSelectorItemGroup::clearItems(UIGSelectorItemType type /* = UIGSelectorItemType_Any */)
-{
-    switch (type)
-    {
-        case UIGSelectorItemType_Any:
-        {
-            clearItems(UIGSelectorItemType_Group);
-            clearItems(UIGSelectorItemType_Machine);
-            break;
-        }
-        case UIGSelectorItemType_Group:
-        {
-            while (!m_groupItems.isEmpty()) { delete m_groupItems.last(); }
-            break;
-        }
-        case UIGSelectorItemType_Machine:
-        {
-            while (!m_machineItems.isEmpty()) { delete m_machineItems.last(); }
-            break;
-        }
-    }
-}
-
-void UIGSelectorItemGroup::updateSizeHint()
-{
-    /* Update size-hints for all the items: */
-    foreach (UIGSelectorItem *pItem, items())
-        pItem->updateSizeHint();
-    /* Update size-hint for this item: */
-    updateGeometry();
-}
-
-void UIGSelectorItemGroup::updateLayout()
-{
-    /* Prepare variables: */
-    int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
-    int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
-    int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
-    int iButtonHeight = data(GroupItemData_ButtonSize).toSize().height();
-    int iButtonWidth = data(GroupItemData_ButtonSize).toSize().width();
-    int iNameEditorHeight = data(GroupItemData_NameEditorSize).toSize().height();
-    int iFullHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();
-    int iPreviousVerticalIndent = 0;
-
-    /* Header (non-root item): */
-    if (parentItem())
-    {
-        /* Layout button: */
-        int iButtonX = iHorizontalMargin;
-        int iButtonY = iButtonHeight == iFullHeaderHeight ? iVerticalMargin :
-                       iVerticalMargin + (iFullHeaderHeight - iButtonHeight) / 2;
-        m_pButton->setPos(iButtonX, iButtonY);
-
-        /* Layout name-editor: */
-        int iNameEditorX = iHorizontalMargin + iButtonWidth + iMinorSpacing;
-        int iNameEditorY = iNameEditorHeight == iFullHeaderHeight ? iVerticalMargin :
-                           iVerticalMargin + (iFullHeaderHeight - iNameEditorHeight) / 2;
-        m_pNameEditor->setPos(iNameEditorX, iNameEditorY);
-        m_pNameEditorWidget->resize(geometry().width() - iNameEditorX - iHorizontalMargin, m_pNameEditorWidget->height());
-
-        /* Prepare body indent: */
-        iPreviousVerticalIndent = 2 * iVerticalMargin + iFullHeaderHeight;
-    }
-    /* Header (root item): */
-    else
-    {
-        /* Prepare body indent: */
-        iPreviousVerticalIndent = iVerticalMargin;
-    }
-
-    /* No body for closed group: */
-    if (m_fClosed)
-    {
-        /* Hide all the items: */
-        foreach (UIGSelectorItem *pItem, items())
-            if (pItem->isVisible())
-                pItem->hide();
-    }
-    /* Body for opened group: */
-    else
-    {
-        /* Prepare variables: */
-        int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
-        QSize size = geometry().size().toSize();
-        /* Layout all the items: */
-        foreach (UIGSelectorItem *pItem, items())
-        {
-            /* Show if hidden: */
-            if (!pItem->isVisible())
-                pItem->show();
-            /* Get item's height-hint: */
-            int iMinimumHeight = pItem->minimumHeightHint();
-            /* Set item's position: */
-            pItem->setPos(iHorizontalMargin, iPreviousVerticalIndent);
-            /* Set item's size: */
-            pItem->resize(size.width() - 2 * iHorizontalMargin, iMinimumHeight);
-            /* Relayout group: */
-            pItem->updateLayout();
-            /* Update indent for next items: */
-            iPreviousVerticalIndent += (iMinimumHeight + iMinorSpacing);
-        }
-    }
-}
-
-int UIGSelectorItemGroup::minimumWidthHint(bool fClosedGroup) const
-{
-    /* Prepare variables: */
-    int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
-    QSize fullHeaderSize = data(GroupItemData_FullHeaderSize).toSize();
-
-    /* Calculating proposed width: */
-    int iProposedWidth = 0;
-
-    /* Simple group item have 2 margins - left and right: */
-    iProposedWidth += 2 * iHorizontalMargin;
-    /* And full header width to take into account: */
-    iProposedWidth += fullHeaderSize.width();
-    /* But if group is opened: */
-    if (!fClosedGroup)
-    {
-        /* We have to make sure that we had taken into account: */
-        foreach (UIGSelectorItem *pItem, items())
-        {
-            int iItemWidth = 2 * iHorizontalMargin + pItem->minimumWidthHint();
-            iProposedWidth = qMax(iProposedWidth, iItemWidth);
-        }
-    }
-
-    /* Return result: */
-    return iProposedWidth;
-}
-
-int UIGSelectorItemGroup::minimumHeightHint(bool fClosedGroup) const
-{
-    /* Prepare variables: */
-    int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
-    int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
-    int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
-    QSize fullHeaderSize = data(GroupItemData_FullHeaderSize).toSize();
-
-    /* Calculating proposed height: */
-    int iProposedHeight = 0;
-
-    /* Simple group item have 2 margins - top and bottom: */
-    iProposedHeight += 2 * iVerticalMargin;
-    /* And full header height to take into account: */
-    iProposedHeight += fullHeaderSize.height();
-    /* But if group is opened: */
-    if (!fClosedGroup)
-    {
-        /* We should take into account: */
-        for (int i = 0; i < m_groupItems.size(); ++i)
-        {
-            /* Every group item height: */
-            UIGSelectorItem *pItem = m_groupItems[i];
-            iProposedHeight += pItem->minimumHeightHint();
-            /* And every spacing between sub-groups: */
-            if (i < m_groupItems.size() - 1)
-                iProposedHeight += iMinorSpacing;
-        }
-        /* Minor spacing between group and machine item: */
-        if (hasItems(UIGSelectorItemType_Group) && hasItems(UIGSelectorItemType_Machine))
-            iProposedHeight += iMinorSpacing;
-        for (int i = 0; i < m_machineItems.size(); ++i)
-        {
-            /* Every machine item height: */
-            UIGSelectorItem *pItem = m_machineItems[i];
-            iProposedHeight += pItem->minimumHeightHint();
-            /* And every spacing between sub-machines: */
-            if (i < m_machineItems.size() - 1)
-                iProposedHeight += iMinorSpacing;
-        }
-        /* Bottom margin: */
-        iProposedHeight += iHorizontalMargin;
-    }
-    /* Finally, additional height during animation: */
-    if (fClosedGroup && m_pButton && m_pButton->isAnimationRunning())
-        iProposedHeight += m_iAdditionalHeight;
-
-    /* Return result: */
-    return iProposedHeight;
-}
-
-int UIGSelectorItemGroup::minimumWidthHint() const
-{
-    return minimumWidthHint(m_fClosed);
-}
-
-int UIGSelectorItemGroup::minimumHeightHint() const
-{
-    return minimumHeightHint(m_fClosed);
-}
-
-QSizeF UIGSelectorItemGroup::minimumSizeHint(bool fClosedGroup) const
-{
-    return QSizeF(minimumWidthHint(fClosedGroup), minimumHeightHint(fClosedGroup));
-}
-
-QSizeF UIGSelectorItemGroup::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const
-{
-    /* If Qt::MinimumSize requested: */
-    if (which == Qt::MinimumSize)
-        return minimumSizeHint(m_fClosed);
-    /* Else call to base-class: */
-    return UIGSelectorItem::sizeHint(which, constraint);
-}
-
-QPixmap UIGSelectorItemGroup::toPixmap()
-{
-    QSize minimumSize = minimumSizeHint(true).toSize();
-    QPixmap pixmap(minimumSize);
-    QPainter painter(&pixmap);
-    QStyleOptionGraphicsItem options;
-    options.rect = QRect(QPoint(0, 0), minimumSize);
-    paint(&painter, &options, true);
-    return pixmap;
-}
-
-bool UIGSelectorItemGroup::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const
-{
-    /* Get mime: */
-    const QMimeData *pMimeData = pEvent->mimeData();
-    /* If drag token is shown, its up to parent to decide: */
-    if (where != DragToken_Off)
-        return parentItem()->isDropAllowed(pEvent);
-    /* Else we should check mime format: */
-    if (pMimeData->hasFormat(UIGSelectorItemGroup::className()))
-    {
-        /* Get passed group item: */
-        const UIGSelectorItemMimeData *pCastedMimeData = qobject_cast<const UIGSelectorItemMimeData*>(pMimeData);
-        AssertMsg(pCastedMimeData, ("Can't cast passed mime-data to UIGSelectorItemMimeData!"));
-        UIGSelectorItem *pItem = pCastedMimeData->item();
-        /* Make sure passed group is not 'this': */
-        if (pItem == this)
-            return false;
-        /* Make sure passed group is not among our parents: */
-        const UIGSelectorItem *pTestedWidget = this;
-        while (UIGSelectorItem *pParentOfTestedWidget = pTestedWidget->parentItem())
-        {
-            if (pItem == pParentOfTestedWidget)
-                return false;
-            pTestedWidget = pParentOfTestedWidget;
-        }
-        return true;
-    }
-    else if (pMimeData->hasFormat(UIGSelectorItemMachine::className()))
-    {
-        /* Get passed machine item: */
-        const UIGSelectorItemMimeData *pCastedMimeData = qobject_cast<const UIGSelectorItemMimeData*>(pMimeData);
-        AssertMsg(pCastedMimeData, ("Can't cast passed mime-data to UIGSelectorItemMimeData!"));
-        UIGSelectorItem *pItem = pCastedMimeData->item();
-        switch (pEvent->proposedAction())
-        {
-            case Qt::MoveAction:
-            {
-                /* Make sure passed item is ours or there is no other item with such id: */
-                return m_machineItems.contains(pItem) || !contains(pItem->toMachineItem()->id());
-            }
-            case Qt::CopyAction:
-            {
-                /* Make sure there is no other item with such id: */
-                return !contains(pItem->toMachineItem()->id());
-            }
-        }
-    }
-    /* That was invalid mime: */
-    return false;
-}
-
-void UIGSelectorItemGroup::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIGSelectorItem *pFromWho, DragToken where)
-{
-    /* Get mime: */
-    const QMimeData *pMime = pEvent->mimeData();
-    /* Check mime format: */
-    if (pMime->hasFormat(UIGSelectorItemGroup::className()))
-    {
-        switch (pEvent->proposedAction())
-        {
-            case Qt::MoveAction:
-            case Qt::CopyAction:
-            {
-                /* Remember scene: */
-                UIGraphicsSelectorModel *pModel = model();
-
-                /* Get passed group item: */
-                const UIGSelectorItemMimeData *pCastedMime = qobject_cast<const UIGSelectorItemMimeData*>(pMime);
-                AssertMsg(pCastedMime, ("Can't cast passed mime-data to UIGSelectorItemMimeData!"));
-                UIGSelectorItem *pItem = pCastedMime->item();
-
-                /* Check if we have position information: */
-                int iPosition = m_groupItems.size();
-                if (pFromWho && where != DragToken_Off)
-                {
-                    /* Make sure sender item if our child: */
-                    AssertMsg(m_groupItems.contains(pFromWho), ("Sender item is NOT our child!"));
-                    if (m_groupItems.contains(pFromWho))
-                    {
-                        iPosition = m_groupItems.indexOf(pFromWho);
-                        if (where == DragToken_Down)
-                            ++iPosition;
-                    }
-                }
-
-                /* Copy passed item into this group: */
-                UIGSelectorItem *pNewGroupItem = new UIGSelectorItemGroup(this, pItem->toGroupItem(), iPosition);
-
-                /* If proposed action is 'move': */
-                if (pEvent->proposedAction() == Qt::MoveAction)
-                {
-                    /* Delete passed item: */
-                    delete pItem;
-                }
-
-                /* Update scene: */
-                pModel->updateGroupTree();
-                pModel->updateNavigation();
-                pModel->updateLayout();
-                pModel->setCurrentItem(pNewGroupItem->parentItem()->toGroupItem()->opened() ?
-                                       pNewGroupItem : pNewGroupItem->parentItem());
-                break;
-            }
-            default:
-                break;
-        }
-    }
-    else if (pMime->hasFormat(UIGSelectorItemMachine::className()))
-    {
-        switch (pEvent->proposedAction())
-        {
-            case Qt::MoveAction:
-            case Qt::CopyAction:
-            {
-                /* Remember scene: */
-                UIGraphicsSelectorModel *pModel = model();
-
-                /* Get passed item: */
-                const UIGSelectorItemMimeData *pCastedMime = qobject_cast<const UIGSelectorItemMimeData*>(pMime);
-                AssertMsg(pCastedMime, ("Can't cast passed mime-data to UIGSelectorItemMimeData!"));
-                UIGSelectorItem *pItem = pCastedMime->item();
-
-                /* Check if we have position information: */
-                int iPosition = m_machineItems.size();
-                if (pFromWho && where != DragToken_Off)
-                {
-                    /* Make sure sender item if our child: */
-                    AssertMsg(m_machineItems.contains(pFromWho), ("Sender item is NOT our child!"));
-                    if (m_machineItems.contains(pFromWho))
-                    {
-                        iPosition = m_machineItems.indexOf(pFromWho);
-                        if (where == DragToken_Down)
-                            ++iPosition;
-                    }
-                }
-
-                /* Copy passed machine item into this group: */
-                UIGSelectorItem *pNewMachineItem = new UIGSelectorItemMachine(this, pItem->toMachineItem(), iPosition);
-
-                /* If proposed action is 'move': */
-                if (pEvent->proposedAction() == Qt::MoveAction)
-                {
-                    /* Delete passed item: */
-                    delete pItem;
-                }
-
-                /* Update scene: */
-                pModel->updateGroupTree();
-                pModel->updateNavigation();
-                pModel->updateLayout();
-                pModel->setCurrentItem(pNewMachineItem->parentItem()->toGroupItem()->opened() ?
-                                       pNewMachineItem : pNewMachineItem->parentItem());
-                break;
-            }
-            default:
-                break;
-        }
-    }
-}
-
-void UIGSelectorItemGroup::resetDragToken()
-{
-    /* Reset drag token for this item: */
-    if (dragTokenPlace() != DragToken_Off)
-    {
-        setDragTokenPlace(DragToken_Off);
-        update();
-    }
-    /* Reset drag tokens for all the items: */
-    foreach (UIGSelectorItem *pItem, items())
-        pItem->resetDragToken();
-}
-
-QMimeData* UIGSelectorItemGroup::createMimeData()
-{
-    return new UIGSelectorItemMimeData(this);
-}
-
-void UIGSelectorItemGroup::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget* /* pWidget = 0 */)
-{
-    paint(pPainter, pOption, m_fClosed);
-}
-
-void UIGSelectorItemGroup::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, bool fClosedGroup)
-{
-    /* Non-root item: */
-    if (parentItem())
-    {
-        /* Configure painter shape: */
-        configurePainterShape(pPainter, pOption, m_iCornerRadius);
-    }
-
-    /* Any item: */
-    {
-        /* Paint decorations: */
-        paintDecorations(pPainter, pOption);
-    }
-
-    /* Non-root item: */
-    if (parentItem())
-    {
-        /* Paint group info: */
-        paintGroupInfo(pPainter, pOption, fClosedGroup);
-    }
-}
-
-void UIGSelectorItemGroup::paintDecorations(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption)
-{
-    /* Prepare variables: */
-    QRect fullRect = pOption->rect;
-
-    /* Any item: */
-    {
-        /* Paint background: */
-        paintBackground(/* Painter: */
-                        pPainter,
-                        /* Rectangle to paint in: */
-                        fullRect,
-                        /* Has parent? */
-                        parentItem(),
-                        /* Is item selected? */
-                        model()->selectionList().contains(this),
-                        /* Gradient darkness for animation: */
-                        gradient(),
-                        /* Show drag where? */
-                        dragTokenPlace(),
-                        /* Rounded corners radius: */
-                        m_iCornerRadius);
-    }
-
-    /* Non-root item: */
-    if (parentItem())
-    {
-        /* Paint frame: */
-        paintFrameRect(/* Painter: */
-                       pPainter,
-                       /* Rectangle to paint in: */
-                       fullRect,
-                       /* Is item selected? */
-                       model()->selectionList().contains(this),
-                       /* Rounded corner radius: */
-                       m_iCornerRadius);
-    }
-}
-
-void UIGSelectorItemGroup::paintGroupInfo(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, bool)
-{
-    /* Prepare variables: */
-    int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
-    int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
-    int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
-    QSize buttonSize = data(GroupItemData_ButtonSize).toSize();
-    QSize nameSize = data(GroupItemData_NameSize).toSize();
-    int iFullHeaderHeight = data(GroupItemData_FullHeaderSize).toSize().height();
-
-    /* Paint name: */
-    int iNameX = iHorizontalMargin + buttonSize.width() + iMinorSpacing +
-                 1 /* frame width from Qt sources */ +
-                 2 /* internal QLineEdit margin from Qt sources */ +
-                 1 /* internal QLineEdit align shifting from Qt sources */;
-    int iNameY = nameSize.height() == iFullHeaderHeight ? iVerticalMargin :
-                 iVerticalMargin + (iFullHeaderHeight - nameSize.height()) / 2;
-    paintText(/* Painter: */
-              pPainter,
-              /* Rectangle to paint in: */
-              QRect(QPoint(iNameX, iNameY), nameSize),
-              /* Font to paint text: */
-              data(GroupItemData_NameFont).value<QFont>(),
-              /* Text to paint: */
-              data(GroupItemData_Name).toString());
-
-    /* Should we add more info? */
-    if (model()->selectionList().contains(this))
-    {
-        /* Prepare variables: */
-        QRect fullRect = pOption->rect;
-        int iMinorSpacing = data(GroupItemData_MinorSpacing).toInt();
-        QSize groupPixmapSize = data(GroupItemData_GroupPixmapSize).toSize();
-        QSize machinePixmapSize = data(GroupItemData_MachinePixmapSize).toSize();
-        QSize groupCountTextSize = data(GroupItemData_GroupCountTextSize).toSize();
-        QSize machineCountTextSize = data(GroupItemData_MachineCountTextSize).toSize();
-        QFont infoFont = data(GroupItemData_InfoFont).value<QFont>();
-        QString strGroupCountText = data(GroupItemData_GroupCountText).toString();
-        QString strMachineCountText = data(GroupItemData_MachineCountText).toString();
-        QPixmap groupPixmap = data(GroupItemData_GroupPixmap).value<QIcon>().pixmap(groupPixmapSize);
-        QPixmap machinePixmap = data(GroupItemData_MachinePixmap).value<QIcon>().pixmap(machinePixmapSize);
-
-        /* We should add machine count: */
-        int iMachineCountTextX = fullRect.right() -
-                                 iHorizontalMargin -
-                                 machineCountTextSize.width();
-        int iMachineCountTextY = machineCountTextSize.height() == iFullHeaderHeight ?
-                                 iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - machineCountTextSize.height()) / 2;
-        paintText(/* Painter: */
-                  pPainter,
-                  /* Rectangle to paint in: */
-                  QRect(QPoint(iMachineCountTextX, iMachineCountTextY), machineCountTextSize),
-                  /* Font to paint text: */
-                  infoFont,
-                  /* Text to paint: */
-                  strMachineCountText);
-
-        /* We should draw machine pixmap: */
-        int iMachinePixmapX = iMachineCountTextX -
-                              iMinorSpacing -
-                              machinePixmapSize.width();
-        int iMachinePixmapY = machinePixmapSize.height() == iFullHeaderHeight ?
-                              iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - machinePixmapSize.height()) / 2;
-        paintPixmap(/* Painter: */
-                    pPainter,
-                    /* Rectangle to paint in: */
-                    QRect(QPoint(iMachinePixmapX, iMachinePixmapY), machinePixmapSize),
-                    /* Pixmap to paint: */
-                    machinePixmap);
-
-        /* We should add group count: */
-        int iGroupCountTextX = iMachinePixmapX -
-                               iMinorSpacing -
-                               groupCountTextSize.width();
-        int iGroupCountTextY = groupCountTextSize.height() == iFullHeaderHeight ?
-                               iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - groupCountTextSize.height()) / 2;
-        paintText(/* Painter: */
-                  pPainter,
-                  /* Rectangle to paint in: */
-                  QRect(QPoint(iGroupCountTextX, iGroupCountTextY), groupCountTextSize),
-                  /* Font to paint text: */
-                  infoFont,
-                  /* Text to paint: */
-                  strGroupCountText);
-
-        /* We should draw group pixmap: */
-        int iGroupPixmapX = iGroupCountTextX -
-                            iMinorSpacing -
-                            groupPixmapSize.width();
-        int iGroupPixmapY = groupPixmapSize.height() == iFullHeaderHeight ?
-                            iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - groupPixmapSize.height()) / 2;
-        paintPixmap(/* Painter: */
-                    pPainter,
-                    /* Rectangle to paint in: */
-                    QRect(QPoint(iGroupPixmapX, iGroupPixmapY), groupPixmapSize),
-                    /* Pixmap to paint: */
-                    groupPixmap);
-    }
-}
-
-void UIGSelectorItemGroup::updateAnimationParameters()
-{
-    /* Recalculate animation parameters: */
-    if (m_pButton)
-    {
-        QSizeF openedSize = minimumSizeHint(false);
-        QSizeF closedSize = minimumSizeHint(true);
-        int iAdditionalHeight = openedSize.height() - closedSize.height();
-        m_pButton->setAnimationRange(0, iAdditionalHeight);
-    }
-}
-
-void UIGSelectorItemGroup::setAdditionalHeight(int iAdditionalHeight)
-{
-    m_iAdditionalHeight = iAdditionalHeight;
-    /* Relayout scene: */
-    model()->updateLayout();
-}
-
-int UIGSelectorItemGroup::additionalHeight() const
-{
-    return m_iAdditionalHeight;
-}
-
-void UIGSelectorItemGroup::prepare()
-{
-    /* Nothing for root: */
-    if (!parentItem())
-        return;
-
-    /* Setup toggle-button: */
-    m_pButton = new UIGraphicsRotatorButton(this, "additionalHeight", !m_fClosed);
-    m_pButton->setIcon(data(GroupItemData_ButtonPixmap).value<QIcon>());
-    connect(m_pButton, SIGNAL(sigRotationStart()), this, SLOT(sltGroupToggleStart()));
-    connect(m_pButton, SIGNAL(sigRotationFinish(bool)), this, SLOT(sltGroupToggleFinish(bool)));
-
-    /* Setup name-editor: */
-    m_pNameEditorWidget = new QLineEdit(m_strName);
-    m_pNameEditorWidget->setTextMargins(0, 0, 0, 0);
-    m_pNameEditorWidget->setFont(data(GroupItemData_NameFont).value<QFont>());
-    connect(m_pNameEditorWidget, SIGNAL(editingFinished()), this, SLOT(sltNameEditingFinished()));
-    m_pNameEditor = new QGraphicsProxyWidget(this);
-    m_pNameEditor->setWidget(m_pNameEditorWidget);
-    m_pNameEditor->hide();
-}
-
-/* static */
-void UIGSelectorItemGroup::copyContent(UIGSelectorItemGroup *pFrom, UIGSelectorItemGroup *pTo)
-{
-    /* Copy group items: */
-    foreach (UIGSelectorItem *pGroupItem, pFrom->items(UIGSelectorItemType_Group))
-        new UIGSelectorItemGroup(pTo, pGroupItem->toGroupItem());
-    /* Copy machine items: */
-    foreach (UIGSelectorItem *pMachineItem, pFrom->items(UIGSelectorItemType_Machine))
-        new UIGSelectorItemMachine(pTo, pMachineItem->toMachineItem());
-}
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItemGroup.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItemGroup.h	(revision 42553)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGSelectorItemGroup class declaration
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-#ifndef __UIGSelectorItemGroup_h__
-#define __UIGSelectorItemGroup_h__
-
-/* Qt includes: */
-#include <QPointer>
-
-/* GUI includes: */
-#include "UIGSelectorItem.h"
-
-/* Forward declarations: */
-class UIGSelectorItemMachine;
-class UIGraphicsRotatorButton;
-class QLineEdit;
-class QGraphicsProxyWidget;
-
-/* Graphics group item
- * for graphics selector model/view architecture: */
-class UIGSelectorItemGroup : public UIGSelectorItem
-{
-    Q_OBJECT;
-    Q_PROPERTY(int additionalHeight READ additionalHeight WRITE setAdditionalHeight);
-
-public slots:
-
-    /* API: Loading stuff: */
-    void sltOpen();
-
-public:
-
-    /* Class-name used for drag&drop mime-data format: */
-    static QString className();
-
-    /* Graphics-item type: */
-    enum { Type = UIGSelectorItemType_Group };
-    int type() const { return Type; }
-
-    /* Constructor/destructor: */
-    UIGSelectorItemGroup(UIGSelectorItem *pParent = 0, const QString &strName = QString(), int iPosition = -1);
-    UIGSelectorItemGroup(UIGSelectorItem *pParent, UIGSelectorItemGroup *pCopyFrom, int iPosition = -1);
-    ~UIGSelectorItemGroup();
-
-    /* API: Basic stuff: */
-    QString name() const;
-    bool closed() const;
-    bool opened() const;
-    void close();
-    void open();
-
-    /* API: Children stuff: */
-    bool contains(const QString &strId, bool fRecursively = false) const;
-
-private slots:
-
-    /* Slot to handle group name editing: */
-    void sltNameEditingFinished();
-
-    /* Slot to handle group collapse/expand: */
-    void sltGroupToggleStart();
-    void sltGroupToggleFinish(bool fToggled);
-
-private:
-
-    /* Data enumerator: */
-    enum GroupItemData
-    {
-        /* Layout hints: */
-        GroupItemData_HorizonalMargin,
-        GroupItemData_VerticalMargin,
-        GroupItemData_MajorSpacing,
-        GroupItemData_MinorSpacing,
-        /* Pixmaps: */
-        GroupItemData_ButtonPixmap,
-        GroupItemData_GroupPixmap,
-        GroupItemData_MachinePixmap,
-        /* Fonts: */
-        GroupItemData_NameFont,
-        GroupItemData_InfoFont,
-        /* Text: */
-        GroupItemData_Name,
-        GroupItemData_GroupCountText,
-        GroupItemData_MachineCountText,
-        /* Sizes: */
-        GroupItemData_ButtonSize,
-        GroupItemData_NameSize,
-        GroupItemData_NameEditorSize,
-        GroupItemData_GroupPixmapSize,
-        GroupItemData_MachinePixmapSize,
-        GroupItemData_GroupCountTextSize,
-        GroupItemData_MachineCountTextSize,
-        GroupItemData_FullHeaderSize
-    };
-
-    /* Data provider: */
-    QVariant data(int iKey) const;
-
-    /* Basic stuff: */
-    void startEditing();
-
-    /* Children stuff: */
-    void addItem(UIGSelectorItem *pItem, int iPosition);
-    void removeItem(UIGSelectorItem *pItem);
-    void moveItemTo(UIGSelectorItem *pItem, int iPosition);
-    QList<UIGSelectorItem*> items(UIGSelectorItemType type = UIGSelectorItemType_Any) const;
-    bool hasItems(UIGSelectorItemType type = UIGSelectorItemType_Any) const;
-    void clearItems(UIGSelectorItemType type = UIGSelectorItemType_Any);
-
-    /* Layout stuff: */
-    void updateSizeHint();
-    void updateLayout();
-    int minimumWidthHint(bool fClosedGroup) const;
-    int minimumHeightHint(bool fClosedGroup) const;
-    int minimumWidthHint() const;
-    int minimumHeightHint() const;
-    QSizeF minimumSizeHint(bool fClosedGroup) const;
-    QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
-
-    /* API: Drag and drop stuff: */
-    QPixmap toPixmap();
-    bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const;
-    void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIGSelectorItem *pFromWho, DragToken where);
-    void resetDragToken();
-    QMimeData* createMimeData();
-
-    /* Paint stuff: */
-    void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget = 0);
-    void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, bool fClosedGroup);
-    void paintDecorations(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption);
-    void paintGroupInfo(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, bool fClosedGroup);
-
-    /* Animation stuff: */
-    void updateAnimationParameters();
-    void setAdditionalHeight(int iAdditionalHeight);
-    int additionalHeight() const;
-
-    /* Helpers: */
-    void prepare();
-    static void copyContent(UIGSelectorItemGroup *pFrom, UIGSelectorItemGroup *pTo);
-
-    /* Variables: */
-    QString m_strName;
-    bool m_fClosed;
-    UIGraphicsRotatorButton *m_pButton;
-    QLineEdit *m_pNameEditorWidget;
-    QGraphicsProxyWidget *m_pNameEditor;
-    QList<UIGSelectorItem*> m_groupItems;
-    QList<UIGSelectorItem*> m_machineItems;
-    int m_iAdditionalHeight;
-    int m_iCornerRadius;
-};
-
-#endif /* __UIGSelectorItemGroup_h__ */
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItemMachine.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItemMachine.cpp	(revision 42553)
+++ 	(revision )
@@ -1,628 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGSelectorItemMachine class implementation
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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 <QPainter>
-#include <QStyleOptionGraphicsItem>
-#include <QGraphicsSceneMouseEvent>
-
-/* GUI includes: */
-#include "UIGSelectorItemMachine.h"
-#include "UIGSelectorItemGroup.h"
-#include "UIGraphicsSelectorModel.h"
-#include "UIGraphicsToolBar.h"
-#include "UIGraphicsZoomButton.h"
-#include "VBoxGlobal.h"
-#include "UIConverter.h"
-#include "UIIconPool.h"
-#include "UIActionPoolSelector.h"
-
-/* COM includes: */
-#include "COMEnums.h"
-#include "CMachine.h"
-
-/* static */
-QString UIGSelectorItemMachine::className() { return "UIGSelectorItemMachine"; }
-
-UIGSelectorItemMachine::UIGSelectorItemMachine(UIGSelectorItem *pParent,
-                                               const CMachine &machine,
-                                               int iPosition /* = -1 */)
-    : UIGSelectorItem(pParent)
-    , UIVMItem(machine)
-    , m_pToolBar(0)
-    , m_pSettingsButton(0)
-    , m_pStartButton(0)
-    , m_pPauseButton(0)
-    , m_pCloseButton(0)
-    , m_iCornerRadius(6)
-{
-    /* Add item to the parent: */
-    AssertMsg(parentItem(), ("No parent set for machine item!"));
-    parentItem()->addItem(this, iPosition);
-
-    /* Prepare: */
-    prepare();
-}
-
-UIGSelectorItemMachine::UIGSelectorItemMachine(UIGSelectorItem *pParent,
-                                               UIGSelectorItemMachine *pCopyFrom,
-                                               int iPosition /* = -1 */)
-    : UIGSelectorItem(pParent)
-    , UIVMItem(pCopyFrom->machine())
-    , m_pToolBar(0)
-    , m_pSettingsButton(0)
-    , m_pStartButton(0)
-    , m_pPauseButton(0)
-    , m_pCloseButton(0)
-    , m_iCornerRadius(6)
-{
-    /* Add item to the parent: */
-    AssertMsg(parentItem(), ("No parent set for machine item!"));
-    parentItem()->addItem(this, iPosition);
-
-    /* Prepare: */
-    prepare();
-}
-
-UIGSelectorItemMachine::~UIGSelectorItemMachine()
-{
-    /* Remove item from the parent: */
-    AssertMsg(parentItem(), ("No parent set for machine item!"));
-    parentItem()->removeItem(this);
-}
-
-QString UIGSelectorItemMachine::name() const
-{
-    return UIVMItem::name();
-}
-
-QVariant UIGSelectorItemMachine::data(int iKey) const
-{
-    /* Provide other members with required data: */
-    switch (iKey)
-    {
-        /* Layout hints: */
-        case MachineItemData_Margin: return 5;
-        case MachineItemData_MajorSpacing: return 10;
-        case MachineItemData_MinorSpacing: return 4;
-        case MachineItemData_TextSpacing: return 2;
-        /* Pixmaps: */
-        case MachineItemData_Pixmap: return osIcon();
-        case MachineItemData_StatePixmap: return machineStateIcon();
-        case MachineItemData_SettingsButtonPixmap: return UIIconPool::iconSet(":/settings_16px.png");
-        case MachineItemData_StartButtonPixmap: return UIIconPool::iconSet(":/start_16px.png");
-        case MachineItemData_PauseButtonPixmap: return UIIconPool::iconSet(":/pause_16px.png");
-        case MachineItemData_CloseButtonPixmap: return UIIconPool::iconSet(":/exit_16px.png");
-        /* Fonts: */
-        case MachineItemData_NameFont:
-        {
-            QFont machineNameFont = qApp->font();
-            machineNameFont.setPointSize(machineNameFont.pointSize() + 1);
-            machineNameFont.setWeight(QFont::Bold);
-            return machineNameFont;
-        }
-        case MachineItemData_SnapshotNameFont:
-        {
-            QFont snapshotStateFont = qApp->font();
-            snapshotStateFont.setPointSize(snapshotStateFont.pointSize() + 1);
-            return snapshotStateFont;
-        }
-        case MachineItemData_StateTextFont:
-        {
-            QFont machineStateFont = qApp->font();
-            machineStateFont.setPointSize(machineStateFont.pointSize() + 1);
-            return machineStateFont;
-        }
-        /* Texts: */
-        case MachineItemData_Name: return name();
-        case MachineItemData_SnapshotName: return snapshotName();
-        case MachineItemData_StateText: return gpConverter->toString(machineState());
-        /* Sizes: */
-        case MachineItemData_PixmapSize: return osIcon().availableSizes().at(0);
-        case MachineItemData_StatePixmapSize: return machineStateIcon().availableSizes().at(0);
-        case MachineItemData_NameSize:
-        {
-            QFontMetrics fm(data(MachineItemData_NameFont).value<QFont>());
-            return QSize(fm.width(data(MachineItemData_Name).toString()), fm.height());
-        }
-        case MachineItemData_SnapshotNameSize:
-        {
-            QFontMetrics fm(data(MachineItemData_SnapshotNameFont).value<QFont>());
-            return QSize(fm.width(QString("(%1)").arg(data(MachineItemData_SnapshotName).toString())), fm.height());
-        }
-        case MachineItemData_StateTextSize:
-        {
-            QFontMetrics fm(data(MachineItemData_StateTextFont).value<QFont>());
-            return QSize(fm.width(data(MachineItemData_StateText).toString()), fm.height());
-        }
-        case MachineItemData_ToolBarSize: return m_pToolBar->minimumSizeHint().toSize();
-        /* Default: */
-        default: break;
-    }
-    return QVariant();
-}
-
-void UIGSelectorItemMachine::startEditing()
-{
-    AssertMsgFailed(("Machine graphics item do NOT support editing yet!"));
-}
-
-void UIGSelectorItemMachine::addItem(UIGSelectorItem*, int)
-{
-    AssertMsgFailed(("Machine graphics item do NOT support children!"));
-}
-
-void UIGSelectorItemMachine::removeItem(UIGSelectorItem*)
-{
-    AssertMsgFailed(("Machine graphics item do NOT support children!"));
-}
-
-void UIGSelectorItemMachine::moveItemTo(UIGSelectorItem*, int)
-{
-    AssertMsgFailed(("Machine graphics item do NOT support children!"));
-}
-
-QList<UIGSelectorItem*> UIGSelectorItemMachine::items(UIGSelectorItemType) const
-{
-    AssertMsgFailed(("Machine graphics item do NOT support children!"));
-    return QList<UIGSelectorItem*>();
-}
-
-bool UIGSelectorItemMachine::hasItems(UIGSelectorItemType) const
-{
-    AssertMsgFailed(("Machine graphics item do NOT support children!"));
-    return false;
-}
-
-void UIGSelectorItemMachine::clearItems(UIGSelectorItemType)
-{
-    AssertMsgFailed(("Machine graphics item do NOT support children!"));
-}
-
-void UIGSelectorItemMachine::updateSizeHint()
-{
-    updateGeometry();
-}
-
-void UIGSelectorItemMachine::updateLayout()
-{
-    /* Prepare variables: */
-    QSize size = geometry().size().toSize();
-
-    /* Prepare variables: */
-    int iMachineItemWidth = size.width();
-    int iMachineItemHeight = size.height();
-    int iToolBarHeight = data(MachineItemData_ToolBarSize).toSize().height();
-
-    /* Configure tool-bar: */
-    QSize toolBarSize = m_pToolBar->minimumSizeHint().toSize();
-    int iToolBarX = iMachineItemWidth - 1 - toolBarSize.width();
-    int iToolBarY = (iMachineItemHeight - iToolBarHeight) / 2;
-    m_pToolBar->setPos(iToolBarX, iToolBarY);
-    m_pToolBar->resize(toolBarSize);
-    m_pToolBar->updateLayout();
-
-    /* Configure buttons: */
-    m_pStartButton->updateAnimation();
-    m_pSettingsButton->updateAnimation();
-    m_pCloseButton->updateAnimation();
-    m_pPauseButton->updateAnimation();
-}
-
-int UIGSelectorItemMachine::minimumWidthHint() const
-{
-    /* First of all, we have to prepare few variables: */
-    int iMachineItemMargin = data(MachineItemData_Margin).toInt();
-    int iMachineItemMajorSpacing = data(MachineItemData_MajorSpacing).toInt();
-    int iMachineItemMinorSpacing = data(MachineItemData_MinorSpacing).toInt();
-    QSize machinePixmapSize = data(MachineItemData_PixmapSize).toSize();
-    QSize machineNameSize = data(MachineItemData_NameSize).toSize();
-    QSize snapshotNameSize = data(MachineItemData_SnapshotNameSize).toSize();
-    QSize machineStatePixmapSize = data(MachineItemData_StatePixmapSize).toSize();
-    QSize machineStateTextSize = data(MachineItemData_StateTextSize).toSize();
-    QSize toolBarSize = data(MachineItemData_ToolBarSize).toSize();
-
-    /* Calculating proposed width: */
-    int iProposedWidth = 0;
-
-    /* We are taking into account only left margin,
-     * tool-bar contains right one: */
-    iProposedWidth += iMachineItemMargin;
-    /* And machine item content to take into account: */
-    int iFirstLineWidth = machineNameSize.width() +
-                          iMachineItemMinorSpacing +
-                          snapshotNameSize.width();
-    int iSecondLineWidth = machineStatePixmapSize.width() +
-                           iMachineItemMinorSpacing +
-                           machineStateTextSize.width();
-    int iSecondColumnWidth = qMax(iFirstLineWidth, iSecondLineWidth);
-    int iMachineItemWidth = machinePixmapSize.width() +
-                            iMachineItemMajorSpacing +
-                            iSecondColumnWidth +
-                            iMachineItemMajorSpacing +
-                            toolBarSize.width() + 1;
-    iProposedWidth += iMachineItemWidth;
-
-    /* Return result: */
-    return iProposedWidth;
-}
-
-int UIGSelectorItemMachine::minimumHeightHint() const
-{
-    /* First of all, we have to prepare few variables: */
-    int iMachineItemMargin = data(MachineItemData_Margin).toInt();
-    int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt();
-    QSize machinePixmapSize = data(MachineItemData_PixmapSize).toSize();
-    QSize machineNameSize = data(MachineItemData_NameSize).toSize();
-    QSize snapshotNameSize = data(MachineItemData_SnapshotNameSize).toSize();
-    QSize machineStatePixmapSize = data(MachineItemData_StatePixmapSize).toSize();
-    QSize machineStateTextSize = data(MachineItemData_StateTextSize).toSize();
-    QSize toolBarSize = data(MachineItemData_ToolBarSize).toSize();
-
-    /* Calculating proposed height: */
-    int iProposedHeight = 0;
-
-    /* Simple machine item have 2 margins - top and bottom: */
-    iProposedHeight += 2 * iMachineItemMargin;
-    /* And machine item content to take into account: */
-    int iFirstLineHeight = qMax(machineNameSize.height(), snapshotNameSize.height());
-    int iSecondLineHeight = qMax(machineStatePixmapSize.height(), machineStateTextSize.height());
-    int iSecondColumnHeight = iFirstLineHeight +
-                              iMachineItemTextSpacing +
-                              iSecondLineHeight;
-    QList<int> heights;
-    heights << machinePixmapSize.height() << iSecondColumnHeight
-            << (toolBarSize.height() - 2 * iMachineItemMargin + 2);
-    int iMaxHeight = 0;
-    foreach (int iHeight, heights)
-        iMaxHeight = qMax(iMaxHeight, iHeight);
-    iProposedHeight += iMaxHeight;
-
-    /* Return result: */
-    return iProposedHeight;
-}
-
-QSizeF UIGSelectorItemMachine::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const
-{
-    /* If Qt::MinimumSize requested: */
-    if (which == Qt::MinimumSize)
-    {
-        /* Return wrappers: */
-        return QSizeF(minimumWidthHint(), minimumHeightHint());
-    }
-
-    /* Call to base-class: */
-    return UIGSelectorItem::sizeHint(which, constraint);
-}
-
-QPixmap UIGSelectorItemMachine::toPixmap()
-{
-    /* Ask item to paint itself into pixmap: */
-    QSize minimumSize = minimumSizeHint().toSize();
-    QPixmap pixmap(minimumSize);
-    QPainter painter(&pixmap);
-    QStyleOptionGraphicsItem options;
-    options.rect = QRect(QPoint(0, 0), minimumSize);
-    paint(&painter, &options);
-    return pixmap;
-}
-
-bool UIGSelectorItemMachine::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const
-{
-    /* Get mime: */
-    const QMimeData *pMimeData = pEvent->mimeData();
-    /* If drag token is shown, its up to parent to decide: */
-    if (where != DragToken_Off)
-        return parentItem()->isDropAllowed(pEvent);
-    /* Else we should try to cast mime to known classes: */
-    if (pMimeData->hasFormat(UIGSelectorItemMachine::className()))
-    {
-        /* Make sure passed item id is not ours: */
-        const UIGSelectorItemMimeData *pCastedMimeData = qobject_cast<const UIGSelectorItemMimeData*>(pMimeData);
-        AssertMsg(pCastedMimeData, ("Can't cast passed mime-data to UIGSelectorItemMimeData!"));
-        UIGSelectorItem *pItem = pCastedMimeData->item();
-        return pItem->toMachineItem()->id() != id();
-    }
-    /* That was invalid mime: */
-    return false;
-}
-
-void UIGSelectorItemMachine::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIGSelectorItem *pFromWho, DragToken where)
-{
-    /* Get mime: */
-    const QMimeData *pMime = pEvent->mimeData();
-    /* Make sure this handler called by this item (not by children): */
-    AssertMsg(!pFromWho && where == DragToken_Off, ("Machine graphics item do NOT support children!"));
-    Q_UNUSED(pFromWho);
-    Q_UNUSED(where);
-    if (pMime->hasFormat(UIGSelectorItemMachine::className()))
-    {
-        switch (pEvent->proposedAction())
-        {
-            case Qt::MoveAction:
-            case Qt::CopyAction:
-            {
-                /* Remember scene: */
-                UIGraphicsSelectorModel *pModel = model();
-
-                /* Get passed item: */
-                const UIGSelectorItemMimeData *pCastedMime = qobject_cast<const UIGSelectorItemMimeData*>(pMime);
-                AssertMsg(pCastedMime, ("Can't cast passed mime-data to UIGSelectorItemMimeData!"));
-                UIGSelectorItem *pItem = pCastedMime->item();
-
-                /* Group passed item with current item into the new group: */
-                UIGSelectorItemGroup *pNewGroupItem = new UIGSelectorItemGroup(parentItem(), "New group");
-                new UIGSelectorItemMachine(pNewGroupItem, this);
-                new UIGSelectorItemMachine(pNewGroupItem, pItem->toMachineItem());
-
-                /* If proposed action is 'move': */
-                if (pEvent->proposedAction() == Qt::MoveAction)
-                {
-                    /* Delete passed item: */
-                    delete pItem;
-                }
-                /* Delete this item: */
-                delete this;
-
-                /* Update scene: */
-                pModel->updateGroupTree();
-                pModel->updateNavigation();
-                pModel->updateLayout();
-                pModel->setCurrentItem(pNewGroupItem);
-                break;
-            }
-            default:
-                break;
-        }
-    }
-}
-
-void UIGSelectorItemMachine::resetDragToken()
-{
-    /* Reset drag token for this item: */
-    if (dragTokenPlace() != DragToken_Off)
-    {
-        setDragTokenPlace(DragToken_Off);
-        update();
-    }
-}
-
-QMimeData* UIGSelectorItemMachine::createMimeData()
-{
-    return new UIGSelectorItemMimeData(this);
-}
-
-void UIGSelectorItemMachine::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget * /* pWidget = 0 */)
-{
-    /* Non-root item: */
-    if (parentItem())
-    {
-        /* Configure painter shape: */
-        configurePainterShape(pPainter, pOption, m_iCornerRadius);
-    }
-
-    /* Any item: */
-    {
-        /* Paint decorations: */
-        paintDecorations(pPainter, pOption);
-    }
-
-    /* Non-root item: */
-    if (parentItem())
-    {
-        /* Paint machine info: */
-        paintMachineInfo(pPainter, pOption);
-    }
-}
-
-void UIGSelectorItemMachine::paintDecorations(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption)
-{
-    /* Prepare variables: */
-    QRect fullRect = pOption->rect;
-
-    /* Any item: */
-    {
-        /* Paint background: */
-        paintBackground(/* Painter: */
-                        pPainter,
-                        /* Rectangle to paint in: */
-                        fullRect,
-                        /* Has parent? */
-                        parentItem(),
-                        /* Is item selected? */
-                        model()->selectionList().contains(this),
-                        /* Gradient darkness for animation: */
-                        gradient(),
-                        /* Show drag where? */
-                        dragTokenPlace(),
-                        /* Rounded corners radius: */
-                        m_iCornerRadius);
-    }
-
-    /* Non-root item: */
-    if (parentItem())
-    {
-        /* Paint frame: */
-        paintFrameRect(/* Painter: */
-                       pPainter,
-                       /* Rectangle to paint in: */
-                       fullRect,
-                       /* Is item selected? */
-                       model()->selectionList().contains(this),
-                       /* Rounded corner radius: */
-                       m_iCornerRadius);
-    }
-}
-
-void UIGSelectorItemMachine::paintMachineInfo(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption)
-{
-    /* Initialize some necessary variables: */
-    QRect fullRect = pOption->rect;
-    int iMachineItemMargin = data(MachineItemData_Margin).toInt();
-    int iMachineItemMajorSpacing = data(MachineItemData_MajorSpacing).toInt();
-    int iMachineItemMinorSpacing = data(MachineItemData_MinorSpacing).toInt();
-    int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt();
-    QSize machinePixmapSize = data(MachineItemData_PixmapSize).toSize();
-    QSize machineNameSize = data(MachineItemData_NameSize).toSize();
-    QString strSnapshotName = data(MachineItemData_SnapshotName).toString();
-    QSize snapshotNameSize = data(MachineItemData_SnapshotNameSize).toSize();
-    QSize machineStatePixmapSize = data(MachineItemData_StatePixmapSize).toSize();
-    QSize machineStateTextSize = data(MachineItemData_StateTextSize).toSize();
-
-    /* Paint pixmap: */
-    {
-        /* Calculate attributes: */
-        int iMachinePixmapHeight = machinePixmapSize.height();
-        int iFirstLineHeight = qMax(machineNameSize.height(), snapshotNameSize.height());
-        int iSecondLineHeight = qMax(machineStatePixmapSize.height(), machineStateTextSize.height());
-        int iRightSizeHeight = iFirstLineHeight + iMachineItemTextSpacing + iSecondLineHeight;
-        int iMinimumHeight = qMin(iMachinePixmapHeight, iRightSizeHeight);
-        int iMaximumHeight = qMax(iMachinePixmapHeight, iRightSizeHeight);
-        int iDelta = iMaximumHeight - iMinimumHeight;
-        int iHalfDelta = iDelta / 2;
-        int iMachinePixmapX = iMachineItemMargin;
-        int iMachinePixmapY = iMachinePixmapHeight >= iRightSizeHeight ?
-                              iMachineItemMargin : iMachineItemMargin + iHalfDelta;
-
-        paintPixmap(/* Painter: */
-                    pPainter,
-                    /* Rectangle to paint in: */
-                    QRect(fullRect.topLeft() +
-                          QPoint(iMachinePixmapX, iMachinePixmapY),
-                          machinePixmapSize),
-                    /* Pixmap to paint: */
-                    data(MachineItemData_Pixmap).value<QIcon>().pixmap(machinePixmapSize));
-    }
-
-    /* Paint name: */
-    {
-        paintText(/* Painter: */
-                  pPainter,
-                  /* Rectangle to paint in: */
-                  QRect(fullRect.topLeft() +
-                        QPoint(iMachineItemMargin, iMachineItemMargin) +
-                        QPoint(machinePixmapSize.width() + iMachineItemMajorSpacing, 0),
-                        machineNameSize),
-                  /* Font to paint text: */
-                  data(MachineItemData_NameFont).value<QFont>(),
-                  /* Text to paint: */
-                  data(MachineItemData_Name).toString());
-    }
-
-    /* Paint snapshot name (if necessary): */
-    if (!strSnapshotName.isEmpty())
-    {
-        paintText(/* Painter: */
-                  pPainter,
-                  /* Rectangle to paint in: */
-                  QRect(fullRect.topLeft() +
-                        QPoint(iMachineItemMargin, iMachineItemMargin) +
-                        QPoint(machinePixmapSize.width() + iMachineItemMajorSpacing, 0) +
-                        QPoint(machineNameSize.width() + iMachineItemMinorSpacing, 0),
-                        snapshotNameSize),
-                  /* Font to paint text: */
-                  data(MachineItemData_SnapshotNameFont).value<QFont>(),
-                  /* Text to paint: */
-                  QString("(%1)").arg(strSnapshotName));
-    }
-
-    /* Paint state pixmap: */
-    {
-        paintPixmap(/* Painter: */
-                    pPainter,
-                    /* Rectangle to paint in: */
-                    QRect(fullRect.topLeft() +
-                          QPoint(iMachineItemMargin, iMachineItemMargin) +
-                          QPoint(machinePixmapSize.width() + iMachineItemMajorSpacing, 0) +
-                          QPoint(0, machineNameSize.height() + iMachineItemTextSpacing),
-                          machineStatePixmapSize),
-                    /* Pixmap to paint: */
-                    data(MachineItemData_StatePixmap).value<QIcon>().pixmap(machineStatePixmapSize));
-    }
-
-    /* Paint state text: */
-    {
-        paintText(/* Painter: */
-                  pPainter,
-                  /* Rectangle to paint in: */
-                  QRect(fullRect.topLeft() +
-                        QPoint(iMachineItemMargin, iMachineItemMargin) +
-                        QPoint(machinePixmapSize.width() + iMachineItemMajorSpacing, 0) +
-                        QPoint(0, machineNameSize.height() + iMachineItemTextSpacing) +
-                        QPoint(machineStatePixmapSize.width() + iMachineItemMinorSpacing, 0),
-                        machineStateTextSize),
-                  /* Font to paint text: */
-                  data(MachineItemData_StateTextFont).value<QFont>(),
-                  /* Text to paint: */
-                  data(MachineItemData_StateText).toString());
-    }
-
-    /* Show/hide start-button: */
-    if (model()->focusItem() == this)
-    {
-        if (!m_pToolBar->isVisible())
-            m_pToolBar->show();
-    }
-    else
-    {
-        if (m_pToolBar->isVisible())
-            m_pToolBar->hide();
-    }
-}
-
-void UIGSelectorItemMachine::prepare()
-{
-    /* Create tool-bar: */
-    m_pToolBar = new UIGraphicsToolBar(this, 2, 2);
-
-    /* Create buttons: */
-    m_pSettingsButton = new UIGraphicsZoomButton(m_pToolBar, UIGraphicsZoomDirection_Top | UIGraphicsZoomDirection_Left);
-    m_pSettingsButton->setIndent(m_pToolBar->toolBarMargin() - 1);
-    m_pSettingsButton->setIcon(data(MachineItemData_SettingsButtonPixmap).value<QIcon>());
-    m_pToolBar->insertItem(m_pSettingsButton, 0, 0);
-
-    m_pStartButton = new UIGraphicsZoomButton(m_pToolBar, UIGraphicsZoomDirection_Top | UIGraphicsZoomDirection_Right);
-    m_pStartButton->setIndent(m_pToolBar->toolBarMargin() - 1);
-    m_pStartButton->setIcon(data(MachineItemData_StartButtonPixmap).value<QIcon>());
-    m_pToolBar->insertItem(m_pStartButton, 0, 1);
-
-    m_pPauseButton = new UIGraphicsZoomButton(m_pToolBar, UIGraphicsZoomDirection_Bottom | UIGraphicsZoomDirection_Left);
-    m_pPauseButton->setIndent(m_pToolBar->toolBarMargin() - 1);
-    m_pPauseButton->setIcon(data(MachineItemData_PauseButtonPixmap).value<QIcon>());
-    m_pToolBar->insertItem(m_pPauseButton, 1, 0);
-
-    m_pCloseButton = new UIGraphicsZoomButton(m_pToolBar, UIGraphicsZoomDirection_Bottom | UIGraphicsZoomDirection_Right);
-    m_pCloseButton->setIndent(m_pToolBar->toolBarMargin() - 1);
-    m_pCloseButton->setIcon(data(MachineItemData_CloseButtonPixmap).value<QIcon>());
-    m_pToolBar->insertItem(m_pCloseButton, 1, 1);
-
-    connect(m_pSettingsButton, SIGNAL(sigButtonClicked()),
-            gActionPool->action(UIActionIndexSelector_Simple_Machine_SettingsDialog), SLOT(trigger()),
-            Qt::QueuedConnection);
-    connect(m_pStartButton, SIGNAL(sigButtonClicked()),
-            gActionPool->action(UIActionIndexSelector_State_Machine_StartOrShow), SLOT(trigger()),
-            Qt::QueuedConnection);
-    connect(m_pPauseButton, SIGNAL(sigButtonClicked()),
-            gActionPool->action(UIActionIndexSelector_Toggle_Machine_PauseAndResume), SLOT(trigger()),
-            Qt::QueuedConnection);
-    connect(m_pCloseButton, SIGNAL(sigButtonClicked()),
-            gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff), SLOT(trigger()),
-            Qt::QueuedConnection);
-}
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItemMachine.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGSelectorItemMachine.h	(revision 42553)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGSelectorItemMachine class declaration
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-#ifndef __UIGSelectorItemMachine_h__
-#define __UIGSelectorItemMachine_h__
-
-/* GUI includes: */
-#include "UIVMItem.h"
-#include "UIGSelectorItem.h"
-
-/* Forward declarations: */
-class CMachine;
-class UIGraphicsToolBar;
-class UIGraphicsZoomButton;
-
-/* Graphics machine item
- * for graphics selector model/view architecture: */
-class UIGSelectorItemMachine : public UIGSelectorItem, public UIVMItem
-{
-    Q_OBJECT;
-
-public:
-
-    /* Class-name used for drag&drop mime-data format: */
-    static QString className();
-
-    /* Graphics-item type: */
-    enum { Type = UIGSelectorItemType_Machine };
-    int type() const { return Type; }
-
-    /* Constructor/destructor: */
-    UIGSelectorItemMachine(UIGSelectorItem *pParent, const CMachine &machine, int iPosition = -1);
-    UIGSelectorItemMachine(UIGSelectorItem *pParent, UIGSelectorItemMachine *pCopyFrom, int iPosition = -1);
-    ~UIGSelectorItemMachine();
-
-    /* API: Basic stuff: */
-    QString name() const;
-
-private:
-
-    /* Data enumerator: */
-    enum MachineItemData
-    {
-        /* Layout hints: */
-        MachineItemData_Margin,
-        MachineItemData_MajorSpacing,
-        MachineItemData_MinorSpacing,
-        MachineItemData_TextSpacing,
-        /* Pixmaps: */
-        MachineItemData_Pixmap,
-        MachineItemData_StatePixmap,
-        MachineItemData_SettingsButtonPixmap,
-        MachineItemData_StartButtonPixmap,
-        MachineItemData_PauseButtonPixmap,
-        MachineItemData_CloseButtonPixmap,
-        /* Fonts: */
-        MachineItemData_NameFont,
-        MachineItemData_SnapshotNameFont,
-        MachineItemData_StateTextFont,
-        /* Text: */
-        MachineItemData_Name,
-        MachineItemData_SnapshotName,
-        MachineItemData_StateText,
-        /* Sizes: */
-        MachineItemData_PixmapSize,
-        MachineItemData_StatePixmapSize,
-        MachineItemData_NameSize,
-        MachineItemData_SnapshotNameSize,
-        MachineItemData_StateTextSize,
-        MachineItemData_ToolBarSize
-    };
-
-    /* Data provider: */
-    QVariant data(int iKey) const;
-
-    /* Basic stuff: */
-    void startEditing();
-
-    /* Children stuff: */
-    void addItem(UIGSelectorItem *pItem, int iPosition);
-    void removeItem(UIGSelectorItem *pItem);
-    void moveItemTo(UIGSelectorItem *pItem, int iPosition);
-    QList<UIGSelectorItem*> items(UIGSelectorItemType type) const;
-    bool hasItems(UIGSelectorItemType type) const;
-    void clearItems(UIGSelectorItemType type);
-
-    /* Layout stuff: */
-    void updateSizeHint();
-    void updateLayout();
-    int minimumWidthHint() const;
-    int minimumHeightHint() const;
-    QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
-
-    /* Drag and drop stuff: */
-    QPixmap toPixmap();
-    bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const;
-    void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIGSelectorItem *pFromWho, DragToken where);
-    void resetDragToken();
-    QMimeData* createMimeData();
-
-    /* Paint stuff: */
-    void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget = 0);
-    void paintDecorations(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption);
-    void paintMachineInfo(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption);
-
-    /* Helpers: Prepare stuff: */
-    void prepare();
-
-    /* Variables: */
-    UIGraphicsToolBar *m_pToolBar;
-    UIGraphicsZoomButton *m_pSettingsButton;
-    UIGraphicsZoomButton *m_pStartButton;
-    UIGraphicsZoomButton *m_pPauseButton;
-    UIGraphicsZoomButton *m_pCloseButton;
-    int m_iCornerRadius;
-};
-
-#endif /* __UIGSelectorItemMachine_h__ */
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorKeyboardHandler.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorKeyboardHandler.cpp	(revision 42553)
+++ 	(revision )
@@ -1,253 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsSelectorKeyboardHandler class implementation
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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 <QKeyEvent>
-
-/* GUI incluedes: */
-#include "UIGraphicsSelectorKeyboardHandler.h"
-#include "UIGraphicsSelectorModel.h"
-#include "UIGSelectorItemGroup.h"
-
-UIGraphicsSelectorKeyboardHandler::UIGraphicsSelectorKeyboardHandler(UIGraphicsSelectorModel *pParent)
-    : QObject(pParent)
-    , m_pModel(pParent)
-{
-}
-
-bool UIGraphicsSelectorKeyboardHandler::handle(QKeyEvent *pEvent, UIKeyboardEventType type) const
-{
-    /* Process passed event: */
-    switch (type)
-    {
-        case UIKeyboardEventType_Press: return handleKeyPress(pEvent);
-        case UIKeyboardEventType_Release: return handleKeyRelease(pEvent);
-    }
-    /* Pass event if unknown: */
-    return false;
-}
-
-UIGraphicsSelectorModel* UIGraphicsSelectorKeyboardHandler::model() const
-{
-    return m_pModel;
-}
-
-bool UIGraphicsSelectorKeyboardHandler::handleKeyPress(QKeyEvent *pEvent) const
-{
-    /* Which key it was? */
-    switch (pEvent->key())
-    {
-        /* Key UP? */
-        case Qt::Key_Up:
-        {
-            /* Determine focus item position: */
-            int iPosition = model()->navigationList().indexOf(model()->focusItem());
-            /* Determine 'previous' item: */
-            UIGSelectorItem *pPreviousItem = iPosition > 0 ?
-                                             model()->navigationList().at(iPosition - 1) : 0;
-            if (pPreviousItem)
-            {
-                /* Make sure 'previous' item is visible: */
-                pPreviousItem->makeSureItsVisible();
-                /* Move focus to 'previous' item: */
-                model()->setFocusItem(pPreviousItem);
-                /* Was 'shift' modifier pressed? */
-                if (pEvent->modifiers() == Qt::ShiftModifier)
-                {
-                    /* Calculate positions: */
-                    UIGSelectorItem *pFirstItem = model()->selectionList().first();
-                    int iFirstPosition = model()->navigationList().indexOf(pFirstItem);
-                    int iPreviousPosition = model()->navigationList().indexOf(pPreviousItem);
-                    /* Clear selection: */
-                    model()->clearSelectionList();
-                    /* Select all the items from 'first' to 'previous': */
-                    if (iFirstPosition <= iPreviousPosition)
-                        for (int i = iFirstPosition; i <= iPreviousPosition; ++i)
-                            model()->addToSelectionList(model()->navigationList().at(i));
-                    else
-                        for (int i = iFirstPosition; i >= iPreviousPosition; --i)
-                            model()->addToSelectionList(model()->navigationList().at(i));
-                }
-                /* There is no modifiers pressed? */
-                else if (pEvent->modifiers() == Qt::NoModifier)
-                {
-                    /* Move selection to 'previous' item: */
-                    model()->clearSelectionList();
-                    model()->addToSelectionList(pPreviousItem);
-                }
-                /* Notify selection changed: */
-                model()->notifySelectionChanged();
-                /* Filter-out this event: */
-                return true;
-            }
-            /* Pass this event: */
-            return false;
-        }
-        /* Key DOWN? */
-        case Qt::Key_Down:
-        {
-            /* Determine focus item position: */
-            int iPosition = model()->navigationList().indexOf(model()->focusItem());
-            /* Determine 'next' item: */
-            UIGSelectorItem *pNextItem = iPosition < model()->navigationList().size() - 1 ?
-                                          model()->navigationList().at(iPosition + 1) : 0;
-            if (pNextItem)
-            {
-                /* Make sure 'next' item is visible: */
-                pNextItem->makeSureItsVisible();
-                /* Move focus to 'next' item: */
-                model()->setFocusItem(pNextItem);
-                /* Was shift modifier pressed? */
-                if (pEvent->modifiers() == Qt::ShiftModifier)
-                {
-                    /* Calculate positions: */
-                    UIGSelectorItem *pFirstItem = model()->selectionList().first();
-                    int iFirstPosition = model()->navigationList().indexOf(pFirstItem);
-                    int iNextPosition = model()->navigationList().indexOf(pNextItem);
-                    /* Clear selection: */
-                    model()->clearSelectionList();
-                    /* Select all the items from 'first' to 'next': */
-                    if (iFirstPosition <= iNextPosition)
-                        for (int i = iFirstPosition; i <= iNextPosition; ++i)
-                            model()->addToSelectionList(model()->navigationList().at(i));
-                    else
-                        for (int i = iFirstPosition; i >= iNextPosition; --i)
-                            model()->addToSelectionList(model()->navigationList().at(i));
-                }
-                /* There is no modifiers pressed? */
-                else if (pEvent->modifiers() == Qt::NoModifier)
-                {
-                    /* Move selection to 'next' item: */
-                    model()->clearSelectionList();
-                    model()->addToSelectionList(pNextItem);
-                }
-                /* Notify selection changed: */
-                model()->notifySelectionChanged();
-                /* Filter-out this event: */
-                return true;
-            }
-            /* Pass this event: */
-            return false;
-        }
-        /* Key LEFT? */
-        case Qt::Key_Left:
-        {
-            /* If there is focus item: */
-            if (UIGSelectorItem *pFocusItem = model()->focusItem())
-            {
-                /* Known item type? */
-                switch (pFocusItem->type())
-                {
-                    /* Group one? */
-                    case UIGSelectorItemType_Group:
-                    {
-                        /* Get focus group: */
-                        UIGSelectorItemGroup *pFocusGroup = pFocusItem->toGroupItem();
-                        /* If focus group is opened: */
-                        if (pFocusGroup->opened())
-                        {
-                            /* Close it: */
-                            pFocusGroup->close();
-                            /* Filter that event out: */
-                            return true;
-                        }
-                        /* If focus group is closed and not from root-group: */
-                        else if (pFocusItem->parentItem() && pFocusItem->parentItem()->parentItem())
-                        {
-                            /* Move focus to parent item: */
-                            model()->setFocusItem(pFocusItem->parentItem(), true);
-                            /* Filter that event out: */
-                            return true;
-                        }
-                        break;
-                    }
-                    /* Machine one? */
-                    case UIGSelectorItemType_Machine:
-                    {
-                        /* If focus machine is not from root-group: */
-                        if (pFocusItem->parentItem() && pFocusItem->parentItem()->parentItem())
-                        {
-                            /* Move focus to parent item: */
-                            model()->setFocusItem(pFocusItem->parentItem(), true);
-                            /* Filter that event out: */
-                            return true;
-                        }
-                        break;
-                    }
-                    default:
-                        break;
-                }
-            }
-            /* Pass that event: */
-            return false;
-        }
-        /* Key RIGHT? */
-        case Qt::Key_Right:
-        {
-            /* If there is focus item: */
-            if (UIGSelectorItem *pFocusItem = model()->focusItem())
-            {
-                /* And focus item is of 'group' type and opened: */
-                if (pFocusItem->type() == UIGSelectorItemType_Group &&
-                    pFocusItem->toGroupItem()->closed())
-                {
-                    /* Open it: */
-                    pFocusItem->toGroupItem()->open();
-                    /* And filter out that event: */
-                    return true;
-                }
-            }
-            /* Pass that event: */
-            return false;
-        }
-        /* Key F2? */
-        case Qt::Key_F2:
-        {
-            /* If this item is of group type: */
-            if (model()->focusItem()->type() == UIGSelectorItemType_Group)
-            {
-                /* Start embedded editing focus item: */
-                model()->focusItem()->startEditing();
-                /* Filter that event out: */
-                return true;
-            }
-            /* Pass event to other items: */
-            return false;
-        }
-        case Qt::Key_Return:
-        case Qt::Key_Enter:
-        {
-            /* Activate item: */
-            model()->activate();
-            /* And filter out that event: */
-            return true;
-        }
-        default:
-            break;
-    }
-    /* Pass all other events: */
-    return false;
-}
-
-bool UIGraphicsSelectorKeyboardHandler::handleKeyRelease(QKeyEvent*) const
-{
-    /* Pass all events: */
-    return false;
-}
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorKeyboardHandler.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorKeyboardHandler.h	(revision 42553)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsSelectorKeyboardHandler class declaration
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-#ifndef __UIGraphicsSelectorKeyboardHandler_h__
-#define __UIGraphicsSelectorKeyboardHandler_h__
-
-/* Qt includes: */
-#include <QObject>
-
-/* Forward declarations: */
-class UIGraphicsSelectorModel;
-class QKeyEvent;
-
-/* Keyboard event type: */
-enum UIKeyboardEventType
-{
-    UIKeyboardEventType_Press,
-    UIKeyboardEventType_Release
-};
-
-/* Keyboard handler for graphics selector: */
-class UIGraphicsSelectorKeyboardHandler : public QObject
-{
-    Q_OBJECT;
-
-public:
-
-    /* Constructor: */
-    UIGraphicsSelectorKeyboardHandler(UIGraphicsSelectorModel *pParent);
-
-    /* API: Model keyboard-event handler delegate: */
-    bool handle(QKeyEvent *pEvent, UIKeyboardEventType type) const;
-
-private:
-
-    /* Model wrapper: */
-    UIGraphicsSelectorModel* model() const;
-
-    /* Helpers: Model keyboard-event handler delegates: */
-    bool handleKeyPress(QKeyEvent *pEvent) const;
-    bool handleKeyRelease(QKeyEvent *pEvent) const;
-
-    /* Variables: */
-    UIGraphicsSelectorModel *m_pModel;
-};
-
-#endif /* __UIGraphicsSelectorKeyboardHandler_h__ */
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorModel.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorModel.cpp	(revision 42553)
+++ 	(revision )
@@ -1,1013 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsSelectorModel class implementation
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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 <QGraphicsScene>
-#include <QGraphicsWidget>
-#include <QGraphicsView>
-#include <QRegExp>
-#include <QTimer>
-#include <QGraphicsSceneMouseEvent>
-#include <QGraphicsSceneContextMenuEvent>
-
-/* GUI includes: */
-#include "UIGraphicsSelectorModel.h"
-#include "UIGSelectorItemGroup.h"
-#include "UIGSelectorItemMachine.h"
-#include "UIDefs.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIActionPoolSelector.h"
-#include "UIGraphicsSelectorMouseHandler.h"
-#include "UIGraphicsSelectorKeyboardHandler.h"
-
-/* COM includes: */
-#include "CMachine.h"
-
-UIGraphicsSelectorModel::UIGraphicsSelectorModel(QObject *pParent)
-    : QObject(pParent)
-    , m_pScene(0)
-    , m_pRoot(0)
-    , m_pMouseHandler(0)
-    , m_pKeyboardHandler(0)
-    , m_pContextMenuRoot(0)
-    , m_pContextMenuGroup(0)
-    , m_pContextMenuMachine(0)
-{
-    /* Prepare scene: */
-    prepareScene();
-
-    /* Prepare root: */
-    prepareRoot();
-
-    /* Prepare context-menu: */
-    prepareContextMenu();
-
-    /* Prepare handlers: */
-    prepareHandlers();
-}
-
-UIGraphicsSelectorModel::~UIGraphicsSelectorModel()
-{
-    /* Cleanup handlers: */
-    cleanupHandlers();
-
-    /* Prepare context-menu: */
-    cleanupContextMenu();
-
-    /* Cleanup root: */
-    cleanupRoot();
-
-    /* Cleanup scene: */
-    cleanupScene();
- }
-
-void UIGraphicsSelectorModel::load()
-{
-    /* Prepare group-tree: */
-    prepareGroupTree();
-}
-
-void UIGraphicsSelectorModel::save()
-{
-    /* Cleanup group-tree: */
-    cleanupGroupTree();
-}
-
-QGraphicsScene* UIGraphicsSelectorModel::scene() const
-{
-    return m_pScene;
-}
-
-void UIGraphicsSelectorModel::setCurrentItem(int iItemIndex)
-{
-    /* Make sure passed index feats the bounds: */
-    if (iItemIndex >= 0 && iItemIndex < navigationList().size())
-    {
-        /* And call for other wrapper: */
-        setCurrentItem(navigationList().at(iItemIndex));
-    }
-    else
-        AssertMsgFailed(("Passed index out of bounds!"));
-}
-
-void UIGraphicsSelectorModel::setCurrentItem(UIGSelectorItem *pItem)
-{
-    /* If navigation list contains passed item: */
-    if (navigationList().contains(pItem))
-    {
-        /* Pass focus/selection to that item: */
-        setFocusItem(pItem, true);
-    }
-    else
-        AssertMsgFailed(("Passed item not in navigation list!"));
-}
-
-void UIGraphicsSelectorModel::unsetCurrentItem()
-{
-    /* Clear focus/selection: */
-    setFocusItem(0, true);
-}
-
-UIVMItem* UIGraphicsSelectorModel::currentItem() const
-{
-    /* Search for the first selected machine: */
-    return searchCurrentItem(selectionList());
-}
-
-QList<UIVMItem*> UIGraphicsSelectorModel::currentItems() const
-{
-    /* Populate list of selected machines: */
-    QList<UIVMItem*> currentItemList;
-    enumerateCurrentItems(selectionList(), currentItemList);
-    return currentItemList;
-}
-
-void UIGraphicsSelectorModel::setFocusItem(UIGSelectorItem *pItem, bool fWithSelection /* = false */)
-{
-    /* Make sure real focus unset: */
-    clearRealFocus();
-
-    /* Something changed? */
-    if (m_pFocusItem != pItem || !pItem)
-    {
-        /* Remember previous focus item: */
-        QPointer<UIGSelectorItem> pPreviousFocusItem = m_pFocusItem;
-        /* Set new focus item: */
-        m_pFocusItem = pItem;
-
-        /* Should we move selection too? */
-        if (fWithSelection)
-        {
-            /* Clear selection: */
-            clearSelectionList();
-            /* Add focus item into selection (if any): */
-            if (m_pFocusItem)
-                addToSelectionList(m_pFocusItem);
-            /* Notify selection changed: */
-            notifySelectionChanged();
-        }
-
-        /* Update previous focus item (if any): */
-        if (pPreviousFocusItem)
-        {
-            pPreviousFocusItem->disconnect(this);
-            pPreviousFocusItem->update();
-        }
-        /* Update new focus item (if any): */
-        if (m_pFocusItem)
-        {
-            connect(m_pFocusItem, SIGNAL(destroyed(QObject*)), this, SLOT(sltFocusItemDestroyed()));
-            m_pFocusItem->update();
-        }
-    }
-}
-
-UIGSelectorItem* UIGraphicsSelectorModel::focusItem() const
-{
-    return m_pFocusItem;
-}
-
-QGraphicsItem* UIGraphicsSelectorModel::itemAt(const QPointF &position, const QTransform &deviceTransform /* = QTransform() */) const
-{
-    return scene()->itemAt(position, deviceTransform);
-}
-
-void UIGraphicsSelectorModel::updateGroupTree()
-{
-    updateGroupTree(m_pRoot);
-}
-
-const QList<UIGSelectorItem*>& UIGraphicsSelectorModel::navigationList() const
-{
-    return m_navigationList;
-}
-
-void UIGraphicsSelectorModel::removeFromNavigationList(UIGSelectorItem *pItem)
-{
-    AssertMsg(pItem, ("Passed item is invalid!"));
-    m_navigationList.removeAll(pItem);
-}
-
-void UIGraphicsSelectorModel::clearNavigationList()
-{
-    m_navigationList.clear();
-}
-
-void UIGraphicsSelectorModel::updateNavigation()
-{
-    /* Recreate navigation list: */
-    clearNavigationList();
-    m_navigationList = createNavigationList(m_pRoot);
-}
-
-const QList<UIGSelectorItem*>& UIGraphicsSelectorModel::selectionList() const
-{
-    return m_selectionList;
-}
-
-void UIGraphicsSelectorModel::addToSelectionList(UIGSelectorItem *pItem)
-{
-    AssertMsg(pItem, ("Passed item is invalid!"));
-    m_selectionList << pItem;
-    pItem->update();
-}
-
-void UIGraphicsSelectorModel::removeFromSelectionList(UIGSelectorItem *pItem)
-{
-    AssertMsg(pItem, ("Passed item is invalid!"));
-    m_selectionList.removeAll(pItem);
-    pItem->update();
-}
-
-void UIGraphicsSelectorModel::clearSelectionList()
-{
-    QList<UIGSelectorItem*> oldSelectedList = m_selectionList;
-    m_selectionList.clear();
-    foreach (UIGSelectorItem *pItem, oldSelectedList)
-        pItem->update();
-}
-
-void UIGraphicsSelectorModel::notifySelectionChanged()
-{
-    /* Make sure selection item list is never empty
-     * if at least one item (for example 'focus') present: */
-    if (selectionList().isEmpty() && focusItem())
-        addToSelectionList(focusItem());
-    /* Notify listeners about selection change: */
-    emit sigSelectionChanged();
-}
-
-void UIGraphicsSelectorModel::updateLayout()
-{
-    /* Initialize variables: */
-    int iSceneMargin = data(SelectorModelData_Margin).toInt();
-    QSize viewportSize = scene()->views()[0]->viewport()->size();
-    int iViewportWidth = viewportSize.width() - 2 * iSceneMargin;
-    int iViewportHeight = viewportSize.height() - 2 * iSceneMargin;
-    /* Update all the size-hints recursively: */
-    m_pRoot->updateSizeHint();
-    /* Set root item position: */
-    m_pRoot->setPos(iSceneMargin, iSceneMargin);
-    /* Set root item size: */
-    m_pRoot->resize(iViewportWidth, iViewportHeight);
-    /* Relayout root item: */
-    m_pRoot->updateLayout();
-    /* Notify listener about root-item relayouted: */
-    emit sigRootItemResized(m_pRoot->geometry().size(), m_pRoot->minimumWidthHint());
-}
-
-void UIGraphicsSelectorModel::setCurrentDragObject(QDrag *pDragObject)
-{
-    /* Make sure real focus unset: */
-    clearRealFocus();
-
-    /* Remember new drag-object: */
-    m_pCurrentDragObject = pDragObject;
-    connect(m_pCurrentDragObject, SIGNAL(destroyed(QObject*)), this, SLOT(sltCurrentDragObjectDestroyed()));
-}
-
-void UIGraphicsSelectorModel::activate()
-{
-    gActionPool->action(UIActionIndexSelector_State_Machine_StartOrShow)->activate(QAction::Trigger);
-}
-
-void UIGraphicsSelectorModel::sltMachineStateChanged(QString strId, KMachineState)
-{
-    /* Update machine items with passed id: */
-    updateMachineItems(strId, m_pRoot);
-}
-
-void UIGraphicsSelectorModel::sltMachineDataChanged(QString strId)
-{
-    /* Update machine items with passed id: */
-    updateMachineItems(strId, m_pRoot);
-}
-
-void UIGraphicsSelectorModel::sltMachineRegistered(QString strId, bool fRegistered)
-{
-    /* New VM registered? */
-    if (fRegistered)
-    {
-        /* Search for corresponding machine: */
-        CMachine machine = vboxGlobal().virtualBox().FindMachine(strId);
-        /* Machine was found? */
-        if (!machine.isNull())
-        {
-            /* Add new machine item: */
-            addMachineIntoTheTree(machine);
-            /* And update model: */
-            updateNavigation();
-            updateLayout();
-            setCurrentItem(getMachineItem(strId, m_pRoot));
-        }
-    }
-    /* Existing VM unregistered? */
-    else
-    {
-        /* Remove machine items with passed id: */
-        removeMachineItems(strId, m_pRoot);
-        /* And update model: */
-        updateGroupTree();
-        updateNavigation();
-        updateLayout();
-        if (m_pRoot->hasItems())
-            setCurrentItem(0);
-        else
-            unsetCurrentItem();
-    }
-}
-
-void UIGraphicsSelectorModel::sltSessionStateChanged(QString strId, KSessionState)
-{
-    /* Update machine items with passed id: */
-    updateMachineItems(strId, m_pRoot);
-}
-
-void UIGraphicsSelectorModel::sltSnapshotChanged(QString strId, QString)
-{
-    /* Update machine items with passed id: */
-    updateMachineItems(strId, m_pRoot);
-}
-
-void UIGraphicsSelectorModel::sltHandleViewResized()
-{
-    /* Relayout: */
-    updateLayout();
-}
-
-void UIGraphicsSelectorModel::sltCurrentDragObjectDestroyed()
-{
-    /* Reset drag tokens starting from the root item: */
-    m_pRoot->resetDragToken();
-}
-
-void UIGraphicsSelectorModel::sltRemoveCurrentlySelectedGroup()
-{
-    /* Check which item is focused now: */
-    if (focusItem()->type() == UIGSelectorItemType_Group)
-    {
-        /* Delete that item: */
-        delete focusItem();
-        /* And update model: */
-        updateGroupTree();
-        updateNavigation();
-        updateLayout();
-        if (m_pRoot->hasItems())
-            setCurrentItem(0);
-        else
-            unsetCurrentItem();
-    }
-}
-
-void UIGraphicsSelectorModel::sltActionHovered(QAction *pAction)
-{
-    emit sigShowStatusMessage(pAction->statusTip());
-}
-
-void UIGraphicsSelectorModel::sltFocusItemDestroyed()
-{
-    AssertMsgFailed(("Focus item destroyed!"));
-}
-
-QVariant UIGraphicsSelectorModel::data(int iKey) const
-{
-    switch (iKey)
-    {
-        case SelectorModelData_Margin: return 0;
-        default: break;
-    }
-    return QVariant();
-}
-
-void UIGraphicsSelectorModel::prepareScene()
-{
-    m_pScene = new QGraphicsScene(this);
-    m_pScene->installEventFilter(this);
-}
-
-void UIGraphicsSelectorModel::prepareRoot()
-{
-    m_pRoot = new UIGSelectorItemGroup;
-    scene()->addItem(m_pRoot);
-}
-
-void UIGraphicsSelectorModel::prepareContextMenu()
-{
-    /* Context menu for empty group: */
-    m_pContextMenuRoot = new QMenu;
-    m_pContextMenuRoot->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_NewWizard));
-    m_pContextMenuRoot->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_AddDialog));
-
-    /* Context menu for group: */
-    m_pContextMenuGroup = new QMenu;
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_NewWizard));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_AddDialog));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveGroupDialog));
-    m_pContextMenuGroup->addSeparator();
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_State_Machine_StartOrShow));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Toggle_Machine_PauseAndResume));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Reset));
-    m_pContextMenuGroup->addMenu(gActionPool->action(UIActionIndexSelector_Menu_Machine_Close)->menu());
-    m_pContextMenuGroup->addSeparator();
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndex_Simple_LogDialog));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Refresh));
-    m_pContextMenuGroup->addSeparator();
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_ShowInFileManager));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_CreateShortcut));
-//    m_pContextMenuGroup->addSeparator();
-//    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Sort));
-
-    /* Context menu for machine(s): */
-    m_pContextMenuMachine = new QMenu;
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_SettingsDialog));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_CloneWizard));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveDialog));
-    m_pContextMenuMachine->addSeparator();
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_State_Machine_StartOrShow));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Toggle_Machine_PauseAndResume));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Reset));
-    m_pContextMenuMachine->addMenu(gActionPool->action(UIActionIndexSelector_Menu_Machine_Close)->menu());
-    m_pContextMenuMachine->addSeparator();
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Discard));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndex_Simple_LogDialog));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Refresh));
-    m_pContextMenuMachine->addSeparator();
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_ShowInFileManager));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_CreateShortcut));
-//    m_pContextMenuMachine->addSeparator();
-//    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Sort));
-
-    connect(m_pContextMenuRoot, SIGNAL(hovered(QAction*)), this, SLOT(sltActionHovered(QAction*)));
-    connect(m_pContextMenuGroup, SIGNAL(hovered(QAction*)), this, SLOT(sltActionHovered(QAction*)));
-    connect(m_pContextMenuMachine, SIGNAL(hovered(QAction*)), this, SLOT(sltActionHovered(QAction*)));
-}
-
-void UIGraphicsSelectorModel::prepareHandlers()
-{
-    m_pMouseHandler = new UIGraphicsSelectorMouseHandler(this);
-    m_pKeyboardHandler = new UIGraphicsSelectorKeyboardHandler(this);
-}
-
-void UIGraphicsSelectorModel::prepareGroupTree()
-{
-    /* Load group tree: */
-    loadGroupTree();
-    /* Load order: */
-    loadGroupsOrder();
-
-    /* Update model: */
-    updateNavigation();
-    updateLayout();
-    if (m_pRoot->hasItems())
-        setCurrentItem(0);
-    else
-        unsetCurrentItem();
-}
-
-void UIGraphicsSelectorModel::cleanupGroupTree()
-{
-    /* Save group tree: */
-    saveGroupTree();
-    /* Save order: */
-    saveGroupsOrder();
-}
-
-void UIGraphicsSelectorModel::cleanupHandlers()
-{
-    delete m_pKeyboardHandler;
-    m_pKeyboardHandler = 0;
-    delete m_pMouseHandler;
-    m_pMouseHandler = 0;
-}
-
-void UIGraphicsSelectorModel::cleanupContextMenu()
-{
-    delete m_pContextMenuRoot;
-    m_pContextMenuRoot = 0;
-    delete m_pContextMenuGroup;
-    m_pContextMenuGroup = 0;
-    delete m_pContextMenuMachine;
-    m_pContextMenuMachine = 0;
-}
-
-void UIGraphicsSelectorModel::cleanupRoot()
-{
-    delete m_pRoot;
-    m_pRoot = 0;
-}
-
-void UIGraphicsSelectorModel::cleanupScene()
-{
-    delete m_pScene;
-    m_pScene = 0;
-}
-
-bool UIGraphicsSelectorModel::eventFilter(QObject *pWatched, QEvent *pEvent)
-{
-    /* Process only scene events: */
-    if (pWatched != m_pScene)
-        return QObject::eventFilter(pWatched, pEvent);
-
-    /* Process only item is focused by model, not by scene: */
-    if (scene()->focusItem())
-        return QObject::eventFilter(pWatched, pEvent);
-
-    /* Checking event-type: */
-    switch (pEvent->type())
-    {
-        /* Keyboard handler: */
-        case QEvent::KeyPress:
-            return m_pKeyboardHandler->handle(static_cast<QKeyEvent*>(pEvent), UIKeyboardEventType_Press);
-        case QEvent::KeyRelease:
-            return m_pKeyboardHandler->handle(static_cast<QKeyEvent*>(pEvent), UIKeyboardEventType_Release);
-        /* Mouse handler: */
-        case QEvent::GraphicsSceneMousePress:
-            return m_pMouseHandler->handle(static_cast<QGraphicsSceneMouseEvent*>(pEvent), UIMouseEventType_Press);
-        case QEvent::GraphicsSceneMouseRelease:
-            return m_pMouseHandler->handle(static_cast<QGraphicsSceneMouseEvent*>(pEvent), UIMouseEventType_Release);
-        case QEvent::GraphicsSceneMouseDoubleClick:
-            return m_pMouseHandler->handle(static_cast<QGraphicsSceneMouseEvent*>(pEvent), UIMouseEventType_DoubleClick);
-        /* Context menu: */
-        case QEvent::GraphicsSceneContextMenu:
-            return processContextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent*>(pEvent));
-    }
-
-    /* Call to base-class: */
-    return QObject::eventFilter(pWatched, pEvent);
-}
-
-void UIGraphicsSelectorModel::clearRealFocus()
-{
-    /* Set real focus to null: */
-    scene()->setFocusItem(0);
-}
-
-UIVMItem* UIGraphicsSelectorModel::searchCurrentItem(const QList<UIGSelectorItem*> &list) const
-{
-    /* Iterate over all the passed items: */
-    foreach (UIGSelectorItem *pItem, list)
-    {
-        /* If item is machine, just return it: */
-        if (pItem->type() == UIGSelectorItemType_Machine)
-        {
-            if (UIGSelectorItemMachine *pMachineItem = pItem->toMachineItem())
-                return pMachineItem;
-        }
-        /* If item is group: */
-        else if (pItem->type() == UIGSelectorItemType_Group)
-        {
-            /* If it have at least one machine item: */
-            if (pItem->hasItems(UIGSelectorItemType_Machine))
-                /* Iterate over all the machine items recursively: */
-                return searchCurrentItem(pItem->items(UIGSelectorItemType_Machine));
-            /* If it have at least one group item: */
-            else if (pItem->hasItems(UIGSelectorItemType_Group))
-                /* Iterate over all the group items recursively: */
-                return searchCurrentItem(pItem->items(UIGSelectorItemType_Group));
-        }
-    }
-    return 0;
-}
-
-void UIGraphicsSelectorModel::enumerateCurrentItems(const QList<UIGSelectorItem*> &il, QList<UIVMItem*> &ol) const
-{
-    /* Enumerate all the passed items: */
-    foreach (UIGSelectorItem *pItem, il)
-    {
-        /* If item is machine, add if missed: */
-        if (pItem->type() == UIGSelectorItemType_Machine)
-        {
-            if (UIGSelectorItemMachine *pMachineItem = pItem->toMachineItem())
-                if (!contains(ol, pMachineItem))
-                    ol << pMachineItem;
-        }
-        /* If item is group: */
-        else if (pItem->type() == UIGSelectorItemType_Group)
-        {
-            /* Enumerate all the machine items recursively: */
-            enumerateCurrentItems(pItem->items(UIGSelectorItemType_Machine), ol);
-            /* Enumerate all the group items recursively: */
-            enumerateCurrentItems(pItem->items(UIGSelectorItemType_Group), ol);
-        }
-    }
-}
-
-bool UIGraphicsSelectorModel::contains(const QList<UIVMItem*> &list, UIVMItem *pItem) const
-{
-    /* Check if passed list contains passed item: */
-    foreach (UIVMItem *pIteratedItem, list)
-        if (pIteratedItem->id() == pItem->id())
-            return true;
-    return false;
-}
-
-void UIGraphicsSelectorModel::loadGroupTree()
-{
-    /* Add all the machines we have into the group-tree: */
-    foreach (const CMachine &machine, vboxGlobal().virtualBox().GetMachines())
-        addMachineIntoTheTree(machine);
-}
-
-void UIGraphicsSelectorModel::loadGroupsOrder()
-{
-    /* Load order starting form the root-item: */
-    loadGroupsOrder(m_pRoot);
-}
-
-void UIGraphicsSelectorModel::loadGroupsOrder(UIGSelectorItem *pParentItem)
-{
-    /* Prepare extra-data key for current group: */
-    QString strExtraDataKey = UIDefs::GUI_GroupDefinitions + fullName(pParentItem);
-    /* Read groups order: */
-    QStringList order = vboxGlobal().virtualBox().GetExtraDataStringList(strExtraDataKey);
-    /* Current groups list: */
-    const QList<UIGSelectorItem*> groupItems = pParentItem->items(UIGSelectorItemType_Group);
-    /* Current machine list: */
-    const QList<UIGSelectorItem*> machineItems = pParentItem->items(UIGSelectorItemType_Machine);
-    /* Iterate order list in backward direction: */
-    for (int i = order.size() - 1; i >= 0; --i)
-    {
-        /* Get current element: */
-        QString strOrderElement = order.at(i);
-        /* Get corresponding list of items: */
-        QList<UIGSelectorItem*> items;
-        QRegExp groupDescriptorRegExp("g(\\S)*=");
-        QRegExp machineDescriptorRegExp("m=");
-        if (groupDescriptorRegExp.indexIn(strOrderElement) == 0)
-            items = groupItems;
-        else if (machineDescriptorRegExp.indexIn(strOrderElement) == 0)
-            items = machineItems;
-        if (items.isEmpty())
-            continue;
-        /* Get element name: */
-        QString strElementName = strOrderElement.section('=', 1, -1);
-        /* Search for corresponding item: */
-        for (int i = 0; i < items.size(); ++i)
-        {
-            /* Get current item: */
-            UIGSelectorItem *pItem = items[i];
-            /* If item found: */
-            if (pItem->name() == strElementName)
-            {
-                /* Move it to the start of list: */
-                pParentItem->moveItemTo(pItem, 0);
-                /* If item is group: */
-                if (pItem->type() == UIGSelectorItemType_Group)
-                {
-                    /* Check descriptors we have: */
-                    QString strDescriptor(groupDescriptorRegExp.cap(1));
-                    if (strDescriptor.contains('o'))
-                        QTimer::singleShot(0, pItem, SLOT(sltOpen()));
-                }
-                break;
-            }
-        }
-    }
-    /* Update groups order for the sub-groups: */
-    foreach (UIGSelectorItem *pItem, pParentItem->items(UIGSelectorItemType_Group))
-        loadGroupsOrder(pItem);
-}
-
-void UIGraphicsSelectorModel::addMachineIntoTheTree(const CMachine &machine)
-{
-    /* Which groups current machine attached to? */
-    QVector<QString> groups = machine.GetGroups();
-    foreach (QString strGroup, groups)
-    {
-        /* Remove last '/' if any: */
-        if (strGroup.right(1) == "/")
-            strGroup.remove(strGroup.size() - 1, 1);
-        /* Search for the group item, create machine item: */
-        createMachineItem(machine, getGroupItem(strGroup, m_pRoot));
-    }
-    /* Update group definitions: */
-    m_groups[machine.GetId()] = UIStringSet::fromList(groups.toList());
-}
-
-UIGSelectorItem* UIGraphicsSelectorModel::getGroupItem(const QString &strName, UIGSelectorItem *pParent)
-{
-    /* Check passed stuff: */
-    if (pParent->name() == strName)
-        return pParent;
-
-    /* Prepare variables: */
-    QString strFirstSubName = strName.section('/', 0, 0);
-    QString strFirstSuffix = strName.section('/', 1, -1);
-    QString strSecondSubName = strFirstSuffix.section('/', 0, 0);
-    QString strSecondSuffix = strFirstSuffix.section('/', 1, -1);
-
-    /* Passed group name equal to first sub-name: */
-    if (pParent->name() == strFirstSubName)
-    {
-        /* Make sure first-suffix is NOT empty: */
-        AssertMsg(!strFirstSuffix.isEmpty(), ("Invalid group name!"));
-        /* Trying to get group item among our children: */
-        foreach (UIGSelectorItem *pGroupItem, pParent->items(UIGSelectorItemType_Group))
-            if (pGroupItem->name() == strSecondSubName)
-                return getGroupItem(strFirstSuffix, pGroupItem);
-    }
-
-    /* Found nothing? Creating: */
-    UIGSelectorItemGroup *pNewGroupItem = new UIGSelectorItemGroup(pParent, strSecondSubName);
-    return strSecondSuffix.isEmpty() ? pNewGroupItem : getGroupItem(strFirstSuffix, pNewGroupItem);
-}
-
-void UIGraphicsSelectorModel::createMachineItem(const CMachine &machine, UIGSelectorItem *pWhere)
-{
-    /* Create corresponding item: */
-    new UIGSelectorItemMachine(pWhere, machine);
-}
-
-void UIGraphicsSelectorModel::saveGroupTree()
-{
-    /* Prepare machine map: */
-    QMap<QString, QStringList> groups;
-    /* Iterate over all the items: */
-    gatherGroupTree(groups, m_pRoot);
-    /* Saving groups: */
-    foreach (const QString &strId, groups.keys())
-    {
-        /* Get new group list: */
-        const QStringList &newGroupList = groups.value(strId);
-        /* Get old group set: */
-        AssertMsg(m_groups.contains(strId), ("Invalid group set!"));
-        const UIStringSet &oldGroupSet = m_groups.value(strId);
-        /* Get new group set: */
-        const UIStringSet &newGroupSet = UIStringSet::fromList(newGroupList);
-        /* Is group set changed? */
-        if (oldGroupSet != newGroupSet)
-        {
-            /* Open session to save machine settings: */
-            CSession session = vboxGlobal().openSession(strId);
-            if (session.isNull())
-                return;
-            /* Get machine: */
-            CMachine machine = session.GetMachine();
-            /* Save groups: */
-            printf(" Saving groups for machine {%s}: {%s}\n",
-                   machine.GetName().toAscii().constData(),
-                   newGroupList.join(",").toAscii().constData());
-            machine.SetGroups(newGroupList.toVector());
-            machine.SaveSettings();
-            if (!machine.isOk())
-                msgCenter().cannotSaveMachineSettings(machine);
-            /* Close the session: */
-            session.UnlockMachine();
-        }
-    }
-}
-
-void UIGraphicsSelectorModel::saveGroupsOrder()
-{
-    /* Clear all the extra-data records related to group-definitions: */
-    const QVector<QString> extraDataKeys = vboxGlobal().virtualBox().GetExtraDataKeys();
-    foreach (const QString &strKey, extraDataKeys)
-        if (strKey.startsWith(UIDefs::GUI_GroupDefinitions))
-            vboxGlobal().virtualBox().SetExtraData(strKey, QString());
-    /* Save order starting from the root-item: */
-    saveGroupsOrder(m_pRoot);
-}
-
-void UIGraphicsSelectorModel::saveGroupsOrder(UIGSelectorItem *pParentItem)
-{
-    /* Prepare extra-data key for current group: */
-    QString strExtraDataKey = UIDefs::GUI_GroupDefinitions + fullName(pParentItem);
-    /* Gather item order: */
-    QStringList order;
-    foreach (UIGSelectorItem *pItem, pParentItem->items(UIGSelectorItemType_Group))
-    {
-        saveGroupsOrder(pItem);
-        QString strGroupDescriptor(pItem->toGroupItem()->opened() ? "go" : "gc");
-        order << QString("%1=%2").arg(strGroupDescriptor, pItem->name());
-    }
-    foreach (UIGSelectorItem *pItem, pParentItem->items(UIGSelectorItemType_Machine))
-        order << QString("m=%1").arg(pItem->name());
-    vboxGlobal().virtualBox().SetExtraDataStringList(strExtraDataKey, order);
-}
-
-void UIGraphicsSelectorModel::gatherGroupTree(QMap<QString, QStringList> &groups,
-                                              UIGSelectorItem *pParentGroup)
-{
-    /* Iterate over all the machine items: */
-    foreach (UIGSelectorItem *pItem, pParentGroup->items(UIGSelectorItemType_Machine))
-        if (UIGSelectorItemMachine *pMachineItem = pItem->toMachineItem())
-            groups[pMachineItem->id()] << fullName(pParentGroup);
-    /* Iterate over all the group items: */
-    foreach (UIGSelectorItem *pItem, pParentGroup->items(UIGSelectorItemType_Group))
-        gatherGroupTree(groups, pItem);
-}
-
-QString UIGraphicsSelectorModel::fullName(UIGSelectorItem *pItem)
-{
-    /* Return '/' for root-group: */
-    if (!pItem->parentItem())
-        return QString("/");
-    /* Get full parent name, append with '/' if not yet appended: */
-    QString strParentFullName = fullName(pItem->parentItem());
-    if (!strParentFullName.endsWith("/"))
-        strParentFullName += QString("/");
-    /* Return full item name based on parent prefix: */
-    return strParentFullName + pItem->name();
-}
-
-void UIGraphicsSelectorModel::updateGroupTree(UIGSelectorItem *pGroupItem)
-{
-    /* Cleanup all the group items first: */
-    foreach (UIGSelectorItem *pSubGroupItem, pGroupItem->items(UIGSelectorItemType_Group))
-        updateGroupTree(pSubGroupItem);
-    /* Cleanup only non-root items: */
-    if (pGroupItem->parentItem() && !pGroupItem->hasItems())
-        delete pGroupItem;
-}
-
-QList<UIGSelectorItem*> UIGraphicsSelectorModel::createNavigationList(UIGSelectorItem *pItem)
-{
-    /* Prepare navigation list: */
-    QList<UIGSelectorItem*> navigationItems;
-
-    /* Iterate over all the group items: */
-    foreach (UIGSelectorItem *pGroupItem, pItem->items(UIGSelectorItemType_Group))
-    {
-        navigationItems << pGroupItem;
-        if (pGroupItem->toGroupItem()->opened())
-            navigationItems << createNavigationList(pGroupItem);
-    }
-    /* Iterate over all the machine items: */
-    foreach (UIGSelectorItem *pMachineItem, pItem->items(UIGSelectorItemType_Machine))
-        navigationItems << pMachineItem;
-
-    /* Return navigation list: */
-    return navigationItems;
-}
-
-void UIGraphicsSelectorModel::updateMachineItems(const QString &strId, UIGSelectorItem *pParent)
-{
-    /* For each group item in passed parent: */
-    foreach (UIGSelectorItem *pItem, pParent->items(UIGSelectorItemType_Group))
-        updateMachineItems(strId, pItem->toGroupItem());
-    /* For each machine item in passed parent: */
-    foreach (UIGSelectorItem *pItem, pParent->items(UIGSelectorItemType_Machine))
-        if (UIGSelectorItemMachine *pMachineItem = pItem->toMachineItem())
-            if (pMachineItem->id() == strId)
-            {
-                pMachineItem->recache();
-                pMachineItem->update();
-            }
-}
-
-void UIGraphicsSelectorModel::removeMachineItems(const QString &strId, UIGSelectorItem *pParent)
-{
-    /* For each group item in passed parent: */
-    foreach (UIGSelectorItem *pItem, pParent->items(UIGSelectorItemType_Group))
-        removeMachineItems(strId, pItem->toGroupItem());
-    /* For each machine item in passed parent: */
-    foreach (UIGSelectorItem *pItem, pParent->items(UIGSelectorItemType_Machine))
-        if (pItem->toMachineItem()->id() == strId)
-            delete pItem;
-}
-
-UIGSelectorItem* UIGraphicsSelectorModel::getMachineItem(const QString &strId, UIGSelectorItem *pParent)
-{
-    /* Search among all the machine items of passed parent: */
-    foreach (UIGSelectorItem *pItem, pParent->items(UIGSelectorItemType_Machine))
-        if (UIGSelectorItemMachine *pMachineItem = pItem->toMachineItem())
-            if (pMachineItem->id() == strId)
-                return pMachineItem;
-    /* Search among all the group items of passed parent: */
-    foreach (UIGSelectorItem *pItem, pParent->items(UIGSelectorItemType_Group))
-        if (UIGSelectorItem *pMachineItem = getMachineItem(strId, pItem))
-            return pMachineItem;
-    /* Nothing found? */
-    return 0;
-}
-
-bool UIGraphicsSelectorModel::processContextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent)
-{
-    /* Whats the reason? */
-    switch (pEvent->reason())
-    {
-        case QGraphicsSceneContextMenuEvent::Mouse:
-        {
-            /* First of all we should look for an item under cursor: */
-            if (QGraphicsItem *pItem = itemAt(pEvent->scenePos()))
-            {
-                /* If this item of known type? */
-                switch (pItem->type())
-                {
-                    case UIGSelectorItemType_Group:
-                    {
-                        /* Get group item: */
-                        UIGSelectorItem *pGroupItem = qgraphicsitem_cast<UIGSelectorItemGroup*>(pItem);
-                        /* Is this group item only the one selected? */
-                        if (selectionList().contains(pGroupItem) && selectionList().size() == 1)
-                        {
-                            /* Group context menu in that case: */
-                            popupContextMenu(UIGraphicsSelectorContextMenuType_Group, pEvent->screenPos());
-                            return true;
-                        }
-                        /* Is this root-group item? */
-                        else if (!pGroupItem->parentItem())
-                        {
-                            /* Root context menu in that cases: */
-                            popupContextMenu(UIGraphicsSelectorContextMenuType_Root, pEvent->screenPos());
-                            return true;
-                        }
-                    }
-                    case UIGSelectorItemType_Machine:
-                    {
-                        /* Machine context menu for other Group/Machine cases: */
-                        popupContextMenu(UIGraphicsSelectorContextMenuType_Machine, pEvent->screenPos());
-                        return true;
-                    }
-                    default:
-                        break;
-                }
-            }
-            /* Root context menu for all the other cases: */
-            popupContextMenu(UIGraphicsSelectorContextMenuType_Root, pEvent->screenPos());
-            return true;
-        }
-        case QGraphicsSceneContextMenuEvent::Keyboard:
-        {
-            /* Get first selected item: */
-            if (UIGSelectorItem *pItem = selectionList().first())
-            {
-                /* If this item of known type? */
-                switch (pItem->type())
-                {
-                    case UIGSelectorItemType_Group:
-                    {
-                        /* Is this group item only the one selected? */
-                        if (selectionList().size() == 1)
-                        {
-                            /* Group context menu in that case: */
-                            popupContextMenu(UIGraphicsSelectorContextMenuType_Group, pEvent->screenPos());
-                            return true;
-                        }
-                    }
-                    case UIGSelectorItemType_Machine:
-                    {
-                        /* Machine context menu for other Group/Machine cases: */
-                        popupContextMenu(UIGraphicsSelectorContextMenuType_Machine, pEvent->screenPos());
-                        return true;
-                    }
-                    default:
-                        break;
-                }
-            }
-            /* Root context menu for all the other cases: */
-            popupContextMenu(UIGraphicsSelectorContextMenuType_Root, pEvent->screenPos());
-            return true;
-        }
-        default:
-            break;
-    }
-    /* Pass others context menu events: */
-    return false;
-}
-
-void UIGraphicsSelectorModel::popupContextMenu(UIGraphicsSelectorContextMenuType type, QPoint point)
-{
-    /* Which type of context-menu requested? */
-    switch (type)
-    {
-        /* For empty group? */
-        case UIGraphicsSelectorContextMenuType_Root:
-        {
-            m_pContextMenuRoot->exec(point);
-            break;
-        }
-        /* For group? */
-        case UIGraphicsSelectorContextMenuType_Group:
-        {
-            m_pContextMenuGroup->exec(point);
-            break;
-        }
-        /* For machine(s)? */
-        case UIGraphicsSelectorContextMenuType_Machine:
-        {
-            m_pContextMenuMachine->exec(point);
-            break;
-        }
-    }
-    /* Clear status-bar: */
-    emit sigClearStatusMessage();
-}
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorModel.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorModel.h	(revision 42553)
+++ 	(revision )
@@ -1,232 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsSelectorModel class declaration
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-#ifndef __UIGraphicsSelectorModel_h__
-#define __UIGraphicsSelectorModel_h__
-
-/* Qt includes: */
-#include <QObject>
-#include <QPointer>
-#include <QTransform>
-#include <QMap>
-#include <QSet>
-
-/* COM includes: */
-#include "COMEnums.h"
-
-/* Forward declaration: */
-class QGraphicsScene;
-class QGraphicsItem;
-class QDrag;
-class QMenu;
-class QAction;
-class QGraphicsSceneContextMenuEvent;
-class CMachine;
-class UIGSelectorItem;
-class UIVMItem;
-class UIGraphicsSelectorMouseHandler;
-class UIGraphicsSelectorKeyboardHandler;
-
-/* Type defs: */
-typedef QSet<QString> UIStringSet;
-
-/* Context-menu type: */
-enum UIGraphicsSelectorContextMenuType
-{
-    UIGraphicsSelectorContextMenuType_Root,
-    UIGraphicsSelectorContextMenuType_Group,
-    UIGraphicsSelectorContextMenuType_Machine
-};
-
-/* Graphics selector model: */
-class UIGraphicsSelectorModel : public QObject
-{
-    Q_OBJECT;
-
-signals:
-
-    /* Notify listeners about root-item height changed: */
-    void sigRootItemResized(const QSizeF &size, int iMinimumWidth);
-
-    /* Notify listeners about selection change: */
-    void sigSelectionChanged();
-
-    /* Notify listeners to show corresponding status-bar message: */
-    void sigClearStatusMessage();
-    void sigShowStatusMessage(const QString &strStatusMessage);
-
-public:
-
-    /* Constructor/destructor: */
-    UIGraphicsSelectorModel(QObject *pParent);
-    ~UIGraphicsSelectorModel();
-
-    /* API: Load/save stuff: */
-    void load();
-    void save();
-
-    /* API: Scene getter: */
-    QGraphicsScene* scene() const;
-
-    /* API: Current item stuff: */
-    void setCurrentItem(int iItemIndex);
-    void setCurrentItem(UIGSelectorItem *pItem);
-    void unsetCurrentItem();
-    UIVMItem* currentItem() const;
-    QList<UIVMItem*> currentItems() const;
-
-    /* API: Focus item stuff: */
-    void setFocusItem(UIGSelectorItem *pItem, bool fWithSelection = false);
-    UIGSelectorItem* focusItem() const;
-
-    /* API: Positioning item stuff: */
-    QGraphicsItem* itemAt(const QPointF &position, const QTransform &deviceTransform = QTransform()) const;
-
-    /* API: Update stuff: */
-    void updateGroupTree();
-
-    /* API: Navigation stuff: */
-    const QList<UIGSelectorItem*>& navigationList() const;
-    void removeFromNavigationList(UIGSelectorItem *pItem);
-    void clearNavigationList();
-    void updateNavigation();
-
-    /* API: Selection stuff: */
-    const QList<UIGSelectorItem*>& selectionList() const;
-    void addToSelectionList(UIGSelectorItem *pItem);
-    void removeFromSelectionList(UIGSelectorItem *pItem);
-    void clearSelectionList();
-    void notifySelectionChanged();
-
-    /* API: Layout stuff: */
-    void updateLayout();
-
-    /* API: Drag and drop stuff: */
-    void setCurrentDragObject(QDrag *pDragObject);
-
-    /* API: Activate stuff: */
-    void activate();
-
-private slots:
-
-    /* Handlers: Global events: */
-    void sltMachineStateChanged(QString strId, KMachineState state);
-    void sltMachineDataChanged(QString strId);
-    void sltMachineRegistered(QString strId, bool fRegistered);
-    void sltSessionStateChanged(QString strId, KSessionState state);
-    void sltSnapshotChanged(QString strId, QString strSnapshotId);
-
-    /* Handler: View-resize: */
-    void sltHandleViewResized();
-
-    /* Handler: Drag object destruction: */
-    void sltCurrentDragObjectDestroyed();
-
-    /* Handler: Remove currently selected group: */
-    void sltRemoveCurrentlySelectedGroup();
-
-    /* Handler: Context menu hovering: */
-    void sltActionHovered(QAction *pAction);
-
-    /* Handler: Focus item destruction: */
-    void sltFocusItemDestroyed();
-
-private:
-
-    /* Data enumerator: */
-    enum SelectorModelData
-    {
-        /* Layout hints: */
-        SelectorModelData_Margin
-    };
-
-    /* Data provider: */
-    QVariant data(int iKey) const;
-
-    /* Helpers: Prepare stuff: */
-    void prepareScene();
-    void prepareRoot();
-    void prepareContextMenu();
-    void prepareHandlers();
-    void prepareGroupTree();
-
-    /* Helpers: Cleanup stuff: */
-    void cleanupGroupTree();
-    void cleanupHandlers();
-    void cleanupContextMenu();
-    void cleanupRoot();
-    void cleanupScene();
-
-    /* Event handlers: */
-    bool eventFilter(QObject *pWatched, QEvent *pEvent);
-
-    /* Helpers: Focus item stuff: */
-    void clearRealFocus();
-
-    /* Helpers: Current item stuff: */
-    UIVMItem* searchCurrentItem(const QList<UIGSelectorItem*> &list) const;
-    void enumerateCurrentItems(const QList<UIGSelectorItem*> &il, QList<UIVMItem*> &ol) const;
-    bool contains(const QList<UIVMItem*> &list, UIVMItem *pItem) const;
-
-    /* Helpers: Loading: */
-    void loadGroupTree();
-    void loadGroupsOrder();
-    void loadGroupsOrder(UIGSelectorItem *pParentItem);
-    void addMachineIntoTheTree(const CMachine &machine);
-    UIGSelectorItem* getGroupItem(const QString &strName, UIGSelectorItem *pParent);
-    void createMachineItem(const CMachine &machine, UIGSelectorItem *pWhere);
-
-    /* Helpers: Saving: */
-    void saveGroupTree();
-    void saveGroupsOrder();
-    void saveGroupsOrder(UIGSelectorItem *pParentItem);
-    void gatherGroupTree(QMap<QString, QStringList> &groups, UIGSelectorItem *pParentGroup);
-    QString fullName(UIGSelectorItem *pItem);
-
-    /* Helpers: Update stuff: */
-    void updateGroupTree(UIGSelectorItem *pGroupItem);
-
-    /* Helpers: Navigation stuff: */
-    QList<UIGSelectorItem*> createNavigationList(UIGSelectorItem *pItem);
-
-    /* Helpers: Global event stuff: */
-    void updateMachineItems(const QString &strId, UIGSelectorItem *pParent);
-    void removeMachineItems(const QString &strId, UIGSelectorItem *pParent);
-    UIGSelectorItem* getMachineItem(const QString &strId, UIGSelectorItem *pParent);
-
-    /* Helpers: Context menu stuff: */
-    bool processContextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent);
-    void popupContextMenu(UIGraphicsSelectorContextMenuType type, QPoint point);
-
-    /* Variables: */
-    QGraphicsScene *m_pScene;
-    UIGSelectorItem *m_pRoot;
-    QMap<QString, UIStringSet> m_groups;
-    QList<UIGSelectorItem*> m_navigationList;
-    QList<UIGSelectorItem*> m_selectionList;
-    UIGraphicsSelectorMouseHandler *m_pMouseHandler;
-    UIGraphicsSelectorKeyboardHandler *m_pKeyboardHandler;
-    QPointer<QDrag> m_pCurrentDragObject;
-    QPointer<UIGSelectorItem> m_pFocusItem;
-    QMenu *m_pContextMenuRoot;
-    QMenu *m_pContextMenuGroup;
-    QMenu *m_pContextMenuMachine;
-};
-
-#endif /* __UIGraphicsSelectorModel_h__ */
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorMouseHandler.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorMouseHandler.cpp	(revision 42553)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsSelectorMouseHandler class implementation
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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 <QGraphicsSceneMouseEvent>
-
-/* GUI incluedes: */
-#include "UIGraphicsSelectorMouseHandler.h"
-#include "UIGraphicsSelectorModel.h"
-#include "UIGSelectorItemGroup.h"
-#include "UIGSelectorItemMachine.h"
-
-UIGraphicsSelectorMouseHandler::UIGraphicsSelectorMouseHandler(UIGraphicsSelectorModel *pParent)
-    : QObject(pParent)
-    , m_pModel(pParent)
-{
-}
-
-bool UIGraphicsSelectorMouseHandler::handle(QGraphicsSceneMouseEvent *pEvent, UIMouseEventType type) const
-{
-    /* Process passed event: */
-    switch (type)
-    {
-        case UIMouseEventType_Press: return handleMousePress(pEvent);
-        case UIMouseEventType_Release: return handleMouseRelease(pEvent);
-        case UIMouseEventType_DoubleClick: return handleMouseDoubleClick(pEvent);
-    }
-    /* Pass event if unknown: */
-    return false;
-}
-
-UIGraphicsSelectorModel* UIGraphicsSelectorMouseHandler::model() const
-{
-    return m_pModel;
-}
-
-bool UIGraphicsSelectorMouseHandler::handleMousePress(QGraphicsSceneMouseEvent *pEvent) const
-{
-    /* Get item under mouse cursor: */
-    QPointF scenePos = pEvent->scenePos();
-    if (QGraphicsItem *pItemUnderMouse = model()->itemAt(scenePos))
-    {
-        /* Which button it was? */
-        switch (pEvent->button())
-        {
-            /* Left one? */
-            case Qt::LeftButton:
-            {
-                /* Which item we just clicked? */
-                UIGSelectorItem *pClickedItem = 0;
-                /* Was that a group item? */
-                if (UIGSelectorItemGroup *pGroupItem = qgraphicsitem_cast<UIGSelectorItemGroup*>(pItemUnderMouse))
-                    pClickedItem = pGroupItem;
-                /* Or a machine one? */
-                else if (UIGSelectorItemMachine *pMachineItem = qgraphicsitem_cast<UIGSelectorItemMachine*>(pItemUnderMouse))
-                    pClickedItem = pMachineItem;
-                /* If we had clicked one of the required item types: */
-                if (pClickedItem)
-                {
-                    /* For non-root items: */
-                    if (pClickedItem->parentItem())
-                    {
-                        /* Move focus to clicked item: */
-                        model()->setFocusItem(pClickedItem);
-                        /* Was 'shift' modifier pressed? */
-                        if (pEvent->modifiers() == Qt::ShiftModifier)
-                        {
-                            /* Calculate positions: */
-                            UIGSelectorItem *pFirstItem = model()->selectionList().first();
-                            int iFirstPosition = model()->navigationList().indexOf(pFirstItem);
-                            int iClickedPosition = model()->navigationList().indexOf(pClickedItem);
-                            /* Clear selection: */
-                            model()->clearSelectionList();
-                            /* Select all the items from 'first' to 'clicked': */
-                            if (iFirstPosition <= iClickedPosition)
-                                for (int i = iFirstPosition; i <= iClickedPosition; ++i)
-                                    model()->addToSelectionList(model()->navigationList().at(i));
-                            else
-                                for (int i = iFirstPosition; i >= iClickedPosition; --i)
-                                    model()->addToSelectionList(model()->navigationList().at(i));
-                        }
-                        /* Was 'control' modifier pressed? */
-                        else if (pEvent->modifiers() == Qt::ControlModifier)
-                        {
-                            /* Select clicked item, inverting if necessary: */
-                            if (model()->selectionList().contains(pClickedItem))
-                                model()->removeFromSelectionList(pClickedItem);
-                            else
-                                model()->addToSelectionList(pClickedItem);
-                        }
-                        /* Was no modifiers pressed? */
-                        else if (pEvent->modifiers() == Qt::NoModifier)
-                        {
-                            /* Move selection to clicked item: */
-                            model()->clearSelectionList();
-                            model()->addToSelectionList(pClickedItem);
-                        }
-                        /* Notify selection changed: */
-                        model()->notifySelectionChanged();
-                    }
-                }
-                break;
-            }
-            /* Right one? */
-            case Qt::RightButton:
-            {
-                /* Which item we just clicked? */
-                UIGSelectorItem *pClickedItem = 0;
-                /* Was that a group item? */
-                if (UIGSelectorItemGroup *pGroupItem = qgraphicsitem_cast<UIGSelectorItemGroup*>(pItemUnderMouse))
-                    pClickedItem = pGroupItem;
-                /* Or a machine one? */
-                else if (UIGSelectorItemMachine *pMachineItem = qgraphicsitem_cast<UIGSelectorItemMachine*>(pItemUnderMouse))
-                    pClickedItem = pMachineItem;
-                /* If we had clicked one of the required item types: */
-                if (pClickedItem)
-                {
-                    /* For non-root items: */
-                    if (pClickedItem->parentItem())
-                    {
-                        /* Is clicked item in selection list: */
-                        bool fIsClickedItemInSelectionList = contains(model()->selectionList(), pClickedItem);
-                        /* Move focus to clicked item (with selection if not selected yet): */
-                        model()->setFocusItem(pClickedItem, !fIsClickedItemInSelectionList);
-                    }
-                }
-                break;
-            }
-            default:
-                break;
-        }
-    }
-    /* Pass all other events: */
-    return false;
-}
-
-bool UIGraphicsSelectorMouseHandler::handleMouseRelease(QGraphicsSceneMouseEvent*) const
-{
-    /* Pass all events: */
-    return false;
-}
-
-bool UIGraphicsSelectorMouseHandler::handleMouseDoubleClick(QGraphicsSceneMouseEvent *pEvent) const
-{
-    /* Get item under mouse cursor: */
-    QPointF scenePos = pEvent->scenePos();
-    if (QGraphicsItem *pItemUnderMouse = model()->itemAt(scenePos))
-    {
-        /* Which button it was? */
-        switch (pEvent->button())
-        {
-            /* Left one? */
-            case Qt::LeftButton:
-            {
-                /* Was that a group item? */
-                if (UIGSelectorItemGroup *pGroupItem = qgraphicsitem_cast<UIGSelectorItemGroup*>(pItemUnderMouse))
-                {
-                    /* Toggle group item: */
-                    if (pGroupItem->opened())
-                        pGroupItem->close();
-                    else if (pGroupItem->closed())
-                        pGroupItem->open();
-                    /* Filter that event out: */
-                    return true;
-                }
-                /* Or a machine one? */
-                else if (qgraphicsitem_cast<UIGSelectorItemMachine*>(pItemUnderMouse))
-                {
-                    /* Activate machine item: */
-                    model()->activate();
-                    /* Filter that event out: */
-                    return true;
-                }
-                break;
-            }
-            default:
-                break;
-        }
-    }
-    /* Pass all other events: */
-    return false;
-}
-
-bool UIGraphicsSelectorMouseHandler::contains(QList<UIGSelectorItem*> list,
-                                              UIGSelectorItem *pRequiredItem,
-                                              bool fRecursively /* = false */) const
-{
-    /* Search throught the all passed list items: */
-    foreach (UIGSelectorItem *pItem, list)
-    {
-        /* Check item first: */
-        if (pItem == pRequiredItem)
-            return true;
-        /* Check if this item supports children: */
-        if (fRecursively && pItem->type() == UIGSelectorItemType_Group)
-        {
-            /* Check machine items recursively: */
-            if (contains(pItem->items(UIGSelectorItemType_Machine), pRequiredItem))
-                return true;
-            /* Check group items recursively: */
-            if (contains(pItem->items(UIGSelectorItemType_Group), pRequiredItem))
-                return true;
-        }
-    }
-    return false;
-}
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorMouseHandler.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorMouseHandler.h	(revision 42553)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsSelectorMouseHandler class declaration
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-#ifndef __UIGraphicsSelectorMouseHandler_h__
-#define __UIGraphicsSelectorMouseHandler_h__
-
-/* Qt includes: */
-#include <QObject>
-
-/* Forward declarations: */
-class UIGraphicsSelectorModel;
-class QGraphicsSceneMouseEvent;
-class UIGSelectorItem;
-
-/* Mouse event type: */
-enum UIMouseEventType
-{
-    UIMouseEventType_Press,
-    UIMouseEventType_Release,
-    UIMouseEventType_DoubleClick
-};
-
-/* Mouse handler for graphics selector: */
-class UIGraphicsSelectorMouseHandler : public QObject
-{
-    Q_OBJECT;
-
-public:
-
-    /* Constructor: */
-    UIGraphicsSelectorMouseHandler(UIGraphicsSelectorModel *pParent);
-
-    /* API: Model mouse-event handler delegate: */
-    bool handle(QGraphicsSceneMouseEvent *pEvent, UIMouseEventType type) const;
-
-private:
-
-    /* Model wrapper: */
-    UIGraphicsSelectorModel* model() const;
-
-    /* Helpers: Model mouse-event handler delegates: */
-    bool handleMousePress(QGraphicsSceneMouseEvent *pEvent) const;
-    bool handleMouseRelease(QGraphicsSceneMouseEvent *pEvent) const;
-    bool handleMouseDoubleClick(QGraphicsSceneMouseEvent *pEvent) const;
-
-    /* Helpers: Others: */
-    bool contains(QList<UIGSelectorItem*> list, UIGSelectorItem *pRequiredItem, bool fRecursively = false) const;
-
-    /* Variables: */
-    UIGraphicsSelectorModel *m_pModel;
-};
-
-#endif /* __UIGraphicsSelectorMouseHandler_h__ */
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorView.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorView.cpp	(revision 42553)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsSelectorView class implementation
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-/* GUI includes: */
-#include "UIGraphicsSelectorView.h"
-#include "UIGraphicsSelectorModel.h"
-
-UIGraphicsSelectorView::UIGraphicsSelectorView(QWidget *pParent)
-    : QGraphicsView(pParent)
-{
-    /* Scrollbars policy: */
-    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
-    /* Update scene-rect: */
-    updateSceneRect();
-}
-
-void UIGraphicsSelectorView::sltHandleRootItemResized(const QSizeF &size, int iMinimumWidth)
-{
-    /* Update scene-rect: */
-    updateSceneRect(size);
-
-    /* Set minimum width: */
-    setMinimumWidth(2 * frameWidth() + iMinimumWidth + 10);
-}
-
-void UIGraphicsSelectorView::resizeEvent(QResizeEvent*)
-{
-    /* Update scene-rect: */
-    updateSceneRect();
-    /* Notify listeners: */
-    emit sigResized();
-}
-
-void UIGraphicsSelectorView::updateSceneRect(const QSizeF &sizeHint /* = QSizeF() */)
-{
-    QPointF topLeft = QPointF(0, 0);
-    QSizeF rectSize = viewport()->size();
-    if (!sizeHint.isNull())
-        rectSize = rectSize.expandedTo(sizeHint);
-    setSceneRect(QRectF(topLeft, rectSize));
-}
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorView.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsSelectorView.h	(revision 42553)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsSelectorView class declaration
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-#ifndef __UIGraphicsSelectorView_h__
-#define __UIGraphicsSelectorView_h__
-
-/* Qt includes: */
-#include <QGraphicsView>
-
-/* Forward declaration: */
-class UIGraphicsSelectorModel;
-class QKeyEvent;
-
-/* Graphics selector view: */
-class UIGraphicsSelectorView : public QGraphicsView
-{
-    Q_OBJECT;
-
-signals:
-
-    /* Notify listeners about size change: */
-    void sigResized();
-
-public:
-
-    /* Constructor: */
-    UIGraphicsSelectorView(QWidget *pParent);
-
-private slots:
-
-    /* Handles root item height change: */
-    void sltHandleRootItemResized(const QSizeF &size, int iMinimumWidth);
-
-private:
-
-    /* Resize-event handler: */
-    void resizeEvent(QResizeEvent *pEvent);
-
-    /* Helpers: */
-    void updateSceneRect(const QSizeF &sizeHint = QSizeF());
-};
-
-#endif /* __UIGraphicsSelectorView_h__ */
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsViewChooser.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsViewChooser.cpp	(revision 42553)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/* $Id$ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsViewChooser class implementation
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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 <QVBoxLayout>
-#include <QStatusBar>
-
-/* GUI includes: */
-#include "UIGraphicsViewChooser.h"
-#include "UIGraphicsSelectorModel.h"
-#include "UIGraphicsSelectorView.h"
-#include "UIVirtualBoxEventHandler.h"
-#include "UIIconPool.h"
-#include "UIActionPoolSelector.h"
-
-/* COM includes: */
-#include "COMEnums.h"
-#include "CMachine.h"
-
-UIGraphicsViewChooser::UIGraphicsViewChooser(QWidget *pParent)
-    : QWidget(pParent)
-    , m_pMainLayout(0)
-    , m_pSelectorModel(0)
-    , m_pSelectorView(0)
-    , m_pStatusBar(0)
-{
-    /* Create main-layout: */
-    m_pMainLayout = new QVBoxLayout(this);
-    m_pMainLayout->setContentsMargins(0, 0, 0, 0);
-    m_pMainLayout->setSpacing(0);
-
-    /* Create selector-model: */
-    m_pSelectorModel = new UIGraphicsSelectorModel(this);
-
-    /* Create selector-view: */
-    m_pSelectorView = new UIGraphicsSelectorView(this);
-    m_pSelectorView->setFrameShape(QFrame::NoFrame);
-    m_pSelectorView->setFrameShadow(QFrame::Plain);
-    m_pSelectorView->setScene(m_pSelectorModel->scene());
-    m_pSelectorView->show();
-    setFocusProxy(m_pSelectorView);
-
-    /* Add tool-bar into layout: */
-    m_pMainLayout->addWidget(m_pSelectorView);
-
-    /* Prepare connections: */
-    prepareConnections();
-
-    /* Load model: */
-    m_pSelectorModel->load();
-}
-
-UIGraphicsViewChooser::~UIGraphicsViewChooser()
-{
-    /* Save model: */
-    m_pSelectorModel->save();
-}
-
-void UIGraphicsViewChooser::setCurrentItem(int iCurrentItemIndex)
-{
-    m_pSelectorModel->setCurrentItem(iCurrentItemIndex);
-}
-
-UIVMItem* UIGraphicsViewChooser::currentItem() const
-{
-    return m_pSelectorModel->currentItem();
-}
-
-QList<UIVMItem*> UIGraphicsViewChooser::currentItems() const
-{
-    return m_pSelectorModel->currentItems();
-}
-
-void UIGraphicsViewChooser::setStatusBar(QStatusBar *pStatusBar)
-{
-    /* Old status-bar set? */
-    if (m_pStatusBar)
-       m_pSelectorModel->disconnect(m_pStatusBar);
-
-    /* Connect new status-bar: */
-    m_pStatusBar = pStatusBar;
-    connect(m_pSelectorModel, SIGNAL(sigClearStatusMessage()), m_pStatusBar, SLOT(clearMessage()));
-    connect(m_pSelectorModel, SIGNAL(sigShowStatusMessage(const QString&)), m_pStatusBar, SLOT(showMessage(const QString&)));
-}
-
-void UIGraphicsViewChooser::prepareConnections()
-{
-    /* Selector-model connections: */
-    connect(m_pSelectorModel, SIGNAL(sigRootItemResized(const QSizeF&, int)),
-            m_pSelectorView, SLOT(sltHandleRootItemResized(const QSizeF&, int)));
-    connect(m_pSelectorModel, SIGNAL(sigSelectionChanged()), this, SIGNAL(sigSelectionChanged()));
-
-    /* Selector-view connections: */
-    connect(m_pSelectorView, SIGNAL(sigResized()), m_pSelectorModel, SLOT(sltHandleViewResized()));
-
-    /* Global connections: */
-    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), m_pSelectorModel, SLOT(sltMachineStateChanged(QString, KMachineState)));
-    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), m_pSelectorModel, SLOT(sltMachineDataChanged(QString)));
-    connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), m_pSelectorModel, SLOT(sltMachineRegistered(QString, bool)));
-    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), m_pSelectorModel, SLOT(sltSessionStateChanged(QString, KSessionState)));
-    connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), m_pSelectorModel, SLOT(sltSnapshotChanged(QString, QString)));
-
-    /* Context menu connections: */
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_RemoveGroupDialog), SIGNAL(triggered()),
-            m_pSelectorModel, SLOT(sltRemoveCurrentlySelectedGroup()));
-}
-
Index: unk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsViewChooser.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGraphicsViewChooser.h	(revision 42553)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsViewChooser class declaration
- */
-
-/*
- * Copyright (C) 2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * 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.
- */
-
-#ifndef __UIGraphicsViewChooser_h__
-#define __UIGraphicsViewChooser_h__
-
-/* Qt includes: */
-#include <QWidget>
-
-/* GUI includes: */
-#include "UIGSelectorItem.h"
-
-/* Forward declartions: */
-class UIVMItem;
-class QVBoxLayout;
-class UIGraphicsSelectorModel;
-class UIGraphicsSelectorView;
-class QStatusBar;
-
-/* Graphics selector widget: */
-class UIGraphicsViewChooser : public QWidget
-{
-    Q_OBJECT;
-
-signals:
-
-    /* Notify listeners about selection changes: */
-    void sigSelectionChanged();
-
-public:
-
-    /* Constructor/destructor: */
-    UIGraphicsViewChooser(QWidget *pParent);
-    ~UIGraphicsViewChooser();
-
-    /* API: Current item stuff: */
-    void setCurrentItem(int iCurrentItemIndex);
-    UIVMItem* currentItem() const;
-    QList<UIVMItem*> currentItems() const;
-
-    /* API: Status bar stuff: */
-    void setStatusBar(QStatusBar *pStatusBar);
-
-private:
-
-    /* Helpers: */
-    void prepareConnections();
-
-    /* Variables: */
-    QVBoxLayout *m_pMainLayout;
-    UIGraphicsSelectorModel *m_pSelectorModel;
-    UIGraphicsSelectorView *m_pSelectorView;
-    QStatusBar *m_pStatusBar;
-};
-
-#endif /* __UIGraphicsViewChooser_h__ */
-
