VirtualBox

Changeset 90334 in vbox for trunk/src


Ignore:
Timestamp:
Jul 26, 2021 1:07:24 PM (4 years ago)
Author:
vboxsync
Message:

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

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

Legend:

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

    r90327 r90334  
    286286        emit sigCloudMachineCreated(m_strShortProviderName, m_strProfileName, m_comMachine);
    287287}
     288
     289
     290/*********************************************************************************************************************************
     291*   Class UINotificationProgressApplianceImport implementation.                                                                  *
     292*********************************************************************************************************************************/
     293
     294UINotificationProgressApplianceImport::UINotificationProgressApplianceImport(const CAppliance &comAppliance,
     295                                                                             const QVector<KImportOptions> &options)
     296    : m_comAppliance(comAppliance)
     297    , m_options(options)
     298{
     299}
     300
     301QString UINotificationProgressApplianceImport::name() const
     302{
     303    return UINotificationProgress::tr("Importing appliance ...");
     304}
     305
     306QString UINotificationProgressApplianceImport::details() const
     307{
     308    return UINotificationProgress::tr("<b>From:</b> %1").arg(m_comAppliance.GetPath());
     309}
     310
     311CProgress UINotificationProgressApplianceImport::createProgress(COMResult &comResult)
     312{
     313    /* Initialize progress-wrapper: */
     314    CProgress comProgress = m_comAppliance.ImportMachines(m_options);
     315    /* Store COM result: */
     316    comResult = m_comAppliance;
     317    /* Return progress-wrapper: */
     318    return comProgress;
     319}
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r90327 r90334  
    2727/* COM includes: */
    2828#include "COMEnums.h"
     29#include "CAppliance.h"
    2930#include "CCloudClient.h"
    3031#include "CCloudMachine.h"
     
    317318};
    318319
     320/** UINotificationProgress extension for import appliance functionality. */
     321class SHARED_LIBRARY_STUFF UINotificationProgressApplianceImport : public UINotificationProgress
     322{
     323    Q_OBJECT;
     324
     325public:
     326
     327    /** Constructs import appliance notification-progress.
     328      * @param  comAppliance  Brings the appliance being imported.
     329      * @param  options       Brings the import options to be taken into account. */
     330    UINotificationProgressApplianceImport(const CAppliance &comAppliance,
     331                                          const QVector<KImportOptions> &options);
     332
     333protected:
     334
     335    /** Returns object name. */
     336    virtual QString name() const /* override final */;
     337    /** Returns object details. */
     338    virtual QString details() const /* override final */;
     339    /** Creates and returns started progress-wrapper. */
     340    virtual CProgress createProgress(COMResult &comResult) /* override final */;
     341
     342private:
     343
     344    /** Holds the medium being moved. */
     345    CAppliance               m_comAppliance;
     346    /** Holds the initial location. */
     347    QVector<KImportOptions>  m_options;
     348};
     349
    319350#endif /* !FEQT_INCLUDED_SRC_notificationcenter_UINotificationObjects_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp

    r82968 r90334  
    2626#include "QITreeView.h"
    2727#include "UIApplianceImportEditorWidget.h"
     28#include "UICommon.h"
    2829#include "UIFilePathSelector.h"
    2930#include "UIMessageCenter.h"
     31#include "UINotificationCenter.h"
    3032#include "UIWizardImportApp.h"
    31 #include "UICommon.h"
    3233
    3334/* COM includes: */
     
    248249    if (m_pAppliance)
    249250    {
    250         /* Start the import asynchronously */
    251         CProgress progress;
     251        /* Configure appliance importing: */
    252252        QVector<KImportOptions> options;
    253253        if (m_pMACComboBox)
     
    266266            }
    267267        }
    268 
    269268        if (m_pImportHDsAsVDI->isChecked())
    270269            options.append(KImportOptions_ImportToVDI);
    271         progress = m_pAppliance->ImportMachines(options);
    272         bool fResult = m_pAppliance->isOk();
    273         if (fResult)
    274         {
    275             /* Show some progress, so the user know whats going on */
    276             msgCenter().showModalProgressDialog(progress, tr("Importing Appliance ..."), ":/progress_import_90px.png", this);
    277             if (progress.GetCanceled())
    278                 return false;
    279             if (!progress.isOk() || progress.GetResultCode() != 0)
    280             {
    281                 msgCenter().cannotImportAppliance(progress, m_pAppliance->GetPath(), this);
    282                 return false;
    283             }
    284             else
    285                 return true;
    286         }
    287         if (!fResult)
    288             msgCenter().cannotImportAppliance(*m_pAppliance, this);
     270
     271        /* Import appliance: */
     272        UINotificationProgressApplianceImport *pNotification = new UINotificationProgressApplianceImport(*m_pAppliance,
     273                                                                                                         options);
     274        notificationCenter().append(pNotification);
     275
     276        /* Positive: */
     277        return true;
    289278    }
    290279    return false;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp

    r86986 r90334  
    3131#include "UICommon.h"
    3232#include "UIMessageCenter.h"
     33#include "UINotificationCenter.h"
    3334#include "UIWizardImportApp.h"
    3435#include "UIWizardImportAppPageBasic1.h"
     
    209210        QVector<KImportOptions> options;
    210211
    211         /* Initiate import porocedure: */
    212         CProgress comProgress = comAppliance.ImportMachines(options);
    213 
    214         /* Show error message if necessary: */
    215         if (!comAppliance.isOk())
    216             msgCenter().cannotImportAppliance(comAppliance, this);
    217         else
    218         {
    219             /* Show "Import appliance" progress: */
    220             msgCenter().showModalProgressDialog(comProgress, tr("Importing Appliance ..."), ":/progress_import_90px.png", this, 0);
    221             if (!comProgress.GetCanceled())
    222             {
    223                 /* Show error message if necessary: */
    224                 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    225                     msgCenter().cannotImportAppliance(comProgress, comAppliance.GetPath(), this);
    226                 else
    227                     return true;
    228             }
    229         }
    230 
    231         /* Failure by default: */
    232         return false;
     212        /* Import appliance: */
     213        UINotificationProgressApplianceImport *pNotification = new UINotificationProgressApplianceImport(comAppliance,
     214                                                                                                         options);
     215        notificationCenter().append(pNotification);
     216
     217        /* Positive: */
     218        return true;
    233219    }
    234220    else
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