VirtualBox

Changeset 66245 in vbox


Ignore:
Timestamp:
Mar 24, 2017 1:43:51 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
114166
Message:

FE/Qt: Machine settings: Refactoring (renaming and tuning).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
18 edited

Legend:

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

    r64130 r66245  
    389389                {
    390390                    pSettingsPage = new UIMachineSettingsStorage;
    391                     connect(pSettingsPage, SIGNAL(storageChanged()), this, SLOT(sltResetFirstRunFlag()));
     391                    connect(pSettingsPage, SIGNAL(sigStorageChanged()), this, SLOT(sltResetFirstRunFlag()));
    392392                    addItem(":/hd_32px.png", ":/hd_24px.png", ":/hd_16px.png",
    393393                            iPageIndex, "#storage", pSettingsPage);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r66243 r66245  
    174174}
    175175
    176 void UIMachineSettingsDisplay::setGuestOSType(CGuestOSType guestOSType)
     176void UIMachineSettingsDisplay::setGuestOSType(CGuestOSType comGuestOSType)
    177177{
    178178    /* Check if guest os type changed: */
    179     if (m_guestOSType == guestOSType)
     179    if (m_comGuestOSType == comGuestOSType)
    180180        return;
    181181
    182182    /* Remember new guest os type: */
    183     m_guestOSType = guestOSType;
     183    m_comGuestOSType = comGuestOSType;
    184184
    185185#ifdef VBOX_WITH_VIDEOHWACCEL
    186186    /* Check if 2D video acceleration supported by the guest OS type: */
    187     QString strguestOSTypeFamily = m_guestOSType.GetFamilyId();
    188     m_f2DVideoAccelerationSupported = strguestOSTypeFamily == "Windows";
     187    const QString strGuestOSTypeFamily = m_comGuestOSType.GetFamilyId();
     188    m_f2DVideoAccelerationSupported = strGuestOSTypeFamily == "Windows";
    189189#endif /* VBOX_WITH_VIDEOHWACCEL */
    190190#ifdef VBOX_WITH_CRHGSMI
    191191    /* Check if WDDM mode supported by the guest OS type: */
    192     QString strguestOSTypeId = m_guestOSType.GetId();
    193     m_fWddmModeSupported = VBoxGlobal::isWddmCompatibleOsType(strguestOSTypeId);
     192    const QString strGuestOSTypeId = m_comGuestOSType.GetId();
     193    m_fWddmModeSupported = VBoxGlobal::isWddmCompatibleOsType(strGuestOSTypeId);
    194194#endif /* VBOX_WITH_CRHGSMI */
    195195
     
    466466
    467467        /* Video RAM amount test: */
    468         if (shouldWeWarnAboutLowVideoMemory() && !m_guestOSType.isNull())
     468        if (shouldWeWarnAboutLowVRAM() && !m_comGuestOSType.isNull())
    469469        {
    470             quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), m_pEditorVideoScreenCount->value());
     470            quint64 uNeedBytes = VBoxGlobal::requiredVideoMemory(m_comGuestOSType.GetId(), m_pEditorVideoScreenCount->value());
    471471
    472472            /* Basic video RAM amount test: */
     
    629629    m_pLabelVideoCaptureQualityMax->setText(tr("high", "quality"));
    630630
    631     updateVideoCaptureSizeHint();
     631    updateVideoCaptureFileSizeHint();
    632632}
    633633
     
    702702}
    703703
    704 void UIMachineSettingsDisplay::sltHandleVideoScreenCountSliderChange()
     704void UIMachineSettingsDisplay::sltHandleGuestScreenCountSliderChange()
    705705{
    706706    /* Apply proposed screen-count: */
     
    713713
    714714    /* Update Video Capture tab screen count: */
    715     updateVideoCaptureScreenCount();
     715    updateGuestScreenCount();
    716716
    717717    /* Revalidate: */
     
    719719}
    720720
    721 void UIMachineSettingsDisplay::sltHandleVideoScreenCountEditorChange()
     721void UIMachineSettingsDisplay::sltHandleGuestScreenCountEditorChange()
    722722{
    723723    /* Apply proposed screen-count: */
     
    730730
    731731    /* Update Video Capture tab screen count: */
    732     updateVideoCaptureScreenCount();
     732    updateGuestScreenCount();
    733733
    734734    /* Revalidate: */
     
    757757     * 1. Machine is in 'offline' or 'saved' state and check-box is checked,
    758758     * 2. Machine is in 'online' state, check-box is checked, and video recording is *disabled* currently. */
    759     bool fIsVideoCaptureOptionsEnabled = ((isMachineOffline() || isMachineSaved()) && m_pCheckboxVideoCapture->isChecked()) ||
    760                                          (isMachineOnline() && !m_pCache->base().m_fVideoCaptureEnabled && m_pCheckboxVideoCapture->isChecked());
     759    const bool fIsVideoCaptureOptionsEnabled = ((isMachineOffline() || isMachineSaved()) && m_pCheckboxVideoCapture->isChecked()) ||
     760                                               (isMachineOnline() && !m_pCache->base().m_fVideoCaptureEnabled && m_pCheckboxVideoCapture->isChecked());
    761761
    762762    /* Video Capture Screens option should be enabled only if:
    763763     * Machine is in *any* valid state and check-box is checked. */
    764     bool fIsVideoCaptureScreenOptionEnabled = isMachineInValidMode() && m_pCheckboxVideoCapture->isChecked();
     764    const bool fIsVideoCaptureScreenOptionEnabled = isMachineInValidMode() && m_pCheckboxVideoCapture->isChecked();
    765765
    766766    m_pLabelVideoCapturePath->setEnabled(fIsVideoCaptureOptionsEnabled);
     
    788788{
    789789    /* Get the proposed size: */
    790     int iCurrentIndex = m_pComboVideoCaptureSize->currentIndex();
    791     QSize videoCaptureSize = m_pComboVideoCaptureSize->itemData(iCurrentIndex).toSize();
     790    const int iCurrentIndex = m_pComboVideoCaptureSize->currentIndex();
     791    const QSize videoCaptureSize = m_pComboVideoCaptureSize->itemData(iCurrentIndex).toSize();
    792792
    793793    /* Make sure its valid: */
     
    803803{
    804804    /* Look for preset: */
    805     lookForCorrespondingSizePreset();
     805    lookForCorrespondingFrameSizePreset();
    806806    /* Update quality and bit-rate: */
    807807    sltHandleVideoCaptureQualitySliderChange();
     
    811811{
    812812    /* Look for preset: */
    813     lookForCorrespondingSizePreset();
     813    lookForCorrespondingFrameSizePreset();
    814814    /* Update quality and bit-rate: */
    815815    sltHandleVideoCaptureQualitySliderChange();
     
    845845                                                            m_pSliderVideoCaptureQuality->value()));
    846846    m_pEditorVideoCaptureBitRate->blockSignals(false);
    847     updateVideoCaptureSizeHint();
     847    updateVideoCaptureFileSizeHint();
    848848}
    849849
     
    857857                                                            m_pEditorVideoCaptureBitRate->value()));
    858858    m_pSliderVideoCaptureQuality->blockSignals(false);
    859     updateVideoCaptureSizeHint();
     859    updateVideoCaptureFileSizeHint();
    860860}
    861861
     
    877877{
    878878    /* Prepare memory-size slider: */
    879     CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
     879    const CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
    880880    m_iMinVRAM = sys.GetMinGuestVRAM();
    881881    m_iMaxVRAM = sys.GetMaxGuestVRAM();
     
    884884    m_pSliderVideoMemorySize->setMinimum(m_iMinVRAM);
    885885    m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible);
    886     m_pSliderVideoMemorySize->setPageStep(calcPageStep(m_iMaxVRAMVisible));
     886    m_pSliderVideoMemorySize->setPageStep(calculatePageStep(m_iMaxVRAMVisible));
    887887    m_pSliderVideoMemorySize->setSingleStep(m_pSliderVideoMemorySize->pageStep() / 4);
    888888    m_pSliderVideoMemorySize->setTickInterval(m_pSliderVideoMemorySize->pageStep());
     
    908908    m_pSliderVideoScreenCount->setOptimalHint(cMinGuestScreens, cHostScreens);
    909909    m_pSliderVideoScreenCount->setWarningHint(cHostScreens, cMaxGuestScreensForSlider);
    910     connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoScreenCountSliderChange()));
     910    connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountSliderChange()));
    911911
    912912    /* Prepare screen-count editor: */
     
    914914    m_pEditorVideoScreenCount->setMinimum(1);
    915915    m_pEditorVideoScreenCount->setMaximum(cMaxGuestScreens);
    916     connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoScreenCountEditorChange()));
     916    connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountEditorChange()));
    917917
    918918    /* Prepare scale-factor slider: */
     
    10401040{
    10411041    /* Make sure guest OS type is set: */
    1042     if (m_guestOSType.isNull())
     1042    if (m_comGuestOSType.isNull())
    10431043        return;
    10441044
    10451045    /* Get monitors count and base video memory requirements: */
    1046     int cGuestScreenCount = m_pEditorVideoScreenCount->value();
    1047     quint64 uNeedMBytes = VBoxGlobal::requiredVideoMemory(m_guestOSType.GetId(), cGuestScreenCount) / _1M;
     1046    const int cGuestScreenCount = m_pEditorVideoScreenCount->value();
     1047    quint64 uNeedMBytes = VBoxGlobal::requiredVideoMemory(m_comGuestOSType.GetId(), cGuestScreenCount) / _1M;
    10481048
    10491049    /* Initial value: */
     
    10811081    m_pEditorVideoMemorySize->setMaximum(m_iMaxVRAMVisible);
    10821082    m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible);
    1083     m_pSliderVideoMemorySize->setPageStep(calcPageStep(m_iMaxVRAMVisible));
     1083    m_pSliderVideoMemorySize->setPageStep(calculatePageStep(m_iMaxVRAMVisible));
    10841084    m_pSliderVideoMemorySize->setWarningHint(1, qMin((int)uNeedMBytes, m_iMaxVRAMVisible));
    10851085    m_pSliderVideoMemorySize->setOptimalHint(qMin((int)uNeedMBytes, m_iMaxVRAMVisible), m_iMaxVRAMVisible);
     
    10871087}
    10881088
    1089 bool UIMachineSettingsDisplay::shouldWeWarnAboutLowVideoMemory()
     1089bool UIMachineSettingsDisplay::shouldWeWarnAboutLowVRAM()
    10901090{
    10911091    bool fResult = true;
     
    10931093    QStringList excludingOSList = QStringList()
    10941094        << "Other" << "DOS" << "Netware" << "L4" << "QNX" << "JRockitVE";
    1095     if (excludingOSList.contains(m_guestOSType.GetId()))
     1095    if (excludingOSList.contains(m_comGuestOSType.GetId()))
    10961096        fResult = false;
    10971097
     
    11001100
    11011101/* static */
    1102 int UIMachineSettingsDisplay::calcPageStep(int iMax)
     1102int UIMachineSettingsDisplay::calculatePageStep(int iMax)
    11031103{
    11041104    /* Reasonable max. number of page steps is 32. */
    1105     uint page = ((uint)iMax + 31) / 32;
     1105    uint uPage = ((uint)iMax + 31) / 32;
    11061106    /* Make it a power of 2: */
    1107     uint p = page, p2 = 0x1;
    1108     while ((p >>= 1))
     1107    uint uP = uPage, p2 = 0x1;
     1108    while ((uP >>= 1))
    11091109        p2 <<= 1;
    1110     if (page != p2)
     1110    if (uPage != p2)
    11111111        p2 <<= 1;
    11121112    if (p2 < 4)
     
    11151115}
    11161116
    1117 void UIMachineSettingsDisplay::lookForCorrespondingSizePreset()
     1117void UIMachineSettingsDisplay::lookForCorrespondingFrameSizePreset()
    11181118{
    11191119    /* Look for video-capture size preset: */
     
    11231123}
    11241124
    1125 void UIMachineSettingsDisplay::updateVideoCaptureScreenCount()
     1125void UIMachineSettingsDisplay::updateGuestScreenCount()
    11261126{
    11271127    /* Update copy of the cached item to get the desired result: */
     
    11311131}
    11321132
    1133 void UIMachineSettingsDisplay::updateVideoCaptureSizeHint()
     1133void UIMachineSettingsDisplay::updateVideoCaptureFileSizeHint()
    11341134{
    11351135    m_pLabelVideoCaptureSizeHint->setText(tr("<i>About %1MB per 5 minute video</i>").arg(m_pEditorVideoCaptureBitRate->value() * 300 / 8 / 1024));
     
    11371137
    11381138/* static */
    1139 void UIMachineSettingsDisplay::lookForCorrespondingPreset(QComboBox *pWhere, const QVariant &whichData)
     1139void UIMachineSettingsDisplay::lookForCorrespondingPreset(QComboBox *pComboBox, const QVariant &data)
    11401140{
    11411141    /* Use passed iterator to look for corresponding preset of passed combo-box: */
    1142     int iLookupResult = pWhere->findData(whichData);
    1143     if (iLookupResult != -1 && pWhere->currentIndex() != iLookupResult)
    1144         pWhere->setCurrentIndex(iLookupResult);
    1145     else if (iLookupResult == -1 && pWhere->currentIndex() != 0)
    1146         pWhere->setCurrentIndex(0);
     1142    const int iLookupResult = pComboBox->findData(data);
     1143    if (iLookupResult != -1 && pComboBox->currentIndex() != iLookupResult)
     1144        pComboBox->setCurrentIndex(iLookupResult);
     1145    else if (iLookupResult == -1 && pComboBox->currentIndex() != 0)
     1146        pComboBox->setCurrentIndex(0);
    11471147}
    11481148
     
    11511151{
    11521152    /* Linear quality<=>bit-rate scale-factor: */
    1153     double dResult = (double)iQuality
    1154                    * (double)iFrameWidth * (double)iFrameHeight * (double)iFrameRate
    1155                    / (double)10 /* translate quality to [%] */
    1156                    / (double)1024 /* translate bit-rate to [kbps] */
    1157                    / (double)18.75 /* linear scale factor */;
     1153    const double dResult = (double)iQuality
     1154                         * (double)iFrameWidth * (double)iFrameHeight * (double)iFrameRate
     1155                         / (double)10 /* translate quality to [%] */
     1156                         / (double)1024 /* translate bit-rate to [kbps] */
     1157                         / (double)18.75 /* linear scale factor */;
    11581158    return (int)dResult;
    11591159}
     
    11631163{
    11641164    /* Linear bit-rate<=>quality scale-factor: */
    1165     double dResult = (double)iBitRate
    1166                    / (double)iFrameWidth / (double)iFrameHeight / (double)iFrameRate
    1167                    * (double)10 /* translate quality to [%] */
    1168                    * (double)1024 /* translate bit-rate to [kbps] */
    1169                    * (double)18.75 /* linear scale factor */;
     1165    const double dResult = (double)iBitRate
     1166                         / (double)iFrameWidth / (double)iFrameHeight / (double)iFrameRate
     1167                         * (double)10 /* translate quality to [%] */
     1168                         * (double)1024 /* translate bit-rate to [kbps] */
     1169                         * (double)18.75 /* linear scale factor */;
    11701170    return (int)dResult;
    11711171}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r66243 r66245  
    4646
    4747    /* API: Correlation stuff: */
    48     void setGuestOSType(CGuestOSType guestOSType);
     48    void setGuestOSType(CGuestOSType comGuestOSType);
    4949
    5050#ifdef VBOX_WITH_VIDEOHWACCEL
     
    8888    void sltHandleVideoMemorySizeSliderChange();
    8989    void sltHandleVideoMemorySizeEditorChange();
    90     void sltHandleVideoScreenCountSliderChange();
    91     void sltHandleVideoScreenCountEditorChange();
     90    void sltHandleGuestScreenCountSliderChange();
     91    void sltHandleGuestScreenCountEditorChange();
    9292    void sltHandleGuestScreenScaleSliderChange();
    9393    void sltHandleGuestScreenScaleEditorChange();
     
    116116    /* Helpers: Video stuff: */
    117117    void checkVRAMRequirements();
    118     bool shouldWeWarnAboutLowVideoMemory();
    119     static int calcPageStep(int iMax);
     118    bool shouldWeWarnAboutLowVRAM();
     119    static int calculatePageStep(int iMax);
    120120
    121121    /* Helpers: Video Capture stuff: */
    122     void lookForCorrespondingSizePreset();
    123     void updateVideoCaptureScreenCount();
    124     void updateVideoCaptureSizeHint();
    125     static void lookForCorrespondingPreset(QComboBox *pWhere, const QVariant &whichData);
     122    void lookForCorrespondingFrameSizePreset();
     123    void updateGuestScreenCount();
     124    void updateVideoCaptureFileSizeHint();
     125    static void lookForCorrespondingPreset(QComboBox *pComboBox, const QVariant &data);
    126126    static int calculateBitRate(int iFrameWidth, int iFrameHeight, int iFrameRate, int iQuality);
    127127    static int calculateQuality(int iFrameWidth, int iFrameHeight, int iFrameRate, int iBitRate);
    128128
    129129    /* Guest OS type id: */
    130     CGuestOSType m_guestOSType;
     130    CGuestOSType  m_comGuestOSType;
    131131    /* System minimum lower limit of VRAM (MiB). */
    132     int m_iMinVRAM;
     132    int           m_iMinVRAM;
    133133    /* System maximum limit of VRAM (MiB). */
    134     int m_iMaxVRAM;
     134    int           m_iMaxVRAM;
    135135    /* Upper limit of VRAM in MiB for this dialog. This value is lower than
    136136     * m_maxVRAM to save careless users from setting useless big values. */
    137     int m_iMaxVRAMVisible;
     137    int           m_iMaxVRAMVisible;
    138138    /* Initial VRAM value when the dialog is opened. */
    139     int m_iInitialVRAM;
     139    int           m_iInitialVRAM;
    140140#ifdef VBOX_WITH_VIDEOHWACCEL
    141141    /* Specifies whether the guest OS supports 2D video-acceleration: */
    142     bool m_f2DVideoAccelerationSupported;
     142    bool          m_f2DVideoAccelerationSupported;
    143143#endif /* VBOX_WITH_VIDEOHWACCEL */
    144144#ifdef VBOX_WITH_CRHGSMI
    145145    /* Specifies whether the guest OS supports WDDM: */
    146     bool m_fWddmModeSupported;
     146    bool          m_fWddmModeSupported;
    147147#endif /* VBOX_WITH_CRHGSMI */
    148148
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r66190 r66245  
    106106
    107107    /** Holds whether HW virtualization extension is enabled. */
    108     bool m_fHWVirtExEnabled;
     108    bool  m_fHWVirtExEnabled;
    109109
    110110    /** Holds whether the encryption cipher was changed.
    111111      * We are holding that argument here because we do not know
    112112      * the old <i>cipher</i> for sure to compare the new one with. */
    113     bool m_fEncryptionCipherChanged;
     113    bool  m_fEncryptionCipherChanged;
    114114    /** Holds whether the encryption password was changed.
    115115      * We are holding that argument here because we do not know
    116116      * the old <i>password</i> at all to compare the new one with. */
    117     bool m_fEncryptionPasswordChanged;
     117    bool  m_fEncryptionPasswordChanged;
    118118
    119119    /** Holds the hard-coded encryption cipher list.
    120120      * We are hard-coding it because there is no place we can get it from. */
    121     QStringList m_encryptionCiphers;
     121    QStringList  m_encryptionCiphers;
    122122
    123123    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp

    r66243 r66245  
    134134
    135135
    136 UIMachineSettingsInterface::UIMachineSettingsInterface(const QString strMachineID)
    137     : m_strMachineID(strMachineID)
     136UIMachineSettingsInterface::UIMachineSettingsInterface(const QString strMachineId)
     137    : m_strMachineId(strMachineId)
    138138    , m_pActionPool(0)
    139139    , m_pCache(new UISettingsCacheMachineInterface)
     
    344344
    345345    /* Assign corresponding machine ID: */
    346     m_pMenuBarEditor->setMachineID(m_strMachineID);
    347     m_pStatusBarEditor->setMachineID(m_strMachineID);
     346    m_pMenuBarEditor->setMachineID(m_strMachineId);
     347    m_pStatusBarEditor->setMachineID(m_strMachineId);
    348348
    349349    /* Translate finally: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h

    r66243 r66245  
    3838
    3939    /** Constructs User Interface settings page. */
    40     UIMachineSettingsInterface(const QString strMachineID);
     40    UIMachineSettingsInterface(const QString strMachineId);
    4141    /** Destructs User Interface settings page. */
    4242    ~UIMachineSettingsInterface();
     
    7676
    7777    /** Holds the machine ID copy. */
    78     const QString m_strMachineID;
     78    const QString  m_strMachineId;
    7979    /** Holds the action-pool instance. */
    80     UIActionPool *m_pActionPool;
     80    UIActionPool  *m_pActionPool;
    8181
    8282    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r66190 r66245  
    259259    connect(m_pMACButton, SIGNAL(clicked()), this, SLOT(sltGenerateMac()));
    260260    connect(m_pPortForwardingButton, SIGNAL(clicked()), this, SLOT(sltOpenPortForwardingDlg()));
    261     connect(this, SIGNAL(sigTabUpdated()), m_pParent, SLOT(sltHandleUpdatedTab()));
     261    connect(this, SIGNAL(sigTabUpdated()), m_pParent, SLOT(sltHandleTabUpdate()));
    262262
    263263    /* Prepare validation: */
     
    992992/* UIMachineSettingsNetworkPage Stuff: */
    993993UIMachineSettingsNetworkPage::UIMachineSettingsNetworkPage()
    994     : m_pTwAdapters(0)
     994    : m_pTabWidgetAdapters(0)
    995995    , m_pCache(new UISettingsCacheMachineNetwork)
    996996{
     
    10001000
    10011001    /* Creating tab-widget: */
    1002     m_pTwAdapters = new QITabWidget(this);
    1003     pMainLayout->addWidget(m_pTwAdapters);
     1002    m_pTabWidgetAdapters = new QITabWidget(this);
     1003    pMainLayout->addWidget(m_pTabWidgetAdapters);
    10041004
    10051005    /* How many adapters to display: */
     
    10161016        connect(pTab, SIGNAL(sigNotifyAdvancedButtonStateChange(bool)),
    10171017                this, SLOT(sltHandleAdvancedButtonStateChange(bool)));
    1018         m_pTwAdapters->addTab(pTab, pTab->tabTitle());
     1018        m_pTabWidgetAdapters->addTab(pTab, pTab->tabTitle());
    10191019    }
    10201020}
     
    10481048
    10491049    /* For each network adapter: */
    1050     for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot)
     1050    for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
    10511051    {
    10521052        /* Prepare adapter data: */
     
    10711071            adapterData.m_promiscuousMode = adapter.GetPromiscModePolicy();
    10721072            adapterData.m_strMACAddress = adapter.GetMACAddress();
    1073             adapterData.m_strGenericProperties = summarizeGenericProperties(adapter);
     1073            adapterData.m_strGenericProperties = loadGenericProperties(adapter);
    10741074            adapterData.m_fCableConnected = adapter.GetCableConnected();
    10751075
     
    11011101    /* Setup tab order: */
    11021102    Assert(firstWidget());
    1103     setTabOrder(firstWidget(), m_pTwAdapters->focusProxy());
    1104     QWidget *pLastFocusWidget = m_pTwAdapters->focusProxy();
     1103    setTabOrder(firstWidget(), m_pTabWidgetAdapters->focusProxy());
     1104    QWidget *pLastFocusWidget = m_pTabWidgetAdapters->focusProxy();
    11051105
    11061106    /* For each network adapter: */
    1107     for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot)
     1107    for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
    11081108    {
    11091109        /* Get adapter page: */
    1110         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot));
     1110        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
    11111111
    11121112        /* Load adapter data to page: */
     
    11301130{
    11311131    /* For each network adapter: */
    1132     for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot)
     1132    for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
    11331133    {
    11341134        /* Get adapter page: */
    1135         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot));
     1135        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
    11361136
    11371137        /* Gather & cache adapter data: */
     
    11491149    {
    11501150        /* For each network adapter: */
    1151         for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot)
     1151        for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
    11521152        {
    11531153            /* Check if adapter data was changed: */
     
    11861186                            case KNetworkAttachmentType_Generic:
    11871187                                adapter.SetGenericDriver(adapterData.m_strGenericDriverName);
    1188                                 updateGenericProperties(adapter, adapterData.m_strGenericProperties);
     1188                                saveGenericProperties(adapter, adapterData.m_strGenericProperties);
    11891189                                break;
    11901190                            case KNetworkAttachmentType_NATNetwork:
     
    12311231
    12321232    /* Delegate validation to adapter tabs: */
    1233     for (int i = 0; i < m_pTwAdapters->count(); ++i)
    1234     {
    1235         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(i));
     1233    for (int i = 0; i < m_pTabWidgetAdapters->count(); ++i)
     1234    {
     1235        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(i));
    12361236        AssertMsg(pTab, ("Can't get adapter tab!\n"));
    12371237        if (!pTab->validate(messages))
     
    12451245void UIMachineSettingsNetworkPage::retranslateUi()
    12461246{
    1247     for (int i = 0; i < m_pTwAdapters->count(); ++ i)
    1248     {
    1249         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(i));
     1247    for (int i = 0; i < m_pTabWidgetAdapters->count(); ++i)
     1248    {
     1249        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(i));
    12501250        Assert(pTab);
    1251         m_pTwAdapters->setTabText(i, pTab->tabTitle());
     1251        m_pTabWidgetAdapters->setTabText(i, pTab->tabTitle());
    12521252    }
    12531253}
     
    12561256{
    12571257    /* Get the count of network adapter tabs: */
    1258     for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot)
    1259     {
    1260         m_pTwAdapters->setTabEnabled(iSlot,
    1261                                      isMachineOffline() ||
    1262                                      (isMachineInValidMode() && m_pCache->child(iSlot).base().m_fAdapterEnabled));
    1263         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot));
     1258    for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
     1259    {
     1260        m_pTabWidgetAdapters->setTabEnabled(iSlot,
     1261                                            isMachineOffline() ||
     1262                                            (isMachineInValidMode() && m_pCache->child(iSlot).base().m_fAdapterEnabled));
     1263        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
    12641264        pTab->polishTab();
    12651265    }
    12661266}
    12671267
    1268 void UIMachineSettingsNetworkPage::sltHandleUpdatedTab()
     1268void UIMachineSettingsNetworkPage::sltHandleTabUpdate()
    12691269{
    12701270    /* Determine the sender: */
     
    12731273
    12741274    /* Determine sender's attachment type: */
    1275     KNetworkAttachmentType senderAttachmentType = pSender->attachmentType();
    1276     switch (senderAttachmentType)
     1275    const KNetworkAttachmentType enmSenderAttachmentType = pSender->attachmentType();
     1276    switch (enmSenderAttachmentType)
    12771277    {
    12781278        case KNetworkAttachmentType_Internal:
     
    12911291
    12921292    /* Update all the tabs except the sender: */
    1293     for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot)
     1293    for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
    12941294    {
    12951295        /* Get the iterated tab: */
    1296         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot));
    1297         AssertMsg(pTab, ("All the tabs of m_pTwAdapters should be of the UIMachineSettingsNetwork type!\n"));
     1296        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
     1297        AssertMsg(pTab, ("All the tabs of m_pTabWidgetAdapters should be of the UIMachineSettingsNetwork type!\n"));
    12981298
    12991299        /* Update all the tabs (except sender) with the same attachment type as sender have: */
    1300         if (pTab != pSender && pTab->attachmentType() == senderAttachmentType)
     1300        if (pTab != pSender && pTab->attachmentType() == enmSenderAttachmentType)
    13011301            pTab->reloadAlternative();
    13021302    }
     
    13061306{
    13071307    /* Update the advanced button states for all the pages: */
    1308     for (int iSlot = 0; iSlot < m_pTwAdapters->count(); ++iSlot)
    1309     {
    1310         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iSlot));
     1308    for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
     1309    {
     1310        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
    13111311        pTab->setAdvancedButtonState(fExpanded);
    13121312    }
     
    13341334        m_internalNetworkList << otherInternalNetworkList();
    13351335    /* Append internal network list with names from all the tabs: */
    1336     for (int iTab = 0; iTab < m_pTwAdapters->count(); ++iTab)
    1337     {
    1338         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iTab));
     1336    for (int iTab = 0; iTab < m_pTabWidgetAdapters->count(); ++iTab)
     1337    {
     1338        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iTab));
    13391339        if (pTab)
    13401340        {
    1341             QString strName = pTab->alternativeName(KNetworkAttachmentType_Internal);
     1341            const QString strName = pTab->alternativeName(KNetworkAttachmentType_Internal);
    13421342            if (!strName.isEmpty() && !m_internalNetworkList.contains(strName))
    13431343                m_internalNetworkList << strName;
     
    13671367        m_genericDriverList << otherGenericDriverList();
    13681368    /* Append generic driver list with names from all the tabs: */
    1369     for (int iTab = 0; iTab < m_pTwAdapters->count(); ++iTab)
    1370     {
    1371         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(iTab));
     1369    for (int iTab = 0; iTab < m_pTabWidgetAdapters->count(); ++iTab)
     1370    {
     1371        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iTab));
    13721372        if (pTab)
    13731373        {
    1374             QString strName = pTab->alternativeName(KNetworkAttachmentType_Generic);
     1374            const QString strName = pTab->alternativeName(KNetworkAttachmentType_Generic);
    13751375            if (!strName.isEmpty() && !m_genericDriverList.contains(strName))
    13761376                m_genericDriverList << strName;
     
    13951395{
    13961396    /* Load total internal network list of all VMs: */
    1397     CVirtualBox vbox = vboxGlobal().virtualBox();
    1398     QStringList otherInternalNetworks(QList<QString>::fromVector(vbox.GetInternalNetworks()));
     1397    const CVirtualBox vbox = vboxGlobal().virtualBox();
     1398    const QStringList otherInternalNetworks(QList<QString>::fromVector(vbox.GetInternalNetworks()));
    13991399    return otherInternalNetworks;
    14001400}
     
    14041404{
    14051405    /* Load total generic driver list of all VMs: */
    1406     CVirtualBox vbox = vboxGlobal().virtualBox();
    1407     QStringList otherGenericDrivers(QList<QString>::fromVector(vbox.GetGenericNetworkDrivers()));
     1406    const CVirtualBox vbox = vboxGlobal().virtualBox();
     1407    const QStringList otherGenericDrivers(QList<QString>::fromVector(vbox.GetGenericNetworkDrivers()));
    14081408    return otherGenericDrivers;
    14091409}
    14101410
    14111411/* static */
    1412 QString UIMachineSettingsNetworkPage::summarizeGenericProperties(const CNetworkAdapter &adapter)
     1412QString UIMachineSettingsNetworkPage::loadGenericProperties(const CNetworkAdapter &adapter)
    14131413{
    14141414    /* Prepare formatted string: */
     
    14291429
    14301430/* static */
    1431 void UIMachineSettingsNetworkPage::updateGenericProperties(CNetworkAdapter &adapter, const QString &strPropText)
     1431void UIMachineSettingsNetworkPage::saveGenericProperties(CNetworkAdapter &adapter, const QString &strProperties)
    14321432{
    14331433    /* Parse new properties: */
    1434     QStringList newProps = strPropText.split("\n");
     1434    const QStringList newProps = strProperties.split("\n");
    14351435    QHash<QString, QString> hash;
    14361436
     
    14381438    for (int i = 0; i < newProps.size(); ++i)
    14391439    {
    1440         QString strLine = newProps[i];
    1441         int iSplitPos = strLine.indexOf("=");
     1440        const QString strLine = newProps[i];
     1441        const int iSplitPos = strLine.indexOf("=");
    14421442        if (iSplitPos)
    14431443        {
    1444             QString strKey = strLine.left(iSplitPos);
    1445             QString strVal = strLine.mid(iSplitPos+1);
     1444            const QString strKey = strLine.left(iSplitPos);
     1445            const QString strVal = strLine.mid(iSplitPos + 1);
    14461446            adapter.SetProperty(strKey, strVal);
    14471447            hash[strKey] = strVal;
     
    14551455    for (int i = 0; i < names.size(); ++i)
    14561456    {
    1457         QString strName = names[i];
    1458         QString strValue = props[i];
     1457        const QString strName = names[i];
     1458        const QString strValue = props[i];
    14591459        if (strValue != hash[strName])
    14601460            adapter.SetProperty(strName, hash[strName]);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h

    r66190 r66245  
    4646
    4747    /* Bridged adapter list: */
    48     const QStringList& bridgedAdapterList() const { return m_bridgedAdapterList; }
     48    const QStringList &bridgedAdapterList() const { return m_bridgedAdapterList; }
    4949    /* Internal network list: */
    50     const QStringList& internalNetworkList() const { return m_internalNetworkList; }
     50    const QStringList &internalNetworkList() const { return m_internalNetworkList; }
    5151    /* Host-only interface list: */
    52     const QStringList& hostInterfaceList() const { return m_hostInterfaceList; }
     52    const QStringList &hostInterfaceList() const { return m_hostInterfaceList; }
    5353    /* Generic driver list: */
    54     const QStringList& genericDriverList() const { return m_genericDriverList; }
     54    const QStringList &genericDriverList() const { return m_genericDriverList; }
    5555    /* NAT network list: */
    56     const QStringList& natNetworkList() const { return m_natNetworkList; }
     56    const QStringList &natNetworkList() const { return m_natNetworkList; }
    5757
    5858protected:
     
    8787
    8888    /* Handles tab updates: */
    89     void sltHandleUpdatedTab();
     89    void sltHandleTabUpdate();
    9090
    9191    /** Handles advanced button state change to @a fExpanded. */
     
    104104    static QStringList otherInternalNetworkList();
    105105    static QStringList otherGenericDriverList();
    106     static QString summarizeGenericProperties(const CNetworkAdapter &adapter);
    107     static void updateGenericProperties(CNetworkAdapter &adapter, const QString &strPropText);
     106    static QString loadGenericProperties(const CNetworkAdapter &adapter);
     107    static void saveGenericProperties(CNetworkAdapter &adapter, const QString &strProperties);
    108108
    109109    /* Tab holder: */
    110     QITabWidget *m_pTwAdapters;
     110    QITabWidget *m_pTabWidgetAdapters;
    111111
    112112    /* Alternative-name lists: */
    113     QStringList m_bridgedAdapterList;
    114     QStringList m_internalNetworkList;
    115     QStringList m_hostInterfaceList;
    116     QStringList m_genericDriverList;
    117     QStringList m_natNetworkList;
     113    QStringList  m_bridgedAdapterList;
     114    QStringList  m_internalNetworkList;
     115    QStringList  m_hostInterfaceList;
     116    QStringList  m_genericDriverList;
     117    QStringList  m_natNetworkList;
    118118
    119119    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp

    r66243 r66245  
    443443        /* Get current tab/page: */
    444444        QWidget *pTab = mTabWidget->widget(iIndex);
    445         UIMachineSettingsParallel *pPage = static_cast<UIMachineSettingsParallel*> (pTab);
     445        UIMachineSettingsParallel *pPage = static_cast<UIMachineSettingsParallel*>(pTab);
    446446        if (!pPage->mGbParallel->isChecked())
    447447            continue;
     
    455455        const QString strIOPort(pPage->mLeIOPort->text());
    456456        const QString strPath(pPage->mLePath->text());
    457         QPair<QString, QString> pair(strIRQ, strIOPort);
     457        const QPair<QString, QString> pair(strIRQ, strIOPort);
    458458
    459459        if (strIRQ.isEmpty())
     
    497497void UIMachineSettingsParallelPage::retranslateUi()
    498498{
    499     for (int i = 0; i < mTabWidget->count(); ++ i)
    500     {
    501         UIMachineSettingsParallel *page =
    502             static_cast<UIMachineSettingsParallel*> (mTabWidget->widget (i));
    503         mTabWidget->setTabText (i, page->pageTitle());
     499    for (int i = 0; i < mTabWidget->count(); ++i)
     500    {
     501        UIMachineSettingsParallel *pPage =
     502            static_cast<UIMachineSettingsParallel*>(mTabWidget->widget(i));
     503        mTabWidget->setTabText(i, pPage->pageTitle());
    504504    }
    505505}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r66243 r66245  
    238238
    239239UIMachineSettingsSF::UIMachineSettingsSF()
    240     : mNewAction(0), mEdtAction(0), mDelAction(0)
     240    : m_pActionAdd(0), m_pActionEdit(0), m_pActionRemove(0)
    241241    , m_pCache(new UISettingsCacheSharedFolders)
    242242{
     
    245245
    246246    /* Prepare actions */
    247     mNewAction = new QAction (this);
    248     mEdtAction = new QAction (this);
    249     mDelAction = new QAction (this);
    250 
    251     mNewAction->setShortcut (QKeySequence ("Ins"));
    252     mEdtAction->setShortcut (QKeySequence ("Ctrl+Space"));
    253     mDelAction->setShortcut (QKeySequence ("Del"));
    254 
    255     mNewAction->setIcon(UIIconPool::iconSet(":/sf_add_16px.png",
     247    m_pActionAdd = new QAction (this);
     248    m_pActionEdit = new QAction (this);
     249    m_pActionRemove = new QAction (this);
     250
     251    m_pActionAdd->setShortcut (QKeySequence ("Ins"));
     252    m_pActionEdit->setShortcut (QKeySequence ("Ctrl+Space"));
     253    m_pActionRemove->setShortcut (QKeySequence ("Del"));
     254
     255    m_pActionAdd->setIcon(UIIconPool::iconSet(":/sf_add_16px.png",
    256256                                            ":/sf_add_disabled_16px.png"));
    257     mEdtAction->setIcon(UIIconPool::iconSet(":/sf_edit_16px.png",
     257    m_pActionEdit->setIcon(UIIconPool::iconSet(":/sf_edit_16px.png",
    258258                                            ":/sf_edit_disabled_16px.png"));
    259     mDelAction->setIcon(UIIconPool::iconSet(":/sf_remove_16px.png",
     259    m_pActionRemove->setIcon(UIIconPool::iconSet(":/sf_remove_16px.png",
    260260                                            ":/sf_remove_disabled_16px.png"));
    261261
     
    267267    m_pFoldersToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    268268    m_pFoldersToolBar->setOrientation(Qt::Vertical);
    269     m_pFoldersToolBar->addAction(mNewAction);
    270     m_pFoldersToolBar->addAction(mEdtAction);
    271     m_pFoldersToolBar->addAction(mDelAction);
     269    m_pFoldersToolBar->addAction(m_pActionAdd);
     270    m_pFoldersToolBar->addAction(m_pActionEdit);
     271    m_pFoldersToolBar->addAction(m_pActionRemove);
    272272
    273273    /* Setup connections */
     
    277277    mTwFolders->header()->setMovable (false);
    278278#endif /* QT_VERSION < 0x050000 */
    279     connect (mNewAction, SIGNAL (triggered (bool)), this, SLOT (addTriggered()));
    280     connect (mEdtAction, SIGNAL (triggered (bool)), this, SLOT (edtTriggered()));
    281     connect (mDelAction, SIGNAL (triggered (bool)), this, SLOT (delTriggered()));
     279    connect (m_pActionAdd, SIGNAL (triggered (bool)), this, SLOT (sltAddSharedFolder()));
     280    connect (m_pActionEdit, SIGNAL (triggered (bool)), this, SLOT (sltEditSharedFolder()));
     281    connect (m_pActionRemove, SIGNAL (triggered (bool)), this, SLOT (sltDeleteSharedFolder()));
    282282    connect (mTwFolders, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)),
    283              this, SLOT (processCurrentChanged (QTreeWidgetItem *)));
     283             this, SLOT (sltHandleCurrentItemChange (QTreeWidgetItem *)));
    284284    connect (mTwFolders, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),
    285              this, SLOT (processDoubleClick (QTreeWidgetItem *)));
     285             this, SLOT (sltHandleDoubleClick (QTreeWidgetItem *)));
    286286    connect (mTwFolders, SIGNAL (customContextMenuRequested (const QPoint &)),
    287              this, SLOT (showContextMenu (const QPoint &)));
     287             this, SLOT (sltHandleContextMenuRequest (const QPoint &)));
    288288
    289289    retranslateUi();
     
    321321}
    322322
    323 void UIMachineSettingsSF::loadToCacheFrom(UISharedFolderType sharedFoldersType)
     323void UIMachineSettingsSF::loadToCacheFrom(UISharedFolderType enmSharedFoldersType)
    324324{
    325325    /* Get current shared folders: */
    326     CSharedFolderVector sharedFolders = getSharedFolders(sharedFoldersType);
     326    CSharedFolderVector sharedFolders = getSharedFolders(enmSharedFoldersType);
    327327
    328328    /* For each shared folder: */
     
    338338        {
    339339            /* Gather shared folder values: */
    340             sharedFolderData.m_type = sharedFoldersType;
     340            sharedFolderData.m_type = enmSharedFoldersType;
    341341            sharedFolderData.m_strName = folder.GetName();
    342342            sharedFolderData.m_strHostPath = folder.GetHostPath();
     
    369369        fields << sharedFolderData.m_strName
    370370               << sharedFolderData.m_strHostPath
    371                << (sharedFolderData.m_fAutoMount ? mTrYes : "")
    372                << (sharedFolderData.m_fWritable ? mTrFull : mTrReadOnly);
     371               << (sharedFolderData.m_fAutoMount ? m_strTrYes : "")
     372               << (sharedFolderData.m_fWritable ? m_strTrFull : m_strTrReadOnly);
    373373        /* Create new shared folders item: */
    374374        new SFTreeViewItem(root(sharedFolderData.m_type), fields, SFTreeViewItem::EllipsisFile);
     
    376376    /* Ensure current item fetched: */
    377377    mTwFolders->setCurrentItem(mTwFolders->topLevelItem(0));
    378     processCurrentChanged(mTwFolders->currentItem());
     378    sltHandleCurrentItemChange(mTwFolders->currentItem());
    379379
    380380    /* Polish page finally: */
     
    399399            sharedFolderData.m_strName = pFolderItem->getText(0);
    400400            sharedFolderData.m_strHostPath = pFolderItem->getText(1);
    401             sharedFolderData.m_fAutoMount = pFolderItem->getText(2) == mTrYes ? true : false;
    402             sharedFolderData.m_fWritable = pFolderItem->getText(3) == mTrFull ? true : false;
     401            sharedFolderData.m_fAutoMount = pFolderItem->getText(2) == m_strTrYes ? true : false;
     402            sharedFolderData.m_fWritable = pFolderItem->getText(3) == m_strTrFull ? true : false;
    403403            m_pCache->child(sharedFolderData.m_strName).cacheCurrentData(sharedFolderData);
    404404        }
     
    426426}
    427427
    428 void UIMachineSettingsSF::saveFromCacheTo(UISharedFolderType sharedFoldersType)
     428void UIMachineSettingsSF::saveFromCacheTo(UISharedFolderType enmSharedFoldersType)
    429429{
    430430    /* For each shared folder data set: */
     
    441441                const UIDataSettingsSharedFolder &sharedFolderData = sharedFolderCache.base();
    442442                /* Check if thats shared folder of required type before removing: */
    443                 if (sharedFolderData.m_type == sharedFoldersType)
     443                if (sharedFolderData.m_type == enmSharedFoldersType)
    444444                    removeSharedFolder(sharedFolderCache);
    445445            }
     
    451451                const UIDataSettingsSharedFolder &sharedFolderData = sharedFolderCache.data();
    452452                /* Check if thats shared folder of required type before creating: */
    453                 if (sharedFolderData.m_type == sharedFoldersType)
     453                if (sharedFolderData.m_type == enmSharedFoldersType)
    454454                    createSharedFolder(sharedFolderCache);
    455455            }
     
    461461                const UIDataSettingsSharedFolder &sharedFolderData = sharedFolderCache.data();
    462462                /* Check if thats shared folder of required type before recreating: */
    463                 if (sharedFolderData.m_type == sharedFoldersType)
     463                if (sharedFolderData.m_type == enmSharedFoldersType)
    464464                {
    465465                    removeSharedFolder(sharedFolderCache);
     
    476476    Ui::UIMachineSettingsSF::retranslateUi(this);
    477477
    478     mNewAction->setText(tr("Add Shared Folder"));
    479     mEdtAction->setText(tr("Edit Shared Folder"));
    480     mDelAction->setText(tr("Remove Shared Folder"));
    481 
    482     mNewAction->setWhatsThis(tr("Adds new shared folder."));
    483     mEdtAction->setWhatsThis(tr("Edits selected shared folder."));
    484     mDelAction->setWhatsThis(tr("Removes selected shared folder."));
    485 
    486     mNewAction->setToolTip(mNewAction->whatsThis());
    487     mEdtAction->setToolTip(mEdtAction->whatsThis());
    488     mDelAction->setToolTip(mDelAction->whatsThis());
    489 
    490     mTrFull = tr("Full");
    491     mTrReadOnly = tr("Read-only");
    492     mTrYes = tr("Yes");
     478    m_pActionAdd->setText(tr("Add Shared Folder"));
     479    m_pActionEdit->setText(tr("Edit Shared Folder"));
     480    m_pActionRemove->setText(tr("Remove Shared Folder"));
     481
     482    m_pActionAdd->setWhatsThis(tr("Adds new shared folder."));
     483    m_pActionEdit->setWhatsThis(tr("Edits selected shared folder."));
     484    m_pActionRemove->setWhatsThis(tr("Removes selected shared folder."));
     485
     486    m_pActionAdd->setToolTip(m_pActionAdd->whatsThis());
     487    m_pActionEdit->setToolTip(m_pActionEdit->whatsThis());
     488    m_pActionRemove->setToolTip(m_pActionRemove->whatsThis());
     489
     490    m_strTrFull = tr("Full");
     491    m_strTrReadOnly = tr("Read-only");
     492    m_strTrYes = tr("Yes");
    493493}
    494494
     
    504504}
    505505
    506 void UIMachineSettingsSF::showEvent (QShowEvent *aEvent)
    507 {
    508     UISettingsPageMachine::showEvent (aEvent);
    509 
    510     /* Connect header-resize signal just before widget is shown after all the items properly loaded and initialized. */
    511     connect (mTwFolders->header(), SIGNAL (sectionResized (int, int, int)), this, SLOT (adjustFields()));
    512 
    513     /* Adjusting size after all pending show events are processed. */
    514     QTimer::singleShot (0, this, SLOT (adjustList()));
    515 }
    516 
    517 void UIMachineSettingsSF::resizeEvent (QResizeEvent *aEvent)
    518 {
    519     NOREF(aEvent);
    520     adjustList();
    521 }
    522 
    523 void UIMachineSettingsSF::addTriggered()
    524 {
    525     /* Invoke Add-Box Dialog */
    526     UIMachineSettingsSFDetails dlg (UIMachineSettingsSFDetails::AddType, isSharedFolderTypeSupported(ConsoleType), usedList (true), this);
     506void UIMachineSettingsSF::showEvent(QShowEvent *pEvent)
     507{
     508    UISettingsPageMachine::showEvent(pEvent);
     509
     510    /* Connect header-resize signal just before widget is shown after all the items properly loaded and initialized: */
     511    connect(mTwFolders->header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(sltAdjustTreeFields()));
     512
     513    /* Adjusting size after all pending show events are processed: */
     514    QTimer::singleShot(0, this, SLOT(sltAdjustTree()));
     515}
     516
     517void UIMachineSettingsSF::resizeEvent(QResizeEvent * /* pEvent */)
     518{
     519    sltAdjustTree();
     520}
     521
     522void UIMachineSettingsSF::sltAddSharedFolder()
     523{
     524    /* Invoke Add-Box Dialog: */
     525    UIMachineSettingsSFDetails dlg(UIMachineSettingsSFDetails::AddType, isSharedFolderTypeSupported(ConsoleType), usedList(true), this);
    527526    if (dlg.exec() == QDialog::Accepted)
    528527    {
    529         QString name = dlg.name();
    530         QString path = dlg.path();
    531         bool isPermanent = dlg.isPermanent();
    532         /* Shared folder's name & path could not be empty */
    533         Assert (!name.isEmpty() && !path.isEmpty());
    534         /* Appending a new listview item to the root */
     528        const QString strName = dlg.name();
     529        const QString strPath = dlg.path();
     530        const bool fPermanent = dlg.isPermanent();
     531        /* Shared folder's name & path could not be empty: */
     532        Assert(!strName.isEmpty() && !strPath.isEmpty());
     533        /* Appending a new listview item to the root: */
    535534        QStringList fields;
    536         fields << name /* name */ << path /* path */
    537                << (dlg.isAutoMounted() ? mTrYes : "" /* auto mount? */)
    538                << (dlg.isWriteable() ? mTrFull : mTrReadOnly /* writable? */);
    539         SFTreeViewItem *item = new SFTreeViewItem (root(isPermanent ? MachineType : ConsoleType),
     535        fields << strName /* name */ << strPath /* path */
     536               << (dlg.isAutoMounted() ? m_strTrYes : "" /* auto mount? */)
     537               << (dlg.isWriteable() ? m_strTrFull : m_strTrReadOnly /* writable? */);
     538        SFTreeViewItem *pItem = new SFTreeViewItem(root(fPermanent ? MachineType : ConsoleType),
    540539                                                   fields, SFTreeViewItem::EllipsisFile);
    541         mTwFolders->sortItems (0, Qt::AscendingOrder);
    542         mTwFolders->scrollToItem (item);
    543         mTwFolders->setCurrentItem (item);
    544         processCurrentChanged (item);
     540        mTwFolders->sortItems(0, Qt::AscendingOrder);
     541        mTwFolders->scrollToItem(pItem);
     542        mTwFolders->setCurrentItem(pItem);
     543        sltHandleCurrentItemChange(pItem);
    545544        mTwFolders->setFocus();
    546         adjustList();
    547     }
    548 }
    549 
    550 void UIMachineSettingsSF::edtTriggered()
    551 {
    552     /* Check selected item */
    553     QTreeWidgetItem *selectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems() [0] : 0;
    554     SFTreeViewItem *item = selectedItem ? static_cast <SFTreeViewItem*> (selectedItem) : 0;
    555     Assert (item);
    556     Assert (item->parentItem());
    557 
    558     /* Invoke Edit-Box Dialog */
    559     UIMachineSettingsSFDetails dlg (UIMachineSettingsSFDetails::EditType, isSharedFolderTypeSupported(ConsoleType), usedList (false), this);
    560     dlg.setPath (item->getText (1));
    561     dlg.setName (item->getText (0));
    562     dlg.setPermanent ((UISharedFolderType)item->parentItem()->text (1).toInt() != ConsoleType);
    563     dlg.setAutoMount (item->getText (2) == mTrYes);
    564     dlg.setWriteable (item->getText (3) == mTrFull);
     545        sltAdjustTree();
     546    }
     547}
     548
     549void UIMachineSettingsSF::sltEditSharedFolder()
     550{
     551    /* Check selected item: */
     552    QTreeWidgetItem *pSelectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems()[0] : 0;
     553    SFTreeViewItem *pItem = pSelectedItem ? static_cast<SFTreeViewItem*>(pSelectedItem) : 0;
     554    Assert(pItem);
     555    Assert(pItem->parentItem());
     556
     557    /* Invoke Edit-Box Dialog: */
     558    UIMachineSettingsSFDetails dlg(UIMachineSettingsSFDetails::EditType, isSharedFolderTypeSupported(ConsoleType), usedList(false), this);
     559    dlg.setPath(pItem->getText(1));
     560    dlg.setName(pItem->getText(0));
     561    dlg.setPermanent((UISharedFolderType)pItem->parentItem()->text(1).toInt() != ConsoleType);
     562    dlg.setAutoMount(pItem->getText(2) == m_strTrYes);
     563    dlg.setWriteable(pItem->getText(3) == m_strTrFull);
    565564    if (dlg.exec() == QDialog::Accepted)
    566565    {
    567         QString name = dlg.name();
    568         QString path = dlg.path();
    569         bool isPermanent = dlg.isPermanent();
    570         /* Shared folder's name & path could not be empty */
    571         Assert (!name.isEmpty() && !path.isEmpty());
    572         /* Searching new root for the selected listview item */
    573         SFTreeViewItem *pRoot = root(isPermanent ? MachineType : ConsoleType);
    574         /* Updating an edited listview item */
     566        const QString strName = dlg.name();
     567        const QString strPath = dlg.path();
     568        const bool fPermanent = dlg.isPermanent();
     569        /* Shared folder's name & path could not be empty: */
     570        Assert(!strName.isEmpty() && !strPath.isEmpty());
     571        /* Searching new root for the selected listview item: */
     572        SFTreeViewItem *pRoot = root(fPermanent ? MachineType : ConsoleType);
     573        /* Updating an edited listview item: */
    575574        QStringList fields;
    576         fields << name /* name */ << path /* path */
    577                << (dlg.isAutoMounted() ? mTrYes : "" /* auto mount? */)
    578                << (dlg.isWriteable() ? mTrFull : mTrReadOnly /* writable? */);
    579         item->updateText (fields);
    580         mTwFolders->sortItems (0, Qt::AscendingOrder);
    581         if (item->parentItem() != pRoot)
    582         {
    583             /* Move the selected item into new location */
    584             item->parentItem()->takeChild (item->parentItem()->indexOfChild (item));
    585             pRoot->insertChild (pRoot->childCount(), item);
    586             mTwFolders->scrollToItem (item);
    587             mTwFolders->setCurrentItem (item);
    588             processCurrentChanged (item);
     575        fields << strName /* name */ << strPath /* path */
     576               << (dlg.isAutoMounted() ? m_strTrYes : "" /* auto mount? */)
     577               << (dlg.isWriteable() ? m_strTrFull : m_strTrReadOnly /* writable? */);
     578        pItem->updateText(fields);
     579        mTwFolders->sortItems(0, Qt::AscendingOrder);
     580        if (pItem->parentItem() != pRoot)
     581        {
     582            /* Move the selected item into new location: */
     583            pItem->parentItem()->takeChild(pItem->parentItem()->indexOfChild(pItem));
     584            pRoot->insertChild(pRoot->childCount(), pItem);
     585            mTwFolders->scrollToItem(pItem);
     586            mTwFolders->setCurrentItem(pItem);
     587            sltHandleCurrentItemChange(pItem);
    589588            mTwFolders->setFocus();
    590589        }
    591         adjustList();
    592     }
    593 }
    594 
    595 void UIMachineSettingsSF::delTriggered()
    596 {
    597     QTreeWidgetItem *selectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems() [0] : 0;
    598     Assert (selectedItem);
    599     delete selectedItem;
    600     adjustList();
    601 }
    602 
    603 void UIMachineSettingsSF::processCurrentChanged (QTreeWidgetItem *aCurrentItem)
    604 {
    605     if (aCurrentItem && aCurrentItem->parent() && !aCurrentItem->isSelected())
    606         aCurrentItem->setSelected (true);
    607     bool addEnabled = aCurrentItem;
    608     bool removeEnabled = addEnabled && aCurrentItem->parent();
    609     mNewAction->setEnabled (addEnabled);
    610     mEdtAction->setEnabled (removeEnabled);
    611     mDelAction->setEnabled (removeEnabled);
    612 }
    613 
    614 void UIMachineSettingsSF::processDoubleClick (QTreeWidgetItem *aItem)
    615 {
    616     bool editEnabled = aItem && aItem->parent();
    617     if (editEnabled)
    618         edtTriggered();
    619 }
    620 
    621 void UIMachineSettingsSF::showContextMenu(const QPoint &pos)
     590        sltAdjustTree();
     591    }
     592}
     593
     594void UIMachineSettingsSF::sltDeleteSharedFolder()
     595{
     596    QTreeWidgetItem *pSelectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems()[0] : 0;
     597    Assert(pSelectedItem);
     598    delete pSelectedItem;
     599    sltAdjustTree();
     600}
     601
     602void UIMachineSettingsSF::sltHandleCurrentItemChange(QTreeWidgetItem *pCurrentItem)
     603{
     604    if (pCurrentItem && pCurrentItem->parent() && !pCurrentItem->isSelected())
     605        pCurrentItem->setSelected(true);
     606    const bool fAddEnabled = pCurrentItem;
     607    const bool fRemoveEnabled = fAddEnabled && pCurrentItem->parent();
     608    m_pActionAdd->setEnabled(fAddEnabled);
     609    m_pActionEdit->setEnabled(fRemoveEnabled);
     610    m_pActionRemove->setEnabled(fRemoveEnabled);
     611}
     612
     613void UIMachineSettingsSF::sltHandleDoubleClick(QTreeWidgetItem *pItem)
     614{
     615    const bool fEditEnabled = pItem && pItem->parent();
     616    if (fEditEnabled)
     617        sltEditSharedFolder();
     618}
     619
     620void UIMachineSettingsSF::sltHandleContextMenuRequest(const QPoint &position)
    622621{
    623622    QMenu menu;
    624     QTreeWidgetItem *pItem = mTwFolders->itemAt(pos);
     623    QTreeWidgetItem *pItem = mTwFolders->itemAt(position);
    625624    if (mTwFolders->isEnabled() && pItem && pItem->flags() & Qt::ItemIsSelectable)
    626625    {
    627         menu.addAction(mEdtAction);
    628         menu.addAction(mDelAction);
     626        menu.addAction(m_pActionEdit);
     627        menu.addAction(m_pActionRemove);
    629628    }
    630629    else
    631630    {
    632         menu.addAction(mNewAction);
     631        menu.addAction(m_pActionAdd);
    633632    }
    634633    if (!menu.isEmpty())
    635         menu.exec(mTwFolders->viewport()->mapToGlobal(pos));
    636 }
    637 
    638 void UIMachineSettingsSF::adjustList()
     634        menu.exec(mTwFolders->viewport()->mapToGlobal(position));
     635}
     636
     637void UIMachineSettingsSF::sltAdjustTree()
    639638{
    640639    /*
     
    648647     * 3 = Writable flag
    649648     */
    650     QAbstractItemView *itemView = mTwFolders;
    651     QHeaderView *itemHeader = mTwFolders->header();
    652     int total = mTwFolders->viewport()->width();
    653 
    654     int mw0 = qMax (itemView->sizeHintForColumn (0), itemHeader->sectionSizeHint (0));
    655     int mw2 = qMax (itemView->sizeHintForColumn (2), itemHeader->sectionSizeHint (2));
    656     int mw3 = qMax (itemView->sizeHintForColumn (3), itemHeader->sectionSizeHint (3));
    657 
    658     int w0 = mw0 < total / 4 ? mw0 : total / 4;
    659     int w2 = mw2 < total / 4 ? mw2 : total / 4;
    660     int w3 = mw3 < total / 4 ? mw3 : total / 4;
     649    QAbstractItemView *pItemView = mTwFolders;
     650    QHeaderView *pItemHeader = mTwFolders->header();
     651    const int iTotal = mTwFolders->viewport()->width();
     652
     653    const int mw0 = qMax(pItemView->sizeHintForColumn(0), pItemHeader->sectionSizeHint(0));
     654    const int mw2 = qMax(pItemView->sizeHintForColumn(2), pItemHeader->sectionSizeHint(2));
     655    const int mw3 = qMax(pItemView->sizeHintForColumn(3), pItemHeader->sectionSizeHint(3));
     656
     657    const int w0 = mw0 < iTotal / 4 ? mw0 : iTotal / 4;
     658    const int w2 = mw2 < iTotal / 4 ? mw2 : iTotal / 4;
     659    const int w3 = mw3 < iTotal / 4 ? mw3 : iTotal / 4;
    661660
    662661    /* Giving 1st column all the available space. */
    663     mTwFolders->setColumnWidth (0, w0);
    664     mTwFolders->setColumnWidth (1, total - w0 - w2 - w3);
    665     mTwFolders->setColumnWidth (2, w2);
    666     mTwFolders->setColumnWidth (3, w3);
    667 }
    668 
    669 void UIMachineSettingsSF::adjustFields()
    670 {
    671     QTreeWidgetItem *mainRoot = mTwFolders->invisibleRootItem();
    672     for (int i = 0; i < mainRoot->childCount(); ++ i)
    673     {
    674         QTreeWidgetItem *subRoot = mainRoot->child (i);
    675         for (int j = 0; j < subRoot->childCount(); ++ j)
    676         {
    677             SFTreeViewItem *item = subRoot->child (j) ? static_cast <SFTreeViewItem*> (subRoot->child (j)) : 0;
    678             if (item)
    679                 item->adjustText();
    680         }
    681     }
    682 }
    683 
    684 SFTreeViewItem* UIMachineSettingsSF::root(UISharedFolderType sharedFolderType)
     662    mTwFolders->setColumnWidth(0, w0);
     663    mTwFolders->setColumnWidth(1, iTotal - w0 - w2 - w3);
     664    mTwFolders->setColumnWidth(2, w2);
     665    mTwFolders->setColumnWidth(3, w3);
     666}
     667
     668void UIMachineSettingsSF::sltAdjustTreeFields()
     669{
     670    QTreeWidgetItem *pMainRoot = mTwFolders->invisibleRootItem();
     671    for (int i = 0; i < pMainRoot->childCount(); ++i)
     672    {
     673        QTreeWidgetItem *pSubRoot = pMainRoot->child(i);
     674        for (int j = 0; j < pSubRoot->childCount(); ++j)
     675        {
     676            SFTreeViewItem *pItem = pSubRoot->child(j) ? static_cast <SFTreeViewItem*>(pSubRoot->child(j)) : 0;
     677            if (pItem)
     678                pItem->adjustText();
     679        }
     680    }
     681}
     682
     683SFTreeViewItem *UIMachineSettingsSF::root(UISharedFolderType enmSharedFolderType)
    685684{
    686685    /* Search for the corresponding root item among all the top-level items: */
     
    692691        QTreeWidgetItem *pIteratedItem = pMainRootItem->child(iFolderTypeIndex);
    693692        /* If iterated item type is what we are looking for: */
    694         if (pIteratedItem->text(1).toInt() == sharedFolderType)
     693        if (pIteratedItem->text(1).toInt() == enmSharedFolderType)
    695694        {
    696695            /* Remember the item: */
     
    704703}
    705704
    706 SFoldersNameList UIMachineSettingsSF::usedList (bool aIncludeSelected)
     705SFoldersNameList UIMachineSettingsSF::usedList(bool fIncludeSelected)
    707706{
    708707    /* Make the used names list: */
    709708    SFoldersNameList list;
    710     QTreeWidgetItemIterator it (mTwFolders);
     709    QTreeWidgetItemIterator it(mTwFolders);
    711710    while (*it)
    712711    {
    713         if ((*it)->parent() && (aIncludeSelected || !(*it)->isSelected()))
    714         {
    715             SFTreeViewItem *item = static_cast <SFTreeViewItem*> (*it);
    716             UISharedFolderType type = (UISharedFolderType) item->parentItem()->text (1).toInt();
    717             list << qMakePair (item->getText (0), type);
    718         }
    719         ++ it;
     712        if ((*it)->parent() && (fIncludeSelected || !(*it)->isSelected()))
     713        {
     714            SFTreeViewItem *pItem = static_cast <SFTreeViewItem*>(*it);
     715            UISharedFolderType type = (UISharedFolderType)pItem->parentItem()->text(1).toInt();
     716            list << qMakePair(pItem->getText(0), type);
     717        }
     718        ++it;
    720719    }
    721720    return list;
    722721}
    723722
    724 bool UIMachineSettingsSF::isSharedFolderTypeSupported(UISharedFolderType sharedFolderType) const
     723bool UIMachineSettingsSF::isSharedFolderTypeSupported(UISharedFolderType enmSharedFolderType) const
    725724{
    726725    bool fIsSharedFolderTypeSupported = false;
    727     switch (sharedFolderType)
     726    switch (enmSharedFolderType)
    728727    {
    729728        case MachineType:
     
    747746}
    748747
    749 void UIMachineSettingsSF::setRootItemVisible(UISharedFolderType sharedFolderType, bool fVisible)
     748void UIMachineSettingsSF::setRootItemVisible(UISharedFolderType enmSharedFolderType, bool fVisible)
    750749{
    751750    /* Search for the corresponding root item among all the top-level items: */
    752     SFTreeViewItem *pRootItem = root(sharedFolderType);
     751    SFTreeViewItem *pRootItem = root(enmSharedFolderType);
    753752    /* If root item, we are looking for, still not found: */
    754753    if (!pRootItem)
     
    757756        QStringList fields;
    758757        /* Depending on folder type: */
    759         switch (sharedFolderType)
     758        switch (enmSharedFolderType)
    760759        {
    761760            case MachineType:
     
    777776}
    778777
    779 CSharedFolderVector UIMachineSettingsSF::getSharedFolders(UISharedFolderType sharedFoldersType)
     778CSharedFolderVector UIMachineSettingsSF::getSharedFolders(UISharedFolderType enmSharedFoldersType)
    780779{
    781780    CSharedFolderVector sharedFolders;
    782     if (isSharedFolderTypeSupported(sharedFoldersType))
    783     {
    784         switch (sharedFoldersType)
     781    if (isSharedFolderTypeSupported(enmSharedFoldersType))
     782    {
     783        switch (enmSharedFoldersType)
    785784        {
    786785            case MachineType:
     
    807806    /* Get shared folder data: */
    808807    const UIDataSettingsSharedFolder &folderData = folderCache.data();
    809     QString strName = folderData.m_strName;
    810     QString strPath = folderData.m_strHostPath;
    811     bool fIsWritable = folderData.m_fWritable;
    812     bool fIsAutoMount = folderData.m_fAutoMount;
    813     UISharedFolderType sharedFoldersType = folderData.m_type;
     808    const QString strName = folderData.m_strName;
     809    const QString strPath = folderData.m_strHostPath;
     810    const bool fIsWritable = folderData.m_fWritable;
     811    const bool fIsAutoMount = folderData.m_fAutoMount;
     812    const UISharedFolderType enmSharedFoldersType = folderData.m_type;
    814813
    815814    /* Get current shared folders: */
    816     CSharedFolderVector sharedFolders = getSharedFolders(sharedFoldersType);
     815    const CSharedFolderVector sharedFolders = getSharedFolders(enmSharedFoldersType);
    817816    /* Check if such shared folder do not exists: */
    818817    CSharedFolder sharedFolder;
     
    823822    {
    824823        /* Create new shared folder: */
    825         switch(sharedFoldersType)
     824        switch(enmSharedFoldersType)
    826825        {
    827826            case MachineType:
    828827            {
     828                /* Create new shared folder: */
    829829                m_machine.CreateSharedFolder(strName, strPath, fIsWritable, fIsAutoMount);
    830830                if (!m_machine.isOk())
     
    865865    /* Get shared folder data: */
    866866    const UIDataSettingsSharedFolder &folderData = folderCache.base();
    867     QString strName = folderData.m_strName;
    868     QString strPath = folderData.m_strHostPath;
    869     UISharedFolderType sharedFoldersType = folderData.m_type;
     867    const QString strName = folderData.m_strName;
     868    const QString strPath = folderData.m_strHostPath;
     869    const UISharedFolderType enmSharedFoldersType = folderData.m_type;
    870870
    871871    /* Get current shared folders: */
    872     CSharedFolderVector sharedFolders = getSharedFolders(sharedFoldersType);
     872    const CSharedFolderVector sharedFolders = getSharedFolders(enmSharedFoldersType);
    873873    /* Check that such shared folder really exists: */
    874874    CSharedFolder sharedFolder;
     
    879879    {
    880880        /* Remove existing shared folder: */
    881         switch(sharedFoldersType)
     881        switch(enmSharedFoldersType)
    882882        {
    883883            case MachineType:
    884884            {
     885                /* Remove existing shared folder: */
    885886                m_machine.RemoveSharedFolder(strName);
    886887                if (!m_machine.isOk())
     
    897898            case ConsoleType:
    898899            {
     900                /* Remove existing shared folder: */
    899901                m_console.RemoveSharedFolder(strName);
    900902                if (!m_console.isOk())
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h

    r66243 r66245  
    8787private slots:
    8888
    89     void addTriggered();
    90     void edtTriggered();
    91     void delTriggered();
     89    void sltAddSharedFolder();
     90    void sltEditSharedFolder();
     91    void sltDeleteSharedFolder();
    9292
    93     void processCurrentChanged (QTreeWidgetItem *aCurrentItem);
    94     void processDoubleClick (QTreeWidgetItem *aItem);
    95     void showContextMenu (const QPoint &aPos);
     93    void sltHandleCurrentItemChange(QTreeWidgetItem *pCurrentItem);
     94    void sltHandleDoubleClick(QTreeWidgetItem *pItem);
     95    void sltHandleContextMenuRequest(const QPoint &position);
    9696
    97     void adjustList();
    98     void adjustFields();
     97    void sltAdjustTree();
     98    void sltAdjustTreeFields();
    9999
    100100private:
    101101
    102     SFTreeViewItem* root(UISharedFolderType type);
    103     SFoldersNameList usedList (bool aIncludeSelected);
     102    SFTreeViewItem *root(UISharedFolderType type);
     103    SFoldersNameList usedList(bool aIncludeSelected);
    104104
    105105    bool isSharedFolderTypeSupported(UISharedFolderType sharedFolderType) const;
     
    112112    bool removeSharedFolder(const UISettingsCacheSharedFolder &folderCache);
    113113
    114     QAction  *mNewAction;
    115     QAction  *mEdtAction;
    116     QAction  *mDelAction;
    117     QString   mTrFull;
    118     QString   mTrReadOnly;
    119     QString   mTrYes;
     114    QAction *m_pActionAdd;
     115    QAction *m_pActionEdit;
     116    QAction *m_pActionRemove;
     117
     118    QString  m_strTrFull;
     119    QString  m_strTrReadOnly;
     120    QString  m_strTrYes;
    120121
    121122    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r66183 r66245  
    498498        /* Get current tab/page: */
    499499        QWidget *pTab = mTabWidget->widget(iIndex);
    500         UIMachineSettingsSerial *page = static_cast<UIMachineSettingsSerial*>(pTab);
    501         if (!page->mGbSerial->isChecked())
     500        UIMachineSettingsSerial *pPage = static_cast<UIMachineSettingsSerial*>(pTab);
     501        if (!pPage->mGbSerial->isChecked())
    502502            continue;
    503503
     
    507507
    508508        /* Check the port attribute emptiness & uniqueness: */
    509         const QString strIRQ(page->mLeIRQ->text());
    510         const QString strIOPort(page->mLeIOPort->text());
    511         QPair<QString, QString> pair(strIRQ, strIOPort);
     509        const QString strIRQ(pPage->mLeIRQ->text());
     510        const QString strIOPort(pPage->mLeIOPort->text());
     511        const QPair<QString, QString> pair(strIRQ, strIOPort);
    512512
    513513        if (strIRQ.isEmpty())
     
    529529        ports << pair;
    530530
    531         KPortMode mode = gpConverter->fromString<KPortMode>(page->mCbMode->currentText());
    532         if (mode != KPortMode_Disconnected)
     531        const KPortMode enmMode = gpConverter->fromString<KPortMode>(pPage->mCbMode->currentText());
     532        if (enmMode != KPortMode_Disconnected)
    533533        {
    534             const QString strPath(page->mLePath->text());
     534            const QString strPath(pPage->mLePath->text());
    535535
    536536            if (strPath.isEmpty())
     
    559559void UIMachineSettingsSerialPage::retranslateUi()
    560560{
    561     for (int i = 0; i < mTabWidget->count(); ++ i)
    562     {
    563         UIMachineSettingsSerial *page =
    564             static_cast<UIMachineSettingsSerial*> (mTabWidget->widget (i));
    565         mTabWidget->setTabText (i, page->pageTitle());
     561    for (int i = 0; i < mTabWidget->count(); ++i)
     562    {
     563        UIMachineSettingsSerial *pPage =
     564            static_cast<UIMachineSettingsSerial*>(mTabWidget->widget(i));
     565        mTabWidget->setTabText(i, pPage->pageTitle());
    566566    }
    567567}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r66243 r66245  
    21252125 */
    21262126UIMachineSettingsStorage::UIMachineSettingsStorage()
    2127     : mStorageModel(0)
    2128     , mAddCtrAction(0), mDelCtrAction(0)
    2129     , mAddIDECtrAction(0), mAddSATACtrAction(0), mAddSCSICtrAction(0), mAddSASCtrAction(0), mAddFloppyCtrAction(0), mAddUSBCtrAction(0), mAddNVMeCtrAction(0)
    2130     , mAddAttAction(0), mDelAttAction(0)
    2131     , mAddHDAttAction(0), mAddCDAttAction(0), mAddFDAttAction(0)
     2127    : m_pModelStorage(0)
     2128    , m_pActionAddController(0), m_pActionRemoveController(0)
     2129    , m_pActionAddControllerIDE(0), m_pActionAddControllerSATA(0), m_pActionAddControllerSCSI(0), m_pActionAddControllerSAS(0), m_pActionAddControllerFloppy(0), m_pActionAddControllerUSB(0), m_pActionAddControllerNVMe(0)
     2130    , m_pActionAddAttachment(0), m_pActionRemoveAttachment(0)
     2131    , m_pActionAddAttachmentHD(0), m_pActionAddAttachmentCD(0), m_pActionAddAttachmentFD(0)
    21322132    , m_pMediumIdHolder(new UIMediumIDHolder(this))
    2133     , mIsPolished(false)
    2134     , mIsLoadingInProgress(0)
     2133    , m_fPolished(false)
     2134    , m_fLoadingInProgress(0)
    21352135    , m_pCache(new UISettingsCacheMachineStorage)
    21362136{
     
    21472147
    21482148    /* Controller Actions */
    2149     mAddCtrAction = new QAction (this);
    2150     mAddCtrAction->setIcon(iconPool()->icon(ControllerAddEn, ControllerAddDis));
    2151 
    2152     mAddIDECtrAction = new QAction (this);
    2153     mAddIDECtrAction->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));
    2154 
    2155     mAddSATACtrAction = new QAction (this);
    2156     mAddSATACtrAction->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
    2157 
    2158     mAddSCSICtrAction = new QAction (this);
    2159     mAddSCSICtrAction->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis));
    2160 
    2161     mAddFloppyCtrAction = new QAction (this);
    2162     mAddFloppyCtrAction->setIcon(iconPool()->icon(FloppyControllerAddEn, FloppyControllerAddDis));
    2163 
    2164     mAddSASCtrAction = new QAction (this);
    2165     mAddSASCtrAction->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
    2166 
    2167     mAddUSBCtrAction = new QAction (this);
    2168     mAddUSBCtrAction->setIcon(iconPool()->icon(USBControllerAddEn, USBControllerAddDis));
    2169 
    2170     mAddNVMeCtrAction = new QAction (this);
    2171     mAddNVMeCtrAction->setIcon(iconPool()->icon(NVMeControllerAddEn, NVMeControllerAddDis));
    2172 
    2173     mDelCtrAction = new QAction (this);
    2174     mDelCtrAction->setIcon(iconPool()->icon(ControllerDelEn, ControllerDelDis));
     2149    m_pActionAddController = new QAction (this);
     2150    m_pActionAddController->setIcon(iconPool()->icon(ControllerAddEn, ControllerAddDis));
     2151
     2152    m_pActionAddControllerIDE = new QAction (this);
     2153    m_pActionAddControllerIDE->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));
     2154
     2155    m_pActionAddControllerSATA = new QAction (this);
     2156    m_pActionAddControllerSATA->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
     2157
     2158    m_pActionAddControllerSCSI = new QAction (this);
     2159    m_pActionAddControllerSCSI->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis));
     2160
     2161    m_pActionAddControllerFloppy = new QAction (this);
     2162    m_pActionAddControllerFloppy->setIcon(iconPool()->icon(FloppyControllerAddEn, FloppyControllerAddDis));
     2163
     2164    m_pActionAddControllerSAS = new QAction (this);
     2165    m_pActionAddControllerSAS->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
     2166
     2167    m_pActionAddControllerUSB = new QAction (this);
     2168    m_pActionAddControllerUSB->setIcon(iconPool()->icon(USBControllerAddEn, USBControllerAddDis));
     2169
     2170    m_pActionAddControllerNVMe = new QAction (this);
     2171    m_pActionAddControllerNVMe->setIcon(iconPool()->icon(NVMeControllerAddEn, NVMeControllerAddDis));
     2172
     2173    m_pActionRemoveController = new QAction (this);
     2174    m_pActionRemoveController->setIcon(iconPool()->icon(ControllerDelEn, ControllerDelDis));
    21752175
    21762176    /* Attachment Actions */
    2177     mAddAttAction = new QAction (this);
    2178     mAddAttAction->setIcon(iconPool()->icon(AttachmentAddEn, AttachmentAddDis));
    2179 
    2180     mAddHDAttAction = new QAction (this);
    2181     mAddHDAttAction->setIcon(iconPool()->icon(HDAttachmentAddEn, HDAttachmentAddDis));
    2182 
    2183     mAddCDAttAction = new QAction (this);
    2184     mAddCDAttAction->setIcon(iconPool()->icon(CDAttachmentAddEn, CDAttachmentAddDis));
    2185 
    2186     mAddFDAttAction = new QAction (this);
    2187     mAddFDAttAction->setIcon(iconPool()->icon(FDAttachmentAddEn, FDAttachmentAddDis));
    2188 
    2189     mDelAttAction = new QAction (this);
    2190     mDelAttAction->setIcon(iconPool()->icon(AttachmentDelEn, AttachmentDelDis));
     2177    m_pActionAddAttachment = new QAction (this);
     2178    m_pActionAddAttachment->setIcon(iconPool()->icon(AttachmentAddEn, AttachmentAddDis));
     2179
     2180    m_pActionAddAttachmentHD = new QAction (this);
     2181    m_pActionAddAttachmentHD->setIcon(iconPool()->icon(HDAttachmentAddEn, HDAttachmentAddDis));
     2182
     2183    m_pActionAddAttachmentCD = new QAction (this);
     2184    m_pActionAddAttachmentCD->setIcon(iconPool()->icon(CDAttachmentAddEn, CDAttachmentAddDis));
     2185
     2186    m_pActionAddAttachmentFD = new QAction (this);
     2187    m_pActionAddAttachmentFD->setIcon(iconPool()->icon(FDAttachmentAddEn, FDAttachmentAddDis));
     2188
     2189    m_pActionRemoveAttachment = new QAction (this);
     2190    m_pActionRemoveAttachment->setIcon(iconPool()->icon(AttachmentDelEn, AttachmentDelDis));
    21912191
    21922192    /* Create storage-view: */
    2193     mTwStorageTree = new QITreeView(this);
     2193    m_pTreeStorage = new QITreeView(this);
    21942194    {
    21952195        /* Configure storage-view: */
    2196         mLsLeftPane->setBuddy(mTwStorageTree);
     2196        mLsLeftPane->setBuddy(m_pTreeStorage);
    21972197        /* Add storage-view into layout: */
    2198         mLtStorage->insertWidget(0, mTwStorageTree);
     2198        mLtStorage->insertWidget(0, m_pTreeStorage);
    21992199    }
    22002200
    22012201    /* Create storage-model: */
    2202     mStorageModel = new StorageModel (mTwStorageTree);
    2203     StorageDelegate *storageDelegate = new StorageDelegate (mTwStorageTree);
    2204     mTwStorageTree->setMouseTracking (true);
    2205     mTwStorageTree->setContextMenuPolicy (Qt::CustomContextMenu);
    2206     mTwStorageTree->setModel (mStorageModel);
    2207     mTwStorageTree->setItemDelegate (storageDelegate);
    2208     mTwStorageTree->setRootIndex (mStorageModel->root());
    2209     mTwStorageTree->setCurrentIndex (mStorageModel->root());
     2202    m_pModelStorage = new StorageModel (m_pTreeStorage);
     2203    StorageDelegate *storageDelegate = new StorageDelegate (m_pTreeStorage);
     2204    m_pTreeStorage->setMouseTracking (true);
     2205    m_pTreeStorage->setContextMenuPolicy (Qt::CustomContextMenu);
     2206    m_pTreeStorage->setModel (m_pModelStorage);
     2207    m_pTreeStorage->setItemDelegate (storageDelegate);
     2208    m_pTreeStorage->setRootIndex (m_pModelStorage->root());
     2209    m_pTreeStorage->setCurrentIndex (m_pModelStorage->root());
    22102210
    22112211    /* Determine icon metric: */
     
    22152215    /* Storage ToolBar */
    22162216    mTbStorageBar->setIconSize (QSize (iIconMetric, iIconMetric));
    2217     mTbStorageBar->addAction (mAddAttAction);
    2218     mTbStorageBar->addAction (mDelAttAction);
    2219     mTbStorageBar->addAction (mAddCtrAction);
    2220     mTbStorageBar->addAction (mDelCtrAction);
     2217    mTbStorageBar->addAction (m_pActionAddAttachment);
     2218    mTbStorageBar->addAction (m_pActionRemoveAttachment);
     2219    mTbStorageBar->addAction (m_pActionAddController);
     2220    mTbStorageBar->addAction (m_pActionRemoveController);
    22212221
    22222222#ifdef VBOX_WS_MAC
     
    22492249    connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)),
    22502250            this, SLOT(sltHandleMediumDeleted(const QString&)));
    2251     connect (mAddCtrAction, SIGNAL (triggered (bool)), this, SLOT (addController()));
    2252     connect (mAddIDECtrAction, SIGNAL (triggered (bool)), this, SLOT (addIDEController()));
    2253     connect (mAddSATACtrAction, SIGNAL (triggered (bool)), this, SLOT (addSATAController()));
    2254     connect (mAddSCSICtrAction, SIGNAL (triggered (bool)), this, SLOT (addSCSIController()));
    2255     connect (mAddSASCtrAction, SIGNAL (triggered (bool)), this, SLOT (addSASController()));
    2256     connect (mAddFloppyCtrAction, SIGNAL (triggered (bool)), this, SLOT (addFloppyController()));
    2257     connect (mAddUSBCtrAction, SIGNAL (triggered (bool)), this, SLOT (addUSBController()));
    2258     connect (mAddNVMeCtrAction, SIGNAL (triggered (bool)), this, SLOT (addNVMeController()));
    2259     connect (mDelCtrAction, SIGNAL (triggered (bool)), this, SLOT (delController()));
    2260     connect (mAddAttAction, SIGNAL (triggered (bool)), this, SLOT (addAttachment()));
    2261     connect (mAddHDAttAction, SIGNAL (triggered (bool)), this, SLOT (addHDAttachment()));
    2262     connect (mAddCDAttAction, SIGNAL (triggered (bool)), this, SLOT (addCDAttachment()));
    2263     connect (mAddFDAttAction, SIGNAL (triggered (bool)), this, SLOT (addFDAttachment()));
    2264     connect (mDelAttAction, SIGNAL (triggered (bool)), this, SLOT (delAttachment()));
    2265     connect (mStorageModel, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
    2266              this, SLOT (onRowInserted (const QModelIndex&, int)));
    2267     connect (mStorageModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
    2268              this, SLOT (onRowRemoved()));
    2269     connect (mTwStorageTree, SIGNAL (currentItemChanged (const QModelIndex&, const QModelIndex&)),
    2270              this, SLOT (onCurrentItemChanged()));
    2271     connect (mTwStorageTree, SIGNAL (customContextMenuRequested (const QPoint&)),
    2272              this, SLOT (onContextMenuRequested (const QPoint&)));
    2273     connect (mTwStorageTree, SIGNAL (drawItemBranches (QPainter*, const QRect&, const QModelIndex&)),
    2274              this, SLOT (onDrawItemBranches (QPainter *, const QRect &, const QModelIndex &)));
    2275     connect (mTwStorageTree, SIGNAL (mouseMoved (QMouseEvent*)),
    2276              this, SLOT (onMouseMoved (QMouseEvent*)));
    2277     connect (mTwStorageTree, SIGNAL (mousePressed (QMouseEvent*)),
    2278              this, SLOT (onMouseClicked (QMouseEvent*)));
    2279     connect (mTwStorageTree, SIGNAL (mouseDoubleClicked (QMouseEvent*)),
    2280              this, SLOT (onMouseClicked (QMouseEvent*)));
    2281     connect (mLeName, SIGNAL (textEdited (const QString&)), this, SLOT (setInformation()));
    2282     connect (mCbType, SIGNAL (activated (int)), this, SLOT (setInformation()));
    2283     connect (mCbSlot, SIGNAL (activated (int)), this, SLOT (setInformation()));
    2284     connect (mSbPortCount, SIGNAL (valueChanged (int)), this, SLOT (setInformation()));
    2285     connect (mCbIoCache, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
    2286     connect (m_pMediumIdHolder, SIGNAL (sigChanged()), this, SLOT (setInformation()));
     2251    connect (m_pActionAddController, SIGNAL (triggered (bool)), this, SLOT (sltAddController()));
     2252    connect (m_pActionAddControllerIDE, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerIDE()));
     2253    connect (m_pActionAddControllerSATA, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSATA()));
     2254    connect (m_pActionAddControllerSCSI, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSCSI()));
     2255    connect (m_pActionAddControllerSAS, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSAS()));
     2256    connect (m_pActionAddControllerFloppy, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerFloppy()));
     2257    connect (m_pActionAddControllerUSB, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerUSB()));
     2258    connect (m_pActionAddControllerNVMe, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerNVMe()));
     2259    connect (m_pActionRemoveController, SIGNAL (triggered (bool)), this, SLOT (sltRemoveController()));
     2260    connect (m_pActionAddAttachment, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachment()));
     2261    connect (m_pActionAddAttachmentHD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentHD()));
     2262    connect (m_pActionAddAttachmentCD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentCD()));
     2263    connect (m_pActionAddAttachmentFD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentFD()));
     2264    connect (m_pActionRemoveAttachment, SIGNAL (triggered (bool)), this, SLOT (sltRemoveAttachment()));
     2265    connect (m_pModelStorage, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
     2266             this, SLOT (sltHandleRowInsertion (const QModelIndex&, int)));
     2267    connect (m_pModelStorage, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
     2268             this, SLOT (sltHandleRowRemoval()));
     2269    connect (m_pTreeStorage, SIGNAL (currentItemChanged (const QModelIndex&, const QModelIndex&)),
     2270             this, SLOT (sltHandleCurrentItemChange()));
     2271    connect (m_pTreeStorage, SIGNAL (customContextMenuRequested (const QPoint&)),
     2272             this, SLOT (sltHandleContextMenuRequest (const QPoint&)));
     2273    connect (m_pTreeStorage, SIGNAL (drawItemBranches (QPainter*, const QRect&, const QModelIndex&)),
     2274             this, SLOT (sltHandleDrawItemBranches (QPainter *, const QRect &, const QModelIndex &)));
     2275    connect (m_pTreeStorage, SIGNAL (mouseMoved (QMouseEvent*)),
     2276             this, SLOT (sltHandleMouseMove (QMouseEvent*)));
     2277    connect (m_pTreeStorage, SIGNAL (mousePressed (QMouseEvent*)),
     2278             this, SLOT (sltHandleMouseClick (QMouseEvent*)));
     2279    connect (m_pTreeStorage, SIGNAL (mouseDoubleClicked (QMouseEvent*)),
     2280             this, SLOT (sltHandleMouseClick (QMouseEvent*)));
     2281    connect (mLeName, SIGNAL (textEdited (const QString&)), this, SLOT (sltSetInformation()));
     2282    connect (mCbType, SIGNAL (activated (int)), this, SLOT (sltSetInformation()));
     2283    connect (mCbSlot, SIGNAL (activated (int)), this, SLOT (sltSetInformation()));
     2284    connect (mSbPortCount, SIGNAL (valueChanged (int)), this, SLOT (sltSetInformation()));
     2285    connect (mCbIoCache, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation()));
     2286    connect (m_pMediumIdHolder, SIGNAL (sigChanged()), this, SLOT (sltSetInformation()));
    22872287    connect (mTbOpen, SIGNAL (clicked (bool)), mTbOpen, SLOT (showMenu()));
    22882288    connect (pOpenMediumMenu, SIGNAL (aboutToShow()), this, SLOT (sltPrepareOpenMediumMenu()));
    2289     connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
    2290     connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
    2291     connect (mCbNonRotational, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
    2292     connect(m_pCheckBoxHotPluggable, SIGNAL(stateChanged(int)), this, SLOT(setInformation()));
     2289    connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation()));
     2290    connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation()));
     2291    connect (mCbNonRotational, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation()));
     2292    connect(m_pCheckBoxHotPluggable, SIGNAL(stateChanged(int)), this, SLOT(sltSetInformation()));
    22932293
    22942294    /* Applying language settings */
     
    23102310}
    23112311
    2312 void UIMachineSettingsStorage::setChipsetType(KChipsetType type)
     2312void UIMachineSettingsStorage::setChipsetType(KChipsetType enmType)
    23132313{
    23142314    /* Make sure chipset type has changed: */
    2315     if (mStorageModel->chipsetType() == type)
     2315    if (m_pModelStorage->chipsetType() == enmType)
    23162316        return;
    23172317
    23182318    /* Update chipset type value: */
    2319     mStorageModel->setChipsetType(type);
    2320     updateActionsState();
     2319    m_pModelStorage->setChipsetType(enmType);
     2320    sltUpdateActionsState();
    23212321
    23222322    /* Revalidate: */
     
    24102410{
    24112411    /* Clear model initially: */
    2412     mStorageModel->clear();
     2412    m_pModelStorage->clear();
    24132413
    24142414    /* Load storage data to page: */
    2415     mStorageModel->setMachineId(m_strMachineId);
     2415    m_pModelStorage->setMachineId(m_strMachineId);
    24162416
    24172417    /* For each storage controller: */
     
    24242424
    24252425        /* Load storage controller data to page: */
    2426         QModelIndex controllerIndex = mStorageModel->addController(controllerData.m_strControllerName,
     2426        QModelIndex controllerIndex = m_pModelStorage->addController(controllerData.m_strControllerName,
    24272427                                                                   controllerData.m_controllerBus,
    24282428                                                                   controllerData.m_controllerType);
    2429         QUuid controllerId = QUuid(mStorageModel->data(controllerIndex, StorageModel::R_ItemId).toString());
    2430         mStorageModel->setData(controllerIndex, controllerData.m_uPortCount, StorageModel::R_CtrPortCount);
    2431         mStorageModel->setData(controllerIndex, controllerData.m_fUseHostIOCache, StorageModel::R_CtrIoCache);
     2429        QUuid controllerId = QUuid(m_pModelStorage->data(controllerIndex, StorageModel::R_ItemId).toString());
     2430        m_pModelStorage->setData(controllerIndex, controllerData.m_uPortCount, StorageModel::R_CtrPortCount);
     2431        m_pModelStorage->setData(controllerIndex, controllerData.m_fUseHostIOCache, StorageModel::R_CtrIoCache);
    24322432
    24332433        /* For each storage attachment: */
     
    24402440
    24412441            /* Load storage attachment data to page: */
    2442             QModelIndex attachmentIndex = mStorageModel->addAttachment(controllerId, attachmentData.m_attachmentType, attachmentData.m_strAttachmentMediumId);
     2442            QModelIndex attachmentIndex = m_pModelStorage->addAttachment(controllerId, attachmentData.m_attachmentType, attachmentData.m_strAttachmentMediumId);
    24432443            StorageSlot attachmentStorageSlot(controllerData.m_controllerBus,
    24442444                                              attachmentData.m_iAttachmentPort,
    24452445                                              attachmentData.m_iAttachmentDevice);
    2446             mStorageModel->setData(attachmentIndex, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
    2447             mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough);
    2448             mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject);
    2449             mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentNonRotational, StorageModel::R_AttIsNonRotational);
    2450             mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentHotPluggable, StorageModel::R_AttIsHotPluggable);
     2446            m_pModelStorage->setData(attachmentIndex, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
     2447            m_pModelStorage->setData(attachmentIndex, attachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough);
     2448            m_pModelStorage->setData(attachmentIndex, attachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject);
     2449            m_pModelStorage->setData(attachmentIndex, attachmentData.m_fAttachmentNonRotational, StorageModel::R_AttIsNonRotational);
     2450            m_pModelStorage->setData(attachmentIndex, attachmentData.m_fAttachmentHotPluggable, StorageModel::R_AttIsHotPluggable);
    24512451        }
    24522452    }
    24532453    /* Set the first controller as current if present */
    2454     if (mStorageModel->rowCount(mStorageModel->root()) > 0)
    2455         mTwStorageTree->setCurrentIndex(mStorageModel->index(0, 0, mStorageModel->root()));
     2454    if (m_pModelStorage->rowCount(m_pModelStorage->root()) > 0)
     2455        m_pTreeStorage->setCurrentIndex(m_pModelStorage->index(0, 0, m_pModelStorage->root()));
    24562456
    24572457    /* Update actions: */
    2458     updateActionsState();
     2458    sltUpdateActionsState();
    24592459
    24602460    /* Polish page finally: */
     
    24712471
    24722472    /* For each storage controller: */
    2473     QModelIndex rootIndex = mStorageModel->root();
    2474     for (int iControllerIndex = 0; iControllerIndex < mStorageModel->rowCount(rootIndex); ++iControllerIndex)
     2473    QModelIndex rootIndex = m_pModelStorage->root();
     2474    for (int iControllerIndex = 0; iControllerIndex < m_pModelStorage->rowCount(rootIndex); ++iControllerIndex)
    24752475    {
    24762476        /* Prepare storage controller data & key: */
     
    24782478
    24792479        /* Gather storage controller data: */
    2480         QModelIndex controllerIndex = mStorageModel->index(iControllerIndex, 0, rootIndex);
    2481         controllerData.m_strControllerName = mStorageModel->data(controllerIndex, StorageModel::R_CtrName).toString();
    2482         controllerData.m_controllerBus = mStorageModel->data(controllerIndex, StorageModel::R_CtrBusType).value<KStorageBus>();
    2483         controllerData.m_controllerType = mStorageModel->data(controllerIndex, StorageModel::R_CtrType).value<KStorageControllerType>();
    2484         controllerData.m_uPortCount = mStorageModel->data(controllerIndex, StorageModel::R_CtrPortCount).toUInt();
    2485         controllerData.m_fUseHostIOCache = mStorageModel->data(controllerIndex, StorageModel::R_CtrIoCache).toBool();
     2480        QModelIndex controllerIndex = m_pModelStorage->index(iControllerIndex, 0, rootIndex);
     2481        controllerData.m_strControllerName = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrName).toString();
     2482        controllerData.m_controllerBus = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrBusType).value<KStorageBus>();
     2483        controllerData.m_controllerType = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrType).value<KStorageControllerType>();
     2484        controllerData.m_uPortCount = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrPortCount).toUInt();
     2485        controllerData.m_fUseHostIOCache = m_pModelStorage->data(controllerIndex, StorageModel::R_CtrIoCache).toBool();
    24862486
    24872487        /* For each storage attachment: */
    2488         for (int iAttachmentIndex = 0; iAttachmentIndex < mStorageModel->rowCount(controllerIndex); ++iAttachmentIndex)
     2488        for (int iAttachmentIndex = 0; iAttachmentIndex < m_pModelStorage->rowCount(controllerIndex); ++iAttachmentIndex)
    24892489        {
    24902490            /* Prepare storage attachment data & key: */
     
    24922492
    24932493            /* Gather storage controller data: */
    2494             QModelIndex attachmentIndex = mStorageModel->index(iAttachmentIndex, 0, controllerIndex);
    2495             attachmentData.m_attachmentType = mStorageModel->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>();
    2496             StorageSlot attachmentSlot = mStorageModel->data(attachmentIndex, StorageModel::R_AttSlot).value<StorageSlot>();
     2494            QModelIndex attachmentIndex = m_pModelStorage->index(iAttachmentIndex, 0, controllerIndex);
     2495            attachmentData.m_attachmentType = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttDevice).value<KDeviceType>();
     2496            StorageSlot attachmentSlot = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttSlot).value<StorageSlot>();
    24972497            attachmentData.m_iAttachmentPort = attachmentSlot.port;
    24982498            attachmentData.m_iAttachmentDevice = attachmentSlot.device;
    2499             attachmentData.m_fAttachmentPassthrough = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool();
    2500             attachmentData.m_fAttachmentTempEject = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool();
    2501             attachmentData.m_fAttachmentNonRotational = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsNonRotational).toBool();
    2502             attachmentData.m_fAttachmentHotPluggable = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsHotPluggable).toBool();
    2503             attachmentData.m_strAttachmentMediumId = mStorageModel->data(attachmentIndex, StorageModel::R_AttMediumId).toString();
     2499            attachmentData.m_fAttachmentPassthrough = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool();
     2500            attachmentData.m_fAttachmentTempEject = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool();
     2501            attachmentData.m_fAttachmentNonRotational = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsNonRotational).toBool();
     2502            attachmentData.m_fAttachmentHotPluggable = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttIsHotPluggable).toBool();
     2503            attachmentData.m_strAttachmentMediumId = m_pModelStorage->data(attachmentIndex, StorageModel::R_AttMediumId).toString();
    25042504
    25052505            /* Recache storage attachment data: */
     
    25372537    /* Check controllers for name emptiness & coincidence.
    25382538     * Check attachments for the hd presence / uniqueness. */
    2539     QModelIndex rootIndex = mStorageModel->root();
     2539    const QModelIndex rootIndex = m_pModelStorage->root();
    25402540    QMap <QString, QString> config;
    25412541    QMap<int, QString> names;
    25422542    /* For each controller: */
    2543     for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
    2544     {
    2545         QModelIndex ctrIndex = rootIndex.child (i, 0);
    2546         QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
     2543    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
     2544    {
     2545        const QModelIndex ctrIndex = rootIndex.child(i, 0);
     2546        const QString ctrName = m_pModelStorage->data(ctrIndex, StorageModel::R_CtrName).toString();
    25472547
    25482548        /* Check for name emptiness: */
     
    25632563
    25642564        /* For each attachment: */
    2565         for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
    2566         {
    2567             QModelIndex attIndex = ctrIndex.child (j, 0);
    2568             StorageSlot attSlot = mStorageModel->data (attIndex, StorageModel::R_AttSlot).value <StorageSlot>();
    2569             KDeviceType attDevice = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
    2570             QString key (mStorageModel->data (attIndex, StorageModel::R_AttMediumId).toString());
    2571             QString value (QString ("%1 (%2)").arg (ctrName, gpConverter->toString (attSlot)));
     2565        for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j)
     2566        {
     2567            const QModelIndex attIndex = ctrIndex.child(j, 0);
     2568            const StorageSlot attSlot = m_pModelStorage->data(attIndex, StorageModel::R_AttSlot).value <StorageSlot>();
     2569            const KDeviceType enmAttDevice = m_pModelStorage->data(attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
     2570            const QString key(m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString());
     2571            const QString value(QString("%1 (%2)").arg(ctrName, gpConverter->toString(attSlot)));
    25722572            /* Check for emptiness: */
    2573             if (vboxGlobal().medium(key).isNull() && attDevice == KDeviceType_HardDisk)
     2573            if (vboxGlobal().medium(key).isNull() && enmAttDevice == KDeviceType_HardDisk)
    25742574            {
    2575                 message.second << tr("No hard disk is selected for <i>%1</i>.").arg (value);
     2575                message.second << tr("No hard disk is selected for <i>%1</i>.").arg(value);
    25762576                fPass = false;
    25772577            }
    25782578            /* Check for coincidence: */
    2579             if (!vboxGlobal().medium(key).isNull() && config.contains (key))
     2579            if (!vboxGlobal().medium(key).isNull() && config.contains(key))
    25802580            {
    25812581                message.second << tr("<i>%1</i> is using a disk that is already attached to <i>%2</i>.")
    2582                                      .arg (value).arg (config [key]);
     2582                                     .arg(value).arg(config[key]);
    25832583                fPass = false;
    25842584            }
    25852585            else
    2586                 config.insert (key, value);
     2586                config.insert(key, value);
    25872587        }
    25882588    }
     
    25902590    /* Check for excessive controllers on Storage page controllers list: */
    25912591    QStringList excessiveList;
    2592     QMap<KStorageBus, int> currentType = mStorageModel->currentControllerTypes();
    2593     QMap<KStorageBus, int> maximumType = mStorageModel->maximumControllerTypes();
     2592    const QMap<KStorageBus, int> currentType = m_pModelStorage->currentControllerTypes();
     2593    const QMap<KStorageBus, int> maximumType = m_pModelStorage->maximumControllerTypes();
    25942594    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_USB; ++iStorageBusType)
    25952595    {
     
    26092609                             "Please change the chipset type on the System settings page or reduce the number "
    26102610                             "of the following storage controllers on the Storage settings page: %2")
    2611                              .arg(gpConverter->toString(mStorageModel->chipsetType()))
     2611                             .arg(gpConverter->toString(m_pModelStorage->chipsetType()))
    26122612                             .arg(excessiveList.join(", "));
    26132613        fPass = false;
     
    26222622}
    26232623
    2624 void UIMachineSettingsStorage::setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel)
     2624void UIMachineSettingsStorage::setConfigurationAccessLevel(ConfigurationAccessLevel enmLevel)
    26252625{
    26262626    /* Update model 'configuration access level': */
    2627     mStorageModel->setConfigurationAccessLevel(newConfigurationAccessLevel);
     2627    m_pModelStorage->setConfigurationAccessLevel(enmLevel);
    26282628    /* Update 'configuration access level' of base class: */
    2629     UISettingsPageMachine::setConfigurationAccessLevel(newConfigurationAccessLevel);
     2629    UISettingsPageMachine::setConfigurationAccessLevel(enmLevel);
    26302630}
    26312631
     
    26362636
    26372637    /* Translate storage-view: */
    2638     mTwStorageTree->setWhatsThis(tr("Lists all storage controllers for this machine and "
     2638    m_pTreeStorage->setWhatsThis(tr("Lists all storage controllers for this machine and "
    26392639                                    "the virtual images and host drives attached to them."));
    26402640
    26412641    /* Translate tool-bar: */
    2642     mAddCtrAction->setShortcut(QKeySequence("Ins"));
    2643     mDelCtrAction->setShortcut(QKeySequence("Del"));
    2644     mAddAttAction->setShortcut(QKeySequence("+"));
    2645     mDelAttAction->setShortcut(QKeySequence("-"));
    2646 
    2647     mAddCtrAction->setText(tr("Add Controller"));
    2648     mAddIDECtrAction->setText(tr("Add IDE Controller"));
    2649     mAddSATACtrAction->setText(tr("Add SATA Controller"));
    2650     mAddSCSICtrAction->setText(tr("Add SCSI Controller"));
    2651     mAddSASCtrAction->setText(tr("Add SAS Controller"));
    2652     mAddFloppyCtrAction->setText(tr("Add Floppy Controller"));
    2653     mAddUSBCtrAction->setText(tr("Add USB Controller"));
    2654     mAddNVMeCtrAction->setText(tr("Add NVMe Controller"));
    2655     mDelCtrAction->setText(tr("Remove Controller"));
    2656     mAddAttAction->setText(tr("Add Attachment"));
    2657     mAddHDAttAction->setText(tr("Add Hard Disk"));
    2658     mAddCDAttAction->setText(tr("Add Optical Drive"));
    2659     mAddFDAttAction->setText(tr("Add Floppy Drive"));
    2660     mDelAttAction->setText(tr("Remove Attachment"));
    2661 
    2662     mAddCtrAction->setWhatsThis(tr("Adds new storage controller."));
    2663     mDelCtrAction->setWhatsThis(tr("Removes selected storage controller."));
    2664     mAddAttAction->setWhatsThis(tr("Adds new storage attachment."));
    2665     mDelAttAction->setWhatsThis(tr("Removes selected storage attachment."));
    2666 
    2667     mAddCtrAction->setToolTip(mAddCtrAction->whatsThis());
    2668     mDelCtrAction->setToolTip(mDelCtrAction->whatsThis());
    2669     mAddAttAction->setToolTip(mAddAttAction->whatsThis());
    2670     mDelAttAction->setToolTip(mDelAttAction->whatsThis());
     2642    m_pActionAddController->setShortcut(QKeySequence("Ins"));
     2643    m_pActionRemoveController->setShortcut(QKeySequence("Del"));
     2644    m_pActionAddAttachment->setShortcut(QKeySequence("+"));
     2645    m_pActionRemoveAttachment->setShortcut(QKeySequence("-"));
     2646
     2647    m_pActionAddController->setText(tr("Add Controller"));
     2648    m_pActionAddControllerIDE->setText(tr("Add IDE Controller"));
     2649    m_pActionAddControllerSATA->setText(tr("Add SATA Controller"));
     2650    m_pActionAddControllerSCSI->setText(tr("Add SCSI Controller"));
     2651    m_pActionAddControllerSAS->setText(tr("Add SAS Controller"));
     2652    m_pActionAddControllerFloppy->setText(tr("Add Floppy Controller"));
     2653    m_pActionAddControllerUSB->setText(tr("Add USB Controller"));
     2654    m_pActionAddControllerNVMe->setText(tr("Add NVMe Controller"));
     2655    m_pActionRemoveController->setText(tr("Remove Controller"));
     2656    m_pActionAddAttachment->setText(tr("Add Attachment"));
     2657    m_pActionAddAttachmentHD->setText(tr("Add Hard Disk"));
     2658    m_pActionAddAttachmentCD->setText(tr("Add Optical Drive"));
     2659    m_pActionAddAttachmentFD->setText(tr("Add Floppy Drive"));
     2660    m_pActionRemoveAttachment->setText(tr("Remove Attachment"));
     2661
     2662    m_pActionAddController->setWhatsThis(tr("Adds new storage controller."));
     2663    m_pActionRemoveController->setWhatsThis(tr("Removes selected storage controller."));
     2664    m_pActionAddAttachment->setWhatsThis(tr("Adds new storage attachment."));
     2665    m_pActionRemoveAttachment->setWhatsThis(tr("Removes selected storage attachment."));
     2666
     2667    m_pActionAddController->setToolTip(m_pActionAddController->whatsThis());
     2668    m_pActionRemoveController->setToolTip(m_pActionRemoveController->whatsThis());
     2669    m_pActionAddAttachment->setToolTip(m_pActionAddAttachment->whatsThis());
     2670    m_pActionRemoveAttachment->setToolTip(m_pActionRemoveAttachment->whatsThis());
    26712671}
    26722672
     
    26742674{
    26752675    /* Declare required variables: */
    2676     QModelIndex index = mTwStorageTree->currentIndex();
    2677     KDeviceType device = mStorageModel->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
     2676    const QModelIndex index = m_pTreeStorage->currentIndex();
     2677    const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value<KDeviceType>();
    26782678
    26792679    /* Left pane: */
    26802680    mLsLeftPane->setEnabled(isMachineInValidMode());
    2681     mTwStorageTree->setEnabled(isMachineInValidMode());
     2681    m_pTreeStorage->setEnabled(isMachineInValidMode());
    26822682    /* Empty information pane: */
    26832683    mLsEmpty->setEnabled(isMachineInValidMode());
     
    26942694    /* Attachments pane: */
    26952695    mLsAttributes->setEnabled(isMachineInValidMode());
    2696     mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));
     2696    mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && enmDevice != KDeviceType_HardDisk));
    26972697    mCbSlot->setEnabled(isMachineOffline());
    2698     mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));
     2698    mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && enmDevice != KDeviceType_HardDisk));
    26992699    mCbPassthrough->setEnabled(isMachineOffline());
    27002700    mCbTempEject->setEnabled(isMachineInValidMode());
     
    27222722
    27232723    /* Update action states: */
    2724     updateActionsState();
     2724    sltUpdateActionsState();
    27252725}
    27262726
    27272727void UIMachineSettingsStorage::showEvent(QShowEvent *pEvent)
    27282728{
    2729     if (!mIsPolished)
    2730     {
    2731         mIsPolished = true;
    2732 
    2733         /* First column indent */
    2734         mLtEmpty->setColumnMinimumWidth (0, 10);
    2735         mLtController->setColumnMinimumWidth (0, 10);
    2736         mLtAttachment->setColumnMinimumWidth (0, 10);
     2729    if (!m_fPolished)
     2730    {
     2731        m_fPolished = true;
     2732
     2733        /* First column indent: */
     2734        mLtEmpty->setColumnMinimumWidth(0, 10);
     2735        mLtController->setColumnMinimumWidth(0, 10);
     2736        mLtAttachment->setColumnMinimumWidth(0, 10);
    27372737#if 0
    27382738        /* Second column indent minimum width */
     
    27422742                   << mLbLocation << mLbUsage;
    27432743        int maxWidth = 0;
    2744         QFontMetrics metrics (font());
     2744        QFontMetrics metrics(font());
    27452745        foreach (QLabel *label, labelsList)
    27462746        {
    2747             int width = metrics.width (label->text());
     2747            int width = metrics.width(label->text());
    27482748            maxWidth = width > maxWidth ? width : maxWidth;
    27492749        }
    2750         mLtAttachment->setColumnMinimumWidth (1, maxWidth);
     2750        mLtAttachment->setColumnMinimumWidth(1, maxWidth);
    27512751#endif
    27522752    }
     
    27542754}
    27552755
    2756 void UIMachineSettingsStorage::sltHandleMediumEnumerated(const QString &strMediumID)
     2756void UIMachineSettingsStorage::sltHandleMediumEnumerated(const QString &strMediumId)
    27572757{
    27582758    /* Search for corresponding medium: */
    2759     UIMedium medium = vboxGlobal().medium(strMediumID);
    2760 
    2761     QModelIndex rootIndex = mStorageModel->root();
    2762     for (int i = 0; i < mStorageModel->rowCount(rootIndex); ++i)
    2763     {
    2764         QModelIndex ctrIndex = rootIndex.child(i, 0);
    2765         for (int j = 0; j < mStorageModel->rowCount(ctrIndex); ++j)
    2766         {
    2767             QModelIndex attIndex = ctrIndex.child(j, 0);
    2768             QString attMediumId = mStorageModel->data(attIndex, StorageModel::R_AttMediumId).toString();
     2759    const UIMedium medium = vboxGlobal().medium(strMediumId);
     2760
     2761    const QModelIndex rootIndex = m_pModelStorage->root();
     2762    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
     2763    {
     2764        const QModelIndex ctrIndex = rootIndex.child(i, 0);
     2765        for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j)
     2766        {
     2767            const QModelIndex attIndex = ctrIndex.child(j, 0);
     2768            const QString attMediumId = m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString();
    27692769            if (attMediumId == medium.id())
    27702770            {
    2771                 mStorageModel->setData(attIndex, attMediumId, StorageModel::R_AttMediumId);
     2771                m_pModelStorage->setData(attIndex, attMediumId, StorageModel::R_AttMediumId);
    27722772
    27732773                /* Revalidate: */
     
    27782778}
    27792779
    2780 void UIMachineSettingsStorage::sltHandleMediumDeleted(const QString &strMediumID)
    2781 {
    2782     QModelIndex rootIndex = mStorageModel->root();
    2783     for (int i = 0; i < mStorageModel->rowCount(rootIndex); ++i)
     2780void UIMachineSettingsStorage::sltHandleMediumDeleted(const QString &strMediumId)
     2781{
     2782    QModelIndex rootIndex = m_pModelStorage->root();
     2783    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
    27842784    {
    27852785        QModelIndex ctrIndex = rootIndex.child(i, 0);
    2786         for (int j = 0; j < mStorageModel->rowCount(ctrIndex); ++j)
     2786        for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j)
    27872787        {
    27882788            QModelIndex attIndex = ctrIndex.child(j, 0);
    2789             QString attMediumId = mStorageModel->data(attIndex, StorageModel::R_AttMediumId).toString();
    2790             if (attMediumId == strMediumID)
     2789            QString attMediumId = m_pModelStorage->data(attIndex, StorageModel::R_AttMediumId).toString();
     2790            if (attMediumId == strMediumId)
    27912791            {
    2792                 mStorageModel->setData(attIndex, UIMedium().id(), StorageModel::R_AttMediumId);
     2792                m_pModelStorage->setData(attIndex, UIMedium().id(), StorageModel::R_AttMediumId);
    27932793
    27942794                /* Revalidate: */
     
    27992799}
    28002800
    2801 void UIMachineSettingsStorage::addController()
     2801void UIMachineSettingsStorage::sltAddController()
    28022802{
    28032803    QMenu menu;
    2804     menu.addAction (mAddIDECtrAction);
    2805     menu.addAction (mAddSATACtrAction);
    2806     menu.addAction (mAddSCSICtrAction);
    2807     menu.addAction (mAddSASCtrAction);
    2808     menu.addAction (mAddFloppyCtrAction);
    2809     menu.addAction (mAddUSBCtrAction);
    2810     menu.addAction (mAddNVMeCtrAction);
    2811     menu.exec (QCursor::pos());
    2812 }
    2813 
    2814 void UIMachineSettingsStorage::addIDEController()
    2815 {
    2816     addControllerWrapper (generateUniqueName ("IDE"), KStorageBus_IDE, KStorageControllerType_PIIX4);
    2817 }
    2818 
    2819 void UIMachineSettingsStorage::addSATAController()
    2820 {
    2821     addControllerWrapper (generateUniqueName ("SATA"), KStorageBus_SATA, KStorageControllerType_IntelAhci);
    2822 }
    2823 
    2824 void UIMachineSettingsStorage::addSCSIController()
    2825 {
    2826     addControllerWrapper (generateUniqueName ("SCSI"), KStorageBus_SCSI, KStorageControllerType_LsiLogic);
    2827 }
    2828 
    2829 void UIMachineSettingsStorage::addFloppyController()
    2830 {
    2831     addControllerWrapper (generateUniqueName ("Floppy"), KStorageBus_Floppy, KStorageControllerType_I82078);
    2832 }
    2833 
    2834 void UIMachineSettingsStorage::addSASController()
    2835 {
    2836     addControllerWrapper (generateUniqueName ("SAS"), KStorageBus_SAS, KStorageControllerType_LsiLogicSas);
    2837 }
    2838 
    2839 void UIMachineSettingsStorage::addUSBController()
    2840 {
    2841     addControllerWrapper (generateUniqueName ("USB"), KStorageBus_USB, KStorageControllerType_USB);
    2842 }
    2843 
    2844 void UIMachineSettingsStorage::addNVMeController()
    2845 {
    2846     addControllerWrapper (generateUniqueName ("NVMe"), KStorageBus_PCIe, KStorageControllerType_NVMe);
    2847 }
    2848 
    2849 void UIMachineSettingsStorage::delController()
    2850 {
    2851     QModelIndex index = mTwStorageTree->currentIndex();
    2852     if (!mStorageModel->data (index, StorageModel::R_IsController).toBool())
     2804    menu.addAction(m_pActionAddControllerIDE);
     2805    menu.addAction(m_pActionAddControllerSATA);
     2806    menu.addAction(m_pActionAddControllerSCSI);
     2807    menu.addAction(m_pActionAddControllerSAS);
     2808    menu.addAction(m_pActionAddControllerFloppy);
     2809    menu.addAction(m_pActionAddControllerUSB);
     2810    menu.addAction(m_pActionAddControllerNVMe);
     2811    menu.exec(QCursor::pos());
     2812}
     2813
     2814void UIMachineSettingsStorage::sltAddControllerIDE()
     2815{
     2816    addControllerWrapper(generateUniqueControllerName("IDE"), KStorageBus_IDE, KStorageControllerType_PIIX4);
     2817}
     2818
     2819void UIMachineSettingsStorage::sltAddControllerSATA()
     2820{
     2821    addControllerWrapper(generateUniqueControllerName("SATA"), KStorageBus_SATA, KStorageControllerType_IntelAhci);
     2822}
     2823
     2824void UIMachineSettingsStorage::sltAddControllerSCSI()
     2825{
     2826    addControllerWrapper(generateUniqueControllerName("SCSI"), KStorageBus_SCSI, KStorageControllerType_LsiLogic);
     2827}
     2828
     2829void UIMachineSettingsStorage::sltAddControllerFloppy()
     2830{
     2831    addControllerWrapper(generateUniqueControllerName("Floppy"), KStorageBus_Floppy, KStorageControllerType_I82078);
     2832}
     2833
     2834void UIMachineSettingsStorage::sltAddControllerSAS()
     2835{
     2836    addControllerWrapper(generateUniqueControllerName("SAS"), KStorageBus_SAS, KStorageControllerType_LsiLogicSas);
     2837}
     2838
     2839void UIMachineSettingsStorage::sltAddControllerUSB()
     2840{
     2841    addControllerWrapper(generateUniqueControllerName("USB"), KStorageBus_USB, KStorageControllerType_USB);
     2842}
     2843
     2844void UIMachineSettingsStorage::sltAddControllerNVMe()
     2845{
     2846    addControllerWrapper(generateUniqueControllerName("NVMe"), KStorageBus_PCIe, KStorageControllerType_NVMe);
     2847}
     2848
     2849void UIMachineSettingsStorage::sltRemoveController()
     2850{
     2851    const QModelIndex index = m_pTreeStorage->currentIndex();
     2852    if (!m_pModelStorage->data(index, StorageModel::R_IsController).toBool())
    28532853        return;
    28542854
    2855     mStorageModel->delController (QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()));
    2856     emit storageChanged();
     2855    m_pModelStorage->delController(QUuid(m_pModelStorage->data(index, StorageModel::R_ItemId).toString()));
     2856    emit sigStorageChanged();
    28572857
    28582858    /* Revalidate: */
     
    28602860}
    28612861
    2862 void UIMachineSettingsStorage::addAttachment()
    2863 {
    2864     QModelIndex index = mTwStorageTree->currentIndex();
    2865     Assert (mStorageModel->data (index, StorageModel::R_IsController).toBool());
    2866 
    2867     DeviceTypeList deviceTypeList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
    2868     bool justTrigger = deviceTypeList.size() == 1;
    2869     bool showMenu = deviceTypeList.size() > 1;
     2862void UIMachineSettingsStorage::sltAddAttachment()
     2863{
     2864    const QModelIndex index = m_pTreeStorage->currentIndex();
     2865    Assert(m_pModelStorage->data(index, StorageModel::R_IsController).toBool());
     2866
     2867    const DeviceTypeList deviceTypeList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
     2868    const bool fJustTrigger = deviceTypeList.size() == 1;
     2869    const bool fShowMenu = deviceTypeList.size() > 1;
    28702870    QMenu menu;
    28712871    foreach (const KDeviceType &deviceType, deviceTypeList)
     
    28742874        {
    28752875            case KDeviceType_HardDisk:
    2876                 if (justTrigger)
    2877                     mAddHDAttAction->trigger();
    2878                 if (showMenu)
    2879                     menu.addAction (mAddHDAttAction);
     2876                if (fJustTrigger)
     2877                    m_pActionAddAttachmentHD->trigger();
     2878                if (fShowMenu)
     2879                    menu.addAction(m_pActionAddAttachmentHD);
    28802880                break;
    28812881            case KDeviceType_DVD:
    2882                 if (justTrigger)
    2883                     mAddCDAttAction->trigger();
    2884                 if (showMenu)
    2885                     menu.addAction (mAddCDAttAction);
     2882                if (fJustTrigger)
     2883                    m_pActionAddAttachmentCD->trigger();
     2884                if (fShowMenu)
     2885                    menu.addAction(m_pActionAddAttachmentCD);
    28862886                break;
    28872887            case KDeviceType_Floppy:
    2888                 if (justTrigger)
    2889                     mAddFDAttAction->trigger();
    2890                 if (showMenu)
    2891                     menu.addAction (mAddFDAttAction);
     2888                if (fJustTrigger)
     2889                    m_pActionAddAttachmentFD->trigger();
     2890                if (fShowMenu)
     2891                    menu.addAction(m_pActionAddAttachmentFD);
    28922892                break;
    28932893            default:
     
    28952895        }
    28962896    }
    2897     if (showMenu)
    2898         menu.exec (QCursor::pos());
    2899 }
    2900 
    2901 void UIMachineSettingsStorage::addHDAttachment()
    2902 {
    2903     addAttachmentWrapper (KDeviceType_HardDisk);
    2904 }
    2905 
    2906 void UIMachineSettingsStorage::addCDAttachment()
    2907 {
    2908     addAttachmentWrapper (KDeviceType_DVD);
    2909 }
    2910 
    2911 void UIMachineSettingsStorage::addFDAttachment()
    2912 {
    2913     addAttachmentWrapper (KDeviceType_Floppy);
    2914 }
    2915 
    2916 void UIMachineSettingsStorage::delAttachment()
    2917 {
    2918     QModelIndex index = mTwStorageTree->currentIndex();
    2919 
    2920     KDeviceType device = mStorageModel->data (index, StorageModel::R_AttDevice).value <KDeviceType>();
     2897    if (fShowMenu)
     2898        menu.exec(QCursor::pos());
     2899}
     2900
     2901void UIMachineSettingsStorage::sltAddAttachmentHD()
     2902{
     2903    addAttachmentWrapper(KDeviceType_HardDisk);
     2904}
     2905
     2906void UIMachineSettingsStorage::sltAddAttachmentCD()
     2907{
     2908    addAttachmentWrapper(KDeviceType_DVD);
     2909}
     2910
     2911void UIMachineSettingsStorage::sltAddAttachmentFD()
     2912{
     2913    addAttachmentWrapper(KDeviceType_Floppy);
     2914}
     2915
     2916void UIMachineSettingsStorage::sltRemoveAttachment()
     2917{
     2918    const QModelIndex index = m_pTreeStorage->currentIndex();
     2919
     2920    const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value <KDeviceType>();
    29212921    /* Check if this would be the last DVD. If so let the user confirm this again. */
    2922     if (   device == KDeviceType_DVD
    2923         && deviceCount (KDeviceType_DVD) == 1)
     2922    if (   enmDevice == KDeviceType_DVD
     2923        && deviceCount(KDeviceType_DVD) == 1)
    29242924    {
    29252925        if (!msgCenter().confirmRemovingOfLastDVDDevice(this))
     
    29272927    }
    29282928
    2929     QModelIndex parent = index.parent();
     2929    const QModelIndex parent = index.parent();
    29302930    if (!index.isValid() || !parent.isValid() ||
    2931         !mStorageModel->data (index, StorageModel::R_IsAttachment).toBool() ||
    2932         !mStorageModel->data (parent, StorageModel::R_IsController).toBool())
     2931        !m_pModelStorage->data(index, StorageModel::R_IsAttachment).toBool() ||
     2932        !m_pModelStorage->data(parent, StorageModel::R_IsController).toBool())
    29332933        return;
    29342934
    2935     mStorageModel->delAttachment (QUuid (mStorageModel->data (parent, StorageModel::R_ItemId).toString()),
    2936                                   QUuid (mStorageModel->data (index, StorageModel::R_ItemId).toString()));
    2937     emit storageChanged();
     2935    m_pModelStorage->delAttachment(QUuid(m_pModelStorage->data(parent, StorageModel::R_ItemId).toString()),
     2936                                   QUuid(m_pModelStorage->data(index, StorageModel::R_ItemId).toString()));
     2937    emit sigStorageChanged();
    29382938
    29392939    /* Revalidate: */
     
    29412941}
    29422942
    2943 void UIMachineSettingsStorage::getInformation()
    2944 {
    2945     mIsLoadingInProgress = true;
    2946 
    2947     QModelIndex index = mTwStorageTree->currentIndex();
    2948     if (!index.isValid() || index == mStorageModel->root())
    2949     {
    2950         /* Showing Initial Page */
    2951         mSwRightPane->setCurrentIndex (0);
     2943void UIMachineSettingsStorage::sltGetInformation()
     2944{
     2945    m_fLoadingInProgress = true;
     2946
     2947    const QModelIndex index = m_pTreeStorage->currentIndex();
     2948    if (!index.isValid() || index == m_pModelStorage->root())
     2949    {
     2950        /* Showing Initial Page: */
     2951        mSwRightPane->setCurrentIndex(0);
    29522952    }
    29532953    else
    29542954    {
    2955         switch (mStorageModel->data (index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
     2955        switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
    29562956        {
    29572957            case AbstractItem::Type_ControllerItem:
    29582958            {
    2959                 /* Getting Controller Name */
    2960                 mLeName->setText (mStorageModel->data (index, StorageModel::R_CtrName).toString());
     2959                /* Getting Controller Name: */
     2960                mLeName->setText(m_pModelStorage->data(index, StorageModel::R_CtrName).toString());
    29612961
    29622962                /* Getting Controller Sub type */
    29632963                mCbType->clear();
    2964                 ControllerTypeList controllerTypeList (mStorageModel->data (index, StorageModel::R_CtrTypes).value <ControllerTypeList>());
    2965                 for (int i = 0; i < controllerTypeList.size(); ++ i)
    2966                     mCbType->insertItem (mCbType->count(), gpConverter->toString (controllerTypeList [i]));
    2967                 KStorageControllerType type = mStorageModel->data (index, StorageModel::R_CtrType).value <KStorageControllerType>();
    2968                 int ctrPos = mCbType->findText (gpConverter->toString (type));
    2969                 mCbType->setCurrentIndex (ctrPos == -1 ? 0 : ctrPos);
    2970 
    2971                 KStorageBus bus = mStorageModel->data (index, StorageModel::R_CtrBusType).value <KStorageBus>();
    2972                 mLbPortCount->setVisible (bus == KStorageBus_SATA || bus == KStorageBus_SAS);
    2973                 mSbPortCount->setVisible (bus == KStorageBus_SATA || bus == KStorageBus_SAS);
    2974                 uint uPortCount = mStorageModel->data (index, StorageModel::R_CtrPortCount).toUInt();
    2975                 uint uMaxPortCount = mStorageModel->data (index, StorageModel::R_CtrMaxPortCount).toUInt();
     2964                const ControllerTypeList controllerTypeList(m_pModelStorage->data(index, StorageModel::R_CtrTypes).value <ControllerTypeList>());
     2965                for (int i = 0; i < controllerTypeList.size(); ++i)
     2966                    mCbType->insertItem(mCbType->count(), gpConverter->toString(controllerTypeList[i]));
     2967                const KStorageControllerType enmType = m_pModelStorage->data(index, StorageModel::R_CtrType).value <KStorageControllerType>();
     2968                const int iCtrPos = mCbType->findText(gpConverter->toString(enmType));
     2969                mCbType->setCurrentIndex(iCtrPos == -1 ? 0 : iCtrPos);
     2970
     2971                const KStorageBus enmBus = m_pModelStorage->data(index, StorageModel::R_CtrBusType).value <KStorageBus>();
     2972                mLbPortCount->setVisible(enmBus == KStorageBus_SATA || enmBus == KStorageBus_SAS);
     2973                mSbPortCount->setVisible(enmBus == KStorageBus_SATA || enmBus == KStorageBus_SAS);
     2974                const uint uPortCount = m_pModelStorage->data(index, StorageModel::R_CtrPortCount).toUInt();
     2975                const uint uMaxPortCount = m_pModelStorage->data(index, StorageModel::R_CtrMaxPortCount).toUInt();
    29762976                mSbPortCount->setMaximum(uMaxPortCount);
    2977                 mSbPortCount->setValue (uPortCount);
    2978 
    2979                 bool isUseIoCache = mStorageModel->data (index, StorageModel::R_CtrIoCache).toBool();
    2980                 mCbIoCache->setChecked(isUseIoCache);
     2977                mSbPortCount->setValue(uPortCount);
     2978
     2979                const bool fUseIoCache = m_pModelStorage->data(index, StorageModel::R_CtrIoCache).toBool();
     2980                mCbIoCache->setChecked(fUseIoCache);
    29812981
    29822982                /* Showing Controller Page */
    2983                 mSwRightPane->setCurrentIndex (1);
     2983                mSwRightPane->setCurrentIndex(1);
    29842984                break;
    29852985            }
     
    29882988                /* Getting Attachment Slot */
    29892989                mCbSlot->clear();
    2990                 SlotsList slotsList (mStorageModel->data (index, StorageModel::R_AttSlots).value <SlotsList>());
    2991                 for (int i = 0; i < slotsList.size(); ++ i)
    2992                     mCbSlot->insertItem (mCbSlot->count(), gpConverter->toString (slotsList [i]));
    2993                 StorageSlot slt = mStorageModel->data (index, StorageModel::R_AttSlot).value <StorageSlot>();
    2994                 int attSlotPos = mCbSlot->findText (gpConverter->toString (slt));
    2995                 mCbSlot->setCurrentIndex (attSlotPos == -1 ? 0 : attSlotPos);
    2996                 mCbSlot->setToolTip (mCbSlot->itemText (mCbSlot->currentIndex()));
     2990                const SlotsList slotsList(m_pModelStorage->data(index, StorageModel::R_AttSlots).value <SlotsList>());
     2991                for (int i = 0; i < slotsList.size(); ++i)
     2992                    mCbSlot->insertItem(mCbSlot->count(), gpConverter->toString(slotsList[i]));
     2993                const StorageSlot slt = m_pModelStorage->data(index, StorageModel::R_AttSlot).value <StorageSlot>();
     2994                const int iAttSlotPos = mCbSlot->findText(gpConverter->toString(slt));
     2995                mCbSlot->setCurrentIndex(iAttSlotPos == -1 ? 0 : iAttSlotPos);
     2996                mCbSlot->setToolTip(mCbSlot->itemText(mCbSlot->currentIndex()));
    29972997
    29982998                /* Getting Attachment Medium */
    2999                 KDeviceType device = mStorageModel->data (index, StorageModel::R_AttDevice).value <KDeviceType>();
    3000                 switch (device)
     2999                const KDeviceType enmDevice = m_pModelStorage->data(index, StorageModel::R_AttDevice).value <KDeviceType>();
     3000                switch (enmDevice)
    30013001                {
    30023002                    case KDeviceType_HardDisk:
     
    30253025
    30263026                /* Get hot-pluggable state: */
    3027                 bool fIsHotPluggable = mStorageModel->data(index, StorageModel::R_AttIsHotPluggable).toBool();
     3027                const bool fIsHotPluggable = m_pModelStorage->data(index, StorageModel::R_AttIsHotPluggable).toBool();
    30283028
    30293029                /* Fetch device-type, medium-id: */
    3030                 m_pMediumIdHolder->setType(mediumTypeToLocal(device));
    3031                 m_pMediumIdHolder->setId(mStorageModel->data(index, StorageModel::R_AttMediumId).toString());
     3030                m_pMediumIdHolder->setType(mediumTypeToLocal(enmDevice));
     3031                m_pMediumIdHolder->setId(m_pModelStorage->data(index, StorageModel::R_AttMediumId).toString());
    30323032
    30333033                /* Get/fetch editable state: */
    3034                 bool fIsEditable =    (isMachineOffline())
    3035                                    || (isMachineOnline() && device != KDeviceType_HardDisk)
    3036                                    || (isMachineOnline() && device == KDeviceType_HardDisk && fIsHotPluggable);
     3034                const bool fIsEditable =    (isMachineOffline())
     3035                                         || (isMachineOnline() && enmDevice != KDeviceType_HardDisk)
     3036                                         || (isMachineOnline() && enmDevice == KDeviceType_HardDisk && fIsHotPluggable);
    30373037                mLbMedium->setEnabled(fIsEditable);
    30383038                mTbOpen->setEnabled(fIsEditable);
    30393039
    30403040                /* Getting Passthrough state */
    3041                 bool isHostDrive = mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool();
    3042                 mCbPassthrough->setVisible (device == KDeviceType_DVD && isHostDrive);
    3043                 mCbPassthrough->setChecked (isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsPassthrough).toBool());
     3041                const bool isHostDrive = m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool();
     3042                mCbPassthrough->setVisible(enmDevice == KDeviceType_DVD && isHostDrive);
     3043                mCbPassthrough->setChecked(isHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsPassthrough).toBool());
    30443044
    30453045                /* Getting TempEject state */
    3046                 mCbTempEject->setVisible (device == KDeviceType_DVD && !isHostDrive);
    3047                 mCbTempEject->setChecked (!isHostDrive && mStorageModel->data (index, StorageModel::R_AttIsTempEject).toBool());
     3046                mCbTempEject->setVisible(enmDevice == KDeviceType_DVD && !isHostDrive);
     3047                mCbTempEject->setChecked(!isHostDrive && m_pModelStorage->data(index, StorageModel::R_AttIsTempEject).toBool());
    30483048
    30493049                /* Getting NonRotational state */
    3050                 mCbNonRotational->setVisible (device == KDeviceType_HardDisk);
    3051                 mCbNonRotational->setChecked (mStorageModel->data (index, StorageModel::R_AttIsNonRotational).toBool());
     3050                mCbNonRotational->setVisible(enmDevice == KDeviceType_HardDisk);
     3051                mCbNonRotational->setChecked(m_pModelStorage->data(index, StorageModel::R_AttIsNonRotational).toBool());
    30523052
    30533053                /* Fetch hot-pluggable state: */
     
    30563056
    30573057                /* Update optional widgets visibility */
    3058                 updateAdditionalObjects (device);
     3058                updateAdditionalDetails(enmDevice);
    30593059
    30603060                /* Getting Other Information */
    3061                 mLbHDFormatValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttFormat).toString()));
    3062                 mLbCDFDTypeValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttFormat).toString()));
    3063                 mLbHDVirtualSizeValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttLogicalSize).toString()));
    3064                 mLbHDActualSizeValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttSize).toString()));
    3065                 mLbSizeValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttSize).toString()));
    3066                 mLbHDDetailsValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttDetails).toString()));
    3067                 mLbLocationValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttLocation).toString()));
    3068                 mLbUsageValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttUsage).toString()));
    3069                 m_pLabelEncryptionValue->setText(compressText(mStorageModel->data(index, StorageModel::R_AttEncryptionPasswordID).toString()));
     3061                mLbHDFormatValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString()));
     3062                mLbCDFDTypeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttFormat).toString()));
     3063                mLbHDVirtualSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLogicalSize).toString()));
     3064                mLbHDActualSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString()));
     3065                mLbSizeValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttSize).toString()));
     3066                mLbHDDetailsValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttDetails).toString()));
     3067                mLbLocationValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttLocation).toString()));
     3068                mLbUsageValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttUsage).toString()));
     3069                m_pLabelEncryptionValue->setText(compressText(m_pModelStorage->data(index, StorageModel::R_AttEncryptionPasswordID).toString()));
    30703070
    30713071                /* Showing Attachment Page */
    3072                 mSwRightPane->setCurrentIndex (2);
     3072                mSwRightPane->setCurrentIndex(2);
    30733073                break;
    30743074            }
     
    30813081    revalidate();
    30823082
    3083     mIsLoadingInProgress = false;
    3084 }
    3085 
    3086 void UIMachineSettingsStorage::setInformation()
    3087 {
    3088     QModelIndex index = mTwStorageTree->currentIndex();
    3089     if (mIsLoadingInProgress || !index.isValid() || index == mStorageModel->root())
     3083    m_fLoadingInProgress = false;
     3084}
     3085
     3086void UIMachineSettingsStorage::sltSetInformation()
     3087{
     3088    const QModelIndex index = m_pTreeStorage->currentIndex();
     3089    if (m_fLoadingInProgress || !index.isValid() || index == m_pModelStorage->root())
    30903090        return;
    30913091
    3092     QObject *sdr = sender();
    3093     switch (mStorageModel->data (index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
     3092    QObject *pSdr = sender();
     3093    switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
    30943094    {
    30953095        case AbstractItem::Type_ControllerItem:
    30963096        {
    3097             /* Setting Controller Name */
    3098             if (sdr == mLeName)
    3099                 mStorageModel->setData (index, mLeName->text(), StorageModel::R_CtrName);
    3100             /* Setting Controller Sub-Type */
    3101             else if (sdr == mCbType)
    3102                 mStorageModel->setData (index, QVariant::fromValue (gpConverter->fromString<KStorageControllerType> (mCbType->currentText())),
     3097            /* Setting Controller Name: */
     3098            if (pSdr == mLeName)
     3099                m_pModelStorage->setData(index, mLeName->text(), StorageModel::R_CtrName);
     3100            /* Setting Controller Sub-Type: */
     3101            else if (pSdr == mCbType)
     3102                m_pModelStorage->setData(index, QVariant::fromValue(gpConverter->fromString<KStorageControllerType>(mCbType->currentText())),
    31033103                                        StorageModel::R_CtrType);
    3104             else if (sdr == mSbPortCount)
    3105                 mStorageModel->setData (index, mSbPortCount->value(), StorageModel::R_CtrPortCount);
    3106             else if (sdr == mCbIoCache)
    3107                 mStorageModel->setData (index, mCbIoCache->isChecked(), StorageModel::R_CtrIoCache);
     3104            else if (pSdr == mSbPortCount)
     3105                m_pModelStorage->setData(index, mSbPortCount->value(), StorageModel::R_CtrPortCount);
     3106            else if (pSdr == mCbIoCache)
     3107                m_pModelStorage->setData(index, mCbIoCache->isChecked(), StorageModel::R_CtrIoCache);
    31083108            break;
    31093109        }
    31103110        case AbstractItem::Type_AttachmentItem:
    31113111        {
    3112             /* Setting Attachment Slot */
    3113             if (sdr == mCbSlot)
     3112            /* Setting Attachment Slot: */
     3113            if (pSdr == mCbSlot)
    31143114            {
    3115                 QModelIndex controllerIndex = mStorageModel->parent(index);
     3115                QModelIndex controllerIndex = m_pModelStorage->parent(index);
    31163116                StorageSlot attachmentStorageSlot = gpConverter->fromString<StorageSlot>(mCbSlot->currentText());
    3117                 mStorageModel->setData(index, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
    3118                 QModelIndex theSameIndexAtNewPosition = mStorageModel->attachmentBySlot(controllerIndex, attachmentStorageSlot);
     3117                m_pModelStorage->setData(index, QVariant::fromValue(attachmentStorageSlot), StorageModel::R_AttSlot);
     3118                QModelIndex theSameIndexAtNewPosition = m_pModelStorage->attachmentBySlot(controllerIndex, attachmentStorageSlot);
    31193119                AssertMsg(theSameIndexAtNewPosition.isValid(), ("Current attachment disappears!\n"));
    3120                 mTwStorageTree->setCurrentIndex(theSameIndexAtNewPosition);
     3120                m_pTreeStorage->setCurrentIndex(theSameIndexAtNewPosition);
    31213121            }
    31223122            /* Setting Attachment Medium */
    3123             else if (sdr == m_pMediumIdHolder)
    3124                 mStorageModel->setData (index, m_pMediumIdHolder->id(), StorageModel::R_AttMediumId);
    3125             else if (sdr == mCbPassthrough)
     3123            else if (pSdr == m_pMediumIdHolder)
     3124                m_pModelStorage->setData(index, m_pMediumIdHolder->id(), StorageModel::R_AttMediumId);
     3125            else if (pSdr == mCbPassthrough)
    31263126            {
    3127                 if (mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool())
    3128                     mStorageModel->setData (index, mCbPassthrough->isChecked(), StorageModel::R_AttIsPassthrough);
     3127                if (m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool())
     3128                    m_pModelStorage->setData(index, mCbPassthrough->isChecked(), StorageModel::R_AttIsPassthrough);
    31293129            }
    3130             else if (sdr == mCbTempEject)
     3130            else if (pSdr == mCbTempEject)
    31313131            {
    3132                 if (!mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool())
    3133                     mStorageModel->setData (index, mCbTempEject->isChecked(), StorageModel::R_AttIsTempEject);
     3132                if (!m_pModelStorage->data(index, StorageModel::R_AttIsHostDrive).toBool())
     3133                    m_pModelStorage->setData(index, mCbTempEject->isChecked(), StorageModel::R_AttIsTempEject);
    31343134            }
    3135             else if (sdr == mCbNonRotational)
     3135            else if (pSdr == mCbNonRotational)
    31363136            {
    3137                 mStorageModel->setData (index, mCbNonRotational->isChecked(), StorageModel::R_AttIsNonRotational);
     3137                m_pModelStorage->setData(index, mCbNonRotational->isChecked(), StorageModel::R_AttIsNonRotational);
    31383138            }
    3139             else if (sdr == m_pCheckBoxHotPluggable)
     3139            else if (pSdr == m_pCheckBoxHotPluggable)
    31403140            {
    3141                 mStorageModel->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable);
     3141                m_pModelStorage->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable);
    31423142            }
    31433143            break;
     
    31473147    }
    31483148
    3149     emit storageChanged();
    3150     getInformation();
     3149    emit sigStorageChanged();
     3150    sltGetInformation();
    31513151}
    31523152
     
    32153215void UIMachineSettingsStorage::sltCreateNewHardDisk()
    32163216{
    3217     QString strMediumId = getWithNewHDWizard();
     3217    const QString strMediumId = getWithNewHDWizard();
    32183218    if (!strMediumId.isNull())
    32193219        m_pMediumIdHolder->setId(strMediumId);
     
    32273227void UIMachineSettingsStorage::sltChooseExistingMedium()
    32283228{
    3229     QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());
    3230     QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(m_pMediumIdHolder->type(), this, strMachineFolder);
     3229    const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());
     3230    const QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(m_pMediumIdHolder->type(), this, strMachineFolder);
    32313231    if (!strMediumId.isNull())
    32323232        m_pMediumIdHolder->setId(strMediumId);
     
    32503250    {
    32513251        /* Get recent medium type & name: */
    3252         QStringList mediumInfoList = pChooseRecentMediumAction->data().toString().split(',');
    3253         UIMediumType mediumType = (UIMediumType)mediumInfoList[0].toUInt();
    3254         QString strMediumLocation = mediumInfoList[1];
    3255         QString strMediumId = vboxGlobal().openMedium(mediumType, strMediumLocation, this);
     3252        const QStringList mediumInfoList = pChooseRecentMediumAction->data().toString().split(',');
     3253        const UIMediumType enmMediumType = (UIMediumType)mediumInfoList[0].toUInt();
     3254        const QString strMediumLocation = mediumInfoList[1];
     3255        const QString strMediumId = vboxGlobal().openMedium(enmMediumType, strMediumLocation, this);
    32563256        if (!strMediumId.isNull())
    32573257            m_pMediumIdHolder->setId(strMediumId);
     
    32593259}
    32603260
    3261 void UIMachineSettingsStorage::updateActionsState()
    3262 {
    3263     QModelIndex index = mTwStorageTree->currentIndex();
    3264 
    3265     bool isIDEPossible = mStorageModel->data (index, StorageModel::R_IsMoreIDEControllersPossible).toBool();
    3266     bool isSATAPossible = mStorageModel->data (index, StorageModel::R_IsMoreSATAControllersPossible).toBool();
    3267     bool isSCSIPossible = mStorageModel->data (index, StorageModel::R_IsMoreSCSIControllersPossible).toBool();
    3268     bool isFloppyPossible = mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool();
    3269     bool isSASPossible = mStorageModel->data (index, StorageModel::R_IsMoreSASControllersPossible).toBool();
    3270     bool isUSBPossible = mStorageModel->data (index, StorageModel::R_IsMoreUSBControllersPossible).toBool();
    3271     bool isNVMePossible = mStorageModel->data (index, StorageModel::R_IsMoreNVMeControllersPossible).toBool();
    3272 
    3273     bool isController = mStorageModel->data (index, StorageModel::R_IsController).toBool();
    3274     bool isAttachment = mStorageModel->data (index, StorageModel::R_IsAttachment).toBool();
    3275     bool isAttachmentsPossible = mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
    3276     bool fIsAttachmentHotPluggable = mStorageModel->data(index, StorageModel::R_AttIsHotPluggable).toBool();
     3261void UIMachineSettingsStorage::sltUpdateActionsState()
     3262{
     3263    const QModelIndex index = m_pTreeStorage->currentIndex();
     3264
     3265    const bool fIDEPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool();
     3266    const bool fSATAPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool();
     3267    const bool fSCSIPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool();
     3268    const bool fFloppyPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool();
     3269    const bool fSASPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool();
     3270    const bool fUSBPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool();
     3271    const bool fNVMePossible = m_pModelStorage->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool();
     3272
     3273    const bool fController = m_pModelStorage->data(index, StorageModel::R_IsController).toBool();
     3274    const bool fAttachment = m_pModelStorage->data(index, StorageModel::R_IsAttachment).toBool();
     3275    const bool fAttachmentsPossible = m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
     3276    const bool fIsAttachmentHotPluggable = m_pModelStorage->data(index, StorageModel::R_AttIsHotPluggable).toBool();
    32773277
    32783278    /* Configure "add controller" actions: */
    3279     mAddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible || isSASPossible || isUSBPossible || isNVMePossible);
    3280     mAddIDECtrAction->setEnabled (isIDEPossible);
    3281     mAddSATACtrAction->setEnabled (isSATAPossible);
    3282     mAddSCSICtrAction->setEnabled (isSCSIPossible);
    3283     mAddFloppyCtrAction->setEnabled (isFloppyPossible);
    3284     mAddSASCtrAction->setEnabled (isSASPossible);
    3285     mAddUSBCtrAction->setEnabled (isUSBPossible);
    3286     mAddNVMeCtrAction->setEnabled (isNVMePossible);
     3279    m_pActionAddController->setEnabled(fIDEPossible || fSATAPossible || fSCSIPossible || fFloppyPossible || fSASPossible || fUSBPossible || fNVMePossible);
     3280    m_pActionAddControllerIDE->setEnabled(fIDEPossible);
     3281    m_pActionAddControllerSATA->setEnabled(fSATAPossible);
     3282    m_pActionAddControllerSCSI->setEnabled(fSCSIPossible);
     3283    m_pActionAddControllerFloppy->setEnabled(fFloppyPossible);
     3284    m_pActionAddControllerSAS->setEnabled(fSASPossible);
     3285    m_pActionAddControllerUSB->setEnabled(fUSBPossible);
     3286    m_pActionAddControllerNVMe->setEnabled(fNVMePossible);
    32873287
    32883288    /* Configure "add attachment" actions: */
    3289     mAddAttAction->setEnabled (isController && isAttachmentsPossible);
    3290     mAddHDAttAction->setEnabled (isController && isAttachmentsPossible);
    3291     mAddCDAttAction->setEnabled (isController && isAttachmentsPossible);
    3292     mAddFDAttAction->setEnabled (isController && isAttachmentsPossible);
     3289    m_pActionAddAttachment->setEnabled(fController && fAttachmentsPossible);
     3290    m_pActionAddAttachmentHD->setEnabled(fController && fAttachmentsPossible);
     3291    m_pActionAddAttachmentCD->setEnabled(fController && fAttachmentsPossible);
     3292    m_pActionAddAttachmentFD->setEnabled(fController && fAttachmentsPossible);
    32933293
    32943294    /* Configure "delete controller" action: */
    3295     bool fControllerInSuitableState = isMachineOffline();
    3296     mDelCtrAction->setEnabled(isController && fControllerInSuitableState);
     3295    const bool fControllerInSuitableState = isMachineOffline();
     3296    m_pActionRemoveController->setEnabled(fController && fControllerInSuitableState);
    32973297
    32983298    /* Configure "delete attachment" action: */
    3299     bool fAttachmentInSuitableState = isMachineOffline() ||
    3300                                       (isMachineOnline() && fIsAttachmentHotPluggable);
    3301     mDelAttAction->setEnabled(isAttachment && fAttachmentInSuitableState);
    3302 }
    3303 
    3304 void UIMachineSettingsStorage::onRowInserted (const QModelIndex &aParent, int aPosition)
    3305 {
    3306     QModelIndex index = mStorageModel->index (aPosition, 0, aParent);
    3307 
    3308     switch (mStorageModel->data (index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
     3299    const bool fAttachmentInSuitableState = isMachineOffline() ||
     3300                                            (isMachineOnline() && fIsAttachmentHotPluggable);
     3301    m_pActionRemoveAttachment->setEnabled(fAttachment && fAttachmentInSuitableState);
     3302}
     3303
     3304void UIMachineSettingsStorage::sltHandleRowInsertion(const QModelIndex &parent, int iPosition)
     3305{
     3306    const QModelIndex index = m_pModelStorage->index(iPosition, 0, parent);
     3307
     3308    switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
    33093309    {
    33103310        case AbstractItem::Type_ControllerItem:
    33113311        {
    3312             /* Select the newly created Controller Item */
    3313             mTwStorageTree->setCurrentIndex (index);
     3312            /* Select the newly created Controller Item: */
     3313            m_pTreeStorage->setCurrentIndex(index);
    33143314            break;
    33153315        }
    33163316        case AbstractItem::Type_AttachmentItem:
    33173317        {
    3318             /* Expand parent if it is not expanded yet */
    3319             if (!mTwStorageTree->isExpanded (aParent))
    3320                 mTwStorageTree->setExpanded (aParent, true);
     3318            /* Expand parent if it is not expanded yet: */
     3319            if (!m_pTreeStorage->isExpanded(parent))
     3320                m_pTreeStorage->setExpanded(parent, true);
    33213321            break;
    33223322        }
     
    33253325    }
    33263326
    3327     updateActionsState();
    3328     getInformation();
    3329 }
    3330 
    3331 void UIMachineSettingsStorage::onRowRemoved()
    3332 {
    3333     if (mStorageModel->rowCount (mStorageModel->root()) == 0)
    3334         mTwStorageTree->setCurrentIndex (mStorageModel->root());
    3335 
    3336     updateActionsState();
    3337     getInformation();
    3338 }
    3339 
    3340 void UIMachineSettingsStorage::onCurrentItemChanged()
    3341 {
    3342     updateActionsState();
    3343     getInformation();
    3344 }
    3345 
    3346 void UIMachineSettingsStorage::onContextMenuRequested (const QPoint &aPosition)
    3347 {
    3348     QModelIndex index = mTwStorageTree->indexAt (aPosition);
    3349     if (!index.isValid()) return addController();
     3327    sltUpdateActionsState();
     3328    sltGetInformation();
     3329}
     3330
     3331void UIMachineSettingsStorage::sltHandleRowRemoval()
     3332{
     3333    if (m_pModelStorage->rowCount (m_pModelStorage->root()) == 0)
     3334        m_pTreeStorage->setCurrentIndex (m_pModelStorage->root());
     3335
     3336    sltUpdateActionsState();
     3337    sltGetInformation();
     3338}
     3339
     3340void UIMachineSettingsStorage::sltHandleCurrentItemChange()
     3341{
     3342    sltUpdateActionsState();
     3343    sltGetInformation();
     3344}
     3345
     3346void UIMachineSettingsStorage::sltHandleContextMenuRequest(const QPoint &position)
     3347{
     3348    const QModelIndex index = m_pTreeStorage->indexAt(position);
     3349    if (!index.isValid())
     3350        return sltAddController();
    33503351
    33513352    QMenu menu;
    3352     switch (mStorageModel->data (index, StorageModel::R_ItemType).value <AbstractItem::ItemType>())
     3353    switch (m_pModelStorage->data(index, StorageModel::R_ItemType).value<AbstractItem::ItemType>())
    33533354    {
    33543355        case AbstractItem::Type_ControllerItem:
    33553356        {
    3356             DeviceTypeList deviceTypeList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
     3357            const DeviceTypeList deviceTypeList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
    33573358            foreach (KDeviceType deviceType, deviceTypeList)
    33583359            {
     
    33603361                {
    33613362                    case KDeviceType_HardDisk:
    3362                         menu.addAction (mAddHDAttAction);
     3363                        menu.addAction(m_pActionAddAttachmentHD);
    33633364                        break;
    33643365                    case KDeviceType_DVD:
    3365                         menu.addAction (mAddCDAttAction);
     3366                        menu.addAction(m_pActionAddAttachmentCD);
    33663367                        break;
    33673368                    case KDeviceType_Floppy:
    3368                         menu.addAction (mAddFDAttAction);
     3369                        menu.addAction(m_pActionAddAttachmentFD);
    33693370                        break;
    33703371                    default:
     
    33723373                }
    33733374            }
    3374             menu.addAction (mDelCtrAction);
     3375            menu.addAction(m_pActionRemoveController);
    33753376            break;
    33763377        }
    33773378        case AbstractItem::Type_AttachmentItem:
    33783379        {
    3379             menu.addAction (mDelAttAction);
     3380            menu.addAction(m_pActionRemoveAttachment);
    33803381            break;
    33813382        }
     
    33843385    }
    33853386    if (!menu.isEmpty())
    3386         menu.exec (mTwStorageTree->viewport()->mapToGlobal (aPosition));
    3387 }
    3388 
    3389 void UIMachineSettingsStorage::onDrawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex)
    3390 {
    3391     if (!aIndex.parent().isValid() || !aIndex.parent().parent().isValid())
     3387        menu.exec(m_pTreeStorage->viewport()->mapToGlobal(position));
     3388}
     3389
     3390void UIMachineSettingsStorage::sltHandleDrawItemBranches(QPainter *pPainter, const QRect &rect, const QModelIndex &index)
     3391{
     3392    if (!index.parent().isValid() || !index.parent().parent().isValid())
    33923393        return;
    33933394
    3394     aPainter->save();
     3395    pPainter->save();
    33953396    QStyleOption options;
    3396     options.initFrom (mTwStorageTree);
    3397     options.rect = aRect;
     3397    options.initFrom(m_pTreeStorage);
     3398    options.rect = rect;
    33983399    options.state |= QStyle::State_Item;
    3399     if (aIndex.row() < mStorageModel->rowCount (aIndex.parent()) - 1)
     3400    if (index.row() < m_pModelStorage->rowCount(index.parent()) - 1)
    34003401        options.state |= QStyle::State_Sibling;
    34013402    /* This pen is commonly used by different
    34023403     * look and feel styles to paint tree-view branches. */
    3403     QPen pen (QBrush (options.palette.dark().color(), Qt::Dense4Pattern), 0);
    3404     aPainter->setPen (pen);
     3404    const QPen pen(QBrush(options.palette.dark().color(), Qt::Dense4Pattern), 0);
     3405    pPainter->setPen(pen);
    34053406    /* If we want tree-view branches to be always painted we have to use QCommonStyle::drawPrimitive()
    34063407     * because QCommonStyle performs branch painting as opposed to particular inherited sub-classing styles. */
    3407     qobject_cast <QCommonStyle*> (style())->QCommonStyle::drawPrimitive (QStyle::PE_IndicatorBranch, &options, aPainter);
    3408     aPainter->restore();
    3409 }
    3410 
    3411 void UIMachineSettingsStorage::onMouseMoved (QMouseEvent *aEvent)
    3412 {
    3413     QModelIndex index = mTwStorageTree->indexAt (aEvent->pos());
    3414     QRect indexRect = mTwStorageTree->visualRect (index);
     3408    qobject_cast<QCommonStyle*>(style())->QCommonStyle::drawPrimitive(QStyle::PE_IndicatorBranch, &options, pPainter);
     3409    pPainter->restore();
     3410}
     3411
     3412void UIMachineSettingsStorage::sltHandleMouseMove(QMouseEvent *pEvent)
     3413{
     3414    const QModelIndex index = m_pTreeStorage->indexAt(pEvent->pos());
     3415    const QRect indexRect = m_pTreeStorage->visualRect(index);
    34153416
    34163417    /* Expander tool-tip */
    3417     if (mStorageModel->data (index, StorageModel::R_IsController).toBool())
    3418     {
    3419         QRect expanderRect = mStorageModel->data (index, StorageModel::R_ItemPixmapRect).toRect();
    3420         expanderRect.translate (indexRect.x(), indexRect.y());
    3421         if (expanderRect.contains (aEvent->pos()))
    3422         {
    3423             aEvent->setAccepted (true);
    3424             if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::ExpanderToolTip)
    3425                 mStorageModel->setData (index, QVariant::fromValue (StorageModel::ExpanderToolTip), StorageModel::R_ToolTipType);
     3418    if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool())
     3419    {
     3420        QRect expanderRect = m_pModelStorage->data(index, StorageModel::R_ItemPixmapRect).toRect();
     3421        expanderRect.translate(indexRect.x(), indexRect.y());
     3422        if (expanderRect.contains(pEvent->pos()))
     3423        {
     3424            pEvent->setAccepted(true);
     3425            if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::ExpanderToolTip)
     3426                m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::ExpanderToolTip), StorageModel::R_ToolTipType);
    34263427            return;
    34273428        }
     
    34293430
    34303431    /* Adder tool-tip */
    3431     if (mStorageModel->data (index, StorageModel::R_IsController).toBool() &&
    3432         mTwStorageTree->currentIndex() == index)
    3433     {
    3434         DeviceTypeList devicesList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
     3432    if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool() &&
     3433        m_pTreeStorage->currentIndex() == index)
     3434    {
     3435        const DeviceTypeList devicesList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value<DeviceTypeList>());
    34353436        for (int i = 0; i < devicesList.size(); ++ i)
    34363437        {
    3437             KDeviceType deviceType = devicesList [i];
     3438            const KDeviceType enmDeviceType = devicesList[i];
    34383439
    34393440            QRect deviceRect;
    3440             switch (deviceType)
     3441            switch (enmDeviceType)
    34413442            {
    34423443                case KDeviceType_HardDisk:
    34433444                {
    3444                     deviceRect = mStorageModel->data (index, StorageModel::R_HDPixmapRect).toRect();
     3445                    deviceRect = m_pModelStorage->data(index, StorageModel::R_HDPixmapRect).toRect();
    34453446                    break;
    34463447                }
    34473448                case KDeviceType_DVD:
    34483449                {
    3449                     deviceRect = mStorageModel->data (index, StorageModel::R_CDPixmapRect).toRect();
     3450                    deviceRect = m_pModelStorage->data (index, StorageModel::R_CDPixmapRect).toRect();
    34503451                    break;
    34513452                }
    34523453                case KDeviceType_Floppy:
    34533454                {
    3454                     deviceRect = mStorageModel->data (index, StorageModel::R_FDPixmapRect).toRect();
     3455                    deviceRect = m_pModelStorage->data (index, StorageModel::R_FDPixmapRect).toRect();
    34553456                    break;
    34563457                }
     
    34583459                    break;
    34593460            }
    3460             deviceRect.translate (indexRect.x() + indexRect.width(), indexRect.y());
    3461 
    3462             if (deviceRect.contains (aEvent->pos()))
     3461            deviceRect.translate(indexRect.x() + indexRect.width(), indexRect.y());
     3462
     3463            if (deviceRect.contains(pEvent->pos()))
    34633464            {
    3464                 aEvent->setAccepted (true);
    3465                 switch (deviceType)
     3465                pEvent->setAccepted(true);
     3466                switch (enmDeviceType)
    34663467                {
    34673468                    case KDeviceType_HardDisk:
    34683469                    {
    3469                         if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::HDAdderToolTip)
    3470                             mStorageModel->setData (index, QVariant::fromValue (StorageModel::HDAdderToolTip), StorageModel::R_ToolTipType);
     3470                        if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::HDAdderToolTip)
     3471                            m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::HDAdderToolTip), StorageModel::R_ToolTipType);
    34713472                        break;
    34723473                    }
    34733474                    case KDeviceType_DVD:
    34743475                    {
    3475                         if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::CDAdderToolTip)
    3476                             mStorageModel->setData (index, QVariant::fromValue (StorageModel::CDAdderToolTip), StorageModel::R_ToolTipType);
     3476                        if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::CDAdderToolTip)
     3477                            m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::CDAdderToolTip), StorageModel::R_ToolTipType);
    34773478                        break;
    34783479                    }
    34793480                    case KDeviceType_Floppy:
    34803481                    {
    3481                         if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::FDAdderToolTip)
    3482                             mStorageModel->setData (index, QVariant::fromValue (StorageModel::FDAdderToolTip), StorageModel::R_ToolTipType);
     3482                        if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::FDAdderToolTip)
     3483                            m_pModelStorage->setData(index, QVariant::fromValue(StorageModel::FDAdderToolTip), StorageModel::R_ToolTipType);
    34833484                        break;
    34843485                    }
     
    34923493
    34933494    /* Default tool-tip */
    3494     if (mStorageModel->data (index, StorageModel::R_ToolTipType).value <StorageModel::ToolTipType>() != StorageModel::DefaultToolTip)
    3495         mStorageModel->setData (index, StorageModel::DefaultToolTip, StorageModel::R_ToolTipType);
    3496 }
    3497 
    3498 void UIMachineSettingsStorage::onMouseClicked (QMouseEvent *aEvent)
    3499 {
    3500     QModelIndex index = mTwStorageTree->indexAt (aEvent->pos());
    3501     QRect indexRect = mTwStorageTree->visualRect (index);
     3495    if (m_pModelStorage->data(index, StorageModel::R_ToolTipType).value<StorageModel::ToolTipType>() != StorageModel::DefaultToolTip)
     3496        m_pModelStorage->setData(index, StorageModel::DefaultToolTip, StorageModel::R_ToolTipType);
     3497}
     3498
     3499void UIMachineSettingsStorage::sltHandleMouseClick(QMouseEvent *pEvent)
     3500{
     3501    const QModelIndex index = m_pTreeStorage->indexAt(pEvent->pos());
     3502    const QRect indexRect = m_pTreeStorage->visualRect(index);
    35023503
    35033504    /* Expander icon */
    3504     if (mStorageModel->data (index, StorageModel::R_IsController).toBool())
    3505     {
    3506         QRect expanderRect = mStorageModel->data (index, StorageModel::R_ItemPixmapRect).toRect();
    3507         expanderRect.translate (indexRect.x(), indexRect.y());
    3508         if (expanderRect.contains (aEvent->pos()))
    3509         {
    3510             aEvent->setAccepted (true);
    3511             mTwStorageTree->setExpanded (index, !mTwStorageTree->isExpanded (index));
     3505    if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool())
     3506    {
     3507        QRect expanderRect = m_pModelStorage->data(index, StorageModel::R_ItemPixmapRect).toRect();
     3508        expanderRect.translate(indexRect.x(), indexRect.y());
     3509        if (expanderRect.contains(pEvent->pos()))
     3510        {
     3511            pEvent->setAccepted(true);
     3512            m_pTreeStorage->setExpanded(index, !m_pTreeStorage->isExpanded(index));
    35123513            return;
    35133514        }
     
    35153516
    35163517    /* Adder icons */
    3517     if (mStorageModel->data (index, StorageModel::R_IsController).toBool() &&
    3518         mTwStorageTree->currentIndex() == index)
    3519     {
    3520         DeviceTypeList devicesList (mStorageModel->data (index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
     3518    if (m_pModelStorage->data(index, StorageModel::R_IsController).toBool() &&
     3519        m_pTreeStorage->currentIndex() == index)
     3520    {
     3521        const DeviceTypeList devicesList(m_pModelStorage->data(index, StorageModel::R_CtrDevices).value <DeviceTypeList>());
    35213522        for (int i = 0; i < devicesList.size(); ++ i)
    35223523        {
    3523             KDeviceType deviceType = devicesList [i];
     3524            const KDeviceType enmDeviceType = devicesList[i];
    35243525
    35253526            QRect deviceRect;
    3526             switch (deviceType)
     3527            switch (enmDeviceType)
    35273528            {
    35283529                case KDeviceType_HardDisk:
    35293530                {
    3530                     deviceRect = mStorageModel->data (index, StorageModel::R_HDPixmapRect).toRect();
     3531                    deviceRect = m_pModelStorage->data(index, StorageModel::R_HDPixmapRect).toRect();
    35313532                    break;
    35323533                }
    35333534                case KDeviceType_DVD:
    35343535                {
    3535                     deviceRect = mStorageModel->data (index, StorageModel::R_CDPixmapRect).toRect();
     3536                    deviceRect = m_pModelStorage->data (index, StorageModel::R_CDPixmapRect).toRect();
    35363537                    break;
    35373538                }
    35383539                case KDeviceType_Floppy:
    35393540                {
    3540                     deviceRect = mStorageModel->data (index, StorageModel::R_FDPixmapRect).toRect();
     3541                    deviceRect = m_pModelStorage->data (index, StorageModel::R_FDPixmapRect).toRect();
    35413542                    break;
    35423543                }
     
    35443545                    break;
    35453546            }
    3546             deviceRect.translate (indexRect.x() + indexRect.width(), indexRect.y());
    3547 
    3548             if (deviceRect.contains (aEvent->pos()))
     3547            deviceRect.translate(indexRect.x() + indexRect.width(), indexRect.y());
     3548
     3549            if (deviceRect.contains(pEvent->pos()))
    35493550            {
    3550                 aEvent->setAccepted (true);
    3551                 if (mAddAttAction->isEnabled())
    3552                     addAttachmentWrapper (deviceType);
     3551                pEvent->setAccepted(true);
     3552                if (m_pActionAddAttachment->isEnabled())
     3553                    addAttachmentWrapper(enmDeviceType);
    35533554                return;
    35543555            }
     
    35573558}
    35583559
    3559 void UIMachineSettingsStorage::addControllerWrapper (const QString &aName, KStorageBus aBus, KStorageControllerType aType)
     3560void UIMachineSettingsStorage::addControllerWrapper(const QString &strName, KStorageBus enmBus, KStorageControllerType enmType)
    35603561{
    35613562#ifdef RT_STRICT
    3562     QModelIndex index = mTwStorageTree->currentIndex();
    3563     switch (aBus)
     3563    const QModelIndex index = m_pTreeStorage->currentIndex();
     3564    switch (enmBus)
    35643565    {
    35653566        case KStorageBus_IDE:
    3566             Assert (mStorageModel->data (index, StorageModel::R_IsMoreIDEControllersPossible).toBool());
     3567            Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreIDEControllersPossible).toBool());
    35673568            break;
    35683569        case KStorageBus_SATA:
    3569             Assert (mStorageModel->data (index, StorageModel::R_IsMoreSATAControllersPossible).toBool());
     3570            Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSATAControllersPossible).toBool());
    35703571            break;
    35713572        case KStorageBus_SCSI:
    3572             Assert (mStorageModel->data (index, StorageModel::R_IsMoreSCSIControllersPossible).toBool());
     3573            Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSCSIControllersPossible).toBool());
    35733574            break;
    35743575        case KStorageBus_SAS:
    3575             Assert (mStorageModel->data (index, StorageModel::R_IsMoreSASControllersPossible).toBool());
     3576            Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreSASControllersPossible).toBool());
    35763577            break;
    35773578        case KStorageBus_Floppy:
    3578             Assert (mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool());
     3579            Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreFloppyControllersPossible).toBool());
    35793580            break;
    35803581        case KStorageBus_USB:
    3581             Assert (mStorageModel->data (index, StorageModel::R_IsMoreUSBControllersPossible).toBool());
     3582            Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreUSBControllersPossible).toBool());
    35823583            break;
    35833584        case KStorageBus_PCIe:
    3584             Assert (mStorageModel->data (index, StorageModel::R_IsMoreNVMeControllersPossible).toBool());
     3585            Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreNVMeControllersPossible).toBool());
    35853586            break;
    35863587        default:
     
    35893590#endif
    35903591
    3591     mStorageModel->addController (aName, aBus, aType);
    3592     emit storageChanged();
    3593 }
    3594 
    3595 void UIMachineSettingsStorage::addAttachmentWrapper(KDeviceType deviceType)
    3596 {
    3597     QModelIndex index = mTwStorageTree->currentIndex();
    3598     Assert(mStorageModel->data(index, StorageModel::R_IsController).toBool());
    3599     Assert(mStorageModel->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool());
    3600     QString strControllerName(mStorageModel->data(index, StorageModel::R_CtrName).toString());
    3601     QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());
     3592    m_pModelStorage->addController(strName, enmBus, enmType);
     3593    emit sigStorageChanged();
     3594}
     3595
     3596void UIMachineSettingsStorage::addAttachmentWrapper(KDeviceType enmDevice)
     3597{
     3598    const QModelIndex index = m_pTreeStorage->currentIndex();
     3599    Assert(m_pModelStorage->data(index, StorageModel::R_IsController).toBool());
     3600    Assert(m_pModelStorage->data(index, StorageModel::R_IsMoreAttachmentsPossible).toBool());
     3601    const QString strControllerName(m_pModelStorage->data(index, StorageModel::R_CtrName).toString());
     3602    const QString strMachineFolder(QFileInfo(m_strMachineSettingsFilePath).absolutePath());
    36023603
    36033604    QString strMediumId;
    3604     switch (deviceType)
     3605    switch (enmDevice)
    36053606    {
    36063607        case KDeviceType_HardDisk:
    36073608        {
    3608             int iAnswer = msgCenter().confirmHardDiskAttachmentCreation(strControllerName, this);
     3609            const int iAnswer = msgCenter().confirmHardDiskAttachmentCreation(strControllerName, this);
    36093610            if (iAnswer == AlertButton_Choice1)
    36103611                strMediumId = getWithNewHDWizard();
     
    36363637    if (!strMediumId.isEmpty())
    36373638    {
    3638         mStorageModel->addAttachment(QUuid(mStorageModel->data(index, StorageModel::R_ItemId).toString()), deviceType, strMediumId);
    3639         mStorageModel->sort();
    3640         emit storageChanged();
     3639        m_pModelStorage->addAttachment(QUuid(m_pModelStorage->data(index, StorageModel::R_ItemId).toString()), enmDevice, strMediumId);
     3640        m_pModelStorage->sort();
     3641        emit sigStorageChanged();
    36413642
    36423643        /* Revalidate: */
     
    36483649{
    36493650    /* Initialize variables: */
    3650     CGuestOSType guestOSType = vboxGlobal().virtualBox().GetGuestOSType(m_strMachineGuestOSTypeId);
    3651     QFileInfo fileInfo(m_strMachineSettingsFilePath);
     3651    const CGuestOSType comGuestOSType = vboxGlobal().virtualBox().GetGuestOSType(m_strMachineGuestOSTypeId);
     3652    const QFileInfo fileInfo(m_strMachineSettingsFilePath);
    36523653    /* Show New VD wizard: */
    3653     UISafePointerWizardNewVD pWizard = new UIWizardNewVD(this, QString(), fileInfo.absolutePath(), guestOSType.GetRecommendedHDD());
     3654    UISafePointerWizardNewVD pWizard = new UIWizardNewVD(this, QString(), fileInfo.absolutePath(), comGuestOSType.GetRecommendedHDD());
    36543655    pWizard->prepare();
    3655     QString strResult = pWizard->exec() == QDialog::Accepted ? pWizard->virtualDisk().GetId() : QString();
     3656    const QString strResult = pWizard->exec() == QDialog::Accepted ? pWizard->virtualDisk().GetId() : QString();
    36563657    if (pWizard)
    36573658        delete pWizard;
     
    36593660}
    36603661
    3661 void UIMachineSettingsStorage::updateAdditionalObjects (KDeviceType aType)
    3662 {
    3663     mLbHDFormat->setVisible (aType == KDeviceType_HardDisk);
    3664     mLbHDFormatValue->setVisible (aType == KDeviceType_HardDisk);
    3665 
    3666     mLbCDFDType->setVisible (aType != KDeviceType_HardDisk);
    3667     mLbCDFDTypeValue->setVisible (aType != KDeviceType_HardDisk);
    3668 
    3669     mLbHDVirtualSize->setVisible (aType == KDeviceType_HardDisk);
    3670     mLbHDVirtualSizeValue->setVisible (aType == KDeviceType_HardDisk);
    3671 
    3672     mLbHDActualSize->setVisible (aType == KDeviceType_HardDisk);
    3673     mLbHDActualSizeValue->setVisible (aType == KDeviceType_HardDisk);
    3674 
    3675     mLbSize->setVisible (aType != KDeviceType_HardDisk);
    3676     mLbSizeValue->setVisible (aType != KDeviceType_HardDisk);
    3677 
    3678     mLbHDDetails->setVisible (aType == KDeviceType_HardDisk);
    3679     mLbHDDetailsValue->setVisible (aType == KDeviceType_HardDisk);
    3680 
    3681     m_pLabelEncryption->setVisible(aType == KDeviceType_HardDisk);
    3682     m_pLabelEncryptionValue->setVisible(aType == KDeviceType_HardDisk);
    3683 }
    3684 
    3685 QString UIMachineSettingsStorage::generateUniqueName (const QString &aTemplate) const
    3686 {
    3687     int maxNumber = 0;
    3688     QModelIndex rootIndex = mStorageModel->root();
    3689     for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
    3690     {
    3691         QModelIndex ctrIndex = rootIndex.child (i, 0);
    3692         QString ctrName = mStorageModel->data (ctrIndex, StorageModel::R_CtrName).toString();
    3693         if (ctrName.startsWith (aTemplate))
    3694         {
    3695             QString stringNumber (ctrName.right (ctrName.size() - aTemplate.size()));
    3696             bool isConverted = false;
    3697             int number = stringNumber.toInt (&isConverted);
    3698             maxNumber = isConverted && (number > maxNumber) ? number : 1;
    3699         }
    3700     }
    3701     return maxNumber ? QString ("%1 %2").arg (aTemplate).arg (++ maxNumber) : aTemplate;
    3702 }
    3703 
    3704 uint32_t UIMachineSettingsStorage::deviceCount (KDeviceType aType) const
     3662void UIMachineSettingsStorage::updateAdditionalDetails(KDeviceType enmType)
     3663{
     3664    mLbHDFormat->setVisible(enmType == KDeviceType_HardDisk);
     3665    mLbHDFormatValue->setVisible(enmType == KDeviceType_HardDisk);
     3666
     3667    mLbCDFDType->setVisible(enmType != KDeviceType_HardDisk);
     3668    mLbCDFDTypeValue->setVisible(enmType != KDeviceType_HardDisk);
     3669
     3670    mLbHDVirtualSize->setVisible(enmType == KDeviceType_HardDisk);
     3671    mLbHDVirtualSizeValue->setVisible(enmType == KDeviceType_HardDisk);
     3672
     3673    mLbHDActualSize->setVisible(enmType == KDeviceType_HardDisk);
     3674    mLbHDActualSizeValue->setVisible(enmType == KDeviceType_HardDisk);
     3675
     3676    mLbSize->setVisible(enmType != KDeviceType_HardDisk);
     3677    mLbSizeValue->setVisible(enmType != KDeviceType_HardDisk);
     3678
     3679    mLbHDDetails->setVisible(enmType == KDeviceType_HardDisk);
     3680    mLbHDDetailsValue->setVisible(enmType == KDeviceType_HardDisk);
     3681
     3682    m_pLabelEncryption->setVisible(enmType == KDeviceType_HardDisk);
     3683    m_pLabelEncryptionValue->setVisible(enmType == KDeviceType_HardDisk);
     3684}
     3685
     3686QString UIMachineSettingsStorage::generateUniqueControllerName(const QString &strTemplate) const
     3687{
     3688    int iMaxNumber = 0;
     3689    const QModelIndex rootIndex = m_pModelStorage->root();
     3690    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
     3691    {
     3692        const QModelIndex ctrIndex = rootIndex.child(i, 0);
     3693        const QString ctrName = m_pModelStorage->data(ctrIndex, StorageModel::R_CtrName).toString();
     3694        if (ctrName.startsWith(strTemplate))
     3695        {
     3696            const QString stringNumber(ctrName.right(ctrName.size() - strTemplate.size()));
     3697            bool fConverted = false;
     3698            const int iNumber = stringNumber.toInt(&fConverted);
     3699            iMaxNumber = fConverted && (iNumber > iMaxNumber) ? iNumber : 1;
     3700        }
     3701    }
     3702    return iMaxNumber ? QString("%1 %2").arg(strTemplate).arg(++iMaxNumber) : strTemplate;
     3703}
     3704
     3705uint32_t UIMachineSettingsStorage::deviceCount(KDeviceType enmType) const
    37053706{
    37063707    uint32_t cDevices = 0;
    3707     QModelIndex rootIndex = mStorageModel->root();
    3708     for (int i = 0; i < mStorageModel->rowCount (rootIndex); ++ i)
    3709     {
    3710         QModelIndex ctrIndex = rootIndex.child (i, 0);
    3711         for (int j = 0; j < mStorageModel->rowCount (ctrIndex); ++ j)
    3712         {
    3713             QModelIndex attIndex = ctrIndex.child (j, 0);
    3714             KDeviceType attDevice = mStorageModel->data (attIndex, StorageModel::R_AttDevice).value <KDeviceType>();
    3715             if (attDevice == aType)
     3708    const QModelIndex rootIndex = m_pModelStorage->root();
     3709    for (int i = 0; i < m_pModelStorage->rowCount(rootIndex); ++i)
     3710    {
     3711        const QModelIndex ctrIndex = rootIndex.child(i, 0);
     3712        for (int j = 0; j < m_pModelStorage->rowCount(ctrIndex); ++j)
     3713        {
     3714            const QModelIndex attIndex = ctrIndex.child(j, 0);
     3715            const KDeviceType enmAttDevice = m_pModelStorage->data(attIndex, StorageModel::R_AttDevice).value<KDeviceType>();
     3716            if (enmAttDevice == enmType)
    37163717                ++cDevices;
    37173718        }
     
    37303731void UIMachineSettingsStorage::addChooseHostDriveActions(QMenu *pOpenMediumMenu)
    37313732{
    3732     foreach (const QString &strMediumID, vboxGlobal().mediumIDs())
    3733     {
    3734         const UIMedium medium = vboxGlobal().medium(strMediumID);
     3733    foreach (const QString &strMediumId, vboxGlobal().mediumIDs())
     3734    {
     3735        const UIMedium medium = vboxGlobal().medium(strMediumId);
    37353736        if (medium.isHostDrive() && m_pMediumIdHolder->type() == medium.type())
    37363737        {
     
    37423743}
    37433744
    3744 void UIMachineSettingsStorage::addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType recentMediumType)
     3745void UIMachineSettingsStorage::addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType enmRecentMediumType)
    37453746{
    37463747    /* Get recent-medium list: */
    37473748    QStringList recentMediumList;
    3748     switch (recentMediumType)
     3749    switch (enmRecentMediumType)
    37493750    {
    37503751        case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break;
     
    37543755    }
    37553756    /* For every list-item: */
    3756     for (int index = 0; index < recentMediumList.size(); ++index)
     3757    for (int iIndex = 0; iIndex < recentMediumList.size(); ++iIndex)
    37573758    {
    37583759        /* Prepare corresponding action: */
    3759         QString strRecentMediumLocation = recentMediumList[index];
     3760        const QString &strRecentMediumLocation = recentMediumList.at(iIndex);
    37603761        if (QFile::exists(strRecentMediumLocation))
    37613762        {
    37623763            QAction *pChooseRecentMediumAction = pOpenMediumMenu->addAction(QFileInfo(strRecentMediumLocation).fileName(),
    37633764                                                                            this, SLOT(sltChooseRecentMedium()));
    3764             pChooseRecentMediumAction->setData(QString("%1,%2").arg(recentMediumType).arg(strRecentMediumLocation));
     3765            pChooseRecentMediumAction->setData(QString("%1,%2").arg(enmRecentMediumType).arg(strRecentMediumLocation));
    37653766        }
    37663767    }
     
    38363837
    38373838        /* Get storage controller name: */
    3838         QString strControllerName = controllerData.m_strControllerName;
     3839        const QString strControllerName = controllerData.m_strControllerName;
    38393840
    38403841        /* Check that storage controller exists: */
     
    38653866
    38663867        /* Get storage controller attributes: */
    3867         QString strControllerName = controllerData.m_strControllerName;
    3868         KStorageBus controllerBus = controllerData.m_controllerBus;
    3869         KStorageControllerType controllerType = controllerData.m_controllerType;
    3870         bool fUseHostIOCache = controllerData.m_fUseHostIOCache;
     3868        const QString strControllerName = controllerData.m_strControllerName;
     3869        const KStorageBus enmControllerBus = controllerData.m_controllerBus;
     3870        const KStorageControllerType enmControllerType = controllerData.m_controllerType;
     3871        const bool fUseHostIOCache = controllerData.m_fUseHostIOCache;
    38713872        ULONG uPortCount = controllerData.m_uPortCount;
    38723873
     
    38793880        {
    38803881            /* Create new storage controller: */
    3881             controller = m_machine.AddStorageController(strControllerName, controllerBus);
     3882            controller = m_machine.AddStorageController(strControllerName, enmControllerBus);
    38823883            /* Check that machine is OK: */
    38833884            fSuccess = m_machine.isOk();
     
    38863887            {
    38873888                /* Set storage controller attributes: */
    3888                 controller.SetControllerType(controllerType);
     3889                controller.SetControllerType(enmControllerType);
    38893890                controller.SetUseHostIOCache(fUseHostIOCache);
    3890                 if (controllerBus == KStorageBus_SATA || controllerBus == KStorageBus_SAS || controllerBus == KStorageBus_PCIe)
     3891                if (enmControllerBus == KStorageBus_SATA || enmControllerBus == KStorageBus_SAS || enmControllerBus == KStorageBus_PCIe)
    38913892                {
    38923893                    uPortCount = qMax(uPortCount, controller.GetMinPortCount());
     
    39213922
    39223923        /* Get storage controller attributes: */
    3923         QString strControllerName = controllerData.m_strControllerName;
    3924         KStorageBus controllerBus = controllerData.m_controllerBus;
    3925         KStorageControllerType controllerType = controllerData.m_controllerType;
    3926         bool fUseHostIOCache = controllerData.m_fUseHostIOCache;
     3924        const QString strControllerName = controllerData.m_strControllerName;
     3925        const KStorageBus enmControllerBus = controllerData.m_controllerBus;
     3926        const KStorageControllerType enmControllerType = controllerData.m_controllerType;
     3927        const bool fUseHostIOCache = controllerData.m_fUseHostIOCache;
    39273928        ULONG uPortCount = controllerData.m_uPortCount;
    39283929
     
    39353936        {
    39363937            /* Set storage controller attributes: */
    3937             controller.SetControllerType(controllerType);
     3938            controller.SetControllerType(enmControllerType);
    39383939            controller.SetUseHostIOCache(fUseHostIOCache);
    3939             if (controllerBus == KStorageBus_SATA || controllerBus == KStorageBus_SAS)
     3940            if (enmControllerBus == KStorageBus_SATA || enmControllerBus == KStorageBus_SAS)
    39403941            {
    39413942                uPortCount = qMax(uPortCount, controller.GetMinPortCount());
     
    39783979
    39793980        /* Get storage controller attributes: */
    3980         QString strControllerName = controllerData.m_strControllerName;
     3981        const QString strControllerName = controllerData.m_strControllerName;
    39813982        /* Get storage attachment attributes: */
    3982         int iAttachmentPort = attachmentData.m_iAttachmentPort;
    3983         int iAttachmentDevice = attachmentData.m_iAttachmentDevice;
     3983        const int iAttachmentPort = attachmentData.m_iAttachmentPort;
     3984        const int iAttachmentDevice = attachmentData.m_iAttachmentDevice;
    39843985
    39853986        /* Check that storage attachment exists: */
     
    40134014
    40144015        /* Get storage controller attributes: */
    4015         QString strControllerName = controllerData.m_strControllerName;
    4016         KStorageBus controllerBus = controllerData.m_controllerBus;
     4016        const QString strControllerName = controllerData.m_strControllerName;
     4017        const KStorageBus enmControllerBus = controllerData.m_controllerBus;
    40174018        /* Get storage attachment attributes: */
    4018         int iAttachmentPort = attachmentData.m_iAttachmentPort;
    4019         int iAttachmentDevice = attachmentData.m_iAttachmentDevice;
    4020         KDeviceType attachmentDeviceType = attachmentData.m_attachmentType;
    4021         QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId;
    4022         bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;
    4023         bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;
    4024         bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational;
    4025         bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable;
     4019        const int iAttachmentPort = attachmentData.m_iAttachmentPort;
     4020        const int iAttachmentDevice = attachmentData.m_iAttachmentDevice;
     4021        const KDeviceType enmAttachmentDeviceType = attachmentData.m_attachmentType;
     4022        const QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId;
     4023        const bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;
     4024        const bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;
     4025        const bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational;
     4026        const bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable;
    40264027        /* Get GUI medium object: */
    4027         UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId);
     4028        const UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId);
    40284029        /* Get COM medium object: */
    4029         CMedium comMedium = vboxMedium.medium();
     4030        const CMedium comMedium = vboxMedium.medium();
    40304031
    40314032        /* Check that storage attachment doesn't exists: */
     
    40374038        {
    40384039            /* Create storage attachment: */
    4039             m_machine.AttachDevice(strControllerName, iAttachmentPort, iAttachmentDevice, attachmentDeviceType, comMedium);
     4040            m_machine.AttachDevice(strControllerName, iAttachmentPort, iAttachmentDevice, enmAttachmentDeviceType, comMedium);
    40404041            /* Check that machine is OK: */
    40414042            fSuccess = m_machine.isOk();
    40424043            if (fSuccess)
    40434044            {
    4044                 if (attachmentDeviceType == KDeviceType_DVD)
     4045                if (enmAttachmentDeviceType == KDeviceType_DVD)
    40454046                {
    40464047                    if (fSuccess && isMachineOffline())
     
    40574058                    }
    40584059                }
    4059                 else if (attachmentDeviceType == KDeviceType_HardDisk)
     4060                else if (enmAttachmentDeviceType == KDeviceType_HardDisk)
    40604061                {
    40614062                    if (fSuccess && isMachineOffline())
     
    40664067                    }
    40674068                }
    4068                 if ((controllerBus == KStorageBus_SATA) || (controllerBus == KStorageBus_USB))
     4069                if ((enmControllerBus == KStorageBus_SATA) || (enmControllerBus == KStorageBus_USB))
    40694070                {
    40704071                    if (fSuccess && isMachineOffline())
     
    40794080            {
    40804081                /* Show error message: */
    4081                 msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal(attachmentDeviceType),
     4082                msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal(enmAttachmentDeviceType),
    40824083                                               vboxMedium.location(),
    4083                                                StorageSlot(controllerBus, iAttachmentPort, iAttachmentDevice), this);
     4084                                               StorageSlot(enmControllerBus, iAttachmentPort, iAttachmentDevice), this);
    40844085            }
    40854086        }
     
    41024103
    41034104        /* Get storage controller attributes: */
    4104         QString strControllerName = controllerData.m_strControllerName;
    4105         KStorageBus controllerBus = controllerData.m_controllerBus;
     4105        const QString strControllerName = controllerData.m_strControllerName;
     4106        const KStorageBus enmControllerBus = controllerData.m_controllerBus;
    41064107        /* Get storage attachment attributes: */
    4107         int iAttachmentPort = attachmentData.m_iAttachmentPort;
    4108         int iAttachmentDevice = attachmentData.m_iAttachmentDevice;
    4109         QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId;
    4110         bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;
    4111         bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;
    4112         bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational;
    4113         bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable;
    4114         KDeviceType attachmentDeviceType = attachmentData.m_attachmentType;
     4108        const int iAttachmentPort = attachmentData.m_iAttachmentPort;
     4109        const int iAttachmentDevice = attachmentData.m_iAttachmentDevice;
     4110        const QString strAttachmentMediumId = attachmentData.m_strAttachmentMediumId;
     4111        const bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;
     4112        const bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;
     4113        const bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational;
     4114        const bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable;
     4115        const KDeviceType enmAttachmentDeviceType = attachmentData.m_attachmentType;
    41154116
    41164117        /* Check that storage attachment exists: */
    4117         CMediumAttachment attachment = m_machine.GetMediumAttachment(strControllerName, iAttachmentPort, iAttachmentDevice);
     4118        const CMediumAttachment attachment = m_machine.GetMediumAttachment(strControllerName, iAttachmentPort, iAttachmentDevice);
    41184119        /* Check that machine is OK: */
    41194120        fSuccess = m_machine.isOk();
     
    41224123        {
    41234124            /* Get GUI medium object: */
    4124             UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId);
     4125            const UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId);
    41254126            /* Get COM medium object: */
    4126             CMedium comMedium = vboxMedium.medium();
     4127            const CMedium comMedium = vboxMedium.medium();
    41274128            /* Remount storage attachment: */
    41284129            m_machine.MountMedium(strControllerName, iAttachmentPort, iAttachmentDevice, comMedium, true /* force? */);
     
    41314132            if (fSuccess)
    41324133            {
    4133                 if (attachmentDeviceType == KDeviceType_DVD)
     4134                if (enmAttachmentDeviceType == KDeviceType_DVD)
    41344135                {
    41354136                    if (fSuccess && isMachineOffline())
     
    41464147                    }
    41474148                }
    4148                 else if (attachmentDeviceType == KDeviceType_HardDisk)
     4149                else if (enmAttachmentDeviceType == KDeviceType_HardDisk)
    41494150                {
    41504151                    if (fSuccess && isMachineOffline())
     
    41554156                    }
    41564157                }
    4157                 if ((controllerBus == KStorageBus_SATA) || (controllerBus == KStorageBus_USB))
     4158                if ((enmControllerBus == KStorageBus_SATA) || (enmControllerBus == KStorageBus_USB))
    41584159                {
    41594160                    if (fSuccess && isMachineOffline())
     
    41684169            {
    41694170                /* Show error message: */
    4170                 msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal(attachmentDeviceType),
     4171                msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal(enmAttachmentDeviceType),
    41714172                                               vboxMedium.location(),
    4172                                                StorageSlot(controllerBus, iAttachmentPort, iAttachmentDevice), this);
     4173                                               StorageSlot(enmControllerBus, iAttachmentPort, iAttachmentDevice), this);
    41734174            }
    41744175        }
     
    41984199    const UIDataSettingsMachineStorageAttachment &initialAttachmentData = attachmentCache.base();
    41994200    const UIDataSettingsMachineStorageAttachment &currentAttachmentData = attachmentCache.data();
    4200     KDeviceType initialAttachmentDeviceType = initialAttachmentData.m_attachmentType;
    4201     KDeviceType currentAttachmentDeviceType = currentAttachmentData.m_attachmentType;
    4202     LONG iInitialAttachmentDevice = initialAttachmentData.m_iAttachmentDevice;
    4203     LONG iCurrentAttachmentDevice = currentAttachmentData.m_iAttachmentDevice;
    4204     LONG iInitialAttachmentPort = initialAttachmentData.m_iAttachmentPort;
    4205     LONG iCurrentAttachmentPort = currentAttachmentData.m_iAttachmentPort;
    4206     return (currentAttachmentDeviceType == initialAttachmentDeviceType) &&
     4201    const KDeviceType enmInitialAttachmentDeviceType = initialAttachmentData.m_attachmentType;
     4202    const KDeviceType enmCurrentAttachmentDeviceType = currentAttachmentData.m_attachmentType;
     4203    const LONG iInitialAttachmentDevice = initialAttachmentData.m_iAttachmentDevice;
     4204    const LONG iCurrentAttachmentDevice = currentAttachmentData.m_iAttachmentDevice;
     4205    const LONG iInitialAttachmentPort = initialAttachmentData.m_iAttachmentPort;
     4206    const LONG iCurrentAttachmentPort = currentAttachmentData.m_iAttachmentPort;
     4207    return (enmCurrentAttachmentDeviceType == enmInitialAttachmentDeviceType) &&
    42074208           (iCurrentAttachmentDevice == iInitialAttachmentDevice) &&
    42084209           (iCurrentAttachmentPort == iInitialAttachmentPort) &&
    4209            (currentAttachmentDeviceType == KDeviceType_Floppy || currentAttachmentDeviceType == KDeviceType_DVD);
     4210           (enmCurrentAttachmentDeviceType == KDeviceType_Floppy || enmCurrentAttachmentDeviceType == KDeviceType_DVD);
    42104211}
    42114212
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r66243 r66245  
    602602signals:
    603603
    604     void storageChanged();
     604    void sigStorageChanged();
    605605
    606606public:
     
    611611    ~UIMachineSettingsStorage();
    612612
    613     void setChipsetType(KChipsetType type);
     613    void setChipsetType(KChipsetType enmType);
    614614
    615615protected:
     
    650650
    651651    /* Handlers: Medium-processing stuff: */
    652     void sltHandleMediumEnumerated(const QString &strMediumID);
    653     void sltHandleMediumDeleted(const QString &strMediumID);
    654 
    655     void addController();
    656     void addIDEController();
    657     void addSATAController();
    658     void addSCSIController();
    659     void addFloppyController();
    660     void addSASController();
    661     void addUSBController();
    662     void addNVMeController();
    663     void delController();
    664 
    665     void addAttachment();
    666     void addHDAttachment();
    667     void addCDAttachment();
    668     void addFDAttachment();
    669     void delAttachment();
    670 
    671     void getInformation();
    672     void setInformation();
     652    void sltHandleMediumEnumerated(const QString &strMediumId);
     653    void sltHandleMediumDeleted(const QString &strMediumId);
     654
     655    void sltAddController();
     656    void sltAddControllerIDE();
     657    void sltAddControllerSATA();
     658    void sltAddControllerSCSI();
     659    void sltAddControllerFloppy();
     660    void sltAddControllerSAS();
     661    void sltAddControllerUSB();
     662    void sltAddControllerNVMe();
     663    void sltRemoveController();
     664
     665    void sltAddAttachment();
     666    void sltAddAttachmentHD();
     667    void sltAddAttachmentCD();
     668    void sltAddAttachmentFD();
     669    void sltRemoveAttachment();
     670
     671    void sltGetInformation();
     672    void sltSetInformation();
    673673
    674674    void sltPrepareOpenMediumMenu();
     
    679679    void sltChooseRecentMedium();
    680680
    681     void updateActionsState();
    682 
    683     void onRowInserted (const QModelIndex &aParent, int aIndex);
    684     void onRowRemoved();
    685 
    686     void onCurrentItemChanged();
    687 
    688     void onContextMenuRequested (const QPoint &aPosition);
    689 
    690     void onDrawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex);
    691 
    692     void onMouseMoved (QMouseEvent *aEvent);
    693     void onMouseClicked (QMouseEvent *aEvent);
    694 
    695 private:
    696 
    697     void addControllerWrapper (const QString &aName, KStorageBus aBus, KStorageControllerType aType);
    698     void addAttachmentWrapper (KDeviceType aDevice);
     681    void sltUpdateActionsState();
     682
     683    void sltHandleRowInsertion(const QModelIndex &parent, int iPosition);
     684    void sltHandleRowRemoval();
     685
     686    void sltHandleCurrentItemChange();
     687
     688    void sltHandleContextMenuRequest(const QPoint &position);
     689
     690    void sltHandleDrawItemBranches(QPainter *pPainter, const QRect &rect, const QModelIndex &index);
     691
     692    void sltHandleMouseMove(QMouseEvent *pEvent);
     693    void sltHandleMouseClick(QMouseEvent *pEvent);
     694
     695private:
     696
     697    void addControllerWrapper(const QString &strName, KStorageBus enmBus, KStorageControllerType enmType);
     698    void addAttachmentWrapper(KDeviceType enmDevice);
    699699
    700700    QString getWithNewHDWizard();
    701701
    702     void updateAdditionalObjects (KDeviceType aType);
    703 
    704     QString generateUniqueName (const QString &aTemplate) const;
    705 
    706     uint32_t deviceCount (KDeviceType aType) const;
     702    void updateAdditionalDetails(KDeviceType enmType);
     703
     704    QString generateUniqueControllerName(const QString &strTemplate) const;
     705
     706    uint32_t deviceCount(KDeviceType enmType) const;
    707707
    708708    void addChooseExistingMediumAction(QMenu *pOpenMediumMenu, const QString &strActionName);
    709709    void addChooseHostDriveActions(QMenu *pOpenMediumMenu);
    710     void addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType recentMediumType);
     710    void addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType enmRecentMediumType);
    711711
    712712    bool updateStorageData();
     
    723723    bool isAttachmentCouldBeUpdated(const UISettingsCacheMachineStorageAttachment &attachmentCache) const;
    724724
    725     QString m_strMachineId;
    726     QString m_strMachineSettingsFilePath;
    727     QString m_strMachineGuestOSTypeId;
     725    QString  m_strMachineId;
     726    QString  m_strMachineSettingsFilePath;
     727    QString  m_strMachineGuestOSTypeId;
    728728
    729729    /** Holds the storage-tree instance. */
    730     QITreeView *mTwStorageTree;
     730    QITreeView   *m_pTreeStorage;
    731731    /** Holds the storage-model instance. */
    732     StorageModel *mStorageModel;
    733 
    734     QAction *mAddCtrAction;
    735     QAction *mDelCtrAction;
    736     QAction *mAddIDECtrAction;
    737     QAction *mAddSATACtrAction;
    738     QAction *mAddSCSICtrAction;
    739     QAction *mAddSASCtrAction;
    740     QAction *mAddFloppyCtrAction;
    741     QAction *mAddUSBCtrAction;
    742     QAction *mAddNVMeCtrAction;
    743     QAction *mAddAttAction;
    744     QAction *mDelAttAction;
    745     QAction *mAddHDAttAction;
    746     QAction *mAddCDAttAction;
    747     QAction *mAddFDAttAction;
     732    StorageModel *m_pModelStorage;
     733
     734    QAction *m_pActionAddController;
     735    QAction *m_pActionRemoveController;
     736    QAction *m_pActionAddControllerIDE;
     737    QAction *m_pActionAddControllerSATA;
     738    QAction *m_pActionAddControllerSCSI;
     739    QAction *m_pActionAddControllerSAS;
     740    QAction *m_pActionAddControllerFloppy;
     741    QAction *m_pActionAddControllerUSB;
     742    QAction *m_pActionAddControllerNVMe;
     743    QAction *m_pActionAddAttachment;
     744    QAction *m_pActionRemoveAttachment;
     745    QAction *m_pActionAddAttachmentHD;
     746    QAction *m_pActionAddAttachmentCD;
     747    QAction *m_pActionAddAttachmentFD;
    748748
    749749    UIMediumIDHolder *m_pMediumIdHolder;
    750750
    751     bool  mIsPolished;
    752     bool  mIsLoadingInProgress;
     751    bool  m_fPolished;
     752    bool  m_fLoadingInProgress;
    753753
    754754    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r66243 r66245  
    430430
    431431        /* RAM amount test: */
    432         ulong uFullSize = vboxGlobal().host().GetMemorySize();
     432        const ulong uFullSize = vboxGlobal().host().GetMemorySize();
    433433        if (m_pSliderMemorySize->value() > (int)m_pSliderMemorySize->maxRAMAlw())
    434434        {
     
    479479
    480480        /* VCPU amount test: */
    481         int cTotalCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();
     481        const int cTotalCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();
    482482        if (m_pSliderCPUCount->value() > 2 * cTotalCPUs)
    483483        {
     
    651651                    mTwBootOrder->setCurrentItem(mTwBootOrder->item(0));
    652652                else
    653                     sltCurrentBootItemChanged(mTwBootOrder->currentRow());
     653                    sltHandleCurrentBootItemChange(mTwBootOrder->currentRow());
    654654                mTwBootOrder->currentItem()->setSelected(true);
    655655            }
     
    694694}
    695695
    696 void UIMachineSettingsSystem::sltCurrentBootItemChanged(int iCurrentItem)
     696void UIMachineSettingsSystem::sltHandleCurrentBootItemChange(int iCurrentItem)
    697697{
    698698    /* Update boot-order tool-buttons: */
    699     bool fEnabledUP = iCurrentItem > 0;
    700     bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1;
     699    const bool fEnabledUP = iCurrentItem > 0;
     700    const bool fEnabledDOWN = iCurrentItem < mTwBootOrder->count() - 1;
    701701    if ((mTbBootItemUp->hasFocus() && !fEnabledUP) ||
    702702        (mTbBootItemDown->hasFocus() && !fEnabledDOWN))
     
    767767{
    768768    /* Load configuration: */
    769     CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
     769    const CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
    770770
    771771    /* Preconfigure memory-size editor: */
     
    796796     * Until there will be separate Main getter for list of supported boot device types,
    797797     * this list will be hard-coded here... */
    798     int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition());
     798    const int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition());
    799799    for (int iBootPosition = 1; iBootPosition <= iPossibleBootListSize; ++iBootPosition)
    800800    {
     
    831831    connect(mTbBootItemUp, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemUp()));
    832832    connect(mTbBootItemDown, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemDown()));
    833     connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(sltCurrentBootItemChanged(int)));
     833    connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(sltHandleCurrentBootItemChange(int)));
    834834
    835835    /* Advanced options: */
     
    840840{
    841841    /* Load configuration: */
    842     CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
    843     uint hostCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();
     842    const CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
     843    const uint hostCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();
    844844    m_uMinGuestCPU = properties.GetMinGuestCPUCount();
    845845    m_uMaxGuestCPU = qMin(2 * hostCPUs, (uint)properties.GetMaxGuestCPUCount());
     
    907907{
    908908    /* Is there any value currently present/selected? */
    909     KPointingHIDType currentValue = KPointingHIDType_None;
    910     {
    911         int iCurrentIndex = m_pComboPointingHIDType->currentIndex();
     909    KPointingHIDType enmCurrentValue = KPointingHIDType_None;
     910    {
     911        const int iCurrentIndex = m_pComboPointingHIDType->currentIndex();
    912912        if (iCurrentIndex != -1)
    913             currentValue = (KPointingHIDType)m_pComboPointingHIDType->itemData(iCurrentIndex).toInt();
     913            enmCurrentValue = (KPointingHIDType)m_pComboPointingHIDType->itemData(iCurrentIndex).toInt();
    914914    }
    915915
     
    918918
    919919    /* Repopulate combo taking into account currently cached value: */
    920     KPointingHIDType cachedValue = m_pCache->base().m_pointingHIDType;
     920    const KPointingHIDType enmCachedValue = m_pCache->base().m_pointingHIDType;
    921921    {
    922922        /* "PS/2 Mouse" value is always here: */
     
    924924
    925925        /* "USB Mouse" value is here only if it is currently selected: */
    926         if (cachedValue == KPointingHIDType_USBMouse)
     926        if (enmCachedValue == KPointingHIDType_USBMouse)
    927927            m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_USBMouse), (int)KPointingHIDType_USBMouse);
    928928
     
    931931
    932932        /* "PS/2 and USB Mouse" value is here only if it is currently selected: */
    933         if (cachedValue == KPointingHIDType_ComboMouse)
     933        if (enmCachedValue == KPointingHIDType_ComboMouse)
    934934            m_pComboPointingHIDType->addItem(gpConverter->toString(KPointingHIDType_ComboMouse), (int)KPointingHIDType_ComboMouse);
    935935
     
    939939
    940940    /* Was there any value previously present/selected? */
    941     if (currentValue != KPointingHIDType_None)
    942     {
    943         int iPreviousIndex = m_pComboPointingHIDType->findData((int)currentValue);
     941    if (enmCurrentValue != KPointingHIDType_None)
     942    {
     943        int iPreviousIndex = m_pComboPointingHIDType->findData((int)enmCurrentValue);
    944944        if (iPreviousIndex != -1)
    945945            m_pComboPointingHIDType->setCurrentIndex(iPreviousIndex);
     
    953953    {
    954954        /* Cast to the corresponding type: */
    955         KChipsetType type = (KChipsetType)iIndex;
     955        const KChipsetType enmType = (KChipsetType)iIndex;
    956956        /* Look for the corresponding item: */
    957         int iCorrespondingIndex = m_pComboChipsetType->findData((int)type);
     957        const int iCorrespondingIndex = m_pComboChipsetType->findData((int)enmType);
    958958        /* Re-translate if corresponding item was found: */
    959959        if (iCorrespondingIndex != -1)
    960             m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString(type));
     960            m_pComboChipsetType->setItemText(iCorrespondingIndex, gpConverter->toString(enmType));
    961961    }
    962962}
     
    968968    {
    969969        /* Cast to the corresponding type: */
    970         KPointingHIDType type = (KPointingHIDType)iIndex;
     970        const KPointingHIDType enmType = (KPointingHIDType)iIndex;
    971971        /* Look for the corresponding item: */
    972         int iCorrespondingIndex = m_pComboPointingHIDType->findData((int)type);
     972        const int iCorrespondingIndex = m_pComboPointingHIDType->findData((int)enmType);
    973973        /* Re-translate if corresponding item was found: */
    974974        if (iCorrespondingIndex != -1)
    975             m_pComboPointingHIDType->setItemText(iCorrespondingIndex, gpConverter->toString(type));
     975            m_pComboPointingHIDType->setItemText(iCorrespondingIndex, gpConverter->toString(enmType));
    976976    }
    977977}
     
    983983    {
    984984        /* Cast to the corresponding type: */
    985         KParavirtProvider type = (KParavirtProvider)iIndex;
     985        const KParavirtProvider enmType = (KParavirtProvider)iIndex;
    986986        /* Look for the corresponding item: */
    987         int iCorrespondingIndex = m_pComboParavirtProvider->findData((int)type);
     987        const int iCorrespondingIndex = m_pComboParavirtProvider->findData((int)enmType);
    988988        /* Re-translate if corresponding item was found: */
    989989        if (iCorrespondingIndex != -1)
    990             m_pComboParavirtProvider->setItemText(iCorrespondingIndex, gpConverter->toString(type));
     990            m_pComboParavirtProvider->setItemText(iCorrespondingIndex, gpConverter->toString(enmType));
    991991    }
    992992}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r66243 r66245  
    4343    /* API: Correlation stuff: */
    4444    bool isHWVirtExEnabled() const;
     45
    4546    bool isHIDEnabled() const;
     47
    4648    KChipsetType chipsetType() const;
     49
    4750    void setUSBEnabled(bool fEnabled);
    4851
     
    8891
    8992    /* Handler: Boot-table stuff: */
    90     void sltCurrentBootItemChanged(int iCurrentIndex);
     93    void sltHandleCurrentBootItemChange(int iCurrentIndex);
    9194
    9295    /* Handlers: CPU stuff: */
     
    116119
    117120    /* Variable: Boot-table stuff: */
    118     QList<KDeviceType> m_possibleBootItems;
     121    QList<KDeviceType>  m_possibleBootItems;
    119122
    120123    /* Variables: CPU stuff: */
    121     uint m_uMinGuestCPU;
    122     uint m_uMaxGuestCPU;
    123     uint m_uMinGuestCPUExecCap;
    124     uint m_uMedGuestCPUExecCap;
    125     uint m_uMaxGuestCPUExecCap;
     124    uint  m_uMinGuestCPU;
     125    uint  m_uMaxGuestCPU;
     126    uint  m_uMinGuestCPUExecCap;
     127    uint  m_uMedGuestCPUExecCap;
     128    uint  m_uMaxGuestCPUExecCap;
    126129
    127130    /* Variable: Correlation stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r66243 r66245  
    277277UIMachineSettingsUSB::UIMachineSettingsUSB()
    278278    : m_pToolBar(0)
    279     , mNewAction(0), mAddAction(0), mEdtAction(0), mDelAction(0)
    280     , mMupAction(0), mMdnAction(0)
    281     , mUSBDevicesMenu(0)
     279    , m_pActionNew(0), m_pActionAdd(0), m_pActionEdit(0), m_pActionRemove(0)
     280    , m_pActionMoveUp(0), m_pActionMoveDown(0)
     281    , m_pMenuUSBDevices(0)
    282282    , m_pCache(new UISettingsCacheMachineUSB)
    283283{
    284284    /* Apply UI decorations */
    285     Ui::UIMachineSettingsUSB::setupUi (this);
     285    Ui::UIMachineSettingsUSB::setupUi(this);
    286286
    287287    /* Prepare actions */
    288     mNewAction = new QAction (mTwFilters);
    289     mAddAction = new QAction (mTwFilters);
    290     mEdtAction = new QAction (mTwFilters);
    291     mDelAction = new QAction (mTwFilters);
    292     mMupAction = new QAction (mTwFilters);
    293     mMdnAction = new QAction (mTwFilters);
    294 
    295     mNewAction->setShortcut (QKeySequence ("Ins"));
    296     mAddAction->setShortcut (QKeySequence ("Alt+Ins"));
    297     mEdtAction->setShortcut (QKeySequence ("Ctrl+Return"));
    298     mDelAction->setShortcut (QKeySequence ("Del"));
    299     mMupAction->setShortcut (QKeySequence ("Ctrl+Up"));
    300     mMdnAction->setShortcut (QKeySequence ("Ctrl+Down"));
    301 
    302     mNewAction->setIcon(UIIconPool::iconSet(":/usb_new_16px.png",
     288    m_pActionNew = new QAction(mTwFilters);
     289    m_pActionAdd = new QAction(mTwFilters);
     290    m_pActionEdit = new QAction(mTwFilters);
     291    m_pActionRemove = new QAction(mTwFilters);
     292    m_pActionMoveUp = new QAction(mTwFilters);
     293    m_pActionMoveDown = new QAction(mTwFilters);
     294
     295    m_pActionNew->setShortcut (QKeySequence ("Ins"));
     296    m_pActionAdd->setShortcut (QKeySequence ("Alt+Ins"));
     297    m_pActionEdit->setShortcut (QKeySequence ("Ctrl+Return"));
     298    m_pActionRemove->setShortcut (QKeySequence ("Del"));
     299    m_pActionMoveUp->setShortcut (QKeySequence ("Ctrl+Up"));
     300    m_pActionMoveDown->setShortcut (QKeySequence ("Ctrl+Down"));
     301
     302    m_pActionNew->setIcon(UIIconPool::iconSet(":/usb_new_16px.png",
    303303                                            ":/usb_new_disabled_16px.png"));
    304     mAddAction->setIcon(UIIconPool::iconSet(":/usb_add_16px.png",
     304    m_pActionAdd->setIcon(UIIconPool::iconSet(":/usb_add_16px.png",
    305305                                            ":/usb_add_disabled_16px.png"));
    306     mEdtAction->setIcon(UIIconPool::iconSet(":/usb_filter_edit_16px.png",
     306    m_pActionEdit->setIcon(UIIconPool::iconSet(":/usb_filter_edit_16px.png",
    307307                                            ":/usb_filter_edit_disabled_16px.png"));
    308     mDelAction->setIcon(UIIconPool::iconSet(":/usb_remove_16px.png",
     308    m_pActionRemove->setIcon(UIIconPool::iconSet(":/usb_remove_16px.png",
    309309                                            ":/usb_remove_disabled_16px.png"));
    310     mMupAction->setIcon(UIIconPool::iconSet(":/usb_moveup_16px.png",
     310    m_pActionMoveUp->setIcon(UIIconPool::iconSet(":/usb_moveup_16px.png",
    311311                                            ":/usb_moveup_disabled_16px.png"));
    312     mMdnAction->setIcon(UIIconPool::iconSet(":/usb_movedown_16px.png",
     312    m_pActionMoveDown->setIcon(UIIconPool::iconSet(":/usb_movedown_16px.png",
    313313                                            ":/usb_movedown_disabled_16px.png"));
    314314
     
    320320    m_pFiltersToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    321321    m_pFiltersToolBar->setOrientation(Qt::Vertical);
    322     m_pFiltersToolBar->addAction(mNewAction);
    323     m_pFiltersToolBar->addAction(mAddAction);
    324     m_pFiltersToolBar->addAction(mEdtAction);
    325     m_pFiltersToolBar->addAction(mDelAction);
    326     m_pFiltersToolBar->addAction(mMupAction);
    327     m_pFiltersToolBar->addAction(mMdnAction);
     322    m_pFiltersToolBar->addAction(m_pActionNew);
     323    m_pFiltersToolBar->addAction(m_pActionAdd);
     324    m_pFiltersToolBar->addAction(m_pActionEdit);
     325    m_pFiltersToolBar->addAction(m_pActionRemove);
     326    m_pFiltersToolBar->addAction(m_pActionMoveUp);
     327    m_pFiltersToolBar->addAction(m_pActionMoveDown);
    328328
    329329    /* Setup connections */
     
    334334
    335335    connect (mGbUSB, SIGNAL (toggled (bool)),
    336              this, SLOT (usbAdapterToggled (bool)));
     336             this, SLOT (sltHandleUsbAdapterToggle (bool)));
    337337    connect (mTwFilters, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
    338              this, SLOT (currentChanged (QTreeWidgetItem*)));
     338             this, SLOT (sltHandleCurrentItemChange (QTreeWidgetItem*)));
    339339    connect (mTwFilters, SIGNAL (customContextMenuRequested (const QPoint &)),
    340              this, SLOT (showContextMenu (const QPoint &)));
     340             this, SLOT (sltHandleContextMenuRequest (const QPoint &)));
    341341    connect (mTwFilters, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),
    342              this, SLOT (edtClicked()));
     342             this, SLOT (sltEditFilter()));
    343343    connect (mTwFilters, SIGNAL (itemChanged (QTreeWidgetItem *, int)),
    344              this, SLOT (sltUpdateActivityState(QTreeWidgetItem *)));
    345 
    346     mUSBDevicesMenu = new VBoxUSBMenu (this);
    347     connect (mUSBDevicesMenu, SIGNAL (triggered (QAction*)),
    348              this, SLOT (addConfirmed (QAction *)));
    349     connect (mNewAction, SIGNAL (triggered (bool)),
    350              this, SLOT (newClicked()));
    351     connect (mAddAction, SIGNAL (triggered (bool)),
    352              this, SLOT (addClicked()));
    353     connect (mEdtAction, SIGNAL (triggered (bool)),
    354              this, SLOT (edtClicked()));
    355     connect (mDelAction, SIGNAL (triggered (bool)),
    356              this, SLOT (delClicked()));
    357     connect (mMupAction, SIGNAL (triggered (bool)),
    358              this, SLOT (mupClicked()));
    359     connect (mMdnAction, SIGNAL (triggered (bool)),
    360              this, SLOT (mdnClicked()));
     344             this, SLOT (sltHandleActivityStateChange(QTreeWidgetItem *)));
     345
     346    m_pMenuUSBDevices = new VBoxUSBMenu (this);
     347    connect (m_pMenuUSBDevices, SIGNAL (triggered (QAction*)),
     348             this, SLOT (sltAddFilterConfirmed (QAction *)));
     349    connect (m_pActionNew, SIGNAL (triggered (bool)),
     350             this, SLOT (sltNewFilter()));
     351    connect (m_pActionAdd, SIGNAL (triggered (bool)),
     352             this, SLOT (sltAddFilter()));
     353    connect (m_pActionEdit, SIGNAL (triggered (bool)),
     354             this, SLOT (sltEditFilter()));
     355    connect (m_pActionRemove, SIGNAL (triggered (bool)),
     356             this, SLOT (sltRemoveFilter()));
     357    connect (m_pActionMoveUp, SIGNAL (triggered (bool)),
     358             this, SLOT (sltMoveFilterUp()));
     359    connect (m_pActionMoveDown, SIGNAL (triggered (bool)),
     360             this, SLOT (sltMoveFilterDown()));
    361361
    362362    /* Setup dialog */
     
    373373UIMachineSettingsUSB::~UIMachineSettingsUSB()
    374374{
    375     delete mUSBDevicesMenu;
     375    delete m_pMenuUSBDevices;
    376376
    377377    /* Cleanup cache: */
     
    473473
    474474    /* Update page: */
    475     usbAdapterToggled(mGbUSB->isChecked());
     475    sltHandleUsbAdapterToggle(mGbUSB->isChecked());
    476476
    477477    /* Polish page finally: */
     
    676676#ifdef VBOX_WITH_EXTPACK
    677677    /* USB 2.0/3.0 Extension Pack presence test: */
    678     CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
     678    const CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
    679679    if (   mGbUSB->isChecked()
    680680        && (mRbUSB2->isChecked() || mRbUSB3->isChecked())
     
    698698}
    699699
    700 void UIMachineSettingsUSB::setOrderAfter (QWidget *aWidget)
    701 {
    702     setTabOrder (aWidget, mGbUSB);
    703     setTabOrder (mGbUSB, mRbUSB1);
    704     setTabOrder (mRbUSB1, mRbUSB2);
    705     setTabOrder (mRbUSB2, mRbUSB3);
    706     setTabOrder (mRbUSB3, mTwFilters);
     700void UIMachineSettingsUSB::setOrderAfter(QWidget *pWidget)
     701{
     702    setTabOrder(pWidget, mGbUSB);
     703    setTabOrder(mGbUSB, mRbUSB1);
     704    setTabOrder(mRbUSB1, mRbUSB2);
     705    setTabOrder(mRbUSB2, mRbUSB3);
     706    setTabOrder(mRbUSB3, mTwFilters);
    707707}
    708708
     
    712712    Ui::UIMachineSettingsUSB::retranslateUi(this);
    713713
    714     mNewAction->setText(tr("Add Empty Filter"));
    715     mAddAction->setText(tr("Add Filter From Device"));
    716     mEdtAction->setText(tr("Edit Filter"));
    717     mDelAction->setText(tr("Remove Filter"));
    718     mMupAction->setText(tr("Move Filter Up"));
    719     mMdnAction->setText(tr("Move Filter Down"));
    720 
    721     mNewAction->setWhatsThis(tr("Adds new USB filter with all fields initially set to empty strings. "
     714    m_pActionNew->setText(tr("Add Empty Filter"));
     715    m_pActionAdd->setText(tr("Add Filter From Device"));
     716    m_pActionEdit->setText(tr("Edit Filter"));
     717    m_pActionRemove->setText(tr("Remove Filter"));
     718    m_pActionMoveUp->setText(tr("Move Filter Up"));
     719    m_pActionMoveDown->setText(tr("Move Filter Down"));
     720
     721    m_pActionNew->setWhatsThis(tr("Adds new USB filter with all fields initially set to empty strings. "
    722722                                "Note that such a filter will match any attached USB device."));
    723     mAddAction->setWhatsThis(tr("Adds new USB filter with all fields set to the values of the "
     723    m_pActionAdd->setWhatsThis(tr("Adds new USB filter with all fields set to the values of the "
    724724                                "selected USB device attached to the host PC."));
    725     mEdtAction->setWhatsThis(tr("Edits selected USB filter."));
    726     mDelAction->setWhatsThis(tr("Removes selected USB filter."));
    727     mMupAction->setWhatsThis(tr("Moves selected USB filter up."));
    728     mMdnAction->setWhatsThis(tr("Moves selected USB filter down."));
    729 
    730     mNewAction->setToolTip(mNewAction->whatsThis());
    731     mAddAction->setToolTip(mAddAction->whatsThis());
    732     mEdtAction->setToolTip(mEdtAction->whatsThis());
    733     mDelAction->setToolTip(mDelAction->whatsThis());
    734     mMupAction->setToolTip(mMupAction->whatsThis());
    735     mMdnAction->setToolTip(mMdnAction->whatsThis());
    736 
    737     mUSBFilterName = tr("New Filter %1", "usb");
     725    m_pActionEdit->setWhatsThis(tr("Edits selected USB filter."));
     726    m_pActionRemove->setWhatsThis(tr("Removes selected USB filter."));
     727    m_pActionMoveUp->setWhatsThis(tr("Moves selected USB filter up."));
     728    m_pActionMoveDown->setWhatsThis(tr("Moves selected USB filter down."));
     729
     730    m_pActionNew->setToolTip(m_pActionNew->whatsThis());
     731    m_pActionAdd->setToolTip(m_pActionAdd->whatsThis());
     732    m_pActionEdit->setToolTip(m_pActionEdit->whatsThis());
     733    m_pActionRemove->setToolTip(m_pActionRemove->whatsThis());
     734    m_pActionMoveUp->setToolTip(m_pActionMoveUp->whatsThis());
     735    m_pActionMoveDown->setToolTip(m_pActionMoveDown->whatsThis());
     736
     737    m_strTrUSBFilterName = tr("New Filter %1", "usb");
    738738}
    739739
     
    747747}
    748748
    749 void UIMachineSettingsUSB::usbAdapterToggled(bool fEnabled)
     749void UIMachineSettingsUSB::sltHandleUsbAdapterToggle(bool fEnabled)
    750750{
    751751    /* Enable/disable USB children: */
     
    761761    }
    762762    /* Update current item: */
    763     currentChanged(mTwFilters->currentItem());
    764 }
    765 
    766 void UIMachineSettingsUSB::currentChanged(QTreeWidgetItem *aItem)
     763    sltHandleCurrentItemChange(mTwFilters->currentItem());
     764}
     765
     766void UIMachineSettingsUSB::sltHandleCurrentItemChange(QTreeWidgetItem *pCurrentItem)
    767767{
    768768    /* Get selected items: */
     
    777777
    778778    /* Select item if requested: */
    779     if (aItem)
    780         aItem->setSelected(true);
     779    if (pCurrentItem)
     780        pCurrentItem->setSelected(true);
    781781
    782782    /* Update corresponding action states: */
    783     mEdtAction->setEnabled(aItem);
    784     mDelAction->setEnabled(aItem);
    785     mMupAction->setEnabled(aItem && mTwFilters->itemAbove(aItem));
    786     mMdnAction->setEnabled(aItem && mTwFilters->itemBelow(aItem));
    787 }
    788 
    789 void UIMachineSettingsUSB::showContextMenu(const QPoint &pos)
     783    m_pActionEdit->setEnabled(pCurrentItem);
     784    m_pActionRemove->setEnabled(pCurrentItem);
     785    m_pActionMoveUp->setEnabled(pCurrentItem && mTwFilters->itemAbove(pCurrentItem));
     786    m_pActionMoveDown->setEnabled(pCurrentItem && mTwFilters->itemBelow(pCurrentItem));
     787}
     788
     789void UIMachineSettingsUSB::sltHandleContextMenuRequest(const QPoint &pos)
    790790{
    791791    QMenu menu;
    792792    if (mTwFilters->isEnabled())
    793793    {
    794         menu.addAction(mNewAction);
    795         menu.addAction(mAddAction);
     794        menu.addAction(m_pActionNew);
     795        menu.addAction(m_pActionAdd);
    796796        menu.addSeparator();
    797         menu.addAction(mEdtAction);
     797        menu.addAction(m_pActionEdit);
    798798        menu.addSeparator();
    799         menu.addAction(mDelAction);
     799        menu.addAction(m_pActionRemove);
    800800        menu.addSeparator();
    801         menu.addAction(mMupAction);
    802         menu.addAction(mMdnAction);
     801        menu.addAction(m_pActionMoveUp);
     802        menu.addAction(m_pActionMoveDown);
    803803    }
    804804    if (!menu.isEmpty())
     
    806806}
    807807
    808 void UIMachineSettingsUSB::sltUpdateActivityState(QTreeWidgetItem *pChangedItem)
     808void UIMachineSettingsUSB::sltHandleActivityStateChange(QTreeWidgetItem *pChangedItem)
    809809{
    810810    /* Check changed USB filter item: */
     
    816816}
    817817
    818 void UIMachineSettingsUSB::newClicked()
     818void UIMachineSettingsUSB::sltNewFilter()
    819819{
    820820    /* Search for the max available filter index: */
    821821    int iMaxFilterIndex = 0;
    822     QRegExp regExp(QString("^") + mUSBFilterName.arg("([0-9]+)") + QString("$"));
     822    const QRegExp regExp(QString("^") + m_strTrUSBFilterName.arg("([0-9]+)") + QString("$"));
    823823    QTreeWidgetItemIterator iterator(mTwFilters);
    824824    while (*iterator)
    825825    {
    826         QString filterName = (*iterator)->text(0);
    827         int pos = regExp.indexIn(filterName);
     826        const QString filterName = (*iterator)->text(0);
     827        const int pos = regExp.indexIn(filterName);
    828828        if (pos != -1)
    829829            iMaxFilterIndex = regExp.cap(1).toInt() > iMaxFilterIndex ?
     
    835835    UIDataSettingsMachineUSBFilter usbFilterData;
    836836    usbFilterData.m_fActive = true;
    837     usbFilterData.m_strName = mUSBFilterName.arg(iMaxFilterIndex + 1);
     837    usbFilterData.m_strName = m_strTrUSBFilterName.arg(iMaxFilterIndex + 1);
    838838    usbFilterData.m_fHostUSBDevice = false;
    839839
     
    845845}
    846846
    847 void UIMachineSettingsUSB::addClicked()
    848 {
    849     mUSBDevicesMenu->exec(QCursor::pos());
    850 }
    851 
    852 void UIMachineSettingsUSB::addConfirmed(QAction *pAction)
     847void UIMachineSettingsUSB::sltAddFilter()
     848{
     849    m_pMenuUSBDevices->exec(QCursor::pos());
     850}
     851
     852void UIMachineSettingsUSB::sltAddFilterConfirmed(QAction *pAction)
    853853{
    854854    /* Get USB device: */
    855     CUSBDevice usb = mUSBDevicesMenu->getUSB(pAction);
     855    const CUSBDevice usb = m_pMenuUSBDevices->getUSB(pAction);
    856856    if (usb.isNull())
    857857        return;
     
    884884}
    885885
    886 void UIMachineSettingsUSB::edtClicked()
     886void UIMachineSettingsUSB::sltEditFilter()
    887887{
    888888    /* Get current USB filter item: */
     
    932932}
    933933
    934 void UIMachineSettingsUSB::delClicked()
     934void UIMachineSettingsUSB::sltRemoveFilter()
    935935{
    936936    /* Get current USB filter item: */
     
    943943
    944944    /* Update current item: */
    945     currentChanged(mTwFilters->currentItem());
     945    sltHandleCurrentItemChange(mTwFilters->currentItem());
    946946
    947947    /* Revalidate: */
     
    949949}
    950950
    951 void UIMachineSettingsUSB::mupClicked()
    952 {
    953     QTreeWidgetItem *item = mTwFilters->currentItem();
    954     Assert (item);
    955 
    956     int index = mTwFilters->indexOfTopLevelItem (item);
    957     QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem (index);
    958     Assert (item == takenItem);
    959     mTwFilters->insertTopLevelItem (index - 1, takenItem);
    960     m_filters.swap (index, index - 1);
    961 
    962     mTwFilters->setCurrentItem (takenItem);
    963 }
    964 
    965 void UIMachineSettingsUSB::mdnClicked()
    966 {
    967     QTreeWidgetItem *item = mTwFilters->currentItem();
    968     Assert (item);
    969 
    970     int index = mTwFilters->indexOfTopLevelItem (item);
    971     QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem (index);
    972     Assert (item == takenItem);
    973     mTwFilters->insertTopLevelItem (index + 1, takenItem);
    974     m_filters.swap (index, index + 1);
    975 
    976     mTwFilters->setCurrentItem (takenItem);
    977 }
    978 
    979 void UIMachineSettingsUSB::addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fIsNew)
     951void UIMachineSettingsUSB::sltMoveFilterUp()
     952{
     953    QTreeWidgetItem *pItem = mTwFilters->currentItem();
     954    Assert(pItem);
     955
     956    const int index = mTwFilters->indexOfTopLevelItem(pItem);
     957    QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem(index);
     958    Assert(pItem == takenItem);
     959    mTwFilters->insertTopLevelItem(index - 1, takenItem);
     960    m_filters.swap(index, index - 1);
     961
     962    mTwFilters->setCurrentItem(takenItem);
     963}
     964
     965void UIMachineSettingsUSB::sltMoveFilterDown()
     966{
     967    QTreeWidgetItem *pItem = mTwFilters->currentItem();
     968    Assert(pItem);
     969
     970    const int index = mTwFilters->indexOfTopLevelItem(pItem);
     971    QTreeWidgetItem *takenItem = mTwFilters->takeTopLevelItem(index);
     972    Assert(pItem == takenItem);
     973    mTwFilters->insertTopLevelItem(index + 1, takenItem);
     974    m_filters.swap(index, index + 1);
     975
     976    mTwFilters->setCurrentItem(takenItem);
     977}
     978
     979void UIMachineSettingsUSB::addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fChoose)
    980980{
    981981    /* Append internal list with data: */
     
    990990
    991991    /* Select this item if its new: */
    992     if (fIsNew)
     992    if (fChoose)
    993993        mTwFilters->setCurrentItem(pItem);
    994994}
     
    10001000    QString strToolTip;
    10011001
    1002     QString strVendorId = usbFilterData.m_strVendorId;
     1002    const QString strVendorId = usbFilterData.m_strVendorId;
    10031003    if (!strVendorId.isEmpty())
    10041004        strToolTip += tr("<nobr>Vendor ID: %1</nobr>", "USB filter tooltip").arg(strVendorId);
    10051005
    1006     QString strProductId = usbFilterData.m_strProductId;
     1006    const QString strProductId = usbFilterData.m_strProductId;
    10071007    if (!strProductId.isEmpty())
    10081008        strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Product ID: %2</nobr>", "USB filter tooltip").arg(strProductId);
    10091009
    1010     QString strRevision = usbFilterData.m_strRevision;
     1010    const QString strRevision = usbFilterData.m_strRevision;
    10111011    if (!strRevision.isEmpty())
    10121012        strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Revision: %3</nobr>", "USB filter tooltip").arg(strRevision);
    10131013
    1014     QString strProduct = usbFilterData.m_strProduct;
     1014    const QString strProduct = usbFilterData.m_strProduct;
    10151015    if (!strProduct.isEmpty())
    10161016        strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Product: %4</nobr>", "USB filter tooltip").arg(strProduct);
    10171017
    1018     QString strManufacturer = usbFilterData.m_strManufacturer;
     1018    const QString strManufacturer = usbFilterData.m_strManufacturer;
    10191019    if (!strManufacturer.isEmpty())
    10201020        strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Manufacturer: %5</nobr>", "USB filter tooltip").arg(strManufacturer);
    10211021
    1022     QString strSerial = usbFilterData.m_strSerialNumber;
     1022    const QString strSerial = usbFilterData.m_strSerialNumber;
    10231023    if (!strSerial.isEmpty())
    10241024        strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Serial No.: %1</nobr>", "USB filter tooltip").arg(strSerial);
    10251025
    1026     QString strPort = usbFilterData.m_strPort;
     1026    const QString strPort = usbFilterData.m_strPort;
    10271027    if (!strPort.isEmpty())
    10281028        strToolTip += strToolTip.isEmpty() ? "":"<br/>" + tr("<nobr>Port: %1</nobr>", "USB filter tooltip").arg(strPort);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h

    r66243 r66245  
    8282private slots:
    8383
    84     void usbAdapterToggled(bool fEnabled);
     84    void sltHandleUsbAdapterToggle(bool fEnabled);
    8585
    86     void currentChanged (QTreeWidgetItem *aItem = 0);
    87     void showContextMenu(const QPoint &pos);
    88     void sltUpdateActivityState(QTreeWidgetItem *pChangedItem);
     86    void sltHandleCurrentItemChange(QTreeWidgetItem *pCurrentItem);
     87    void sltHandleContextMenuRequest(const QPoint &position);
     88    void sltHandleActivityStateChange(QTreeWidgetItem *pChangedItem);
    8989
    90     void newClicked();
    91     void addClicked();
    92     void edtClicked();
    93     void addConfirmed (QAction *aAction);
    94     void delClicked();
    95     void mupClicked();
    96     void mdnClicked();
     90    void sltNewFilter();
     91    void sltAddFilter();
     92    void sltEditFilter();
     93    void sltAddFilterConfirmed(QAction *pAction);
     94    void sltRemoveFilter();
     95    void sltMoveFilterUp();
     96    void sltMoveFilterDown();
    9797
    9898private:
    9999
    100     void addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fIsNew);
     100    void addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fChoose);
    101101
    102102    /* Returns the multi-line description of the given USB filter: */
     
    104104
    105105    /* Other variables: */
    106     UIToolBar *m_pToolBar;
    107     QAction *mNewAction;
    108     QAction *mAddAction;
    109     QAction *mEdtAction;
    110     QAction *mDelAction;
    111     QAction *mMupAction;
    112     QAction *mMdnAction;
    113     VBoxUSBMenu *mUSBDevicesMenu;
     106    UIToolBar   *m_pToolBar;
     107    QAction     *m_pActionNew;
     108    QAction     *m_pActionAdd;
     109    QAction     *m_pActionEdit;
     110    QAction     *m_pActionRemove;
     111    QAction     *m_pActionMoveUp;
     112    QAction     *m_pActionMoveDown;
     113    VBoxUSBMenu *m_pMenuUSBDevices;
    114114
    115     QString mUSBFilterName;
     115    QString  m_strTrUSBFilterName;
    116116
    117     QList<UIDataSettingsMachineUSBFilter> m_filters;
     117    QList<UIDataSettingsMachineUSBFilter>  m_filters;
    118118
    119119    /** Holds the page data cache instance. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette