VirtualBox

Changeset 51937 in vbox


Ignore:
Timestamp:
Jul 8, 2014 4:01:15 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: UIToolBar: Cleanup/Doxygen.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r51901 r51937  
    387387        src/widgets/UISpacerWidgets.h \
    388388        src/widgets/UISpecialControls.h \
     389        src/widgets/UIToolBar.h \
    389390        src/widgets/VBoxFilePathSelectorWidget.h \
    390391        src/widgets/VBoxMediaComboBox.h \
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r51933 r51937  
    12141214        }
    12151215        /* Initial focus: */
    1216         m_pViewOfChooser->setFocus();
     1216        if (m_pViewOfChooser)
     1217            m_pViewOfChooser->setFocus();
    12171218    }
    12181219}
     
    12371238        /* Enable unified tool-bars on Mac OS X. Available on Qt >= 4.3: */
    12381239        addToolBar(m_pToolBar);
    1239         m_pToolBar->setMacToolbar();
     1240        m_pToolBar->enableMacToolbar();
    12401241#else /* !MAC_LEOPARD_STYLE */
    12411242        /* Add tool-bar into main-layout: */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r51267 r51937  
    11521152        /* Enable unified tool-bars on Mac OS X. Available on Qt >= 4.3: */
    11531153        addToolBar(m_pToolBar);
    1154         m_pToolBar->setMacToolbar();
     1154        m_pToolBar->enableMacToolbar();
    11551155        /* No spacing/margin on the Mac: */
    11561156        pMainLayout->setContentsMargins(0, 0, 0, 0);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r51931 r51937  
    121121     * We do this after setting the window pos/size, cause Qt sometimes
    122122     * includes the toolbar height in the content height. */
    123     mVMToolBar->setMacToolbar();
     123    mVMToolBar->enableMacToolbar();
    124124# endif /* MAC_LEOPARD_STYLE */
    125125
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp

    r51679 r51937  
    375375    /* ToolBar creation */
    376376    UIToolBar *toolBar = new UIToolBar (this);
    377     toolBar->setUsesTextLabel (false);
    378377    toolBar->setIconSize (QSize (22, 22));
    379378    toolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r51287 r51937  
    8585    /* Create modern tool-bar selector: */
    8686    m_pSelector = new VBoxSettingsToolBarSelector(this);
    87     static_cast<UIToolBar*>(m_pSelector->widget())->setMacToolbar();
     87    static_cast<UIToolBar*>(m_pSelector->widget())->enableMacToolbar();
    8888    addToolBar(qobject_cast<QToolBar*>(m_pSelector->widget()));
    8989    /* No title in this mode, we change the title of the window: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp

    r51287 r51937  
    379379    /* Init the toolbar */
    380380    mTbSelector = new UIToolBar (aParent);
    381     mTbSelector->setUsesTextLabel (true);
     381    mTbSelector->setUseTextLabels (true);
    382382    mTbSelector->setIconSize (QSize (32, 32));
    383383#ifdef Q_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp

    r47193 r51937  
    102102
    103103    /* Setup tool-bar: */
    104     m_pPackagesToolbar->setUsesTextLabel(false);
    105104    m_pPackagesToolbar->setIconSize(QSize(16, 16));
    106105    m_pPackagesToolbar->setOrientation(Qt::Vertical);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp

    r50879 r51937  
    451451    /* Prepare NAT network toolbar: */
    452452    {
    453         m_pToolbarNetworkNAT->setUsesTextLabel(false);
    454453        m_pToolbarNetworkNAT->setIconSize(QSize(16, 16));
    455454        m_pToolbarNetworkNAT->setOrientation(Qt::Vertical);
     
    460459    /* Prepare Host network toolbar: */
    461460    {
    462         m_pToolbarNetworkHost->setUsesTextLabel(false);
    463461        m_pToolbarNetworkHost->setIconSize(QSize(16, 16));
    464462        m_pToolbarNetworkHost->setOrientation(Qt::Vertical);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r47149 r51937  
    188188
    189189    /* Prepare tool-bar: */
    190     m_pFoldersToolBar->setUsesTextLabel(false);
    191190    m_pFoldersToolBar->setIconSize(QSize(16, 16));
    192191    m_pFoldersToolBar->setOrientation(Qt::Vertical);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r51355 r51937  
    176176
    177177    /* Prepare tool-bar: */
    178     m_pFiltersToolBar->setUsesTextLabel(false);
    179178    m_pFiltersToolBar->setIconSize(QSize(16, 16));
    180179    m_pFiltersToolBar->setOrientation(Qt::Vertical);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp

    r48534 r51937  
    11/* $Id$ */
    22/** @file
    3  *
    4  * VBox frontends: Qt GUI ("VirtualBox"):
    5  * UIToolBar class implementation
     3 * VBox Qt GUI - UIToolBar class implementation.
    64 */
    75
    86/*
    9  * Copyright (C) 2006-2013 Oracle Corporation
     7 * Copyright (C) 2006-2014 Oracle Corporation
    108 *
    119 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1816 */
    1917
    20 /* Local includes */
     18/* Qt includes: */
     19#include <QLayout>
     20#include <QMainWindow>
     21#include <QWindowsStyle>
     22#include <QCleanlooksStyle>
     23
     24/* GUI includes: */
    2125#include "UIToolBar.h"
    2226#ifdef Q_WS_MAC
     
    2428#endif /* Q_WS_MAC */
    2529
    26 /* Qt includes: */
    27 #include <QLayout>
    28 #include <QMainWindow>
    29 /* Note: These styles are available on _all_ platforms: */
    30 #include <QCleanlooksStyle>
    31 #include <QWindowsStyle>
    32 
    33 UIToolBar::UIToolBar(QWidget *pParent /* = 0*/)
     30UIToolBar::UIToolBar(QWidget *pParent /* = 0 */)
    3431    : QToolBar(pParent)
    3532    , m_pMainWindow(qobject_cast<QMainWindow*>(pParent))
    3633{
    37     /* Configure tool-bar: */
    38     setFloatable(false);
    39     setMovable(false);
    40 
    41     /* Remove that ugly frame panel around the toolbar.
    42      * Doing that currently for Cleanlooks & Windows styles. */
    43     if (qobject_cast <QCleanlooksStyle*>(QToolBar::style()) ||
    44         qobject_cast <QWindowsStyle*>(QToolBar::style()))
    45         setStyleSheet("QToolBar { border: 0px none black; }");
    46 
    47     /* Configure layout: */
    48     if (layout())
    49         layout()->setContentsMargins(0, 0, 0, 0);;
    50 
    51     /* Configure context-menu policy: */
    52     setContextMenuPolicy(Qt::NoContextMenu);
     34    /* Prepare: */
     35    prepare();
    5336}
    5437
    55 void UIToolBar::setUsesTextLabel(bool fEnable)
     38void UIToolBar::setUseTextLabels(bool fEnable)
    5639{
    57     Qt::ToolButtonStyle tbs = Qt::ToolButtonTextUnderIcon;
    58     if (!fEnable)
    59         tbs = Qt::ToolButtonIconOnly;
     40    /* Determine tool-button style on the basis of passed flag: */
     41    Qt::ToolButtonStyle tbs = fEnable ? Qt::ToolButtonTextUnderIcon : Qt::ToolButtonIconOnly;
    6042
     43    /* Depending on parent, assign this style: */
    6144    if (m_pMainWindow)
    6245        m_pMainWindow->setToolButtonStyle(tbs);
     
    6649
    6750#ifdef Q_WS_MAC
    68 void UIToolBar::setMacToolbar()
     51void UIToolBar::enableMacToolbar()
    6952{
     53    /* Depending on parent, enable unified title/tool-bar: */
    7054    if (m_pMainWindow)
    7155        m_pMainWindow->setUnifiedTitleAndToolBarOnMac(true);
     
    9276#endif /* Q_WS_MAC */
    9377
     78void UIToolBar::prepare()
     79{
     80    /* Configure tool-bar: */
     81    setFloatable(false);
     82    setMovable(false);
     83
     84    /* Remove that ugly frame panel around the toolbar.
     85     * Doing that currently for Cleanlooks & Windows styles. */
     86    if (qobject_cast <QCleanlooksStyle*>(QToolBar::style()) ||
     87        qobject_cast <QWindowsStyle*>(QToolBar::style()))
     88        setStyleSheet("QToolBar { border: 0px none black; }");
     89
     90    /* Configure tool-bar' layout: */
     91    if (layout())
     92        layout()->setContentsMargins(0, 0, 0, 0);
     93
     94    /* Configure tool-bar' context-menu policy: */
     95    setContextMenuPolicy(Qt::NoContextMenu);
     96}
     97
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.h

    r46193 r51937  
    11/** @file
    2  *
    3  * VBox frontends: Qt GUI ("VirtualBox"):
    4  * UIToolBar class declaration
     2 * VBox Qt GUI - UIToolBar class declaration.
    53 */
    64
    75/*
    8  * Copyright (C) 2006-2013 Oracle Corporation
     6 * Copyright (C) 2006-2014 Oracle Corporation
    97 *
    108 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2624class QMainWindow;
    2725
    28 /* UI tool-bar prototype class: */
     26/** QToolBar extension
     27  * with few settings presets. */
    2928class UIToolBar : public QToolBar
    3029{
     30    Q_OBJECT;
     31
    3132public:
    3233
    33     /* Constructor: */
     34    /** Constructor, passes @a pParent to the QToolBar constructor. */
    3435    UIToolBar(QWidget *pParent = 0);
    3536
    36     /* API: Text-label stuff: */
    37     void setUsesTextLabel(bool fEnable);
     37    /** Defines whether tool-bar should use text-labels.
     38      * Default value if @a false. */
     39    void setUseTextLabels(bool fEnable);
    3840
    3941#ifdef Q_WS_MAC
    40     /* API: Mac toolbar stuff: */
    41     void setMacToolbar();
     42    /** Mac OS X: Defines whether native tool-bar should be used. */
     43    void enableMacToolbar();
     44    /** Mac OS X: Defines whether native tool-bar button should be shown. */
    4245    void setShowToolBarButton(bool fShow);
     46    /** Mac OS X: Updates native tool-bar layout. */
    4347    void updateLayout();
    4448#endif /* Q_WS_MAC */
     
    4650private:
    4751
    48     /* Variables: */
     52    /** Prepare routine. */
     53    void prepare();
     54
     55    /** Holds the parent main-window isntance. */
    4956    QMainWindow *m_pMainWindow;
    5057};
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