VirtualBox

Changeset 48090 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 27, 2013 4:10:14 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Virtual Medium Manager: Rework (part 3).

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r48088 r48090  
    14451445}
    14461446
     1447void UIMediumManager::setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem)
     1448{
     1449    if (pTree && pItem)
     1450    {
     1451        pItem->setSelected(true);
     1452        pTree->setCurrentItem(pItem);
     1453        pTree->scrollToItem(pItem, QAbstractItemView::EnsureVisible);
     1454        sltHandleCurrentItemChanged(pItem);
     1455    }
     1456    else
     1457        sltHandleCurrentTabChanged();
     1458}
     1459
    14471460UIMediumItem* UIMediumManager::toMediumItem(QTreeWidgetItem *pItem) const
    14481461{
     
    14541467}
    14551468
    1456 void UIMediumManager::setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem)
    1457 {
    1458     if (pTree && pItem)
    1459     {
    1460         pItem->setSelected(true);
    1461         pTree->setCurrentItem(pItem);
    1462         pTree->scrollToItem(pItem, QAbstractItemView::EnsureVisible);
    1463         sltHandleCurrentItemChanged(pItem);
    1464     }
    1465     else
    1466         sltHandleCurrentTabChanged();
     1469UIMediumItem* UIMediumManager::searchItem(QTreeWidget *pTree, const QString &strId) const
     1470{
     1471    /* Make sure passed ID is valid: */
     1472    if (strId.isNull())
     1473        return 0;
     1474
     1475    /* Iterate other all the mediums of passed tree: */
     1476    UIMediumItemIterator iterator(pTree);
     1477    while (*iterator)
     1478    {
     1479        if ((*iterator)->id() == strId)
     1480            return *iterator;
     1481        ++iterator;
     1482    }
     1483
     1484    /* Null by default: */
     1485    return 0;
    14671486}
    14681487
     
    15821601}
    15831602
    1584 UIMediumItem* UIMediumManager::searchItem(QTreeWidget *pTree, const QString &strId) const
    1585 {
    1586     /* Make sure passed ID is valid: */
    1587     if (strId.isNull())
    1588         return 0;
    1589 
    1590     /* Iterate other all the mediums of passed tree: */
    1591     UIMediumItemIterator iterator(pTree);
    1592     while (*iterator)
    1593     {
    1594         if ((*iterator)->id() == strId)
    1595             return *iterator;
    1596         ++iterator;
    1597     }
    1598 
    1599     /* Null by default: */
    1600     return 0;
    1601 }
    1602 
    16031603bool UIMediumManager::checkMediumFor(UIMediumItem *pItem, Action action)
    16041604{
     
    17021702}
    17031703
     1704/* static */
    17041705QString UIMediumManager::formatPaneText(const QString &strText, bool fCompact /* = true */,
    17051706                                        const QString &strElipsis /* = "middle" */)
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r48088 r48090  
    66
    77/*
    8  * Copyright (C) 2006-2012 Oracle Corporation
     8 * Copyright (C) 2006-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    125125    void retranslateUi();
    126126
    127     /* Helper: Medium-modification stuff: */
     127    /* Helpers: Medium-modification stuff: */
    128128    bool releaseMediumFrom(const UIMedium &medium, const QString &strMachineId);
    129129    bool releaseHardDiskFrom(const UIMedium &medium, CMachine &machine);
     
    135135    UIMediumType currentTreeWidgetType() const;
    136136    QTreeWidget* currentTreeWidget() const;
    137     UIMediumItem* toMediumItem(QTreeWidgetItem *aItem) const;
    138137    void setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem);
     138    UIMediumItem* toMediumItem(QTreeWidgetItem *pItem) const;
     139    UIMediumItem* searchItem(QTreeWidget *pTree, const QString &strId) const;
     140    UIMediumItem* createHardDiskItem(QTreeWidget *pTree, const UIMedium &medium) const;
    139141
    140     UIMediumItem* createHardDiskItem (QTreeWidget *aTree, const UIMedium &aMedium) const;
     142    /* Internal API: Tab-widget access stuff: */
     143    void updateTabIcons(UIMediumItem *pItem, ItemAction action);
    141144
    142     void updateTabIcons (UIMediumItem *aItem, ItemAction aAction);
     145    /* Helpers: Other stuff: */
     146    bool checkMediumFor(UIMediumItem *pItem, Action action);
     147    void clearInfoPanes();
     148    void prepareToRefresh(int iTotal = 0);
    143149
    144     UIMediumItem* searchItem (QTreeWidget *aTree, const QString &aId) const;
     150    /* Static helper: Formatting stuff: */
     151    static QString formatPaneText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle");
    145152
    146     bool checkMediumFor (UIMediumItem *aItem, Action aAction);
    147 
    148     void clearInfoPanes();
    149     void prepareToRefresh (int aTotal = 0);
    150 
    151     QString formatPaneText (const QString &aText, bool aCompact = true, const QString &aElipsis = "middle");
    152 
    153     /* Helper: Enumeration stuff: */
     153    /* Static helper: Enumeration stuff: */
    154154    static bool isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium);
    155155
     
    188188
    189189#endif /* __UIMediumManager_h__ */
    190 
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