Changeset 45049 in vbox
- Timestamp:
- Mar 15, 2013 12:52:34 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84300
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
r45040 r45049 45 45 const char* UIDefs::GUI_LastItemSelected = "GUI/LastItemSelected"; 46 46 const char* UIDefs::GUI_GroupDefinitions = "GUI/GroupDefinitions"; 47 const char* UIDefs::GUI_HideFromManager = "GUI/HideFromManager"; 47 48 48 49 /* Machine-window definitions: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
r45040 r45049 122 122 extern const char* GUI_LastItemSelected; 123 123 extern const char* GUI_GroupDefinitions; 124 extern const char* GUI_HideFromManager; 124 125 125 126 /* Machine-window declarations: */ -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r44948 r45049 3917 3917 return tr("QCOW (QEMU Copy-On-Write)"); 3918 3918 return strBaseMediumFormatName; 3919 } 3920 3921 /* static */ 3922 bool VBoxGlobal::isApprovedByExtraData(CMachine &machine, const QString &strExtraDataKey) 3923 { 3924 /* Load corresponding extra-data value: */ 3925 QString strExtraDataValue(machine.GetExtraData(strExtraDataKey)); 3926 3927 /* 'false' if value was not set: */ 3928 if (strExtraDataValue.isEmpty()) 3929 return false; 3930 3931 /* Handle particular values: */ 3932 return strExtraDataValue.compare("true", Qt::CaseInsensitive) == 0 3933 || strExtraDataValue.compare("yes", Qt::CaseInsensitive) == 0 3934 || strExtraDataValue.compare("on", Qt::CaseInsensitive) == 0 3935 || strExtraDataValue == "1"; 3936 } 3937 3938 /* static */ 3939 bool VBoxGlobal::shouldWeShowMachine(CMachine &machine) 3940 { 3941 /* 'false' for null machines: */ 3942 if (machine.isNull()) 3943 return false; 3944 3945 /* 'true' for inaccessible machines, 3946 * because we can't verify anything in that case: */ 3947 if (!machine.GetAccessible()) 3948 return true; 3949 3950 /* 'true' if hiding is not approved by the extra-data: */ 3951 return !isApprovedByExtraData(machine, GUI_HideFromManager); 3919 3952 } 3920 3953 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r44528 r45049 393 393 /* Returns full medium-format name for the given base medium-format name: */ 394 394 static QString fullMediumFormatName(const QString &strBaseMediumFormatName); 395 396 /* Extra-data settings stuff: */ 397 static bool isApprovedByExtraData(CMachine &machine, const QString &strExtraDataKey); 398 static bool shouldWeShowMachine(CMachine &machine); 395 399 396 400 signals: -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r45040 r45049 602 602 /* Search for corresponding machine: */ 603 603 CMachine machine = vboxGlobal().virtualBox().FindMachine(strId); 604 /* Machine was found? */605 if ( !machine.isNull())604 /* Should we show this machine? */ 605 if (VBoxGlobal::shouldWeShowMachine(machine)) 606 606 { 607 607 /* Add new machine-item: */ … … 884 884 /* Remove all the items first: */ 885 885 mainRoot()->removeAll(strId); 886 887 /* Check if such machine still present: */ 886 /* Wipe out empty groups: */ 887 cleanupGroupTree(); 888 889 /* Show machine if we should: */ 888 890 CMachine machine = vboxGlobal().virtualBox().FindMachine(strId); 889 if (machine.isNull()) 890 return; 891 892 /* Add machine into the tree: */ 893 addMachineIntoTheTree(machine); 891 if (VBoxGlobal::shouldWeShowMachine(machine)) 892 addMachineIntoTheTree(machine); 894 893 895 894 /* And update model: */ 896 cleanupGroupTree();897 895 updateNavigation(); 898 896 updateLayout(); … … 1616 1614 void UIGChooserModel::loadGroupTree() 1617 1615 { 1618 /* Add all the machines we have into the group-tree: */1616 /* Add all the approved machines we have into the group-tree: */ 1619 1617 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 (VBoxGlobal::shouldWeShowMachine(machine)) 1620 addMachineIntoTheTree(machine); 1622 1621 LogRel(("Loading VMs finished.\n")); 1623 1622 }
Note:
See TracChangeset
for help on using the changeset viewer.