VirtualBox

Changeset 74246 in vbox for trunk/src


Ignore:
Timestamp:
Sep 13, 2018 3:42:21 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager UI: Small Chooser pane cleanup.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp

    r74184 r74246  
    2121
    2222/* Qt includes: */
    23 # include <QStatusBar>
    24 # include <QStyle>
    2523# include <QVBoxLayout>
    2624
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h

    r74184 r74246  
    2222#include <QWidget>
    2323
    24 /* GUI includes: */
    25 #include "UIChooserItem.h"
    26 
    2724/* Forward declarations: */
    2825class QVBoxLayout;
     
    3330class UIVirtualMachineItem;
    3431
    35 /** QWidget extension used as VM chooser pane. */
     32/** QWidget extension used as VM Chooser-pane. */
    3633class UIChooser : public QWidget
    3734{
     
    6259public:
    6360
    64     /** Constructs chooser pane passing @a pParent to the base-class. */
     61    /** Constructs Chooser-pane passing @a pParent to the base-class. */
    6562    UIChooser(UIVirtualBoxManagerWidget *pParent);
    66     /** Destructs chooser pane. */
     63    /** Destructs Chooser-pane. */
    6764    virtual ~UIChooser() /* override */;
    6865
     
    147144        /** Holds the main layout instane. */
    148145        QVBoxLayout    *m_pMainLayout;
    149         /** Holds the chooser model instane. */
     146        /** Holds the Chooser-model instane. */
    150147        UIChooserModel *m_pChooserModel;
    151         /** Holds the chooser view instane. */
     148        /** Holds the Chooser-view instane. */
    152149        UIChooserView  *m_pChooserView;
    153150    /** @} */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp

    r74084 r74246  
    389389    {
    390390        /* Root-item should notify chooser-view if minimum-width-hint was changed: */
    391         int iMinimumWidthHint = minimumWidthHint();
     391        const int iMinimumWidthHint = minimumWidthHint();
    392392        if (m_iPreviousMinimumWidthHint != iMinimumWidthHint)
    393393        {
     
    397397        }
    398398        /* Root-item should notify chooser-view if minimum-height-hint was changed: */
    399         int iMinimumHeightHint = minimumHeightHint();
     399        const int iMinimumHeightHint = minimumHeightHint();
    400400        if (m_iPreviousMinimumHeightHint != iMinimumHeightHint)
    401401        {
     
    578578        return strText;
    579579
    580     /* Check if passed text feats maximum width: */
     580    /* Check if passed text fits maximum width: */
    581581    QFontMetrics fm(font, pPaintDevice);
    582582    if (fm.width(strText) <= iWidth)
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp

    r74138 r74246  
    6060    updatePixmap();
    6161
    62     /* Translate finally: */
     62    /* Apply language settings: */
    6363    retranslateUi();
    6464}
     
    8989    updatePixmap();
    9090
    91     /* Translate finally: */
     91    /* Apply language settings: */
    9292    retranslateUi();
    9393}
     
    215215QString UIChooserItemGlobal::definition() const
    216216{
    217     return QString("n=%1").arg(name());
     217    return QString("n=%1").arg("GLOBAL");
    218218}
    219219
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r74085 r74246  
    6767    pScene->addItem(this);
    6868
    69     /* Translate finally: */
     69    /* Apply language settings: */
    7070    retranslateUi();
    7171
     
    102102    copyContent(pCopyFrom, this);
    103103
    104     /* Translate finally: */
     104    /* Apply language settings: */
    105105    retranslateUi();
    106106
     
    142142            this, &UIChooserItemGroup::sltHandleWindowRemapped);
    143143
    144     /* Translate finally: */
     144    /* Apply language settings: */
    145145    retranslateUi();
    146146
     
    190190    copyContent(pCopyFrom, this);
    191191
    192     /* Translate finally: */
     192    /* Apply language settings: */
    193193    retranslateUi();
    194194
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r74002 r74246  
    7474    updateSnapshotName();
    7575
    76     /* Translate finally: */
     76    /* Apply language settings: */
    7777    retranslateUi();
    7878}
     
    110110    updateSnapshotName();
    111111
    112     /* Translate finally: */
     112    /* Apply language settings: */
    113113    retranslateUi();
    114114}
     
    226226
    227227    /* What is the new geometry? */
    228     QRectF newGeometry = geometry();
     228    const QRectF newGeometry = geometry();
    229229
    230230    /* Should we update visible name? */
     
    252252    /* Paint decorations: */
    253253    paintDecorations(pPainter, pOption);
    254 
    255254    /* Paint machine info: */
    256255    paintMachineInfo(pPainter, pOption);
     
    455454}
    456455
    457 QSizeF UIChooserItemMachine::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const
     456QSizeF UIChooserItemMachine::sizeHint(Qt::SizeHint enmWhich, const QSizeF &constraint /* = QSizeF() */) const
    458457{
    459458    /* If Qt::MinimumSize requested: */
    460     if (which == Qt::MinimumSize)
     459    if (enmWhich == Qt::MinimumSize)
    461460        return QSizeF(minimumWidthHint(), minimumHeightHint());
    462461    /* Else call to base-class: */
    463     return UIChooserItem::sizeHint(which, constraint);
     462    return UIChooserItem::sizeHint(enmWhich, constraint);
    464463}
    465464
     
    586585void UIChooserItemMachine::prepare()
    587586{
    588     /* Colors: */
     587    /* Color tones: */
    589588#ifdef VBOX_WS_MAC
    590589    m_iHighlightLightnessMin = 105;
     
    667666void UIChooserItemMachine::updateStatePixmap()
    668667{
    669     /* Determine the icon metric: */
    670     const QStyle *pStyle = QApplication::style();
    671     const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
     668    /* Determine icon metric: */
     669    const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
    672670    /* Get new state-pixmap and state-pixmap size: */
    673671    const QIcon stateIcon = machineStateIcon();
     
    891889{
    892890    /* Prepare variables: */
    893     QRect fullRect = pOption->rect;
     891    const QRect fullRect = pOption->rect;
    894892
    895893    /* Paint background: */
    896894    paintBackground(pPainter, fullRect);
    897 
    898895    /* Paint frame: */
    899896    paintFrameRectangle(pPainter, fullRect);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r74184 r74246  
    142142QPaintDevice *UIChooserModel::paintDevice() const
    143143{
    144     if (!scene() || scene()->views().isEmpty())
    145         return 0;
    146     return scene()->views().first();
     144    if (scene() && !scene()->views().isEmpty())
     145        return scene()->views().first();
     146    return 0;
    147147}
    148148
     
    154154void UIChooserModel::setCurrentItems(const QList<UIChooserItem*> &items)
    155155{
    156     /* Is there something seems to be changed? */
     156    /* Is there something changed? */
    157157    if (m_currentItems == items)
    158158        return;
     
    171171            m_currentItems << pItem;
    172172        else
    173             AssertMsgFailed(("Passed item not in navigation list!"));
     173            AssertMsgFailed(("Passed item is not in navigation list!"));
    174174    }
    175175
     
    16081608    QList<UIChooserItem*> navigationItems;
    16091609
     1610    /* Iterate over all the global-items: */
     1611    foreach (UIChooserItem *pGlobalItem, pItem->items(UIChooserItemType_Global))
     1612        navigationItems << pGlobalItem;
    16101613    /* Iterate over all the group-items: */
    16111614    foreach (UIChooserItem *pGroupItem, pItem->items(UIChooserItemType_Group))
     
    16151618            navigationItems << createNavigationList(pGroupItem);
    16161619    }
    1617     /* Iterate over all the global-items: */
    1618     foreach (UIChooserItem *pGlobalItem, pItem->items(UIChooserItemType_Global))
    1619         navigationItems << pGlobalItem;
    16201620    /* Iterate over all the machine-items: */
    16211621    foreach (UIChooserItem *pMachineItem, pItem->items(UIChooserItemType_Machine))
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r74184 r74246  
    3333
    3434/* Forward declaration: */
    35 class QAction;
    3635class QDrag;
    3736class QGraphicsItem;
     
    5756
    5857
    59 /** QObject extension used as VM chooser pane model: */
     58/** QObject extension used as VM Chooser-pane model: */
    6059class UIChooserModel : public QObject
    6160{
     
    9897public:
    9998
    100     /** Constructs chooser model passing @a pParent to the base-class. */
     99    /** Constructs Chooser-model passing @a pParent to the base-class. */
    101100    UIChooserModel(UIChooser *pParent);
    102     /** Destructs chooser model. */
     101    /** Destructs Chooser-model. */
    103102    virtual ~UIChooserModel() /* override */;
    104103
     
    110109        void deinit();
    111110
    112         /** Returns the chooser reference. */
     111        /** Returns the Chooser reference. */
    113112        UIChooser *chooser() const;
    114113        /** Returns the action-pool reference. */
     
    239238    /** @name General stuff.
    240239      * @{ */
    241         /** Handles chooser view resize. */
     240        /** Handles Chooser-view resize. */
    242241        void sltHandleViewResized();
    243242    /** @} */
     
    449448    /** @name General stuff.
    450449      * @{ */
    451         /** Holds the chooser reference. */
     450        /** Holds the Chooser reference. */
    452451        UIChooser *m_pChooser;
    453452
     
    469468      * @{ */
    470469        /** Holds the focus item reference. */
    471         QPointer<UIChooserItem> m_pFocusItem;
     470        QPointer<UIChooserItem>  m_pFocusItem;
    472471    /** @} */
    473472
     
    486485
    487486        /** Holds the navigation list. */
    488         QList<UIChooserItem*> m_navigationList;
    489         QList<UIChooserItem*> m_currentItems;
     487        QList<UIChooserItem*>  m_navigationList;
     488        QList<UIChooserItem*>  m_currentItems;
    490489
    491490        /** Holds the current drag object instance. */
    492491        QPointer<QDrag>  m_pCurrentDragObject;
    493492        /** Holds the drag scrolling token size. */
    494         int m_iScrollingTokenSize;
     493        int              m_iScrollingTokenSize;
    495494        /** Holds whether drag scrolling is in progress. */
    496         bool m_fIsScrollingInProgress;
     495        bool             m_fIsScrollingInProgress;
    497496
    498497        /** Holds the item lookup timer instance. */
    499         QTimer *m_pLookupTimer;
     498        QTimer  *m_pLookupTimer;
    500499        /** Holds the item lookup string. */
    501         QString m_strLookupString;
     500        QString  m_strLookupString;
    502501
    503502        /** Holds the Id of last VM created from the GUI side. */
    504         QString m_strLastCreatedMachineId;
     503        QString  m_strLastCreatedMachineId;
    505504    /** @} */
    506505
     
    508507      * @{ */
    509508        /** Holds the consolidated map of group definitions/orders. */
    510         QMap<QString, QStringList> m_groups;
     509        QMap<QString, QStringList>  m_groups;
    511510    /** @} */
    512511};
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