VirtualBox

Ignore:
Timestamp:
Feb 18, 2019 1:26:44 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128884
Message:

FE/Qt: bugref:9373: VirtualBox Manager: Chooser pane: Integrate support for Global favorite item (s.a. r128883), no UI switch for now.

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  
    3535
    3636UIChooserItemGlobal::UIChooserItemGlobal(UIChooserItem *pParent,
     37                                         bool fFavorite,
    3738                                         int iPosition /* = -1 */)
    38     : UIChooserItem(pParent, false /* favorite? */, pParent->isTemporary(), 0, 100)
     39    : UIChooserItem(pParent, fFavorite, pParent->isTemporary(), 0, 100)
    3940    , m_iPosition(iPosition)
    4041    , m_iDefaultLightnessMin(0)
     
    5253
    5354UIChooserItemGlobal::UIChooserItemGlobal(UIChooserItem *pParent,
     55                                         bool fFavorite,
    5456                                         UIChooserItemGlobal *pCopyFrom,
    5557                                         int iPosition /* = -1 */)
    56     : UIChooserItem(pParent, false /* favorite? */, pParent->isTemporary(), 0, 100)
     58    : UIChooserItem(pParent, fFavorite, pParent->isTemporary(), 0, 100)
    5759    , m_iPosition(iPosition)
    5860    , m_iDefaultLightnessMin(0)
     
    390392    /* Add item to the parent: */
    391393    AssertPtrReturnVoid(parentItem());
    392     parentItem()->addItem(this, false, m_iPosition);
     394    parentItem()->addItem(this, isFavorite(), m_iPosition);
    393395
    394396    /* Configure connections: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h

    r77346 r77347  
    4242    enum { Type = UIChooserItemType_Global };
    4343
    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);
    4848    /** Destructs global item. */
    4949    virtual ~UIChooserItemGlobal() /* override */;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r77316 r77347  
    18541854}
    18551855
     1856bool 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
    18561884UIChooserItem *UIChooserModel::getGroupItem(const QString &strName, UIChooserItem *pParentItem, bool fAllGroupsOpened)
    18571885{
     
    20162044{
    20172045    /* Create global-item: */
    2018     new UIChooserItemGlobal(pParentItem, 0);
     2046    new UIChooserItemGlobal(pParentItem, isGlobalItemFavorite(pParentItem), 0);
    20192047}
    20202048
     
    22032231    /* Prepare extra-data key for current group: */
    22042232    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    }
    22052239    /* Iterate over all the group-items: */
    22062240    foreach (UIChooserItem *pItem, pParentItem->items(UIChooserItemType_Group))
    22072241    {
    2208         QString strGroupDescriptor(pItem->toGroupItem()->isOpened() ? "go" : "gc");
     2242        const QString strGroupDescriptor(pItem->toGroupItem()->isOpened() ? "go" : "gc");
    22092243        orders[strExtraDataKey] << QString("%1=%2").arg(strGroupDescriptor, pItem->name());
    22102244        gatherGroupOrders(orders, pItem);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r77315 r77347  
    412412        void cleanupGroupTree(UIChooserItem *pParentItem);
    413413
     414        /** Returns whether global item within the @a pParentItem is favorite. */
     415        bool isGlobalItemFavorite(UIChooserItem *pParentItem) const;
     416
    414417        /** Acquires group item, creates one if necessary.
    415418          * @param  strName           Brings the name of group we looking for.
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette