VirtualBox

Changeset 90325 in vbox for trunk/src


Ignore:
Timestamp:
Jul 24, 2021 1:21:36 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145888
Message:

FE/Qt: bugref:10067: Notification signature for final Clone VM wizard progress which should now go to center instead of modal dialog.

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

Legend:

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

    r90302 r90325  
    41554155}
    41564156
     4157void UICommon::sltHandleMachineCreated(const CMachine &comMachine)
     4158{
     4159    /* Register created machine. */
     4160    CVirtualBox comVBox = virtualBox();
     4161    comVBox.RegisterMachine(comMachine);
     4162    if (!comVBox.isOk())
     4163        msgCenter().cannotRegisterMachine(comVBox, comMachine.GetName());
     4164}
     4165
    41574166void UICommon::sltHandleCloudMachineAdded(const QString &strShortProviderName,
    41584167                                          const QString &strProfileName,
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r90302 r90325  
    735735    /** @} */
    736736
     737    /** @name Machine related stuff.
     738     * @{ */
     739        /** Handles signal about machine was created. */
     740        void sltHandleMachineCreated(const CMachine &comMachine);
     741    /** @} */
     742
    737743    /** @name Cloud Machine related stuff.
    738744     * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90321 r90325  
    9898
    9999/*********************************************************************************************************************************
     100*   Class UINotificationProgressMachineCopy implementation.                                                                      *
     101*********************************************************************************************************************************/
     102
     103UINotificationProgressMachineCopy::UINotificationProgressMachineCopy(const CMachine &comSource,
     104                                                                     const CMachine &comTarget,
     105                                                                     const KCloneMode &enmCloneMode,
     106                                                                     const QVector<KCloneOptions> &options)
     107    : m_comSource(comSource)
     108    , m_comTarget(comTarget)
     109    , m_enmCloneMode(enmCloneMode)
     110    , m_options(options)
     111{
     112    connect(this, &UINotificationProgress::sigProgressFinished,
     113            this, &UINotificationProgressMachineCopy::sltHandleProgressFinished);
     114}
     115
     116QString UINotificationProgressMachineCopy::name() const
     117{
     118    return UINotificationProgress::tr("Copying machine ...");
     119}
     120
     121QString UINotificationProgressMachineCopy::details() const
     122{
     123    return UINotificationProgress::tr("<b>From:</b> %1<br><b>To:</b> %2")
     124                                     .arg(m_comSource.GetName(), m_comTarget.GetName());
     125}
     126
     127CProgress UINotificationProgressMachineCopy::createProgress(COMResult &comResult)
     128{
     129    /* Initialize progress-wrapper: */
     130    CProgress comProgress = m_comSource.CloneTo(m_comTarget, m_enmCloneMode, m_options);
     131    /* Store COM result: */
     132    comResult = m_comSource;
     133    /* Return progress-wrapper: */
     134    return comProgress;
     135}
     136
     137void UINotificationProgressMachineCopy::sltHandleProgressFinished()
     138{
     139    if (m_comTarget.isNotNull() && !m_comTarget.GetId().isNull())
     140        emit sigMachineCopied(m_comTarget);
     141}
     142
     143
     144/*********************************************************************************************************************************
    100145*   Class UINotificationProgressCloudMachineAdd implementation.                                                                  *
    101146*********************************************************************************************************************************/
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90321 r90325  
    2929#include "CCloudClient.h"
    3030#include "CCloudMachine.h"
     31#include "CMachine.h"
    3132#include "CMedium.h"
    3233#include "CVirtualSystemDescription.h"
     
    108109    /** Holds the target medium options. */
    109110    QVector<KMediumVariant>  m_variants;
     111};
     112
     113/** UINotificationProgress extension for machine copy functionality. */
     114class SHARED_LIBRARY_STUFF UINotificationProgressMachineCopy : public UINotificationProgress
     115{
     116    Q_OBJECT;
     117
     118signals:
     119
     120    /** Notifies listeners about @a comMachine was copied. */
     121    void sigMachineCopied(const CMachine &comMachine);
     122
     123public:
     124
     125    /** Constructs medium move notification-progress.
     126      * @param  comSource     Brings the machine being copied.
     127      * @param  comTarget     Brings the machine being the target.
     128      * @param  enmCloneMode  Brings the cloning mode.
     129      * @param  options       Brings the cloning options. */
     130    UINotificationProgressMachineCopy(const CMachine &comSource,
     131                                      const CMachine &comTarget,
     132                                      const KCloneMode &enmCloneMode,
     133                                      const QVector<KCloneOptions> &options);
     134
     135protected:
     136
     137    /** Returns object name. */
     138    virtual QString name() const /* override final */;
     139    /** Returns object details. */
     140    virtual QString details() const /* override final */;
     141    /** Creates and returns started progress-wrapper. */
     142    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     143
     144private slots:
     145
     146    /** Handles signal about progress being finished. */
     147    void sltHandleProgressFinished();
     148
     149private:
     150
     151    /** Holds the machine being copied. */
     152    CMachine                m_comSource;
     153    /** Holds the machine being the target. */
     154    CMachine                m_comTarget;
     155    /** Holds the machine cloning mode. */
     156    KCloneMode              m_enmCloneMode;
     157    /** Holds the target machine options. */
     158    QVector<KCloneOptions>  m_options;
    110159};
    111160
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp

    r88446 r90325  
    1717
    1818/* GUI includes: */
     19#include "UICommon.h"
     20#include "UIMessageCenter.h"
     21#include "UINotificationCenter.h"
    1922#include "UIWizardCloneVM.h"
    2023#include "UIWizardCloneVMPageBasic1.h"
     
    2225#include "UIWizardCloneVMPageBasic3.h"
    2326#include "UIWizardCloneVMPageExpert.h"
    24 #include "UICommon.h"
    25 #include "UIMessageCenter.h"
    2627
    2728/* COM includes: */
     
    147148        options.append(KCloneOptions_Link);
    148149
    149     /* Start cloning. */
    150     CProgress progress = srcMachine.CloneTo(cloneMachine, cloneMode, options);
    151     if (!srcMachine.isOk())
    152     {
    153         msgCenter().cannotCreateClone(srcMachine, this);
    154         return false;
    155     }
    156 
    157     /* Wait until done. */
    158     msgCenter().showModalProgressDialog(progress, windowTitle(), ":/progress_clone_90px.png", this);
    159     if (progress.GetCanceled())
    160         return false;
    161     if (!progress.isOk() || progress.GetResultCode() != 0)
    162     {
    163         msgCenter().cannotCreateClone(progress, srcMachine.GetName(), this);
    164         return false;
    165     }
    166 
    167     /* Finally register the clone machine. */
    168     vbox.RegisterMachine(cloneMachine);
    169     if (!vbox.isOk())
    170     {
    171         msgCenter().cannotRegisterMachine(vbox, cloneMachine.GetName(), this);
    172         return false;
    173     }
     150    /* Clone VM: */
     151    UINotificationProgressMachineCopy *pNotification = new UINotificationProgressMachineCopy(srcMachine,
     152                                                                                             cloneMachine,
     153                                                                                             cloneMode,
     154                                                                                             options);
     155    connect(pNotification, &UINotificationProgressMachineCopy::sigMachineCopied,
     156            &uiCommon(), &UICommon::sltHandleMachineCreated);
     157    notificationCenter().append(pNotification);
    174158
    175159    return true;
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