VirtualBox

Changeset 85872 in vbox


Ignore:
Timestamp:
Aug 21, 2020 7:41:31 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9812: VM settings: Prepare cascade cleanup for Storage page; And a bit of minor fixes for polishing stuff.

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

Legend:

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

    r85827 r85872  
    29492949    , m_pActionAddAttachmentHD(0), m_pActionAddAttachmentCD(0), m_pActionAddAttachmentFD(0)
    29502950    , m_pMediumIdHolder(new UIMediumIDHolder(this))
    2951     , m_fPolished(false)
    29522951    , m_fLoadingInProgress(0)
    29532952    , m_pCache(0)
     2953    , m_pSplitter(0)
     2954    , m_pWidgetLeftPane(0)
    29542955    , m_pLabelSeparatorLeftPane(0)
     2956    , m_pLayoutTreeView(0)
     2957    , m_pTreeStorage(0)
     2958    , m_pLayoutToolBar(0)
     2959    , m_pToolBar(0)
     2960    , m_pStackRightPane(0)
    29552961    , m_pLabelSeparatorEmpty(0)
     2962    , m_pLabelInfo(0)
    29562963    , m_pLabelSeparatorParameters(0)
    2957     , m_pLabelSeparatorAttributes(0)
    2958     , m_pLabelSeparatorInformation(0)
    2959     , m_pLabelInfo(0)
    29602964    , m_pLabelName(0)
     2965    , m_pEditorName(0)
    29612966    , m_pLabelType(0)
     2967    , m_pComboType(0)
    29622968    , m_pLabelPortCount(0)
    2963     , m_pLabelHDFormat(0)
    2964     , m_pLabelCDFDType(0)
    2965     , m_pLabelHDVirtualSize(0)
    2966     , m_pLabelHDActualSize(0)
    2967     , m_pLabelSize(0)
    2968     , m_pLabelHDDetails(0)
    2969     , m_pLabelLocation(0)
    2970     , m_pLabelUsage(0)
    2971     , m_pLabelEncryption(0)
    2972     , m_pLabelMedium(0)
    2973     , m_pLabelHDFormatValue(0)
    2974     , m_pLabelCDFDTypeValue(0)
    2975     , m_pLabelHDVirtualSizeValue(0)
    2976     , m_pLabelHDActualSizeValue(0)
    2977     , m_pLabelSizeValue(0)
    2978     , m_pLabelHDDetailsValue(0)
    2979     , m_pLabelLocationValue(0)
    2980     , m_pLabelUsageValue(0)
    2981     , m_pLabelEncryptionValue(0)
    2982     , m_pLineEditName(0)
    2983     , m_pComboBoxType(0)
    2984     , m_pComboBoxSlot(0)
    29852969    , m_pSpinBoxPortCount(0)
    29862970    , m_pCheckBoxIoCache(0)
     2971    , m_pLabelSeparatorAttributes(0)
     2972    , m_pLabelMedium(0)
     2973    , m_pComboSlot(0)
     2974    , m_pToolButtonOpen(0)
    29872975    , m_pCheckBoxPassthrough(0)
    29882976    , m_pCheckBoxTempEject(0)
    29892977    , m_pCheckBoxNonRotational(0)
    29902978    , m_pCheckBoxHotPluggable(0)
    2991     , m_pToolButtonOpen(0)
    2992     , m_pToolBarStorageBar(0)
    2993     , m_pLayoutController(0)
    2994     , m_pLayoutEmpty(0)
    2995     , m_pLayoutAttachment(0)
    2996     , mSwRightPane(0)
    2997     , m_pLayoutStorage(0)
    2998     , m_pSplitter(0)
     2979    , m_pLabelSeparatorInformation(0)
     2980    , m_pLabelHDFormat(0)
     2981    , m_pFieldHDFormat(0)
     2982    , m_pLabelCDFDType(0)
     2983    , m_pFieldCDFDType(0)
     2984    , m_pLabelHDVirtualSize(0)
     2985    , m_pFieldHDVirtualSize(0)
     2986    , m_pLabelHDActualSize(0)
     2987    , m_pFieldHDActualSize(0)
     2988    , m_pLabelCDFDSize(0)
     2989    , m_pFieldCDFDSize(0)
     2990    , m_pLabelHDDetails(0)
     2991    , m_pFieldHDDetails(0)
     2992    , m_pLabelLocation(0)
     2993    , m_pFieldLocation(0)
     2994    , m_pLabelUsage(0)
     2995    , m_pFieldUsage(0)
     2996    , m_pLabelEncryption(0)
     2997    , m_pFieldEncryption(0)
    29992998{
    30002999    /* Prepare: */
     
    33533352    m_pLabelSeparatorParameters->setText(tr("Attributes"));
    33543353    m_pLabelName->setText(tr("&Name:"));
    3355     m_pLineEditName->setWhatsThis(tr("Holds the name of the storage controller currently selected in the Storage Tree."));
     3354    m_pEditorName->setWhatsThis(tr("Holds the name of the storage controller currently selected in the Storage Tree."));
    33563355    m_pLabelType->setText(tr("&Type:"));
    3357     m_pComboBoxType->setWhatsThis(tr("Selects the sub-type of the storage controller currently selected in the Storage Tree."));
     3356    m_pComboType->setWhatsThis(tr("Selects the sub-type of the storage controller currently selected in the Storage Tree."));
    33583357    m_pLabelPortCount->setText(tr("&Port Count:"));
    33593358    m_pSpinBoxPortCount->setWhatsThis(tr("Selects the port count of the SATA storage controller currently selected in the"
     
    33623361    m_pCheckBoxIoCache->setText(tr("Use Host I/O Cache"));
    33633362    m_pLabelSeparatorAttributes->setText(tr("Attributes"));
    3364     m_pComboBoxSlot->setWhatsThis(tr("Selects the slot on the storage controller used by this attachment. The available slots depend"
     3363    m_pComboSlot->setWhatsThis(tr("Selects the slot on the storage controller used by this attachment. The available slots depend"
    33653364                                     "on the type of the controller and other attachments on it."));
    33663365    m_pToolButtonOpen->setText(QString());
     
    33803379    m_pLabelHDVirtualSize->setText(tr("Virtual Size:"));
    33813380    m_pLabelHDActualSize->setText(tr("Actual Size:"));
    3382     m_pLabelSize->setText(tr("Size:"));
     3381    m_pLabelCDFDSize->setText(tr("Size:"));
    33833382    m_pLabelHDDetails->setText(tr("Details:"));
    33843383    m_pLabelLocation->setText(tr("Location:"));
     
    34433442    m_pLabelSeparatorParameters->setEnabled(isMachineInValidMode());
    34443443    m_pLabelName->setEnabled(isMachineOffline());
    3445     m_pLineEditName->setEnabled(isMachineOffline());
     3444    m_pEditorName->setEnabled(isMachineOffline());
    34463445    m_pLabelType->setEnabled(isMachineOffline());
    3447     m_pComboBoxType->setEnabled(isMachineOffline());
     3446    m_pComboType->setEnabled(isMachineOffline());
    34483447    m_pLabelPortCount->setEnabled(isMachineOffline());
    34493448    m_pSpinBoxPortCount->setEnabled(isMachineOffline());
     
    34533452    m_pLabelSeparatorAttributes->setEnabled(isMachineInValidMode());
    34543453    m_pLabelMedium->setEnabled(isMachineOffline() || (isMachineOnline() && enmDeviceType != KDeviceType_HardDisk));
    3455     m_pComboBoxSlot->setEnabled(isMachineOffline());
     3454    m_pComboSlot->setEnabled(isMachineOffline());
    34563455    m_pToolButtonOpen->setEnabled(isMachineOffline() || (isMachineOnline() && enmDeviceType != KDeviceType_HardDisk));
    34573456    m_pCheckBoxPassthrough->setEnabled(isMachineOffline());
     
    34613460    m_pLabelSeparatorInformation->setEnabled(isMachineInValidMode());
    34623461    m_pLabelHDFormat->setEnabled(isMachineInValidMode());
    3463     m_pLabelHDFormatValue->setEnabled(isMachineInValidMode());
     3462    m_pFieldHDFormat->setEnabled(isMachineInValidMode());
    34643463    m_pLabelCDFDType->setEnabled(isMachineInValidMode());
    3465     m_pLabelCDFDTypeValue->setEnabled(isMachineInValidMode());
     3464    m_pFieldCDFDType->setEnabled(isMachineInValidMode());
    34663465    m_pLabelHDVirtualSize->setEnabled(isMachineInValidMode());
    3467     m_pLabelHDVirtualSizeValue->setEnabled(isMachineInValidMode());
     3466    m_pFieldHDVirtualSize->setEnabled(isMachineInValidMode());
    34683467    m_pLabelHDActualSize->setEnabled(isMachineInValidMode());
    3469     m_pLabelHDActualSizeValue->setEnabled(isMachineInValidMode());
    3470     m_pLabelSize->setEnabled(isMachineInValidMode());
    3471     m_pLabelSizeValue->setEnabled(isMachineInValidMode());
     3468    m_pFieldHDActualSize->setEnabled(isMachineInValidMode());
     3469    m_pLabelCDFDSize->setEnabled(isMachineInValidMode());
     3470    m_pFieldCDFDSize->setEnabled(isMachineInValidMode());
    34723471    m_pLabelHDDetails->setEnabled(isMachineInValidMode());
    3473     m_pLabelHDDetailsValue->setEnabled(isMachineInValidMode());
     3472    m_pFieldHDDetails->setEnabled(isMachineInValidMode());
    34743473    m_pLabelLocation->setEnabled(isMachineInValidMode());
    3475     m_pLabelLocationValue->setEnabled(isMachineInValidMode());
     3474    m_pFieldLocation->setEnabled(isMachineInValidMode());
    34763475    m_pLabelUsage->setEnabled(isMachineInValidMode());
    3477     m_pLabelUsageValue->setEnabled(isMachineInValidMode());
     3476    m_pFieldUsage->setEnabled(isMachineInValidMode());
    34783477    m_pLabelEncryption->setEnabled(isMachineInValidMode());
    3479     m_pLabelEncryptionValue->setEnabled(isMachineInValidMode());
     3478    m_pFieldEncryption->setEnabled(isMachineInValidMode());
    34803479
    34813480    /* Update action states: */
    34823481    sltUpdateActionStates();
    3483 }
    3484 
    3485 void UIMachineSettingsStorage::showEvent(QShowEvent *pEvent)
    3486 {
    3487     if (!m_fPolished)
    3488     {
    3489         m_fPolished = true;
    3490 
    3491         /* First column indent: */
    3492         m_pLayoutEmpty->setColumnMinimumWidth(0, 10);
    3493         m_pLayoutController->setColumnMinimumWidth(0, 10);
    3494         m_pLayoutAttachment->setColumnMinimumWidth(0, 10);
    3495 #if 0
    3496         /* Second column indent minimum width: */
    3497         QList <QLabel*> labelsList;
    3498         labelsList << m_pLabelMedium << m_pLabelHDFormat << m_pLabelCDFDType
    3499                    << m_pLabelHDVirtualSize << m_pLabelHDActualSize << m_pLabelSize
    3500                    << m_pLabelLocation << m_pLabelUsage;
    3501         int maxWidth = 0;
    3502         QFontMetrics metrics(font());
    3503         foreach (QLabel *label, labelsList)
    3504         {
    3505             int iWidth = metrics.width(label->text());
    3506             maxWidth = iWidth > maxWidth ? iWidth : maxWidth;
    3507         }
    3508         m_pLayoutAttachment->setColumnMinimumWidth(1, maxWidth);
    3509 #endif
    3510     }
    3511 
    3512     /* Call to base-class: */
    3513     UISettingsPageMachine::showEvent(pEvent);
    35143482}
    35153483
     
    37363704    {
    37373705        /* Showing Initial Page: */
    3738         mSwRightPane->setCurrentIndex(0);
     3706        m_pStackRightPane->setCurrentIndex(0);
    37393707    }
    37403708    else
     
    37463714                /* Getting Controller Name: */
    37473715                const QString strCtrName = m_pModelStorage->data(index, StorageModel::R_CtrName).toString();
    3748                 if (m_pLineEditName->text() != strCtrName)
    3749                     m_pLineEditName->setText(strCtrName);
     3716                if (m_pEditorName->text() != strCtrName)
     3717                    m_pEditorName->setText(strCtrName);
    37503718
    37513719                /* Rebuild type combo: */
    3752                 m_pComboBoxType->clear();
     3720                m_pComboType->clear();
    37533721                /* Getting controller buses: */
    37543722                const ControllerBusList controllerBusList(m_pModelStorage->data(index, StorageModel::R_CtrBusTypes).value<ControllerBusList>());
     
    37593727                    foreach (const KStorageControllerType &enmCurrentType, controllerTypeList)
    37603728                    {
    3761                         m_pComboBoxType->addItem(gpConverter->toString(enmCurrentType));
    3762                         m_pComboBoxType->setItemData(m_pComboBoxType->count() - 1, QVariant::fromValue(enmCurrentBus), StorageModel::R_CtrBusType);
    3763                         m_pComboBoxType->setItemData(m_pComboBoxType->count() - 1, QVariant::fromValue(enmCurrentType), StorageModel::R_CtrType);
     3729                        m_pComboType->addItem(gpConverter->toString(enmCurrentType));
     3730                        m_pComboType->setItemData(m_pComboType->count() - 1, QVariant::fromValue(enmCurrentBus), StorageModel::R_CtrBusType);
     3731                        m_pComboType->setItemData(m_pComboType->count() - 1, QVariant::fromValue(enmCurrentType), StorageModel::R_CtrType);
    37643732                    }
    37653733                }
    37663734                const KStorageControllerType enmType = m_pModelStorage->data(index, StorageModel::R_CtrType).value<KStorageControllerType>();
    3767                 const int iCtrPos = m_pComboBoxType->findData(enmType, StorageModel::R_CtrType);
    3768                 m_pComboBoxType->setCurrentIndex(iCtrPos == -1 ? 0 : iCtrPos);
     3735                const int iCtrPos = m_pComboType->findData(enmType, StorageModel::R_CtrType);
     3736                m_pComboType->setCurrentIndex(iCtrPos == -1 ? 0 : iCtrPos);
    37693737
    37703738                const KStorageBus enmBus = m_pModelStorage->data(index, StorageModel::R_CtrBusType).value<KStorageBus>();
     
    37803748
    37813749                /* Showing Controller Page: */
    3782                 mSwRightPane->setCurrentIndex(1);
     3750                m_pStackRightPane->setCurrentIndex(1);
    37833751                break;
    37843752            }
     
    37863754            {
    37873755                /* Getting Attachment Slot: */
    3788                 m_pComboBoxSlot->clear();
     3756                m_pComboSlot->clear();
    37893757                const SlotsList slotsList(m_pModelStorage->data(index, StorageModel::R_AttSlots).value<SlotsList>());
    37903758                for (int i = 0; i < slotsList.size(); ++i)
    3791                     m_pComboBoxSlot->insertItem(m_pComboBoxSlot->count(), gpConverter->toString(slotsList[i]));
     3759                    m_pComboSlot->insertItem(m_pComboSlot->count(), gpConverter->toString(slotsList[i]));
    37923760                const StorageSlot slt = m_pModelStorage->data(index, StorageModel::R_AttSlot).value<StorageSlot>();
    3793                 const int iAttSlotPos = m_pComboBoxSlot->findText(gpConverter->toString(slt));
    3794                 m_pComboBoxSlot->setCurrentIndex(iAttSlotPos == -1 ? 0 : iAttSlotPos);
    3795                 m_pComboBoxSlot->setToolTip(m_pComboBoxSlot->itemText(m_pComboBoxSlot->currentIndex()));
     3761                const int iAttSlotPos = m_pComboSlot->findText(gpConverter->toString(slt));
     3762                m_pComboSlot->setCurrentIndex(iAttSlotPos == -1 ? 0 : iAttSlotPos);
     3763                m_pComboSlot->setToolTip(m_pComboSlot->itemText(m_pComboSlot->currentIndex()));
    37963764
    37973765                /* Getting Attachment Medium: */
     
    38583826
    38593827                /* Getting Other Information: */
    3860                 m_pLabelHDFormatValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString()));
    3861                 m_pLabelCDFDTypeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString()));
    3862                 m_pLabelHDVirtualSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLogicalSize).toString()));
    3863                 m_pLabelHDActualSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString()));
    3864                 m_pLabelSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString()));
    3865                 m_pLabelHDDetailsValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttDetails).toString()));
    3866                 m_pLabelLocationValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLocation).toString()));
    3867                 m_pLabelUsageValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttUsage).toString()));
    3868                 m_pLabelEncryptionValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttEncryptionPasswordID).toString()));
     3828                m_pFieldHDFormat->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString()));
     3829                m_pFieldCDFDType->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString()));
     3830                m_pFieldHDVirtualSize->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLogicalSize).toString()));
     3831                m_pFieldHDActualSize->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString()));
     3832                m_pFieldCDFDSize->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString()));
     3833                m_pFieldHDDetails->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttDetails).toString()));
     3834                m_pFieldLocation->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLocation).toString()));
     3835                m_pFieldUsage->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttUsage).toString()));
     3836                m_pFieldEncryption->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttEncryptionPasswordID).toString()));
    38693837
    38703838                /* Showing Attachment Page: */
    3871                 mSwRightPane->setCurrentIndex(2);
     3839                m_pStackRightPane->setCurrentIndex(2);
    38723840                break;
    38733841            }
     
    38953863        {
    38963864            /* Setting Controller Name: */
    3897             if (pSender == m_pLineEditName)
    3898                 m_pModelStorage->setData(index, m_pLineEditName->text(), StorageModel::R_CtrName);
     3865            if (pSender == m_pEditorName)
     3866                m_pModelStorage->setData(index, m_pEditorName->text(), StorageModel::R_CtrName);
    38993867            /* Setting Controller Sub-Type: */
    3900             else if (pSender == m_pComboBoxType)
     3868            else if (pSender == m_pComboType)
    39013869            {
    39023870                const bool fResult =
    39033871                    m_pModelStorage->setData(index,
    3904                                              QVariant::fromValue(m_pComboBoxType->currentData(StorageModel::R_CtrBusType).value<KStorageBus>()),
     3872                                             QVariant::fromValue(m_pComboType->currentData(StorageModel::R_CtrBusType).value<KStorageBus>()),
    39053873                                             StorageModel::R_CtrBusType);
    39063874                if (fResult)
    39073875                    m_pModelStorage->setData(index,
    3908                                              QVariant::fromValue(m_pComboBoxType->currentData(StorageModel::R_CtrType).value<KStorageControllerType>()),
     3876                                             QVariant::fromValue(m_pComboType->currentData(StorageModel::R_CtrType).value<KStorageControllerType>()),
    39093877                                             StorageModel::R_CtrType);
    39103878            }
     
    39183886        {
    39193887            /* Setting Attachment Slot: */
    3920             if (pSender == m_pComboBoxSlot)
     3888            if (pSender == m_pComboSlot)
    39213889            {
    39223890                QModelIndex controllerIndex = m_pModelStorage->parent(index);
    3923                 StorageSlot attachmentStorageSlot = gpConverter->fromString<StorageSlot>(m_pComboBoxSlot->currentText());
     3891                StorageSlot attachmentStorageSlot = gpConverter->fromString<StorageSlot>(m_pComboSlot->currentText());
    39243892                m_pModelStorage->setData(index, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
    39253893                QModelIndex theSameIndexAtNewPosition = m_pModelStorage->attachmentBySlot(controllerIndex, attachmentStorageSlot);
     
    45114479void UIMachineSettingsStorage::prepare()
    45124480{
    4513     prepareWidgets();
    4514 
    45154481    /* Prepare cache: */
    45164482    m_pCache = new UISettingsCacheMachineStorage;
     
    45244490        uiCommon().enumerateMedia();
    45254491
    4526     AssertPtrReturnVoid(m_pLayoutStorage);
    4527     {
    4528 #ifdef VBOX_WS_MAC
    4529         /* We need a little more space for the focus rect: */
    4530         m_pLayoutStorage->setContentsMargins(3, 0, 3, 0);
    4531         m_pLayoutStorage->setSpacing(3);
    4532 #else
    4533         m_pLayoutStorage->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 3);
    4534 #endif
    4535 
    4536         /* Prepare storage tree: */
    4537         prepareStorageTree();
    4538         /* Prepare storage toolbar: */
    4539         prepareStorageToolbar();
    4540         /* Prepare storage widgets: */
    4541         prepareStorageWidgets();
    4542         /* Prepare connections: */
    4543         prepareConnections();
    4544     }
     4492    /* Prepare everything: */
     4493    prepareWidgets();
     4494    prepareConnections();
    45454495
    45464496    /* Apply language settings: */
     
    45544504void UIMachineSettingsStorage::prepareWidgets()
    45554505{
    4556     QVBoxLayout *pLayoutMain;
    4557     QWidget *pWidgetLeftPane;
    4558     QVBoxLayout *pLayoutLeftPane;
    4559     QHBoxLayout *pLayoutStorageBar;
    4560     QSpacerItem *pSpacerItem1;
    4561     QWidget *pWidgetEmpty;
    4562     QSpacerItem *pSpacerItem2;
    4563     QWidget *mWtController;
    4564     QSpacerItem *pSpacerItem3;
    4565     QWidget *pWidgetAttachment;
    4566     QHBoxLayout *pLayoutContainer;
    4567     QVBoxLayout *pLayoutAttachmentConfig;
    4568     QSpacerItem *pSpacerItem6;
    4569 
    4570     if (objectName().isEmpty())
    4571         setObjectName(QStringLiteral("UIMachineSettingsStorage"));
    4572     resize(800, 700);
    4573     pLayoutMain = new QVBoxLayout(this);
    4574     pLayoutMain->setObjectName(QStringLiteral("pLayoutMain"));
    4575     m_pSplitter = new QISplitter(this);
    4576     m_pSplitter->setObjectName(QStringLiteral("m_pSplitter"));
    4577     m_pSplitter->setOrientation(Qt::Horizontal);
    4578     m_pSplitter->setHandleWidth(4);
    4579     pWidgetLeftPane = new QWidget(m_pSplitter);
    4580     pWidgetLeftPane->setObjectName(QStringLiteral("pWidgetLeftPane"));
    4581     pLayoutLeftPane = new QVBoxLayout(pWidgetLeftPane);
    4582     pLayoutLeftPane->setObjectName(QStringLiteral("pLayoutLeftPane"));
    4583     pLayoutLeftPane->setContentsMargins(0, 0, 10, 0);
    4584     m_pLabelSeparatorLeftPane = new QILabelSeparator(pWidgetLeftPane);
    4585     m_pLabelSeparatorLeftPane->setObjectName(QStringLiteral("m_pLabelSeparatorLeftPane"));
    4586     pLayoutLeftPane->addWidget(m_pLabelSeparatorLeftPane);
    4587 
    4588     m_pLayoutStorage = new QVBoxLayout();
    4589     m_pLayoutStorage->setSpacing(3);
    4590     m_pLayoutStorage->setContentsMargins(0, 0, 0, 0);
    4591     m_pLayoutStorage->setObjectName(QStringLiteral("m_pLayoutStorage"));
    4592     pLayoutStorageBar = new QHBoxLayout();
    4593     pLayoutStorageBar->setObjectName(QStringLiteral("pLayoutStorageBar"));
    4594     pSpacerItem1 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
    4595 
    4596     pLayoutStorageBar->addItem(pSpacerItem1);
    4597 
    4598     m_pToolBarStorageBar = new UIToolBar(pWidgetLeftPane);
    4599     m_pToolBarStorageBar->setObjectName(QStringLiteral("m_pToolBarStorageBar"));
    4600     pLayoutStorageBar->addWidget(m_pToolBarStorageBar);
    4601 
    4602     m_pLayoutStorage->addLayout(pLayoutStorageBar);
    4603     pLayoutLeftPane->addLayout(m_pLayoutStorage);
    4604 
    4605     m_pSplitter->addWidget(pWidgetLeftPane);
    4606     mSwRightPane = new QStackedWidget(m_pSplitter);
    4607     mSwRightPane->setObjectName(QStringLiteral("mSwRightPane"));
    4608     pWidgetEmpty = new QWidget();
    4609     pWidgetEmpty->setObjectName(QStringLiteral("pWidgetEmpty"));
    4610     m_pLayoutEmpty = new QGridLayout(pWidgetEmpty);
    4611     m_pLayoutEmpty->setObjectName(QStringLiteral("m_pLayoutEmpty"));
    4612     m_pLayoutEmpty->setContentsMargins(10, 0, 0, 0);
    4613     m_pLabelSeparatorEmpty = new QILabelSeparator(pWidgetEmpty);
    4614     m_pLabelSeparatorEmpty->setObjectName(QStringLiteral("m_pLabelSeparatorEmpty"));
    4615     m_pLayoutEmpty->addWidget(m_pLabelSeparatorEmpty, 0, 0, 1, 2);
    4616 
    4617     m_pLabelInfo = new QLabel(pWidgetEmpty);
    4618     m_pLabelInfo->setObjectName(QStringLiteral("m_pLabelInfo"));
    4619     m_pLabelInfo->setWordWrap(true);
    4620     m_pLayoutEmpty->addWidget(m_pLabelInfo, 1, 1, 1, 1);
    4621 
    4622     pSpacerItem2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    4623     m_pLayoutEmpty->addItem(pSpacerItem2, 2, 0, 1, 2);
    4624 
    4625     mSwRightPane->addWidget(pWidgetEmpty);
    4626     mWtController = new QWidget();
    4627     mWtController->setObjectName(QStringLiteral("mWtController"));
    4628     m_pLayoutController = new QGridLayout(mWtController);
    4629     m_pLayoutController->setObjectName(QStringLiteral("m_pLayoutController"));
    4630     m_pLayoutController->setContentsMargins(10, 0, 0, 0);
    4631     m_pLabelSeparatorParameters = new QILabelSeparator(mWtController);
    4632     m_pLabelSeparatorParameters->setObjectName(QStringLiteral("m_pLabelSeparatorParameters"));
    4633     m_pLayoutController->addWidget(m_pLabelSeparatorParameters, 0, 0, 1, 3);
    4634 
    4635     m_pLabelName = new QLabel(mWtController);
    4636     m_pLabelName->setObjectName(QStringLiteral("m_pLabelName"));
    4637     m_pLabelName->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4638     m_pLayoutController->addWidget(m_pLabelName, 1, 1, 1, 1);
    4639 
    4640     m_pLineEditName = new QLineEdit(mWtController);
    4641     m_pLineEditName->setObjectName(QStringLiteral("m_pLineEditName"));
    4642     m_pLayoutController->addWidget(m_pLineEditName, 1, 2, 1, 1);
    4643 
    4644     m_pLabelType = new QLabel(mWtController);
    4645     m_pLabelType->setObjectName(QStringLiteral("m_pLabelType"));
    4646     m_pLabelType->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4647     m_pLayoutController->addWidget(m_pLabelType, 2, 1, 1, 1);
    4648 
    4649     m_pComboBoxType = new QComboBox(mWtController);
    4650     m_pComboBoxType->setObjectName(QStringLiteral("m_pComboBoxType"));
    4651     QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    4652     sizePolicy.setHorizontalStretch(0);
    4653     sizePolicy.setVerticalStretch(0);
    4654     sizePolicy.setHeightForWidth(m_pComboBoxType->sizePolicy().hasHeightForWidth());
    4655     m_pComboBoxType->setSizePolicy(sizePolicy);
    4656     m_pLayoutController->addWidget(m_pComboBoxType, 2, 2, 1, 1);
    4657 
    4658     m_pLabelPortCount = new QLabel(mWtController);
    4659     m_pLabelPortCount->setObjectName(QStringLiteral("m_pLabelPortCount"));
    4660     m_pLabelPortCount->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4661     m_pLayoutController->addWidget(m_pLabelPortCount, 3, 1, 1, 1);
    4662 
    4663     m_pSpinBoxPortCount = new QSpinBox(mWtController);
    4664     m_pSpinBoxPortCount->setObjectName(QStringLiteral("m_pSpinBoxPortCount"));
    4665     sizePolicy.setHeightForWidth(m_pSpinBoxPortCount->sizePolicy().hasHeightForWidth());
    4666     m_pSpinBoxPortCount->setSizePolicy(sizePolicy);
    4667     m_pLayoutController->addWidget(m_pSpinBoxPortCount, 3, 2, 1, 1);
    4668 
    4669     m_pCheckBoxIoCache = new QCheckBox(mWtController);
    4670     m_pCheckBoxIoCache->setObjectName(QStringLiteral("m_pCheckBoxIoCache"));
    4671     m_pLayoutController->addWidget(m_pCheckBoxIoCache, 4, 2, 1, 1);
    4672 
    4673     pSpacerItem3 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    4674     m_pLayoutController->addItem(pSpacerItem3, 5, 0, 1, 3);
    4675 
    4676     mSwRightPane->addWidget(mWtController);
    4677     pWidgetAttachment = new QWidget();
    4678     pWidgetAttachment->setObjectName(QStringLiteral("pWidgetAttachment"));
    4679     m_pLayoutAttachment = new QGridLayout(pWidgetAttachment);
    4680     m_pLayoutAttachment->setObjectName(QStringLiteral("m_pLayoutAttachment"));
    4681     m_pLayoutAttachment->setContentsMargins(10, 0, 0, 0);
    4682     m_pLabelSeparatorAttributes = new QILabelSeparator(pWidgetAttachment);
    4683     m_pLabelSeparatorAttributes->setObjectName(QStringLiteral("m_pLabelSeparatorAttributes"));
    4684     m_pLayoutAttachment->addWidget(m_pLabelSeparatorAttributes, 0, 0, 1, 3);
    4685 
    4686     m_pLabelMedium = new QLabel(pWidgetAttachment);
    4687     m_pLabelMedium->setObjectName(QStringLiteral("m_pLabelMedium"));
    4688     m_pLabelMedium->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4689     m_pLayoutAttachment->addWidget(m_pLabelMedium, 1, 1, 1, 1);
    4690 
    4691     pLayoutContainer = new QHBoxLayout();
    4692     pLayoutContainer->setSpacing(1);
    4693     pLayoutContainer->setObjectName(QStringLiteral("pLayoutContainer"));
    4694     pLayoutContainer->setContentsMargins(0, 0, 0, 0);
    4695     m_pComboBoxSlot = new QComboBox(pWidgetAttachment);
    4696     m_pComboBoxSlot->setObjectName(QStringLiteral("m_pComboBoxSlot"));
    4697     sizePolicy.setHeightForWidth(m_pComboBoxSlot->sizePolicy().hasHeightForWidth());
    4698     m_pComboBoxSlot->setSizePolicy(sizePolicy);
    4699     pLayoutContainer->addWidget(m_pComboBoxSlot);
    4700 
    4701     m_pToolButtonOpen = new QIToolButton(pWidgetAttachment);
    4702     m_pToolButtonOpen->setObjectName(QStringLiteral("m_pToolButtonOpen"));
    4703 
    4704     pLayoutContainer->addWidget(m_pToolButtonOpen);
    4705     m_pLayoutAttachment->addLayout(pLayoutContainer, 1, 2, 1, 1);
    4706 
    4707     pLayoutAttachmentConfig = new QVBoxLayout();
    4708     pLayoutAttachmentConfig->setSpacing(0);
    4709     pLayoutAttachmentConfig->setContentsMargins(0, 0, 0, 0);
    4710     pLayoutAttachmentConfig->setObjectName(QStringLiteral("pLayoutAttachmentConfig"));
    4711     m_pCheckBoxPassthrough = new QCheckBox(pWidgetAttachment);
    4712     m_pCheckBoxPassthrough->setObjectName(QStringLiteral("m_pCheckBoxPassthrough"));
    4713     QSizePolicy sizePolicy1(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    4714     sizePolicy1.setHorizontalStretch(0);
    4715     sizePolicy1.setVerticalStretch(0);
    4716     sizePolicy1.setHeightForWidth(m_pCheckBoxPassthrough->sizePolicy().hasHeightForWidth());
    4717     m_pCheckBoxPassthrough->setSizePolicy(sizePolicy1);
    4718     pLayoutAttachmentConfig->addWidget(m_pCheckBoxPassthrough);
    4719 
    4720     m_pCheckBoxTempEject = new QCheckBox(pWidgetAttachment);
    4721     m_pCheckBoxTempEject->setObjectName(QStringLiteral("m_pCheckBoxTempEject"));
    4722     sizePolicy1.setHeightForWidth(m_pCheckBoxTempEject->sizePolicy().hasHeightForWidth());
    4723     m_pCheckBoxTempEject->setSizePolicy(sizePolicy1);
    4724     pLayoutAttachmentConfig->addWidget(m_pCheckBoxTempEject);
    4725 
    4726     m_pCheckBoxNonRotational = new QCheckBox(pWidgetAttachment);
    4727     m_pCheckBoxNonRotational->setObjectName(QStringLiteral("m_pCheckBoxNonRotational"));
    4728     sizePolicy1.setHeightForWidth(m_pCheckBoxNonRotational->sizePolicy().hasHeightForWidth());
    4729     m_pCheckBoxNonRotational->setSizePolicy(sizePolicy1);
    4730     pLayoutAttachmentConfig->addWidget(m_pCheckBoxNonRotational);
    4731 
    4732     m_pCheckBoxHotPluggable = new QCheckBox(pWidgetAttachment);
    4733     m_pCheckBoxHotPluggable->setObjectName(QStringLiteral("m_pCheckBoxHotPluggable"));
    4734     sizePolicy1.setHeightForWidth(m_pCheckBoxHotPluggable->sizePolicy().hasHeightForWidth());
    4735     m_pCheckBoxHotPluggable->setSizePolicy(sizePolicy1);
    4736 
    4737     pLayoutAttachmentConfig->addWidget(m_pCheckBoxHotPluggable);
    4738     m_pLayoutAttachment->addLayout(pLayoutAttachmentConfig, 2, 2, 1, 1);
    4739 
    4740     m_pLabelSeparatorInformation = new QILabelSeparator(pWidgetAttachment);
    4741     m_pLabelSeparatorInformation->setObjectName(QStringLiteral("m_pLabelSeparatorInformation"));
    4742     m_pLayoutAttachment->addWidget(m_pLabelSeparatorInformation, 3, 0, 1, 3);
    4743 
    4744     m_pLabelHDFormat = new QLabel(pWidgetAttachment);
    4745     m_pLabelHDFormat->setObjectName(QStringLiteral("m_pLabelHDFormat"));
    4746     m_pLabelHDFormat->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4747     m_pLayoutAttachment->addWidget(m_pLabelHDFormat, 4, 1, 1, 1);
    4748 
    4749     m_pLabelHDFormatValue = new QILabel(pWidgetAttachment);
    4750     m_pLabelHDFormatValue->setObjectName(QStringLiteral("m_pLabelHDFormatValue"));
    4751     QSizePolicy sizePolicy2(QSizePolicy::Ignored, QSizePolicy::Preferred);
    4752     sizePolicy2.setHorizontalStretch(0);
    4753     sizePolicy2.setVerticalStretch(0);
    4754     sizePolicy2.setHeightForWidth(m_pLabelHDFormatValue->sizePolicy().hasHeightForWidth());
    4755     m_pLabelHDFormatValue->setSizePolicy(sizePolicy2);
    4756     m_pLayoutAttachment->addWidget(m_pLabelHDFormatValue, 4, 2, 1, 1);
    4757 
    4758     m_pLabelCDFDType = new QLabel(pWidgetAttachment);
    4759     m_pLabelCDFDType->setObjectName(QStringLiteral("m_pLabelCDFDType"));
    4760     m_pLabelCDFDType->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4761     m_pLayoutAttachment->addWidget(m_pLabelCDFDType, 5, 1, 1, 1);
    4762 
    4763     m_pLabelCDFDTypeValue = new QILabel(pWidgetAttachment);
    4764     m_pLabelCDFDTypeValue->setObjectName(QStringLiteral("m_pLabelCDFDTypeValue"));
    4765     sizePolicy2.setHeightForWidth(m_pLabelCDFDTypeValue->sizePolicy().hasHeightForWidth());
    4766     m_pLabelCDFDTypeValue->setSizePolicy(sizePolicy2);
    4767     m_pLayoutAttachment->addWidget(m_pLabelCDFDTypeValue, 5, 2, 1, 1);
    4768 
    4769     m_pLabelHDVirtualSize = new QLabel(pWidgetAttachment);
    4770     m_pLabelHDVirtualSize->setObjectName(QStringLiteral("m_pLabelHDVirtualSize"));
    4771     m_pLabelHDVirtualSize->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4772 
    4773     m_pLayoutAttachment->addWidget(m_pLabelHDVirtualSize, 6, 1, 1, 1);
    4774 
    4775     m_pLabelHDVirtualSizeValue = new QILabel(pWidgetAttachment);
    4776     m_pLabelHDVirtualSizeValue->setObjectName(QStringLiteral("m_pLabelHDVirtualSizeValue"));
    4777     sizePolicy2.setHeightForWidth(m_pLabelHDVirtualSizeValue->sizePolicy().hasHeightForWidth());
    4778     m_pLabelHDVirtualSizeValue->setSizePolicy(sizePolicy2);
    4779     m_pLayoutAttachment->addWidget(m_pLabelHDVirtualSizeValue, 6, 2, 1, 1);
    4780 
    4781     m_pLabelHDActualSize = new QLabel(pWidgetAttachment);
    4782     m_pLabelHDActualSize->setObjectName(QStringLiteral("m_pLabelHDActualSize"));
    4783     m_pLabelHDActualSize->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4784     m_pLayoutAttachment->addWidget(m_pLabelHDActualSize, 7, 1, 1, 1);
    4785 
    4786     m_pLabelHDActualSizeValue = new QILabel(pWidgetAttachment);
    4787     m_pLabelHDActualSizeValue->setObjectName(QStringLiteral("m_pLabelHDActualSizeValue"));
    4788     sizePolicy2.setHeightForWidth(m_pLabelHDActualSizeValue->sizePolicy().hasHeightForWidth());
    4789     m_pLabelHDActualSizeValue->setSizePolicy(sizePolicy2);
    4790     m_pLayoutAttachment->addWidget(m_pLabelHDActualSizeValue, 7, 2, 1, 1);
    4791 
    4792     m_pLabelSize = new QLabel(pWidgetAttachment);
    4793     m_pLabelSize->setObjectName(QStringLiteral("m_pLabelSize"));
    4794     m_pLabelSize->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4795     m_pLayoutAttachment->addWidget(m_pLabelSize, 8, 1, 1, 1);
    4796 
    4797     m_pLabelSizeValue = new QILabel(pWidgetAttachment);
    4798     m_pLabelSizeValue->setObjectName(QStringLiteral("m_pLabelSizeValue"));
    4799     sizePolicy2.setHeightForWidth(m_pLabelSizeValue->sizePolicy().hasHeightForWidth());
    4800     m_pLabelSizeValue->setSizePolicy(sizePolicy2);
    4801     m_pLayoutAttachment->addWidget(m_pLabelSizeValue, 8, 2, 1, 1);
    4802 
    4803     m_pLabelHDDetails = new QLabel(pWidgetAttachment);
    4804     m_pLabelHDDetails->setObjectName(QStringLiteral("m_pLabelHDDetails"));
    4805     m_pLabelHDDetails->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4806     m_pLayoutAttachment->addWidget(m_pLabelHDDetails, 9, 1, 1, 1);
    4807 
    4808     m_pLabelHDDetailsValue = new QILabel(pWidgetAttachment);
    4809     m_pLabelHDDetailsValue->setObjectName(QStringLiteral("m_pLabelHDDetailsValue"));
    4810     sizePolicy2.setHeightForWidth(m_pLabelHDDetailsValue->sizePolicy().hasHeightForWidth());
    4811     m_pLabelHDDetailsValue->setSizePolicy(sizePolicy2);
    4812     m_pLayoutAttachment->addWidget(m_pLabelHDDetailsValue, 9, 2, 1, 1);
    4813 
    4814     m_pLabelLocation = new QLabel(pWidgetAttachment);
    4815     m_pLabelLocation->setObjectName(QStringLiteral("m_pLabelLocation"));
    4816     m_pLabelLocation->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4817     m_pLayoutAttachment->addWidget(m_pLabelLocation, 10, 1, 1, 1);
    4818 
    4819     m_pLabelLocationValue = new QILabel(pWidgetAttachment);
    4820     m_pLabelLocationValue->setObjectName(QStringLiteral("m_pLabelLocationValue"));
    4821     sizePolicy2.setHeightForWidth(m_pLabelLocationValue->sizePolicy().hasHeightForWidth());
    4822     m_pLabelLocationValue->setSizePolicy(sizePolicy2);
    4823     m_pLayoutAttachment->addWidget(m_pLabelLocationValue, 10, 2, 1, 1);
    4824 
    4825     m_pLabelUsage = new QLabel(pWidgetAttachment);
    4826     m_pLabelUsage->setObjectName(QStringLiteral("m_pLabelUsage"));
    4827     m_pLabelUsage->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4828     m_pLayoutAttachment->addWidget(m_pLabelUsage, 11, 1, 1, 1);
    4829 
    4830     m_pLabelUsageValue = new QILabel(pWidgetAttachment);
    4831     m_pLabelUsageValue->setObjectName(QStringLiteral("m_pLabelUsageValue"));
    4832     sizePolicy2.setHeightForWidth(m_pLabelUsageValue->sizePolicy().hasHeightForWidth());
    4833     m_pLabelUsageValue->setSizePolicy(sizePolicy2);
    4834     m_pLayoutAttachment->addWidget(m_pLabelUsageValue, 11, 2, 1, 1);
    4835 
    4836     m_pLabelEncryption = new QLabel(pWidgetAttachment);
    4837     m_pLabelEncryption->setObjectName(QStringLiteral("m_pLabelEncryption"));
    4838     m_pLabelEncryption->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
    4839     m_pLayoutAttachment->addWidget(m_pLabelEncryption, 12, 1, 1, 1);
    4840 
    4841     m_pLabelEncryptionValue = new QILabel(pWidgetAttachment);
    4842     m_pLabelEncryptionValue->setObjectName(QStringLiteral("m_pLabelEncryptionValue"));
    4843     sizePolicy2.setHeightForWidth(m_pLabelEncryptionValue->sizePolicy().hasHeightForWidth());
    4844     m_pLabelEncryptionValue->setSizePolicy(sizePolicy2);
    4845     m_pLayoutAttachment->addWidget(m_pLabelEncryptionValue, 12, 2, 1, 1);
    4846 
    4847     pSpacerItem6 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    4848     m_pLayoutAttachment->addItem(pSpacerItem6, 13, 0, 1, 3);
    4849 
    4850     mSwRightPane->addWidget(pWidgetAttachment);
    4851     m_pSplitter->addWidget(mSwRightPane);
    4852     pLayoutMain->addWidget(m_pSplitter);
    4853 
    4854     m_pLabelName->setBuddy(m_pLineEditName);
    4855     m_pLabelType->setBuddy(m_pComboBoxType);
    4856     m_pLabelPortCount->setBuddy(m_pSpinBoxPortCount);
    4857     m_pLabelMedium->setBuddy(m_pToolButtonOpen);
    4858 }
    4859 
    4860 void UIMachineSettingsStorage::prepareStorageTree()
    4861 {
    4862     /* Create storage tree-view: */
     4506    /* Create main layout: */
     4507    QVBoxLayout *pLayoutMain = new QVBoxLayout(this);
     4508    if (pLayoutMain)
     4509    {
     4510        /* Create splitter: */
     4511        m_pSplitter = new QISplitter(this);
     4512        if (m_pSplitter)
     4513        {
     4514            m_pSplitter->setOrientation(Qt::Horizontal);
     4515            m_pSplitter->setHandleWidth(4);
     4516
     4517            /* Prepare panes: */
     4518            prepareLeftPane();
     4519            prepareRightPane();
     4520
     4521            pLayoutMain->addWidget(m_pSplitter);
     4522        }
     4523    }
     4524}
     4525
     4526void UIMachineSettingsStorage::prepareLeftPane()
     4527{
     4528    /* Prepare left pane: */
     4529    m_pWidgetLeftPane = new QWidget(m_pSplitter);
     4530    if (m_pWidgetLeftPane)
     4531    {
     4532        /* Prepare left pane layout: */
     4533        QVBoxLayout *pLayoutLeftPane = new QVBoxLayout(m_pWidgetLeftPane);
     4534        if (pLayoutLeftPane)
     4535        {
     4536            pLayoutLeftPane->setContentsMargins(0, 0, 10, 0);
     4537
     4538            /* Prepare left separator: */
     4539            m_pLabelSeparatorLeftPane = new QILabelSeparator(m_pWidgetLeftPane);
     4540            if (m_pLabelSeparatorLeftPane)
     4541                pLayoutLeftPane->addWidget(m_pLabelSeparatorLeftPane);
     4542
     4543            /* Prepare storage layout: */
     4544            m_pLayoutTreeView = new QVBoxLayout;
     4545            if (m_pLayoutTreeView)
     4546            {
     4547#ifdef VBOX_WS_MAC
     4548                m_pLayoutTreeView->setContentsMargins(3, 0, 3, 0);
     4549                m_pLayoutTreeView->setSpacing(3);
     4550#else
     4551                m_pLayoutTreeView->setContentsMargins(0, 0, 0, 0);
     4552                m_pLayoutTreeView->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 3);
     4553#endif
     4554
     4555                /* Prepare tree-view: */
     4556                prepareTreeView();
     4557
     4558                /* Prepare toolbar layout: */
     4559                m_pLayoutToolBar = new QHBoxLayout;
     4560                if (m_pLayoutToolBar)
     4561                {
     4562                    m_pLayoutToolBar->addStretch();
     4563
     4564                    /* Prepare toolbar: */
     4565                    prepareToolBar();
     4566
     4567                    m_pLayoutTreeView->addLayout(m_pLayoutToolBar);
     4568                }
     4569
     4570                pLayoutLeftPane->addLayout(m_pLayoutTreeView);
     4571            }
     4572        }
     4573
     4574        m_pSplitter->addWidget(m_pWidgetLeftPane);
     4575    }
     4576}
     4577
     4578void UIMachineSettingsStorage::prepareTreeView()
     4579{
     4580    /* Prepare tree-view: */
    48634581    m_pTreeStorage = new QITreeView;
    4864     AssertPtrReturnVoid(m_pTreeStorage);
    4865     AssertPtrReturnVoid(m_pLabelSeparatorLeftPane);
    4866     {
    4867         /* Configure tree-view: */
    4868         m_pLabelSeparatorLeftPane->setBuddy(m_pTreeStorage);
     4582    if (m_pTreeStorage)
     4583    {
     4584        if (m_pLabelSeparatorLeftPane)
     4585            m_pLabelSeparatorLeftPane->setBuddy(m_pTreeStorage);
    48694586        m_pTreeStorage->setMouseTracking(true);
    48704587        m_pTreeStorage->setAcceptDrops(true);
    48714588        m_pTreeStorage->setContextMenuPolicy(Qt::CustomContextMenu);
    48724589
    4873         /* Create storage model: */
     4590        /* Prepare storage model: */
    48744591        m_pModelStorage = new StorageModel(m_pTreeStorage);
    4875         AssertPtrReturnVoid(m_pModelStorage);
    4876         {
    4877             /* Configure model: */
     4592        if (m_pModelStorage)
     4593        {
    48784594            m_pTreeStorage->setModel(m_pModelStorage);
    48794595            m_pTreeStorage->setRootIndex(m_pModelStorage->root());
     
    48814597        }
    48824598
    4883         /* Create storage delegate: */
     4599        /* Prepare storage delegate: */
    48844600        StorageDelegate *pStorageDelegate = new StorageDelegate(m_pTreeStorage);
    4885         AssertPtrReturnVoid(pStorageDelegate);
    4886         {
    4887             /* Configure delegate: */
     4601        if (pStorageDelegate)
    48884602            m_pTreeStorage->setItemDelegate(pStorageDelegate);
    4889         }
    4890 
    4891         /* Insert tree-view into layout: */
    4892         m_pLayoutStorage->insertWidget(0, m_pTreeStorage);
    4893     }
    4894 }
    4895 
    4896 void UIMachineSettingsStorage::prepareStorageToolbar()
    4897 {
    4898     AssertPtrReturnVoid(m_pToolBarStorageBar);
     4603
     4604        m_pLayoutTreeView->addWidget(m_pTreeStorage);
     4605    }
     4606}
     4607
     4608void UIMachineSettingsStorage::prepareToolBar()
     4609{
     4610    /* Prepare toolbar: */
     4611    m_pToolBar = new UIToolBar(m_pWidgetLeftPane);
     4612    if (m_pToolBar)
    48994613    {
    49004614        /* Configure toolbar: */
    49014615        const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
    4902         m_pToolBarStorageBar->setIconSize(QSize(iIconMetric, iIconMetric));
    4903 
    4904         /* Create 'Add Controller' action: */
     4616        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
     4617
     4618        /* Prepare 'Add Controller' action: */
    49054619        m_pActionAddController = new QAction(this);
    4906         AssertPtrReturnVoid(m_pActionAddController);
    4907         {
    4908             /* Configure action: */
     4620        if (m_pActionAddController)
     4621        {
    49094622            m_pActionAddController->setIcon(iconPool()->icon(ControllerAddEn, ControllerAddDis));
    4910 
    4911             /* Add action into toolbar: */
    4912             m_pToolBarStorageBar->addAction(m_pActionAddController);
    4913         }
    4914 
    4915         /* Create 'Add PIIX3 Controller' action: */
     4623            m_pToolBar->addAction(m_pActionAddController);
     4624        }
     4625
     4626        /* Prepare 'Add PIIX3 Controller' action: */
    49164627        m_addControllerActions[KStorageControllerType_PIIX3] = new QAction(this);
    4917         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_PIIX3));
    4918         {
    4919             /* Configure action: */
     4628        if (m_addControllerActions.value(KStorageControllerType_PIIX3))
    49204629            m_addControllerActions.value(KStorageControllerType_PIIX3)->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));
    4921         }
    4922 
    4923         /* Create 'Add PIIX4 Controller' action: */
     4630        /* Prepare 'Add PIIX4 Controller' action: */
    49244631        m_addControllerActions[KStorageControllerType_PIIX4] = new QAction(this);
    4925         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_PIIX4));
    4926         {
    4927             /* Configure action: */
     4632        if (m_addControllerActions.value(KStorageControllerType_PIIX4))
    49284633            m_addControllerActions.value(KStorageControllerType_PIIX4)->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));
    4929         }
    4930 
    4931         /* Create 'Add ICH6 Controller' action: */
     4634        /* Prepare 'Add ICH6 Controller' action: */
    49324635        m_addControllerActions[KStorageControllerType_ICH6] = new QAction(this);
    4933         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_ICH6));
    4934         {
    4935             /* Configure action: */
     4636        if (m_addControllerActions.value(KStorageControllerType_ICH6))
    49364637            m_addControllerActions.value(KStorageControllerType_ICH6)->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));
    4937         }
    4938 
    4939         /* Create 'Add AHCI Controller' action: */
     4638        /* Prepare 'Add AHCI Controller' action: */
    49404639        m_addControllerActions[KStorageControllerType_IntelAhci] = new QAction(this);
    4941         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_IntelAhci));
    4942         {
    4943             /* Configure action: */
     4640        if (m_addControllerActions.value(KStorageControllerType_IntelAhci))
    49444641            m_addControllerActions.value(KStorageControllerType_IntelAhci)->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
    4945         }
    4946 
    4947         /* Create 'Add LsiLogic Controller' action: */
     4642        /* Prepare 'Add LsiLogic Controller' action: */
    49484643        m_addControllerActions[KStorageControllerType_LsiLogic] = new QAction(this);
    4949         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_LsiLogic));
    4950         {
    4951             /* Configure action: */
     4644        if (m_addControllerActions.value(KStorageControllerType_LsiLogic))
    49524645            m_addControllerActions.value(KStorageControllerType_LsiLogic)->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis));
    4953         }
    4954 
    4955         /* Create 'Add BusLogic Controller' action: */
     4646        /* Prepare 'Add BusLogic Controller' action: */
    49564647        m_addControllerActions[KStorageControllerType_BusLogic] = new QAction(this);
    4957         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_BusLogic));
    4958         {
    4959             /* Configure action: */
     4648        if (m_addControllerActions.value(KStorageControllerType_BusLogic))
    49604649            m_addControllerActions.value(KStorageControllerType_BusLogic)->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis));
    4961         }
    4962 
    4963         /* Create 'Add Floppy Controller' action: */
     4650        /* Prepare 'Add Floppy Controller' action: */
    49644651        m_addControllerActions[KStorageControllerType_I82078] = new QAction(this);
    4965         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_I82078));
    4966         {
    4967             /* Configure action: */
     4652        if (m_addControllerActions.value(KStorageControllerType_I82078))
    49684653            m_addControllerActions.value(KStorageControllerType_I82078)->setIcon(iconPool()->icon(FloppyControllerAddEn, FloppyControllerAddDis));
    4969         }
    4970 
    4971         /* Create 'Add LsiLogic SAS Controller' action: */
     4654        /* Prepare 'Add LsiLogic SAS Controller' action: */
    49724655        m_addControllerActions[KStorageControllerType_LsiLogicSas] = new QAction(this);
    4973         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_LsiLogicSas));
    4974         {
    4975             /* Configure action: */
     4656        if (m_addControllerActions.value(KStorageControllerType_LsiLogicSas))
    49764657            m_addControllerActions.value(KStorageControllerType_LsiLogicSas)->setIcon(iconPool()->icon(SASControllerAddEn, SASControllerAddDis));
    4977         }
    4978 
    4979         /* Create 'Add USB Controller' action: */
     4658        /* Prepare 'Add USB Controller' action: */
    49804659        m_addControllerActions[KStorageControllerType_USB] = new QAction(this);
    4981         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_USB));
    4982         {
    4983             /* Configure action: */
     4660        if (m_addControllerActions.value(KStorageControllerType_USB))
    49844661            m_addControllerActions.value(KStorageControllerType_USB)->setIcon(iconPool()->icon(USBControllerAddEn, USBControllerAddDis));
    4985         }
    4986 
    4987         /* Create 'Add NVMe Controller' action: */
     4662        /* Prepare 'Add NVMe Controller' action: */
    49884663        m_addControllerActions[KStorageControllerType_NVMe] = new QAction(this);
    4989         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_NVMe));
    4990         {
    4991             /* Configure action: */
     4664        if (m_addControllerActions.value(KStorageControllerType_NVMe))
    49924665            m_addControllerActions.value(KStorageControllerType_NVMe)->setIcon(iconPool()->icon(NVMeControllerAddEn, NVMeControllerAddDis));
    4993         }
    4994 
    4995         /* Create 'Add virtio-scsi Controller' action: */
     4666        /* Prepare 'Add virtio-scsi Controller' action: */
    49964667        m_addControllerActions[KStorageControllerType_VirtioSCSI] = new QAction(this);
    4997         AssertPtrReturnVoid(m_addControllerActions.value(KStorageControllerType_VirtioSCSI));
    4998         {
    4999             /* Configure action: */
     4668        if (m_addControllerActions.value(KStorageControllerType_VirtioSCSI))
    50004669            m_addControllerActions.value(KStorageControllerType_VirtioSCSI)->setIcon(iconPool()->icon(VirtioSCSIControllerAddEn, VirtioSCSIControllerAddDis));
    5001         }
    5002 
    5003         /* Create 'Remove Controller' action: */
     4670
     4671        /* Prepare 'Remove Controller' action: */
    50044672        m_pActionRemoveController = new QAction(this);
    5005         AssertPtrReturnVoid(m_pActionRemoveController);
    5006         {
    5007             /* Configure action: */
     4673        if (m_pActionRemoveController)
     4674        {
    50084675            m_pActionRemoveController->setIcon(iconPool()->icon(ControllerDelEn, ControllerDelDis));
    5009 
    5010             /* Add action into toolbar: */
    5011             m_pToolBarStorageBar->addAction(m_pActionRemoveController);
    5012         }
    5013 
    5014         /* Create 'Add Attachment' action: */
     4676            m_pToolBar->addAction(m_pActionRemoveController);
     4677        }
     4678
     4679        /* Prepare 'Add Attachment' action: */
    50154680        m_pActionAddAttachment = new QAction(this);
    5016         AssertPtrReturnVoid(m_pActionAddAttachment);
    5017         {
    5018             /* Configure action: */
     4681        if (m_pActionAddAttachment)
     4682        {
    50194683            m_pActionAddAttachment->setIcon(iconPool()->icon(AttachmentAddEn, AttachmentAddDis));
    5020 
    5021             /* Add action into toolbar: */
    5022             m_pToolBarStorageBar->addAction(m_pActionAddAttachment);
    5023         }
    5024 
    5025         /* Create 'Add HD Attachment' action: */
     4684            m_pToolBar->addAction(m_pActionAddAttachment);
     4685        }
     4686
     4687        /* Prepare 'Add HD Attachment' action: */
    50264688        m_pActionAddAttachmentHD = new QAction(this);
    5027         AssertPtrReturnVoid(m_pActionAddAttachmentHD);
    5028         {
    5029             /* Configure action: */
     4689        if (m_pActionAddAttachmentHD)
    50304690            m_pActionAddAttachmentHD->setIcon(iconPool()->icon(HDAttachmentAddEn, HDAttachmentAddDis));
    5031         }
    5032 
    5033         /* Create 'Add CD Attachment' action: */
     4691        /* Prepare 'Add CD Attachment' action: */
    50344692        m_pActionAddAttachmentCD = new QAction(this);
    5035         AssertPtrReturnVoid(m_pActionAddAttachmentCD);
    5036         {
    5037             /* Configure action: */
     4693        if (m_pActionAddAttachmentCD)
    50384694            m_pActionAddAttachmentCD->setIcon(iconPool()->icon(CDAttachmentAddEn, CDAttachmentAddDis));
    5039         }
    5040 
    5041         /* Create 'Add FD Attachment' action: */
     4695        /* Prepare 'Add FD Attachment' action: */
    50424696        m_pActionAddAttachmentFD = new QAction(this);
    5043         AssertPtrReturnVoid(m_pActionAddAttachmentFD);
    5044         {
    5045             /* Configure action: */
     4697        if (m_pActionAddAttachmentFD)
    50464698            m_pActionAddAttachmentFD->setIcon(iconPool()->icon(FDAttachmentAddEn, FDAttachmentAddDis));
    5047         }
    5048 
    5049         /* Create 'Remove Attachment' action: */
     4699
     4700        /* Prepare 'Remove Attachment' action: */
    50504701        m_pActionRemoveAttachment = new QAction(this);
    5051         AssertPtrReturnVoid(m_pActionRemoveAttachment);
    5052         {
    5053             /* Configure action: */
     4702        if (m_pActionRemoveAttachment)
     4703        {
    50544704            m_pActionRemoveAttachment->setIcon(iconPool()->icon(AttachmentDelEn, AttachmentDelDis));
    5055 
    5056             /* Add action into toolbar: */
    5057             m_pToolBarStorageBar->addAction(m_pActionRemoveAttachment);
    5058         }
    5059     }
    5060 }
    5061 
    5062 void UIMachineSettingsStorage::prepareStorageWidgets()
    5063 {
    5064     AssertPtrReturnVoid(m_pToolButtonOpen);
    5065     {
    5066         /* Create Open Medium menu: */
    5067         QMenu *pOpenMediumMenu = new QMenu(m_pToolButtonOpen);
    5068         AssertPtrReturnVoid(pOpenMediumMenu);
    5069         {
    5070             /* Add menu into tool-button: */
    5071             m_pToolButtonOpen->setMenu(pOpenMediumMenu);
    5072         }
    5073     }
    5074 
    5075     AssertPtrReturnVoid(m_pSpinBoxPortCount);
    5076     AssertPtrReturnVoid(m_pLabelHDFormatValue);
    5077     AssertPtrReturnVoid(m_pLabelCDFDTypeValue);
    5078     AssertPtrReturnVoid(m_pLabelHDVirtualSizeValue);
    5079     AssertPtrReturnVoid(m_pLabelHDActualSizeValue);
    5080     AssertPtrReturnVoid(m_pLabelSizeValue);
    5081     AssertPtrReturnVoid(m_pLabelHDDetailsValue);
    5082     AssertPtrReturnVoid(m_pLabelLocationValue);
    5083     AssertPtrReturnVoid(m_pLabelUsageValue);
    5084     AssertPtrReturnVoid(m_pLabelEncryptionValue);
    5085     {
    5086         /* Configure widgets: */
    5087         m_pSpinBoxPortCount->setValue(0);
    5088         m_pLabelHDFormatValue->setFullSizeSelection(true);
    5089         m_pLabelCDFDTypeValue->setFullSizeSelection(true);
    5090         m_pLabelHDVirtualSizeValue->setFullSizeSelection(true);
    5091         m_pLabelHDActualSizeValue->setFullSizeSelection(true);
    5092         m_pLabelSizeValue->setFullSizeSelection(true);
    5093         m_pLabelHDDetailsValue->setFullSizeSelection(true);
    5094         m_pLabelLocationValue->setFullSizeSelection(true);
    5095         m_pLabelUsageValue->setFullSizeSelection(true);
    5096         m_pLabelEncryptionValue->setFullSizeSelection(true);
     4705            m_pToolBar->addAction(m_pActionRemoveAttachment);
     4706        }
     4707
     4708        m_pLayoutToolBar->addWidget(m_pToolBar);
     4709    }
     4710}
     4711
     4712void UIMachineSettingsStorage::prepareRightPane()
     4713{
     4714    /* Prepare right pane: */
     4715    m_pStackRightPane = new QStackedWidget(m_pSplitter);
     4716    if (m_pStackRightPane)
     4717    {
     4718        /* Prepare stack contents: */
     4719        prepareEmptyWidget();
     4720        prepareControllerWidget();
     4721        prepareAttachmentWidget();
     4722
     4723        m_pSplitter->addWidget(m_pStackRightPane);
     4724    }
     4725}
     4726
     4727void UIMachineSettingsStorage::prepareEmptyWidget()
     4728{
     4729    /* Prepare widget for empty case: */
     4730    QWidget *pWidgetEmpty = new QWidget;
     4731    if (pWidgetEmpty)
     4732    {
     4733        /* Create widget layout for empty case: */
     4734        QGridLayout *pLayoutEmpty = new QGridLayout(pWidgetEmpty);
     4735        if (pLayoutEmpty)
     4736        {
     4737            pLayoutEmpty->setContentsMargins(10, 0, 0, 0);
     4738            pLayoutEmpty->setRowStretch(2, 1);
     4739
     4740            /* Prepare separator for empty case: */
     4741            m_pLabelSeparatorEmpty = new QILabelSeparator(pWidgetEmpty);
     4742            if (m_pLabelSeparatorEmpty)
     4743                pLayoutEmpty->addWidget(m_pLabelSeparatorEmpty, 0, 0, 1, 2);
     4744
     4745            /* Prepare label for empty case: */
     4746            m_pLabelInfo = new QLabel(pWidgetEmpty);
     4747            if (m_pLabelInfo)
     4748            {
     4749                m_pLabelInfo->setWordWrap(true);
     4750                pLayoutEmpty->addWidget(m_pLabelInfo, 1, 1, 1, 1);
     4751            }
     4752
     4753            pLayoutEmpty->setColumnMinimumWidth(0, 10);
     4754        }
     4755
     4756        m_pStackRightPane->addWidget(pWidgetEmpty);
     4757    }
     4758}
     4759
     4760void UIMachineSettingsStorage::prepareControllerWidget()
     4761{
     4762    /* Create widget for controller case: */
     4763    QWidget *pWidgetController = new QWidget;
     4764    if (pWidgetController)
     4765    {
     4766        /* Create widget layout for controller case: */
     4767        QGridLayout *m_pLayoutController = new QGridLayout(pWidgetController);
     4768        if (m_pLayoutController)
     4769        {
     4770            m_pLayoutController->setContentsMargins(10, 0, 0, 0);
     4771            m_pLayoutController->setRowStretch(5, 1);
     4772
     4773            /* Prepare separator for controller case: */
     4774            m_pLabelSeparatorParameters = new QILabelSeparator(pWidgetController);
     4775            if (m_pLabelSeparatorParameters)
     4776                m_pLayoutController->addWidget(m_pLabelSeparatorParameters, 0, 0, 1, 3);
     4777
     4778            /* Prepare name label: */
     4779            m_pLabelName = new QLabel(pWidgetController);
     4780            if (m_pLabelName)
     4781            {
     4782                m_pLabelName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4783                m_pLayoutController->addWidget(m_pLabelName, 1, 1, 1, 1);
     4784            }
     4785            /* Prepare name editor: */
     4786            m_pEditorName = new QLineEdit(pWidgetController);
     4787            if (m_pEditorName)
     4788            {
     4789                m_pLabelName->setBuddy(m_pEditorName);
     4790                m_pLayoutController->addWidget(m_pEditorName, 1, 2, 1, 1);
     4791            }
     4792
     4793            /* Prepare type label: */
     4794            m_pLabelType = new QLabel(pWidgetController);
     4795            if (m_pLabelType)
     4796            {
     4797                m_pLabelType->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4798                m_pLayoutController->addWidget(m_pLabelType, 2, 1, 1, 1);
     4799            }
     4800            /* Prepare type combo: */
     4801            m_pComboType = new QComboBox(pWidgetController);
     4802            if (m_pComboType)
     4803            {
     4804                m_pLabelType->setBuddy(m_pComboType);
     4805                m_pComboType->setSizeAdjustPolicy(QComboBox::AdjustToContents);
     4806                m_pLayoutController->addWidget(m_pComboType, 2, 2, 1, 1);
     4807            }
     4808
     4809            /* Prepare port count label: */
     4810            m_pLabelPortCount = new QLabel(pWidgetController);
     4811            if (m_pLabelPortCount)
     4812            {
     4813                m_pLabelPortCount->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4814                m_pLayoutController->addWidget(m_pLabelPortCount, 3, 1, 1, 1);
     4815            }
     4816            /* Prepare port count spinbox: */
     4817            m_pSpinBoxPortCount = new QSpinBox(pWidgetController);
     4818            if (m_pSpinBoxPortCount)
     4819            {
     4820                m_pLabelPortCount->setBuddy(m_pSpinBoxPortCount);
     4821                m_pLayoutController->addWidget(m_pSpinBoxPortCount, 3, 2, 1, 1);
     4822            }
     4823
     4824            /* Prepare port count check-box: */
     4825            m_pCheckBoxIoCache = new QCheckBox(pWidgetController);
     4826            if (m_pCheckBoxIoCache)
     4827                m_pLayoutController->addWidget(m_pCheckBoxIoCache, 4, 2, 1, 1);
     4828
     4829            m_pLayoutController->setColumnMinimumWidth(0, 10);
     4830        }
     4831
     4832        m_pStackRightPane->addWidget(pWidgetController);
     4833    }
     4834}
     4835
     4836void UIMachineSettingsStorage::prepareAttachmentWidget()
     4837{
     4838    /* Create widget for attachment case: */
     4839    QWidget *pWidgetAttachment = new QWidget;
     4840    if (pWidgetAttachment)
     4841    {
     4842        /* Create widget layout for attachment case: */
     4843        QGridLayout *m_pLayoutAttachment = new QGridLayout(pWidgetAttachment);
     4844        if (m_pLayoutAttachment)
     4845        {
     4846            m_pLayoutAttachment->setContentsMargins(10, 0, 0, 0);
     4847            m_pLayoutAttachment->setColumnStretch(2, 1);
     4848            m_pLayoutAttachment->setRowStretch(13, 1);
     4849
     4850            /* Prepare separator for attachment case: */
     4851            m_pLabelSeparatorAttributes = new QILabelSeparator(pWidgetAttachment);
     4852            if (m_pLabelSeparatorAttributes)
     4853                m_pLayoutAttachment->addWidget(m_pLabelSeparatorAttributes, 0, 0, 1, 3);
     4854
     4855            /* Prepare medium label: */
     4856            m_pLabelMedium = new QLabel(pWidgetAttachment);
     4857            if (m_pLabelMedium)
     4858            {
     4859                m_pLabelMedium->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4860                m_pLayoutAttachment->addWidget(m_pLabelMedium, 1, 1);
     4861            }
     4862
     4863            /* Prepare slot layout: */
     4864            QHBoxLayout *pLayoutContainer = new QHBoxLayout;
     4865            if (pLayoutContainer)
     4866            {
     4867                pLayoutContainer->setContentsMargins(0, 0, 0, 0);
     4868                pLayoutContainer->setSpacing(1);
     4869
     4870                /* Prepare slot combo: */
     4871                m_pComboSlot = new QComboBox(pWidgetAttachment);
     4872                if (m_pComboSlot)
     4873                    pLayoutContainer->addWidget(m_pComboSlot);
     4874
     4875                /* Prepare slot combo: */
     4876                m_pToolButtonOpen = new QIToolButton(pWidgetAttachment);
     4877                if (m_pToolButtonOpen)
     4878                {
     4879                    if (m_pLabelMedium)
     4880                        m_pLabelMedium->setBuddy(m_pToolButtonOpen);
     4881
     4882                    /* Prepare open medium menu: */
     4883                    QMenu *pOpenMediumMenu = new QMenu(m_pToolButtonOpen);
     4884                    if (pOpenMediumMenu)
     4885                        m_pToolButtonOpen->setMenu(pOpenMediumMenu);
     4886
     4887                    pLayoutContainer->addWidget(m_pToolButtonOpen);
     4888                }
     4889
     4890                m_pLayoutAttachment->addLayout(pLayoutContainer, 1, 2);
     4891            }
     4892
     4893            /* Prepare attachment settings layout: */
     4894            QVBoxLayout *pLayoutAttachmentSettings = new QVBoxLayout;
     4895            if (pLayoutAttachmentSettings)
     4896            {
     4897                pLayoutAttachmentSettings->setContentsMargins(0, 0, 0, 0);
     4898                pLayoutAttachmentSettings->setSpacing(0);
     4899
     4900                /* Prepare attachment passthrough check-box: */
     4901                m_pCheckBoxPassthrough = new QCheckBox(pWidgetAttachment);
     4902                if (m_pCheckBoxPassthrough)
     4903                    pLayoutAttachmentSettings->addWidget(m_pCheckBoxPassthrough);
     4904
     4905                /* Prepare attachment temporary eject check-box: */
     4906                m_pCheckBoxTempEject = new QCheckBox(pWidgetAttachment);
     4907                if (m_pCheckBoxTempEject)
     4908                    pLayoutAttachmentSettings->addWidget(m_pCheckBoxTempEject);
     4909
     4910                /* Prepare attachment non rotational check-box: */
     4911                m_pCheckBoxNonRotational = new QCheckBox(pWidgetAttachment);
     4912                if (m_pCheckBoxNonRotational)
     4913                    pLayoutAttachmentSettings->addWidget(m_pCheckBoxNonRotational);
     4914
     4915                /* Prepare attachment hot pluggable check-box: */
     4916                m_pCheckBoxHotPluggable = new QCheckBox(pWidgetAttachment);
     4917                if (m_pCheckBoxHotPluggable)
     4918                    pLayoutAttachmentSettings->addWidget(m_pCheckBoxHotPluggable);
     4919
     4920                m_pLayoutAttachment->addLayout(pLayoutAttachmentSettings, 2, 2, 1, 1);
     4921            }
     4922
     4923            /* Prepare separator for attachment case: */
     4924            m_pLabelSeparatorInformation = new QILabelSeparator(pWidgetAttachment);
     4925            if (m_pLabelSeparatorInformation)
     4926                m_pLayoutAttachment->addWidget(m_pLabelSeparatorInformation, 3, 0, 1, 3);
     4927
     4928            /* Prepare HD format label: */
     4929            m_pLabelHDFormat = new QLabel(pWidgetAttachment);
     4930            if (m_pLabelHDFormat)
     4931            {
     4932                m_pLabelHDFormat->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4933                m_pLayoutAttachment->addWidget(m_pLabelHDFormat, 4, 1);
     4934            }
     4935            /* Prepare HD format field: */
     4936            m_pFieldHDFormat = new QILabel(pWidgetAttachment);
     4937            if (m_pFieldHDFormat)
     4938            {
     4939                m_pFieldHDFormat->setFullSizeSelection(true);
     4940                m_pLayoutAttachment->addWidget(m_pFieldHDFormat, 4, 2);
     4941            }
     4942
     4943            /* Prepare CD/FD type label: */
     4944            m_pLabelCDFDType = new QLabel(pWidgetAttachment);
     4945            if (m_pLabelCDFDType)
     4946            {
     4947                m_pLabelCDFDType->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4948                m_pLayoutAttachment->addWidget(m_pLabelCDFDType, 5, 1);
     4949            }
     4950            /* Prepare CD/FD type field: */
     4951            m_pFieldCDFDType = new QILabel(pWidgetAttachment);
     4952            if (m_pFieldCDFDType)
     4953            {
     4954                m_pFieldCDFDType->setFullSizeSelection(true);
     4955                m_pLayoutAttachment->addWidget(m_pFieldCDFDType, 5, 2);
     4956            }
     4957
     4958            /* Prepare HD virtual size label: */
     4959            m_pLabelHDVirtualSize = new QLabel(pWidgetAttachment);
     4960            if (m_pLabelHDVirtualSize)
     4961            {
     4962                m_pLabelHDVirtualSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4963                m_pLayoutAttachment->addWidget(m_pLabelHDVirtualSize, 6, 1);
     4964            }
     4965            /* Prepare HD virtual size field: */
     4966            m_pFieldHDVirtualSize = new QILabel(pWidgetAttachment);
     4967            if (m_pFieldHDVirtualSize)
     4968            {
     4969                m_pFieldHDVirtualSize->setFullSizeSelection(true);
     4970                m_pLayoutAttachment->addWidget(m_pFieldHDVirtualSize, 6, 2);
     4971            }
     4972
     4973            /* Prepare HD actual size label: */
     4974            m_pLabelHDActualSize = new QLabel(pWidgetAttachment);
     4975            if (m_pLabelHDActualSize)
     4976            {
     4977                m_pLabelHDActualSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4978                m_pLayoutAttachment->addWidget(m_pLabelHDActualSize, 7, 1);
     4979            }
     4980            /* Prepare HD actual size field: */
     4981            m_pFieldHDActualSize = new QILabel(pWidgetAttachment);
     4982            if (m_pFieldHDActualSize)
     4983            {
     4984                m_pFieldHDActualSize->setFullSizeSelection(true);
     4985                m_pLayoutAttachment->addWidget(m_pFieldHDActualSize, 7, 2);
     4986            }
     4987
     4988            /* Prepare CD/FD size label: */
     4989            m_pLabelCDFDSize = new QLabel(pWidgetAttachment);
     4990            if (m_pLabelCDFDSize)
     4991            {
     4992                m_pLabelCDFDSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     4993                m_pLayoutAttachment->addWidget(m_pLabelCDFDSize, 8, 1);
     4994            }
     4995            /* Prepare CD/FD size field: */
     4996            m_pFieldCDFDSize = new QILabel(pWidgetAttachment);
     4997            if (m_pFieldCDFDSize)
     4998            {
     4999                m_pFieldCDFDSize->setFullSizeSelection(true);
     5000                m_pLayoutAttachment->addWidget(m_pFieldCDFDSize, 8, 2);
     5001            }
     5002
     5003            /* Prepare HD details label: */
     5004            m_pLabelHDDetails = new QLabel(pWidgetAttachment);
     5005            if (m_pLabelHDDetails)
     5006            {
     5007                m_pLabelHDDetails->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     5008                m_pLayoutAttachment->addWidget(m_pLabelHDDetails, 9, 1);
     5009            }
     5010            /* Prepare HD details field: */
     5011            m_pFieldHDDetails = new QILabel(pWidgetAttachment);
     5012            if (m_pFieldHDDetails)
     5013            {
     5014                m_pFieldHDDetails->setFullSizeSelection(true);
     5015                m_pLayoutAttachment->addWidget(m_pFieldHDDetails, 9, 2);
     5016            }
     5017
     5018            /* Prepare location label: */
     5019            m_pLabelLocation = new QLabel(pWidgetAttachment);
     5020            if (m_pLabelLocation)
     5021            {
     5022                m_pLabelLocation->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     5023                m_pLayoutAttachment->addWidget(m_pLabelLocation, 10, 1);
     5024            }
     5025            /* Prepare location field: */
     5026            m_pFieldLocation = new QILabel(pWidgetAttachment);
     5027            if (m_pFieldLocation)
     5028            {
     5029                m_pFieldLocation->setFullSizeSelection(true);
     5030                m_pLayoutAttachment->addWidget(m_pFieldLocation, 10, 2);
     5031            }
     5032
     5033            /* Prepare usage label: */
     5034            m_pLabelUsage = new QLabel(pWidgetAttachment);
     5035            if (m_pLabelUsage)
     5036            {
     5037                m_pLabelUsage->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     5038                m_pLayoutAttachment->addWidget(m_pLabelUsage, 11, 1);
     5039            }
     5040            /* Prepare usage field: */
     5041            m_pFieldUsage = new QILabel(pWidgetAttachment);
     5042            if (m_pFieldUsage)
     5043            {
     5044                m_pFieldUsage->setFullSizeSelection(true);
     5045                m_pLayoutAttachment->addWidget(m_pFieldUsage, 11, 2);
     5046            }
     5047
     5048            /* Prepare encryption label: */
     5049            m_pLabelEncryption = new QLabel(pWidgetAttachment);
     5050            if (m_pLabelEncryption)
     5051            {
     5052                m_pLabelEncryption->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     5053                m_pLayoutAttachment->addWidget(m_pLabelEncryption, 12, 1);
     5054            }
     5055            /* Prepare encryption field: */
     5056            m_pFieldEncryption = new QILabel(pWidgetAttachment);
     5057            if (m_pFieldEncryption)
     5058            {
     5059                m_pFieldEncryption->setFullSizeSelection(true);
     5060                m_pLayoutAttachment->addWidget(m_pFieldEncryption, 12, 2);
     5061            }
     5062
     5063            m_pLayoutAttachment->setColumnMinimumWidth(0, 10);
     5064        }
     5065
     5066        m_pStackRightPane->addWidget(pWidgetAttachment);
    50975067    }
    50985068}
     
    51645134    connect(m_pSpinBoxPortCount, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
    51655135            this, &UIMachineSettingsStorage::sltSetInformation);
    5166     connect(m_pLineEditName, &QLineEdit::textEdited,
     5136    connect(m_pEditorName, &QLineEdit::textEdited,
    51675137            this, &UIMachineSettingsStorage::sltSetInformation);
    5168     connect(m_pComboBoxType, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),
     5138    connect(m_pComboType, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),
    51695139            this, &UIMachineSettingsStorage::sltSetInformation);
    5170     connect(m_pComboBoxSlot, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),
     5140    connect(m_pComboSlot, static_cast<void(QComboBox::*)(int)>(&QComboBox::activated),
    51715141            this, &UIMachineSettingsStorage::sltSetInformation);
    51725142    connect(m_pCheckBoxIoCache, &QCheckBox::stateChanged,
     
    52675237{
    52685238    m_pLabelHDFormat->setVisible(enmType == KDeviceType_HardDisk);
    5269     m_pLabelHDFormatValue->setVisible(enmType == KDeviceType_HardDisk);
     5239    m_pFieldHDFormat->setVisible(enmType == KDeviceType_HardDisk);
    52705240
    52715241    m_pLabelCDFDType->setVisible(enmType != KDeviceType_HardDisk);
    5272     m_pLabelCDFDTypeValue->setVisible(enmType != KDeviceType_HardDisk);
     5242    m_pFieldCDFDType->setVisible(enmType != KDeviceType_HardDisk);
    52735243
    52745244    m_pLabelHDVirtualSize->setVisible(enmType == KDeviceType_HardDisk);
    5275     m_pLabelHDVirtualSizeValue->setVisible(enmType == KDeviceType_HardDisk);
     5245    m_pFieldHDVirtualSize->setVisible(enmType == KDeviceType_HardDisk);
    52765246
    52775247    m_pLabelHDActualSize->setVisible(enmType == KDeviceType_HardDisk);
    5278     m_pLabelHDActualSizeValue->setVisible(enmType == KDeviceType_HardDisk);
    5279 
    5280     m_pLabelSize->setVisible(enmType != KDeviceType_HardDisk);
    5281     m_pLabelSizeValue->setVisible(enmType != KDeviceType_HardDisk);
     5248    m_pFieldHDActualSize->setVisible(enmType == KDeviceType_HardDisk);
     5249
     5250    m_pLabelCDFDSize->setVisible(enmType != KDeviceType_HardDisk);
     5251    m_pFieldCDFDSize->setVisible(enmType != KDeviceType_HardDisk);
    52825252
    52835253    m_pLabelHDDetails->setVisible(enmType == KDeviceType_HardDisk);
    5284     m_pLabelHDDetailsValue->setVisible(enmType == KDeviceType_HardDisk);
     5254    m_pFieldHDDetails->setVisible(enmType == KDeviceType_HardDisk);
    52855255
    52865256    m_pLabelEncryption->setVisible(enmType == KDeviceType_HardDisk);
    5287     m_pLabelEncryptionValue->setVisible(enmType == KDeviceType_HardDisk);
     5257    m_pFieldEncryption->setVisible(enmType == KDeviceType_HardDisk);
    52885258}
    52895259
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r85711 r85872  
    3030class QComboBox;
    3131class QGridLayout;
     32class QHBoxLayout;
    3233class QLabel;
    3334class QSpinBox;
     
    105106    /** Performs final page polishing. */
    106107    virtual void polishPage() /* override */;
    107 
    108     /** Handles show @a pEvent. */
    109     virtual void showEvent(QShowEvent *pEvent) /* override */;
    110108
    111109private slots:
     
    209207    /** Prepares widgets. */
    210208    void prepareWidgets();
    211     /** Prepares storage tree. */
    212     void prepareStorageTree();
    213     /** Prepares storage toolbar. */
    214     void prepareStorageToolbar();
    215     /** Prepares storage widgets. */
    216     void prepareStorageWidgets();
     209    /** Prepares left pane. */
     210    void prepareLeftPane();
     211    /** Prepares tree view. */
     212    void prepareTreeView();
     213    /** Prepares toolbar. */
     214    void prepareToolBar();
     215    /** Prepares right pane. */
     216    void prepareRightPane();
     217    /** Prepares empty widget. */
     218    void prepareEmptyWidget();
     219    /** Prepares controller widget. */
     220    void prepareControllerWidget();
     221    /** Prepares attachment widget. */
     222    void prepareAttachmentWidget();
    217223    /** Prepares connections. */
    218224    void prepareConnections();
     
    276282    QString  m_strMachineGuestOSTypeId;
    277283
    278     /** Holds the storage-tree instance. */
    279     QITreeView   *m_pTreeStorage;
    280284    /** Holds the storage-model instance. */
    281285    StorageModel *m_pModelStorage;
     
    302306    UIMediumIDHolder *m_pMediumIdHolder;
    303307
    304     /** Holds whether the page is polished. */
    305     bool  m_fPolished;
    306308    /** Holds whether the loading is in progress. */
    307309    bool  m_fLoadingInProgress;
     
    312314    /** Holds the page data cache instance. */
    313315    UISettingsCacheMachineStorage *m_pCache;
     316
    314317    /** @name Widgets
    315318     * @{ */
    316        QILabelSeparator *m_pLabelSeparatorLeftPane;
    317        QILabelSeparator *m_pLabelSeparatorEmpty;
    318        QILabelSeparator *m_pLabelSeparatorParameters;
    319        QILabelSeparator *m_pLabelSeparatorAttributes;
    320        QILabelSeparator *m_pLabelSeparatorInformation;
    321        QLabel *m_pLabelInfo;
    322        QLabel *m_pLabelName;
    323        QLabel *m_pLabelType;
    324        QLabel *m_pLabelPortCount;
    325        QLabel *m_pLabelHDFormat;
    326        QLabel *m_pLabelCDFDType;
    327        QLabel *m_pLabelHDVirtualSize;
    328        QLabel *m_pLabelHDActualSize;
    329        QLabel *m_pLabelSize;
    330        QLabel *m_pLabelHDDetails;
    331        QLabel *m_pLabelLocation;
    332        QLabel *m_pLabelUsage;
    333        QLabel *m_pLabelEncryption;
    334        QLabel *m_pLabelMedium;
    335        QILabel *m_pLabelHDFormatValue;
    336        QILabel *m_pLabelCDFDTypeValue;
    337        QILabel *m_pLabelHDVirtualSizeValue;
    338        QILabel *m_pLabelHDActualSizeValue;
    339        QILabel *m_pLabelSizeValue;
    340        QILabel *m_pLabelHDDetailsValue;
    341        QILabel *m_pLabelLocationValue;
    342        QILabel *m_pLabelUsageValue;
    343        QILabel *m_pLabelEncryptionValue;
    344        QLineEdit *m_pLineEditName;
    345        QComboBox *m_pComboBoxType;
    346        QComboBox *m_pComboBoxSlot;
    347        QSpinBox *m_pSpinBoxPortCount;
    348        QCheckBox *m_pCheckBoxIoCache;
    349        QCheckBox *m_pCheckBoxPassthrough;
    350        QCheckBox *m_pCheckBoxTempEject;
    351        QCheckBox *m_pCheckBoxNonRotational;
    352        QCheckBox *m_pCheckBoxHotPluggable;
    353        QIToolButton *m_pToolButtonOpen;
    354        UIToolBar *m_pToolBarStorageBar;
    355        QGridLayout *m_pLayoutController;
    356        QGridLayout *m_pLayoutEmpty;
    357        QGridLayout *m_pLayoutAttachment;
    358        QStackedWidget *mSwRightPane;
    359        QVBoxLayout *m_pLayoutStorage;
    360        QISplitter *m_pSplitter;
     319        /** Holds the splitter instance. */
     320        QISplitter       *m_pSplitter;
     321        /** Holds the left pane instance. */
     322        QWidget          *m_pWidgetLeftPane;
     323        /** Holds the left pane separator instance. */
     324        QILabelSeparator *m_pLabelSeparatorLeftPane;
     325        /** Holds the tree-view layout instance. */
     326        QVBoxLayout      *m_pLayoutTreeView;
     327        /** Holds the tree-view instance. */
     328        QITreeView       *m_pTreeStorage;
     329        /** Holds the toolbar layout instance. */
     330        QHBoxLayout      *m_pLayoutToolBar;
     331        /** Holds the tree-view instance. */
     332        UIToolBar        *m_pToolBar;
     333
     334        /** Holds the right pane instance. */
     335        QStackedWidget   *m_pStackRightPane;
     336        /** Holds the right pane empty widget separator instance. */
     337        QILabelSeparator *m_pLabelSeparatorEmpty;
     338        /** Holds the info label instance. */
     339        QLabel           *m_pLabelInfo;
     340        /** Holds the right pane controller widget separator instance. */
     341        QILabelSeparator *m_pLabelSeparatorParameters;
     342        /** Holds the name label instance. */
     343        QLabel           *m_pLabelName;
     344        /** Holds the name editor instance. */
     345        QLineEdit        *m_pEditorName;
     346        /** Holds the type label instance. */
     347        QLabel           *m_pLabelType;
     348        /** Holds the type combo instance. */
     349        QComboBox        *m_pComboType;
     350        /** Holds the port count label instance. */
     351        QLabel           *m_pLabelPortCount;
     352        /** Holds the port count spinbox instance. */
     353        QSpinBox         *m_pSpinBoxPortCount;
     354        /** Holds the IO cache check-box instance. */
     355        QCheckBox        *m_pCheckBoxIoCache;
     356        /** Holds the right pane attachment widget separator instance. */
     357        QILabelSeparator *m_pLabelSeparatorAttributes;
     358        /** Holds the medium label instance. */
     359        QLabel           *m_pLabelMedium;
     360        /** Holds the slot combo instance. */
     361        QComboBox        *m_pComboSlot;
     362        /** Holds the open tool-button instance. */
     363        QIToolButton     *m_pToolButtonOpen;
     364        /** Holds the passthrough check-box instance. */
     365        QCheckBox        *m_pCheckBoxPassthrough;
     366        /** Holds the temporary eject check-box instance. */
     367        QCheckBox        *m_pCheckBoxTempEject;
     368        /** Holds the non-rotational check-box instance. */
     369        QCheckBox        *m_pCheckBoxNonRotational;
     370        /** Holds the hot-pluggable check-box instance. */
     371        QCheckBox        *m_pCheckBoxHotPluggable;
     372        /** Holds the right pane attachment widget separator instance. */
     373        QILabelSeparator *m_pLabelSeparatorInformation;
     374        /** Holds the HD format label instance. */
     375        QLabel           *m_pLabelHDFormat;
     376        /** Holds the HD format field instance. */
     377        QILabel          *m_pFieldHDFormat;
     378        /** Holds the CD/FD type label instance. */
     379        QLabel           *m_pLabelCDFDType;
     380        /** Holds the CD/FD type field instance. */
     381        QILabel          *m_pFieldCDFDType;
     382        /** Holds the HD virtual size label instance. */
     383        QLabel           *m_pLabelHDVirtualSize;
     384        /** Holds the HD virtual size field instance. */
     385        QILabel          *m_pFieldHDVirtualSize;
     386        /** Holds the HD actual size label instance. */
     387        QLabel           *m_pLabelHDActualSize;
     388        /** Holds the HD actual size field instance. */
     389        QILabel          *m_pFieldHDActualSize;
     390        /** Holds the CD/FD size label instance. */
     391        QLabel           *m_pLabelCDFDSize;
     392        /** Holds the CD/FD size field instance. */
     393        QILabel          *m_pFieldCDFDSize;
     394        /** Holds the HD details label instance. */
     395        QLabel           *m_pLabelHDDetails;
     396        /** Holds the HD details field instance. */
     397        QILabel          *m_pFieldHDDetails;
     398        /** Holds the location label instance. */
     399        QLabel           *m_pLabelLocation;
     400        /** Holds the location field instance. */
     401        QILabel          *m_pFieldLocation;
     402        /** Holds the usage label instance. */
     403        QLabel           *m_pLabelUsage;
     404        /** Holds the usage field instance. */
     405        QILabel          *m_pFieldUsage;
     406        /** Holds the encryption label instance. */
     407        QLabel           *m_pLabelEncryption;
     408        /** Holds the encryption field instance. */
     409        QILabel          *m_pFieldEncryption;
    361410   /** @} */
    362411};
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