Changeset 77347 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 18, 2019 1:26:44 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128884
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp
r77346 r77347 35 35 36 36 UIChooserItemGlobal::UIChooserItemGlobal(UIChooserItem *pParent, 37 bool fFavorite, 37 38 int iPosition /* = -1 */) 38 : UIChooserItem(pParent, f alse /* favorite? */, pParent->isTemporary(), 0, 100)39 : UIChooserItem(pParent, fFavorite, pParent->isTemporary(), 0, 100) 39 40 , m_iPosition(iPosition) 40 41 , m_iDefaultLightnessMin(0) … … 52 53 53 54 UIChooserItemGlobal::UIChooserItemGlobal(UIChooserItem *pParent, 55 bool fFavorite, 54 56 UIChooserItemGlobal *pCopyFrom, 55 57 int iPosition /* = -1 */) 56 : UIChooserItem(pParent, f alse /* favorite? */, pParent->isTemporary(), 0, 100)58 : UIChooserItem(pParent, fFavorite, pParent->isTemporary(), 0, 100) 57 59 , m_iPosition(iPosition) 58 60 , m_iDefaultLightnessMin(0) … … 390 392 /* Add item to the parent: */ 391 393 AssertPtrReturnVoid(parentItem()); 392 parentItem()->addItem(this, false, m_iPosition);394 parentItem()->addItem(this, isFavorite(), m_iPosition); 393 395 394 396 /* Configure connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h
r77346 r77347 42 42 enum { Type = UIChooserItemType_Global }; 43 43 44 /** Constructs item with specified @a iPosition, passing @a pParent to the base-class. */45 UIChooserItemGlobal(UIChooserItem *pParent, int iPosition = -1);46 /** Constructs temporary item with specified @a iPosition as a @a pCopyFrom, passing @a pParent to the base-class. */47 UIChooserItemGlobal(UIChooserItem *pParent, UIChooserItemGlobal *pCopyFrom, int iPosition = -1);44 /** Constructs possible @a fFavorite item with specified @a iPosition, passing @a pParent to the base-class. */ 45 UIChooserItemGlobal(UIChooserItem *pParent, bool fFavorite, int iPosition = -1); 46 /** Constructs possible @a fFavorite temporary item with specified @a iPosition as a @a pCopyFrom, passing @a pParent to the base-class. */ 47 UIChooserItemGlobal(UIChooserItem *pParent, bool fFavorite, UIChooserItemGlobal *pCopyFrom, int iPosition = -1); 48 48 /** Destructs global item. */ 49 49 virtual ~UIChooserItemGlobal() /* override */; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r77316 r77347 1854 1854 } 1855 1855 1856 bool UIChooserModel::isGlobalItemFavorite(UIChooserItem *pParentItem) const 1857 { 1858 /* Read group definitions: */ 1859 const QStringList definitions = gEDataManager->selectorWindowGroupsDefinitions(pParentItem->fullName()); 1860 /* Return 'false' if no definitions found: */ 1861 if (definitions.isEmpty()) 1862 return false; 1863 1864 /* Prepare required group definition reg-exp: */ 1865 const QString strDefinitionTemplate = QString("n(\\S)*=GLOBAL"); 1866 const QRegExp definitionRegExp(strDefinitionTemplate); 1867 /* For each the group definition: */ 1868 foreach (const QString &strDefinition, definitions) 1869 { 1870 /* Check if this is required definition: */ 1871 if (definitionRegExp.indexIn(strDefinition) == 0) 1872 { 1873 /* Get group descriptor: */ 1874 const QString strDescriptor(definitionRegExp.cap(1)); 1875 if (strDescriptor.contains('f')) 1876 return true; 1877 } 1878 } 1879 1880 /* Return 'false' by default: */ 1881 return false; 1882 } 1883 1856 1884 UIChooserItem *UIChooserModel::getGroupItem(const QString &strName, UIChooserItem *pParentItem, bool fAllGroupsOpened) 1857 1885 { … … 2016 2044 { 2017 2045 /* Create global-item: */ 2018 new UIChooserItemGlobal(pParentItem, 0);2046 new UIChooserItemGlobal(pParentItem, isGlobalItemFavorite(pParentItem), 0); 2019 2047 } 2020 2048 … … 2203 2231 /* Prepare extra-data key for current group: */ 2204 2232 const QString strExtraDataKey = pParentItem->fullName(); 2233 /* Iterate over all the global-items: */ 2234 foreach (UIChooserItem *pItem, pParentItem->items(UIChooserItemType_Global)) 2235 { 2236 const QString strGlobalDescriptor(pItem->isFavorite() ? "nf" : "n"); 2237 orders[strExtraDataKey] << QString("%1=GLOBAL").arg(strGlobalDescriptor); 2238 } 2205 2239 /* Iterate over all the group-items: */ 2206 2240 foreach (UIChooserItem *pItem, pParentItem->items(UIChooserItemType_Group)) 2207 2241 { 2208 QString strGroupDescriptor(pItem->toGroupItem()->isOpened() ? "go" : "gc");2242 const QString strGroupDescriptor(pItem->toGroupItem()->isOpened() ? "go" : "gc"); 2209 2243 orders[strExtraDataKey] << QString("%1=%2").arg(strGroupDescriptor, pItem->name()); 2210 2244 gatherGroupOrders(orders, pItem); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r77315 r77347 412 412 void cleanupGroupTree(UIChooserItem *pParentItem); 413 413 414 /** Returns whether global item within the @a pParentItem is favorite. */ 415 bool isGlobalItemFavorite(UIChooserItem *pParentItem) const; 416 414 417 /** Acquires group item, creates one if necessary. 415 418 * @param strName Brings the name of group we looking for.
Note:
See TracChangeset
for help on using the changeset viewer.