VirtualBox

Changeset 90430 in vbox for trunk


Ignore:
Timestamp:
Jul 30, 2021 2:23:10 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9996. More fixes on the expert page of new vd wizard.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp

    r90413 r90430  
    9494    {
    9595        case WizardMode_Basic:
    96         case WizardMode_Expert:
    9796        {
    9897            addPage(new UIWizardNewVDPageFileType);
     
    101100            break;
    102101        }
    103 
    104         // {
    105         //     //addPage(new UIWizardNewVDPageExpert);
    106         //     break;
    107         // }
     102       case WizardMode_Expert:
     103        {
     104            addPage(new UIWizardNewVDPageExpert(m_strDefaultName, m_strDefaultPath, m_uDefaultSize));
     105            break;
     106        }
    108107        default:
    109108        {
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r90427 r90430  
    7474    connect(m_pFormatGroup, &UIDiskFormatsGroupBox::sigMediumFormatChanged,
    7575            this, &UIWizardNewVDPageExpert::sltMediumFormatChanged);
     76    connect(m_pVariantGroup, &UIDiskVariantGroupBox::sigMediumVariantChanged,
     77            this, &UIWizardNewVDPageExpert::sltMediumVariantChanged);
     78
    7679//     connect(m_pFixedCheckBox, &QAbstractButton::toggled,
    7780//             this, &UIWizardNewVDPageExpert::completeChanged);
     
    8588//             this, &UIWizardNewVDPageExpert::completeChanged);
    8689
     90    connect(m_pSizeAndPathGroup, &UIMediumSizeAndPathGroupBox::sigMediumSizeChanged,
     91            this, &UIWizardNewVDPageExpert::sltMediumSizeChanged);
     92
     93    connect(m_pSizeAndPathGroup, &UIMediumSizeAndPathGroupBox::sigMediumPathChanged,
     94            this, &UIWizardNewVDPageExpert::sltMediumPathChanged);
    8795
    8896    retranslateUi();
    8997
     98}
     99
     100void UIWizardNewVDPageExpert::sltMediumSizeChanged(qulonglong uSize)
     101{
     102    newVDWizardPropertySet(MediumSize, uSize);
     103    emit completeChanged();
     104}
     105
     106void UIWizardNewVDPageExpert::sltMediumPathChanged(const QString &strPath)
     107{
     108    newVDWizardPropertySet(MediumPath, strPath);
     109    emit completeChanged();
     110}
     111
     112void UIWizardNewVDPageExpert::sltMediumVariantChanged(qulonglong uVariant)
     113{
     114    newVDWizardPropertySet(MediumVariant, uVariant);
     115    emit completeChanged();
    90116}
    91117
     
    110136    QFileInfo mediumPath(strMediumPath);
    111137    m_pSizeAndPathGroup->setMediumPath(QDir::toNativeSeparators(mediumPath.absoluteFilePath()));
     138    emit completeChanged();
    112139}
    113140
     
    173200bool UIWizardNewVDPageExpert::isComplete() const
    174201{
    175     /* Make sure medium format/variant is correct,
    176      * current name is not empty and current size feats the bounds: */
    177     // return !mediumFormat().isNull() &&
    178     //        mediumVariant() != (qulonglong)KMediumVariant_Max &&
    179     //        !m_pLocationEditor->text().trimmed().isEmpty() &&
    180     //        mediumSize() >= m_uMediumSizeMin && mediumSize() <= m_uMediumSizeMax;
    181     return false;
     202    UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard());
     203    AssertReturn(pWizard, false);
     204    if (pWizard->mediumFormat().isNull())
     205        return false;
     206    if (pWizard->mediumVariant() == (qulonglong)KMediumVariant_Max)
     207        return false;
     208    if (pWizard->mediumPath().isEmpty())
     209        return false;
     210    if (pWizard->mediumSize() > m_uMediumSizeMax || pWizard->mediumSize() < m_uMediumSizeMin)
     211        return false;
     212    return true;
    182213}
    183214
    184215bool UIWizardNewVDPageExpert::validatePage()
    185216{
    186     /* Initial result: */
    187217    bool fResult = true;
    188 
    189     // /* Make sure such file doesn't exist already: */
    190     // const QString strMediumPath(mediumPath());
    191     // fResult = !QFileInfo(strMediumPath).exists();
    192     // if (!fResult)
    193     // {
    194     //     msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
    195     //     return fResult;
    196     // }
    197 
    198     // /* Make sure we are passing FAT size limitation: */
    199     // fResult = UIWizardNewVDPageBaseSizeLocation::checkFATSizeLimitation(fieldImp("mediumVariant").toULongLong(),
    200     //                                                      fieldImp("mediumPath").toString(),
    201     //                                                      fieldImp("mediumSize").toULongLong());
    202     // if (!fResult)
    203     // {
    204     //     msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this);
    205     //     return fResult;
    206     // }
    207 
    208     // /* Lock finish button: */
    209     // startProcessing();
    210     // /* Try to create virtual-disk: */
    211     // fResult = qobject_cast<UIWizardNewVD*>(wizard())->createVirtualDisk();
    212     // /* Unlock finish button: */
    213     // endProcessing();
    214 
    215     /* Return result: */
     218    UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard());
     219    AssertReturn(pWizard, false);
     220    /* Make sure such file doesn't exist already: */
     221    const QString strMediumPath(pWizard->mediumPath());
     222    fResult = !QFileInfo(strMediumPath).exists();
     223    if (!fResult)
     224    {
     225        msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
     226        return fResult;
     227    }
     228
     229    /* Make sure we are passing FAT size limitation: */
     230    fResult = UIDiskEditorGroupBox::checkFATSizeLimitation(pWizard->mediumVariant(),
     231                                     pWizard->mediumPath(),
     232                                     pWizard->mediumSize());
     233    if (!fResult)
     234    {
     235        msgCenter().cannotCreateHardDiskStorageInFAT(strMediumPath, this);
     236        return fResult;
     237    }
     238
     239    fResult = pWizard->createVirtualDisk();
    216240    return fResult;
    217241}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h

    r90427 r90430  
    4747    void sltMediumFormatChanged();
    4848    void sltSelectLocationButtonClicked();
     49    void sltMediumVariantChanged(qulonglong uVariant);
     50    void sltMediumPathChanged(const QString &strPath);
     51    void sltMediumSizeChanged(qulonglong uSize);
    4952
    5053private:
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageFileType.cpp

    r90413 r90430  
    5252    AssertReturnVoid(m_pFormatButtonGroup);
    5353    newVDWizardPropertySet(MediumFormat, m_pFormatButtonGroup->mediumFormat());
     54    emit completeChanged();
    5455}
    5556
     
    7273bool UIWizardNewVDPageFileType::isComplete() const
    7374{
    74     /* Make sure medium format is correct: */
    75     //return !mediumFormat().isNull();
    76     return true;
     75    UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard());
     76    if (pWizard && !pWizard->mediumFormat().isNull())
     77        return true;
     78    return false;
    7779}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageSizeLocation.cpp

    r90427 r90430  
    100100void UIWizardNewVDPageSizeLocation::sltSelectLocationButtonClicked()
    101101{
    102 
     102    UIWizardNewVD *pWizard = qobject_cast<UIWizardNewVD*>(wizard());
     103    AssertReturnVoid(pWizard);
     104    QString strSelectedPath = UIWizardNewVDSizeLocation::selectNewMediumLocation(pWizard);
     105    if (strSelectedPath.isEmpty())
     106        return;
     107    QString strMediumPath =
     108        UIDiskEditorGroupBox::appendExtension(strSelectedPath,
     109                                              UIDiskEditorGroupBox::defaultExtensionForMediumFormat(pWizard->mediumFormat()));
     110    QFileInfo mediumPath(strMediumPath);
     111    m_pMediumSizePathGroup->setMediumPath(QDir::toNativeSeparators(mediumPath.absoluteFilePath()));
    103112}
    104113
    105 void UIWizardNewVDPageSizeLocation::sltMediumSizeChanged(qulonglong /*uSize*/)
     114void UIWizardNewVDPageSizeLocation::sltMediumSizeChanged(qulonglong uSize)
    106115{
    107     AssertReturnVoid(m_pMediumSizePathGroup);
    108116    m_userModifiedParameters << "MediumSize";
    109     newVDWizardPropertySet(MediumSize, m_pMediumSizePathGroup->mediumSize());
     117    newVDWizardPropertySet(MediumSize, uSize);
     118    emit completeChanged();
    110119}
    111120
    112 void UIWizardNewVDPageSizeLocation::sltMediumPathChanged(const QString &/*strPath*/)
     121void UIWizardNewVDPageSizeLocation::sltMediumPathChanged(const QString &strPath)
    113122{
    114     AssertReturnVoid(m_pMediumSizePathGroup);
    115123    m_userModifiedParameters << "MediumPath";
    116     newVDWizardPropertySet(MediumPath, m_pMediumSizePathGroup->mediumPath());
     124    newVDWizardPropertySet(MediumPath, strPath);
     125    emit completeChanged();
    117126}
    118127
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