VirtualBox

Changeset 28804 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 27, 2010 9:54:17 AM (15 years ago)
Author:
vboxsync
Message:

FE/VirtualBox: Expose I/O cache setting

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

Legend:

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

    r28800 r28804  
    406406    , mCtrName (aName)
    407407    , mCtrType (0)
     408    , mUseIoCache (true)
    408409{
    409410    /* Check for proper parent type */
     
    461462}
    462463
     464bool ControllerItem::ctrUseIoCache() const
     465{
     466    return mUseIoCache;
     467}
     468
    463469void ControllerItem::setCtrName (const QString &aCtrName)
    464470{
     
    469475{
    470476    mCtrType->setCtrType (aCtrType);
     477}
     478
     479void ControllerItem::setCtrUseIoCache (bool aUseIoCache)
     480{
     481    mUseIoCache = aUseIoCache;
    471482}
    472483
     
    11011112            return result;
    11021113        }
     1114        case R_CtrIoCache:
     1115        {
     1116            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1117                if (item->rtti() == AbstractItem::Type_ControllerItem)
     1118                    return static_cast <ControllerItem*> (item)->ctrUseIoCache();
     1119            return false;
     1120        }
    11031121
    11041122        case R_AttSlot:
     
    12951313                {
    12961314                    static_cast <ControllerItem*> (item)->setCtrType (aValue.value <KStorageControllerType>());
     1315                    emit dataChanged (aIndex, aIndex);
     1316                    return true;
     1317                }
     1318            return false;
     1319        }
     1320        case R_CtrIoCache:
     1321        {
     1322            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1323                if (item->rtti() == AbstractItem::Type_ControllerItem)
     1324                {
     1325                    static_cast <ControllerItem*> (item)->setCtrUseIoCache (aValue.toBool());
    12971326                    emit dataChanged (aIndex, aIndex);
    12981327                    return true;
     
    16721701    connect (mCbType, SIGNAL (activated (int)), this, SLOT (setInformation()));
    16731702    connect (mCbSlot, SIGNAL (activated (int)), this, SLOT (setInformation()));
     1703    connect (mCbIoCache, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
    16741704    connect (mCbVdi, SIGNAL (activated (int)), this, SLOT (setInformation()));
    16751705    connect (mTbVmm, SIGNAL (clicked (bool)), this, SLOT (onVmmInvoked()));
     
    17031733        QModelIndex ctrIndex = mStorageModel->addController (controllerName, controller.GetBus(), controller.GetControllerType());
    17041734        QUuid ctrId = QUuid (mStorageModel->data (ctrIndex, StorageModel::R_ItemId).toString());
     1735
     1736        bool useIoCache = true;
     1737        if (controller.GetIoBackend() == KIoBackendType_Unbuffered)
     1738            useIoCache = false;
     1739
     1740        mStorageModel->setData (ctrIndex, useIoCache, StorageModel::R_CtrIoCache);
    17051741
    17061742        CMediumAttachmentVector attachments = mMachine.GetMediumAttachmentsOfController (controllerName);
     
    17431779        KStorageBus ctrBusType = mStorageModel->data (ctrIndex, StorageModel::R_CtrBusType).value <KStorageBus>();
    17441780        KStorageControllerType ctrType = mStorageModel->data (ctrIndex, StorageModel::R_CtrType).value <KStorageControllerType>();
     1781        bool useIoCache = mStorageModel->data (ctrIndex, StorageModel::R_CtrIoCache).toBool();
    17451782        CStorageController ctr = mMachine.AddStorageController (ctrName, ctrBusType);
    17461783        ctr.SetControllerType (ctrType);
     1784        ctr.SetIoBackend(useIoCache ? KIoBackendType_Buffered : KIoBackendType_Unbuffered);
    17471785        int maxUsedPort = -1;
    17481786        for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
     
    20702108                mCbType->setCurrentIndex (ctrPos == -1 ? 0 : ctrPos);
    20712109
     2110                bool isUseIoCache = mStorageModel->data (index, StorageModel::R_CtrIoCache).toBool();
     2111                mCbIoCache->setChecked(isUseIoCache);
     2112
    20722113                /* Showing Controller Page */
    20732114                mSwRightPane->setCurrentIndex (1);
     
    21602201                mStorageModel->setData (index, QVariant::fromValue (vboxGlobal().toControllerType (mCbType->currentText())),
    21612202                                        StorageModel::R_CtrType);
     2203            else if (sdr == mCbIoCache)
     2204                mStorageModel->setData (index, mCbIoCache->isChecked(), StorageModel::R_CtrIoCache);
    21622205            break;
    21632206        }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.h

    r28800 r28804  
    297297    KStorageControllerType ctrType() const;
    298298    ControllerTypeList ctrTypes() const;
     299    bool ctrUseIoCache() const;
    299300
    300301    void setCtrName (const QString &aCtrName);
    301302    void setCtrType (KStorageControllerType aCtrType);
     303    void setCtrUseIoCache (bool aUseIoCache);
    302304
    303305    SlotsList ctrAllSlots() const;
     
    322324    QString mCtrName;
    323325    AbstractControllerType *mCtrType;
     326    bool mUseIoCache;
    324327    QList <AbstractItem*> mAttachments;
    325328};
     
    419422        R_CtrDevices,
    420423        R_CtrBusType,
     424        R_CtrIoCache,
    421425
    422426        R_AttSlot,
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsHD.ui

    r28800 r28804  
    209209         </widget>
    210210        </item>
    211         <item row="3" column="0" colspan="3" >
     211        <item row="3" column="2" >
     212         <widget class="QCheckBox" name="mCbIoCache" >
     213          <property name="whatsThis" >
     214           <string>Allows to use host I/O caching capabilities.</string>
     215          </property>
     216          <property name="text" >
     217           <string>Use host I/O cache</string>
     218          </property>
     219         </widget>
     220        </item>
     221        <item row="4" column="0" colspan="3" >
    212222         <spacer name="mSp3" >
    213223          <property name="orientation" >
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp

    r28800 r28804  
    668668    /* Create default storage controllers */
    669669    QString ctrName = VBoxVMSettingsHD::tr("Storage Controller");
    670     KStorageBus ideBus = KStorageBus_IDE;
     670    KStorageBus storageBus = type.GetRecommendedStorageBus();
    671671
    672672    // Add storage controller
    673     m_Machine.AddStorageController(ctrName, ideBus);
     673    m_Machine.AddStorageController(ctrName, storageBus);
    674674
    675675    // Set storage controller type
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