VirtualBox

Ignore:
Timestamp:
Jul 5, 2018 9:30:09 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123460
Message:

FE/Qt: bugref:9083 Adding a checkbox to enable floppy formatting while creation

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.cpp

    r72903 r72913  
    2121
    2222/* Qt includes */
     23# include<QCheckBox>
    2324# include<QDialogButtonBox>
    2425# include<QDir>
     
    4647   : QIWithRetranslateUI<QDialog>(pParent)
    4748    , m_pFilePathselector(0)
    48     , m_strMachineName(strMachineName)
    49     , m_strMachineFolder(strMachineFolder)
    5049    , m_pPathLabel(0)
    5150    , m_pSizeLabel(0)
    5251    , m_pSizeCombo(0)
    5352    , m_pButtonBox(0)
     53    , m_pFormatCheckBox(0)
     54    , m_strMachineName(strMachineName)
     55    , m_strMachineFolder(strMachineFolder)
    5456{
    5557
     
    7375    if (m_pButtonBox)
    7476        m_pButtonBox->button(QDialogButtonBox::Ok)->setText("Create");
     77    if (m_pFormatCheckBox)
     78        m_pFormatCheckBox->setText(QApplication::translate("UIMediumManager", "Format disk as FAT12"));
    7579    if (m_pSizeCombo)
    7680    {
    77         m_pSizeCombo->setItemText(FDSize_2_88M, QApplication::translate("UIMediumManager", "2.88M"));
     81        //m_pSizeCombo->setItemText(FDSize_2_88M, QApplication::translate("UIMediumManager", "2.88M"));
    7882        m_pSizeCombo->setItemText(FDSize_1_44M, QApplication::translate("UIMediumManager", "1.44M"));
    7983        m_pSizeCombo->setItemText(FDSize_1_2M, QApplication::translate("UIMediumManager", "1.2M"));
     
    126130    {
    127131        pMainLayout->addWidget(m_pSizeCombo, 1, 1, 1, 1);
    128         m_pSizeCombo->insertItem(FDSize_2_88M, "2.88M", 2949120);
     132        //m_pSizeCombo->insertItem(FDSize_2_88M, "2.88M", 2949120);
    129133        m_pSizeCombo->insertItem(FDSize_1_44M, "1.44M", 1474560);
    130134        m_pSizeCombo->insertItem(FDSize_1_2M, "1.2M", 1228800);
     
    135139    }
    136140
     141    m_pFormatCheckBox = new QCheckBox;
     142    if (m_pFormatCheckBox)
     143    {
     144        pMainLayout->addWidget(m_pFormatCheckBox, 2, 1, 1, 1);
     145        m_pFormatCheckBox->setCheckState(Qt::Checked);
     146    }
     147
    137148    m_pButtonBox =
    138149        new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
    139150    if (m_pButtonBox)
    140151    {
    141         pMainLayout->addWidget(m_pButtonBox, 2, 0, 1, 3);
     152        pMainLayout->addWidget(m_pButtonBox, 3, 0, 1, 3);
    142153        connect(m_pButtonBox, &QDialogButtonBox::accepted, this, &UIFDCreationDialog::accept);
    143154        connect(m_pButtonBox, &QDialogButtonBox::rejected, this, &UIFDCreationDialog::reject);
     
    177188        return;
    178189    }
     190
    179191    QVector<KMediumVariant> variants(1, KMediumVariant_Fixed);
     192    /* Decide if formatting the disk is required: */
     193    if (m_pFormatCheckBox && m_pFormatCheckBox->checkState() == Qt::Checked)
     194        variants.push_back(KMediumVariant_Formatted);
    180195    CProgress progress = newMedium.CreateBaseStorage(m_pSizeCombo->currentData().toLongLong(), variants);
    181196
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIFDCreationDialog.h

    r72903 r72913  
    2727
    2828/* Forward declarations: */
     29class QCheckBox;
     30class QComboBox;
    2931class QDialogButtonBox;
    3032class QLabel;
    31 class QComboBox;
    3233class UIFilePathSelector;
    3334
     
    5960    enum FDSize
    6061    {
    61         FDSize_2_88M,
     62        //FDSize_2_88M,
    6263        FDSize_1_44M,
    6364        FDSize_1_2M,
     
    6768    void                prepare();
    6869    QString             getDefaultFolder() const;
     70
    6971    UIFilePathSelector *m_pFilePathselector;
    70     QString             m_strMachineName;
    71     QString             m_strMachineFolder;
    7272    QLabel             *m_pPathLabel;
    7373    QLabel             *m_pSizeLabel;
    7474    QComboBox          *m_pSizeCombo;
    7575    QDialogButtonBox   *m_pButtonBox;
     76    QCheckBox          *m_pFormatCheckBox;
     77    QString             m_strMachineName;
     78    QString             m_strMachineFolder;
    7679    QString             m_strMediumID;
    7780};
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