VirtualBox

Changeset 45035 in vbox


Ignore:
Timestamp:
Mar 14, 2013 11:08:06 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
84283
Message:

FE/Qt: VM selector: Extra-data option: Allow to hide VM from VM list.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp

    r42526 r45035  
    6060const char* UIDefs::GUI_SaveMountedAtRuntime = "GUI/SaveMountedAtRuntime";
    6161const char* UIDefs::GUI_PassCAD = "GUI/PassCAD";
     62const char* UIDefs::GUI_HideFromManager = "GUI/HideFromManager";
    6263
    6364/* Mini tool-bar definitions: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r42526 r45035  
    137137    extern const char* GUI_SaveMountedAtRuntime;
    138138    extern const char* GUI_PassCAD;
     139    extern const char* GUI_HideFromManager;
    139140
    140141    /* Mini tool-bar declarations: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp

    r44051 r45035  
    597597void UIGChooserModel::sltMachineRegistered(QString strId, bool fRegistered)
    598598{
    599     /* New VM registered? */
     599    /* New machine registered? */
    600600    if (fRegistered)
    601601    {
    602602        /* Search for corresponding machine: */
    603603        CMachine machine = vboxGlobal().virtualBox().FindMachine(strId);
    604         /* Machine was found? */
    605         if (!machine.isNull())
     604        /* Should we show this machine? */
     605        if (shouldWeShowMachine(machine))
    606606        {
    607607            /* Add new machine-item: */
     
    615615        }
    616616    }
    617     /* Existing VM unregistered? */
     617    /* Existing machine unregistered? */
    618618    else
    619619    {
     
    884884    /* Remove all the items first: */
    885885    mainRoot()->removeAll(strId);
    886 
    887     /* Check if such machine still present: */
     886    /* Update model: */
     887    cleanupGroupTree();
     888
     889    /* Should we show this machine? */
    888890    CMachine machine = vboxGlobal().virtualBox().FindMachine(strId);
    889     if (machine.isNull())
    890         return;
    891 
    892     /* Add machine into the tree: */
    893     addMachineIntoTheTree(machine);
    894 
    895     /* And update model: */
    896     cleanupGroupTree();
     891    if (shouldWeShowMachine(machine))
     892        addMachineIntoTheTree(machine);
     893
     894    /* Update model: */
    897895    updateNavigation();
    898896    updateLayout();
     
    16161614void UIGChooserModel::loadGroupTree()
    16171615{
    1618     /* Add all the machines we have into the group-tree: */
     1616    /* Add all the approved machines we have into the group-tree: */
    16191617    LogRel(("Loading VMs started...\n"));
    1620     foreach (const CMachine &machine, vboxGlobal().virtualBox().GetMachines())
    1621         addMachineIntoTheTree(machine);
     1618    foreach (CMachine machine, vboxGlobal().virtualBox().GetMachines())
     1619        if (shouldWeShowMachine(machine))
     1620            addMachineIntoTheTree(machine);
    16221621    LogRel(("Loading VMs finished.\n"));
    16231622}
     
    18351834}
    18361835
     1836/* static */
     1837bool UIGChooserModel::shouldWeShowMachine(CMachine &machine)
     1838{
     1839    /* False for null machines: */
     1840    if (machine.isNull())
     1841        return false;
     1842
     1843    /* Check corresponding extra-data flag: */
     1844    QString strMachineIgnored(machine.GetExtraData(GUI_HideFromManager));
     1845    return    strMachineIgnored.compare("true", Qt::CaseInsensitive) != 0
     1846           && strMachineIgnored.compare("yes", Qt::CaseInsensitive) != 0
     1847           && strMachineIgnored != "1";
     1848}
     1849
    18371850void UIGChooserModel::saveGroupDefinitions()
    18381851{
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h

    r44051 r45035  
    266266    int positionFromDefinitions(UIGChooserItem *pParentItem, UIGChooserItemType type, const QString &strName);
    267267    void createMachineItem(const CMachine &machine, UIGChooserItem *pParentItem);
     268    static bool shouldWeShowMachine(CMachine &machine);
    268269
    269270    /* Helpers: Saving stuff: */
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