VirtualBox

Changeset 79964 in vbox for trunk/src


Ignore:
Timestamp:
Jul 24, 2019 6:36:34 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7720: VM settings / System page: Move load/save boot items logic to UIBootTable where it belongs.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r79963 r79964  
    272272    /* Load old 'Motherboard' data from the cache: */
    273273    m_pSliderMemorySize->setValue(oldSystemData.m_iMemorySize);
     274    mTwBootOrder->setBootItems(oldSystemData.m_bootItems);
    274275    const int iChipsetTypePosition = m_pComboChipsetType->findData(oldSystemData.m_chipsetType);
    275276    m_pComboChipsetType->setCurrentIndex(iChipsetTypePosition == -1 ? 0 : iChipsetTypePosition);
     
    279280    m_pCheckBoxEFI->setChecked(oldSystemData.m_fEnabledEFI);
    280281    m_pCheckBoxUseUTC->setChecked(oldSystemData.m_fEnabledUTC);
    281     /* Remove any old data in the boot view: */
    282     QAbstractItemView *pItemView = qobject_cast<QAbstractItemView*>(mTwBootOrder);
    283     pItemView->model()->removeRows(0, pItemView->model()->rowCount());
    284     /* Apply internal variables data to QWidget(s): */
    285     for (int i = 0; i < oldSystemData.m_bootItems.size(); ++i)
    286     {
    287         const UIBootItemData data = oldSystemData.m_bootItems[i];
    288         QListWidgetItem *pItem = new UIBootTableItem(data.m_enmType);
    289         pItem->setCheckState(data.m_fEnabled ? Qt::Checked : Qt::Unchecked);
    290         mTwBootOrder->addItem(pItem);
    291     }
    292282
    293283    /* Load old 'Processor' data from the cache: */
     
    323313    /* Gather 'Motherboard' data: */
    324314    newSystemData.m_iMemorySize = m_pSliderMemorySize->value();
     315    newSystemData.m_bootItems = mTwBootOrder->bootItems();
    325316    newSystemData.m_chipsetType = (KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt();
    326317    newSystemData.m_pointingHIDType = (KPointingHIDType)m_pComboPointingHIDType->itemData(m_pComboPointingHIDType->currentIndex()).toInt();
     
    329320    newSystemData.m_fEnabledEFI = m_pCheckBoxEFI->isChecked();
    330321    newSystemData.m_fEnabledUTC = m_pCheckBoxUseUTC->isChecked();
    331     /* Gather boot-table data: */
    332     newSystemData.m_bootItems.clear();
    333     for (int i = 0; i < mTwBootOrder->count(); ++i)
    334     {
    335         QListWidgetItem *pItem = mTwBootOrder->item(i);
    336         UIBootItemData bootData;
    337         bootData.m_enmType = static_cast<UIBootTableItem*>(pItem)->type();
    338         bootData.m_fEnabled = pItem->checkState() == Qt::Checked;
    339         newSystemData.m_bootItems << bootData;
    340     }
    341322
    342323    /* Gather 'Processor' data: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp

    r76606 r79964  
    6565}
    6666
     67void UIBootTable::setBootItems(const UIBootItemDataList &bootItems)
     68{
     69    /* Clear initially: */
     70    clear();
     71
     72    /* Apply internal variables data to QWidget(s): */
     73    foreach (const UIBootItemData &data, bootItems)
     74    {
     75        UIBootTableItem *pItem = new UIBootTableItem(data.m_enmType);
     76        pItem->setCheckState(data.m_fEnabled ? Qt::Checked : Qt::Unchecked);
     77        addItem(pItem);
     78    }
     79}
     80
     81UIBootItemDataList UIBootTable::bootItems() const
     82{
     83    /* Prepare boot items: */
     84    UIBootItemDataList bootItems;
     85
     86    /* Enumerate all the items we have: */
     87    for (int i = 0; i < count(); ++i)
     88    {
     89        QListWidgetItem *pItem = item(i);
     90        UIBootItemData bootData;
     91        bootData.m_enmType = static_cast<UIBootTableItem*>(pItem)->type();
     92        bootData.m_fEnabled = pItem->checkState() == Qt::Checked;
     93        bootItems << bootData;
     94    }
     95
     96    /* Return boot items: */
     97    return bootItems;
     98}
     99
    67100void UIBootTable::adjustSizeToFitContent()
    68101{
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.h

    r79962 r79964  
    7777    /** Holds the item type. */
    7878    KDeviceType m_enmType;
    79 
    8079};
    8180
     
    9695    /** Constructs boot-table passing @a pParent to the base-class. */
    9796    UIBootTable(QWidget *pParent = 0);
     97
     98    /** Defines @a bootItems list. */
     99    void setBootItems(const UIBootItemDataList &bootItems);
     100    /** Returns boot item list. */
     101    UIBootItemDataList bootItems() const;
    98102
    99103    /** Adjusts table size to fit contents. */
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