VirtualBox

Changeset 33932 in vbox


Ignore:
Timestamp:
Nov 10, 2010 12:33:46 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67590
Message:

FE/Qt: Machine settings / System & Storage pages correlation.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
5 edited

Legend:

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

    r33882 r33932  
    892892#endif /* !VBOX_OSE */
    893893
     894    if (pPage == m_pSelector->idToPage(VMSettingsPage_Storage))
     895    {
     896        /* Get System & Storage pages: */
     897        UIMachineSettingsSystem *pSystemPage =
     898            qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(VMSettingsPage_System));
     899        UIMachineSettingsStorage *pStoragePage =
     900            qobject_cast<UIMachineSettingsStorage*>(m_pSelector->idToPage(VMSettingsPage_Storage));
     901        if (pSystemPage && pStoragePage)
     902        {
     903            /* Update chiset type for the Storage settings page: */
     904            if (pStoragePage->chipsetType() != pSystemPage->chipsetType())
     905                pStoragePage->setChipsetType(pSystemPage->chipsetType());
     906            /* Check for excessive controllers on Storage page controllers list: */
     907            QStringList excessiveList;
     908            QMap<KStorageBus, int> currentType = pStoragePage->currentControllerTypes();
     909            QMap<KStorageBus, int> maximumType = pStoragePage->maximumControllerTypes();
     910            for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType)
     911            {
     912                if (currentType[(KStorageBus)iStorageBusType] > maximumType[(KStorageBus)iStorageBusType])
     913                {
     914                    QString strExcessiveRecord = QString("%1 (%2)");
     915                    strExcessiveRecord = strExcessiveRecord.arg(QString("<b>%1</b>").arg(vboxGlobal().toString((KStorageBus)iStorageBusType)));
     916                    strExcessiveRecord = strExcessiveRecord.arg(maximumType[(KStorageBus)iStorageBusType] == 1 ?
     917                                                                tr("at most one supported") :
     918                                                                tr("up to %1 supported").arg(maximumType[(KStorageBus)iStorageBusType]));
     919                    excessiveList << strExcessiveRecord;
     920                }
     921            }
     922            if (!excessiveList.isEmpty())
     923            {
     924                strWarning = tr(
     925                    "you are currently using more storage controllers than a %1 chipset supports. "
     926                    "Please change the chipset type on the System settings page or reduce the number "
     927                    "of the following storage controllers on the Storage settings page: %2.")
     928                    .arg(vboxGlobal().toString(pStoragePage->chipsetType()))
     929                    .arg(excessiveList.join(", "));
     930                return false;
     931            }
     932        }
     933    }
     934
    894935    return true;
    895936}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r33930 r33932  
    15071507}
    15081508
     1509KChipsetType StorageModel::chipsetType() const
     1510{
     1511    return m_chipsetType;
     1512}
     1513
     1514void StorageModel::setChipsetType(KChipsetType type)
     1515{
     1516    m_chipsetType = type;
     1517}
     1518
     1519QMap<KStorageBus, int> StorageModel::currentControllerTypes() const
     1520{
     1521    QMap<KStorageBus, int> currentMap;
     1522    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType)
     1523    {
     1524        currentMap.insert((KStorageBus)iStorageBusType,
     1525                          static_cast<RootItem*>(mRootItem)->childCount((KStorageBus)iStorageBusType));
     1526    }
     1527    return currentMap;
     1528}
     1529
     1530QMap<KStorageBus, int> StorageModel::maximumControllerTypes() const
     1531{
     1532    QMap<KStorageBus, int> maximumMap;
     1533    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType)
     1534    {
     1535        maximumMap.insert((KStorageBus)iStorageBusType,
     1536                          vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), (KStorageBus)iStorageBusType));
     1537    }
     1538    return maximumMap;
     1539}
     1540
    15091541Qt::ItemFlags StorageModel::flags (const QModelIndex &aIndex) const
    15101542{
    15111543    return !aIndex.isValid() ? QAbstractItemModel::flags (aIndex) :
    15121544           Qt::ItemIsEnabled | Qt::ItemIsSelectable;
    1513 }
    1514 
    1515 KChipsetType StorageModel::chipsetType() const
    1516 {
    1517     CMachine machine = vboxGlobal().virtualBox().FindMachine(mRootItem->machineId());
    1518     Assert(!machine.isNull());
    1519     return machine.GetChipsetType();
    15201545}
    15211546
     
    17971822}
    17981823
     1824KChipsetType UIMachineSettingsStorage::chipsetType() const
     1825{
     1826    return mStorageModel->chipsetType();
     1827}
     1828
     1829void UIMachineSettingsStorage::setChipsetType(KChipsetType type)
     1830{
     1831    mStorageModel->setChipsetType(type);
     1832    updateActionsState();
     1833}
     1834
     1835QMap<KStorageBus, int> UIMachineSettingsStorage::currentControllerTypes() const
     1836{
     1837    return mStorageModel->currentControllerTypes();
     1838}
     1839
     1840QMap<KStorageBus, int> UIMachineSettingsStorage::maximumControllerTypes() const
     1841{
     1842    return mStorageModel->maximumControllerTypes();
     1843}
     1844
    17991845/* Load data to cashe from corresponding external object(s),
    18001846 * this task COULD be performed in other than GUI thread: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r33923 r33932  
    498498    QModelIndex attachmentBySlot(QModelIndex controllerIndex, StorageSlot attachmentStorageSlot);
    499499
     500    KChipsetType chipsetType() const;
     501    void setChipsetType(KChipsetType type);
     502
     503    QMap<KStorageBus, int> currentControllerTypes() const;
     504    QMap<KStorageBus, int> maximumControllerTypes() const;
     505
    500506private:
    501507
    502508    Qt::ItemFlags flags (const QModelIndex &aIndex) const;
    503 
    504     KChipsetType chipsetType() const;
    505509
    506510    AbstractItem *mRootItem;
     
    513517
    514518    ToolTipType mToolTipType;
     519
     520    KChipsetType m_chipsetType;
    515521};
    516522Q_DECLARE_METATYPE (StorageModel::ToolTipType);
     
    568574
    569575    UIMachineSettingsStorage();
     576
     577    KChipsetType chipsetType() const;
     578    void setChipsetType(KChipsetType type);
     579
     580    QMap<KStorageBus, int> currentControllerTypes() const;
     581    QMap<KStorageBus, int> maximumControllerTypes() const;
    570582
    571583signals:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r33882 r33932  
    158158{
    159159    return mCbUseAbsHID->isChecked();
     160}
     161
     162KChipsetType UIMachineSettingsSystem::chipsetType() const
     163{
     164    return (KChipsetType)mCbChipset->itemData(mCbChipset->currentIndex()).toInt();
    160165}
    161166
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r33882 r33932  
    6262    int cpuCount() const;
    6363    bool isHIDEnabled() const;
     64    KChipsetType chipsetType() const;
    6465
    6566signals:
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