VirtualBox

Changeset 106045 in vbox


Ignore:
Timestamp:
Sep 13, 2024 12:38:14 PM (7 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
164802
Message:

FE/Qt: bugref:10513: VM Settings / Storage page: Make sure attachment option check-boxes properly located at corresponding pages of stacked-layout; That is necessary to prevent page-size and layout jumping while switching between HD, CD and FD attachment types.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.cpp

    r105820 r106045  
    29572957    , m_pComboSlot(0)
    29582958    , m_pToolButtonOpen(0)
     2959    , m_pContainerForCheckBoxes1(0)
     2960    , m_pContainerForCheckBoxes2(0)
    29592961    , m_pCheckBoxPassthrough(0)
    29602962    , m_pCheckBoxTempEject(0)
     
    36883690                m_pToolButtonOpen->setEnabled(fIsEditable);
    36893691
     3692                /* Prepare setting #1 to show: */
     3693                int iIndexForSetting1 = 0;
    36903694                /* Getting passthrough state: */
    36913695                const bool fHostDrive = pModel->data(index, StorageModel::R_AttIsHostDrive).toBool();
    3692                 m_pCheckBoxPassthrough->setVisible(enmDeviceType == KDeviceType_DVD && fHostDrive);
     3696                if (enmDeviceType == KDeviceType_DVD && fHostDrive)
     3697                    iIndexForSetting1 = 1;
    36933698                m_pCheckBoxPassthrough->setChecked(fHostDrive && pModel->data(index, StorageModel::R_AttIsPassthrough).toBool());
    3694 
    36953699                /* Getting temp-eject state: */
    3696                 m_pCheckBoxTempEject->setVisible(enmDeviceType == KDeviceType_DVD && !fHostDrive);
     3700                if (enmDeviceType == KDeviceType_DVD && !fHostDrive)
     3701                    iIndexForSetting1 = 2;
    36973702                m_pCheckBoxTempEject->setChecked(!fHostDrive && pModel->data(index, StorageModel::R_AttIsTempEject).toBool());
    3698 
    36993703                /* Getting non-rotational state: */
    3700                 m_pCheckBoxNonRotational->setVisible(enmDeviceType == KDeviceType_HardDisk);
     3704                if (enmDeviceType == KDeviceType_HardDisk)
     3705                    iIndexForSetting1 = 3;
    37013706                m_pCheckBoxNonRotational->setChecked(pModel->data(index, StorageModel::R_AttIsNonRotational).toBool());
    3702 
     3707                /* Trigger setting #1 to show: */
     3708                m_pContainerForCheckBoxes1->setCurrentIndex(iIndexForSetting1);
     3709
     3710                /* Prepare setting #2 to show: */
     3711                int iIndexForSetting2 = 0;
    37033712                /* Fetch hot-pluggable state: */
    3704                 m_pCheckBoxHotPluggable->setVisible(slt.bus == KStorageBus_SATA);
     3713                if (slt.bus == KStorageBus_SATA)
     3714                    iIndexForSetting2 = 1;
    37053715                m_pCheckBoxHotPluggable->setChecked(fIsHotPluggable);
     3716                /* Trigger setting #2 to show: */
     3717                m_pContainerForCheckBoxes2->setCurrentIndex(iIndexForSetting2);
    37063718
    37073719                /* Update optional widgets visibility: */
     
    48094821            m_pLayoutAttachment->setContentsMargins(10, 0, 0, 0);
    48104822            m_pLayoutAttachment->setColumnStretch(2, 1);
    4811             m_pLayoutAttachment->setRowStretch(13, 1);
     4823            m_pLayoutAttachment->setRowStretch(14, 1);
    48124824
    48134825            /* Prepare separator for attachment case: */
     
    48544866            }
    48554867
    4856             /* Prepare attachment settings layout: */
    4857             QVBoxLayout *pLayoutAttachmentSettings = new QVBoxLayout;
    4858             if (pLayoutAttachmentSettings)
    4859             {
    4860                 pLayoutAttachmentSettings->setContentsMargins(0, 0, 0, 0);
     4868            /* Prepare attachment settings container #1: */
     4869            m_pContainerForCheckBoxes1 = new QStackedWidget(pWidgetAttachment);
     4870            if (m_pContainerForCheckBoxes1)
     4871            {
     4872                /* Prepare placeholder: */
     4873                m_pContainerForCheckBoxes1->addWidget(new QWidget);
    48614874
    48624875                /* Prepare attachment passthrough check-box: */
    4863                 m_pCheckBoxPassthrough = new QCheckBox(pWidgetAttachment);
     4876                m_pCheckBoxPassthrough = new QCheckBox(m_pContainerForCheckBoxes1);
    48644877                if (m_pCheckBoxPassthrough)
    4865                 {
    4866                     m_pCheckBoxPassthrough->hide();
    4867                     pLayoutAttachmentSettings->addWidget(m_pCheckBoxPassthrough);
    4868                 }
     4878                    m_pContainerForCheckBoxes1->addWidget(m_pCheckBoxPassthrough);
    48694879
    48704880                /* Prepare attachment temporary eject check-box: */
    4871                 m_pCheckBoxTempEject = new QCheckBox(pWidgetAttachment);
     4881                m_pCheckBoxTempEject = new QCheckBox(m_pContainerForCheckBoxes1);
    48724882                if (m_pCheckBoxTempEject)
    4873                 {
    4874                     m_pCheckBoxTempEject->hide();
    4875                     pLayoutAttachmentSettings->addWidget(m_pCheckBoxTempEject);
    4876                 }
     4883                    m_pContainerForCheckBoxes1->addWidget(m_pCheckBoxTempEject);
    48774884
    48784885                /* Prepare attachment non rotational check-box: */
    4879                 m_pCheckBoxNonRotational = new QCheckBox(pWidgetAttachment);
     4886                m_pCheckBoxNonRotational = new QCheckBox(m_pContainerForCheckBoxes1);
    48804887                if (m_pCheckBoxNonRotational)
    4881                 {
    4882                     m_pCheckBoxNonRotational->hide();
    4883                     pLayoutAttachmentSettings->addWidget(m_pCheckBoxNonRotational);
    4884                 }
     4888                    m_pContainerForCheckBoxes1->addWidget(m_pCheckBoxNonRotational);
     4889
     4890                m_pLayoutAttachment->addWidget(m_pContainerForCheckBoxes1, 2, 2);
     4891            }
     4892
     4893            /* Prepare attachment settings container #2: */
     4894            m_pContainerForCheckBoxes2 = new QStackedWidget(pWidgetAttachment);
     4895            if (m_pContainerForCheckBoxes2)
     4896            {
     4897                /* Prepare placeholder: */
     4898                m_pContainerForCheckBoxes2->addWidget(new QWidget);
    48854899
    48864900                /* Prepare attachment hot pluggable check-box: */
    4887                 m_pCheckBoxHotPluggable = new QCheckBox(pWidgetAttachment);
     4901                m_pCheckBoxHotPluggable = new QCheckBox(m_pContainerForCheckBoxes2);
    48884902                if (m_pCheckBoxHotPluggable)
    4889                 {
    4890                     m_pCheckBoxHotPluggable->hide();
    4891                     pLayoutAttachmentSettings->addWidget(m_pCheckBoxHotPluggable);
    4892                 }
    4893 
    4894                 m_pLayoutAttachment->addLayout(pLayoutAttachmentSettings, 2, 2);
     4903                    m_pContainerForCheckBoxes2->addWidget(m_pCheckBoxHotPluggable);
     4904
     4905                m_pLayoutAttachment->addWidget(m_pContainerForCheckBoxes2, 3, 2);
    48954906            }
    48964907
     
    48984909            m_pLabelSeparatorInformation = new QILabelSeparator(pWidgetAttachment);
    48994910            if (m_pLabelSeparatorInformation)
    4900                 m_pLayoutAttachment->addWidget(m_pLabelSeparatorInformation, 3, 0, 1, 3);
     4911                m_pLayoutAttachment->addWidget(m_pLabelSeparatorInformation, 4, 0, 1, 3);
    49014912
    49024913            /* Prepare HD format label: */
     
    49054916            {
    49064917                m_pLabelHDFormat->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    4907                 m_pLayoutAttachment->addWidget(m_pLabelHDFormat, 4, 1);
     4918                m_pLayoutAttachment->addWidget(m_pLabelHDFormat, 5, 1);
    49084919            }
    49094920            /* Prepare HD format field: */
     
    49134924                m_pFieldHDFormat->setFullSizeSelection(true);
    49144925                m_pFieldHDFormat->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    4915                 m_pLayoutAttachment->addWidget(m_pFieldHDFormat, 4, 2);
     4926                m_pLayoutAttachment->addWidget(m_pFieldHDFormat, 5, 2);
    49164927            }
    49174928
     
    49214932            {
    49224933                m_pLabelCDFDType->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    4923                 m_pLayoutAttachment->addWidget(m_pLabelCDFDType, 5, 1);
     4934                m_pLayoutAttachment->addWidget(m_pLabelCDFDType, 6, 1);
    49244935            }
    49254936            /* Prepare CD/FD type field: */
     
    49294940                m_pFieldCDFDType->setFullSizeSelection(true);
    49304941                m_pFieldCDFDType->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    4931                 m_pLayoutAttachment->addWidget(m_pFieldCDFDType, 5, 2);
     4942                m_pLayoutAttachment->addWidget(m_pFieldCDFDType, 6, 2);
    49324943            }
    49334944
     
    49374948            {
    49384949                m_pLabelHDVirtualSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    4939                 m_pLayoutAttachment->addWidget(m_pLabelHDVirtualSize, 6, 1);
     4950                m_pLayoutAttachment->addWidget(m_pLabelHDVirtualSize, 7, 1);
    49404951            }
    49414952            /* Prepare HD virtual size field: */
     
    49454956                m_pFieldHDVirtualSize->setFullSizeSelection(true);
    49464957                m_pFieldHDVirtualSize->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    4947                 m_pLayoutAttachment->addWidget(m_pFieldHDVirtualSize, 6, 2);
     4958                m_pLayoutAttachment->addWidget(m_pFieldHDVirtualSize, 7, 2);
    49484959            }
    49494960
     
    49534964            {
    49544965                m_pLabelHDActualSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    4955                 m_pLayoutAttachment->addWidget(m_pLabelHDActualSize, 7, 1);
     4966                m_pLayoutAttachment->addWidget(m_pLabelHDActualSize, 8, 1);
    49564967            }
    49574968            /* Prepare HD actual size field: */
     
    49614972                m_pFieldHDActualSize->setFullSizeSelection(true);
    49624973                m_pFieldHDActualSize->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    4963                 m_pLayoutAttachment->addWidget(m_pFieldHDActualSize, 7, 2);
     4974                m_pLayoutAttachment->addWidget(m_pFieldHDActualSize, 8, 2);
    49644975            }
    49654976
     
    49694980            {
    49704981                m_pLabelCDFDSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    4971                 m_pLayoutAttachment->addWidget(m_pLabelCDFDSize, 8, 1);
     4982                m_pLayoutAttachment->addWidget(m_pLabelCDFDSize, 9, 1);
    49724983            }
    49734984            /* Prepare CD/FD size field: */
     
    49774988                m_pFieldCDFDSize->setFullSizeSelection(true);
    49784989                m_pFieldCDFDSize->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    4979                 m_pLayoutAttachment->addWidget(m_pFieldCDFDSize, 8, 2);
     4990                m_pLayoutAttachment->addWidget(m_pFieldCDFDSize, 9, 2);
    49804991            }
    49814992
     
    49854996            {
    49864997                m_pLabelHDDetails->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    4987                 m_pLayoutAttachment->addWidget(m_pLabelHDDetails, 9, 1);
     4998                m_pLayoutAttachment->addWidget(m_pLabelHDDetails, 10, 1);
    49884999            }
    49895000            /* Prepare HD details field: */
     
    49935004                m_pFieldHDDetails->setFullSizeSelection(true);
    49945005                m_pFieldHDDetails->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    4995                 m_pLayoutAttachment->addWidget(m_pFieldHDDetails, 9, 2);
     5006                m_pLayoutAttachment->addWidget(m_pFieldHDDetails, 10, 2);
    49965007            }
    49975008
     
    50015012            {
    50025013                m_pLabelLocation->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    5003                 m_pLayoutAttachment->addWidget(m_pLabelLocation, 10, 1);
     5014                m_pLayoutAttachment->addWidget(m_pLabelLocation, 11, 1);
    50045015            }
    50055016            /* Prepare location field: */
     
    50095020                m_pFieldLocation->setFullSizeSelection(true);
    50105021                m_pFieldLocation->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    5011                 m_pLayoutAttachment->addWidget(m_pFieldLocation, 10, 2);
     5022                m_pLayoutAttachment->addWidget(m_pFieldLocation, 11, 2);
    50125023            }
    50135024
     
    50175028            {
    50185029                m_pLabelUsage->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    5019                 m_pLayoutAttachment->addWidget(m_pLabelUsage, 11, 1);
     5030                m_pLayoutAttachment->addWidget(m_pLabelUsage, 12, 1);
    50205031            }
    50215032            /* Prepare usage field: */
     
    50255036                m_pFieldUsage->setFullSizeSelection(true);
    50265037                m_pFieldUsage->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    5027                 m_pLayoutAttachment->addWidget(m_pFieldUsage, 11, 2);
     5038                m_pLayoutAttachment->addWidget(m_pFieldUsage, 12, 2);
    50285039            }
    50295040
     
    50335044            {
    50345045                m_pLabelEncryption->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    5035                 m_pLayoutAttachment->addWidget(m_pLabelEncryption, 12, 1);
     5046                m_pLayoutAttachment->addWidget(m_pLabelEncryption, 13, 1);
    50365047            }
    50375048            /* Prepare encryption field: */
     
    50415052                m_pFieldEncryption->setFullSizeSelection(true);
    50425053                m_pFieldEncryption->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
    5043                 m_pLayoutAttachment->addWidget(m_pFieldEncryption, 12, 2);
     5054                m_pLayoutAttachment->addWidget(m_pFieldEncryption, 13, 2);
    50445055            }
    50455056
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.h

    r104371 r106045  
    483483        /** Holds the open tool-button instance. */
    484484        QIToolButton     *m_pToolButtonOpen;
     485        /** Holds the 1st check-box container instance. */
     486        QStackedWidget   *m_pContainerForCheckBoxes1;
     487        /** Holds the 2nd check-box container instance. */
     488        QStackedWidget   *m_pContainerForCheckBoxes2;
    485489        /** Holds the passthrough check-box instance. */
    486490        QCheckBox        *m_pCheckBoxPassthrough;
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