VirtualBox

Changeset 87859 in vbox


Ignore:
Timestamp:
Feb 24, 2021 1:01:12 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9950. Further refactoring

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

Legend:

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

    r82968 r87859  
    1818/* Qt includes: */
    1919#include <QVariant>
    20 
     20#include <QPushButton>
    2121/* GUI includes: */
    2222#include "UICommon.h"
     
    4949    assignBackground(":/wizard_new_harddisk_bg.png");
    5050#endif /* VBOX_WS_MAC */
     51    QPushButton *pButton = new QPushButton("boooo");
     52    setSideWidget(pButton);
     53
    5154}
    5255
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.cpp

    r87850 r87859  
    145145}
    146146
     147void UIWizardNewVDPage1::retranslateWidgets()
     148{
     149    QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons();
     150    for (int i = 0; i < buttons.size(); ++i)
     151    {
     152        QAbstractButton *pButton = buttons[i];
     153        UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]);
     154        pButton->setText(gpConverter->toString(enmFormat));
     155    }
     156}
     157
    147158UIWizardNewVDPageBasic1::UIWizardNewVDPageBasic1()
    148159{
     
    169180void UIWizardNewVDPageBasic1::retranslateUi()
    170181{
     182    retranslateWidgets();
    171183    /* Translate page: */
    172     setTitle(UIWizardNewVD::tr("Hard disk file type"));
     184    setTitle(UIWizardNewVD::tr("Virtual Hard disk file type"));
    173185
    174186    /* Translate widgets: */
     
    176188                                        "for the new virtual hard disk. If you do not need to use it "
    177189                                        "with other virtualization software you can leave this setting unchanged."));
    178     QList<QAbstractButton*> buttons = m_pFormatButtonGroup->buttons();
    179     for (int i = 0; i < buttons.size(); ++i)
    180     {
    181         QAbstractButton *pButton = buttons[i];
    182         UIMediumFormat enmFormat = gpConverter->fromInternalString<UIMediumFormat>(m_formatNames[m_pFormatButtonGroup->id(pButton)]);
    183         pButton->setText(gpConverter->toString(enmFormat));
    184     }
    185190}
    186191
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.h

    r87850 r87859  
    5252    CMediumFormat mediumFormat() const;
    5353    void setMediumFormat(const CMediumFormat &mediumFormat);
     54    void retranslateWidgets();
    5455
    5556    /* Variables: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.cpp

    r82968 r87859  
    7272}
    7373
     74void UIWizardNewVDPage2::retranslateWidgets()
     75{
     76    m_pDynamicalButton->setText(UIWizardNewVD::tr("&Dynamically allocated"));
     77    m_pFixedButton->setText(UIWizardNewVD::tr("&Fixed size"));
     78    m_pSplitBox->setText(UIWizardNewVD::tr("&Split into files of less than 2GB"));
     79}
     80
    7481UIWizardNewVDPageBasic2::UIWizardNewVDPageBasic2()
    7582{
     
    119126void UIWizardNewVDPageBasic2::retranslateUi()
    120127{
     128    retranslateWidgets();
    121129    /* Translate page: */
    122130    setTitle(UIWizardNewVD::tr("Storage on physical hard disk"));
     
    134142                                             "virtual machine on removable USB devices or old systems, some of which cannot "
    135143                                             "handle very large files."));
    136     m_pDynamicalButton->setText(UIWizardNewVD::tr("&Dynamically allocated"));
    137     m_pFixedButton->setText(UIWizardNewVD::tr("&Fixed size"));
    138     m_pSplitBox->setText(UIWizardNewVD::tr("&Split into files of less than 2GB"));
    139144}
    140145
     
    168173    return mediumVariant() != (qulonglong)KMediumVariant_Max;
    169174}
    170 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.h

    r82968 r87859  
    4343    qulonglong mediumVariant() const;
    4444    void setMediumVariant(qulonglong uMediumVariant);
     45    void retranslateWidgets();
    4546
    4647    /* Widgets: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp

    r87850 r87859  
    5252    , m_uMediumSizeMin(_4M)
    5353    , m_uMediumSizeMax(uiCommon().virtualBox().GetSystemProperties().GetInfoVDSize())
     54    , m_pLocationEditor(0)
     55    , m_pLocationOpenButton(0)
     56    , m_pEditorSize(0)
     57
    5458{
    5559}
     
    102106        if (QFileInfo(strChosenFilePath).suffix().isEmpty())
    103107            strChosenFilePath += QString(".%1").arg(m_strDefaultExtension);
    104         m_pLocationEditor->setText(QDir::toNativeSeparators(strChosenFilePath));
    105         m_pLocationEditor->selectAll();
    106         m_pLocationEditor->setFocus();
     108        if (m_pLocationEditor)
     109        {
     110            m_pLocationEditor->setText(QDir::toNativeSeparators(strChosenFilePath));
     111            m_pLocationEditor->selectAll();
     112            m_pLocationEditor->setFocus();
     113        }
    107114    }
    108115}
     
    200207QString UIWizardNewVDPage3::mediumPath() const
    201208{
     209    if (!m_pLocationEditor)
     210        return QString();
    202211    return absoluteFilePath(toFileName(m_pLocationEditor->text(), m_strDefaultExtension), m_strDefaultPath);
    203212}
     
    205214qulonglong UIWizardNewVDPage3::mediumSize() const
    206215{
    207     return m_pEditorSize->mediumSize();
     216    return m_pEditorSize ? m_pEditorSize->mediumSize() : 0;
    208217}
    209218
    210219void UIWizardNewVDPage3::setMediumSize(qulonglong uMediumSize)
    211220{
    212     m_pEditorSize->setMediumSize(uMediumSize);
     221    if (m_pEditorSize)
     222        m_pEditorSize->setMediumSize(uMediumSize);
     223}
     224
     225void UIWizardNewVDPage3::retranslateWidgets()
     226{
     227    if (m_pLocationOpenButton)
     228        m_pLocationOpenButton->setToolTip(UIWizardNewVD::tr("Choose a location for new virtual hard disk file..."));
    213229}
    214230
     
    259275void UIWizardNewVDPageBasic3::retranslateUi()
    260276{
     277    retranslateWidgets();
    261278    /* Translate page: */
    262279    setTitle(UIWizardNewVD::tr("File location and size"));
     
    265282    m_pLocationLabel->setText(UIWizardNewVD::tr("Please type the name of the new virtual hard disk file into the box below or "
    266283                                                "click on the folder icon to select a different folder to create the file in."));
    267     m_pLocationOpenButton->setToolTip(UIWizardNewVD::tr("Choose a location for new virtual hard disk file..."));
    268     m_pSizeLabel->setText(UIWizardNewVD::tr("Select the size of the virtual hard disk in megabytes. "
    269                                             "This size is the limit on the amount of file data "
    270                                             "that a virtual machine will be able to store on the hard disk."));
     284    if (m_pSizeLabel)
     285        m_pSizeLabel->setText(UIWizardNewVD::tr("Select the size of the virtual hard disk in megabytes. "
     286                                                "This size is the limit on the amount of file data "
     287                                                "that a virtual machine will be able to store on the hard disk."));
    271288}
    272289
     
    279296    m_strDefaultExtension = defaultExtension(field("mediumFormat").value<CMediumFormat>());
    280297    /* Set default name as text for location editor: */
    281     m_pLocationEditor->setText(absoluteFilePath(m_strDefaultName, m_strDefaultPath, m_strDefaultExtension));
     298    if (m_pLocationEditor)
     299        m_pLocationEditor->setText(absoluteFilePath(m_strDefaultName, m_strDefaultPath, m_strDefaultExtension));
    282300}
    283301
    284302bool UIWizardNewVDPageBasic3::isComplete() const
    285303{
     304    if (!m_pLocationEditor)
     305        return false;
    286306    /* Make sure current name is not empty and current size feats the bounds: */
    287307    return !m_pLocationEditor->text().trimmed().isEmpty() &&
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h

    r87775 r87859  
    6565    qulonglong mediumSize() const;
    6666    void setMediumSize(qulonglong uMediumSize);
     67    void retranslateWidgets();
    6768
    6869    /* Variables: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r87850 r87859  
    197197void UIWizardNewVDPageExpert::retranslateUi()
    198198{
     199    UIWizardNewVDPage1::retranslateWidgets();
     200    UIWizardNewVDPage2::retranslateWidgets();
     201    UIWizardNewVDPage3::retranslateWidgets();
    199202    /* Translate widgets: */
    200203    if (m_pLocationGroupBox)
    201204        m_pLocationGroupBox->setTitle(UIWizardNewVD::tr("File &location"));
    202     if (m_pLocationOpenButton)
    203         m_pLocationOpenButton->setToolTip(UIWizardNewVD::tr("Choose a location for new virtual hard disk file..."));
    204205    if (m_pSizeGroupBox)
    205206        m_pSizeGroupBox->setTitle(UIWizardNewVD::tr("File &size"));
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