VirtualBox

Ignore:
Timestamp:
May 19, 2020 3:34:13 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Rework group definition save procedure to use existing group definitions to avoid duplication.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r84371 r84373  
    941941    foreach (UIChooserNode *pNode, pParentGroup->nodes(UIChooserNodeType_Global))
    942942    {
    943         const QString strGlobalDescriptor(pNode->isFavorite() ? "nf" : "n");
    944         orders[strExtraDataKey] << QString("%1=GLOBAL").arg(strGlobalDescriptor);
     943        /* Append node definition: */
     944        AssertPtrReturnVoid(pNode);
     945        orders[strExtraDataKey] << pNode->definition(true /* full */);
    945946    }
    946947    /* Iterate over all the group-nodes: */
    947948    foreach (UIChooserNode *pNode, pParentGroup->nodes(UIChooserNodeType_Group))
    948949    {
    949         const QString strGroupDescriptor(pNode->toGroupNode()->isOpened() ? "go" : "gc");
    950         orders[strExtraDataKey] << QString("%1=%2").arg(strGroupDescriptor, pNode->name());
     950        /* Append node definition: */
     951        AssertPtrReturnVoid(pNode);
     952        orders[strExtraDataKey] << pNode->definition(true /* full */);
     953        /* Go recursively through children: */
    951954        gatherGroupOrders(orders, pNode);
    952955    }
     
    958961        UIChooserNodeMachine *pMachineNode = pNode->toMachineNode();
    959962        AssertPtrReturnVoid(pMachineNode);
    960         /* Make sure it's local or real cloud machine node exactly: */
     963        /* Append node definition, make sure it's local or real cloud machine node only: */
    961964        if (   pMachineNode->cacheType() == UIVirtualMachineItemType_Local
    962965            || pMachineNode->cacheType() == UIVirtualMachineItemType_CloudReal)
    963             orders[strExtraDataKey] << QString("m=%1").arg(toOldStyleUuid(pMachineNode->id()));
     966            orders[strExtraDataKey] << pNode->definition(true /* full */);
    964967    }
    965968}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNode.h

    r83884 r84373  
    8787    /** Returns item description. */
    8888    virtual QString description() const = 0;
    89     /** Returns item definition. */
    90     virtual QString definition() const = 0;
     89    /** Returns item definition.
     90      * @param  fFull  Brings whether full definition is required
     91      *                which is used while saving group definitions,
     92      *                otherwise short definition will be returned,
     93      *                which is used while saving last chosen node. */
     94    virtual QString definition(bool fFull = false) const = 0;
    9195
    9296    /** Returns whether there are children of certain @a enmType. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGlobal.cpp

    r83884 r84373  
    7575}
    7676
    77 QString UIChooserNodeGlobal::definition() const
     77QString UIChooserNodeGlobal::definition(bool fFull /* = false */) const
    7878{
    79     return QString("n=%1").arg("GLOBAL");
     79    return   fFull
     80           ? QString("n%1=%2").arg(isFavorite() ? "f" : "").arg("GLOBAL")
     81           : QString("n=%1").arg("GLOBAL");
    8082}
    8183
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGlobal.h

    r83884 r84373  
    5959    /** Returns item description. */
    6060    virtual QString description() const /* override */;
    61     /** Returns item definition. */
    62     virtual QString definition() const /* override */;
     61    /** Returns item definition.
     62      * @param  fFull  Brings whether full definition is required
     63      *                which is used while saving group definitions,
     64      *                otherwise short definition will be returned,
     65      *                which is used while saving last chosen node. */
     66    virtual QString definition(bool fFull = false) const /* override */;
    6367
    6468    /** Returns whether there are children of certain @a enmType. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGroup.cpp

    r84371 r84373  
    105105}
    106106
    107 QString UIChooserNodeGroup::definition() const
    108 {
    109     return QString("g=%1").arg(fullName());
     107QString UIChooserNodeGroup::definition(bool fFull /* = false */) const
     108{
     109    return   fFull
     110           ? QString("g%1=%2").arg(isOpened() ? "o" : "").arg(name())
     111           : QString("g=%1").arg(fullName());
    110112}
    111113
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGroup.h

    r83884 r84373  
    6363    /** Returns item description. */
    6464    virtual QString description() const /* override */;
    65     /** Returns item definition. */
    66     virtual QString definition() const /* override */;
     65    /** Returns item definition.
     66      * @param  fFull  Brings whether full definition is required
     67      *                which is used while saving group definitions,
     68      *                otherwise short definition will be returned,
     69      *                which is used while saving last chosen node. */
     70    virtual QString definition(bool fFull = false) const /* override */;
    6771
    6872    /** Returns whether there are children of certain @a enmType. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.cpp

    r83946 r84373  
    136136}
    137137
    138 QString UIChooserNodeMachine::definition() const
     138QString UIChooserNodeMachine::definition(bool) const
    139139{
    140140    return QString("m=%1").arg(UIChooserAbstractModel::toOldStyleUuid(id()));
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.h

    r83946 r84373  
    7979    /** Returns item description. */
    8080    virtual QString description() const /* override */;
    81     /** Returns item definition. */
    82     virtual QString definition() const /* override */;
     81    /** Returns item definition.
     82      * @param  fFull  Brings whether full definition is required
     83      *                which is used while saving group definitions,
     84      *                otherwise short definition will be returned,
     85      *                which is used while saving last chosen node. */
     86    virtual QString definition(bool fFull = false) const /* override */;
    8387
    8488    /** Returns whether there are children of certain @a enmType. */
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