VirtualBox

Changeset 92106 in vbox for trunk


Ignore:
Timestamp:
Oct 27, 2021 2:01:36 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996. Replace the macro we use to check unattended install setup with a function.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r91664 r92106  
    9595#include <VBox/version.h>
    9696
    97 #define checkUnattendedInstallError(comUnattendedInstaller) \
    98     do { \
    99         if (!comUnattendedInstaller.isOk())      \
    100         { \
    101         COMErrorInfo comErrorInfo =  comUnattendedInstaller.errorInfo(); \
    102         QString strErrorInfo = UIErrorString::formatErrorInfo(comErrorInfo); \
    103         msgCenter().cannotRunUnattendedGuestInstall(comUnattendedInstaller); \
    104         return; \
    105         } \
    106     } while (0)
    107 
    108 
    10997/** QDialog extension used to ask for a public key for console connection needs. */
    11098class UIAcquirePublicKeyDialog : public QIWithRetranslateUI<QDialog>
     
    24312419}
    24322420
     2421bool UIVirtualBoxManager::checkUnattendedInstallError(CUnattended &comUnattendedInstaller) const
     2422{
     2423    if (!comUnattendedInstaller.isOk())
     2424    {
     2425        COMErrorInfo comErrorInfo =  comUnattendedInstaller.errorInfo();
     2426        QString strErrorInfo = UIErrorString::formatErrorInfo(comErrorInfo);
     2427        msgCenter().cannotRunUnattendedGuestInstall(comUnattendedInstaller);
     2428        return false;
     2429    }
     2430    return true;
     2431}
     2432
    24332433void UIVirtualBoxManager::openAddMachineDialog(const QString &strFileName /* = QString() */)
    24342434{
     
    25422542
    25432543    comUnattendedInstaller.SetIsoPath(unattendedData.m_strISOPath);
    2544     checkUnattendedInstallError(comUnattendedInstaller);
     2544    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25452545    comUnattendedInstaller.SetMachine(comMachine);
    2546     checkUnattendedInstallError(comUnattendedInstaller);
     2546    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25472547    comUnattendedInstaller.SetUser(unattendedData.m_strUserName);
    2548     checkUnattendedInstallError(comUnattendedInstaller);
     2548    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25492549    comUnattendedInstaller.SetPassword(unattendedData.m_strPassword);
    2550     checkUnattendedInstallError(comUnattendedInstaller);
     2550    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25512551    comUnattendedInstaller.SetHostname(unattendedData.m_strHostnameDomainName);
    2552     checkUnattendedInstallError(comUnattendedInstaller);
     2552    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25532553    comUnattendedInstaller.SetProductKey(unattendedData.m_strProductKey);
    2554     checkUnattendedInstallError(comUnattendedInstaller);
     2554    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25552555    comUnattendedInstaller.SetInstallGuestAdditions(unattendedData.m_fInstallGuestAdditions);
    2556     checkUnattendedInstallError(comUnattendedInstaller);
     2556    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25572557    comUnattendedInstaller.SetAdditionsIsoPath(unattendedData.m_strGuestAdditionsISOPath);
    25582558
    25592559    comUnattendedInstaller.Prepare();
    2560     checkUnattendedInstallError(comUnattendedInstaller);
     2560    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25612561    comUnattendedInstaller.ConstructMedia();
    2562     checkUnattendedInstallError(comUnattendedInstaller);
     2562    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25632563    comUnattendedInstaller.ReconfigureVM();
    2564     checkUnattendedInstallError(comUnattendedInstaller);
     2564    AssertReturnVoid(checkUnattendedInstallError(comUnattendedInstaller));
    25652565
    25662566    UICommon::LaunchMode enmLaunchMode = UICommon::LaunchMode_Default;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h

    r91001 r92106  
    4141class UIVirtualMachineItem;
    4242class CCloudMachine;
     43class CUnattended;
    4344
    4445/* Type definitions: */
     
    353354        /** Returns whether at least one cloud profile currently being updated. */
    354355        bool isCloudProfileUpdateInProgress() const;
     356
     357        /* Checks if @p comUnattendedInstaller has any errors. If so shows an error message and return false, else returns true. */
     358        bool checkUnattendedInstallError(CUnattended &comUnattendedInstaller) const;
    355359    /** @} */
    356360
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