VirtualBox

Changeset 58879 in vbox


Ignore:
Timestamp:
Nov 26, 2015 12:49:07 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
104368
Message:

FE/Qt: ​​​bugref:8088: Rework session-information window: Cleanup and removing not-required (animation and events) code (part 1).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformation.cpp

    r58726 r58879  
    3131
    3232#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    33 
    3433
    3534UIGInformation::UIGInformation(QWidget *pParent)
     
    102101    connect(m_pDetailsModel, SIGNAL(sigRootItemMinimumHeightHintChanged(int)),
    103102            m_pDetailsView, SLOT(sltMinimumHeightHintChanged(int)));
    104     connect(m_pDetailsModel, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)),
    105             this, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)));
    106     connect(this, SIGNAL(sigSlidingStarted()),
    107             m_pDetailsModel, SLOT(sltHandleSlidingStarted()));
    108     connect(this, SIGNAL(sigToggleStarted()),
    109             m_pDetailsModel, SLOT(sltHandleToggleStarted()));
    110     connect(this, SIGNAL(sigToggleFinished()),
    111             m_pDetailsModel, SLOT(sltHandleToggleFinished()));
    112103
    113104    /* Setup details-view connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformation.h

    r58616 r58879  
    3535signals:
    3636
    37     /* Notifier: Link processing stuff: */
    38     void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId);
    39 
    4037    /* Notifier: Sliding stuff: */
    4138    void sigSlidingStarted();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformationElement.cpp

    r58726 r58879  
    4141#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    4242
    43 
    4443UIGInformationElement::UIGInformationElement(UIGInformationSet *pParent, InformationElementType type, bool fOpened)
    4544    : UIGInformationItem(pParent)
    4645    , m_pSet(pParent)
    4746    , m_type(type)
    48     , m_iCornerRadius(10)
     47    , m_iCornerRadius(0)
    4948    , m_iMinimumHeaderWidth(0)
    5049    , m_iMinimumHeaderHeight(0)
    51     , m_pButton(0)
    52     , m_fClosed(!fOpened)
    53     , m_iAdditionalHeight(0)
    54     , m_fAnimationRunning(false)
    5550    , m_pTextPane(0)
    56     , m_fHovered(false)
    57     , m_fNameHovered(false)
    58     , m_pHighlightMachine(0)
    59     , m_pForwardAnimation(0)
    60     , m_pBackwardAnimation(0)
    61     , m_iAnimationDuration(400)
    62     , m_iDefaultDarkness(100)
    63     , m_iHighlightDarkness(90)
    64     , m_iAnimationDarkness(m_iDefaultDarkness)
    6551{
    6652    /* Prepare element: */
    6753    prepareElement();
    68     /* Prepare button: */
    69     prepareButton();
    7054    /* Prepare text-pane: */
    7155    prepareTextPane();
    72 
    7356    /* Setup size-policy: */
    7457    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    75 
    7658    /* Add item to the parent: */
    7759    AssertMsg(parentItem(), ("No parent set for details element!"));
     
    8668}
    8769
    88 void UIGInformationElement::close(bool fAnimated /* = true */)
    89 {
    90     m_pButton->setToggled(false, fAnimated);
    91 }
    92 
    93 void UIGInformationElement::open(bool fAnimated /* = true */)
    94 {
    95     m_pButton->setToggled(true, fAnimated);
    96 }
    97 
    9870void UIGInformationElement::updateAppearance()
    9971{
    100     /* Reset name hover state: */
    101     m_fNameHovered = false;
    102     updateNameHoverLink();
    103 
    10472    /* Update anchor role restrictions: */
    10573    ConfigurationAccessLevel cal = m_pSet->configurationAccessLevel();
    10674    m_pTextPane->setAnchorRoleRestricted("#mount", cal == ConfigurationAccessLevel_Null);
    10775    m_pTextPane->setAnchorRoleRestricted("#attach", cal != ConfigurationAccessLevel_Full);
    108 }
    109 
    110 void UIGInformationElement::markAnimationFinished()
    111 {
    112     /* Mark animation as non-running: */
    113     m_fAnimationRunning = false;
    114 
    115     /* Recursively update size-hint: */
    116     updateGeometry();
    117     /* Repaint: */
    118     update();
    119 }
    120 
    121 void UIGInformationElement::sltToggleButtonClicked()
    122 {
    123     emit sigToggleElement(m_type, closed());
    124 }
    125 
    126 void UIGInformationElement::sltElementToggleStart()
    127 {
    128     /* Mark animation running: */
    129     m_fAnimationRunning = true;
    130 
    131     /* Setup animation: */
    132     updateAnimationParameters();
    133 
    134     /* Invert toggle-state: */
    135     m_fClosed = !m_fClosed;
    136 }
    137 
    138 void UIGInformationElement::sltElementToggleFinish(bool fToggled)
    139 {
    140     /* Update toggle-state: */
    141     m_fClosed = !fToggled;
    142 
    143     /* Notify about finishing: */
    144     emit sigToggleElementFinished();
    145 }
    146 
    147 void UIGInformationElement::sltHandleAnchorClicked(const QString &strAnchor)
    148 {
    149     /* Current anchor role: */
    150     const QString strRole = strAnchor.section(',', 0, 0);
    151     const QString strData = strAnchor.section(',', 1);
    152 
    153     /* Handle known anchor roles: */
    154     if (   strRole == "#mount"  // Optical and floppy attachments..
    155         || strRole == "#attach" // Hard-drive attachments..
    156         )
    157     {
    158         /* Prepare storage-menu: */
    159         UIMenu menu;
    160         menu.setShowToolTip(true);
    161 
    162         /* Storage-controller name: */
    163         QString strControllerName = strData.section(',', 0, 0);
    164         /* Storage-slot: */
    165         StorageSlot storageSlot = gpConverter->fromString<StorageSlot>(strData.section(',', 1));
    166 
    167         /* Fill storage-menu: */
    168         vboxGlobal().prepareStorageMenu(menu, this, SLOT(sltMountStorageMedium()),
    169                                         machine(), strControllerName, storageSlot);
    170 
    171         /* Exec menu: */
    172         menu.exec(QCursor::pos());
    173     }
    174 }
    175 
    176 void UIGInformationElement::sltMountStorageMedium()
    177 {
    178     /* Sender action: */
    179     QAction *pAction = qobject_cast<QAction*>(sender());
    180     AssertMsgReturnVoid(pAction, ("This slot should only be called by menu action!\n"));
    181 
    182     /* Current mount-target: */
    183     const UIMediumTarget target = pAction->data().value<UIMediumTarget>();
    184 
    185     /* Update current machine mount-target: */
    186     vboxGlobal().updateMachineStorage(machine(), target);
    18776}
    18877
     
    215104    /* Update minimum-header-width: */
    216105    m_iMinimumHeaderWidth = m_pixmapSize.width() +
    217                             iSpacing + m_nameSize.width() +
    218                             iSpacing + m_buttonSize.width();
     106                            iSpacing + m_nameSize.width();
    219107}
    220108
     
    223111    /* Update minimum-header-height: */
    224112    m_iMinimumHeaderHeight = qMax(m_pixmapSize.height(), m_nameSize.height());
    225     m_iMinimumHeaderHeight = qMax(m_iMinimumHeaderHeight, m_buttonSize.height());
    226113}
    227114
     
    305192
    306193    /* Header height: */
    307     iMinimumHeightHint += m_iMinimumHeaderHeight;
    308 
    309     /* Element is opened? */
    310     if (!fClosed)
    311     {
    312         /* Add text height: */
    313         if (!m_pTextPane->isEmpty())
    314             iMinimumHeightHint += 2 * iMargin + (int)m_pTextPane->minimumSizeHint().height();
    315     }
    316 
    317     /* Additional height during animation: */
    318     if (m_fAnimationRunning)
    319         iMinimumHeightHint += m_iAdditionalHeight;
     194    iMinimumHeightHint += m_iMinimumHeaderHeight + m_pTextPane->minimumSizeHint().height() + 10;
    320195
    321196    /* Return value: */
     
    325200int UIGInformationElement::minimumHeightHint() const
    326201{
    327     return minimumHeightHint(m_fClosed);
     202    return minimumHeightHint(false);
    328203}
    329204
     
    333208    QSize size = geometry().size().toSize();
    334209    int iMargin = data(ElementData_Margin).toInt();
    335 
    336     /* Layout button: */
    337     int iButtonWidth = m_buttonSize.width();
    338     int iButtonHeight = m_buttonSize.height();
    339     int iButtonX = size.width() - 2 * iMargin - iButtonWidth;
    340     int iButtonY = iButtonHeight == m_iMinimumHeaderHeight ? iMargin :
    341                    iMargin + (m_iMinimumHeaderHeight - iButtonHeight) / 2;
    342     m_pButton->setPos(iButtonX, iButtonY);
    343 
    344     /* If closed: */
    345     if (closed())
    346     {
    347         /* Hide text-pane if still visible: */
    348         if (m_pTextPane->isVisible())
    349             m_pTextPane->hide();
    350     }
    351     /* If opened: */
    352     else
    353     {
    354         /* Layout text-pane: */
    355         int iTextPaneX = 2 * iMargin;
    356         int iTextPaneY = iMargin + m_iMinimumHeaderHeight + 2 * iMargin;
    357         m_pTextPane->setPos(iTextPaneX, iTextPaneY);
    358         m_pTextPane->resize(size.width() - 4 * iMargin,
    359                             size.height() - 4 * iMargin - m_iMinimumHeaderHeight);
    360         /* Show text-pane if still invisible and animation finished: */
    361         if (!m_pTextPane->isVisible() && !isAnimationRunning())
    362             m_pTextPane->show();
    363     }
    364 }
    365 
    366 void UIGInformationElement::setAdditionalHeight(int iAdditionalHeight)
    367 {
    368     /* Cache new value: */
    369     m_iAdditionalHeight = iAdditionalHeight;
    370     /* Update layout: */
    371     updateLayout();
    372     /* Repaint: */
    373     update();
     210    /* Layout text-pane: */
     211    int iTextPaneX = 2 * iMargin;
     212    int iTextPaneY = iMargin + m_iMinimumHeaderHeight + 2 * iMargin;
     213    m_pTextPane->setPos(iTextPaneX, iTextPaneY);
     214    m_pTextPane->resize(size.width() - 4 * iMargin,
     215                        size.height() - 4 * iMargin - m_iMinimumHeaderHeight);
     216    /* Show text-pane if still invisible and animation finished: */
     217    if (!m_pTextPane->isVisible())
     218        m_pTextPane->show();
    374219}
    375220
     
    407252    m_nameFont.setWeight(QFont::Bold);
    408253    m_textFont = font();
    409 
    410     /* Create highlight machine: */
    411     m_pHighlightMachine = new QStateMachine(this);
    412     /* Create 'default' state: */
    413     QState *pStateDefault = new QState(m_pHighlightMachine);
    414     /* Create 'highlighted' state: */
    415     QState *pStateHighlighted = new QState(m_pHighlightMachine);
    416 
    417     /* Forward animation: */
    418     m_pForwardAnimation = new QPropertyAnimation(this, "animationDarkness", this);
    419     m_pForwardAnimation->setDuration(m_iAnimationDuration);
    420     m_pForwardAnimation->setStartValue(m_iDefaultDarkness);
    421     m_pForwardAnimation->setEndValue(m_iHighlightDarkness);
    422 
    423     /* Backward animation: */
    424     m_pBackwardAnimation = new QPropertyAnimation(this, "animationDarkness", this);
    425     m_pBackwardAnimation->setDuration(m_iAnimationDuration);
    426     m_pBackwardAnimation->setStartValue(m_iHighlightDarkness);
    427     m_pBackwardAnimation->setEndValue(m_iDefaultDarkness);
    428 
    429     /* Add state transitions: */
    430     QSignalTransition *pDefaultToHighlighted = pStateDefault->addTransition(this, SIGNAL(sigHoverEnter()), pStateHighlighted);
    431     pDefaultToHighlighted->addAnimation(m_pForwardAnimation);
    432     QSignalTransition *pHighlightedToDefault = pStateHighlighted->addTransition(this, SIGNAL(sigHoverLeave()), pStateDefault);
    433     pHighlightedToDefault->addAnimation(m_pBackwardAnimation);
    434 
    435     /* Initial state is 'default': */
    436     m_pHighlightMachine->setInitialState(pStateDefault);
    437     /* Start state-machine: */
    438     m_pHighlightMachine->start();
    439 
    440     connect(this, SIGNAL(sigToggleElement(InformationElementType, bool)), model(), SLOT(sltToggleElements(InformationElementType, bool)));
    441     connect(this, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)),
    442             model(), SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)));
    443 }
    444 
    445 void UIGInformationElement::prepareButton()
    446 {
    447     /* Setup toggle-button: */
    448     m_pButton = new UIGraphicsRotatorButton(this, "additionalHeight", !m_fClosed, true /* reflected */);
    449     m_pButton->setAutoHandleButtonClick(false);
    450     connect(m_pButton, SIGNAL(sigButtonClicked()), this, SLOT(sltToggleButtonClicked()));
    451     connect(m_pButton, SIGNAL(sigRotationStart()), this, SLOT(sltElementToggleStart()));
    452     connect(m_pButton, SIGNAL(sigRotationFinish(bool)), this, SLOT(sltElementToggleFinish(bool)));
    453     m_buttonSize = m_pButton->minimumSizeHint().toSize();
    454254}
    455255
     
    461261    m_pTextPane->setFlag(QGraphicsItem::ItemIsSelectable);
    462262    connect(m_pTextPane, SIGNAL(sigGeometryChanged()), this, SLOT(sltUpdateGeometry()));
    463     connect(m_pTextPane, SIGNAL(sigAnchorClicked(const QString&)), this, SLOT(sltHandleAnchorClicked(const QString&)));
    464263}
    465264
    466265void UIGInformationElement::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget*)
    467266{
    468     /* Update button visibility: */
    469     updateButtonVisibility();
    470 
    471     /* Configure painter shape: */
    472     configurePainterShape(pPainter, pOption, m_iCornerRadius);
    473 
    474267    /* Paint decorations: */
    475268    paintDecorations(pPainter, pOption);
     
    499292    QPalette pal = palette();
    500293    QColor buttonTextColor = pal.color(QPalette::Active, QPalette::ButtonText);
    501     QColor linkTextColor = pal.color(QPalette::Active, QPalette::Link);
    502294
    503295    /* Paint pixmap: */
     
    528320              /* Text to paint: */
    529321              m_strName,
    530               /* Name hovered? */
    531               m_fNameHovered ? linkTextColor : buttonTextColor);
     322              /* buttonTextColor: */
     323              buttonTextColor);
    532324}
    533325
     
    541333    int iHeaderHeight = 2 * iMargin + m_iMinimumHeaderHeight;
    542334    QRect optionRect = pOption->rect;
    543     QRect fullRect = !m_fAnimationRunning ? optionRect :
    544                      QRect(optionRect.topLeft(), QSize(optionRect.width(), iHeaderHeight + m_iAdditionalHeight));
     335    QRect fullRect = optionRect;
    545336    int iFullHeight = fullRect.height();
    546337
     
    574365    QLinearGradient tGradient(tRect.bottomLeft(), tRect.topLeft());
    575366    tGradient.setColorAt(0, headerColor.darker(110));
    576     tGradient.setColorAt(1, headerColor.darker(animationDarkness()));
    577367
    578368    /* Paint all the stuff: */
     
    588378}
    589379
    590 void UIGInformationElement::hoverMoveEvent(QGraphicsSceneHoverEvent *pEvent)
    591 {
    592     /* Update hover state: */
    593     if (!m_fHovered)
    594     {
    595         m_fHovered = true;
    596         emit sigHoverEnter();
    597     }
    598 
    599     /* Update name-hover state: */
    600     handleHoverEvent(pEvent);
    601 }
    602 
    603 void UIGInformationElement::hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent)
    604 {
    605     /* Update hover state: */
    606     if (m_fHovered)
    607     {
    608         m_fHovered = false;
    609         emit sigHoverLeave();
    610     }
    611 
    612     /* Update name-hover state: */
    613     handleHoverEvent(pEvent);
    614 }
    615 
    616 void UIGInformationElement::mousePressEvent(QGraphicsSceneMouseEvent *pEvent)
    617 {
    618     /* Only for hovered header: */
    619     if (!m_fNameHovered)
    620         return;
    621 
    622     /* Process link click: */
    623     pEvent->accept();
    624     QString strCategory;
    625     if (m_type >= InformationElementType_General &&
    626         m_type < InformationElementType_Description)
    627         strCategory = QString("#%1").arg(gpConverter->toInternalString(m_type));
    628     else if (m_type == InformationElementType_Description)
    629         strCategory = QString("#%1%%mTeDescription").arg(gpConverter->toInternalString(m_type));
    630     else if (m_type >= InformationElementType_RuntimeAttributes &&
    631              m_type < InformationElementType_NetworkStatistics)
    632         strCategory = QString("#%1").arg(gpConverter->toInternalString(m_type));
    633     emit sigLinkClicked(strCategory, QString(), machine().GetId());
    634 }
    635 
    636 void UIGInformationElement::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *pEvent)
    637 {
    638     /* Only for left-button: */
    639     if (pEvent->button() != Qt::LeftButton)
    640         return;
    641 
    642     /* Process left-button double-click: */
    643     emit sigToggleElement(m_type, closed());
    644 }
    645 
    646 void UIGInformationElement::updateButtonVisibility()
    647 {
    648     if (m_fHovered && !m_pButton->isVisible())
    649         m_pButton->show();
    650     else if (!m_fHovered && m_pButton->isVisible())
    651         m_pButton->hide();
    652 }
    653 
    654 void UIGInformationElement::handleHoverEvent(QGraphicsSceneHoverEvent *pEvent)
    655 {
    656     /* Not for 'preview' element type: */
    657     if (m_type == InformationElementType_Preview)
    658         return;
    659 
    660     /* Prepare variables: */
    661     int iMargin = data(ElementData_Margin).toInt();
    662     int iSpacing = data(ElementData_Spacing).toInt();
    663     int iNameHeight = m_nameSize.height();
    664     int iElementNameX = 2 * iMargin + m_pixmapSize.width() + iSpacing;
    665     int iElementNameY = iNameHeight == m_iMinimumHeaderHeight ?
    666                         iMargin : iMargin + (m_iMinimumHeaderHeight - iNameHeight) / 2;
    667 
    668     /* Simulate hyperlink hovering: */
    669     QPoint point = pEvent->pos().toPoint();
    670     bool fNameHovered = QRect(QPoint(iElementNameX, iElementNameY), m_nameSize).contains(point);
    671     if (   m_pSet->configurationAccessLevel() != ConfigurationAccessLevel_Null
    672         && m_fNameHovered != fNameHovered)
    673     {
    674         m_fNameHovered = fNameHovered;
    675         updateNameHoverLink();
    676     }
    677 }
    678 
    679 void UIGInformationElement::updateNameHoverLink()
    680 {
    681     if (m_fNameHovered)
    682         setCursor(Qt::PointingHandCursor);
    683     else
    684         unsetCursor();
    685     update();
    686 }
    687 
    688 void UIGInformationElement::updateAnimationParameters()
    689 {
    690     /* Recalculate animation parameters: */
    691     int iOpenedHeight = minimumHeightHint(false);
    692     int iClosedHeight = minimumHeightHint(true);
    693     int iAdditionalHeight = iOpenedHeight - iClosedHeight;
    694     if (m_fClosed)
    695         m_iAdditionalHeight = 0;
    696     else
    697         m_iAdditionalHeight = iAdditionalHeight;
    698     m_pButton->setAnimationRange(0, iAdditionalHeight);
    699 }
    700 
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformationElement.h

    r58726 r58879  
    3333class QTextLayout;
    3434class QStateMachine;
    35 class QPropertyAnimation;
    3635
    3736/* Typedefs: */
     
    4443{
    4544    Q_OBJECT;
    46     Q_PROPERTY(int animationDarkness READ animationDarkness WRITE setAnimationDarkness);
    47     Q_PROPERTY(int additionalHeight READ additionalHeight WRITE setAdditionalHeight);
    4845
    4946signals:
    5047
    5148    /* Notifiers: Hover stuff: */
    52     void sigHoverEnter();
    5349    void sigHoverLeave();
    5450
     
    5652    void sigToggleElement(InformationElementType type, bool fToggled);
    5753    void sigToggleElementFinished();
    58 
    59     /* Notifier: Link-click stuff: */
    60     void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId);
    6154
    6255public:
     
    7366    InformationElementType elementType() const { return m_type; }
    7467
    75     /* API: Open/close stuff: */
    76     bool closed() const { return m_fClosed; }
    77     bool opened() const { return !m_fClosed; }
    78     void close(bool fAnimated = true);
    79     void open(bool fAnimated = true);
    80 
    8168    /* API: Update stuff: */
    8269    virtual void updateAppearance();
    8370
    84     /* API: Animation stuff: */
    85     void markAnimationFinished();
    86 
    8771protected slots:
    88 
    89     /* Handlers: Toggle stuff: */
    90     void sltToggleButtonClicked();
    91     void sltElementToggleStart();
    92     void sltElementToggleFinish(bool fToggled);
    9372
    9473    /** Handles children geometry changes. */
    9574    void sltUpdateGeometry() { updateGeometry(); }
    96 
    97     /** Handles children anchor clicks. */
    98     void sltHandleAnchorClicked(const QString &strAnchor);
    99 
    100     /** Handles mount storage medium requests. */
    101     void sltMountStorageMedium();
    10275
    10376protected:
     
    143116    void updateLayout();
    144117
    145     /* Helpers: Hover stuff: */
    146     int animationDarkness() const { return m_iAnimationDarkness; }
    147     void setAnimationDarkness(int iAnimationDarkness) { m_iAnimationDarkness = iAnimationDarkness; update(); }
    148 
    149     /* Helpers: Animation stuff: */
    150     void setAdditionalHeight(int iAdditionalHeight);
    151     int additionalHeight() const { return m_iAdditionalHeight; }
    152     UIGraphicsRotatorButton* button() const { return m_pButton; }
    153     bool isAnimationRunning() const { return m_fAnimationRunning; }
    154 
    155118private:
    156119
     
    164127    /* Helpers: Prepare stuff: */
    165128    void prepareElement();
    166     void prepareButton();
    167129    void prepareTextPane();
    168130
     
    172134    void paintElementInfo(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption);
    173135    void paintBackground(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption);
    174 
    175     /* Handlers: Mouse stuff: */
    176     void hoverMoveEvent(QGraphicsSceneHoverEvent *pEvent);
    177     void hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent);
    178     void mousePressEvent(QGraphicsSceneMouseEvent *pEvent);
    179     void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *pEvent);
    180 
    181     /* Helpers: Mouse stuff: */
    182     void updateButtonVisibility();
    183     void handleHoverEvent(QGraphicsSceneHoverEvent *pEvent);
    184     void updateNameHoverLink();
    185 
    186     /* Helper: Animation stuff: */
    187     void updateAnimationParameters();
    188136
    189137    /* Variables: */
     
    201149    int m_iMinimumHeaderHeight;
    202150
    203     /* Variables: Toggle-button stuff: */
    204     UIGraphicsRotatorButton *m_pButton;
    205     bool m_fClosed;
    206     int m_iAdditionalHeight;
    207     bool m_fAnimationRunning;
    208 
    209151    /* Variables: Text-pane stuff: */
    210152    UIGraphicsTextPane *m_pTextPane;
    211 
    212     /* Variables: Hover stuff: */
    213     bool m_fHovered;
    214     bool m_fNameHovered;
    215     QStateMachine *m_pHighlightMachine;
    216     QPropertyAnimation *m_pForwardAnimation;
    217     QPropertyAnimation *m_pBackwardAnimation;
    218     int m_iAnimationDuration;
    219     int m_iDefaultDarkness;
    220     int m_iHighlightDarkness;
    221     int m_iAnimationDarkness;
    222153
    223154    /* Friends: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformationElements.cpp

    r58866 r58879  
    121121}
    122122
    123 
    124123UIGInformationElementPreview::UIGInformationElementPreview(UIGInformationSet *pParent, bool fOpened)
    125124    : UIGInformationElement(pParent, InformationElementType_Preview, fOpened)
     
    201200    /* Header height: */
    202201    iProposedHeight += minimumHeaderHeight();
    203 
    204     /* Element is opened? */
    205     if (!fClosed)
    206     {
    207         iProposedHeight += iMargin;
    208         iProposedHeight += m_pPreview->minimumSizeHint().toSize().height();
    209     }
    210     else
    211     {
    212         /* Additional height during animation: */
    213         if (button()->isAnimationRunning())
    214             iProposedHeight += additionalHeight();
    215     }
     202    iProposedHeight += iMargin;
     203    iProposedHeight += m_pPreview->minimumSizeHint().toSize().height();
    216204
    217205    /* Return result: */
     
    223211    /* Call to base-class: */
    224212    UIGInformationElement::updateLayout();
    225 
    226     /* Show/hide preview: */
    227     if (closed() && m_pPreview->isVisible())
    228         m_pPreview->hide();
    229     if (opened() && !m_pPreview->isVisible() && !isAnimationRunning())
    230         m_pPreview->show();
    231213}
    232214
     
    240222    emit sigBuildDone();
    241223}
    242 
    243224
    244225void UIGInformationUpdateTaskGeneral::run()
     
    288269}
    289270
    290 
    291271void UIGInformationUpdateTaskSystem::run()
    292272{
     
    364344    setProperty("table", QVariant::fromValue(table));
    365345}
    366 
    367346
    368347void UIGInformationUpdateTaskDisplay::run()
     
    467446    setProperty("table", QVariant::fromValue(table));
    468447}
    469 
    470448
    471449void UIGInformationUpdateTaskStorage::run()
     
    548526}
    549527
    550 
    551528void UIGInformationUpdateTaskAudio::run()
    552529{
     
    584561    setProperty("table", QVariant::fromValue(table));
    585562}
    586 
    587563
    588564void UIGInformationUpdateTaskNetwork::run()
     
    681657}
    682658
    683 
    684659void UIGInformationUpdateTaskSerial::run()
    685660{
     
    724699}
    725700
    726 
    727701#ifdef VBOX_WITH_PARALLEL_PORTS
    728702void UIGInformationUpdateTaskParallel::run()
     
    762736}
    763737#endif /* VBOX_WITH_PARALLEL_PORTS */
    764 
    765738
    766739void UIGInformationUpdateTaskUSB::run()
     
    813786}
    814787
    815 
    816788void UIGInformationUpdateTaskSF::run()
    817789{
     
    840812    setProperty("table", QVariant::fromValue(table));
    841813}
    842 
    843814
    844815void UIGInformationUpdateTaskUI::run()
     
    930901}
    931902
    932 
    933903void UIGInformationUpdateTaskDescription::run()
    934904{
     
    960930void UIGInformationUpdateTaskRuntimeAttributes::run()
    961931{
    962 
    963 }
    964 
     932}
     933
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformationGroup.cpp

    r58726 r58879  
    3232
    3333#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    34 
    3534
    3635UIGInformationGroup::UIGInformationGroup(QGraphicsScene *pParent)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformationModel.cpp

    r58855 r58879  
    4040    , m_pScene(0)
    4141    , m_pRoot(0)
    42     , m_pAnimationCallback(0)
    4342{
    4443    /* Prepare scene: */
     
    121120}
    122121
    123 void UIGInformationModel::sltToggleElements(InformationElementType type, bool fToggled)
    124 {
    125     /* Make sure it is not started yet: */
    126     if (m_pAnimationCallback)
    127         return;
    128 
    129     /* Prepare/configure animation callback: */
    130     m_pAnimationCallback = new UIGInformationElementAnimationCallback(this, type, fToggled);
    131     connect(m_pAnimationCallback, SIGNAL(sigAllAnimationFinished(InformationElementType, bool)),
    132             this, SLOT(sltToggleAnimationFinished(InformationElementType, bool)), Qt::QueuedConnection);
    133     /* For each the set of the group: */
    134     foreach (UIGInformationItem *pSetItem, m_pRoot->items())
    135     {
    136         /* For each the element of the set: */
    137         foreach (UIGInformationItem *pElementItem, pSetItem->items())
    138         {
    139             /* Get each element: */
    140             UIGInformationElement *pElement = pElementItem->toElement();
    141             /* Check if this element is of required type: */
    142             if (pElement->elementType() == type)
    143             {
    144                 if (fToggled && pElement->closed())
    145                 {
    146                     m_pAnimationCallback->addNotifier(pElement);
    147                     pElement->open();
    148                 }
    149                 else if (!fToggled && pElement->opened())
    150                 {
    151                     m_pAnimationCallback->addNotifier(pElement);
    152                     pElement->close();
    153                 }
    154             }
    155         }
    156     }
    157     /* Update layout: */
    158     updateLayout();
    159 }
    160 
    161 void UIGInformationModel::sltToggleAnimationFinished(InformationElementType type, bool fToggled)
    162 {
    163     /* Cleanup animation callback: */
    164     delete m_pAnimationCallback;
    165     m_pAnimationCallback = 0;
    166 
    167     /* Mark animation finished: */
    168     foreach (UIGInformationItem *pSetItem, m_pRoot->items())
    169     {
    170         foreach (UIGInformationItem *pElementItem, pSetItem->items())
    171         {
    172             UIGInformationElement *pElement = pElementItem->toElement();
    173             if (pElement->elementType() == type)
    174                 pElement->markAnimationFinished();
    175         }
    176     }
    177     /* Update layout: */
    178     updateLayout();
    179 
    180     /* Update element open/close status: */
    181     if (m_settings.contains(type))
    182         m_settings[type] = fToggled;
    183 }
    184 
    185 void UIGInformationModel::sltElementTypeToggled()
    186 {
    187     /* Which item was toggled? */
    188     QAction *pAction = qobject_cast<QAction*>(sender());
    189     InformationElementType type = pAction->data().value<InformationElementType>();
    190 
    191     /* Toggle element visibility status: */
    192     if (m_settings.contains(type))
    193         m_settings.remove(type);
    194     else
    195         m_settings[type] = true;
    196 
    197     /* Rebuild group: */
    198     m_pRoot->rebuildGroup();
    199 }
    200 
    201 void UIGInformationModel::sltHandleSlidingStarted()
    202 {
    203     m_pRoot->stopBuildingGroup();
    204 }
    205 
    206 void UIGInformationModel::sltHandleToggleStarted()
    207 {
    208     m_pRoot->stopBuildingGroup();
    209 }
    210 
    211 void UIGInformationModel::sltHandleToggleFinished()
    212 {
    213     m_pRoot->rebuildGroup();
    214 }
    215 
    216122QVariant UIGInformationModel::data(int iKey) const
    217123{
     
    227133{
    228134    m_pScene = new QGraphicsScene(this);
    229     m_pScene->installEventFilter(this);
    230135}
    231136
     
    272177}
    273178
    274 bool UIGInformationModel::eventFilter(QObject *pObject, QEvent *pEvent)
    275 {
    276     /* Ignore if no scene object: */
    277     if (pObject != scene())
    278         return QObject::eventFilter(pObject, pEvent);
    279 
    280     /* Ignore if no context-menu event: */
    281     if (pEvent->type() != QEvent::GraphicsSceneContextMenu)
    282         return QObject::eventFilter(pObject, pEvent);
    283 
    284     /* Process context menu event: */
    285     return processContextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent*>(pEvent));
    286 }
    287 
    288 bool UIGInformationModel::processContextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent)
    289 {
    290     /* Pass preview context menu instead: */
    291     if (QGraphicsItem *pItem = itemAt(pEvent->scenePos()))
    292         if (pItem->type() == UIGInformationItemType_Preview)
    293             return false;
    294 
    295     /* Prepare context-menu: */
    296     QMenu contextMenu;
    297     /* Enumerate elements settings: */
    298     for (int iType = InformationElementType_General; iType <= InformationElementType_RuntimeAttributes; ++iType)
    299     {
    300         InformationElementType currentElementType = (InformationElementType)iType;
    301         QAction *pAction = contextMenu.addAction(gpConverter->toString(currentElementType), this, SLOT(sltElementTypeToggled()));
    302         pAction->setCheckable(true);
    303         pAction->setChecked(m_settings.contains(currentElementType));
    304         pAction->setData(QVariant::fromValue(currentElementType));
    305     }
    306     /* Exec context-menu: */
    307     contextMenu.exec(pEvent->screenPos());
    308 
    309     /* Filter: */
    310     return true;
    311 }
    312 
    313 UIGInformationElementAnimationCallback::UIGInformationElementAnimationCallback(QObject *pParent, InformationElementType type, bool fToggled)
    314     : QObject(pParent)
    315     , m_type(type)
    316     , m_fToggled(fToggled)
    317 {
    318 }
    319 
    320 void UIGInformationElementAnimationCallback::addNotifier(UIGInformationItem *pItem)
    321 {
    322     /* Connect notifier: */
    323     connect(pItem, SIGNAL(sigToggleElementFinished()), this, SLOT(sltAnimationFinished()));
    324     /* Remember notifier: */
    325     m_notifiers << pItem;
    326 }
    327 
    328 void UIGInformationElementAnimationCallback::sltAnimationFinished()
    329 {
    330     /* Determine notifier: */
    331     UIGInformationItem *pItem = qobject_cast<UIGInformationItem*>(sender());
    332     /* Disconnect notifier: */
    333     disconnect(pItem, SIGNAL(sigToggleElementFinished()), this, SLOT(sltAnimationFinished()));
    334     /* Remove notifier: */
    335     m_notifiers.removeAll(pItem);
    336     /* Check if we finished: */
    337     if (m_notifiers.isEmpty())
    338         emit sigAllAnimationFinished(m_type, m_fToggled);
    339 }
    340 
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformationModel.h

    r58726 r58879  
    3838class UIGInformationGroup;
    3939class UIVMItem;
    40 class UIGInformationElementAnimationCallback;
     40//class UIGInformationElementAnimationCallback;
    4141class UIGInformationItem;
    4242
     
    5353
    5454    /* Notifier: Link processing stuff: */
    55     void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId);
     55    //void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId);
    5656
    5757public:
     
    8282    void sltHandleViewResize();
    8383
    84     /* Handlers: Element-items stuff: */
    85     void sltToggleElements(InformationElementType type, bool fToggled);
    86     void sltToggleAnimationFinished(InformationElementType type, bool fToggled);
    87     void sltElementTypeToggled();
    88 
    89     /* Handlers: Chooser stuff: */
    90     void sltHandleSlidingStarted();
    91     void sltHandleToggleStarted();
    92     void sltHandleToggleFinished();
    93 
    9484private:
    9585
     
    115105
    116106    /* Handler: Event-filter: */
    117     bool eventFilter(QObject *pObject, QEvent *pEvent);
    118 
    119     /* Handler: Context-menu stuff: */
    120     bool processContextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent);
     107    //bool eventFilter(QObject *pObject, QEvent *pEvent);
    121108
    122109    /* Variables: */
    123110    QGraphicsScene *m_pScene;
    124111    UIGInformationGroup *m_pRoot;
    125     UIGInformationElementAnimationCallback *m_pAnimationCallback;
     112    //UIGInformationElementAnimationCallback *m_pAnimationCallback;
    126113    /** Holds the details settings. */
    127114    QMap<InformationElementType, bool> m_settings;
    128115};
    129116
    130 /* Details-element animation callback: */
    131 class UIGInformationElementAnimationCallback : public QObject
    132 {
    133     Q_OBJECT;
    134 
    135 signals:
    136 
    137     /* Notifier: Complete stuff: */
    138     void sigAllAnimationFinished(InformationElementType type, bool fToggled);
    139 
    140 public:
    141 
    142     /* Constructor: */
    143     UIGInformationElementAnimationCallback(QObject *pParent, InformationElementType type, bool fToggled);
    144 
    145     /* API: Notifiers stuff: */
    146     void addNotifier(UIGInformationItem *pItem);
    147 
    148 private slots:
    149 
    150     /* Handler: Progress stuff: */
    151     void sltAnimationFinished();
    152 
    153 private:
    154 
    155     /* Variables: */
    156     QList<UIGInformationItem*> m_notifiers;
    157     InformationElementType m_type;
    158     bool m_fToggled;
    159 };
    160 
    161117#endif /* __UIGInformationModel_h__ */
    162118
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGInformationSet.cpp

    r58726 r58879  
    3434#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3535
    36 
    3736UIGInformationSet::UIGInformationSet(UIGInformationItem *pParent)
    3837    : UIGInformationItem(pParent)
     
    128127        bool fVisible = m_settings.contains(elementType);
    129128        /* Should the element be opened? */
    130         bool fOpen = fVisible && m_settings[elementType];
     129        //bool fOpen = fVisible && m_settings[elementType];
    131130
    132131        /* Check if element is present already: */
    133132        UIGInformationElement *pElement = element(elementType);
    134         if (pElement && fOpen)
    135             pElement->open(false);
     133        //if (pElement && fOpen)
     134            //pElement->open(false);
    136135        /* Create element if necessary: */
    137136        bool fJustCreated = false;
     
    139138        {
    140139            fJustCreated = true;
    141             pElement = createElement(elementType, fOpen);
     140            pElement = createElement(elementType, true);
    142141        }
    143142
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGRuntimeInformation.cpp

    r58726 r58879  
    103103    connect(m_pDetailsModel, SIGNAL(sigRootItemMinimumHeightHintChanged(int)),
    104104            m_pDetailsView, SLOT(sltMinimumHeightHintChanged(int)));
    105     connect(m_pDetailsModel, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)),
    106             this, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)));
    107     connect(this, SIGNAL(sigSlidingStarted()),
    108             m_pDetailsModel, SLOT(sltHandleSlidingStarted()));
    109     connect(this, SIGNAL(sigToggleStarted()),
    110             m_pDetailsModel, SLOT(sltHandleToggleStarted()));
    111     connect(this, SIGNAL(sigToggleFinished()),
    112             m_pDetailsModel, SLOT(sltHandleToggleFinished()));
    113105
    114106    /* Setup details-view connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIGRuntimeInformation.h

    r58690 r58879  
    3636
    3737    /* Notifier: Link processing stuff: */
    38     void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId);
     38    //void sigLinkClicked(const QString &strCategory, const QString &strControl, const QString &strId);
    3939
    4040    /* Notifier: Sliding stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIVMInformationDialog.h

    r58616 r58879  
    158158
    159159#endif /* !___UIVMInformationDialog_h___ */
     160
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette