VirtualBox

Changeset 86573 in vbox


Ignore:
Timestamp:
Oct 14, 2020 12:06:06 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
140927
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Implementing possibility to notify about cloud machine registration directly using prepared wrapper; This is useful if we have wrapper already updated to avoid adding it in inaccessible state initially; This way both cloud wizards are now able to add instantly updated cloud machines.

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

Legend:

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

    r86341 r86573  
    25762576}
    25772577
    2578 void UICommon::notifyCloudMachineRegistered(const QString &strProviderShortName, const QString &strProfileName,
    2579                                             const QUuid &uId, const bool fRegistered)
    2580 {
    2581     emit sigCloudMachineRegistered(strProviderShortName, strProfileName, uId, fRegistered);
     2578void UICommon::notifyCloudMachineRegistered(const QString &strProviderShortName,
     2579                                            const QString &strProfileName,
     2580                                            const CCloudMachine &comCloudMachine)
     2581{
     2582    emit sigCloudMachineRegistered(strProviderShortName, strProfileName, comCloudMachine, true /* select */);
     2583}
     2584
     2585void UICommon::notifyCloudMachineRegistrationChanged(const QString &strProviderShortName,
     2586                                                     const QString &strProfileName,
     2587                                                     const QUuid &uId,
     2588                                                     const bool fRegistered)
     2589{
     2590    emit sigCloudMachineRegistrationChanged(strProviderShortName, strProfileName, uId, fRegistered);
    25822591}
    25832592
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r84847 r86573  
    8686    /** @} */
    8787
    88     /** @name Temporary: Cloud Virtual Machine stuff.
    89      * @{ */
    90         /** Notifies listeners about cloud VM was (un)registered.
    91           * @note   This is to be replaced by corresponding Main API event later.
     88    /** @name Cloud Virtual Machine stuff.
     89     * @{ */
     90        /** Notifies listeners about cloud VM was registered.
     91          * @param  strProviderShortName  Brings provider short name.
     92          * @param  strProfileName        Brings profile name.
     93          * @param  comCloudMachine       Brings cloud VM.
     94          * @param  fSelect               Brings whether registered VM should be selected. */
     95        void sigCloudMachineRegistered(const QString &strProviderShortName,
     96                                       const QString &strProfileName,
     97                                       const CCloudMachine &comCloudMachine,
     98                                       const bool fSelect);
     99        /** Notifies listeners about cloud VM registeration changed.
    92100          * @param  strProviderShortName  Brings provider short name.
    93101          * @param  strProfileName        Brings profile name.
    94102          * @param  uId                   Brings cloud VM id.
    95103          * @param  fRegistered           True is machine was registered, false otherwise. */
    96         void sigCloudMachineRegistered(const QString &strProviderShortName, const QString &strProfileName,
    97                                        const QUuid &uId, const bool fRegistered);
     104        void sigCloudMachineRegistrationChanged(const QString &strProviderShortName,
     105                                                const QString &strProfileName,
     106                                                const QUuid &uId,
     107                                                const bool fRegistered);
    98108    /** @} */
    99109
     
    500510    /** @} */
    501511
    502     /** @name Temporary: Cloud Virtual Machine stuff.
    503      * @{ */
    504         /** Notifies listeners about cloud VM was (un)registered.
    505           * @note   This is to be replaced by corresponding Main API event later.
     512    /** @name Cloud Virtual Machine stuff.
     513     * @{ */
     514        /** Notifies listeners about cloud VM was registered.
     515          * @param  strProviderShortName  Brings provider short name.
     516          * @param  strProfileName        Brings profile name.
     517          * @param  comCloudMachine       Brings cloud VM. */
     518        void notifyCloudMachineRegistered(const QString &strProviderShortName,
     519                                          const QString &strProfileName,
     520                                          const CCloudMachine &comCloudMachine);
     521        /** Notifies listeners about cloud VM registeration changed.
    506522          * @param  strProviderShortName  Brings provider short name.
    507523          * @param  strProfileName        Brings profile name.
    508524          * @param  uId                   Brings cloud VM id.
    509525          * @param  fRegistered           True is machine was registered, false otherwise. */
    510         void notifyCloudMachineRegistered(const QString &strProviderShortName, const QString &strProfileName,
    511                                           const QUuid &uId, const bool fRegistered);
     526        void notifyCloudMachineRegistrationChanged(const QString &strProviderShortName,
     527                                                   const QString &strProfileName,
     528                                                   const QUuid &uId,
     529                                                   const bool fRegistered);
    512530    /** @} */
    513531
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r86572 r86573  
    636636}
    637637
     638void UIChooserAbstractModel::sltCloudMachineRegistered(const QString &strProviderShortName, const QString &strProfileName,
     639                                                       const CCloudMachine &comMachine, bool fSelect)
     640{
     641    /* Search for profile node: */
     642    const QString strProfileNodeName = QString("/%1/%2").arg(strProviderShortName, strProfileName);
     643    QList<UIChooserNode*> profileNodes;
     644    invisibleRoot()->searchForNodes(strProfileNodeName, UIChooserItemSearchFlag_CloudProfile | UIChooserItemSearchFlag_ExactId, profileNodes);
     645    AssertReturnVoid(!profileNodes.isEmpty());
     646    UIChooserNode *pProfileNode = profileNodes.first();
     647    AssertPtrReturnVoid(pProfileNode);
     648
     649    /* Add new machine-item: */
     650    addCloudMachineIntoTheTree(strProfileNodeName, comMachine, fSelect);
     651
     652    /* Search for possible fake node: */
     653    QList<UIChooserNode*> fakeNodes;
     654    pProfileNode->searchForNodes(QUuid().toString(), UIChooserItemSearchFlag_Machine | UIChooserItemSearchFlag_ExactId, fakeNodes);
     655    /* Delete fake node if present: */
     656    delete fakeNodes.value(0);
     657}
     658
    638659void UIChooserAbstractModel::sltCloudMachineRegistrationChanged(const QString &strProviderShortName, const QString &strProfileName,
    639660                                                                const QUuid &uMachineId, const bool fRegistered)
     
    797818    connect(uiCommon().threadPoolCloud(), &UIThreadPool::sigTaskComplete,
    798819            this, &UIChooserAbstractModel::sltHandleCloudListMachinesTaskComplete);
    799     /* Setup temporary connections,
    800      * this is to be replaced by corresponding Main API event later. */
     820
     821    /* Cloud VM registration connections: */
    801822    connect(&uiCommon(), &UICommon::sigCloudMachineRegistered,
     823            this, &UIChooserAbstractModel::sltCloudMachineRegistered);
     824    connect(&uiCommon(), &UICommon::sigCloudMachineRegistrationChanged,
    802825            this, &UIChooserAbstractModel::sltCloudMachineRegistrationChanged);
    803826
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h

    r86572 r86573  
    145145        /** Handles local machine registering/unregistering for machine with certain @a uMachineId. */
    146146        virtual void sltLocalMachineRegistrationChanged(const QUuid &uMachineId, const bool fRegistered);
     147        /** Handles cloud machine registering for @a comMachine.
     148          * @param  strProviderShortName  Brings provider short name.
     149          * @param  strProfileName        Brings profile name.
     150          * @param  fSelect               Brings whether registered machine should be selected. */
     151        virtual void sltCloudMachineRegistered(const QString &strProviderShortName, const QString &strProfileName,
     152                                               const CCloudMachine &comMachine, bool fSelect);
    147153        /** Handles cloud machine registering/unregistering for machine with certain @a uMachineId.
    148154          * @param  strProviderShortName  Brings provider short name.
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r86572 r86573  
    4040#include "UIChooserNodeMachine.h"
    4141#include "UIChooserView.h"
     42#include "UICloudNetworkingStuff.h"
    4243#include "UIExtraDataManager.h"
    4344#include "UIMessageCenter.h"
     
    11071108                                                  UIChooserItemSearchFlag_ExactId));
    11081109        }
     1110    }
     1111}
     1112
     1113void UIChooserModel::sltCloudMachineRegistered(const QString &strProviderShortName, const QString &strProfileName,
     1114                                               const CCloudMachine &comMachine, bool fSelect)
     1115{
     1116    /* Call to base-class: */
     1117    UIChooserAbstractModel::sltCloudMachineRegistered(strProviderShortName, strProfileName, comMachine, fSelect);
     1118
     1119    /* Rebuild tree for main root: */
     1120    buildTreeForMainRoot(false /* preserve selection */);
     1121
     1122    /* Select newly added item: */
     1123    if (fSelect)
     1124    {
     1125        QUuid uMachineId;
     1126        if (cloudMachineId(comMachine, uMachineId))
     1127            setSelectedItem(root()->searchForItem(uMachineId.toString(),
     1128                                                  UIChooserItemSearchFlag_Machine |
     1129                                                  UIChooserItemSearchFlag_ExactId));
    11091130    }
    11101131}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r86572 r86573  
    263263        /** Handles local machine registering/unregistering for machine with certain @a uMachineId. */
    264264        virtual void sltLocalMachineRegistrationChanged(const QUuid &uMachineId, const bool fRegistered) /* override */;
     265        /** Handles cloud machine registering for @a comMachine.
     266          * @param  strProviderShortName  Brings provider short name.
     267          * @param  strProfileName        Brings profile name.
     268          * @param  fSelect               Brings whether registered machine should be selected. */
     269        virtual void sltCloudMachineRegistered(const QString &strProviderShortName, const QString &strProfileName,
     270                                               const CCloudMachine &comMachine, bool fSelect);
    265271        /** Handles cloud machine registering/unregistering for machine with certain @a uMachineId.
    266272          * @param  strProviderShortName  Brings provider short name.
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/addcloudvm/UIWizardAddCloudVM.cpp

    r86345 r86573  
    111111                        uiCommon().notifyCloudMachineRegistered(field("source").toString(),
    112112                                                                field("profileName").toString(),
    113                                                                 comMachine.GetId(),
    114                                                                 true /* registered */);
     113                                                                comMachine);
    115114                        fResult = true;
    116115                    }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newcloudvm/UIWizardNewCloudVM.cpp

    r86345 r86573  
    165165            uiCommon().notifyCloudMachineRegistered(field("location").toString(),
    166166                                                    field("profileName").toString(),
    167                                                     comMachine.GetId(),
    168                                                     true /* registered */);
     167                                                    comMachine);
    169168
    170169        /* Finally, success: */
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