VirtualBox

Changeset 43615 in vbox


Ignore:
Timestamp:
Oct 11, 2012 11:34:53 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: VM group feature UI: Moving item sorting stuff into corresponding place.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.h

    r43604 r43615  
    107107    virtual UIGChooserItem* searchForItem(const QString &strSearchTag, int iItemSearchFlags) = 0;
    108108    virtual UIGChooserItemMachine* firstMachineItem() = 0;
     109    virtual void sortItems() = 0;
    109110
    110111    /* API: Layout stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp

    r43604 r43615  
    779779}
    780780
     781void UIGChooserItemGroup::sortItems()
     782{
     783    /* Sort group-items: */
     784    QMap<QString, UIGChooserItem*> sorter;
     785    foreach (UIGChooserItem *pItem, items(UIGChooserItemType_Group))
     786        sorter.insert(pItem->name().toLower(), pItem);
     787    setItems(sorter.values(), UIGChooserItemType_Group);
     788
     789    /* Sort machine-items: */
     790    sorter.clear();
     791    foreach (UIGChooserItem *pItem, items(UIGChooserItemType_Machine))
     792        sorter.insert(pItem->name().toLower(), pItem);
     793    setItems(sorter.values(), UIGChooserItemType_Machine);
     794
     795    /* Update model: */
     796    model()->updateNavigation();
     797    model()->updateLayout();
     798}
     799
    781800void UIGChooserItemGroup::updateLayout()
    782801{
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h

    r43604 r43615  
    150150    UIGChooserItem* searchForItem(const QString &strSearchTag, int iItemSearchFlags);
    151151    UIGChooserItemMachine* firstMachineItem();
     152    void sortItems();
    152153
    153154    /* Helpers: Layout stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp

    r43604 r43615  
    390390}
    391391
     392void UIGChooserItemMachine::sortItems()
     393{
     394    AssertMsgFailed(("Machine graphics item do NOT support children!"));
     395}
     396
    392397void UIGChooserItemMachine::updateLayout()
    393398{
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.h

    r43604 r43615  
    126126    UIGChooserItem* searchForItem(const QString &strSearchTag, int iItemSearchFlags);
    127127    UIGChooserItemMachine* firstMachineItem();
     128    void sortItems();
    128129
    129130    /* Helpers: Layout stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp

    r43614 r43615  
    728728
    729729    /* Sorting group: */
    730     sortItems(currentItem());
     730    currentItem()->sortItems();
    731731}
    732732
     
    915915
    916916    /* Sorting parent group: */
    917     sortItems(currentItem()->parentItem());
     917    currentItem()->parentItem()->sortItems();
    918918}
    919919
     
    14251425            unindentRoot();
    14261426    }
    1427 }
    1428 
    1429 void UIGChooserModel::sortItems(UIGChooserItem *pParent)
    1430 {
    1431     /* Sort group-items: */
    1432     QMap<QString, UIGChooserItem*> sorter;
    1433     foreach (UIGChooserItem *pItem, pParent->items(UIGChooserItemType_Group))
    1434         sorter.insert(pItem->name().toLower(), pItem);
    1435     pParent->setItems(sorter.values(), UIGChooserItemType_Group);
    1436 
    1437     /* Sort machine-items: */
    1438     sorter.clear();
    1439     foreach (UIGChooserItem *pItem, pParent->items(UIGChooserItemType_Machine))
    1440         sorter.insert(pItem->name().toLower(), pItem);
    1441     pParent->setItems(sorter.values(), UIGChooserItemType_Machine);
    1442 
    1443     /* Update model: */
    1444     updateNavigation();
    1445     updateLayout();
    14461427}
    14471428
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h

    r43614 r43615  
    247247
    248248    /* Helpers: Machine-item stuff: */
    249     void sortItems(UIGChooserItem *pParent);
    250249    void updateMachineItems(const QString &strId, UIGChooserItem *pParent);
    251250    void removeMachineItems(const QString &strId, UIGChooserItem *pParent);
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