VirtualBox

Changeset 69197 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 24, 2017 10:19:03 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9025: Refactoring for clone VD wizard.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp

    r69187 r69197  
    3939
    4040
    41 UIWizardCloneVD::UIWizardCloneVD(QWidget *pParent, const CMedium &sourceVirtualDisk)
     41UIWizardCloneVD::UIWizardCloneVD(QWidget *pParent, const CMedium &comSourceVirtualDisk)
    4242    : UIWizard(pParent, WizardType_CloneVD)
    43     , m_sourceVirtualDisk(sourceVirtualDisk)
     43    , m_comSourceVirtualDisk(comSourceVirtualDisk)
    4444{
    4545#ifndef VBOX_WS_MAC
     
    5555{
    5656    /* Gather attributes: */
    57     CMedium sourceVirtualDisk = field("sourceVirtualDisk").value<CMedium>();
    58     CMediumFormat mediumFormat = field("mediumFormat").value<CMediumFormat>();
     57    CMedium comSourceVirtualDisk = field("sourceVirtualDisk").value<CMedium>();
     58    CMediumFormat comMediumFormat = field("mediumFormat").value<CMediumFormat>();
    5959    qulonglong uVariant = field("mediumVariant").toULongLong();
    6060    QString strMediumPath = field("mediumPath").toString();
     
    6565
    6666    /* Get VBox object: */
    67     CVirtualBox vbox = vboxGlobal().virtualBox();
     67    CVirtualBox comVBox = vboxGlobal().virtualBox();
    6868
    6969    /* Create new virtual hard-disk: */
    70     CMedium virtualDisk = vbox.CreateMedium(mediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, KDeviceType_HardDisk);
    71     if (!vbox.isOk())
     70    CMedium comVirtualDisk = comVBox.CreateMedium(comMediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, KDeviceType_HardDisk);
     71    if (!comVBox.isOk())
    7272    {
    73         msgCenter().cannotCreateHardDiskStorage(vbox, strMediumPath, this);
     73        msgCenter().cannotCreateHardDiskStorage(comVBox, strMediumPath, this);
    7474        return false;
    7575    }
    7676
    7777    /* Compose medium-variant: */
    78     QVector<KMediumVariant> variants(sizeof(qulonglong)*8);
     78    QVector<KMediumVariant> variants(sizeof(qulonglong) * 8);
    7979    for (int i = 0; i < variants.size(); ++i)
    8080    {
     
    8585
    8686    /* Copy existing virtual-disk to the new virtual-disk: */
    87     CProgress progress = sourceVirtualDisk.CloneTo(virtualDisk, variants, CMedium());
    88     if (!sourceVirtualDisk.isOk())
     87    CProgress comProgress = comSourceVirtualDisk.CloneTo(comVirtualDisk, variants, CMedium());
     88    if (!comSourceVirtualDisk.isOk())
    8989    {
    90         msgCenter().cannotCreateHardDiskStorage(sourceVirtualDisk, strMediumPath, this);
     90        msgCenter().cannotCreateHardDiskStorage(comSourceVirtualDisk, strMediumPath, this);
    9191        return false;
    9292    }
    9393
    9494    /* Show creation progress: */
    95     msgCenter().showModalProgressDialog(progress, windowTitle(), ":/progress_media_create_90px.png", this);
    96     if (progress.GetCanceled())
     95    msgCenter().showModalProgressDialog(comProgress, windowTitle(), ":/progress_media_create_90px.png", this);
     96    if (comProgress.GetCanceled())
    9797        return false;
    98     if (!progress.isOk() || progress.GetResultCode() != 0)
     98    if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    9999    {
    100         msgCenter().cannotCreateHardDiskStorage(progress, strMediumPath, this);
     100        msgCenter().cannotCreateHardDiskStorage(comProgress, strMediumPath, this);
    101101        return false;
    102102    }
    103103
    104104    /* Remember created virtual-disk: */
    105     m_virtualDisk = virtualDisk;
     105    m_comTargetVirtualDisk = comVirtualDisk;
    106106
    107107    /* Just close the created medium, it is not necessary yet: */
    108     m_virtualDisk.Close();
     108    m_comTargetVirtualDisk.Close();
    109109
    110110    return true;
     
    128128        case WizardMode_Basic:
    129129        {
    130             setPage(Page1, new UIWizardCloneVDPageBasic1(m_sourceVirtualDisk));
     130            setPage(Page1, new UIWizardCloneVDPageBasic1(m_comSourceVirtualDisk));
    131131            setPage(Page2, new UIWizardCloneVDPageBasic2);
    132132            setPage(Page3, new UIWizardCloneVDPageBasic3);
     
    136136        case WizardMode_Expert:
    137137        {
    138             setPage(PageExpert, new UIWizardCloneVDPageExpert(m_sourceVirtualDisk));
     138            setPage(PageExpert, new UIWizardCloneVDPageExpert(m_comSourceVirtualDisk));
    139139            break;
    140140        }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h

    r69187 r69197  
    4949    };
    5050
    51     /** Constructs wizard to clone @a sourceVirtualDisk passing @a pParent to the base-class. */
    52     UIWizardCloneVD(QWidget *pParent, const CMedium &sourceVirtualDisk);
     51    /** Constructs wizard to clone @a comSourceVirtualDisk passing @a pParent to the base-class. */
     52    UIWizardCloneVD(QWidget *pParent, const CMedium &comSourceVirtualDisk);
    5353
    5454    /** Returns target virtual-disk. */
    55     CMedium virtualDisk() const { return m_virtualDisk; }
     55    CMedium targetVirtualDisk() const { return m_comTargetVirtualDisk; }
    5656
    5757protected:
     
    6767
    6868    /** Handles translation event. */
    69     void retranslateUi();
     69    virtual void retranslateUi() /* override */;
    7070
    7171    /** Prepares all. */
    72     void prepare();
     72    virtual void prepare() /* override */;
    7373
    7474    /** Holds the source virtual disk wrapper. */
    75     CMedium m_sourceVirtualDisk;
     75    CMedium m_comSourceVirtualDisk;
    7676    /** Holds the target virtual disk wrapper. */
    77     CMedium m_virtualDisk;
     77    CMedium m_comTargetVirtualDisk;
    7878};
    7979
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp

    r69187 r69197  
    5858}
    5959
    60 void UIWizardCloneVDPage1::setSourceVirtualDisk(const CMedium &sourceVirtualDisk)
     60void UIWizardCloneVDPage1::setSourceVirtualDisk(const CMedium &comSourceVirtualDisk)
    6161{
    62     m_pSourceDiskSelector->setCurrentItem(sourceVirtualDisk.GetId());
     62    m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId());
    6363}
    6464
    65 UIWizardCloneVDPageBasic1::UIWizardCloneVDPageBasic1(const CMedium &sourceVirtualDisk)
     65UIWizardCloneVDPageBasic1::UIWizardCloneVDPageBasic1(const CMedium &comSourceVirtualDisk)
    6666{
    6767    /* Create widgets: */
     
    7575                m_pSourceDiskSelector->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
    7676                m_pSourceDiskSelector->setType(UIMediumType_HardDisk);
    77                 m_pSourceDiskSelector->setCurrentItem(sourceVirtualDisk.GetId());
     77                m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId());
    7878                m_pSourceDiskSelector->repopulate();
    7979            }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h

    r69187 r69197  
    4646    CMedium sourceVirtualDisk() const;
    4747    /** Defines 'sourceVirtualDisk' field value. */
    48     void setSourceVirtualDisk(const CMedium &sourceVirtualDisk);
     48    void setSourceVirtualDisk(const CMedium &comSourceVirtualDisk);
    4949
    5050    /** Holds the source media combo-box instance. */
     
    6464
    6565    /** Constructs basic page.
    66       * @param  sourceVirtualDisk  Brings the initial source disk to make copy from. */
    67     UIWizardCloneVDPageBasic1(const CMedium &sourceVirtualDisk);
     66      * @param  comSourceVirtualDisk  Brings the initial source disk to make copy from. */
     67    UIWizardCloneVDPageBasic1(const CMedium &comSourceVirtualDisk);
    6868
    6969protected:
     
    8080
    8181    /** Handles translation event. */
    82     void retranslateUi();
     82    virtual void retranslateUi() /* override */;
    8383
    8484    /** Prepares the page. */
    85     void initializePage();
     85    virtual void initializePage() /* override */;
    8686
    8787    /** Returns whether the page is complete. */
    88     bool isComplete() const;
     88    virtual bool isComplete() const /* override */;
    8989
    9090    /** Holds the description label instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp

    r69187 r69197  
    4141}
    4242
    43 void UIWizardCloneVDPage2::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatLayout, CMediumFormat medFormat, bool fPreferred /* = false */)
     43void UIWizardCloneVDPage2::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatLayout, CMediumFormat comMediumFormat, bool fPreferred /* = false */)
    4444{
    4545    /* Check that medium format supports creation: */
    4646    ULONG uFormatCapabilities = 0;
    4747    QVector<KMediumFormatCapabilities> capabilities;
    48     capabilities = medFormat.GetCapabilities();
     48    capabilities = comMediumFormat.GetCapabilities();
    4949    for (int i = 0; i < capabilities.size(); i++)
    5050        uFormatCapabilities |= capabilities[i];
     
    5757    QVector<QString> fileExtensions;
    5858    QVector<KDeviceType> deviceTypes;
    59     medFormat.DescribeFileExtensions(fileExtensions, deviceTypes);
     59    comMediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes);
    6060    if (!deviceTypes.contains(KDeviceType_HardDisk))
    6161        return;
     
    7373        }
    7474        pFormatLayout->addWidget(pFormatButton);
    75         m_formats << medFormat;
    76         m_formatNames << medFormat.GetName();
     75        m_formats << comMediumFormat;
     76        m_formatNames << comMediumFormat.GetName();
    7777        m_pFormatButtonGroup->addButton(pFormatButton, m_formatNames.size() - 1);
    7878    }
     
    8484}
    8585
    86 void UIWizardCloneVDPage2::setMediumFormat(const CMediumFormat &mediumFormat)
    87 {
    88     int iPosition = m_formats.indexOf(mediumFormat);
     86void UIWizardCloneVDPage2::setMediumFormat(const CMediumFormat &comMediumFormat)
     87{
     88    int iPosition = m_formats.indexOf(comMediumFormat);
    8989    if (iPosition >= 0)
    9090    {
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h

    r69187 r69197  
    4242
    4343    /** Adds format button.
    44       * @param  pParent         Brings the parent to add button to.
    45       * @param  pFormatsLayout  Brings the layout to insert button to.
    46       * @param  medFormat       Brings the medium format object to acquire format from.
    47       * @param  fPreferred      Brings whether curretn format is preferred or not. */
    48     void addFormatButton(QWidget *pParent, QVBoxLayout *pFormatsLayout, CMediumFormat medFormat, bool fPreferred = false);
     44      * @param  pParent          Brings the parent to add button to.
     45      * @param  pFormatsLayout   Brings the layout to insert button to.
     46      * @param  comMediumFormat  Brings the medium format object to acquire format from.
     47      * @param  fPreferred       Brings whether curretn format is preferred or not. */
     48    void addFormatButton(QWidget *pParent,
     49                         QVBoxLayout *pFormatsLayout,
     50                         CMediumFormat comMediumFormat,
     51                         bool fPreferred = false);
    4952
    5053    /** Returns 'mediumFormat' field value. */
    5154    CMediumFormat mediumFormat() const;
    5255    /** Defines 'mediumFormat' field value. */
    53     void setMediumFormat(const CMediumFormat &mediumFormat);
     56    void setMediumFormat(const CMediumFormat &comMediumFormat);
    5457
    5558    /** Holds the format button-group instance. */
     
    7679
    7780    /** Handles translation event. */
    78     void retranslateUi();
     81    virtual void retranslateUi() /* override */;
    7982
    8083    /** Prepares the page. */
    81     void initializePage();
     84    virtual void initializePage() /* override */;
    8285
    8386    /** Returns whether the page is complete. */
    84     bool isComplete() const;
     87    virtual bool isComplete() const /* override */;
    8588
    8689    /** Returns the ID of the next page to traverse to. */
    87     int nextId() const;
     90    virtual int nextId() const /* override */;
    8891
    8992    /** Holds the description label instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.h

    r69187 r69197  
    6767
    6868    /** Handles translation event. */
    69     void retranslateUi();
     69    virtual void retranslateUi() /* override */;
    7070
    7171    /** Prepares the page. */
    72     void initializePage();
     72    virtual void initializePage() /* override */;
    7373
    7474    /** Returns whether the page is complete. */
    75     bool isComplete() const;
     75    virtual bool isComplete() const /* override */;
    7676
    7777    /** Holds the description label instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp

    r69187 r69197  
    134134
    135135/* static */
    136 QString UIWizardCloneVDPage4::defaultExtension(const CMediumFormat &mediumFormatRef)
     136QString UIWizardCloneVDPage4::defaultExtension(const CMediumFormat &comMediumFormat)
    137137{
    138138    /* Load extension / device list: */
    139139    QVector<QString> fileExtensions;
    140140    QVector<KDeviceType> deviceTypes;
    141     CMediumFormat mediumFormat(mediumFormatRef);
     141    CMediumFormat mediumFormat(comMediumFormat);
    142142    mediumFormat.DescribeFileExtensions(fileExtensions, deviceTypes);
    143143    for (int i = 0; i < fileExtensions.size(); ++i)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.h

    r69187 r69197  
    4848    static QString absoluteFilePath(const QString &strFileName, const QString &strDefaultPath);
    4949    /** Acquires @a strDefaultExtension on the basis of incoming @a mediumFormatRef. */
    50     static QString defaultExtension(const CMediumFormat &mediumFormatRef);
     50    static QString defaultExtension(const CMediumFormat &comMediumFormat);
    5151
    5252    /** Returns 'mediumPath' field value. */
     
    9595
    9696    /** Handles translation event. */
    97     void retranslateUi();
     97    virtual void retranslateUi() /* override */;
    9898
    9999    /** Prepares the page. */
    100     void initializePage();
     100    virtual void initializePage() /* override */;
    101101
    102102    /** Returns whether the page is complete. */
    103     bool isComplete() const;
     103    virtual bool isComplete() const /* override */;
    104104
    105105    /** Returns whether the page is valid. */
    106     bool validatePage();
     106    virtual bool validatePage() /* override */;
    107107
    108108    /** Holds the description label instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp

    r69187 r69197  
    4444
    4545
    46 UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(const CMedium &sourceVirtualDisk)
     46UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk)
    4747{
    4848    /* Create widgets: */
     
    6060                    m_pSourceDiskSelector->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
    6161                    m_pSourceDiskSelector->setType(UIMediumType_HardDisk);
    62                     m_pSourceDiskSelector->setCurrentItem(sourceVirtualDisk.GetId());
     62                    m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId());
    6363                    m_pSourceDiskSelector->repopulate();
    6464                }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.h

    r69187 r69197  
    4646
    4747    /** Constructs basic page.
    48       * @param  sourceVirtualDisk  Brings the initial source disk to make copy from. */
    49     UIWizardCloneVDPageExpert(const CMedium &sourceVirtualDisk);
     48      * @param  comSourceVirtualDisk  Brings the initial source disk to make copy from. */
     49    UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk);
    5050
    5151protected:
     
    7272
    7373    /** Handles translation event. */
    74     void retranslateUi();
     74    virtual void retranslateUi() /* override */;
    7575
    7676    /** Prepares the page. */
    77     void initializePage();
     77    virtual void initializePage() /* override */;
    7878
    7979    /** Returns whether the page is complete. */
    80     bool isComplete() const;
     80    virtual bool isComplete() const /* override */;
    8181
    8282    /** Returns whether the page is valid. */
    83     bool validatePage();
     83    virtual bool validatePage() /* override */;
    8484
    8585    /** Holds the source disk container instance. */
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