VirtualBox

Changeset 37710 in vbox for trunk


Ignore:
Timestamp:
Jun 30, 2011 1:56:23 PM (13 years ago)
Author:
vboxsync
Message:

Frontends/VirtualBox: add config for controlling DVD eject in UIMachineSettingsStorage

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

Legend:

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

    r37374 r37710  
    551551    , mAttIsHostDrive (false)
    552552    , mAttIsPassthrough (false)
     553    , mAttIsTempEject (false)
    553554{
    554555    /* Check for proper parent type */
     
    604605}
    605606
     607bool AttachmentItem::attIsTempEject() const
     608{
     609    return mAttIsTempEject;
     610}
     611
    606612void AttachmentItem::setAttSlot (const StorageSlot &aAttSlot)
    607613{
     
    624630{
    625631    mAttIsPassthrough = aIsAttPassthrough;
     632}
     633
     634void AttachmentItem::setAttIsTempEject (bool aIsAttTempEject)
     635{
     636    mAttIsTempEject = aIsAttTempEject;
    626637}
    627638
     
    10781089            return false;
    10791090        }
     1091        case R_AttIsTempEject:
     1092        {
     1093            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1094                if (item->rtti() == AbstractItem::Type_AttachmentItem)
     1095                    return static_cast <AttachmentItem*> (item)->attIsTempEject();
     1096            return false;
     1097        }
    10801098        case R_AttSize:
    10811099        {
     
    12821300                {
    12831301                    static_cast <AttachmentItem*> (item)->setAttIsPassthrough (aValue.toBool());
     1302                    emit dataChanged (aIndex, aIndex);
     1303                    return true;
     1304                }
     1305            return false;
     1306        }
     1307        case R_AttIsTempEject:
     1308        {
     1309            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
     1310                if (item->rtti() == AbstractItem::Type_AttachmentItem)
     1311                {
     1312                    static_cast <AttachmentItem*> (item)->setAttIsTempEject (aValue.toBool());
    12841313                    emit dataChanged (aIndex, aIndex);
    12851314                    return true;
     
    17711800    connect (pOpenMediumMenu, SIGNAL (aboutToShow()), this, SLOT (sltPrepareOpenMediumMenu()));
    17721801    connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
     1802    connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
    17731803
    17741804    /* Applying language settings */
     
    18341864                    storageAttachmentData.m_iAttachmentDevice = attachment.GetDevice();
    18351865                    storageAttachmentData.m_fAttachmentPassthrough = attachment.GetPassthrough();
     1866                    storageAttachmentData.m_fAttachmentTempEject = attachment.GetTemporaryEject();
    18361867                    CMedium comMedium(attachment.GetMedium());
    18371868                    VBoxMedium vboxMedium;
     
    18931924            mStorageModel->setData(attachmentIndex, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
    18941925            mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough);
     1926            mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject);
    18951927        }
    18961928    }
     
    19441976            attachmentData.m_iAttachmentDevice = attachmentSlot.device;
    19451977            attachmentData.m_fAttachmentPassthrough = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool();
     1978            attachmentData.m_fAttachmentTempEject = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool();
    19461979            attachmentData.m_strAttachmentMediumId = mStorageModel->data(attachmentIndex, StorageModel::R_AttMediumId).toString();
    19471980
     
    23802413                mCbPassthrough->setChecked (isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsPassthrough).toBool());
    23812414
     2415                /* Getting TempEject state */
     2416                mCbTempEject->setVisible (device == KDeviceType_DVD && !isHostDrive);
     2417                mCbTempEject->setChecked (!isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsTempEject).toBool());
     2418
    23822419                /* Update optional widgets visibility */
    23832420                updateAdditionalObjects (device);
     
    24472484                if (mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool())
    24482485                    mStorageModel->setData (index, mCbPassthrough->isChecked(), StorageModel::R_AttIsPassthrough);
     2486            }
     2487            else if (sdr == mCbTempEject)
     2488            {
     2489                if (!mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool())
     2490                    mStorageModel->setData (index, mCbTempEject->isChecked(), StorageModel::R_AttIsTempEject);
    24492491            }
    24502492            break;
     
    33543396        QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId;
    33553397        bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;
     3398        bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;
    33563399        /* Get GUI medium object: */
    33573400        VBoxMedium vboxMedium = vboxGlobal().findMedium(strAttachmentMediumId);
     
    33763419                    /* Check that machine is OK: */
    33773420                    fSuccess = m_machine.isOk();
     3421                    if (fSuccess)
     3422                    {
     3423                        m_machine.TemporaryEjectDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentTempEject);
     3424                        /* Check that machine is OK: */
     3425                        fSuccess = m_machine.isOk();
     3426                    }
    33783427                }
    33793428            }
     
    34113460        QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId;
    34123461        bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;
     3462        bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;
    34133463        KDeviceType attachmentDeviceType = attachmentData.m_attachmentType;
    34143464
     
    34383488                    }
    34393489                }
     3490                if (fSuccess)
     3491                {
     3492                    if (attachmentDeviceType == KDeviceType_DVD)
     3493                    {
     3494                        m_machine.TemporaryEjectDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentTempEject);
     3495                        /* Check that machine is OK: */
     3496                        fSuccess = m_machine.isOk();
     3497                    }
     3498                }
    34403499            }
    34413500            else
     
    35113570    mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));
    35123571    mCbPassthrough->setEnabled(isMachineOffline());
     3572    mCbTempEject->setEnabled(isMachineInValidMode());
    35133573    mLsInformation->setEnabled(isMachineInValidMode());
    35143574    mLbHDFormat->setEnabled(isMachineInValidMode());
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r37374 r37710  
    356356    bool attIsHostDrive() const;
    357357    bool attIsPassthrough() const;
     358    bool attIsTempEject() const;
    358359
    359360    void setAttSlot (const StorageSlot &aAttSlot);
     
    361362    void setAttMediumId (const QString &aAttMediumId);
    362363    void setAttIsPassthrough (bool aPassthrough);
     364    void setAttIsTempEject (bool aTempEject);
    363365
    364366    QString attSize() const;
     
    391393    bool mAttIsHostDrive;
    392394    bool mAttIsPassthrough;
     395    bool mAttIsTempEject;
    393396
    394397    QString mAttName;
     
    444447        R_AttIsHostDrive,
    445448        R_AttIsPassthrough,
     449        R_AttIsTempEject,
    446450        R_AttSize,
    447451        R_AttLogicalSize,
     
    557561        , m_iAttachmentDevice(-1)
    558562        , m_strAttachmentMediumId(QString())
    559         , m_fAttachmentPassthrough(false) {}
     563        , m_fAttachmentPassthrough(false)
     564        , m_fAttachmentTempEject(false) {}
    560565    /* Functions: */
    561566    bool equal(const UIDataSettingsMachineStorageAttachment &other) const
     
    565570               (m_iAttachmentDevice == other.m_iAttachmentDevice) &&
    566571               (m_strAttachmentMediumId == other.m_strAttachmentMediumId) &&
    567                (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough);
     572               (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough) &&
     573               (m_fAttachmentTempEject == other.m_fAttachmentTempEject);
    568574    }
    569575    /* Operators: */
     
    576582    QString m_strAttachmentMediumId;
    577583    bool m_fAttachmentPassthrough;
     584    bool m_fAttachmentTempEject;
    578585};
    579586typedef UISettingsCache<UIDataSettingsMachineStorageAttachment> UICacheSettingsMachineStorageAttachment;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.ui

    r37374 r37710  
    323323         </widget>
    324324        </item>
     325        <item row="2" column="2" >
     326         <widget class="QCheckBox" name="mCbTempEject" >
     327          <property name="sizePolicy" >
     328           <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
     329            <horstretch>0</horstretch>
     330            <verstretch>0</verstretch>
     331           </sizepolicy>
     332          </property>
     333          <property name="whatsThis" >
     334           <string>When checked, it suppresses unmounting the medium when the guest OS ejects it.</string>
     335          </property>
     336          <property name="text" >
     337           <string>&amp;Live CD/DVD</string>
     338          </property>
     339         </widget>
     340        </item>
    325341        <item row="3" column="0" colspan="3" >
    326342         <widget class="QILabelSeparator" native="1" name="mLsInformation" >
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