VirtualBox

Changeset 92089 in vbox for trunk/src


Ignore:
Timestamp:
Oct 26, 2021 5:02:00 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10067: UIWizardExportApp: Migrate a lot of UIMessageCenter stuff to UINotificationCenter.

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

Legend:

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

    r91359 r92089  
    22142214}
    22152215
    2216 bool UIMessageCenter::cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const
    2217 {
    2218     error(pParent, MessageType_Error,
    2219           tr("Failed to check files."),
    2220           UIErrorString::formatErrorInfo(comAppliance));
    2221     return false;
    2222 }
    2223 
    2224 bool UIMessageCenter::cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const
    2225 {
    2226     error(pParent, MessageType_Error,
    2227           tr("Failed to check files."),
    2228           UIErrorString::formatErrorInfo(comVFSExplorer));
    2229     return false;
    2230 }
    2231 
    2232 bool UIMessageCenter::cannotCheckFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
    2233 {
    2234     error(pParent, MessageType_Error,
    2235           tr("Failed to check files."),
    2236           UIErrorString::formatErrorInfo(comProgress));
    2237     return false;
    2238 }
    2239 
    22402216bool UIMessageCenter::cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const
    22412217{
     
    22662242                          0 /* auto-confirm id */,
    22672243                          tr("Continue"));
    2268 }
    2269 
    2270 bool UIMessageCenter::cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const
    2271 {
    2272     error(pParent, MessageType_Error,
    2273           tr("Failed to prepare the export of the appliance <b>%1</b>.")
    2274              .arg(CAppliance(comAppliance).GetPath()),
    2275           UIErrorString::formatErrorInfo(comAppliance));
    2276     return false;
    2277 }
    2278 
    2279 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0 */) const
    2280 {
    2281     error(pParent, MessageType_Error,
    2282           tr("Failed to prepare the export of the appliance <b>%1</b>.")
    2283              .arg(strPath),
    2284           UIErrorString::formatErrorInfo(machine));
    2285 }
    2286 
    2287 bool UIMessageCenter::cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent /* = 0 */) const
    2288 {
    2289     error(pParent, MessageType_Error,
    2290           tr("Failed to export appliance <b>%1</b>.")
    2291              .arg(strPath),
    2292           UIErrorString::formatErrorInfo(comProgress));
    2293     return false;
    2294 }
    2295 
    2296 bool UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent /* = 0 */)
    2297 {
    2298     error(pParent, MessageType_Error,
    2299           tr("Bad password or authentication failure."),
    2300           UIErrorString::formatErrorInfo(comAppliance));
    2301     return false;
    23022244}
    23032245
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r91219 r92089  
    480480        void cannotImportAppliance(CAppliance &appliance, QWidget *pParent = 0) const;
    481481        void cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const;
    482         bool cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent = 0) const;
    483         bool cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent = 0) const;
    484         bool cannotCheckFiles(const CProgress &comProgress, QWidget *pParent = 0) const;
    485482        bool cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent = 0) const;
    486483        bool cannotRemoveFiles(const CProgress &comProgress, QWidget *pParent = 0) const;
    487484        bool confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent = 0) const;
    488         bool cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent = 0) const;
    489         void cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent = 0) const;
    490         bool cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent = 0) const;
    491         bool cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent = 0);
    492485        void cannotRunUnattendedGuestInstall(const CUnattended &comUnattendedInstall, QWidget *pParent = 0);
    493486        bool confirmOverridingFile(const QString &strPath, QWidget *pParent = 0) const;
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r92086 r92089  
    631631/* static */
    632632void UINotificationMessage::cannotAcquireVirtualSystemDescriptionFormParameter(const CVirtualSystemDescriptionForm &comVsdForm,
    633                                                                                UINotificationCenter *pParent)
     633                                                                               UINotificationCenter *pParent /* = 0 */)
    634634{
    635635    createMessage(
     
    725725/* static */
    726726void UINotificationMessage::cannotChangeVirtualSystemDescriptionParameter(const CVirtualSystemDescription &comVsd,
    727                                                                           UINotificationCenter *pParent)
     727                                                                          UINotificationCenter *pParent /* = 0 */)
    728728{
    729729    createMessage(
     
    797797
    798798/* static */
     799void UINotificationMessage::cannotCreateAppliance(const CVirtualBox &comVBox,
     800                                                  UINotificationCenter *pParent /* = 0 */)
     801{
     802    createMessage(
     803        QApplication::translate("UIMessageCenter", "Can't create appliance ..."),
     804        QApplication::translate("UIMessageCenter", "Failed to create appliance.") +
     805        UIErrorString::formatErrorInfo(comVBox),
     806        QString(), QString(), pParent);
     807}
     808
     809/* static */
     810void UINotificationMessage::cannotFindMachineById(const CVirtualBox &comVBox,
     811                                                  const QUuid &uMachineId,
     812                                                  UINotificationCenter *pParent /* = 0 */)
     813{
     814    createMessage(
     815        QApplication::translate("UIMessageCenter", "Can't find machine ..."),
     816        QApplication::translate("UIMessageCenter", "Failed to find the machine with following ID: <nobr><b>%1</b></nobr>.")
     817                                                   .arg(uMachineId.toString()) +
     818        UIErrorString::formatErrorInfo(comVBox),
     819        QString(), QString(), pParent);
     820}
     821
     822/* static */
    799823void UINotificationMessage::cannotOpenKnownMedium(const CVirtualBox &comVBox, const QUuid &uMediumId)
    800824{
     
    826850
    827851/* static */
     852void UINotificationMessage::cannotCreateVfsExplorer(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
     853{
     854    createMessage(
     855        QApplication::translate("UIMessageCenter", "Can't create VFS explorer ..."),
     856        QApplication::translate("UIMessageCenter", "Failed to create VFS explorer to check files.") +
     857        UIErrorString::formatErrorInfo(comAppliance),
     858        QString(), QString(), pParent);
     859}
     860
     861/* static */
     862void UINotificationMessage::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, UINotificationCenter *pParent /* = 0 */)
     863{
     864    createMessage(
     865        QApplication::translate("UIMessageCenter", "Bad password ..."),
     866        QApplication::translate("UIMessageCenter", "Bad password or authentication failure.") +
     867        UIErrorString::formatErrorInfo(comAppliance),
     868        QString(), QString(), pParent);
     869}
     870
     871/* static */
    828872void UINotificationMessage::cannotOpenExtPack(const CExtPackManager &comExtPackManager, const QString &strFilename)
    829873{
     
    9851029        QApplication::translate("UIMessageCenter", "Can't remove machine ..."),
    9861030        QApplication::translate("UIMessageCenter", "Failed to remove the virtual machine <b>%1</b>.")
     1031                                                   .arg(CMachine(comMachine).GetName()) +
     1032        UIErrorString::formatErrorInfo(comMachine),
     1033        QString(), QString(), pParent);
     1034}
     1035
     1036/* static */
     1037void UINotificationMessage::cannotExportMachine(const CMachine &comMachine, UINotificationCenter *pParent /* = 0 */)
     1038{
     1039    createMessage(
     1040        QApplication::translate("UIMessageCenter", "Can't export machine ..."),
     1041        QApplication::translate("UIMessageCenter", "Failed to export virtual machine <b>%1</b>.")
    9871042                                                   .arg(CMachine(comMachine).GetName()) +
    9881043        UIErrorString::formatErrorInfo(comMachine),
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r92086 r92089  
    266266          * @param  comVsdForm  Brings the object parameter get acquired from. */
    267267        static void cannotAcquireVirtualSystemDescriptionFormParameter(const CVirtualSystemDescriptionForm &comVsdForm,
    268                                                                        UINotificationCenter *pParent);
     268                                                                       UINotificationCenter *pParent = 0);
    269269
    270270        /** Notifies about inability to change IMedium parameter.
     
    298298          * @param  comVsd  Brings the object parameter being changed for. */
    299299        static void cannotChangeVirtualSystemDescriptionParameter(const CVirtualSystemDescription &comVsd,
    300                                                                   UINotificationCenter *pParent);
     300                                                                  UINotificationCenter *pParent = 0);
    301301
    302302        /** Notifies about inability to enumerate host USB devices.
     
    321321    /** @name COM VirtualBox Manager warnings.
    322322      * @{ */
     323        /** Notifies about inability to create appliance.
     324          * @param  comVBox  Brings common VBox object trying to create appliance. */
     325        static void cannotCreateAppliance(const CVirtualBox &comVBox, UINotificationCenter *pParent = 0);
     326        /** Notifies about inability to find machine by ID.
     327          * @param  comVBox     Brings common VBox object trying to find machine.
     328          * @param  uMachineId  Brings the machine ID. */
     329        static void cannotFindMachineById(const CVirtualBox &comVBox,
     330                                          const QUuid &uMachineId,
     331                                          UINotificationCenter *pParent = 0);
    323332        /** Notifies about inability to open known medium.
    324333          * @param  comVBox    Brings common VBox object trying to open medium.
     
    332341          * @param  comVBox      Brings common VBox object trying to open machine. */
    333342        static void cannotGetExtensionPackManager(const CVirtualBox &comVBox);
     343
     344        /** Notifies about inability to create VFS explorer.
     345          * @param  comAppliance  Brings appliance trying to create VFS explorer. */
     346        static void cannotCreateVfsExplorer(const CAppliance &comAppliance, UINotificationCenter *pParent = 0);
     347        /** Notifies about inability to add disk scryption password.
     348          * @param  comAppliance  Brings appliance trying to add disk scryption password. */
     349        static void cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, UINotificationCenter *pParent = 0);
    334350
    335351        /** Notifies about inability to open extension pack.
     
    395411          * @param  comMachine  Brings machine being removed. */
    396412        static void cannotRemoveMachine(const CMachine &comMachine, UINotificationCenter *pParent = 0);
     413        /** Notifies about inability to export appliance.
     414          * @param  comMachine  Brings machine trying to export appliance. */
     415        static void cannotExportMachine(const CMachine &comMachine, UINotificationCenter *pParent = 0);
    397416
    398417        /** Notifies about inability to find snapshot by ID.
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp

    r92024 r92089  
    144144        CVFSExplorer comExplorer = comAppliance.CreateVFSExplorer(uri(false /* fWithFile */));
    145145        if (!comAppliance.isOk())
    146             return msgCenter().cannotCheckFiles(comAppliance, this);
     146        {
     147            UINotificationMessage::cannotCreateVfsExplorer(comAppliance, notificationCenter());
     148            return false;
     149        }
    147150
    148151        /* Update VFS explorer: */
     
    287290        if (!comAppliance.isOk())
    288291        {
    289             msgCenter().cannotAddDiskEncryptionPassword(comAppliance);
     292            UINotificationMessage::cannotAddDiskEncryptionPassword(comAppliance, notificationCenter());
    290293            return false;
    291294        }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp

    r91707 r92089  
    4040#include "UIIconPool.h"
    4141#include "UIMessageCenter.h"
     42#include "UINotificationCenter.h"
    4243#include "UIToolBox.h"
    4344#include "UIVirtualBoxEventHandler.h"
     
    604605            fResult = comForm.isOk();
    605606            if (!fResult)
    606                 msgCenter().cannotAcquireVirtualSystemDescriptionFormProperty(comForm);
     607                UINotificationMessage::cannotAcquireVirtualSystemDescriptionFormParameter(comForm, wizard()->notificationCenter());
    607608        }
    608609
     
    790791    /* Create appliance: */
    791792    CAppliance comAppliance;
    792     refreshLocalStuff(comAppliance, wizard()->machineIDs(), wizard()->uri());
     793    refreshLocalStuff(comAppliance, wizard(), wizard()->machineIDs(), wizard()->uri());
    793794    wizard()->setLocalAppliance(comAppliance);
    794795}
     
    805806                      comDescription,
    806807                      comForm,
     808                      wizard(),
    807809                      m_comCloudProfile,
    808810                      wizard()->machineIDs(),
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageFormat.cpp

    r91707 r92089  
    3434#include "UIEmptyFilePathSelector.h"
    3535#include "UIIconPool.h"
    36 #include "UIMessageCenter.h"
     36#include "UINotificationCenter.h"
    3737#include "UIVirtualBoxEventHandler.h"
    3838#include "UIVirtualBoxManager.h"
     
    325325
    326326void UIWizardExportAppFormat::refreshLocalStuff(CAppliance &comLocalAppliance,
     327                                                UIWizardExportApp *pWizard,
    327328                                                const QList<QUuid> &machineIDs,
    328329                                                const QString &strUri)
     
    335336    CAppliance comAppliance = comVBox.CreateAppliance();
    336337    if (!comVBox.isOk())
    337     {
    338         msgCenter().cannotCreateAppliance(comVBox);
    339         return;
    340     }
     338        return UINotificationMessage::cannotCreateAppliance(comVBox, pWizard->notificationCenter());
    341339
    342340    /* Remember appliance: */
     
    350348        CMachine comMachine = comVBox.FindMachine(uMachineId.toString());
    351349        if (!comVBox.isOk())
    352             return msgCenter().cannotFindMachineById(comVBox, uMachineId);
     350            return UINotificationMessage::cannotFindMachineById(comVBox, uMachineId, pWizard->notificationCenter());
    353351        /* Add the export description to our appliance object: */
    354352        CVirtualSystemDescription comVsd = comMachine.ExportTo(comLocalAppliance, strUri);
    355353        if (!comMachine.isOk())
    356             return msgCenter().cannotExportAppliance(comMachine, comLocalAppliance.GetPath());
     354            return UINotificationMessage::cannotExportMachine(comMachine, pWizard->notificationCenter());
    357355        /* Add some additional fields the user may change: */
    358356        comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", "");
     
    478476                                                CVirtualSystemDescription &comCloudVsd,
    479477                                                CVirtualSystemDescriptionForm &comCloudVsdExportForm,
     478                                                UIWizardExportApp *pWizard,
    480479                                                const CCloudProfile &comCloudProfile,
    481480                                                const QList<QUuid> &machineIDs,
     
    502501    CMachine comMachine = comVBox.FindMachine(uMachineId.toString());
    503502    if (!comVBox.isOk())
    504     {
    505         msgCenter().cannotFindMachineById(comVBox, uMachineId);
    506         return;
    507     }
     503        return UINotificationMessage::cannotFindMachineById(comVBox, uMachineId, pWizard->notificationCenter());
    508504
    509505    /* Create appliance: */
    510506    CAppliance comAppliance = comVBox.CreateAppliance();
    511507    if (!comVBox.isOk())
    512     {
    513         msgCenter().cannotCreateAppliance(comVBox);
    514         return;
    515     }
     508        return UINotificationMessage::cannotCreateAppliance(comVBox, pWizard->notificationCenter());
    516509
    517510    /* Remember appliance: */
     
    521514    CVirtualSystemDescription comVsd = comMachine.ExportTo(comCloudAppliance, strUri);
    522515    if (!comMachine.isOk())
    523     {
    524         msgCenter().cannotExportAppliance(comMachine, comCloudAppliance.GetPath());
    525         return;
    526     }
     516        return UINotificationMessage::cannotExportMachine(comMachine, pWizard->notificationCenter());
    527517
    528518    /* Remember description: */
     
    541531    }
    542532    if (!comCloudVsd.isOk())
    543     {
    544         msgCenter().cannotAddVirtualSystemDescriptionValue(comCloudVsd);
    545         return;
    546     }
     533        return UINotificationMessage::cannotChangeVirtualSystemDescriptionParameter(comCloudVsd, pWizard->notificationCenter());
    547534
    548535    /* Create Cloud Client: */
     
    11561143    /* Create appliance: */
    11571144    CAppliance comAppliance;
    1158     refreshLocalStuff(comAppliance, wizard()->machineIDs(), wizard()->uri());
     1145    refreshLocalStuff(comAppliance, wizard(), wizard()->machineIDs(), wizard()->uri());
    11591146    wizard()->setLocalAppliance(comAppliance);
    11601147}
     
    11711158                      comDescription,
    11721159                      comForm,
     1160                      wizard(),
    11731161                      m_comCloudProfile,
    11741162                      wizard()->machineIDs(),
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageFormat.h

    r91707 r92089  
    9999    /** Refresh local stuff. */
    100100    void refreshLocalStuff(CAppliance &comLocalAppliance,
     101                           UIWizardExportApp *pWizard,
    101102                           const QList<QUuid> &machineIDs,
    102103                           const QString &strUri);
     
    119120                           CVirtualSystemDescription &comCloudVsd,
    120121                           CVirtualSystemDescriptionForm &comCloudVsdExportForm,
     122                           UIWizardExportApp *pWizard,
    121123                           const CCloudProfile &comCloudProfile,
    122124                           const QList<QUuid> &machineIDs,
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageSettings.cpp

    r91707 r92089  
    2626#include "UICommon.h"
    2727#include "UIFormEditorWidget.h"
    28 #include "UIMessageCenter.h"
     28#include "UINotificationCenter.h"
    2929#include "UIWizardExportApp.h"
    3030#include "UIWizardExportAppPageSettings.h"
     
    223223            fResult = comForm.isOk();
    224224            if (!fResult)
    225                 msgCenter().cannotAcquireVirtualSystemDescriptionFormProperty(comForm);
     225                UINotificationMessage::cannotAcquireVirtualSystemDescriptionFormParameter(comForm, wizard()->notificationCenter());
    226226        }
    227227
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