VirtualBox

Changeset 8071 in vbox


Ignore:
Timestamp:
Apr 17, 2008 12:36:49 AM (17 years ago)
Author:
vboxsync
Message:

New Hard Disk GUI (including SATA support) implemented:

  1. Attachment list is a table (QListView) with two columns.
  2. Each attachment represented by cortege of two cells. First of them allows to select unique attachment slot (IDE00, IDE01, IDE11, SLOT[0..max]). Second allows to select necessary VDI image (through standard VBoxMediaComboBox selector).
  3. Each cell contain hidden combo-box invoked by double-mouse-click or F2, Space, Ctrl/Alt+Up/Down keys.
  4. User can navigate through the table cells with cursor keys.
  5. There are three buttons which allows "Add new attachment", "Remove selected attachment" and "open Virtual Disk Manager" to directly select necessary vdi image there.
  6. There are context-menu in each cortege of attachments list.
Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r7983 r8071  
    191191        ui/VBoxVMSettingsDlg.ui.h \
    192192        ui/VBoxVMLogViewer.ui.h \
    193         ui/VBoxSharedFoldersSettings.ui.h
     193        ui/VBoxSharedFoldersSettings.ui.h \
     194        ui/VBoxHardDiskSettings.ui.h
    194195
    195196
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r7983 r8071  
    2727        ui/VBoxUSBFilterSettings.ui \
    2828        ui/VBoxSharedFoldersSettings.ui \
     29        ui/VBoxHardDiskSettings.ui \
    2930        ui/VBoxNewVMWzd.ui \
    3031        ui/VBoxCloseVMDlg.ui \
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h

    r7442 r8071  
    215215    }
    216216
     217    KStorageBus toStorageBusType (const QString &s) const
     218    {
     219        QStringVector::const_iterator it =
     220            qFind (storageBuses.begin(), storageBuses.end(), s);
     221        AssertMsg (it != storageBuses.end(), ("No value for {%s}", s.latin1()));
     222        return KStorageBus (it - storageBuses.begin());
     223    }
     224
    217225    QString toString (KStorageBus t) const
    218226    {
     
    221229    }
    222230
     231    LONG toStorageChannelType (KStorageBus t, const QString &c) const;
    223232    QString toString (KStorageBus t, LONG c) const;
     233
     234    LONG toStorageDeviceType (KStorageBus t, const QString &c) const;
    224235    QString toString (KStorageBus t, LONG c, LONG d) const;
    225236
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r7442 r8071  
    192192    bool confirmHardDiskUnregister (QWidget *parent, const QString &src);
    193193
     194    int confirmSATASlotsRemoving (QWidget *aParent);
     195
    194196    void cannotCreateHardDiskImage (
    195197        QWidget *parent, const CVirtualBox &vbox, const QString &src,
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r7651 r8071  
    738738    , deviceTypes (KDeviceType_COUNT)
    739739    , storageBuses (KStorageBus_COUNT)
    740     , storageBusDevices (3)
     740    , storageBusDevices (4)
    741741    , storageBusChannels (3)
    742742    , diskTypes (KHardDiskType_COUNT)
     
    960960}
    961961
     962LONG VBoxGlobal::toStorageDeviceType (KStorageBus t, const QString &c) const
     963{
     964    LONG device;
     965    switch (t)
     966    {
     967        case KStorageBus_IDE:
     968        {
     969            QStringVector::const_iterator it =
     970                qFind (storageBusDevices.begin(), storageBusDevices.end(), c);
     971            AssertMsg (it != storageBusDevices.end(), ("No value for {%s}", c.latin1()));
     972            device = (LONG) (it - storageBusDevices.begin());
     973            break;
     974        }
     975        default:
     976        {
     977            device = 0;
     978            break;
     979        }
     980    }
     981    return device;
     982}
     983
    962984QString VBoxGlobal::toString (KStorageBus t, LONG c, LONG d) const
    963985{
    964     Assert (storageBusDevices.count() == 3);
     986    Assert (storageBusDevices.count() == 4);
    965987    QString dev;
    966988
     
    976998            }
    977999        }
     1000        case KStorageBus_SATA:
     1001        {
     1002            dev = storageBusDevices [3].arg (d);
     1003            break;
     1004        }
    9781005        default:
    9791006            dev = storageBusDevices [2].arg (d);
    9801007    }
    9811008    return dev;
     1009}
     1010
     1011LONG VBoxGlobal::toStorageChannelType (KStorageBus t, const QString &c) const
     1012{
     1013    LONG channel;
     1014    switch (t)
     1015    {
     1016        case KStorageBus_IDE:
     1017        {
     1018            QStringVector::const_iterator it =
     1019                qFind (storageBusChannels.begin(), storageBusChannels.end(), c);
     1020            AssertMsg (it != storageBusChannels.end(), ("No value for {%s}", c.latin1()));
     1021            channel = (LONG) (it - storageBusChannels.begin());
     1022            break;
     1023        }
     1024        default:
     1025        {
     1026            channel = 0;
     1027            break;
     1028        }
     1029    }
     1030    return channel;
    9821031}
    9831032
     
    23032352        tr ("Channel %1", "StorageBusChannel");
    23042353
    2305     Assert (storageBusDevices.count() == 3);
     2354    Assert (storageBusDevices.count() == 4);
    23062355    storageBusDevices [0] = tr ("Master", "StorageBusDevice");
    23072356    storageBusDevices [1] = tr ("Slave", "StorageBusDevice");
    23082357    storageBusDevices [2] = tr ("Device %1", "StorageBusDevice");
     2358    storageBusDevices [3] = tr ("Port %1", "StorageBusDevice");
    23092359
    23102360    diskTypes [KHardDiskType_Normal] =
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r7983 r8071  
    10551055}
    10561056
     1057int VBoxProblemReporter::confirmSATASlotsRemoving (QWidget *aParent)
     1058{
     1059    return messageOkCancel (aParent, Question,
     1060        tr ("<p>Currently you have SATA devices attached in Hard Disk "
     1061            "attachments list. If you really want to disable SATA Controller, "
     1062            "SATA attachments will be removed.</p><p>Are you really want to "
     1063            "disable the SATA Controller?</p>"),
     1064        0 /* aAutoConfirmId */);
     1065}
     1066
    10571067void VBoxProblemReporter::cannotCreateHardDiskImage (
    10581068    QWidget *parent, const CVirtualBox &vbox, const QString &src,
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui

    r7021 r8071  
    14001400                    <number>1</number>
    14011401                </attribute>
    1402                 <vbox>
    1403                     <property name="name">
    1404                         <cstring>unnamed</cstring>
    1405                     </property>
    1406                     <property name="margin">
    1407                         <number>0</number>
    1408                     </property>
    1409                     <property name="spacing">
    1410                         <number>10</number>
    1411                     </property>
    1412                     <widget class="QGroupBox">
    1413                         <property name="name">
    1414                             <cstring>grbHDA</cstring>
    1415                         </property>
    1416                         <property name="title">
    1417                             <string>&amp;Primary Master</string>
    1418                         </property>
    1419                         <property name="checkable">
    1420                             <bool>true</bool>
    1421                         </property>
    1422                         <vbox>
    1423                             <property name="name">
    1424                                 <cstring>unnamed</cstring>
    1425                             </property>
    1426                             <widget class="QLayoutWidget">
    1427                                 <property name="name">
    1428                                     <cstring>hdaLayout</cstring>
    1429                                 </property>
    1430                                 <hbox>
    1431                                     <property name="name">
    1432                                         <cstring>unnamed</cstring>
    1433                                     </property>
    1434                                     <widget class="QToolButton">
    1435                                         <property name="name">
    1436                                             <cstring>tbHDA</cstring>
    1437                                         </property>
    1438                                         <property name="focusPolicy">
    1439                                             <enum>TabFocus</enum>
    1440                                         </property>
    1441                                         <property name="text">
    1442                                             <string>Select</string>
    1443                                         </property>
    1444                                         <property name="iconSet">
    1445                                             <iconset></iconset>
    1446                                         </property>
    1447                                         <property name="textLabel">
    1448                                             <string>Select</string>
    1449                                         </property>
    1450                                         <property name="autoRaise">
    1451                                             <bool>true</bool>
    1452                                         </property>
    1453                                         <property name="whatsThis" stdset="0">
    1454                                             <string>Invokes the Virtual Disk Manager to create a new or select an existing virtual hard disk to attach.</string>
    1455                                         </property>
    1456                                     </widget>
    1457                                 </hbox>
    1458                             </widget>
    1459                             <widget class="QLabel">
    1460                                 <property name="name">
    1461                                     <cstring>txHDA</cstring>
    1462                                 </property>
    1463                                 <property name="text">
    1464                                     <string>&lt;not selected&gt;</string>
    1465                                 </property>
    1466                             </widget>
    1467                         </vbox>
    1468                     </widget>
    1469                     <widget class="QGroupBox">
    1470                         <property name="name">
    1471                             <cstring>grbHDB</cstring>
    1472                         </property>
    1473                         <property name="title">
    1474                             <string>P&amp;rimary Slave</string>
    1475                         </property>
    1476                         <property name="checkable">
    1477                             <bool>true</bool>
    1478                         </property>
    1479                         <vbox>
    1480                             <property name="name">
    1481                                 <cstring>unnamed</cstring>
    1482                             </property>
    1483                             <widget class="QLayoutWidget">
    1484                                 <property name="name">
    1485                                     <cstring>hdbLayout</cstring>
    1486                                 </property>
    1487                                 <hbox>
    1488                                     <property name="name">
    1489                                         <cstring>unnamed</cstring>
    1490                                     </property>
    1491                                     <widget class="QToolButton">
    1492                                         <property name="name">
    1493                                             <cstring>tbHDB</cstring>
    1494                                         </property>
    1495                                         <property name="focusPolicy">
    1496                                             <enum>TabFocus</enum>
    1497                                         </property>
    1498                                         <property name="text">
    1499                                             <string>Select</string>
    1500                                         </property>
    1501                                         <property name="iconSet">
    1502                                             <iconset></iconset>
    1503                                         </property>
    1504                                         <property name="textLabel">
    1505                                             <string>Select</string>
    1506                                         </property>
    1507                                         <property name="autoRaise">
    1508                                             <bool>true</bool>
    1509                                         </property>
    1510                                         <property name="whatsThis" stdset="0">
    1511                                             <string>Invokes the Virtual Disk Manager to create a new or select an existing virtual hard disk to attach.</string>
    1512                                         </property>
    1513                                     </widget>
    1514                                 </hbox>
    1515                             </widget>
    1516                             <widget class="QLabel">
    1517                                 <property name="name">
    1518                                     <cstring>txHDB</cstring>
    1519                                 </property>
    1520                                 <property name="text">
    1521                                     <string>&lt;not selected&gt;</string>
    1522                                 </property>
    1523                             </widget>
    1524                         </vbox>
    1525                     </widget>
    1526                     <widget class="QGroupBox">
    1527                         <property name="name">
    1528                             <cstring>grbHDD</cstring>
    1529                         </property>
    1530                         <property name="title">
    1531                             <string>&amp;Secondary (IDE 1) Slave</string>
    1532                         </property>
    1533                         <property name="checkable">
    1534                             <bool>true</bool>
    1535                         </property>
    1536                         <vbox>
    1537                             <property name="name">
    1538                                 <cstring>unnamed</cstring>
    1539                             </property>
    1540                             <widget class="QLayoutWidget">
    1541                                 <property name="name">
    1542                                     <cstring>hddLayout</cstring>
    1543                                 </property>
    1544                                 <hbox>
    1545                                     <property name="name">
    1546                                         <cstring>unnamed</cstring>
    1547                                     </property>
    1548                                     <widget class="QToolButton">
    1549                                         <property name="name">
    1550                                             <cstring>tbHDD</cstring>
    1551                                         </property>
    1552                                         <property name="focusPolicy">
    1553                                             <enum>TabFocus</enum>
    1554                                         </property>
    1555                                         <property name="text">
    1556                                             <string>Select</string>
    1557                                         </property>
    1558                                         <property name="iconSet">
    1559                                             <iconset></iconset>
    1560                                         </property>
    1561                                         <property name="textLabel">
    1562                                             <string>Select</string>
    1563                                         </property>
    1564                                         <property name="autoRaise">
    1565                                             <bool>true</bool>
    1566                                         </property>
    1567                                         <property name="whatsThis" stdset="0">
    1568                                             <string>Invokes the Virtual Disk Manager to create a new or select an existing virtual hard disk to attach.</string>
    1569                                         </property>
    1570                                     </widget>
    1571                                 </hbox>
    1572                             </widget>
    1573                             <widget class="QLabel">
    1574                                 <property name="name">
    1575                                     <cstring>txHDD</cstring>
    1576                                 </property>
    1577                                 <property name="text">
    1578                                     <string>&lt;not selected&gt;</string>
    1579                                 </property>
    1580                             </widget>
    1581                         </vbox>
    1582                     </widget>
    1583                     <spacer>
    1584                         <property name="name">
    1585                             <cstring>spacer3</cstring>
    1586                         </property>
    1587                         <property name="orientation">
    1588                             <enum>Vertical</enum>
    1589                         </property>
    1590                         <property name="sizeType">
    1591                             <enum>Expanding</enum>
    1592                         </property>
    1593                         <property name="sizeHint">
    1594                             <size>
    1595                                 <width>20</width>
    1596                                 <height>0</height>
    1597                             </size>
    1598                         </property>
    1599                     </spacer>
    1600                 </vbox>
    16011402            </widget>
    16021403            <widget class="QWidget">
     
    31592960    <tabstop>tbSelectSavedStateFolder</tabstop>
    31602961    <tabstop>tbResetSavedStateFolder</tabstop>
    3161     <tabstop>grbHDA</tabstop>
    3162     <tabstop>tbHDA</tabstop>
    3163     <tabstop>grbHDB</tabstop>
    3164     <tabstop>tbHDB</tabstop>
    3165     <tabstop>grbHDD</tabstop>
    3166     <tabstop>tbHDD</tabstop>
    31672962    <tabstop>bgDVD</tabstop>
    31682963    <tabstop>rbHostDVD</tabstop>
     
    32223017    <include location="local" impldecl="in implementation">VBoxMediaComboBox.h</include>
    32233018    <include location="local" impldecl="in implementation">QIRichLabel.h</include>
     3019    <include location="local" impldecl="in implementation">VBoxHardDiskSettings.h</include>
    32243020</includes>
    32253021<forwards>
     
    32283024    <forward>class VBoxUSBMenu</forward>
    32293025    <forward>class VBoxSharedFoldersSettings</forward>
     3026    <forward>class VBoxHardDiskSettings</forward>
    32303027    <forward>class QIRichLabel</forward>
    32313028    <forward>class BootItemsList</forward>
     
    32413038    <variable access="private">QIWidgetValidator *wvalFloppy;</variable>
    32423039    <variable access="private">QIWidgetValidator *wvalVRDP;</variable>
    3243     <variable access="private">QUuid uuidHDA;</variable>
    3244     <variable access="private">QUuid uuidHDB;</variable>
    3245     <variable access="private">QUuid uuidHDD;</variable>
    32463040    <variable access="private">QUuid uuidISODVD;</variable>
    32473041    <variable access="private">QUuid uuidISOFloppy;</variable>
     
    32543048    <variable access="private">bool mUSBFilterListModified;</variable>
    32553049    <variable access="private">VBoxSharedFoldersSettings *mSharedFolders;</variable>
     3050    <variable access="private">VBoxHardDiskSettings *mHDSettings;</variable>
    32563051    <variable access="private">QString warningString;</variable>
    3257     <variable access="private">VBoxMediaComboBox *cbHDA;</variable>
    3258     <variable access="private">VBoxMediaComboBox *cbHDB;</variable>
    3259     <variable access="private">VBoxMediaComboBox *cbHDD;</variable>
    32603052    <variable access="private">VBoxMediaComboBox *cbISODVD;</variable>
    32613053    <variable access="private">VBoxMediaComboBox *cbISOFloppy;</variable>
     
    32733065    <slot>revalidate( QIWidgetValidator * wval )</slot>
    32743066    <slot>updateWhatsThis( bool gotFocus = false )</slot>
    3275     <slot>showImageManagerHDA()</slot>
    3276     <slot>showImageManagerHDB()</slot>
    3277     <slot>showImageManagerHDD()</slot>
    32783067    <slot>showImageManagerISODVD()</slot>
    32793068    <slot>showImageManagerISOFloppy()</slot>
     
    33003089    <slot>tbUSBFilterUp_clicked()</slot>
    33013090    <slot>tbUSBFilterDown_clicked()</slot>
    3302     <slot>hdaMediaChanged()</slot>
    3303     <slot>hdbMediaChanged()</slot>
    3304     <slot>hddMediaChanged()</slot>
    33053091    <slot>cdMediaChanged()</slot>
    33063092    <slot>fdMediaChanged()</slot>
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h

    r7525 r8071  
    584584    /* HDD Images page */
    585585
    586     QWhatsThis::add (static_cast <QWidget *> (grbHDA->child ("qt_groupbox_checkbox")),
    587                      tr ("When checked, attaches the specified virtual hard disk to the "
    588                          "Master slot of the Primary IDE controller."));
    589     QWhatsThis::add (static_cast <QWidget *> (grbHDB->child ("qt_groupbox_checkbox")),
    590                      tr ("When checked, attaches the specified virtual hard disk to the "
    591                          "Slave slot of the Primary IDE controller."));
    592     QWhatsThis::add (static_cast <QWidget *> (grbHDD->child ("qt_groupbox_checkbox")),
    593                      tr ("When checked, attaches the specified virtual hard disk to the "
    594                          "Slave slot of the Secondary IDE controller."));
    595     cbHDA = new VBoxMediaComboBox (grbHDA, "cbHDA", VBoxDefs::HD);
    596     cbHDB = new VBoxMediaComboBox (grbHDB, "cbHDB", VBoxDefs::HD);
    597     cbHDD = new VBoxMediaComboBox (grbHDD, "cbHDD", VBoxDefs::HD);
    598     hdaLayout->insertWidget (0, cbHDA);
    599     hdbLayout->insertWidget (0, cbHDB);
    600     hddLayout->insertWidget (0, cbHDD);
    601     /* sometimes the weirdness of Qt just kills... */
    602     setTabOrder (static_cast <QWidget *> (grbHDA->child ("qt_groupbox_checkbox")),
    603                  cbHDA);
    604     setTabOrder (static_cast <QWidget *> (grbHDB->child ("qt_groupbox_checkbox")),
    605                  cbHDB);
    606     setTabOrder (static_cast <QWidget *> (grbHDD->child ("qt_groupbox_checkbox")),
    607                  cbHDD);
    608 
    609     QWhatsThis::add (cbHDB, tr ("Displays the virtual hard disk to attach to this IDE slot "
    610                                 "and allows to quickly select a different hard disk."));
    611     QWhatsThis::add (cbHDD, tr ("Displays the virtual hard disk to attach to this IDE slot "
    612                                 "and allows to quickly select a different hard disk."));
    613     QWhatsThis::add (cbHDA, tr ("Displays the virtual hard disk to attach to this IDE slot "
    614                                 "and allows to quickly select a different hard disk."));
    615     QWhatsThis::add (cbHDB, tr ("Displays the virtual hard disk to attach to this IDE slot "
    616                                 "and allows to quickly select a different hard disk."));
    617     QWhatsThis::add (cbHDD, tr ("Displays the virtual hard disk to attach to this IDE slot "
    618                                 "and allows to quickly select a different hard disk."));
     586    QVBoxLayout *hdPageLayout = new QVBoxLayout (pageHDD, 0, 10);
     587    mHDSettings = new VBoxHardDiskSettings (pageHDD);
     588    hdPageLayout->addWidget (mHDSettings);
    619589
    620590    wvalHDD = new QIWidgetValidator (pagePath (pageHDD), pageHDD, this);
     
    624594             this, SLOT (revalidate (QIWidgetValidator *)));
    625595
    626     connect (grbHDA, SIGNAL (toggled (bool)), this, SLOT (hdaMediaChanged()));
    627     connect (grbHDB, SIGNAL (toggled (bool)), this, SLOT (hdbMediaChanged()));
    628     connect (grbHDD, SIGNAL (toggled (bool)), this, SLOT (hddMediaChanged()));
    629     connect (cbHDA, SIGNAL (activated (int)), this, SLOT (hdaMediaChanged()));
    630     connect (cbHDB, SIGNAL (activated (int)), this, SLOT (hdbMediaChanged()));
    631     connect (cbHDD, SIGNAL (activated (int)), this, SLOT (hddMediaChanged()));
    632     connect (tbHDA, SIGNAL (clicked()), this, SLOT (showImageManagerHDA()));
    633     connect (tbHDB, SIGNAL (clicked()), this, SLOT (showImageManagerHDB()));
    634     connect (tbHDD, SIGNAL (clicked()), this, SLOT (showImageManagerHDD()));
    635 
    636     /* setup iconsets -- qdesigner is not capable... */
    637     tbHDA->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png",
    638                                             "select_file_dis_16px.png"));
    639     tbHDB->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png",
    640                                             "select_file_dis_16px.png"));
    641     tbHDD->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png",
    642                                             "select_file_dis_16px.png"));
     596    connect (mHDSettings, SIGNAL (hddListChanged()), wvalHDD, SLOT (revalidate()));
     597    connect (mHDSettings, SIGNAL (hddListChanged()), this, SLOT (resetFirstRunFlag()));
    643598
    644599    /* CD/DVD-ROM Drive Page */
     
    978933{
    979934    /* setup necessary combobox item */
    980     cbHDA->setCurrentItem (uuidHDA);
    981     cbHDB->setCurrentItem (uuidHDB);
    982     cbHDD->setCurrentItem (uuidHDD);
    983935    cbISODVD->setCurrentItem (uuidISODVD);
    984936    cbISOFloppy->setCurrentItem (uuidISOFloppy);
     
    988940    else
    989941    {
    990         cbHDA->refresh();
    991         cbHDB->refresh();
    992         cbHDD->refresh();
    993942        cbISODVD->refresh();
    994943        cbISOFloppy->refresh();
     
    11951144
    11961145
    1197 void VBoxVMSettingsDlg::hdaMediaChanged()
    1198 {
    1199     resetFirstRunFlag();
    1200     uuidHDA = grbHDA->isChecked() ? cbHDA->getId() : QUuid();
    1201     txHDA->setText (getHdInfo (grbHDA, uuidHDA));
    1202     /* revailidate */
    1203     wvalHDD->revalidate();
    1204 }
    1205 
    1206 
    1207 void VBoxVMSettingsDlg::hdbMediaChanged()
    1208 {
    1209     resetFirstRunFlag();
    1210     uuidHDB = grbHDB->isChecked() ? cbHDB->getId() : QUuid();
    1211     txHDB->setText (getHdInfo (grbHDB, uuidHDB));
    1212     /* revailidate */
    1213     wvalHDD->revalidate();
    1214 }
    1215 
    1216 
    1217 void VBoxVMSettingsDlg::hddMediaChanged()
    1218 {
    1219     resetFirstRunFlag();
    1220     uuidHDD = grbHDD->isChecked() ? cbHDD->getId() : QUuid();
    1221     txHDD->setText (getHdInfo (grbHDD, uuidHDD));
    1222     /* revailidate */
    1223     wvalHDD->revalidate();
    1224 }
    1225 
    1226 
    12271146void VBoxVMSettingsDlg::cdMediaChanged()
    12281147{
     
    14231342    {
    14241343        CVirtualBox vbox = vboxGlobal().virtualBox();
    1425         valid = true;
    1426 
    1427         QValueList <QUuid> uuids;
    1428 
    1429         if (valid && grbHDA->isChecked())
    1430         {
    1431             if (uuidHDA.isNull())
    1432             {
    1433                 valid = false;
    1434                 warningText = tr ("Primary Master hard disk is not selected");
    1435             }
    1436             else uuids << uuidHDA;
    1437         }
    1438 
    1439         if (valid && grbHDB->isChecked())
    1440         {
    1441             if (uuidHDB.isNull())
    1442             {
    1443                 valid = false;
    1444                 warningText = tr ("Primary Slave hard disk is not selected");
    1445             }
    1446             else
    1447             {
    1448                 bool found = uuids.findIndex (uuidHDB) >= 0;
    1449                 if (found)
    1450                 {
    1451                     CHardDisk hd = vbox.GetHardDisk (uuidHDB);
    1452                     valid = hd.GetType() == KHardDiskType_Immutable;
    1453                 }
    1454                 if (valid)
    1455                     uuids << uuidHDB;
    1456                 else
    1457                     warningText = tr ("Primary Slave hard disk is already attached "
    1458                                       "to a different slot");
    1459             }
    1460         }
    1461 
    1462         if (valid && grbHDD->isChecked())
    1463         {
    1464             if (uuidHDD.isNull())
    1465             {
    1466                 valid = false;
    1467                 warningText = tr ("Secondary Slave hard disk is not selected");
    1468             }
    1469             else
    1470             {
    1471                 bool found = uuids.findIndex (uuidHDD) >= 0;
    1472                 if (found)
    1473                 {
    1474                     CHardDisk hd = vbox.GetHardDisk (uuidHDD);
    1475                     valid = hd.GetType() == KHardDiskType_Immutable;
    1476                 }
    1477                 if (valid)
    1478                     uuids << uuidHDB;
    1479                 else
    1480                     warningText = tr ("Secondary Slave hard disk is already attached "
    1481                                       "to a different slot");
    1482             }
    1483         }
    1484 
    1485         cbHDA->setEnabled (grbHDA->isChecked());
    1486         cbHDB->setEnabled (grbHDB->isChecked());
    1487         cbHDD->setEnabled (grbHDD->isChecked());
    1488         tbHDA->setEnabled (grbHDA->isChecked());
    1489         tbHDB->setEnabled (grbHDB->isChecked());
    1490         tbHDD->setEnabled (grbHDD->isChecked());
     1344        QString validity = mHDSettings->checkValidity();
     1345        valid = validity == QString::null;
     1346        if (!valid)
     1347            warningText = validity;
    14911348    }
    14921349    else if (pg == pageDVD)
     
    17031560    /* hard disk images */
    17041561    {
    1705         struct
    1706         {
    1707             KStorageBus bus;
    1708             LONG channel;
    1709             LONG dev;
    1710             struct {
    1711                 QGroupBox *grb;
    1712                 QComboBox *cbb;
    1713                 QLabel *tx;
    1714                 QUuid *uuid;
    1715             } data;
    1716         }
    1717         diskSet[] =
    1718         {
    1719             { KStorageBus_IDE, 0, 0, {grbHDA, cbHDA, txHDA, &uuidHDA} },
    1720             { KStorageBus_IDE, 0, 1, {grbHDB, cbHDB, txHDB, &uuidHDB} },
    1721             { KStorageBus_IDE, 1, 1, {grbHDD, cbHDD, txHDD, &uuidHDD} },
    1722         };
    1723 
    1724         grbHDA->setChecked (false);
    1725         grbHDB->setChecked (false);
    1726         grbHDD->setChecked (false);
    1727 
    1728         CHardDiskAttachmentEnumerator en =
    1729             machine.GetHardDiskAttachments().Enumerate();
    1730         while (en.HasMore())
    1731         {
    1732             CHardDiskAttachment hda = en.GetNext();
    1733             for (uint i = 0; i < SIZEOF_ARRAY (diskSet); i++)
    1734             {
    1735                 if (diskSet [i].bus == hda.GetBus() &&
    1736                     diskSet [i].channel == hda.GetChannel() &&
    1737                     diskSet [i].dev == hda.GetDevice())
    1738                 {
    1739                     CHardDisk hd = hda.GetHardDisk();
    1740                     CHardDisk root = hd.GetRoot();
    1741                     QString src = root.GetLocation();
    1742                     if (hd.GetStorageType() == KHardDiskStorageType_VirtualDiskImage)
    1743                     {
    1744                         QFileInfo fi (src);
    1745                         src = fi.fileName() + " (" +
    1746                               QDir::convertSeparators (fi.dirPath (true)) + ")";
    1747                     }
    1748                     diskSet [i].data.grb->setChecked (true);
    1749                     diskSet [i].data.tx->setText (vboxGlobal().details (hd));
    1750                     *(diskSet [i].data.uuid) = QUuid (root.GetId());
    1751                 }
    1752             }
    1753         }
     1562        mHDSettings->getFromMachine (machine);
    17541563    }
    17551564
     
    20101819
    20111820    /* request for media shortcuts update */
    2012     cbHDA->setBelongsTo (machine.GetId());
    2013     cbHDB->setBelongsTo (machine.GetId());
    2014     cbHDD->setBelongsTo (machine.GetId());
    20151821    updateShortcuts();
    20161822
     
    20881894    /* hard disk images */
    20891895    {
    2090         struct
    2091         {
    2092             KStorageBus bus;
    2093             LONG channel;
    2094             LONG dev;
    2095             struct {
    2096                 QGroupBox *grb;
    2097                 QUuid *uuid;
    2098             } data;
    2099         }
    2100         diskSet[] =
    2101         {
    2102             { KStorageBus_IDE, 0, 0, {grbHDA, &uuidHDA} },
    2103             { KStorageBus_IDE, 0, 1, {grbHDB, &uuidHDB} },
    2104             { KStorageBus_IDE, 1, 1, {grbHDD, &uuidHDD} }
    2105         };
    2106 
    2107         /*
    2108          *  first, detach all disks (to ensure we can reattach them to different
    2109          *  controllers / devices, when appropriate)
    2110          */
    2111         CHardDiskAttachmentEnumerator en =
    2112             cmachine.GetHardDiskAttachments().Enumerate();
    2113         while (en.HasMore())
    2114         {
    2115             CHardDiskAttachment hda = en.GetNext();
    2116             for (uint i = 0; i < SIZEOF_ARRAY (diskSet); i++)
    2117             {
    2118                 if (diskSet [i].bus == hda.GetBus() &&
    2119                     diskSet [i].channel == hda.GetChannel() &&
    2120                     diskSet [i].dev == hda.GetDevice())
    2121                 {
    2122                     cmachine.DetachHardDisk (diskSet [i].bus, diskSet [i].channel, diskSet [i].dev);
    2123                     if (!cmachine.isOk())
    2124                         vboxProblem().cannotDetachHardDisk (
    2125                             this, cmachine, diskSet [i].bus, diskSet [i].channel, diskSet [i].dev);
    2126                 }
    2127             }
    2128         }
    2129 
    2130         /* now, attach new disks */
    2131         for (uint i = 0; i < SIZEOF_ARRAY (diskSet); i++)
    2132         {
    2133             QUuid *newId = diskSet [i].data.uuid;
    2134             if (diskSet [i].data.grb->isChecked() && !(*newId).isNull())
    2135             {
    2136                 cmachine.AttachHardDisk (*newId, diskSet [i].bus, diskSet [i].channel, diskSet [i].dev);
    2137                 if (!cmachine.isOk())
    2138                     vboxProblem().cannotAttachHardDisk (
    2139                         this, cmachine, *newId, diskSet [i].bus, diskSet [i].channel, diskSet [i].dev);
    2140             }
    2141         }
     1896        mHDSettings->putBackToMachine();
    21421897    }
    21431898
     
    23092064
    23102065
    2311 void VBoxVMSettingsDlg::showImageManagerHDA() { showVDImageManager (&uuidHDA, cbHDA); }
    2312 void VBoxVMSettingsDlg::showImageManagerHDB() { showVDImageManager (&uuidHDB, cbHDB); }
    2313 void VBoxVMSettingsDlg::showImageManagerHDD() { showVDImageManager (&uuidHDD, cbHDD); }
    23142066void VBoxVMSettingsDlg::showImageManagerISODVD() { showVDImageManager (&uuidISODVD, cbISODVD); }
    23152067void VBoxVMSettingsDlg::showImageManagerISOFloppy() { showVDImageManager(&uuidISOFloppy, cbISOFloppy); }
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