VirtualBox

Changeset 90344 in vbox for trunk/src


Ignore:
Timestamp:
Jul 26, 2021 6:26:53 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145908
Message:

FE/Qt: bugref:10067: Notification signature for final Export Appliance wizard progress which should now go to center instead of modal dialog; This code covers local exporting only for now, cloud exporting to go later.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r90334 r90344  
    289289
    290290/*********************************************************************************************************************************
     291*   Class UINotificationProgressApplianceExport implementation.                                                                  *
     292*********************************************************************************************************************************/
     293
     294UINotificationProgressApplianceExport::UINotificationProgressApplianceExport(const CAppliance &comAppliance,
     295                                                                             const QString &strFormat,
     296                                                                             const QVector<KExportOptions> &options,
     297                                                                             const QString &strPath)
     298    : m_comAppliance(comAppliance)
     299    , m_strFormat(strFormat)
     300    , m_options(options)
     301    , m_strPath(strPath)
     302{
     303}
     304
     305QString UINotificationProgressApplianceExport::name() const
     306{
     307    return UINotificationProgress::tr("Exporting appliance ...");
     308}
     309
     310QString UINotificationProgressApplianceExport::details() const
     311{
     312    return UINotificationProgress::tr("<b>To:</b> %1").arg(m_strPath);
     313}
     314
     315CProgress UINotificationProgressApplianceExport::createProgress(COMResult &comResult)
     316{
     317    /* Initialize progress-wrapper: */
     318    CProgress comProgress = m_comAppliance.Write(m_strFormat, m_options, m_strPath);
     319    /* Store COM result: */
     320    comResult = m_comAppliance;
     321    /* Return progress-wrapper: */
     322    return comProgress;
     323}
     324
     325
     326/*********************************************************************************************************************************
    291327*   Class UINotificationProgressApplianceImport implementation.                                                                  *
    292328*********************************************************************************************************************************/
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90334 r90344  
    318318};
    319319
     320/** UINotificationProgress extension for export appliance functionality. */
     321class SHARED_LIBRARY_STUFF UINotificationProgressApplianceExport : public UINotificationProgress
     322{
     323    Q_OBJECT;
     324
     325public:
     326
     327    /** Constructs export appliance notification-progress.
     328      * @param  comAppliance  Brings the appliance being exported.
     329      * @param  strFormat     Brings the appliance format.
     330      * @param  options       Brings the export options to be taken into account.
     331      * @param  strPath       Brings the appliance path. */
     332    UINotificationProgressApplianceExport(const CAppliance &comAppliance,
     333                                          const QString &strFormat,
     334                                          const QVector<KExportOptions> &options,
     335                                          const QString &strPath);
     336
     337protected:
     338
     339    /** Returns object name. */
     340    virtual QString name() const /* override final */;
     341    /** Returns object details. */
     342    virtual QString details() const /* override final */;
     343    /** Creates and returns started progress-wrapper. */
     344    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     345
     346private:
     347
     348    /** Holds the appliance being exported. */
     349    CAppliance               m_comAppliance;
     350    /** Holds the appliance format. */
     351    QString                  m_strFormat;
     352    /** Holds the export options to be taken into account. */
     353    QVector<KExportOptions>  m_options;
     354    /** Holds the appliance path. */
     355    QString                  m_strPath;
     356};
     357
    320358/** UINotificationProgress extension for import appliance functionality. */
    321359class SHARED_LIBRARY_STUFF UINotificationProgressApplianceImport : public UINotificationProgress
     
    342380private:
    343381
    344     /** Holds the medium being moved. */
     382    /** Holds the appliance being imported. */
    345383    CAppliance               m_comAppliance;
    346     /** Holds the initial location. */
     384    /** Holds the import options to be taken into account. */
    347385    QVector<KImportOptions>  m_options;
    348386};
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp

    r89979 r90344  
    2525#include "UIMessageCenter.h"
    2626#include "UIModalWindowManager.h"
     27#include "UINotificationCenter.h"
    2728#include "UIWizardExportApp.h"
    2829#include "UIWizardExportAppDefs.h"
     
    349350            if (iWizardResult == QDialog::Rejected)
    350351                break;
    351         }
    352 
    353         /* Prepare Export VM progress: */
    354         CProgress comProgress = comAppliance.Write(field("format").toString(), options, uri());
    355         if (!comAppliance.isOk())
    356         {
    357             msgCenter().cannotExportAppliance(comAppliance, this);
    358             break;
    359         }
    360 
    361         /* Show Export VM progress: */
    362         msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Exporting Appliance ..."),
    363                                             ":/progress_export_90px.png", this);
    364         if (comProgress.GetCanceled())
    365             break;
    366         if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    367         {
    368             msgCenter().cannotExportAppliance(comProgress, comAppliance.GetPath(), this);
    369             break;
    370         }
    371 
    372         /* Is this VM being exported to cloud? */
    373         if (field("isFormatCloudOne").toBool())
    374         {
     352
     353            /* Prepare Export VM progress: */
     354            CProgress comProgress = comAppliance.Write(field("format").toString(), options, uri());
     355            if (!comAppliance.isOk())
     356            {
     357                msgCenter().cannotExportAppliance(comAppliance, this);
     358                break;
     359            }
     360
     361            /* Show Export VM progress: */
     362            msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Exporting Appliance ..."),
     363                                                ":/progress_export_90px.png", this);
     364            if (comProgress.GetCanceled())
     365                break;
     366            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     367            {
     368                msgCenter().cannotExportAppliance(comProgress, comAppliance.GetPath(), this);
     369                break;
     370            }
     371
    375372            /* We can have wizard and it's result
    376373             * should be distinguishable: */
    377             int iWizardResult = -1;
     374            iWizardResult = -1;
    378375
    379376            switch (field("cloudExportMode").value<CloudExportMode>())
     
    410407                break;
    411408        }
     409        /* Is this VM being exported locally? */
     410        else
     411        {
     412            /* Export appliance: */
     413            UINotificationProgressApplianceExport *pNotification = new UINotificationProgressApplianceExport(comAppliance,
     414                                                                                                             field("format").toString(),
     415                                                                                                             options,
     416                                                                                                             uri());
     417            notificationCenter().append(pNotification);
     418        }
    412419
    413420        /* Success finally: */
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