VirtualBox

Changeset 24417 in vbox


Ignore:
Timestamp:
Nov 5, 2009 10:38:36 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: Storage Settings UI: Update to unique medium selection mechanism, taking into account snapshot's diff-disks (excluding for "don't show diffs" mode).

File:
1 edited

Legend:

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

    r24395 r24417  
    6565
    6666
    67 KDeviceType typeToGlobal (VBoxDefs::MediumType aType)
    68 {
    69     KDeviceType result = KDeviceType_Null;
    70     switch (aType)
    71     {
    72         case VBoxDefs::MediumType_HardDisk:
    73             result = KDeviceType_HardDisk;
    74             break;
    75         case VBoxDefs::MediumType_DVD:
    76             result = KDeviceType_DVD;
    77             break;
    78         case VBoxDefs::MediumType_Floppy:
    79             result = KDeviceType_Floppy;
    80             break;
    81         default:
    82             AssertMsgFailed (("Incorrect device type!\n"));
    83             break;
    84     }
    85     return result;
    86 }
    87 
    8867QString compressText (const QString &aText)
    8968{
     
    323302}
    324303
    325 void AbstractItem::setMachineId (const QString &aMchineId)
    326 {
    327     mMachineId = aMchineId;
     304void AbstractItem::setMachineId (const QString &aMachineId)
     305{
     306    mMachineId = aMachineId;
    328307}
    329308
     
    498477QStringList ControllerItem::ctrAllMediumIds (bool aShowDiffs) const
    499478{
    500     QStringList allImages;
    501     for (VBoxMediaList::const_iterator it = vboxGlobal().currentMediaList().begin();
    502          it != vboxGlobal().currentMediaList().end(); ++ it)
    503     {
    504          foreach (KDeviceType deviceType, mCtrType->deviceTypeList())
     479    QStringList allMediums;
     480    foreach (const VBoxMedium &medium, vboxGlobal().currentMediaList())
     481    {
     482         foreach (const KDeviceType &deviceType, mCtrType->deviceTypeList())
    505483         {
    506              if ((*it).isNull() || typeToGlobal ((*it).type()) == deviceType)
     484             if (medium.isNull() || medium.medium().GetDeviceType() == deviceType)
    507485             {
    508                  /* We should filter out the base hard-disk of diff-disks,
    509                   * as we want to insert here a diff-disks and want
    510                   * to avoid duplicates in !aShowDiffs mode. */
    511                  if (!aShowDiffs && (*it).parent() && !parent()->machineId().isNull() &&
    512                      (*it).isAttachedInCurStateTo (parent()->machineId()))
    513                      allImages.removeAll ((*it).root().id());
    514                  allImages << (*it).id();
     486                 /* In 'don't show diffs' mode we should filter out all the mediums
     487                  * which are already attached to some snapshot of current VM. */
     488                 if (!aShowDiffs && medium.type() == VBoxDefs::MediumType_HardDisk)
     489                 {
     490                     if (!medium.medium().GetMachineIds().contains (parent()->machineId()) ||
     491                         medium.isAttachedInCurStateTo (parent()->machineId()))
     492                         allMediums << medium.id();
     493                 }
     494                 else allMediums << medium.id();
    515495                 break;
    516496             }
    517497         }
    518498    }
    519     return allImages;
     499    return allMediums;
    520500}
    521501
     
    665645        VBoxMedium medium = vboxGlobal().findMedium (mediumId);
    666646        if ((medium.isNull() && mAttDeviceType != KDeviceType_HardDisk) ||
    667             (!medium.isNull() && typeToGlobal (medium.type()) == mAttDeviceType))
     647            (!medium.isNull() && medium.medium().GetDeviceType() == mAttDeviceType))
    668648            allMediumIds << mediumId;
    669649    }
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