VirtualBox

Changeset 23225 in vbox


Ignore:
Timestamp:
Sep 22, 2009 4:02:40 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: merged New Storage UI: 'Show Diffs' support.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsHD.h

    r23223 r23225  
    320320    QString attMediumId() const;
    321321    QStringList attMediumIds (bool aFilter = true) const;
     322    bool attIsShowDiffs() const;
    322323    bool attIsHostDrive() const;
    323324    bool attIsPassthrough() const;
     
    326327    void setAttDevice (KDeviceType aAttDeviceType);
    327328    void setAttMediumId (const QString &aAttMediumId);
     329    void setAttIsShowDiffs (bool aAttIsShowDiffs);
    328330    void setAttIsPassthrough (bool aPassthrough);
    329331
     
    336338private:
    337339
    338     void cache (const VBoxMedium &aMedium);
     340    void cache();
    339341
    340342    void addChild (AbstractItem *aItem);
     
    345347    StorageSlot mAttSlot;
    346348    QString mAttMediumId;
     349    bool mAttIsShowDiffs;
    347350    bool mAttIsHostDrive;
    348351    bool mAttIsPassthrough;
     
    391394        R_AttDevices,
    392395        R_AttMediumId,
     396        R_AttIsShowDiffs,
    393397        R_AttIsHostDrive,
    394398        R_AttIsPassthrough,
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp

    r23223 r23225  
    775775
    776776            item->setMedium (aMedium);
     777
     778            /* Check if swapped diff disk is required one */
     779            if (item->id() == mHDSelectedId)
     780            {
     781                setCurrentItem (mHardDiskView, item);
     782                mHDSelectedId = QString::null;
     783            }
     784
    777785            updateTabIcons (item, ItemAction_Updated);
    778786            return;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsHD.cpp

    r23223 r23225  
    556556    : AbstractItem (aParent)
    557557    , mAttDeviceType (aDeviceType)
     558    , mAttIsShowDiffs (false)
    558559    , mAttIsHostDrive (false)
    559560    , mAttIsPassthrough (false)
     
    701702}
    702703
     704bool AttachmentItem::attIsShowDiffs() const
     705{
     706    return mAttIsShowDiffs;
     707}
     708
    703709bool AttachmentItem::attIsHostDrive() const
    704710{
     
    732738        medium = vboxGlobal().findMedium (aAttMediumId);
    733739
    734     cache (medium);
     740    mAttMediumId = medium.id();
     741    cache();
     742}
     743
     744void AttachmentItem::setAttIsShowDiffs (bool aAttIsShowDiffs)
     745{
     746    mAttIsShowDiffs = aAttIsShowDiffs;
     747    cache();
    735748}
    736749
     
    765778}
    766779
    767 void AttachmentItem::cache (const VBoxMedium &aMedium)
    768 {
    769     mAttMediumId = aMedium.id();
     780void AttachmentItem::cache()
     781{
     782    VBoxMedium medium = vboxGlobal().findMedium (mAttMediumId);
    770783
    771784    /* Cache medium information */
    772     mAttName = aMedium.name (true);
    773     mAttTip = aMedium.toolTipCheckRO (true);
    774     mAttPixmap = aMedium.iconCheckRO (true);
    775     mAttIsHostDrive = aMedium.isHostDrive();
     785    mAttName = medium.name (!mAttIsShowDiffs);
     786    mAttTip = medium.toolTipCheckRO (!mAttIsShowDiffs);
     787    mAttPixmap = medium.iconCheckRO (!mAttIsShowDiffs);
     788    mAttIsHostDrive = medium.isHostDrive();
    776789
    777790    /* Cache additional information */
    778     mAttSize = aMedium.size();
    779     mAttLogicalSize = aMedium.logicalSize();
    780     mAttLocation = aMedium.location();
    781     mAttFormat = QString ("%1 (%2)").arg (aMedium.hardDiskType()).arg (aMedium.hardDiskFormat());
    782     mAttUsage = aMedium.usage();
     791    mAttSize = medium.size (!mAttIsShowDiffs);
     792    mAttLogicalSize = medium.logicalSize (!mAttIsShowDiffs);
     793    mAttLocation = medium.location (!mAttIsShowDiffs);
     794    mAttFormat = QString ("%1 (%2)").arg (medium.hardDiskType (!mAttIsShowDiffs))
     795                                    .arg (medium.hardDiskFormat (!mAttIsShowDiffs));
     796    mAttUsage = medium.usage (!mAttIsShowDiffs);
    783797
    784798    /* Fill empty attributes */
     
    10291043            return QString();
    10301044        }
     1045        case R_AttIsShowDiffs:
     1046        {
     1047            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1048                if (item->rtti() == AbstractItem::Type_AttachmentItem)
     1049                    return static_cast <AttachmentItem*> (item)->attIsShowDiffs();
     1050            return false;
     1051        }
    10311052        case R_AttIsHostDrive:
    10321053        {
     
    12191240                {
    12201241                    static_cast <AttachmentItem*> (item)->setAttMediumId (aValue.toString());
     1242                    emit dataChanged (aIndex, aIndex);
     1243                    return true;
     1244                }
     1245            return false;
     1246        }
     1247        case R_AttIsShowDiffs:
     1248        {
     1249            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1250                if (item->rtti() == AbstractItem::Type_AttachmentItem)
     1251                {
     1252                    static_cast <AttachmentItem*> (item)->setAttIsShowDiffs (aValue.toBool());
    12211253                    emit dataChanged (aIndex, aIndex);
    12221254                    return true;
     
    15201552    connect (mCbVdi, SIGNAL (activated (int)), this, SLOT (setInformation()));
    15211553    connect (mTbVmm, SIGNAL (clicked (bool)), this, SLOT (onVmmInvoked()));
     1554    connect (mCbShowDiffs, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
    15221555    connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
    15231556
     
    15361569{
    15371570    mMachine = aMachine;
     1571
     1572    /* Set the machine id for the media-combo */
     1573    mCbVdi->setMachineId (mMachine.GetId());
    15381574
    15391575    /* Load currently present controllers & attachments */
     
    17891825                mCbDevice->setCurrentIndex (attDevicePos == -1 ? 0 : attDevicePos);
    17901826
     1827                /* Getting Show Diffs state */
     1828                bool isShowDiffs = mStorageModel->data (index, StorageModel::R_AttIsShowDiffs).toBool();
     1829                mCbShowDiffs->setChecked (isShowDiffs);
     1830
    17911831                /* Getting Attachment Medium */
    17921832                mCbVdi->setType (typeToLocal (device));
     1833                mCbVdi->setShowDiffs (isShowDiffs);
    17931834                mCbVdi->setCurrentItem (mStorageModel->data (index, StorageModel::R_AttMediumId).toString());
    17941835                mCbVdi->refresh();
     
    18371878            /* Setting Controller Sub-Type */
    18381879            else if (sdr == mCbType)
    1839             {
    1840                 KStorageControllerType type = vboxGlobal().toControllerType (mCbType->currentText());
    1841                 mStorageModel->setData (index, QVariant::fromValue (type), StorageModel::R_CtrType);
    1842             }
     1880                mStorageModel->setData (index, QVariant::fromValue (vboxGlobal().toControllerType (mCbType->currentText())),
     1881                                        StorageModel::R_CtrType);
    18431882            break;
    18441883        }
     
    18471886            /* Setting Attachment Slot */
    18481887            if (sdr == mCbSlot)
    1849             {
    1850                 StorageSlot slt = vboxGlobal().toStorageSlot (mCbSlot->currentText());
    1851                 mStorageModel->setData (index, QVariant::fromValue (slt), StorageModel::R_AttSlot);
    1852             }
     1888                mStorageModel->setData (index, QVariant::fromValue (vboxGlobal().toStorageSlot (mCbSlot->currentText())),
     1889                                        StorageModel::R_AttSlot);
    18531890            /* Setting Attachment Device-Type */
    18541891            else if (sdr == mCbDevice)
     
    18571894                mStorageModel->setData (index, QVariant::fromValue (device), StorageModel::R_AttDevice);
    18581895                mCbVdi->setType (typeToLocal (device));
     1896                mCbVdi->setShowDiffs (mCbShowDiffs->isChecked());
    18591897                mCbVdi->refresh();
    18601898            }
     
    18621900            else if (sdr == mCbVdi)
    18631901                mStorageModel->setData (index, mCbVdi->id(), StorageModel::R_AttMediumId);
     1902            else if (sdr == mCbShowDiffs)
     1903                mStorageModel->setData (index, mCbShowDiffs->isChecked(), StorageModel::R_AttIsShowDiffs);
    18641904            else if (sdr == mCbPassthrough)
    18651905            {
     
    20782118               false /* do refresh? */,
    20792119               mMachine,
    2080                QString(),
    2081                false);
     2120               mCbVdi->id(),
     2121               mCbShowDiffs->isChecked());
    20822122
    20832123    return dlg.exec() == QDialog::Accepted ? dlg.selectedId() : QString();
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