VirtualBox

Changeset 54529 in vbox


Ignore:
Timestamp:
Feb 26, 2015 1:37:25 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 7462: Add status-bar enable check-box to status-bar editor opened from the VM settings / Interface page.

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

Legend:

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

    r54079 r54529  
    2727# include <QMouseEvent>
    2828# include <QStatusBar>
     29# include <QCheckBox>
    2930# include <QPainter>
    3031# include <QPixmap>
     
    264265    , m_pMainLayout(0), m_pButtonLayout(0)
    265266    , m_pButtonClose(0)
     267    , m_pCheckBoxEnable(0)
    266268    , m_pButtonDropToken(0)
    267269    , m_fDropAfterTokenButton(true)
     
    285287        return;
    286288
     289    /* Update enable-checkbox: */
     290    updateEnableCheckbox();
     291
    287292    /* Update status buttons: */
    288293    updateStatusButtons();
     294}
     295
     296void UIStatusBarEditorWidget::sltHandleStatusBarEnableToggle(bool fEnabled)
     297{
     298    /* Toggle enable-checkbox if necessary: */
     299    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
     300    {
     301        /* Check whether this value is really changed: */
     302        const bool fStatusBarEnabled = gEDataManager->statusBarEnabled(machineID());
     303        if (fStatusBarEnabled != fEnabled)
     304        {
     305            /* Set new value: */
     306            gEDataManager->setStatusBarEnabled(fEnabled, machineID());
     307        }
     308    }
    289309}
    290310
     
    339359    {
    340360        /* Configure main-layout: */
    341 #ifdef Q_WS_MAC
    342         /* Standard margins on Mac OS X are too big: */
    343         m_pMainLayout->setContentsMargins(10, 10, 10, 5);
    344 #else /* !Q_WS_MAC */
    345         /* Standard margins on Windows/X11: */
    346361        int iLeft, iTop, iRight, iBottom;
    347362        m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom);
     363        /* Standard margins should not be too big: */
     364        iLeft   = qMin(iLeft,   10);
     365        iTop    = qMin(iTop,    10);
     366        iRight  = qMin(iRight,  10);
     367        iBottom = qMin(iBottom, 10);
     368        /* Bottom margin should be smaller for the common case: */
    348369        if (iBottom >= 5)
    349370            iBottom -= 5;
     371        /* Left margin should be bigger for the settings case: */
     372        if (m_fStartedFromVMSettings)
     373            iLeft += 5;
     374        /* Apply margins/spacing finally: */
    350375        m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom);
    351 #endif /* !Q_WS_MAC */
    352376        m_pMainLayout->setSpacing(0);
    353377        /* Create close-button if necessary: */
     
    366390            }
    367391        }
     392        /* Create enable-checkbox if necessary: */
     393        else
     394        {
     395            m_pCheckBoxEnable = new QCheckBox;
     396            AssertPtrReturnVoid(m_pCheckBoxEnable);
     397            {
     398                /* Configure enable-checkbox: */
     399                m_pCheckBoxEnable->setFocusPolicy(Qt::StrongFocus);
     400                connect(m_pCheckBoxEnable, SIGNAL(toggled(bool)), this, SLOT(sltHandleStatusBarEnableToggle(bool)));
     401                /* Add enable-checkbox into main-layout: */
     402                m_pMainLayout->addWidget(m_pCheckBoxEnable);
     403                /* Update enable-checkbox: */
     404                updateEnableCheckbox();
     405            }
     406        }
    368407        /* Insert stretch: */
    369408        m_pMainLayout->addStretch();
     
    427466}
    428467
     468void UIStatusBarEditorWidget::updateEnableCheckbox()
     469{
     470    /* Update enable-checkbox if necessary: */
     471    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
     472    {
     473        m_pCheckBoxEnable->blockSignals(true);
     474        m_pCheckBoxEnable->setChecked(gEDataManager->statusBarEnabled(machineID()));
     475        m_pCheckBoxEnable->blockSignals(false);
     476    }
     477}
     478
    429479void UIStatusBarEditorWidget::updateStatusButtons()
    430480{
     
    461511    if (!m_fStartedFromVMSettings && m_pButtonClose)
    462512        m_pButtonClose->setToolTip(tr("Close"));
     513    /* Translate enable-checkbox if necessary: */
     514    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
     515        m_pCheckBoxEnable->setToolTip(tr("Enable Status Bar"));
    463516}
    464517
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h

    r53321 r54529  
    3232class QIToolButton;
    3333class QHBoxLayout;
     34class QCheckBox;
    3435
    3536/** UISlidingToolBar wrapper
     
    7677    void sltHandleConfigurationChange(const QString &strMachineID);
    7778
     79    /** Handles status-bar enable toggle. */
     80    void sltHandleStatusBarEnableToggle(bool fEnabled);
    7881    /** Handles button click. */
    7982    void sltHandleButtonClick();
     
    9194    void prepareStatusButton(IndicatorType type);
    9295
    93     /** Updates status buttons. */
     96    /** Update enable-checkbox routine. */
     97    void updateEnableCheckbox();
     98    /** Update status buttons routine. */
    9499    void updateStatusButtons();
    95100
     
    130135        /** Holds the close-button instance. */
    131136        QIToolButton *m_pButtonClose;
     137        /** Holds the enable-checkbox instance. */
     138        QCheckBox *m_pCheckBoxEnable;
    132139        /** Holds status-bar buttons. */
    133140        QMap<IndicatorType, UIStatusBarEditorButton*> m_buttons;
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