VirtualBox

Ignore:
Timestamp:
Feb 4, 2019 5:52:47 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128629
Message:

FE/Qt: Removing source medium selector from the clone medium wizard(s)

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
5 edited
4 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r77086 r77154  
    675675        src/wizards/clonevd/UIWizardCloneVDPageBasic2.h \
    676676        src/wizards/clonevd/UIWizardCloneVDPageBasic3.h \
    677         src/wizards/clonevd/UIWizardCloneVDPageBasic4.h \
    678677        src/wizards/clonevd/UIWizardCloneVDPageExpert.h \
    679678        src/wizards/exportappliance/UIWizardExportApp.h \
     
    10941093        src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp \
    10951094        src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp \
    1096         src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp \
    10971095        src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp \
    10981096        src/wizards/exportappliance/UIWizardExportApp.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp

    r76606 r77154  
    2121#include "UIWizardCloneVDPageBasic2.h"
    2222#include "UIWizardCloneVDPageBasic3.h"
    23 #include "UIWizardCloneVDPageBasic4.h"
    2423#include "UIWizardCloneVDPageExpert.h"
    2524#include "VBoxGlobal.h"
     
    4746{
    4847    /* Gather attributes: */
    49     CMedium comSourceVirtualDisk = field("sourceVirtualDisk").value<CMedium>();
     48
    5049    const CMediumFormat comMediumFormat = field("mediumFormat").value<CMediumFormat>();
    5150    const qulonglong uVariant = field("mediumVariant").toULongLong();
     
    7776
    7877    /* Copy source image to new one: */
    79     CProgress comProgress = comSourceVirtualDisk.CloneTo(comVirtualDisk, variants, CMedium());
    80     if (!comSourceVirtualDisk.isOk())
     78    CProgress comProgress = m_comSourceVirtualDisk.CloneTo(comVirtualDisk, variants, CMedium());
     79    if (!m_comSourceVirtualDisk.isOk())
    8180    {
    82         msgCenter().cannotCreateMediumStorage(comSourceVirtualDisk, strMediumPath, this);
     81        msgCenter().cannotCreateMediumStorage(m_comSourceVirtualDisk, strMediumPath, this);
    8382        return false;
    8483    }
     
    120119        case WizardMode_Basic:
    121120        {
    122             setPage(Page1, new UIWizardCloneVDPageBasic1(m_comSourceVirtualDisk,
    123                                                          m_enmSourceVirtualDiskDeviceType));
     121            setPage(Page1, new UIWizardCloneVDPageBasic1(m_enmSourceVirtualDiskDeviceType));
    124122            setPage(Page2, new UIWizardCloneVDPageBasic2(m_enmSourceVirtualDiskDeviceType));
    125             setPage(Page3, new UIWizardCloneVDPageBasic3(m_enmSourceVirtualDiskDeviceType));
    126             setPage(Page4, new UIWizardCloneVDPageBasic4);
     123            setPage(Page3, new UIWizardCloneVDPageBasic3);
    127124            break;
    128125        }
    129126        case WizardMode_Expert:
    130127        {
    131             setPage(PageExpert, new UIWizardCloneVDPageExpert(m_comSourceVirtualDisk,
    132                                                               m_enmSourceVirtualDiskDeviceType));
     128            setPage(PageExpert, new UIWizardCloneVDPageExpert(m_enmSourceVirtualDiskDeviceType));
    133129            break;
    134130        }
     
    142138    UIWizard::prepare();
    143139}
    144 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h

    r76581 r77154  
    4242        Page1,
    4343        Page2,
    44         Page3,
    45         Page4
     44        Page3
    4645    };
    4746
     
    5655
    5756    /** Returns source virtual-disk. */
    58     CMedium sourceVirtualDisk() const { return m_comSourceVirtualDisk; }
     57    const CMedium &sourceVirtualDisk() const { return m_comSourceVirtualDisk; }
    5958    /** Returns target virtual-disk. */
    6059    CMedium targetVirtualDisk() const { return m_comTargetVirtualDisk; }
     
    8483
    8584#endif /* !FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVD_h */
    86 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp

    r77153 r77154  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardCloneVDPageBasic2 class implementation.
     3 * VBox Qt GUI - UIWizardCloneVDPageBasic1 class implementation.
    44 */
    55
     
    2323/* GUI includes: */
    2424#include "UIConverter.h"
    25 #include "UIWizardCloneVDPageBasic2.h"
     25#include "UIWizardCloneVDPageBasic1.h"
    2626#include "UIWizardCloneVD.h"
    2727#include "VBoxGlobal.h"
     
    3232
    3333
    34 UIWizardCloneVDPage2::UIWizardCloneVDPage2()
    35 {
    36 }
    37 
    38 void UIWizardCloneVDPage2::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatLayout, KDeviceType enmDeviceType, CMediumFormat comMediumFormat, bool fPreferred /* = false */)
     34UIWizardCloneVDPage1::UIWizardCloneVDPage1()
     35{
     36}
     37
     38void UIWizardCloneVDPage1::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatLayout, KDeviceType enmDeviceType, CMediumFormat comMediumFormat, bool fPreferred /* = false */)
    3939{
    4040    /* Check that medium format supports creation: */
     
    7474}
    7575
    76 CMediumFormat UIWizardCloneVDPage2::mediumFormat() const
     76CMediumFormat UIWizardCloneVDPage1::mediumFormat() const
    7777{
    7878    return m_pFormatButtonGroup->checkedButton() ? m_formats[m_pFormatButtonGroup->checkedId()] : CMediumFormat();
    7979}
    8080
    81 void UIWizardCloneVDPage2::setMediumFormat(const CMediumFormat &comMediumFormat)
     81void UIWizardCloneVDPage1::setMediumFormat(const CMediumFormat &comMediumFormat)
    8282{
    8383    int iPosition = m_formats.indexOf(comMediumFormat);
     
    8989}
    9090
    91 UIWizardCloneVDPageBasic2::UIWizardCloneVDPageBasic2(KDeviceType enmDeviceType)
     91UIWizardCloneVDPageBasic1::UIWizardCloneVDPageBasic1(KDeviceType enmDeviceType)
    9292{
    9393    /* Create widgets: */
     
    143143    /* Setup connections: */
    144144    connect(m_pFormatButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
    145             this, &UIWizardCloneVDPageBasic2::completeChanged);
     145            this, &UIWizardCloneVDPageBasic1::completeChanged);
    146146
    147147    /* Register classes: */
     
    151151}
    152152
    153 void UIWizardCloneVDPageBasic2::retranslateUi()
     153void UIWizardCloneVDPageBasic1::retranslateUi()
    154154{
    155155    /* Translate page: */
     
    169169}
    170170
    171 void UIWizardCloneVDPageBasic2::initializePage()
     171void UIWizardCloneVDPageBasic1::initializePage()
    172172{
    173173    /* Translate page: */
     
    175175}
    176176
    177 bool UIWizardCloneVDPageBasic2::isComplete() const
     177bool UIWizardCloneVDPageBasic1::isComplete() const
    178178{
    179179    /* Make sure medium format is correct: */
     
    181181}
    182182
    183 int UIWizardCloneVDPageBasic2::nextId() const
     183int UIWizardCloneVDPageBasic1::nextId() const
    184184{
    185185    /* Show variant page only if there is something to show: */
     
    208208    }
    209209    /* Skip otherwise: */
    210     return UIWizardCloneVD::Page4;
    211 }
    212 
     210    return UIWizardCloneVD::Page3;
     211}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h

    r77153 r77154  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardCloneVDPageBasic2 class declaration.
     3 * VBox Qt GUI - UIWizardCloneVDPageBasic1 class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic2_h
    19 #define FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic2_h
     18#ifndef FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic1_h
     19#define FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic1_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    3636
    3737
    38 /** 2nd page of the Clone Virtual Disk Image wizard (base part): */
    39 class UIWizardCloneVDPage2 : public UIWizardPageBase
     38/** 1st page of the Clone Virtual Disk Image wizard (base part): */
     39class UIWizardCloneVDPage1 : public UIWizardPageBase
    4040{
    4141protected:
    4242
    4343    /** Constructs page basis. */
    44     UIWizardCloneVDPage2();
     44    UIWizardCloneVDPage1();
    4545
    4646    /** Adds format button.
     
    7171
    7272/** 2nd page of the Clone Virtual Disk Image wizard (basic extension): */
    73 class UIWizardCloneVDPageBasic2 : public UIWizardPage, public UIWizardCloneVDPage2
     73class UIWizardCloneVDPageBasic1 : public UIWizardPage, public UIWizardCloneVDPage1
    7474{
    7575    Q_OBJECT;
     
    8080    /** Constructs basic page.
    8181      * @param  enmDeviceType  Brings the device type to limit format to. */
    82     UIWizardCloneVDPageBasic2(KDeviceType enmDeviceType);
     82    UIWizardCloneVDPageBasic1(KDeviceType enmDeviceType);
    8383
    8484private:
     
    100100};
    101101
    102 #endif /* !FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic2_h */
    103 
     102#endif /* !FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic1_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp

    r77153 r77154  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardCloneVDPageBasic3 class implementation.
     3 * VBox Qt GUI - UIWizardCloneVDPageBasic2 class implementation.
    44 */
    55
     
    2323
    2424/* GUI includes: */
    25 #include "UIWizardCloneVDPageBasic3.h"
     25#include "UIWizardCloneVDPageBasic2.h"
    2626#include "UIWizardCloneVD.h"
    2727#include "QIRichTextLabel.h"
     
    3131
    3232
    33 UIWizardCloneVDPage3::UIWizardCloneVDPage3()
     33UIWizardCloneVDPage2::UIWizardCloneVDPage2()
    3434{
    3535}
    3636
    37 qulonglong UIWizardCloneVDPage3::mediumVariant() const
     37qulonglong UIWizardCloneVDPage2::mediumVariant() const
    3838{
    3939    /* Initial value: */
     
    5454}
    5555
    56 void UIWizardCloneVDPage3::setMediumVariant(qulonglong uMediumVariant)
     56void UIWizardCloneVDPage2::setMediumVariant(qulonglong uMediumVariant)
    5757{
    5858    /* Exclusive options: */
     
    7272}
    7373
    74 UIWizardCloneVDPageBasic3::UIWizardCloneVDPageBasic3(KDeviceType enmDeviceType)
     74UIWizardCloneVDPageBasic2::UIWizardCloneVDPageBasic2(KDeviceType enmDeviceType)
    7575{
    7676    /* Create widgets: */
     
    116116    /* Setup connections: */
    117117    connect(m_pVariantButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
    118             this, &UIWizardCloneVDPageBasic3::completeChanged);
     118            this, &UIWizardCloneVDPageBasic2::completeChanged);
    119119    connect(m_pSplitBox, &QCheckBox::stateChanged,
    120             this, &UIWizardCloneVDPageBasic3::completeChanged);
     120            this, &UIWizardCloneVDPageBasic2::completeChanged);
    121121
    122122    /* Register fields: */
     
    124124}
    125125
    126 void UIWizardCloneVDPageBasic3::retranslateUi()
     126void UIWizardCloneVDPageBasic2::retranslateUi()
    127127{
    128128    /* Translate page: */
     
    146146}
    147147
    148 void UIWizardCloneVDPageBasic3::initializePage()
     148void UIWizardCloneVDPageBasic2::initializePage()
    149149{
    150150    /* Translate page: */
     
    170170}
    171171
    172 bool UIWizardCloneVDPageBasic3::isComplete() const
     172bool UIWizardCloneVDPageBasic2::isComplete() const
    173173{
    174174    /* Make sure medium variant is correct: */
    175175    return mediumVariant() != (qulonglong)KMediumVariant_Max;
    176176}
    177 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h

    r77153 r77154  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardCloneVDPageBasic3 class declaration.
     3 * VBox Qt GUI - UIWizardCloneVDPageBasic2 class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic3_h
    19 #define FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic3_h
     18#ifndef FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic2_h
     19#define FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic2_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    3636
    3737/** 3rd page of the Clone Virtual Disk Image wizard (base part): */
    38 class UIWizardCloneVDPage3 : public UIWizardPageBase
     38class UIWizardCloneVDPage2 : public UIWizardPageBase
    3939{
    4040protected:
    4141
    4242    /** Constructs page basis. */
    43     UIWizardCloneVDPage3();
     43    UIWizardCloneVDPage2();
    4444
    4545    /** Returns 'mediumVariant' field value. */
     
    6060
    6161/** 3rd page of the Clone Virtual Disk Image wizard (basic extension): */
    62 class UIWizardCloneVDPageBasic3 : public UIWizardPage, public UIWizardCloneVDPage3
     62class UIWizardCloneVDPageBasic2 : public UIWizardPage, public UIWizardCloneVDPage2
    6363{
    6464    Q_OBJECT;
     
    6868
    6969    /** Constructs basic page. */
    70     UIWizardCloneVDPageBasic3(KDeviceType enmDeviceType);
     70    UIWizardCloneVDPageBasic2(KDeviceType enmDeviceType);
    7171
    7272private:
     
    9191};
    9292
    93 #endif /* !FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic3_h */
    94 
     93#endif /* !FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic2_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp

    r77153 r77154  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardCloneVDPageBasic4 class implementation.
     3 * VBox Qt GUI - UIWizardCloneVDPageBasic3 class implementation.
    44 */
    55
     
    2323
    2424/* GUI includes: */
    25 #include "UIWizardCloneVDPageBasic4.h"
     25#include "UIWizardCloneVDPageBasic3.h"
    2626#include "UIWizardCloneVD.h"
    2727#include "VBoxGlobal.h"
     
    3636
    3737
    38 UIWizardCloneVDPage4::UIWizardCloneVDPage4()
    39 {
    40 }
    41 
    42 void UIWizardCloneVDPage4::onSelectLocationButtonClicked()
     38UIWizardCloneVDPage3::UIWizardCloneVDPage3()
     39{
     40}
     41
     42void UIWizardCloneVDPage3::onSelectLocationButtonClicked()
    4343{
    4444    /* Get current folder and filename: */
     
    9494
    9595/* static */
    96 QString UIWizardCloneVDPage4::toFileName(const QString &strName, const QString &strExtension)
     96QString UIWizardCloneVDPage3::toFileName(const QString &strName, const QString &strExtension)
    9797{
    9898    /* Convert passed name to native separators (it can be full, actually): */
     
    113113
    114114/* static */
    115 QString UIWizardCloneVDPage4::absoluteFilePath(const QString &strFileName, const QString &strDefaultPath)
     115QString UIWizardCloneVDPage3::absoluteFilePath(const QString &strFileName, const QString &strDefaultPath)
    116116{
    117117    /* Wrap file-info around received file name: */
     
    128128
    129129/* static */
    130 void UIWizardCloneVDPage4::acquireExtensions(const CMediumFormat &comMediumFormat, KDeviceType enmDeviceType,
     130void UIWizardCloneVDPage3::acquireExtensions(const CMediumFormat &comMediumFormat, KDeviceType enmDeviceType,
    131131                                             QStringList &aAllowedExtensions, QString &strDefaultExtension)
    132132{
     
    143143}
    144144
    145 QString UIWizardCloneVDPage4::mediumPath() const
     145QString UIWizardCloneVDPage3::mediumPath() const
    146146{
    147147    /* Acquire chosen file path, and what is important user suffix: */
     
    156156}
    157157
    158 qulonglong UIWizardCloneVDPage4::mediumSize() const
    159 {
    160     const CMedium &sourceVirtualDisk = fieldImp("sourceVirtualDisk").value<CMedium>();
     158qulonglong UIWizardCloneVDPage3::mediumSize()
     159{
     160    UIWizardCloneVD *pWizard = qobject_cast<UIWizardCloneVD*>(wizardImp());
     161    if (!pWizard)
     162        return 0;
     163    const CMedium &sourceVirtualDisk = pWizard->sourceVirtualDisk();
    161164    return sourceVirtualDisk.isNull() ? 0 : sourceVirtualDisk.GetLogicalSize();
    162165}
    163166
    164 UIWizardCloneVDPageBasic4::UIWizardCloneVDPageBasic4()
     167UIWizardCloneVDPageBasic3::UIWizardCloneVDPageBasic3()
    165168{
    166169    /* Create widgets: */
     
    185188
    186189    /* Setup page connections: */
    187     connect(m_pDestinationDiskEditor, &QLineEdit::textChanged,    this, &UIWizardCloneVDPageBasic4::completeChanged);
    188     connect(m_pDestinationDiskOpenButton, &QIToolButton::clicked, this, &UIWizardCloneVDPageBasic4::sltSelectLocationButtonClicked);
     190    connect(m_pDestinationDiskEditor, &QLineEdit::textChanged,    this, &UIWizardCloneVDPageBasic3::completeChanged);
     191    connect(m_pDestinationDiskOpenButton, &QIToolButton::clicked, this, &UIWizardCloneVDPageBasic3::sltSelectLocationButtonClicked);
    189192
    190193    /* Register fields: */
     
    193196}
    194197
    195 void UIWizardCloneVDPageBasic4::sltSelectLocationButtonClicked()
     198void UIWizardCloneVDPageBasic3::sltSelectLocationButtonClicked()
    196199{
    197200    /* Call to base-class: */
     
    199202}
    200203
    201 void UIWizardCloneVDPageBasic4::retranslateUi()
     204void UIWizardCloneVDPageBasic3::retranslateUi()
    202205{
    203206    /* Translate page: */
     
    210213}
    211214
    212 void UIWizardCloneVDPageBasic4::initializePage()
     215void UIWizardCloneVDPageBasic3::initializePage()
    213216{
    214217    /* Translate page: */
    215218    retranslateUi();
    216219
     220    UIWizardCloneVD *pWizard = qobject_cast<UIWizardCloneVD*>(wizardImp());
     221    if (!pWizard)
     222        return;
     223    const CMedium &comMedium = pWizard->sourceVirtualDisk();
     224
    217225    /* Get source virtual-disk file-information: */
    218     QFileInfo sourceFileInfo(field("sourceVirtualDisk").value<CMedium>().GetLocation());
     226    QFileInfo sourceFileInfo(comMedium.GetLocation());
    219227    /* Get default path for virtual-disk copy: */
    220228    m_strDefaultPath = sourceFileInfo.absolutePath();
     
    229237}
    230238
    231 bool UIWizardCloneVDPageBasic4::isComplete() const
     239bool UIWizardCloneVDPageBasic3::isComplete() const
    232240{
    233241    /* Make sure current name is not empty: */
     
    235243}
    236244
    237 bool UIWizardCloneVDPageBasic4::validatePage()
     245bool UIWizardCloneVDPageBasic3::validatePage()
    238246{
    239247    /* Initial result: */
     
    261269    return fResult;
    262270}
    263 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.h

    r77153 r77154  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIWizardCloneVDPageBasic4 class declaration.
     3 * VBox Qt GUI - UIWizardCloneVDPageBasic3 class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic4_h
    19 #define FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic4_h
     18#ifndef FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic3_h
     19#define FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic3_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    3939
    4040/** 4th page of the Clone Virtual Disk Image wizard (base part): */
    41 class UIWizardCloneVDPage4 : public UIWizardPageBase
     41class UIWizardCloneVDPage3 : public UIWizardPageBase
    4242{
    4343protected:
    4444
    4545    /** Constructs page basis. */
    46     UIWizardCloneVDPage4();
     46    UIWizardCloneVDPage3();
    4747
    4848    /** Handles command to open target disk. */
     
    6262
    6363    /** Returns 'mediumSize' field value. */
    64     qulonglong mediumSize() const;
     64    qulonglong mediumSize();
    6565
    6666    /** Holds the default path. */
     
    7979
    8080/** 4th page of the Clone Virtual Disk Image wizard (basic extension): */
    81 class UIWizardCloneVDPageBasic4 : public UIWizardPage, public UIWizardCloneVDPage4
     81class UIWizardCloneVDPageBasic3 : public UIWizardPage, public UIWizardCloneVDPage3
    8282{
    8383    Q_OBJECT;
     
    8888
    8989    /** Constructs basic page. */
    90     UIWizardCloneVDPageBasic4();
     90    UIWizardCloneVDPageBasic3();
    9191
    9292protected:
     
    122122};
    123123
    124 #endif /* !FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic4_h */
    125 
     124#endif /* !FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageBasic3_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp

    r76606 r77154  
    3939
    4040
    41 UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk, KDeviceType enmDeviceType)
     41UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(KDeviceType enmDeviceType)
    4242{
    4343    /* Create widgets: */
    4444    QGridLayout *pMainLayout = new QGridLayout(this);
    4545    {
    46         m_pSourceDiskCnt = new QGroupBox(this);
    47         {
    48             m_pSourceDiskCnt->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    49             QHBoxLayout *pSourceDiskCntLayout = new QHBoxLayout(m_pSourceDiskCnt);
    50             {
    51                 m_pSourceDiskSelector = new UIMediaComboBox(m_pSourceDiskCnt);
    52                 {
    53                     m_pSourceDiskSelector->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
    54                     m_pSourceDiskSelector->setType(UIMediumDefs::mediumTypeToLocal(enmDeviceType));
    55                     m_pSourceDiskSelector->setCurrentItem(comSourceVirtualDisk.GetId());
    56                     m_pSourceDiskSelector->repopulate();
    57                 }
    58                 m_pSourceDiskOpenButton = new QIToolButton(m_pSourceDiskCnt);
    59                 {
    60                     m_pSourceDiskOpenButton->setAutoRaise(true);
    61                     m_pSourceDiskOpenButton->setIcon(UIIconPool::iconSet(":/select_file_16px.png", ":/select_file_disabled_16px.png"));
    62                 }
    63                 pSourceDiskCntLayout->addWidget(m_pSourceDiskSelector);
    64                 pSourceDiskCntLayout->addWidget(m_pSourceDiskOpenButton);
    65             }
    66         }
    6746        m_pDestinationCnt = new QGroupBox(this);
    6847        {
     
    153132            }
    154133        }
    155         pMainLayout->addWidget(m_pSourceDiskCnt, 0, 0, 1, 2);
    156134        pMainLayout->addWidget(m_pDestinationCnt, 1, 0, 1, 2);
    157135        pMainLayout->addWidget(m_pFormatCnt, 2, 0, Qt::AlignTop);
     
    160138
    161139    /* Setup connections: */
    162     connect(m_pSourceDiskSelector, static_cast<void(UIMediaComboBox::*)(int)>(&UIMediaComboBox::currentIndexChanged),
    163             this, &UIWizardCloneVDPageExpert::sltHandleSourceDiskChange);
    164     connect(m_pSourceDiskOpenButton, &QIToolButton::clicked,
    165             this, &UIWizardCloneVDPageExpert::sltHandleOpenSourceDiskClick);
    166140    connect(m_pFormatButtonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
    167141            this, &UIWizardCloneVDPageExpert::sltMediumFormatChanged);
     
    179153    qRegisterMetaType<CMediumFormat>();
    180154    /* Register fields: */
    181     registerField("sourceVirtualDisk", this, "sourceVirtualDisk");
    182155    registerField("mediumFormat", this, "mediumFormat");
    183156    registerField("mediumVariant", this, "mediumVariant");
     
    186159}
    187160
    188 void UIWizardCloneVDPageExpert::sltHandleSourceDiskChange()
    189 {
     161void UIWizardCloneVDPageExpert::setTargetLocation()
     162{
     163    UIWizardCloneVD *pWizard = qobject_cast<UIWizardCloneVD*>(wizard());
     164    if (!pWizard)
     165        return;
    190166    /* Get source virtual-disk file-information: */
    191     QFileInfo sourceFileInfo(sourceVirtualDisk().GetLocation());
     167    QFileInfo sourceFileInfo(pWizard->sourceVirtualDisk().GetLocation());
    192168    /* Get default path for virtual-disk copy: */
    193169    m_strDefaultPath = sourceFileInfo.absolutePath();
     
    196172    /* Set text to location editor: */
    197173    m_pDestinationDiskEditor->setText(strMediumName);
    198 
    199     /* Broadcast complete-change: */
    200     emit completeChanged();
    201 }
    202 
    203 void UIWizardCloneVDPageExpert::sltHandleOpenSourceDiskClick()
    204 {
    205     /* Call to base-class: */
    206     onHandleOpenSourceDiskClick();
    207174
    208175    /* Broadcast complete-change: */
     
    251218{
    252219    /* Translate widgets: */
    253     m_pSourceDiskCnt->setTitle(UIWizardCloneVD::tr("Disk image to &copy"));
    254     m_pSourceDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a virtual disk image file to copy..."));
    255220    m_pDestinationCnt->setTitle(UIWizardCloneVD::tr("&New disk image to create"));
    256221    m_pDestinationDiskOpenButton->setToolTip(UIWizardCloneVD::tr("Choose a location for new virtual disk image file..."));
     
    274239    retranslateUi();
    275240
    276     sltHandleSourceDiskChange();
     241    setTargetLocation();
    277242    sltMediumFormatChanged();
    278243}
     
    280245bool UIWizardCloneVDPageExpert::isComplete() const
    281246{
     247    UIWizardCloneVD *pWizard = qobject_cast<UIWizardCloneVD*>(wizard());
     248    if (!pWizard)
     249        return false;
    282250    /* Check what source virtual-disk feats the rules,
    283251     * medium format/variant is correct,
    284252     * current name is not empty: */
    285     return !sourceVirtualDisk().isNull() &&
     253    return !pWizard->sourceVirtualDisk().isNull() &&
    286254           !mediumFormat().isNull() &&
    287255           mediumVariant() != (qulonglong)KMediumVariant_Max &&
     
    313281    return fResult;
    314282}
    315 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.h

    r76581 r77154  
    2626#include "UIWizardCloneVDPageBasic2.h"
    2727#include "UIWizardCloneVDPageBasic3.h"
    28 #include "UIWizardCloneVDPageBasic4.h"
    2928
    3029/* Forward declarations: */
     
    3635                                  public UIWizardCloneVDPage1,
    3736                                  public UIWizardCloneVDPage2,
    38                                   public UIWizardCloneVDPage3,
    39                                   public UIWizardCloneVDPage4
     37                                  public UIWizardCloneVDPage3
    4038{
    4139    Q_OBJECT;
    42     Q_PROPERTY(CMedium sourceVirtualDisk READ sourceVirtualDisk WRITE setSourceVirtualDisk);
    4340    Q_PROPERTY(CMediumFormat mediumFormat READ mediumFormat WRITE setMediumFormat);
    4441    Q_PROPERTY(qulonglong mediumVariant READ mediumVariant WRITE setMediumVariant);
     
    5148      * @param  comSourceVirtualDisk  Brings the initial source disk to make copy from.
    5249      * @param  enmDeviceType         Brings the device type to limit format to. */
    53     UIWizardCloneVDPageExpert(const CMedium &comSourceVirtualDisk, KDeviceType enmDeviceType);
     50    UIWizardCloneVDPageExpert(KDeviceType enmDeviceType);
    5451
    5552protected:
     
    6360
    6461private slots:
    65 
    66     /** Handles source disk change. */
    67     void sltHandleSourceDiskChange();
    68     /** Handles command to open source disk. */
    69     void sltHandleOpenSourceDiskClick();
    7062
    7163    /** Handles medium format change. */
     
    8981    virtual bool validatePage() /* override */;
    9082
    91     /** Holds the source disk container instance. */
    92     QGroupBox *m_pSourceDiskCnt;
     83    /** Sets the target disk name and location. */
     84    void setTargetLocation();
     85
    9386    /** Holds the format container instance. */
    9487    QGroupBox *m_pFormatCnt;
     
    10093
    10194#endif /* !FEQT_INCLUDED_SRC_wizards_clonevd_UIWizardCloneVDPageExpert_h */
    102 
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