VirtualBox

Changeset 73598 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 9, 2018 5:45:12 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: UISlidingWidget: Replace state bool flag with corresponding enum value to make state more informative outside.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISlidingWidget.cpp

    r68287 r73598  
    55
    66/*
    7  * Copyright (C) 2017 Oracle Corporation
     7 * Copyright (C) 2017-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727UISlidingWidget::UISlidingWidget(QWidget *pParent /* = 0 */)
    2828    : QWidget(pParent)
    29     , m_fStateIsFinal(false)
     29    , m_enmState(State_Start)
    3030    , m_pAnimation(0)
    3131    , m_pWidget(0)
     
    7373    updateAnimation();
    7474    /* Update widget geometry: */
    75     m_pWidget->setGeometry(m_fStateIsFinal ? m_finalWidgetGeometry : m_startWidgetGeometry);
     75    m_pWidget->setGeometry(m_enmState == State_Final ? m_finalWidgetGeometry : m_startWidgetGeometry);
    7676}
    7777
     
    107107    updateAnimation();
    108108    /* Update widget geometry: */
    109     m_pWidget->setGeometry(m_fStateIsFinal ? m_finalWidgetGeometry : m_startWidgetGeometry);
     109    m_pWidget->setGeometry(m_enmState == State_Final ? m_finalWidgetGeometry : m_startWidgetGeometry);
    110110}
    111111
     
    129129    updateAnimation();
    130130    /* Update widget geometry: */
    131     m_pWidget->setGeometry(m_fStateIsFinal ? m_finalWidgetGeometry : m_startWidgetGeometry);
     131    m_pWidget->setGeometry(m_enmState == State_Final ? m_finalWidgetGeometry : m_startWidgetGeometry);
    132132}
    133133
     
    156156    return m_pWidget->geometry();
    157157}
    158 
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISlidingWidget.h

    r68287 r73598  
    55
    66/*
    7  * Copyright (C) 2017 Oracle Corporation
     7 * Copyright (C) 2017-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4747public:
    4848
     49    /** Sliding state. */
     50    enum State
     51    {
     52        State_Start,
     53        State_GoingForward,
     54        State_Final,
     55        State_GoingBackward
     56    };
     57
    4958    /** Constructs sliding widget passing @a pParent to the base-class. */
    5059    UISlidingWidget(QWidget *pParent = 0);
     
    5665    void setWidgets(QWidget *pWidget1, QWidget *pWidget2);
    5766
     67    /** Returns sliding state. */
     68    State state() const { return m_enmState; }
     69
    5870    /** Moves animation forward. */
    59     void moveForward() { emit sigForward(); }
     71    void moveForward() { m_enmState = State_GoingForward; emit sigForward(); }
    6072    /** Moves animation backward. */
    61     void moveBackward() { emit sigBackward(); }
     73    void moveBackward() { m_enmState = State_GoingBackward; emit sigBackward(); }
    6274
    6375protected:
     
    7284
    7385    /** Marks state as start. */
    74     void sltSetStateToStart() { m_fStateIsFinal = false; }
     86    void sltSetStateToStart() { m_enmState = State_Start; }
    7587    /** Marks state as final. */
    76     void sltSetStateToFinal() { m_fStateIsFinal = true; }
     88    void sltSetStateToFinal() { m_enmState = State_Final; }
    7789
    7890private:
     
    94106
    95107    /** Holds whether we are in animation final state. */
    96     bool         m_fStateIsFinal;
     108    State        m_enmState;
    97109    /** Holds the shift left/right animation instance. */
    98110    UIAnimation *m_pAnimation;
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