VirtualBox

Changeset 66345 in vbox for trunk


Ignore:
Timestamp:
Mar 29, 2017 6:03:32 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: Machine settings: Proper prepare/cleanup cascade.

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

Legend:

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

    r66246 r66345  
    6565
    6666UIMachineSettingsAudio::UIMachineSettingsAudio()
    67     : m_pCache(new UISettingsCacheMachineAudio)
     67    : m_pCache(0)
    6868{
    6969    /* Prepare: */
     
    7373UIMachineSettingsAudio::~UIMachineSettingsAudio()
    7474{
    75     /* Cleanup cache: */
    76     delete m_pCache;
    77     m_pCache = 0;
     75    /* Cleanup: */
     76    cleanup();
    7877}
    7978
     
    171170
    172171    /* Translate audio-driver combo.
    173      * Make sure this order corresponds the same in prepareComboboxes(): */
     172     * Make sure this order corresponds the same in prepare(): */
    174173    int iIndex = -1;
    175174    m_pComboAudioDriver->setItemText(++iIndex, gpConverter->toString(KAudioDriverType_Null));
     
    194193
    195194    /* Translate audio-controller combo.
    196      * Make sure this order corresponds the same in prepareComboboxes(): */
     195     * Make sure this order corresponds the same in prepare(): */
    197196    iIndex = -1;
    198197    m_pComboAudioController->setItemText(++iIndex, gpConverter->toString(KAudioControllerType_HDA));
     
    213212    Ui::UIMachineSettingsAudio::setupUi(this);
    214213
    215     /* Prepare combo-boxes: */
    216     prepareComboboxes();
    217 
    218     /* Translate finally: */
     214    /* Prepare cache: */
     215    m_pCache = new UISettingsCacheMachineAudio;
     216    AssertPtrReturnVoid(m_pCache);
     217
     218    /* Layout created in the .ui file. */
     219    {
     220        /* Audio-driver combo-box created in the .ui file. */
     221        AssertPtrReturnVoid(m_pComboAudioDriver);
     222        {
     223            /* Configure combo-box.
     224             * Make sure this order corresponds the same in retranslateUi(): */
     225            int iIndex = -1;
     226            m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_Null);
     227#ifdef Q_OS_WIN
     228            m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_DirectSound);
     229# ifdef VBOX_WITH_WINMM
     230            m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_WinMM);
     231# endif
     232#endif
     233#ifdef VBOX_WITH_AUDIO_OSS
     234            m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_OSS);
     235#endif
     236#ifdef VBOX_WITH_AUDIO_ALSA
     237            m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_ALSA);
     238#endif
     239#ifdef VBOX_WITH_AUDIO_PULSE
     240            m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_Pulse);
     241#endif
     242#ifdef Q_OS_MACX
     243            m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_CoreAudio);
     244#endif
     245        }
     246
     247        /* Audio-controller combo-box created in the .ui file. */
     248        AssertPtrReturnVoid(m_pComboAudioController);
     249        {
     250            /* Configure combo-box.
     251             * Make sure this order corresponds the same in retranslateUi(): */
     252            int iIndex = -1;
     253            m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_HDA);
     254            m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_AC97);
     255            m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_SB16);
     256        }
     257    }
     258
     259    /* Apply language settings: */
    219260    retranslateUi();
    220261}
    221262
    222 void UIMachineSettingsAudio::prepareComboboxes()
    223 {
    224     /* Prepare audio-driver combo.
    225      * Make sure this order corresponds the same in retranslateUi(): */
    226     int iIndex = -1;
    227     m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_Null);
    228 #ifdef Q_OS_WIN
    229     m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_DirectSound);
    230 # ifdef VBOX_WITH_WINMM
    231     m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_WinMM);
    232 # endif
    233 #endif
    234 #ifdef VBOX_WITH_AUDIO_OSS
    235     m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_OSS);
    236 #endif
    237 #ifdef VBOX_WITH_AUDIO_ALSA
    238     m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_ALSA);
    239 #endif
    240 #ifdef VBOX_WITH_AUDIO_PULSE
    241     m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_Pulse);
    242 #endif
    243 #ifdef Q_OS_MACX
    244     m_pComboAudioDriver->insertItem(++iIndex, "", KAudioDriverType_CoreAudio);
    245 #endif
    246 
    247     /* Prepare audio-controller combo.
    248      * Make sure this order corresponds the same in retranslateUi(): */
    249     iIndex = -1;
    250     m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_HDA);
    251     m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_AC97);
    252     m_pComboAudioController->insertItem(++iIndex, "", KAudioControllerType_SB16);
    253 }
    254 
     263void UIMachineSettingsAudio::cleanup()
     264{
     265    /* Cleanup cache: */
     266    delete m_pCache;
     267    m_pCache = 0;
     268}
     269
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h

    r66246 r66345  
    7070    /** Prepares all. */
    7171    void prepare();
    72     /** Prepares combo-boxes. */
    73     void prepareComboboxes();
     72    /** Cleanups all. */
     73    void cleanup();
    7474
    7575    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r66246 r66345  
    161161    , m_fWddmModeSupported(false)
    162162#endif /* VBOX_WITH_CRHGSMI */
    163     , m_pCache(new UISettingsCacheMachineDisplay)
     163    , m_pCache(0)
    164164{
    165165    /* Prepare: */
     
    169169UIMachineSettingsDisplay::~UIMachineSettingsDisplay()
    170170{
    171     /* Cleanup cache: */
    172     delete m_pCache;
    173     m_pCache = 0;
     171    /* Cleanup: */
     172    cleanup();
    174173}
    175174
     
    865864    Ui::UIMachineSettingsDisplay::setupUi(this);
    866865
    867     /* Prepare tabs: */
    868     prepareScreenTab();
    869     prepareRemoteDisplayTab();
    870     prepareVideoCaptureTab();
    871 
    872     /* Translate finally: */
     866    /* Prepare cache: */
     867    m_pCache = new UISettingsCacheMachineDisplay;
     868    AssertPtrReturnVoid(m_pCache);
     869
     870    /* Tree-widget created in the .ui file. */
     871    {
     872        /* Prepare 'Screen' tab: */
     873        prepareTabScreen();
     874        /* Prepare 'Remote Display' tab: */
     875        prepareTabRemoteDisplay();
     876        /* Prepare 'Video Capture' tab: */
     877        prepareTabVideoCapture();
     878        /* Prepare connections: */
     879        prepareConnections();
     880    }
     881
     882    /* Apply language settings: */
    873883    retranslateUi();
    874884}
    875885
    876 void UIMachineSettingsDisplay::prepareScreenTab()
    877 {
    878     /* Prepare memory-size slider: */
     886void UIMachineSettingsDisplay::prepareTabScreen()
     887{
     888    /* Prepare common variables: */
    879889    const CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
    880890    m_iMinVRAM = sys.GetMinGuestVRAM();
    881891    m_iMaxVRAM = sys.GetMaxGuestVRAM();
    882892    m_iMaxVRAMVisible = m_iMaxVRAM;
    883     const uint cHostScreens = gpDesktop->screenCount();
    884     m_pSliderVideoMemorySize->setMinimum(m_iMinVRAM);
    885     m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible);
    886     m_pSliderVideoMemorySize->setPageStep(calculatePageStep(m_iMaxVRAMVisible));
    887     m_pSliderVideoMemorySize->setSingleStep(m_pSliderVideoMemorySize->pageStep() / 4);
    888     m_pSliderVideoMemorySize->setTickInterval(m_pSliderVideoMemorySize->pageStep());
    889     m_pSliderVideoMemorySize->setSnappingEnabled(true);
    890     m_pSliderVideoMemorySize->setErrorHint(0, 1);
     893
     894    /* Tab and it's layout created in the .ui file. */
     895    {
     896        /* Memory-size slider created in the .ui file. */
     897        AssertPtrReturnVoid(m_pSliderVideoMemorySize);
     898        {
     899            /* Configure slider: */
     900            m_pSliderVideoMemorySize->setMinimum(m_iMinVRAM);
     901            m_pSliderVideoMemorySize->setMaximum(m_iMaxVRAMVisible);
     902            m_pSliderVideoMemorySize->setPageStep(calculatePageStep(m_iMaxVRAMVisible));
     903            m_pSliderVideoMemorySize->setSingleStep(m_pSliderVideoMemorySize->pageStep() / 4);
     904            m_pSliderVideoMemorySize->setTickInterval(m_pSliderVideoMemorySize->pageStep());
     905            m_pSliderVideoMemorySize->setSnappingEnabled(true);
     906            m_pSliderVideoMemorySize->setErrorHint(0, 1);
     907        }
     908
     909        /* Memory-size editor created in the .ui file. */
     910        AssertPtrReturnVoid(m_pEditorVideoMemorySize);
     911        {
     912            /* Configure editor: */
     913            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoMemorySize, 4);
     914            m_pEditorVideoMemorySize->setMinimum(m_iMinVRAM);
     915            m_pEditorVideoMemorySize->setMaximum(m_iMaxVRAMVisible);
     916        }
     917
     918        /* Screen-count slider created in the .ui file. */
     919        AssertPtrReturnVoid(m_pSliderVideoScreenCount);
     920        {
     921            /* Configure slider: */
     922            const uint cHostScreens = gpDesktop->screenCount();
     923            const uint cMinGuestScreens = 1;
     924            const uint cMaxGuestScreens = sys.GetMaxGuestMonitors();
     925            const uint cMaxGuestScreensForSlider = qMin(cMaxGuestScreens, (uint)8);
     926            m_pSliderVideoScreenCount->setMinimum(cMinGuestScreens);
     927            m_pSliderVideoScreenCount->setMaximum(cMaxGuestScreensForSlider);
     928            m_pSliderVideoScreenCount->setPageStep(1);
     929            m_pSliderVideoScreenCount->setSingleStep(1);
     930            m_pSliderVideoScreenCount->setTickInterval(1);
     931            m_pSliderVideoScreenCount->setOptimalHint(cMinGuestScreens, cHostScreens);
     932            m_pSliderVideoScreenCount->setWarningHint(cHostScreens, cMaxGuestScreensForSlider);
     933        }
     934
     935        /* Screen-count editor created in the .ui file. */
     936        AssertPtrReturnVoid(m_pEditorVideoScreenCount);
     937        {
     938            /* Configure editor: */
     939            const uint cMaxGuestScreens = sys.GetMaxGuestMonitors();
     940            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoScreenCount, 3);
     941            m_pEditorVideoScreenCount->setMinimum(1);
     942            m_pEditorVideoScreenCount->setMaximum(cMaxGuestScreens);
     943        }
     944
     945        /* Scale-factor slider created in the .ui file. */
     946        AssertPtrReturnVoid(m_pSliderGuestScreenScale);
     947        {
     948            /* Configure slider: */
     949            m_pSliderGuestScreenScale->setMinimum(100);
     950            m_pSliderGuestScreenScale->setMaximum(200);
     951            m_pSliderGuestScreenScale->setPageStep(10);
     952            m_pSliderGuestScreenScale->setSingleStep(1);
     953            m_pSliderGuestScreenScale->setTickInterval(10);
     954            m_pSliderGuestScreenScale->setSnappingEnabled(true);
     955        }
     956
     957        /* Scale-factor editor created in the .ui file. */
     958        AssertPtrReturnVoid(m_pEditorGuestScreenScale);
     959        {
     960            /* Configure editor: */
     961            m_pEditorGuestScreenScale->setMinimum(100);
     962            m_pEditorGuestScreenScale->setMaximum(200);
     963            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorGuestScreenScale, 5);
     964        }
     965    }
     966}
     967
     968void UIMachineSettingsDisplay::prepareTabRemoteDisplay()
     969{
     970    /* Tab and it's layout created in the .ui file. */
     971    {
     972        /* Port editor created in the .ui file. */
     973        AssertPtrReturnVoid(m_pEditorRemoteDisplayPort);
     974        {
     975            /* Configure editor: */
     976            m_pEditorRemoteDisplayPort->setValidator(new QRegExpValidator(
     977                QRegExp("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this));
     978        }
     979
     980        /* Timeout editor created in the .ui file. */
     981        AssertPtrReturnVoid(m_pEditorRemoteDisplayTimeout);
     982        {
     983            /* Configure editor: */
     984            m_pEditorRemoteDisplayTimeout->setValidator(new QIntValidator(this));
     985        }
     986
     987        /* Auth-method combo-box created in the .ui file. */
     988        AssertPtrReturnVoid(m_pComboRemoteDisplayAuthMethod);
     989        {
     990            /* Configure combo-box: */
     991            m_pComboRemoteDisplayAuthMethod->insertItem(0, ""); /* KAuthType_Null */
     992            m_pComboRemoteDisplayAuthMethod->insertItem(1, ""); /* KAuthType_External */
     993            m_pComboRemoteDisplayAuthMethod->insertItem(2, ""); /* KAuthType_Guest */
     994        }
     995    }
     996}
     997
     998void UIMachineSettingsDisplay::prepareTabVideoCapture()
     999{
     1000    /* Tab and it's layout created in the .ui file. */
     1001    {
     1002        /* File-path selector created in the .ui file. */
     1003        AssertPtrReturnVoid(m_pEditorVideoCapturePath);
     1004        {
     1005            /* Configure selector: */
     1006            m_pEditorVideoCapturePath->setEditable(false);
     1007            m_pEditorVideoCapturePath->setMode(UIFilePathSelector::Mode_File_Save);
     1008        }
     1009
     1010        /* Frame-size combo-box created in the .ui file. */
     1011        AssertPtrReturnVoid(m_pComboVideoCaptureSize);
     1012        {
     1013            /* Configure combo-box: */
     1014            m_pComboVideoCaptureSize->addItem(""); /* User Defined */
     1015            m_pComboVideoCaptureSize->addItem("320 x 200 (16:10)",   QSize(320, 200));
     1016            m_pComboVideoCaptureSize->addItem("640 x 480 (4:3)",     QSize(640, 480));
     1017            m_pComboVideoCaptureSize->addItem("720 x 400 (9:5)",     QSize(720, 400));
     1018            m_pComboVideoCaptureSize->addItem("720 x 480 (3:2)",     QSize(720, 480));
     1019            m_pComboVideoCaptureSize->addItem("800 x 600 (4:3)",     QSize(800, 600));
     1020            m_pComboVideoCaptureSize->addItem("1024 x 768 (4:3)",    QSize(1024, 768));
     1021            m_pComboVideoCaptureSize->addItem("1152 x 864 (4:3)",    QSize(1152, 864));
     1022            m_pComboVideoCaptureSize->addItem("1280 x 720 (16:9)",   QSize(1280, 720));
     1023            m_pComboVideoCaptureSize->addItem("1280 x 800 (16:10)",  QSize(1280, 800));
     1024            m_pComboVideoCaptureSize->addItem("1280 x 960 (4:3)",    QSize(1280, 960));
     1025            m_pComboVideoCaptureSize->addItem("1280 x 1024 (5:4)",   QSize(1280, 1024));
     1026            m_pComboVideoCaptureSize->addItem("1366 x 768 (16:9)",   QSize(1366, 768));
     1027            m_pComboVideoCaptureSize->addItem("1440 x 900 (16:10)",  QSize(1440, 900));
     1028            m_pComboVideoCaptureSize->addItem("1440 x 1080 (4:3)",   QSize(1440, 1080));
     1029            m_pComboVideoCaptureSize->addItem("1600 x 900 (16:9)",   QSize(1600, 900));
     1030            m_pComboVideoCaptureSize->addItem("1680 x 1050 (16:10)", QSize(1680, 1050));
     1031            m_pComboVideoCaptureSize->addItem("1600 x 1200 (4:3)",   QSize(1600, 1200));
     1032            m_pComboVideoCaptureSize->addItem("1920 x 1080 (16:9)",  QSize(1920, 1080));
     1033            m_pComboVideoCaptureSize->addItem("1920 x 1200 (16:10)", QSize(1920, 1200));
     1034            m_pComboVideoCaptureSize->addItem("1920 x 1440 (4:3)",   QSize(1920, 1440));
     1035            m_pComboVideoCaptureSize->addItem("2880 x 1800 (16:10)", QSize(2880, 1800));
     1036        }
     1037
     1038        /* Frame-width editor created in the .ui file. */
     1039        AssertPtrReturnVoid(m_pEditorVideoCaptureWidth);
     1040        {
     1041            /* Configure editor: */
     1042            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoCaptureWidth, 5);
     1043            m_pEditorVideoCaptureWidth->setMinimum(16);
     1044            m_pEditorVideoCaptureWidth->setMaximum(2880);
     1045        }
     1046
     1047        /* Frame-height editor created in the .ui file. */
     1048        AssertPtrReturnVoid(m_pEditorVideoCaptureHeight);
     1049        {
     1050            /* Configure editor: */
     1051            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoCaptureHeight, 5);
     1052            m_pEditorVideoCaptureHeight->setMinimum(16);
     1053            m_pEditorVideoCaptureHeight->setMaximum(1800);
     1054        }
     1055
     1056        /* Frame-rate slider created in the .ui file. */
     1057        AssertPtrReturnVoid(m_pSliderVideoCaptureFrameRate);
     1058        {
     1059            /* Configure slider: */
     1060            m_pSliderVideoCaptureFrameRate->setMinimum(1);
     1061            m_pSliderVideoCaptureFrameRate->setMaximum(30);
     1062            m_pSliderVideoCaptureFrameRate->setPageStep(1);
     1063            m_pSliderVideoCaptureFrameRate->setSingleStep(1);
     1064            m_pSliderVideoCaptureFrameRate->setTickInterval(1);
     1065            m_pSliderVideoCaptureFrameRate->setSnappingEnabled(true);
     1066            m_pSliderVideoCaptureFrameRate->setOptimalHint(1, 25);
     1067            m_pSliderVideoCaptureFrameRate->setWarningHint(25, 30);
     1068        }
     1069
     1070        /* Frame-rate editor created in the .ui file. */
     1071        AssertPtrReturnVoid(m_pEditorVideoCaptureFrameRate);
     1072        {
     1073            /* Configure editor: */
     1074            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoCaptureFrameRate, 3);
     1075            m_pEditorVideoCaptureFrameRate->setMinimum(1);
     1076            m_pEditorVideoCaptureFrameRate->setMaximum(30);
     1077        }
     1078
     1079        /* Frame quality combo-box created in the .ui file. */
     1080        AssertPtrReturnVoid(m_pContainerLayoutSliderVideoCaptureQuality);
     1081        AssertPtrReturnVoid(m_pSliderVideoCaptureQuality);
     1082        {
     1083            /* Configure combo-box: */
     1084            m_pContainerLayoutSliderVideoCaptureQuality->setColumnStretch(1, 4);
     1085            m_pContainerLayoutSliderVideoCaptureQuality->setColumnStretch(3, 5);
     1086            m_pSliderVideoCaptureQuality->setMinimum(1);
     1087            m_pSliderVideoCaptureQuality->setMaximum(10);
     1088            m_pSliderVideoCaptureQuality->setPageStep(1);
     1089            m_pSliderVideoCaptureQuality->setSingleStep(1);
     1090            m_pSliderVideoCaptureQuality->setTickInterval(1);
     1091            m_pSliderVideoCaptureQuality->setSnappingEnabled(true);
     1092            m_pSliderVideoCaptureQuality->setOptimalHint(1, 5);
     1093            m_pSliderVideoCaptureQuality->setWarningHint(5, 9);
     1094            m_pSliderVideoCaptureQuality->setErrorHint(9, 10);
     1095        }
     1096
     1097        /* Bit-rate editor created in the .ui file. */
     1098        AssertPtrReturnVoid(m_pEditorVideoCaptureBitRate);
     1099        {
     1100            /* Configure editor: */
     1101            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoCaptureBitRate, 5);
     1102            m_pEditorVideoCaptureBitRate->setMinimum(32);
     1103            m_pEditorVideoCaptureBitRate->setMaximum(2048);
     1104        }
     1105    }
     1106}
     1107
     1108void UIMachineSettingsDisplay::prepareConnections()
     1109{
     1110    /* Configure 'Screen' connections: */
    8911111    connect(m_pSliderVideoMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoMemorySizeSliderChange()));
    892 
    893     /* Prepare memory-size editor: */
    894     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoMemorySize, 4);
    895     m_pEditorVideoMemorySize->setMinimum(m_iMinVRAM);
    896     m_pEditorVideoMemorySize->setMaximum(m_iMaxVRAMVisible);
    8971112    connect(m_pEditorVideoMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoMemorySizeEditorChange()));
    898 
    899     /* Prepare screen-count slider: */
    900     const uint cMinGuestScreens = 1;
    901     const uint cMaxGuestScreens = sys.GetMaxGuestMonitors();
    902     const uint cMaxGuestScreensForSlider = qMin(cMaxGuestScreens, (uint)8);
    903     m_pSliderVideoScreenCount->setMinimum(cMinGuestScreens);
    904     m_pSliderVideoScreenCount->setMaximum(cMaxGuestScreensForSlider);
    905     m_pSliderVideoScreenCount->setPageStep(1);
    906     m_pSliderVideoScreenCount->setSingleStep(1);
    907     m_pSliderVideoScreenCount->setTickInterval(1);
    908     m_pSliderVideoScreenCount->setOptimalHint(cMinGuestScreens, cHostScreens);
    909     m_pSliderVideoScreenCount->setWarningHint(cHostScreens, cMaxGuestScreensForSlider);
    9101113    connect(m_pSliderVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountSliderChange()));
    911 
    912     /* Prepare screen-count editor: */
    913     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoScreenCount, 3);
    914     m_pEditorVideoScreenCount->setMinimum(1);
    915     m_pEditorVideoScreenCount->setMaximum(cMaxGuestScreens);
    9161114    connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenCountEditorChange()));
    917 
    918     /* Prepare scale-factor slider: */
    919     m_pSliderGuestScreenScale->setMinimum(100);
    920     m_pSliderGuestScreenScale->setMaximum(200);
    921     m_pSliderGuestScreenScale->setPageStep(10);
    922     m_pSliderGuestScreenScale->setSingleStep(1);
    923     m_pSliderGuestScreenScale->setTickInterval(10);
    924     m_pSliderGuestScreenScale->setSnappingEnabled(true);
    9251115    connect(m_pSliderGuestScreenScale, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenScaleSliderChange()));
    926 
    927     /* Prepare scale-factor editor: */
    928     m_pEditorGuestScreenScale->setMinimum(100);
    929     m_pEditorGuestScreenScale->setMaximum(200);
    930     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorGuestScreenScale, 5);
    9311116    connect(m_pEditorGuestScreenScale, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenScaleEditorChange()));
    932 
    933     /* Prepare advanced options: */
    9341117    connect(m_pCheckbox3D, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
    9351118#ifdef VBOX_WITH_VIDEOHWACCEL
    9361119    connect(m_pCheckbox2DVideo, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
    9371120#endif
    938 }
    939 
    940 void UIMachineSettingsDisplay::prepareRemoteDisplayTab()
    941 {
    942     /* Prepare check-box: */
     1121
     1122    /* Configure 'Remote Display' connections: */
    9431123    connect(m_pCheckboxRemoteDisplay, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
    944 
    945     /* Prepare port/timeout editors: */
    946     m_pEditorRemoteDisplayPort->setValidator(new QRegExpValidator(QRegExp("(([0-9]{1,5}(\\-[0-9]{1,5}){0,1}),)*([0-9]{1,5}(\\-[0-9]{1,5}){0,1})"), this));
    947     m_pEditorRemoteDisplayTimeout->setValidator(new QIntValidator(this));
    9481124    connect(m_pEditorRemoteDisplayPort, SIGNAL(textChanged(const QString &)), this, SLOT(revalidate()));
    9491125    connect(m_pEditorRemoteDisplayTimeout, SIGNAL(textChanged(const QString &)), this, SLOT(revalidate()));
    9501126
    951     /* Prepare auth-method combo: */
    952     m_pComboRemoteDisplayAuthMethod->insertItem(0, ""); /* KAuthType_Null */
    953     m_pComboRemoteDisplayAuthMethod->insertItem(1, ""); /* KAuthType_External */
    954     m_pComboRemoteDisplayAuthMethod->insertItem(2, ""); /* KAuthType_Guest */
    955 }
    956 
    957 void UIMachineSettingsDisplay::prepareVideoCaptureTab()
    958 {
    959     /* Prepare Video Capture checkbox: */
     1127    /* Configure 'Video Capture' connections: */
    9601128    connect(m_pCheckboxVideoCapture, SIGNAL(toggled(bool)), this, SLOT(sltHandleVideoCaptureCheckboxToggle()));
    961 
    962     /* Prepare filepath selector: */
    963     m_pEditorVideoCapturePath->setEditable(false);
    964     m_pEditorVideoCapturePath->setMode(UIFilePathSelector::Mode_File_Save);
    965 
    966     /* Prepare frame-size combo-box: */
    967     m_pComboVideoCaptureSize->addItem(""); /* User Defined */
    968     m_pComboVideoCaptureSize->addItem("320 x 200 (16:10)",   QSize(320, 200));
    969     m_pComboVideoCaptureSize->addItem("640 x 480 (4:3)",     QSize(640, 480));
    970     m_pComboVideoCaptureSize->addItem("720 x 400 (9:5)",     QSize(720, 400));
    971     m_pComboVideoCaptureSize->addItem("720 x 480 (3:2)",     QSize(720, 480));
    972     m_pComboVideoCaptureSize->addItem("800 x 600 (4:3)",     QSize(800, 600));
    973     m_pComboVideoCaptureSize->addItem("1024 x 768 (4:3)",    QSize(1024, 768));
    974     m_pComboVideoCaptureSize->addItem("1152 x 864 (4:3)",    QSize(1152, 864));
    975     m_pComboVideoCaptureSize->addItem("1280 x 720 (16:9)",   QSize(1280, 720));
    976     m_pComboVideoCaptureSize->addItem("1280 x 800 (16:10)",  QSize(1280, 800));
    977     m_pComboVideoCaptureSize->addItem("1280 x 960 (4:3)",    QSize(1280, 960));
    978     m_pComboVideoCaptureSize->addItem("1280 x 1024 (5:4)",   QSize(1280, 1024));
    979     m_pComboVideoCaptureSize->addItem("1366 x 768 (16:9)",   QSize(1366, 768));
    980     m_pComboVideoCaptureSize->addItem("1440 x 900 (16:10)",  QSize(1440, 900));
    981     m_pComboVideoCaptureSize->addItem("1440 x 1080 (4:3)",   QSize(1440, 1080));
    982     m_pComboVideoCaptureSize->addItem("1600 x 900 (16:9)",   QSize(1600, 900));
    983     m_pComboVideoCaptureSize->addItem("1680 x 1050 (16:10)", QSize(1680, 1050));
    984     m_pComboVideoCaptureSize->addItem("1600 x 1200 (4:3)",   QSize(1600, 1200));
    985     m_pComboVideoCaptureSize->addItem("1920 x 1080 (16:9)",  QSize(1920, 1080));
    986     m_pComboVideoCaptureSize->addItem("1920 x 1200 (16:10)", QSize(1920, 1200));
    987     m_pComboVideoCaptureSize->addItem("1920 x 1440 (4:3)",   QSize(1920, 1440));
    988     m_pComboVideoCaptureSize->addItem("2880 x 1800 (16:10)", QSize(2880, 1800));
    9891129    connect(m_pComboVideoCaptureSize, SIGNAL(currentIndexChanged(int)), this, SLOT(sltHandleVideoCaptureFrameSizeComboboxChange()));
    990 
    991     /* Prepare frame-width/height editors: */
    992     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoCaptureWidth, 5);
    993     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoCaptureHeight, 5);
    994     m_pEditorVideoCaptureWidth->setMinimum(16);
    995     m_pEditorVideoCaptureWidth->setMaximum(2880);
    996     m_pEditorVideoCaptureHeight->setMinimum(16);
    997     m_pEditorVideoCaptureHeight->setMaximum(1800);
    9981130    connect(m_pEditorVideoCaptureWidth, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoCaptureFrameWidthEditorChange()));
    9991131    connect(m_pEditorVideoCaptureHeight, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoCaptureFrameHeightEditorChange()));
    1000 
    1001     /* Prepare frame-rate slider: */
    1002     m_pSliderVideoCaptureFrameRate->setMinimum(1);
    1003     m_pSliderVideoCaptureFrameRate->setMaximum(30);
    1004     m_pSliderVideoCaptureFrameRate->setPageStep(1);
    1005     m_pSliderVideoCaptureFrameRate->setSingleStep(1);
    1006     m_pSliderVideoCaptureFrameRate->setTickInterval(1);
    1007     m_pSliderVideoCaptureFrameRate->setSnappingEnabled(true);
    1008     m_pSliderVideoCaptureFrameRate->setOptimalHint(1, 25);
    1009     m_pSliderVideoCaptureFrameRate->setWarningHint(25, 30);
    10101132    connect(m_pSliderVideoCaptureFrameRate, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoCaptureFrameRateSliderChange()));
    1011 
    1012     /* Prepare frame-rate editor: */
    1013     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoCaptureFrameRate, 3);
    1014     m_pEditorVideoCaptureFrameRate->setMinimum(1);
    1015     m_pEditorVideoCaptureFrameRate->setMaximum(30);
    10161133    connect(m_pEditorVideoCaptureFrameRate, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoCaptureFrameRateEditorChange()));
    1017 
    1018     /* Prepare quality combo-box: */
    1019     m_pContainerLayoutSliderVideoCaptureQuality->setColumnStretch(1, 4);
    1020     m_pContainerLayoutSliderVideoCaptureQuality->setColumnStretch(3, 5);
    1021     m_pSliderVideoCaptureQuality->setMinimum(1);
    1022     m_pSliderVideoCaptureQuality->setMaximum(10);
    1023     m_pSliderVideoCaptureQuality->setPageStep(1);
    1024     m_pSliderVideoCaptureQuality->setSingleStep(1);
    1025     m_pSliderVideoCaptureQuality->setTickInterval(1);
    1026     m_pSliderVideoCaptureQuality->setSnappingEnabled(true);
    1027     m_pSliderVideoCaptureQuality->setOptimalHint(1, 5);
    1028     m_pSliderVideoCaptureQuality->setWarningHint(5, 9);
    1029     m_pSliderVideoCaptureQuality->setErrorHint(9, 10);
    10301134    connect(m_pSliderVideoCaptureQuality, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoCaptureQualitySliderChange()));
    1031 
    1032     /* Prepare bit-rate editor: */
    1033     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorVideoCaptureBitRate, 5);
    1034     m_pEditorVideoCaptureBitRate->setMinimum(32);
    1035     m_pEditorVideoCaptureBitRate->setMaximum(2048);
    10361135    connect(m_pEditorVideoCaptureBitRate, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoCaptureBitRateEditorChange()));
     1136}
     1137
     1138void UIMachineSettingsDisplay::cleanup()
     1139{
     1140    /* Cleanup cache: */
     1141    delete m_pCache;
     1142    m_pCache = 0;
    10371143}
    10381144
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r66246 r66345  
    121121    void prepare();
    122122    /** Prepares 'Screen' tab. */
    123     void prepareScreenTab();
     123    void prepareTabScreen();
    124124    /** Prepares 'Remote Display' tab. */
    125     void prepareRemoteDisplayTab();
     125    void prepareTabRemoteDisplay();
    126126    /** Prepares 'Video Capture' tab. */
    127     void prepareVideoCaptureTab();
     127    void prepareTabVideoCapture();
     128    /** Prepares connections. */
     129    void prepareConnections();
     130    /** Cleanups all. */
     131    void cleanup();
    128132
    129133    /** Checks the VRAM requirements. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r66246 r66345  
    120120    , m_fEncryptionCipherChanged(false)
    121121    , m_fEncryptionPasswordChanged(false)
    122     , m_pCache(new UISettingsCacheMachineGeneral)
     122    , m_pCache(0)
    123123{
    124124    /* Prepare: */
    125125    prepare();
    126 
    127     /* Translate: */
    128     retranslateUi();
    129126}
    130127
    131128UIMachineSettingsGeneral::~UIMachineSettingsGeneral()
    132129{
    133     /* Cleanup cache: */
    134     delete m_pCache;
    135     m_pCache = 0;
     130    /* Cleanup: */
     131    cleanup();
    136132}
    137133
     
    630626    Ui::UIMachineSettingsGeneral::setupUi(this);
    631627
    632     /* Prepare tabs: */
    633     prepareTabBasic();
    634     prepareTabAdvanced();
    635     prepareTabDescription();
    636     prepareTabEncryption();
     628    /* Prepare cache: */
     629    m_pCache = new UISettingsCacheMachineGeneral;
     630    AssertPtrReturnVoid(m_pCache);
     631
     632    /* Tree-widget created in the .ui file. */
     633    {
     634        /* Prepare 'Basic' tab: */
     635        prepareTabBasic();
     636        /* Prepare 'Advanced' tab: */
     637        prepareTabAdvanced();
     638        /* Prepare 'Description' tab: */
     639        prepareTabDescription();
     640        /* Prepare 'Encryption' tab: */
     641        prepareTabEncryption();
     642        /* Prepare connections: */
     643        prepareConnections();
     644    }
     645
     646    /* Apply language settings: */
     647    retranslateUi();
    637648}
    638649
    639650void UIMachineSettingsGeneral::prepareTabBasic()
    640651{
    641     /* Name and OS Type widget was created in the .ui file: */
    642     AssertPtrReturnVoid(m_pNameAndSystemEditor);
    643     {
    644         /* Configure Name and OS Type widget: */
    645         m_pNameAndSystemEditor->nameEditor()->setValidator(new QRegExpValidator(QRegExp(".+"), this));
    646         connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(revalidate()));
    647         connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), this, SLOT(revalidate()));
     652    /* Tab and it's layout created in the .ui file. */
     653    {
     654        /* Name and OS Type widget created in the .ui file. */
     655        AssertPtrReturnVoid(m_pNameAndSystemEditor);
     656        {
     657            /* Configure widget: */
     658            m_pNameAndSystemEditor->nameEditor()->setValidator(new QRegExpValidator(QRegExp(".+"), this));
     659        }
    648660    }
    649661}
     
    651663void UIMachineSettingsGeneral::prepareTabAdvanced()
    652664{
    653     /* Shared Clipboard mode combo was created in the .ui file: */
    654     AssertPtrReturnVoid(mCbClipboard);
    655     {
    656         /* Configure Shared Clipboard mode combo: */
    657         mCbClipboard->addItem(""); /* KClipboardMode_Disabled */
    658         mCbClipboard->addItem(""); /* KClipboardMode_HostToGuest */
    659         mCbClipboard->addItem(""); /* KClipboardMode_GuestToHost */
    660         mCbClipboard->addItem(""); /* KClipboardMode_Bidirectional */
    661     }
    662     /* Drag&drop mode combo was created in the .ui file: */
    663     AssertPtrReturnVoid(mCbDragAndDrop);
    664     {
    665         /* Configure Drag&drop mode combo: */
    666         mCbDragAndDrop->addItem(""); /* KDnDMode_Disabled */
    667         mCbDragAndDrop->addItem(""); /* KDnDMode_HostToGuest */
    668         mCbDragAndDrop->addItem(""); /* KDnDMode_GuestToHost */
    669         mCbDragAndDrop->addItem(""); /* KDnDMode_Bidirectional */
     665    /* Tab and it's layout created in the .ui file. */
     666    {
     667        /* Shared Clipboard Mode combo-box created in the .ui file. */
     668        AssertPtrReturnVoid(mCbClipboard);
     669        {
     670            /* Configure combo-box: */
     671            mCbClipboard->addItem(""); /* KClipboardMode_Disabled */
     672            mCbClipboard->addItem(""); /* KClipboardMode_HostToGuest */
     673            mCbClipboard->addItem(""); /* KClipboardMode_GuestToHost */
     674            mCbClipboard->addItem(""); /* KClipboardMode_Bidirectional */
     675        }
     676
     677        /* Drag&drop Mode combo-box created in the .ui file. */
     678        AssertPtrReturnVoid(mCbDragAndDrop);
     679        {
     680            /* Configure combo-box: */
     681            mCbDragAndDrop->addItem(""); /* KDnDMode_Disabled */
     682            mCbDragAndDrop->addItem(""); /* KDnDMode_HostToGuest */
     683            mCbDragAndDrop->addItem(""); /* KDnDMode_GuestToHost */
     684            mCbDragAndDrop->addItem(""); /* KDnDMode_Bidirectional */
     685        }
    670686    }
    671687}
     
    673689void UIMachineSettingsGeneral::prepareTabDescription()
    674690{
    675     /* Description text editor was created in the .ui file: */
    676     AssertPtrReturnVoid(mTeDescription);
    677     {
    678         /* Configure Description text editor: */
     691    /* Tab and it's layout created in the .ui file. */
     692    {
     693        /* Description Text editor created in the .ui file. */
     694        AssertPtrReturnVoid(mTeDescription);
     695        {
     696            /* Configure editor: */
    679697#ifdef VBOX_WS_MAC
    680         mTeDescription->setMinimumHeight(150);
     698            mTeDescription->setMinimumHeight(150);
    681699#endif
     700        }
    682701    }
    683702}
     
    685704void UIMachineSettingsGeneral::prepareTabEncryption()
    686705{
    687     /* Encryption check-box was created in the .ui file: */
    688     AssertPtrReturnVoid(m_pCheckBoxEncryption);
    689     {
    690         /* Configure Encryption check-box: */
    691         connect(m_pCheckBoxEncryption, SIGNAL(toggled(bool)),
    692                 this, SLOT(revalidate()));
    693     }
    694     /* Encryption Cipher combo was created in the .ui file: */
    695     AssertPtrReturnVoid(m_pComboCipher);
    696     {
    697         /* Configure Encryption Cipher combo: */
    698         m_encryptionCiphers << QString()
    699                             << "AES-XTS256-PLAIN64"
    700                             << "AES-XTS128-PLAIN64";
    701         m_pComboCipher->addItems(m_encryptionCiphers);
    702         connect(m_pComboCipher, SIGNAL(currentIndexChanged(int)),
    703                 this, SLOT(sltMarkEncryptionCipherChanged()));
    704         connect(m_pComboCipher, SIGNAL(currentIndexChanged(int)),
    705                 this, SLOT(revalidate()));
    706     }
    707     /* Encryption Password editor was created in the .ui file: */
    708     AssertPtrReturnVoid(m_pEditorEncryptionPassword);
    709     {
    710         /* Configure Encryption Password editor: */
    711         m_pEditorEncryptionPassword->setEchoMode(QLineEdit::Password);
    712         connect(m_pEditorEncryptionPassword, SIGNAL(textEdited(const QString&)),
    713                 this, SLOT(sltMarkEncryptionPasswordChanged()));
    714         connect(m_pEditorEncryptionPassword, SIGNAL(textEdited(const QString&)),
    715                 this, SLOT(revalidate()));
    716     }
    717     /* Encryption Password Confirmation editor was created in the .ui file: */
    718     AssertPtrReturnVoid(m_pEditorEncryptionPasswordConfirm);
    719     {
    720         /* Configure Encryption Password Confirmation editor: */
    721         m_pEditorEncryptionPasswordConfirm->setEchoMode(QLineEdit::Password);
    722         connect(m_pEditorEncryptionPasswordConfirm, SIGNAL(textEdited(const QString&)),
    723                 this, SLOT(sltMarkEncryptionPasswordChanged()));
    724         connect(m_pEditorEncryptionPasswordConfirm, SIGNAL(textEdited(const QString&)),
    725                 this, SLOT(revalidate()));
    726     }
    727 }
    728 
     706    /* Tab and it's layout created in the .ui file. */
     707    {
     708        /* Encryption Cipher combo-box created in the .ui file. */
     709        AssertPtrReturnVoid(m_pComboCipher);
     710        {
     711            /* Configure combo-box: */
     712            m_encryptionCiphers << QString()
     713                                << "AES-XTS256-PLAIN64"
     714                                << "AES-XTS128-PLAIN64";
     715            m_pComboCipher->addItems(m_encryptionCiphers);
     716        }
     717
     718        /* Encryption Password editor created in the .ui file. */
     719        AssertPtrReturnVoid(m_pEditorEncryptionPassword);
     720        {
     721            /* Configure editor: */
     722            m_pEditorEncryptionPassword->setEchoMode(QLineEdit::Password);
     723        }
     724
     725        /* Encryption Password Confirmation editor created in the .ui file. */
     726        AssertPtrReturnVoid(m_pEditorEncryptionPasswordConfirm);
     727        {
     728            /* Configure editor: */
     729            m_pEditorEncryptionPasswordConfirm->setEchoMode(QLineEdit::Password);
     730        }
     731    }
     732}
     733
     734void UIMachineSettingsGeneral::prepareConnections()
     735{
     736    /* Configure 'Basic' connections: */
     737    connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()),
     738            this, SLOT(revalidate()));
     739    connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString &)),
     740            this, SLOT(revalidate()));
     741
     742    /* Configure 'Encryption' connections: */
     743    connect(m_pCheckBoxEncryption, SIGNAL(toggled(bool)),
     744            this, SLOT(revalidate()));
     745    connect(m_pComboCipher, SIGNAL(currentIndexChanged(int)),
     746            this, SLOT(sltMarkEncryptionCipherChanged()));
     747    connect(m_pComboCipher, SIGNAL(currentIndexChanged(int)),
     748            this, SLOT(revalidate()));
     749    connect(m_pEditorEncryptionPassword, SIGNAL(textEdited(const QString&)),
     750            this, SLOT(sltMarkEncryptionPasswordChanged()));
     751    connect(m_pEditorEncryptionPassword, SIGNAL(textEdited(const QString&)),
     752            this, SLOT(revalidate()));
     753    connect(m_pEditorEncryptionPasswordConfirm, SIGNAL(textEdited(const QString&)),
     754            this, SLOT(sltMarkEncryptionPasswordChanged()));
     755    connect(m_pEditorEncryptionPasswordConfirm, SIGNAL(textEdited(const QString&)),
     756            this, SLOT(revalidate()));
     757}
     758
     759void UIMachineSettingsGeneral::cleanup()
     760{
     761    /* Cleanup cache: */
     762    delete m_pCache;
     763    m_pCache = 0;
     764}
     765
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r66246 r66345  
    104104    /** Prepares 'Encryption' tab. */
    105105    void prepareTabEncryption();
     106    /** Prepares connections. */
     107    void prepareConnections();
     108    /** Cleanups all. */
     109    void cleanup();
    106110
    107111    /** Holds whether HW virtualization extension is enabled. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp

    r66245 r66345  
    137137    : m_strMachineId(strMachineId)
    138138    , m_pActionPool(0)
    139     , m_pCache(new UISettingsCacheMachineInterface)
     139    , m_pCache(0)
    140140{
    141141    /* Prepare: */
     
    339339    Ui::UIMachineSettingsInterface::setupUi(this);
    340340
    341     /* Create personal action-pool: */
    342     m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime);
    343     m_pMenuBarEditor->setActionPool(m_pActionPool);
    344 
    345     /* Assign corresponding machine ID: */
    346     m_pMenuBarEditor->setMachineID(m_strMachineId);
    347     m_pStatusBarEditor->setMachineID(m_strMachineId);
    348 
    349     /* Translate finally: */
     341    /* Prepare cache: */
     342    m_pCache = new UISettingsCacheMachineInterface;
     343    AssertPtrReturnVoid(m_pCache);
     344
     345    /* Layout created in the .ui file. */
     346    {
     347        /* Menu-bar editor created in the .ui file. */
     348        AssertPtrReturnVoid(m_pMenuBarEditor);
     349        {
     350            /* Configure editor: */
     351            m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime);
     352            m_pMenuBarEditor->setActionPool(m_pActionPool);
     353            m_pMenuBarEditor->setMachineID(m_strMachineId);
     354        }
     355
     356        /* Status-bar editor created in the .ui file. */
     357        AssertPtrReturnVoid(m_pStatusBarEditor);
     358        {
     359            /* Configure editor: */
     360            m_pStatusBarEditor->setMachineID(m_strMachineId);
     361        }
     362    }
     363
     364    /* Apply language settings: */
    350365    retranslateUi();
    351366}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h

    r66246 r66345  
    7171    /** Prepares all. */
    7272    void prepare();
    73 
    7473    /** Cleanups all. */
    7574    void cleanup();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r66246 r66345  
    269269    prepareValidation();
    270270
    271     /* Applying language settings: */
     271    /* Apply language settings: */
    272272    retranslateUi();
    273273}
     
    10011001
    10021002UIMachineSettingsNetworkPage::UIMachineSettingsNetworkPage()
    1003     : m_pTabWidgetAdapters(0)
    1004     , m_pCache(new UISettingsCacheMachineNetwork)
    1005 {
    1006     /* Setup main layout: */
    1007     QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    1008     pMainLayout->setContentsMargins(0, 5, 0, 5);
    1009 
    1010     /* Creating tab-widget: */
    1011     m_pTabWidgetAdapters = new QITabWidget(this);
    1012     pMainLayout->addWidget(m_pTabWidgetAdapters);
    1013 
    1014     /* How many adapters to display: */
    1015     /** @todo r=klaus this needs to be done based on the actual chipset type of the VM,
    1016      * but in this place the m_machine field isn't set yet. My observation (on Linux)
    1017      * is that the limitation to 4 isn't necessary any more, but this needs to be checked
    1018      * on all platforms to be certain that it's usable everywhere. */
    1019     ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3));
    1020     /* Add corresponding tab pages to parent tab widget: */
    1021     for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
    1022     {
    1023         /* Creating adapter tab: */
    1024         UIMachineSettingsNetwork *pTab = new UIMachineSettingsNetwork(this);
    1025         connect(pTab, SIGNAL(sigNotifyAdvancedButtonStateChange(bool)),
    1026                 this, SLOT(sltHandleAdvancedButtonStateChange(bool)));
    1027         m_pTabWidgetAdapters->addTab(pTab, pTab->tabTitle());
    1028     }
     1003    : m_pTabWidget(0)
     1004    , m_pCache(0)
     1005{
     1006    /* Prepare: */
     1007    prepare();
    10291008}
    10301009
    10311010UIMachineSettingsNetworkPage::~UIMachineSettingsNetworkPage()
    10321011{
    1033     /* Cleanup cache: */
    1034     delete m_pCache;
    1035     m_pCache = 0;
     1012    /* Cleanup: */
     1013    cleanup();
    10361014}
    10371015
     
    10571035
    10581036    /* For each network adapter: */
    1059     for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
     1037    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
    10601038    {
    10611039        /* Prepare adapter data: */
     
    11101088    /* Setup tab order: */
    11111089    Assert(firstWidget());
    1112     setTabOrder(firstWidget(), m_pTabWidgetAdapters->focusProxy());
    1113     QWidget *pLastFocusWidget = m_pTabWidgetAdapters->focusProxy();
     1090    setTabOrder(firstWidget(), m_pTabWidget->focusProxy());
     1091    QWidget *pLastFocusWidget = m_pTabWidget->focusProxy();
    11141092
    11151093    /* For each network adapter: */
    1116     for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
     1094    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
    11171095    {
    11181096        /* Get adapter page: */
    1119         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
     1097        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot));
    11201098
    11211099        /* Load adapter data to page: */
     
    11261104    }
    11271105
    1128     /* Applying language settings: */
     1106    /* Apply language settings: */
    11291107    retranslateUi();
    11301108
     
    11391117{
    11401118    /* For each network adapter: */
    1141     for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
     1119    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
    11421120    {
    11431121        /* Get adapter page: */
    1144         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
     1122        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot));
    11451123
    11461124        /* Gather & cache adapter data: */
     
    11581136    {
    11591137        /* For each network adapter: */
    1160         for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
     1138        for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
    11611139        {
    11621140            /* Check if adapter data was changed: */
     
    12401218
    12411219    /* Delegate validation to adapter tabs: */
    1242     for (int i = 0; i < m_pTabWidgetAdapters->count(); ++i)
    1243     {
    1244         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(i));
     1220    for (int i = 0; i < m_pTabWidget->count(); ++i)
     1221    {
     1222        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(i));
    12451223        AssertMsg(pTab, ("Can't get adapter tab!\n"));
    12461224        if (!pTab->validate(messages))
     
    12541232void UIMachineSettingsNetworkPage::retranslateUi()
    12551233{
    1256     for (int i = 0; i < m_pTabWidgetAdapters->count(); ++i)
    1257     {
    1258         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(i));
     1234    for (int i = 0; i < m_pTabWidget->count(); ++i)
     1235    {
     1236        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(i));
    12591237        Assert(pTab);
    1260         m_pTabWidgetAdapters->setTabText(i, pTab->tabTitle());
     1238        m_pTabWidget->setTabText(i, pTab->tabTitle());
    12611239    }
    12621240}
     
    12651243{
    12661244    /* Get the count of network adapter tabs: */
    1267     for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
    1268     {
    1269         m_pTabWidgetAdapters->setTabEnabled(iSlot,
     1245    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
     1246    {
     1247        m_pTabWidget->setTabEnabled(iSlot,
    12701248                                            isMachineOffline() ||
    12711249                                            (isMachineInValidMode() && m_pCache->child(iSlot).base().m_fAdapterEnabled));
    1272         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
     1250        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot));
    12731251        pTab->polishTab();
    12741252    }
     
    13001278
    13011279    /* Update all the tabs except the sender: */
    1302     for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
     1280    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
    13031281    {
    13041282        /* Get the iterated tab: */
    1305         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
    1306         AssertMsg(pTab, ("All the tabs of m_pTabWidgetAdapters should be of the UIMachineSettingsNetwork type!\n"));
     1283        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot));
     1284        AssertMsg(pTab, ("All the tabs of m_pTabWidget should be of the UIMachineSettingsNetwork type!\n"));
    13071285
    13081286        /* Update all the tabs (except sender) with the same attachment type as sender have: */
     
    13151293{
    13161294    /* Update the advanced button states for all the pages: */
    1317     for (int iSlot = 0; iSlot < m_pTabWidgetAdapters->count(); ++iSlot)
    1318     {
    1319         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iSlot));
     1295    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
     1296    {
     1297        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iSlot));
    13201298        pTab->setAdvancedButtonState(fExpanded);
    13211299    }
     1300}
     1301
     1302void UIMachineSettingsNetworkPage::prepare()
     1303{
     1304    /* Prepare cache: */
     1305    m_pCache = new UISettingsCacheMachineNetwork;
     1306    AssertPtrReturnVoid(m_pCache);
     1307
     1308    /* Create main layout: */
     1309    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     1310    AssertPtrReturnVoid(pMainLayout);
     1311    {
     1312        /* Configure layout: */
     1313        pMainLayout->setContentsMargins(0, 5, 0, 5);
     1314
     1315        /* Creating tab-widget: */
     1316        m_pTabWidget = new QITabWidget;
     1317        AssertPtrReturnVoid(m_pTabWidget);
     1318        {
     1319            /* How many adapters to display: */
     1320            /** @todo r=klaus this needs to be done based on the actual chipset type of the VM,
     1321              * but in this place the m_machine field isn't set yet. My observation (on Linux)
     1322              * is that the limitation to 4 isn't necessary any more, but this needs to be checked
     1323              * on all platforms to be certain that it's usable everywhere. */
     1324            const ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3));
     1325
     1326            /* Create corresponding adapter tabs: */
     1327            for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
     1328            {
     1329                /* Create adapter tab: */
     1330                UIMachineSettingsNetwork *pTab = new UIMachineSettingsNetwork(this);
     1331                AssertPtrReturnVoid(pTab);
     1332                {
     1333                    /* Configure tab: */
     1334                    connect(pTab, SIGNAL(sigNotifyAdvancedButtonStateChange(bool)),
     1335                            this, SLOT(sltHandleAdvancedButtonStateChange(bool)));
     1336
     1337                    /* Add tab into tab-widget: */
     1338                    m_pTabWidget->addTab(pTab, pTab->tabTitle());
     1339                }
     1340            }
     1341
     1342            /* Add tab-widget into layout: */
     1343            pMainLayout->addWidget(m_pTabWidget);
     1344        }
     1345    }
     1346}
     1347
     1348void UIMachineSettingsNetworkPage::cleanup()
     1349{
     1350    /* Cleanup cache: */
     1351    delete m_pCache;
     1352    m_pCache = 0;
    13221353}
    13231354
     
    13431374        m_internalNetworkList << otherInternalNetworkList();
    13441375    /* Append internal network list with names from all the tabs: */
    1345     for (int iTab = 0; iTab < m_pTabWidgetAdapters->count(); ++iTab)
    1346     {
    1347         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iTab));
     1376    for (int iTab = 0; iTab < m_pTabWidget->count(); ++iTab)
     1377    {
     1378        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iTab));
    13481379        if (pTab)
    13491380        {
     
    13761407        m_genericDriverList << otherGenericDriverList();
    13771408    /* Append generic driver list with names from all the tabs: */
    1378     for (int iTab = 0; iTab < m_pTabWidgetAdapters->count(); ++iTab)
    1379     {
    1380         UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidgetAdapters->widget(iTab));
     1409    for (int iTab = 0; iTab < m_pTabWidget->count(); ++iTab)
     1410    {
     1411        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTabWidget->widget(iTab));
    13811412        if (pTab)
    13821413        {
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h

    r66246 r66345  
    9494private:
    9595
     96    /** Prepares all. */
     97    void prepare();
     98    /** Cleanups all. */
     99    void cleanup();
     100
    96101    /** Repopulates bridged adapter list. */
    97102    void refreshBridgedAdapterList();
     
    115120
    116121    /** Holds the tab-widget instance. */
    117     QITabWidget *m_pTabWidgetAdapters;
     122    QITabWidget *m_pTabWidget;
    118123
    119124    /** Holds the bridged adapter list. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp

    r66246 r66345  
    287287
    288288UIMachineSettingsParallelPage::UIMachineSettingsParallelPage()
    289     : mTabWidget(0)
    290     , m_pCache(new UISettingsCacheMachineParallel)
    291 {
    292     /* TabWidget creation */
    293     mTabWidget = new QITabWidget (this);
    294     QVBoxLayout *layout = new QVBoxLayout (this);
    295     layout->setContentsMargins (0, 5, 0, 5);
    296     layout->addWidget (mTabWidget);
    297 
    298     /* How many ports to display: */
    299     ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetParallelPortCount();
    300     /* Add corresponding tab pages to parent tab widget: */
    301     for (ulong uPort = 0; uPort < uCount; ++uPort)
    302     {
    303         /* Creating port page: */
    304         UIMachineSettingsParallel *pPage = new UIMachineSettingsParallel(this);
    305         mTabWidget->addTab(pPage, pPage->pageTitle());
    306     }
     289    : m_pTabWidget(0)
     290    , m_pCache(0)
     291{
     292    /* Prepare: */
     293    prepare();
    307294}
    308295
    309296UIMachineSettingsParallelPage::~UIMachineSettingsParallelPage()
    310297{
    311     /* Cleanup cache: */
    312     delete m_pCache;
    313     m_pCache = 0;
     298    /* Cleanup: */
     299    cleanup();
    314300}
    315301
     
    328314
    329315    /* For each parallel port: */
    330     for (int iSlot = 0; iSlot < mTabWidget->count(); ++iSlot)
     316    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
    331317    {
    332318        /* Prepare port data: */
     
    357343    /* Setup tab order: */
    358344    Assert(firstWidget());
    359     setTabOrder(firstWidget(), mTabWidget->focusProxy());
    360     QWidget *pLastFocusWidget = mTabWidget->focusProxy();
     345    setTabOrder(firstWidget(), m_pTabWidget->focusProxy());
     346    QWidget *pLastFocusWidget = m_pTabWidget->focusProxy();
    361347
    362348    /* For each parallel port: */
    363     for (int iPort = 0; iPort < mTabWidget->count(); ++iPort)
     349    for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
    364350    {
    365351        /* Get port page: */
    366         UIMachineSettingsParallel *pPage = qobject_cast<UIMachineSettingsParallel*>(mTabWidget->widget(iPort));
     352        UIMachineSettingsParallel *pPage = qobject_cast<UIMachineSettingsParallel*>(m_pTabWidget->widget(iPort));
    367353
    368354        /* Load port data to page: */
     
    373359    }
    374360
    375     /* Applying language settings: */
     361    /* Apply language settings: */
    376362    retranslateUi();
    377363
     
    386372{
    387373    /* For each parallel port: */
    388     for (int iPort = 0; iPort < mTabWidget->count(); ++iPort)
     374    for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
    389375    {
    390376        /* Getting port page: */
    391         UIMachineSettingsParallel *pPage = qobject_cast<UIMachineSettingsParallel*>(mTabWidget->widget(iPort));
     377        UIMachineSettingsParallel *pPage = qobject_cast<UIMachineSettingsParallel*>(m_pTabWidget->widget(iPort));
    392378
    393379        /* Gather & cache port data: */
     
    405391    {
    406392        /* For each parallel port: */
    407         for (int iPort = 0; iPort < mTabWidget->count(); ++iPort)
     393        for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
    408394        {
    409395            /* Check if port data was changed: */
     
    445431
    446432    /* Validate all the ports: */
    447     for (int iIndex = 0; iIndex < mTabWidget->count(); ++iIndex)
     433    for (int iIndex = 0; iIndex < m_pTabWidget->count(); ++iIndex)
    448434    {
    449435        /* Get current tab/page: */
    450         QWidget *pTab = mTabWidget->widget(iIndex);
     436        QWidget *pTab = m_pTabWidget->widget(iIndex);
    451437        UIMachineSettingsParallel *pPage = static_cast<UIMachineSettingsParallel*>(pTab);
    452438        if (!pPage->mGbParallel->isChecked())
     
    455441        /* Prepare message: */
    456442        UIValidationMessage message;
    457         message.first = vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(pTab)));
     443        message.first = vboxGlobal().removeAccelMark(m_pTabWidget->tabText(m_pTabWidget->indexOf(pTab)));
    458444
    459445        /* Check the port attribute emptiness & uniqueness: */
     
    503489void UIMachineSettingsParallelPage::retranslateUi()
    504490{
    505     for (int i = 0; i < mTabWidget->count(); ++i)
     491    for (int i = 0; i < m_pTabWidget->count(); ++i)
    506492    {
    507493        UIMachineSettingsParallel *pPage =
    508             static_cast<UIMachineSettingsParallel*>(mTabWidget->widget(i));
    509         mTabWidget->setTabText(i, pPage->pageTitle());
     494            static_cast<UIMachineSettingsParallel*>(m_pTabWidget->widget(i));
     495        m_pTabWidget->setTabText(i, pPage->pageTitle());
    510496    }
    511497}
     
    514500{
    515501    /* Get the count of parallel port tabs: */
    516     for (int iPort = 0; iPort < mTabWidget->count(); ++iPort)
    517     {
    518         mTabWidget->setTabEnabled(iPort,
     502    for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
     503    {
     504        m_pTabWidget->setTabEnabled(iPort,
    519505                                  isMachineOffline() ||
    520506                                  (isMachineInValidMode() && m_pCache->child(iPort).base().m_fPortEnabled));
    521         UIMachineSettingsParallel *pTab = qobject_cast<UIMachineSettingsParallel*>(mTabWidget->widget(iPort));
     507        UIMachineSettingsParallel *pTab = qobject_cast<UIMachineSettingsParallel*>(m_pTabWidget->widget(iPort));
    522508        pTab->polishTab();
    523509    }
    524510}
    525511
     512void UIMachineSettingsParallelPage::prepare()
     513{
     514    /* Prepare cache: */
     515    m_pCache = new UISettingsCacheMachineParallel;
     516    AssertPtrReturnVoid(m_pCache);
     517
     518    /* Create main layout: */
     519    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     520    AssertPtrReturnVoid(pMainLayout);
     521    {
     522        /* Configure layout: */
     523        pMainLayout->setContentsMargins(0, 5, 0, 5);
     524
     525        /* Creating tab-widget: */
     526        m_pTabWidget = new QITabWidget;
     527        AssertPtrReturnVoid(m_pTabWidget);
     528        {
     529            /* How many ports to display: */
     530            const ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetParallelPortCount();
     531
     532            /* Create corresponding port tabs: */
     533            for (ulong uPort = 0; uPort < uCount; ++uPort)
     534            {
     535                /* Create port tab: */
     536                UIMachineSettingsParallel *pTab = new UIMachineSettingsParallel(this);
     537                AssertPtrReturnVoid(pTab);
     538                {
     539                    /* Add tab into tab-widget: */
     540                    m_pTabWidget->addTab(pTab, pTab->pageTitle());
     541                }
     542            }
     543
     544            /* Add tab-widget into layout: */
     545            pMainLayout->addWidget(m_pTabWidget);
     546        }
     547    }
     548}
     549
     550void UIMachineSettingsParallelPage::cleanup()
     551{
     552    /* Cleanup cache: */
     553    delete m_pCache;
     554    m_pCache = 0;
     555}
     556
    526557# include "UIMachineSettingsParallel.moc"
    527558
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h

    r66246 r66345  
    7474private:
    7575
     76    /** Prepares all. */
     77    void prepare();
     78    /** Cleanups all. */
     79    void cleanup();
     80
    7681    /** Holds the tab-widget instance. */
    77     QITabWidget *mTabWidget;
     82    QITabWidget *m_pTabWidget;
    7883
    7984    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r66246 r66345  
    239239UIMachineSettingsSF::UIMachineSettingsSF()
    240240    : m_pActionAdd(0), m_pActionEdit(0), m_pActionRemove(0)
    241     , m_pCache(new UISettingsCacheSharedFolders)
    242 {
    243     /* Apply UI decorations */
    244     Ui::UIMachineSettingsSF::setupUi (this);
    245 
    246     /* Prepare actions */
    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",
    256                                             ":/sf_add_disabled_16px.png"));
    257     m_pActionEdit->setIcon(UIIconPool::iconSet(":/sf_edit_16px.png",
    258                                             ":/sf_edit_disabled_16px.png"));
    259     m_pActionRemove->setIcon(UIIconPool::iconSet(":/sf_remove_16px.png",
    260                                             ":/sf_remove_disabled_16px.png"));
    261 
    262     /* Determine icon metric: */
    263     const QStyle *pStyle = QApplication::style();
    264     const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
    265 
    266     /* Prepare tool-bar: */
    267     m_pFoldersToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    268     m_pFoldersToolBar->setOrientation(Qt::Vertical);
    269     m_pFoldersToolBar->addAction(m_pActionAdd);
    270     m_pFoldersToolBar->addAction(m_pActionEdit);
    271     m_pFoldersToolBar->addAction(m_pActionRemove);
    272 
    273     /* Setup connections */
    274 #if QT_VERSION >= 0x050000
    275     mTwFolders->header()->setSectionsMovable(false);
    276 #else /* QT_VERSION < 0x050000 */
    277     mTwFolders->header()->setMovable (false);
    278 #endif /* QT_VERSION < 0x050000 */
    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()));
    282     connect (mTwFolders, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)),
    283              this, SLOT (sltHandleCurrentItemChange (QTreeWidgetItem *)));
    284     connect (mTwFolders, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),
    285              this, SLOT (sltHandleDoubleClick (QTreeWidgetItem *)));
    286     connect (mTwFolders, SIGNAL (customContextMenuRequested (const QPoint &)),
    287              this, SLOT (sltHandleContextMenuRequest (const QPoint &)));
    288 
    289     retranslateUi();
     241    , m_pCache(0)
     242{
     243    /* Prepare: */
     244    prepare();
    290245}
    291246
    292247UIMachineSettingsSF::~UIMachineSettingsSF()
    293248{
    294     /* Cleanup cache: */
    295     delete m_pCache;
    296     m_pCache = 0;
     249    /* Cleanup: */
     250    cleanup();
    297251}
    298252
     
    593547}
    594548
    595 void UIMachineSettingsSF::sltDeleteSharedFolder()
     549void UIMachineSettingsSF::sltRemoveSharedFolder()
    596550{
    597551    QTreeWidgetItem *pSelectedItem = mTwFolders->selectedItems().size() == 1 ? mTwFolders->selectedItems()[0] : 0;
     
    680634        }
    681635    }
     636}
     637
     638void UIMachineSettingsSF::prepare()
     639{
     640    /* Apply UI decorations: */
     641    Ui::UIMachineSettingsSF::setupUi(this);
     642
     643    /* Prepare cache: */
     644    m_pCache = new UISettingsCacheSharedFolders;
     645    AssertPtrReturnVoid(m_pCache);
     646
     647    /* Layout created in the .ui file. */
     648    {
     649        /* Prepare shared folders tree: */
     650        prepareFoldersTree();
     651        /* Prepare shared folders toolbar: */
     652        prepareFoldersToolbar();
     653        /* Prepare connections: */
     654        prepareConnections();
     655    }
     656
     657    /* Apply language settings: */
     658    retranslateUi();
     659}
     660
     661void UIMachineSettingsSF::prepareFoldersTree()
     662{
     663    /* Shared Folders tree-widget created in the .ui file. */
     664    AssertPtrReturnVoid(mTwFolders);
     665    {
     666        /* Configure tree-widget: */
     667        mTwFolders->header()->setSectionsMovable(false);
     668    }
     669}
     670
     671void UIMachineSettingsSF::prepareFoldersToolbar()
     672{
     673    /* Shared Folders toolbar created in the .ui file. */
     674    AssertPtrReturnVoid(m_pFoldersToolBar);
     675    {
     676        /* Configure toolbar: */
     677        const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
     678        m_pFoldersToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
     679        m_pFoldersToolBar->setOrientation(Qt::Vertical);
     680
     681        /* Create 'Add Shared Folder' action: */
     682        m_pActionAdd = m_pFoldersToolBar->addAction(UIIconPool::iconSet(":/sf_add_16px.png",
     683                                                                        ":/sf_add_disabled_16px.png"),
     684                                                    QString(), this, SLOT(sltAddSharedFolder()));
     685        AssertPtrReturnVoid(m_pActionAdd);
     686        {
     687            /* Configure action: */
     688            m_pActionAdd->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
     689        }
     690
     691        /* Create 'Edit Shared Folder' action: */
     692        m_pActionEdit = m_pFoldersToolBar->addAction(UIIconPool::iconSet(":/sf_edit_16px.png",
     693                                                                         ":/sf_edit_disabled_16px.png"),
     694                                                     QString(), this, SLOT(sltEditSharedFolder()));
     695        AssertPtrReturnVoid(m_pActionEdit);
     696        {
     697            /* Configure action: */
     698            m_pActionEdit->setShortcuts(QList<QKeySequence>() << QKeySequence("Space") << QKeySequence("F2"));
     699        }
     700
     701        /* Create 'Remove Shared Folder' action: */
     702        m_pActionRemove = m_pFoldersToolBar->addAction(UIIconPool::iconSet(":/sf_remove_16px.png",
     703                                                                           ":/sf_remove_disabled_16px.png"),
     704                                                       QString(), this, SLOT(sltRemoveSharedFolder()));
     705        AssertPtrReturnVoid(m_pActionRemove);
     706        {
     707            /* Configure action: */
     708            m_pActionRemove->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
     709        }
     710    }
     711}
     712
     713void UIMachineSettingsSF::prepareConnections()
     714{
     715    /* Configure tree-widget connections: */
     716    connect(mTwFolders, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
     717            this, SLOT(sltHandleCurrentItemChange(QTreeWidgetItem *)));
     718    connect(mTwFolders, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
     719            this, SLOT(sltHandleDoubleClick(QTreeWidgetItem *)));
     720    connect(mTwFolders, SIGNAL(customContextMenuRequested(const QPoint &)),
     721            this, SLOT(sltHandleContextMenuRequest(const QPoint &)));
     722}
     723
     724void UIMachineSettingsSF::cleanup()
     725{
     726    /* Cleanup cache: */
     727    delete m_pCache;
     728    m_pCache = 0;
    682729}
    683730
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h

    r66246 r66345  
    9191    /** Handles command to edit shared folder. */
    9292    void sltEditSharedFolder();
    93     /** Handles command to delete shared folder. */
    94     void sltDeleteSharedFolder();
     93    /** Handles command to remove shared folder. */
     94    void sltRemoveSharedFolder();
    9595
    9696    /** Handles @a pCurrentItem change. */
     
    107107
    108108private:
     109
     110    /** Prepares all. */
     111    void prepare();
     112    /** Prepares shared folders tree. */
     113    void prepareFoldersTree();
     114    /** Prepares shared folders toolbar. */
     115    void prepareFoldersToolbar();
     116    /** Prepares connections. */
     117    void prepareConnections();
     118    /** Cleanups all. */
     119    void cleanup();
    109120
    110121    /** Returns the tree-view root item for corresponding shared folder @a type. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r66246 r66345  
    335335
    336336UIMachineSettingsSerialPage::UIMachineSettingsSerialPage()
    337     : mTabWidget(0)
    338     , m_pCache(new UISettingsCacheMachineSerial)
    339 {
    340     /* TabWidget creation */
    341     mTabWidget = new QITabWidget (this);
    342     QVBoxLayout *layout = new QVBoxLayout (this);
    343     layout->setContentsMargins (0, 5, 0, 5);
    344     layout->addWidget (mTabWidget);
    345 
    346     /* How many ports to display: */
    347     ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount();
    348     /* Add corresponding tab pages to parent tab widget: */
    349     for (ulong uPort = 0; uPort < uCount; ++uPort)
    350     {
    351         /* Creating port page: */
    352         UIMachineSettingsSerial *pPage = new UIMachineSettingsSerial(this);
    353         mTabWidget->addTab(pPage, pPage->pageTitle());
    354     }
     337    : m_pTabWidget(0)
     338    , m_pCache(0)
     339{
     340    /* Prepare: */
     341    prepare();
    355342}
    356343
    357344UIMachineSettingsSerialPage::~UIMachineSettingsSerialPage()
    358345{
    359     /* Cleanup cache: */
    360     delete m_pCache;
    361     m_pCache = 0;
     346    /* Cleanup: */
     347    cleanup();
    362348}
    363349
     
    376362
    377363    /* For each serial port: */
    378     for (int iSlot = 0; iSlot < mTabWidget->count(); ++iSlot)
     364    for (int iSlot = 0; iSlot < m_pTabWidget->count(); ++iSlot)
    379365    {
    380366        /* Prepare port data: */
     
    407393    /* Setup tab order: */
    408394    Assert(firstWidget());
    409     setTabOrder(firstWidget(), mTabWidget->focusProxy());
    410     QWidget *pLastFocusWidget = mTabWidget->focusProxy();
     395    setTabOrder(firstWidget(), m_pTabWidget->focusProxy());
     396    QWidget *pLastFocusWidget = m_pTabWidget->focusProxy();
    411397
    412398    /* For each serial port: */
    413     for (int iPort = 0; iPort < mTabWidget->count(); ++iPort)
     399    for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
    414400    {
    415401        /* Get port page: */
    416         UIMachineSettingsSerial *pPage = qobject_cast<UIMachineSettingsSerial*>(mTabWidget->widget(iPort));
     402        UIMachineSettingsSerial *pPage = qobject_cast<UIMachineSettingsSerial*>(m_pTabWidget->widget(iPort));
    417403
    418404        /* Load port data to page: */
     
    423409    }
    424410
    425     /* Applying language settings: */
     411    /* Apply language settings: */
    426412    retranslateUi();
    427413
     
    436422{
    437423    /* For each serial port: */
    438     for (int iPort = 0; iPort < mTabWidget->count(); ++iPort)
     424    for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
    439425    {
    440426        /* Getting port page: */
    441         UIMachineSettingsSerial *pPage = qobject_cast<UIMachineSettingsSerial*>(mTabWidget->widget(iPort));
     427        UIMachineSettingsSerial *pPage = qobject_cast<UIMachineSettingsSerial*>(m_pTabWidget->widget(iPort));
    442428
    443429        /* Gather & cache port data: */
     
    455441    {
    456442        /* For each serial port: */
    457         for (int iPort = 0; iPort < mTabWidget->count(); ++iPort)
     443        for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
    458444        {
    459445            /* Check if port data was changed: */
     
    500486
    501487    /* Validate all the ports: */
    502     for (int iIndex = 0; iIndex < mTabWidget->count(); ++iIndex)
     488    for (int iIndex = 0; iIndex < m_pTabWidget->count(); ++iIndex)
    503489    {
    504490        /* Get current tab/page: */
    505         QWidget *pTab = mTabWidget->widget(iIndex);
     491        QWidget *pTab = m_pTabWidget->widget(iIndex);
    506492        UIMachineSettingsSerial *pPage = static_cast<UIMachineSettingsSerial*>(pTab);
    507493        if (!pPage->mGbSerial->isChecked())
     
    510496        /* Prepare message: */
    511497        UIValidationMessage message;
    512         message.first = vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(pTab)));
     498        message.first = vboxGlobal().removeAccelMark(m_pTabWidget->tabText(m_pTabWidget->indexOf(pTab)));
    513499
    514500        /* Check the port attribute emptiness & uniqueness: */
     
    565551void UIMachineSettingsSerialPage::retranslateUi()
    566552{
    567     for (int i = 0; i < mTabWidget->count(); ++i)
     553    for (int i = 0; i < m_pTabWidget->count(); ++i)
    568554    {
    569555        UIMachineSettingsSerial *pPage =
    570             static_cast<UIMachineSettingsSerial*>(mTabWidget->widget(i));
    571         mTabWidget->setTabText(i, pPage->pageTitle());
     556            static_cast<UIMachineSettingsSerial*>(m_pTabWidget->widget(i));
     557        m_pTabWidget->setTabText(i, pPage->pageTitle());
    572558    }
    573559}
     
    576562{
    577563    /* Get the count of serial port tabs: */
    578     for (int iPort = 0; iPort < mTabWidget->count(); ++iPort)
    579     {
    580         mTabWidget->setTabEnabled(iPort,
     564    for (int iPort = 0; iPort < m_pTabWidget->count(); ++iPort)
     565    {
     566        m_pTabWidget->setTabEnabled(iPort,
    581567                                  isMachineOffline() ||
    582568                                  (isMachineInValidMode() && m_pCache->child(iPort).base().m_fPortEnabled));
    583         UIMachineSettingsSerial *pTab = qobject_cast<UIMachineSettingsSerial*>(mTabWidget->widget(iPort));
     569        UIMachineSettingsSerial *pTab = qobject_cast<UIMachineSettingsSerial*>(m_pTabWidget->widget(iPort));
    584570        pTab->polishTab();
    585571    }
    586572}
    587573
     574void UIMachineSettingsSerialPage::prepare()
     575{
     576    /* Prepare cache: */
     577    m_pCache = new UISettingsCacheMachineSerial;
     578    AssertPtrReturnVoid(m_pCache);
     579
     580    /* Create main layout: */
     581    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     582    AssertPtrReturnVoid(pMainLayout);
     583    {
     584        /* Configure layout: */
     585        pMainLayout->setContentsMargins(0, 5, 0, 5);
     586
     587        /* Creating tab-widget: */
     588        m_pTabWidget = new QITabWidget;
     589        AssertPtrReturnVoid(m_pTabWidget);
     590        {
     591            /* How many ports to display: */
     592            const ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetSerialPortCount();
     593
     594            /* Create corresponding port tabs: */
     595            for (ulong uPort = 0; uPort < uCount; ++uPort)
     596            {
     597                /* Create port tab: */
     598                UIMachineSettingsSerial *pTab = new UIMachineSettingsSerial(this);
     599                AssertPtrReturnVoid(pTab);
     600                {
     601                    /* Add tab into tab-widget: */
     602                    m_pTabWidget->addTab(pTab, pTab->pageTitle());
     603                }
     604            }
     605
     606            /* Add tab-widget into layout: */
     607            pMainLayout->addWidget(m_pTabWidget);
     608        }
     609    }
     610}
     611
     612void UIMachineSettingsSerialPage::cleanup()
     613{
     614    /* Cleanup cache: */
     615    delete m_pCache;
     616    m_pCache = 0;
     617}
     618
    588619# include "UIMachineSettingsSerial.moc"
    589620
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h

    r66246 r66345  
    7474private:
    7575
     76    /** Prepares all. */
     77    void prepare();
     78    /** Cleanups all. */
     79    void cleanup();
     80
    7681    /** Holds the tab-widget instance. */
    77     QITabWidget *mTabWidget;
     82    QITabWidget *m_pTabWidget;
    7883
    7984    /** Holds the page data cache instance. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r66246 r66345  
    21302130    , m_fPolished(false)
    21312131    , m_fLoadingInProgress(0)
    2132     , m_pCache(new UISettingsCacheMachineStorage)
    2133 {
    2134     /* Apply UI decorations */
    2135     Ui::UIMachineSettingsStorage::setupUi (this);
    2136 
    2137     /* Enumerate Mediums. We need at least the MediaList filled, so this is the
    2138      * lasted point, where we can start. The rest of the media checking is done
    2139      * in a background thread. */
    2140     vboxGlobal().startMediumEnumeration();
    2141 
    2142     /* Create icon-pool: */
    2143     UIIconPoolStorageSettings::create();
    2144 
    2145     /* Controller Actions */
    2146     m_pActionAddController = new QAction (this);
    2147     m_pActionAddController->setIcon(iconPool()->icon(ControllerAddEn, ControllerAddDis));
    2148 
    2149     m_pActionAddControllerIDE = new QAction (this);
    2150     m_pActionAddControllerIDE->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));
    2151 
    2152     m_pActionAddControllerSATA = new QAction (this);
    2153     m_pActionAddControllerSATA->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
    2154 
    2155     m_pActionAddControllerSCSI = new QAction (this);
    2156     m_pActionAddControllerSCSI->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis));
    2157 
    2158     m_pActionAddControllerFloppy = new QAction (this);
    2159     m_pActionAddControllerFloppy->setIcon(iconPool()->icon(FloppyControllerAddEn, FloppyControllerAddDis));
    2160 
    2161     m_pActionAddControllerSAS = new QAction (this);
    2162     m_pActionAddControllerSAS->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
    2163 
    2164     m_pActionAddControllerUSB = new QAction (this);
    2165     m_pActionAddControllerUSB->setIcon(iconPool()->icon(USBControllerAddEn, USBControllerAddDis));
    2166 
    2167     m_pActionAddControllerNVMe = new QAction (this);
    2168     m_pActionAddControllerNVMe->setIcon(iconPool()->icon(NVMeControllerAddEn, NVMeControllerAddDis));
    2169 
    2170     m_pActionRemoveController = new QAction (this);
    2171     m_pActionRemoveController->setIcon(iconPool()->icon(ControllerDelEn, ControllerDelDis));
    2172 
    2173     /* Attachment Actions */
    2174     m_pActionAddAttachment = new QAction (this);
    2175     m_pActionAddAttachment->setIcon(iconPool()->icon(AttachmentAddEn, AttachmentAddDis));
    2176 
    2177     m_pActionAddAttachmentHD = new QAction (this);
    2178     m_pActionAddAttachmentHD->setIcon(iconPool()->icon(HDAttachmentAddEn, HDAttachmentAddDis));
    2179 
    2180     m_pActionAddAttachmentCD = new QAction (this);
    2181     m_pActionAddAttachmentCD->setIcon(iconPool()->icon(CDAttachmentAddEn, CDAttachmentAddDis));
    2182 
    2183     m_pActionAddAttachmentFD = new QAction (this);
    2184     m_pActionAddAttachmentFD->setIcon(iconPool()->icon(FDAttachmentAddEn, FDAttachmentAddDis));
    2185 
    2186     m_pActionRemoveAttachment = new QAction (this);
    2187     m_pActionRemoveAttachment->setIcon(iconPool()->icon(AttachmentDelEn, AttachmentDelDis));
    2188 
    2189     /* Create storage-view: */
    2190     m_pTreeStorage = new QITreeView(this);
    2191     {
    2192         /* Configure storage-view: */
    2193         mLsLeftPane->setBuddy(m_pTreeStorage);
    2194         /* Add storage-view into layout: */
    2195         mLtStorage->insertWidget(0, m_pTreeStorage);
    2196     }
    2197 
    2198     /* Create storage-model: */
    2199     m_pModelStorage = new StorageModel (m_pTreeStorage);
    2200     StorageDelegate *storageDelegate = new StorageDelegate (m_pTreeStorage);
    2201     m_pTreeStorage->setMouseTracking (true);
    2202     m_pTreeStorage->setContextMenuPolicy (Qt::CustomContextMenu);
    2203     m_pTreeStorage->setModel (m_pModelStorage);
    2204     m_pTreeStorage->setItemDelegate (storageDelegate);
    2205     m_pTreeStorage->setRootIndex (m_pModelStorage->root());
    2206     m_pTreeStorage->setCurrentIndex (m_pModelStorage->root());
    2207 
    2208     /* Determine icon metric: */
    2209     const QStyle *pStyle = QApplication::style();
    2210     const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
    2211 
    2212     /* Storage ToolBar */
    2213     mTbStorageBar->setIconSize (QSize (iIconMetric, iIconMetric));
    2214     mTbStorageBar->addAction (m_pActionAddAttachment);
    2215     mTbStorageBar->addAction (m_pActionRemoveAttachment);
    2216     mTbStorageBar->addAction (m_pActionAddController);
    2217     mTbStorageBar->addAction (m_pActionRemoveController);
    2218 
    2219 #ifdef VBOX_WS_MAC
    2220     /* We need a little more space for the focus rect. */
    2221     mLtStorage->setContentsMargins (3, 0, 3, 0);
    2222     mLtStorage->setSpacing (3);
    2223 #endif /* VBOX_WS_MAC */
    2224 
    2225     /* Setup choose-medium button: */
    2226     QMenu *pOpenMediumMenu = new QMenu(mTbOpen);
    2227     mTbOpen->setMenu(pOpenMediumMenu);
    2228 
    2229     /* Controller pane initialization: */
    2230     mSbPortCount->setValue(0);
    2231 
    2232     /* Info Pane initialization */
    2233     mLbHDFormatValue->setFullSizeSelection (true);
    2234     mLbCDFDTypeValue->setFullSizeSelection (true);
    2235     mLbHDVirtualSizeValue->setFullSizeSelection (true);
    2236     mLbHDActualSizeValue->setFullSizeSelection (true);
    2237     mLbSizeValue->setFullSizeSelection (true);
    2238     mLbHDDetailsValue->setFullSizeSelection (true);
    2239     mLbLocationValue->setFullSizeSelection (true);
    2240     mLbUsageValue->setFullSizeSelection (true);
    2241     m_pLabelEncryptionValue->setFullSizeSelection(true);
    2242 
    2243     /* Setup connections: */
    2244     connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const QString&)),
    2245             this, SLOT(sltHandleMediumEnumerated(const QString&)));
    2246     connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString&)),
    2247             this, SLOT(sltHandleMediumDeleted(const QString&)));
    2248     connect (m_pActionAddController, SIGNAL (triggered (bool)), this, SLOT (sltAddController()));
    2249     connect (m_pActionAddControllerIDE, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerIDE()));
    2250     connect (m_pActionAddControllerSATA, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSATA()));
    2251     connect (m_pActionAddControllerSCSI, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSCSI()));
    2252     connect (m_pActionAddControllerSAS, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerSAS()));
    2253     connect (m_pActionAddControllerFloppy, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerFloppy()));
    2254     connect (m_pActionAddControllerUSB, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerUSB()));
    2255     connect (m_pActionAddControllerNVMe, SIGNAL (triggered (bool)), this, SLOT (sltAddControllerNVMe()));
    2256     connect (m_pActionRemoveController, SIGNAL (triggered (bool)), this, SLOT (sltRemoveController()));
    2257     connect (m_pActionAddAttachment, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachment()));
    2258     connect (m_pActionAddAttachmentHD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentHD()));
    2259     connect (m_pActionAddAttachmentCD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentCD()));
    2260     connect (m_pActionAddAttachmentFD, SIGNAL (triggered (bool)), this, SLOT (sltAddAttachmentFD()));
    2261     connect (m_pActionRemoveAttachment, SIGNAL (triggered (bool)), this, SLOT (sltRemoveAttachment()));
    2262     connect (m_pModelStorage, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
    2263              this, SLOT (sltHandleRowInsertion (const QModelIndex&, int)));
    2264     connect (m_pModelStorage, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
    2265              this, SLOT (sltHandleRowRemoval()));
    2266     connect (m_pTreeStorage, SIGNAL (currentItemChanged (const QModelIndex&, const QModelIndex&)),
    2267              this, SLOT (sltHandleCurrentItemChange()));
    2268     connect (m_pTreeStorage, SIGNAL (customContextMenuRequested (const QPoint&)),
    2269              this, SLOT (sltHandleContextMenuRequest (const QPoint&)));
    2270     connect (m_pTreeStorage, SIGNAL (drawItemBranches (QPainter*, const QRect&, const QModelIndex&)),
    2271              this, SLOT (sltHandleDrawItemBranches (QPainter *, const QRect &, const QModelIndex &)));
    2272     connect (m_pTreeStorage, SIGNAL (mouseMoved (QMouseEvent*)),
    2273              this, SLOT (sltHandleMouseMove (QMouseEvent*)));
    2274     connect (m_pTreeStorage, SIGNAL (mousePressed (QMouseEvent*)),
    2275              this, SLOT (sltHandleMouseClick (QMouseEvent*)));
    2276     connect (m_pTreeStorage, SIGNAL (mouseDoubleClicked (QMouseEvent*)),
    2277              this, SLOT (sltHandleMouseClick (QMouseEvent*)));
    2278     connect (mLeName, SIGNAL (textEdited (const QString&)), this, SLOT (sltSetInformation()));
    2279     connect (mCbType, SIGNAL (activated (int)), this, SLOT (sltSetInformation()));
    2280     connect (mCbSlot, SIGNAL (activated (int)), this, SLOT (sltSetInformation()));
    2281     connect (mSbPortCount, SIGNAL (valueChanged (int)), this, SLOT (sltSetInformation()));
    2282     connect (mCbIoCache, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation()));
    2283     connect (m_pMediumIdHolder, SIGNAL (sigChanged()), this, SLOT (sltSetInformation()));
    2284     connect (mTbOpen, SIGNAL (clicked (bool)), mTbOpen, SLOT (showMenu()));
    2285     connect (pOpenMediumMenu, SIGNAL (aboutToShow()), this, SLOT (sltPrepareOpenMediumMenu()));
    2286     connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation()));
    2287     connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation()));
    2288     connect (mCbNonRotational, SIGNAL (stateChanged (int)), this, SLOT (sltSetInformation()));
    2289     connect(m_pCheckBoxHotPluggable, SIGNAL(stateChanged(int)), this, SLOT(sltSetInformation()));
    2290 
    2291     /* Applying language settings */
    2292     retranslateUi();
    2293 
    2294     /* Initial setup */
    2295     setMinimumWidth (500);
    2296     mSplitter->setSizes (QList<int>() << (int) (0.45 * minimumWidth()) << (int) (0.55 * minimumWidth()));
     2132    , m_pCache(0)
     2133{
     2134    /* Prepare: */
     2135    prepare();
    22972136}
    22982137
    22992138UIMachineSettingsStorage::~UIMachineSettingsStorage()
    23002139{
    2301     /* Destroy icon-pool: */
    2302     UIIconPoolStorageSettings::destroy();
    2303 
    2304     /* Cleanup cache: */
    2305     delete m_pCache;
    2306     m_pCache = 0;
     2140    /* Cleanup: */
     2141    cleanup();
    23072142}
    23082143
     
    35553390        }
    35563391    }
     3392}
     3393
     3394void UIMachineSettingsStorage::prepare()
     3395{
     3396    /* Apply UI decorations: */
     3397    Ui::UIMachineSettingsStorage::setupUi(this);
     3398
     3399    /* Prepare cache: */
     3400    m_pCache = new UISettingsCacheMachineStorage;
     3401    AssertPtrReturnVoid(m_pCache);
     3402
     3403    /* Create icon-pool: */
     3404    UIIconPoolStorageSettings::create();
     3405
     3406    /* Enumerate Mediums. We need at least the MediaList filled, so this is the
     3407     * lasted point, where we can start. The rest of the media checking is done
     3408     * in a background thread. */
     3409    vboxGlobal().startMediumEnumeration();
     3410
     3411    /* Layout created in the .ui file. */
     3412    AssertPtrReturnVoid(mLtStorage);
     3413    {
     3414#ifdef VBOX_WS_MAC
     3415        /* We need a little more space for the focus rect: */
     3416        mLtStorage->setContentsMargins(3, 0, 3, 0);
     3417        mLtStorage->setSpacing(3);
     3418#endif
     3419
     3420        /* Prepare storage tree: */
     3421        prepareStorageTree();
     3422        /* Prepare storage toolbar: */
     3423        prepareStorageToolbar();
     3424        /* Prepare storage widgets: */
     3425        prepareStorageWidgets();
     3426        /* Prepare connections: */
     3427        prepareConnections();
     3428    }
     3429
     3430    /* Apply language settings: */
     3431    retranslateUi();
     3432
     3433    /* Initial setup (after first retranslateUi() call): */
     3434    setMinimumWidth(500);
     3435    mSplitter->setSizes(QList<int>() << (int) (0.45 * minimumWidth()) << (int) (0.55 * minimumWidth()));
     3436}
     3437
     3438void UIMachineSettingsStorage::prepareStorageTree()
     3439{
     3440    /* Create storage tree-view: */
     3441    m_pTreeStorage = new QITreeView;
     3442    AssertPtrReturnVoid(m_pTreeStorage);
     3443    AssertPtrReturnVoid(mLsLeftPane);
     3444    {
     3445        /* Configure tree-view: */
     3446        mLsLeftPane->setBuddy(m_pTreeStorage);
     3447        m_pTreeStorage->setMouseTracking(true);
     3448        m_pTreeStorage->setContextMenuPolicy(Qt::CustomContextMenu);
     3449
     3450        /* Create storage model: */
     3451        m_pModelStorage = new StorageModel(m_pTreeStorage);
     3452        AssertPtrReturnVoid(m_pModelStorage);
     3453        {
     3454            /* Configure model: */
     3455            m_pTreeStorage->setModel(m_pModelStorage);
     3456            m_pTreeStorage->setRootIndex(m_pModelStorage->root());
     3457            m_pTreeStorage->setCurrentIndex(m_pModelStorage->root());
     3458        }
     3459
     3460        /* Create storage delegate: */
     3461        StorageDelegate *pStorageDelegate = new StorageDelegate(m_pTreeStorage);
     3462        AssertPtrReturnVoid(pStorageDelegate);
     3463        {
     3464            /* Configure delegate: */
     3465            m_pTreeStorage->setItemDelegate(pStorageDelegate);
     3466        }
     3467
     3468        /* Insert tree-view into layout: */
     3469        mLtStorage->insertWidget(0, m_pTreeStorage);
     3470    }
     3471}
     3472
     3473void UIMachineSettingsStorage::prepareStorageToolbar()
     3474{
     3475    /* Storage toolbar created in the .ui file. */
     3476    AssertPtrReturnVoid(mTbStorageBar);
     3477    {
     3478        /* Configure toolbar: */
     3479        const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
     3480        mTbStorageBar->setIconSize(QSize(iIconMetric, iIconMetric));
     3481
     3482        /* Create 'Add Controller' action: */
     3483        m_pActionAddController = new QAction(this);
     3484        AssertPtrReturnVoid(m_pActionAddController);
     3485        {
     3486            /* Configure action: */
     3487            m_pActionAddController->setIcon(iconPool()->icon(ControllerAddEn, ControllerAddDis));
     3488
     3489            /* Add action into toolbar: */
     3490            mTbStorageBar->addAction(m_pActionAddController);
     3491        }
     3492
     3493        /* Create 'Add IDE Controller' action: */
     3494        m_pActionAddControllerIDE = new QAction(this);
     3495        AssertPtrReturnVoid(m_pActionAddControllerIDE);
     3496        {
     3497            /* Configure action: */
     3498            m_pActionAddControllerIDE->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));
     3499        }
     3500
     3501        /* Create 'Add SATA Controller' action: */
     3502        m_pActionAddControllerSATA = new QAction(this);
     3503        AssertPtrReturnVoid(m_pActionAddControllerSATA);
     3504        {
     3505            /* Configure action: */
     3506            m_pActionAddControllerSATA->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
     3507        }
     3508
     3509        /* Create 'Add SCSI Controller' action: */
     3510        m_pActionAddControllerSCSI = new QAction(this);
     3511        AssertPtrReturnVoid(m_pActionAddControllerSCSI);
     3512        {
     3513            /* Configure action: */
     3514            m_pActionAddControllerSCSI->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis));
     3515        }
     3516
     3517        /* Create 'Add Floppy Controller' action: */
     3518        m_pActionAddControllerFloppy = new QAction(this);
     3519        AssertPtrReturnVoid(m_pActionAddControllerFloppy);
     3520        {
     3521            /* Configure action: */
     3522            m_pActionAddControllerFloppy->setIcon(iconPool()->icon(FloppyControllerAddEn, FloppyControllerAddDis));
     3523        }
     3524
     3525        /* Create 'Add SAS Controller' action: */
     3526        m_pActionAddControllerSAS = new QAction(this);
     3527        AssertPtrReturnVoid(m_pActionAddControllerSAS);
     3528        {
     3529            /* Configure action: */
     3530            m_pActionAddControllerSAS->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
     3531        }
     3532
     3533        /* Create 'Add USB Controller' action: */
     3534        m_pActionAddControllerUSB = new QAction(this);
     3535        AssertPtrReturnVoid(m_pActionAddControllerUSB);
     3536        {
     3537            /* Configure action: */
     3538            m_pActionAddControllerUSB->setIcon(iconPool()->icon(USBControllerAddEn, USBControllerAddDis));
     3539        }
     3540
     3541        /* Create 'Add NVMe Controller' action: */
     3542        m_pActionAddControllerNVMe = new QAction(this);
     3543        AssertPtrReturnVoid(m_pActionAddControllerNVMe);
     3544        {
     3545            /* Configure action: */
     3546            m_pActionAddControllerNVMe->setIcon(iconPool()->icon(NVMeControllerAddEn, NVMeControllerAddDis));
     3547        }
     3548
     3549        /* Create 'Remove Controller' action: */
     3550        m_pActionRemoveController = new QAction(this);
     3551        AssertPtrReturnVoid(m_pActionRemoveController);
     3552        {
     3553            /* Configure action: */
     3554            m_pActionRemoveController->setIcon(iconPool()->icon(ControllerDelEn, ControllerDelDis));
     3555
     3556            /* Add action into toolbar: */
     3557            mTbStorageBar->addAction(m_pActionRemoveController);
     3558        }
     3559
     3560        /* Create 'Add Attachment' action: */
     3561        m_pActionAddAttachment = new QAction(this);
     3562        AssertPtrReturnVoid(m_pActionAddAttachment);
     3563        {
     3564            /* Configure action: */
     3565            m_pActionAddAttachment->setIcon(iconPool()->icon(AttachmentAddEn, AttachmentAddDis));
     3566
     3567            /* Add action into toolbar: */
     3568            mTbStorageBar->addAction(m_pActionAddAttachment);
     3569        }
     3570
     3571        /* Create 'Add HD Attachment' action: */
     3572        m_pActionAddAttachmentHD = new QAction(this);
     3573        AssertPtrReturnVoid(m_pActionAddAttachmentHD);
     3574        {
     3575            /* Configure action: */
     3576            m_pActionAddAttachmentHD->setIcon(iconPool()->icon(HDAttachmentAddEn, HDAttachmentAddDis));
     3577        }
     3578
     3579        /* Create 'Add CD Attachment' action: */
     3580        m_pActionAddAttachmentCD = new QAction(this);
     3581        AssertPtrReturnVoid(m_pActionAddAttachmentCD);
     3582        {
     3583            /* Configure action: */
     3584            m_pActionAddAttachmentCD->setIcon(iconPool()->icon(CDAttachmentAddEn, CDAttachmentAddDis));
     3585        }
     3586
     3587        /* Create 'Add FD Attachment' action: */
     3588        m_pActionAddAttachmentFD = new QAction(this);
     3589        AssertPtrReturnVoid(m_pActionAddAttachmentFD);
     3590        {
     3591            /* Configure action: */
     3592            m_pActionAddAttachmentFD->setIcon(iconPool()->icon(FDAttachmentAddEn, FDAttachmentAddDis));
     3593        }
     3594
     3595        /* Create 'Remove Attachment' action: */
     3596        m_pActionRemoveAttachment = new QAction(this);
     3597        AssertPtrReturnVoid(m_pActionRemoveAttachment);
     3598        {
     3599            /* Configure action: */
     3600            m_pActionRemoveAttachment->setIcon(iconPool()->icon(AttachmentDelEn, AttachmentDelDis));
     3601
     3602            /* Add action into toolbar: */
     3603            mTbStorageBar->addAction(m_pActionRemoveAttachment);
     3604        }
     3605    }
     3606}
     3607
     3608void UIMachineSettingsStorage::prepareStorageWidgets()
     3609{
     3610    /* Open Medium tool-button created in the .ui file. */
     3611    AssertPtrReturnVoid(mTbOpen);
     3612    {
     3613        /* Create Open Medium menu: */
     3614        QMenu *pOpenMediumMenu = new QMenu(mTbOpen);
     3615        AssertPtrReturnVoid(pOpenMediumMenu);
     3616        {
     3617            /* Add menu into tool-button: */
     3618            mTbOpen->setMenu(pOpenMediumMenu);
     3619        }
     3620    }
     3621
     3622    /* Other widgets created in the .ui file. */
     3623    AssertPtrReturnVoid(mSbPortCount);
     3624    AssertPtrReturnVoid(mLbHDFormatValue);
     3625    AssertPtrReturnVoid(mLbCDFDTypeValue);
     3626    AssertPtrReturnVoid(mLbHDVirtualSizeValue);
     3627    AssertPtrReturnVoid(mLbHDActualSizeValue);
     3628    AssertPtrReturnVoid(mLbSizeValue);
     3629    AssertPtrReturnVoid(mLbHDDetailsValue);
     3630    AssertPtrReturnVoid(mLbLocationValue);
     3631    AssertPtrReturnVoid(mLbUsageValue);
     3632    AssertPtrReturnVoid(m_pLabelEncryptionValue);
     3633    {
     3634        /* Configure widgets: */
     3635        mSbPortCount->setValue(0);
     3636        mLbHDFormatValue->setFullSizeSelection(true);
     3637        mLbCDFDTypeValue->setFullSizeSelection(true);
     3638        mLbHDVirtualSizeValue->setFullSizeSelection(true);
     3639        mLbHDActualSizeValue->setFullSizeSelection(true);
     3640        mLbSizeValue->setFullSizeSelection(true);
     3641        mLbHDDetailsValue->setFullSizeSelection(true);
     3642        mLbLocationValue->setFullSizeSelection(true);
     3643        mLbUsageValue->setFullSizeSelection(true);
     3644        m_pLabelEncryptionValue->setFullSizeSelection(true);
     3645    }
     3646}
     3647
     3648void UIMachineSettingsStorage::prepareConnections()
     3649{
     3650    /* Configure this: */
     3651    connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const QString &)),
     3652            this, SLOT(sltHandleMediumEnumerated(const QString &)));
     3653    connect(&vboxGlobal(), SIGNAL(sigMediumDeleted(const QString &)),
     3654            this, SLOT(sltHandleMediumDeleted(const QString &)));
     3655
     3656    /* Configure tree-view: */
     3657    connect(m_pTreeStorage, SIGNAL(currentItemChanged(const QModelIndex &, const QModelIndex &)),
     3658             this, SLOT(sltHandleCurrentItemChange()));
     3659    connect(m_pTreeStorage, SIGNAL(customContextMenuRequested(const QPoint &)),
     3660             this, SLOT(sltHandleContextMenuRequest(const QPoint &)));
     3661    connect(m_pTreeStorage, SIGNAL(drawItemBranches(QPainter *, const QRect &, const QModelIndex &)),
     3662             this, SLOT(sltHandleDrawItemBranches(QPainter *, const QRect &, const QModelIndex &)));
     3663    connect(m_pTreeStorage, SIGNAL(mouseMoved(QMouseEvent *)),
     3664             this, SLOT(sltHandleMouseMove(QMouseEvent *)));
     3665    connect(m_pTreeStorage, SIGNAL(mousePressed(QMouseEvent *)),
     3666             this, SLOT(sltHandleMouseClick(QMouseEvent *)));
     3667    connect(m_pTreeStorage, SIGNAL(mouseDoubleClicked(QMouseEvent *)),
     3668             this, SLOT(sltHandleMouseClick(QMouseEvent *)));
     3669
     3670    /* Create model: */
     3671    connect(m_pModelStorage, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
     3672            this, SLOT(sltHandleRowInsertion(const QModelIndex &, int)));
     3673    connect(m_pModelStorage, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
     3674            this, SLOT(sltHandleRowRemoval()));
     3675
     3676    /* Configure actions: */
     3677    connect(m_pActionAddController, SIGNAL(triggered(bool)), this, SLOT(sltAddController()));
     3678    connect(m_pActionAddControllerIDE, SIGNAL(triggered(bool)), this, SLOT(sltAddControllerIDE()));
     3679    connect(m_pActionAddControllerSATA, SIGNAL(triggered(bool)), this, SLOT(sltAddControllerSATA()));
     3680    connect(m_pActionAddControllerSCSI, SIGNAL(triggered(bool)), this, SLOT(sltAddControllerSCSI()));
     3681    connect(m_pActionAddControllerFloppy, SIGNAL(triggered(bool)), this, SLOT(sltAddControllerFloppy()));
     3682    connect(m_pActionAddControllerSAS, SIGNAL(triggered(bool)), this, SLOT(sltAddControllerSAS()));
     3683    connect(m_pActionAddControllerUSB, SIGNAL(triggered(bool)), this, SLOT(sltAddControllerUSB()));
     3684    connect(m_pActionAddControllerNVMe, SIGNAL(triggered(bool)), this, SLOT(sltAddControllerNVMe()));
     3685    connect(m_pActionRemoveController, SIGNAL(triggered(bool)), this, SLOT(sltRemoveController()));
     3686    connect(m_pActionAddAttachment, SIGNAL(triggered(bool)), this, SLOT(sltAddAttachment()));
     3687    connect(m_pActionAddAttachmentHD, SIGNAL(triggered(bool)), this, SLOT(sltAddAttachmentHD()));
     3688    connect(m_pActionAddAttachmentCD, SIGNAL(triggered(bool)), this, SLOT(sltAddAttachmentCD()));
     3689    connect(m_pActionAddAttachmentFD, SIGNAL(triggered(bool)), this, SLOT(sltAddAttachmentFD()));
     3690    connect(m_pActionRemoveAttachment, SIGNAL(triggered(bool)), this, SLOT(sltRemoveAttachment()));
     3691
     3692    /* Configure tool-button: */
     3693    connect(mTbOpen, SIGNAL(clicked(bool)), mTbOpen, SLOT(showMenu()));
     3694    /* Configure menu: */
     3695    connect(mTbOpen->menu(), SIGNAL(aboutToShow()), this, SLOT(sltPrepareOpenMediumMenu()));
     3696
     3697    /* Configure widgets: */
     3698    connect(m_pMediumIdHolder, SIGNAL(sigChanged()), this, SLOT(sltSetInformation()));
     3699    connect(mSbPortCount, SIGNAL(valueChanged(int)), this, SLOT(sltSetInformation()));
     3700    connect(mLeName, SIGNAL(textEdited(const QString &)), this, SLOT(sltSetInformation()));
     3701    connect(mCbType, SIGNAL(activated(int)), this, SLOT(sltSetInformation()));
     3702    connect(mCbSlot, SIGNAL(activated(int)), this, SLOT(sltSetInformation()));
     3703    connect(mCbIoCache, SIGNAL(stateChanged(int)), this, SLOT(sltSetInformation()));
     3704    connect(mCbPassthrough, SIGNAL(stateChanged(int)), this, SLOT(sltSetInformation()));
     3705    connect(mCbTempEject, SIGNAL(stateChanged(int)), this, SLOT(sltSetInformation()));
     3706    connect(mCbNonRotational, SIGNAL(stateChanged(int)), this, SLOT(sltSetInformation()));
     3707    connect(m_pCheckBoxHotPluggable, SIGNAL(stateChanged(int)), this, SLOT(sltSetInformation()));
     3708}
     3709
     3710void UIMachineSettingsStorage::cleanup()
     3711{
     3712    /* Destroy icon-pool: */
     3713    UIIconPoolStorageSettings::destroy();
     3714
     3715    /* Cleanup cache: */
     3716    delete m_pCache;
     3717    m_pCache = 0;
    35573718}
    35583719
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r66246 r66345  
    727727
    728728private:
     729
     730    /** Prepares all. */
     731    void prepare();
     732    /** Prepares storage tree. */
     733    void prepareStorageTree();
     734    /** Prepares storage toolbar. */
     735    void prepareStorageToolbar();
     736    /** Prepares storage widgets. */
     737    void prepareStorageWidgets();
     738    /** Prepares connections. */
     739    void prepareConnections();
     740    /** Cleanups all. */
     741    void cleanup();
    729742
    730743    /** Adds controller with @a strName, @a enmBus and @a enmType. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r66246 r66345  
    161161    , m_uMinGuestCPUExecCap(0), m_uMedGuestCPUExecCap(0), m_uMaxGuestCPUExecCap(0)
    162162    , m_fIsUSBEnabled(false)
    163     , m_pCache(new UISettingsCacheMachineSystem)
     163    , m_pCache(0)
    164164{
    165165    /* Prepare: */
     
    169169UIMachineSettingsSystem::~UIMachineSettingsSystem()
    170170{
    171     /* Cleanup cache: */
    172     delete m_pCache;
    173     m_pCache = 0;
     171    /* Cleanup: */
     172    cleanup();
    174173}
    175174
     
    756755    Ui::UIMachineSettingsSystem::setupUi(this);
    757756
    758     /* Prepare tabs: */
    759     prepareTabMotherboard();
    760     prepareTabProcessor();
    761     prepareTabAcceleration();
    762 
    763     /* Retranslate finally: */
     757    /* Prepare cache: */
     758    m_pCache = new UISettingsCacheMachineSystem;
     759    AssertPtrReturnVoid(m_pCache);
     760
     761    /* Tree-widget created in the .ui file. */
     762    {
     763        /* Prepare 'Motherboard' tab: */
     764        prepareTabMotherboard();
     765        /* Prepare 'Processor' tab: */
     766        prepareTabProcessor();
     767        /* Prepare 'Acceleration' tab: */
     768        prepareTabAcceleration();
     769        /* Prepare connections: */
     770        prepareConnections();
     771    }
     772
     773    /* Apply language settings: */
    764774    retranslateUi();
    765775}
     
    767777void UIMachineSettingsSystem::prepareTabMotherboard()
    768778{
    769     /* Load configuration: */
     779    /* Tab and it's layout created in the .ui file. */
     780    {
     781        /* Memory Size editor created in the .ui file. */
     782        AssertPtrReturnVoid(m_pEditorMemorySize);
     783        {
     784            /* Configure editor: */
     785            m_pEditorMemorySize->setMinimum(m_pSliderMemorySize->minRAM());
     786            m_pEditorMemorySize->setMaximum(m_pSliderMemorySize->maxRAM());
     787            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorMemorySize, 5);
     788        }
     789
     790        /* Boot-order layout created in the .ui file. */
     791        AssertPtrReturnVoid(m_pLayoutBootOrder);
     792        {
     793            /* Configure layout: */
     794#ifdef VBOX_WS_MAC
     795            /* We need a little space for the focus rect: */
     796            m_pLayoutBootOrder->setContentsMargins(3, 3, 3, 3);
     797            m_pLayoutBootOrder->setSpacing(3);
     798#endif
     799
     800            /* Boot-order tree-widget created in the .ui file. */
     801            AssertPtrReturnVoid(mTwBootOrder);
     802            {
     803                /* Install global event filter to handle
     804                 * boot-table focus in/out events: */
     805                /// @todo Get rid of that *crap*!
     806                qApp->installEventFilter(this);
     807
     808                /* Populate possible boot items list.
     809                 * Currently, it seems, we are supporting only 4 possible boot device types:
     810                 * 1. Floppy, 2. DVD-ROM, 3. Hard Disk, 4. Network.
     811                 * But maximum boot devices count supported by machine
     812                 * should be retrieved through the ISystemProperties getter.
     813                 * Moreover, possible boot device types are not listed in some separate Main vector,
     814                 * so we should get them (randomely?) from the list of all device types.
     815                 * Until there will be separate Main getter for list of supported boot device types,
     816                 * this list will be hard-coded here... */
     817                const CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
     818                const int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition());
     819                for (int iBootPosition = 1; iBootPosition <= iPossibleBootListSize; ++iBootPosition)
     820                {
     821                    switch (iBootPosition)
     822                    {
     823                        case 1: m_possibleBootItems << KDeviceType_Floppy; break;
     824                        case 2: m_possibleBootItems << KDeviceType_DVD; break;
     825                        case 3: m_possibleBootItems << KDeviceType_HardDisk; break;
     826                        case 4: m_possibleBootItems << KDeviceType_Network; break;
     827                        default: break;
     828                    }
     829                }
     830                /* Add all available devices types, so we could initially calculate the right size: */
     831                for (int i = 0; i < m_possibleBootItems.size(); ++i)
     832                {
     833                    QListWidgetItem *pItem = new UIBootTableItem(m_possibleBootItems[i]);
     834                    mTwBootOrder->addItem(pItem);
     835                }
     836            }
     837
     838            /* Boot-order Button-up created in the .ui file. */
     839            AssertPtrReturnVoid(mTbBootItemUp);
     840            {
     841                /* Configure button: */
     842                mTbBootItemUp->setIcon(UIIconPool::iconSet(":/list_moveup_16px.png", ":/list_moveup_disabled_16px.png"));
     843            }
     844
     845            /* Boot-order Button-down created in the .ui file. */
     846            AssertPtrReturnVoid(mTbBootItemUp);
     847            {
     848                /* Configure button: */
     849                mTbBootItemDown->setIcon(UIIconPool::iconSet(":/list_movedown_16px.png", ":/list_movedown_disabled_16px.png"));
     850            }
     851        }
     852
     853        /* Chipset Type combo-box created in the .ui file. */
     854        AssertPtrReturnVoid(m_pComboChipsetType);
     855        {
     856            /* Configure combo-box: */
     857            m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3));
     858            m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9));
     859        }
     860
     861        /* Pointing HID Type combo-box created in the .ui file. */
     862        AssertPtrReturnVoid(m_pComboPointingHIDType);
     863        {
     864            /* Configure combo-box: */
     865            m_pComboPointingHIDType->setSizeAdjustPolicy(QComboBox::AdjustToContents);
     866        }
     867    }
     868}
     869
     870void UIMachineSettingsSystem::prepareTabProcessor()
     871{
     872    /* Prepare common variables: */
    770873    const CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
    771 
    772     /* Preconfigure memory-size editor: */
    773     m_pEditorMemorySize->setMinimum(m_pSliderMemorySize->minRAM());
    774     m_pEditorMemorySize->setMaximum(m_pSliderMemorySize->maxRAM());
    775     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorMemorySize, 5);
    776 
    777     /* Preconfigure boot-table widgets: */
    778     mTbBootItemUp->setIcon(UIIconPool::iconSet(":/list_moveup_16px.png", ":/list_moveup_disabled_16px.png"));
    779     mTbBootItemDown->setIcon(UIIconPool::iconSet(":/list_movedown_16px.png", ":/list_movedown_disabled_16px.png"));
    780 #ifdef VBOX_WS_MAC
    781     /* We need a little space for the focus rect: */
    782     m_pLayoutBootOrder->setContentsMargins(3, 3, 3, 3);
    783     m_pLayoutBootOrder->setSpacing(3);
    784 #endif /* VBOX_WS_MAC */
    785     /* Install global event filter
    786      * to handle boot-table focus in/out events: */
    787     /// @todo Get rid of that *crap*!
    788     qApp->installEventFilter(this);
    789 
    790     /* Populate possible boot items list.
    791      * Currently, it seems, we are supporting only 4 possible boot device types:
    792      * 1. Floppy, 2. DVD-ROM, 3. Hard Disk, 4. Network.
    793      * But maximum boot devices count supported by machine
    794      * should be retrieved through the ISystemProperties getter.
    795      * Moreover, possible boot device types are not listed in some separate Main vector,
    796      * so we should get them (randomely?) from the list of all device types.
    797      * Until there will be separate Main getter for list of supported boot device types,
    798      * this list will be hard-coded here... */
    799     const int iPossibleBootListSize = qMin((ULONG)4, properties.GetMaxBootPosition());
    800     for (int iBootPosition = 1; iBootPosition <= iPossibleBootListSize; ++iBootPosition)
    801     {
    802         switch (iBootPosition)
    803         {
    804             case 1: m_possibleBootItems << KDeviceType_Floppy; break;
    805             case 2: m_possibleBootItems << KDeviceType_DVD; break;
    806             case 3: m_possibleBootItems << KDeviceType_HardDisk; break;
    807             case 4: m_possibleBootItems << KDeviceType_Network; break;
    808             default: break;
    809         }
    810     }
    811     /* Add all available devices types, so we could initially calculate the right size: */
    812     for (int i = 0; i < m_possibleBootItems.size(); ++i)
    813     {
    814         QListWidgetItem *pItem = new UIBootTableItem(m_possibleBootItems[i]);
    815         mTwBootOrder->addItem(pItem);
    816     }
    817 
    818     /* Populate 'chipset type' combo: */
    819     m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_PIIX3), QVariant(KChipsetType_PIIX3));
    820     m_pComboChipsetType->addItem(gpConverter->toString(KChipsetType_ICH9), QVariant(KChipsetType_ICH9));
     874    const uint uHostCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();
     875    m_uMinGuestCPU = properties.GetMinGuestCPUCount();
     876    m_uMaxGuestCPU = qMin(2 * uHostCPUs, (uint)properties.GetMaxGuestCPUCount());
     877    m_uMinGuestCPUExecCap = 1;
     878    m_uMedGuestCPUExecCap = 40;
     879    m_uMaxGuestCPUExecCap = 100;
     880
     881    /* Tab and it's layout created in the .ui file. */
     882    {
     883        /* CPU-count slider created in the .ui file. */
     884        AssertPtrReturnVoid(m_pSliderCPUCount);
     885        {
     886            /* Configure slider: */
     887            m_pSliderCPUCount->setPageStep(1);
     888            m_pSliderCPUCount->setSingleStep(1);
     889            m_pSliderCPUCount->setTickInterval(1);
     890            m_pSliderCPUCount->setMinimum(m_uMinGuestCPU);
     891            m_pSliderCPUCount->setMaximum(m_uMaxGuestCPU);
     892            m_pSliderCPUCount->setOptimalHint(1, uHostCPUs);
     893            m_pSliderCPUCount->setWarningHint(uHostCPUs, m_uMaxGuestCPU);
     894        }
     895
     896        /* CPU-count editor created in the .ui file. */
     897        AssertPtrReturnVoid(m_pEditorCPUCount);
     898        {
     899            /* Configure editor: */
     900            m_pEditorCPUCount->setMinimum(m_uMinGuestCPU);
     901            m_pEditorCPUCount->setMaximum(m_uMaxGuestCPU);
     902            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUCount, 4);
     903        }
     904
     905        /* CPU-execution-cap slider created in the .ui file. */
     906        AssertPtrReturnVoid(m_pSliderCPUExecCap);
     907        {
     908            /* Configure slider: */
     909            m_pSliderCPUExecCap->setPageStep(10);
     910            m_pSliderCPUExecCap->setSingleStep(1);
     911            m_pSliderCPUExecCap->setTickInterval(10);
     912            /* Setup the scale so that ticks are at page step boundaries: */
     913            m_pSliderCPUExecCap->setMinimum(m_uMinGuestCPUExecCap);
     914            m_pSliderCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap);
     915            m_pSliderCPUExecCap->setWarningHint(m_uMinGuestCPUExecCap, m_uMedGuestCPUExecCap);
     916            m_pSliderCPUExecCap->setOptimalHint(m_uMedGuestCPUExecCap, m_uMaxGuestCPUExecCap);
     917        }
     918
     919        /* CPU-execution-cap editor created in the .ui file. */
     920        AssertPtrReturnVoid(m_pEditorCPUExecCap);
     921        {
     922            /* Configure editor: */
     923            m_pEditorCPUExecCap->setMinimum(m_uMinGuestCPUExecCap);
     924            m_pEditorCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap);
     925            vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUExecCap, 4);
     926        }
     927    }
     928}
     929
     930void UIMachineSettingsSystem::prepareTabAcceleration()
     931{
     932    /* Tab and it's layout created in the .ui file. */
     933    {
     934        /* Paravirtualization Provider combo-box created in the .ui file. */
     935        AssertPtrReturnVoid(m_pComboParavirtProvider);
     936        {
     937            /* Configure combo-box: */
     938            m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_None), QVariant(KParavirtProvider_None));
     939            m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Default), QVariant(KParavirtProvider_Default));
     940            m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Legacy), QVariant(KParavirtProvider_Legacy));
     941            m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Minimal), QVariant(KParavirtProvider_Minimal));
     942            m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_HyperV), QVariant(KParavirtProvider_HyperV));
     943            m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_KVM), QVariant(KParavirtProvider_KVM));
     944        }
     945
     946        /* Other widgets created in the .ui file. */
     947        AssertPtrReturnVoid(m_pWidgetPlaceholder);
     948        AssertPtrReturnVoid(m_pCheckBoxVirtualization);
     949        {
     950            /* Configure widgets: */
     951#ifndef VBOX_WITH_RAW_MODE
     952            /* Hide VT-x/AMD-V checkbox when raw-mode is not supported: */
     953            m_pWidgetPlaceholder->setVisible(false);
     954            m_pCheckBoxVirtualization->setVisible(false);
     955#endif
     956        }
     957    }
     958}
     959
     960void UIMachineSettingsSystem::prepareConnections()
     961{
     962    /* Configure 'Motherboard' connections: */
    821963    connect(m_pComboChipsetType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate()));
    822 
    823     /* Preconfigure 'pointing HID type' combo: */
    824     m_pComboPointingHIDType->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    825964    connect(m_pComboPointingHIDType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate()));
    826 
    827     /* Install memory-size widget connections: */
    828965    connect(m_pSliderMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeSliderChange()));
    829966    connect(m_pEditorMemorySize, SIGNAL(valueChanged(int)), this, SLOT(sltHandleMemorySizeEditorChange()));
    830 
    831     /* Install boot-table connections: */
    832967    connect(mTbBootItemUp, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemUp()));
    833968    connect(mTbBootItemDown, SIGNAL(clicked()), mTwBootOrder, SLOT(sltMoveItemDown()));
    834969    connect(mTwBootOrder, SIGNAL(sigRowChanged(int)), this, SLOT(sltHandleCurrentBootItemChange(int)));
    835 
    836     /* Advanced options: */
    837970    connect(m_pCheckBoxApic, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
    838 }
    839 
    840 void UIMachineSettingsSystem::prepareTabProcessor()
    841 {
    842     /* Load configuration: */
    843     const CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
    844     const uint hostCPUs = vboxGlobal().host().GetProcessorOnlineCoreCount();
    845     m_uMinGuestCPU = properties.GetMinGuestCPUCount();
    846     m_uMaxGuestCPU = qMin(2 * hostCPUs, (uint)properties.GetMaxGuestCPUCount());
    847     m_uMinGuestCPUExecCap = 1;
    848     m_uMedGuestCPUExecCap = 40;
    849     m_uMaxGuestCPUExecCap = 100;
    850 
    851     /* Preconfigure CPU-count slider: */
    852     m_pSliderCPUCount->setPageStep(1);
    853     m_pSliderCPUCount->setSingleStep(1);
    854     m_pSliderCPUCount->setTickInterval(1);
    855     m_pSliderCPUCount->setMinimum(m_uMinGuestCPU);
    856     m_pSliderCPUCount->setMaximum(m_uMaxGuestCPU);
    857     m_pSliderCPUCount->setOptimalHint(1, hostCPUs);
    858     m_pSliderCPUCount->setWarningHint(hostCPUs, m_uMaxGuestCPU);
    859 
    860     /* Preconfigure CPU-count editor: */
    861     m_pEditorCPUCount->setMinimum(m_uMinGuestCPU);
    862     m_pEditorCPUCount->setMaximum(m_uMaxGuestCPU);
    863     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUCount, 4);
    864 
    865     /* Preconfigure CPU-execution-cap slider: */
    866     m_pSliderCPUExecCap->setPageStep(10);
    867     m_pSliderCPUExecCap->setSingleStep(1);
    868     m_pSliderCPUExecCap->setTickInterval(10);
    869     /* Setup the scale so that ticks are at page step boundaries: */
    870     m_pSliderCPUExecCap->setMinimum(m_uMinGuestCPUExecCap);
    871     m_pSliderCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap);
    872     m_pSliderCPUExecCap->setWarningHint(m_uMinGuestCPUExecCap, m_uMedGuestCPUExecCap);
    873     m_pSliderCPUExecCap->setOptimalHint(m_uMedGuestCPUExecCap, m_uMaxGuestCPUExecCap);
    874 
    875     /* Preconfigure CPU-execution-cap editor: */
    876     m_pEditorCPUExecCap->setMinimum(m_uMinGuestCPUExecCap);
    877     m_pEditorCPUExecCap->setMaximum(m_uMaxGuestCPUExecCap);
    878     vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorCPUExecCap, 4);
    879 
    880     /* Install CPU widget connections: */
     971
     972    /* Configure 'Processor' connections: */
    881973    connect(m_pSliderCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountSliderChange()));
    882974    connect(m_pEditorCPUCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUCountEditorChange()));
    883975    connect(m_pSliderCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapSliderChange()));
    884976    connect(m_pEditorCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapEditorChange()));
    885 }
    886 
    887 void UIMachineSettingsSystem::prepareTabAcceleration()
    888 {
    889     /* Populate 'paravirt provider' combo: */
    890     m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_None), QVariant(KParavirtProvider_None));
    891     m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Default), QVariant(KParavirtProvider_Default));
    892     m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Legacy), QVariant(KParavirtProvider_Legacy));
    893     m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Minimal), QVariant(KParavirtProvider_Minimal));
    894     m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_HyperV), QVariant(KParavirtProvider_HyperV));
    895     m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_KVM), QVariant(KParavirtProvider_KVM));
    896 
    897     /* Hide VT-x/AMD-V checkbox when raw-mode is not supported: */
    898 #ifndef VBOX_WITH_RAW_MODE
    899     m_pWidgetPlaceholder->setVisible(false);
    900     m_pCheckBoxVirtualization->setVisible(false);
    901 #endif /* !VBOX_WITH_RAW_MODE */
    902 
    903     /* Advanced options: */
     977
     978    /* Configure 'Acceleration' connections: */
    904979    connect(m_pCheckBoxVirtualization, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     980}
     981
     982void UIMachineSettingsSystem::cleanup()
     983{
     984    /* Cleanup cache: */
     985    delete m_pCache;
     986    m_pCache = 0;
    905987}
    906988
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r66246 r66345  
    116116    /** Prepares 'Acceleration' tab. */
    117117    void prepareTabAcceleration();
     118    /** Prepares connections. */
     119    void prepareConnections();
     120    /** Cleanups all. */
     121    void cleanup();
    118122
    119123    /** Repopulates Pointing HID type combo-box. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r66246 r66345  
    280280    , m_pActionMoveUp(0), m_pActionMoveDown(0)
    281281    , m_pMenuUSBDevices(0)
    282     , m_pCache(new UISettingsCacheMachineUSB)
    283 {
    284     /* Apply UI decorations: */
    285     Ui::UIMachineSettingsUSB::setupUi(this);
    286 
    287     /* Prepare actions */
    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",
    303                                             ":/usb_new_disabled_16px.png"));
    304     m_pActionAdd->setIcon(UIIconPool::iconSet(":/usb_add_16px.png",
    305                                             ":/usb_add_disabled_16px.png"));
    306     m_pActionEdit->setIcon(UIIconPool::iconSet(":/usb_filter_edit_16px.png",
    307                                             ":/usb_filter_edit_disabled_16px.png"));
    308     m_pActionRemove->setIcon(UIIconPool::iconSet(":/usb_remove_16px.png",
    309                                             ":/usb_remove_disabled_16px.png"));
    310     m_pActionMoveUp->setIcon(UIIconPool::iconSet(":/usb_moveup_16px.png",
    311                                             ":/usb_moveup_disabled_16px.png"));
    312     m_pActionMoveDown->setIcon(UIIconPool::iconSet(":/usb_movedown_16px.png",
    313                                             ":/usb_movedown_disabled_16px.png"));
    314 
    315     /* Determine icon metric: */
    316     const QStyle *pStyle = QApplication::style();
    317     const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
    318 
    319     /* Prepare tool-bar: */
    320     m_pFiltersToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
    321     m_pFiltersToolBar->setOrientation(Qt::Vertical);
    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);
    328 
    329     /* Setup connections */
    330     connect(mGbUSB, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
    331     connect(mRbUSB1, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
    332     connect(mRbUSB2, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
    333     connect(mRbUSB3, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
    334 
    335     connect (mGbUSB, SIGNAL (toggled (bool)),
    336              this, SLOT (sltHandleUsbAdapterToggle (bool)));
    337     connect (mTwFilters, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)),
    338              this, SLOT (sltHandleCurrentItemChange (QTreeWidgetItem*)));
    339     connect (mTwFilters, SIGNAL (customContextMenuRequested (const QPoint &)),
    340              this, SLOT (sltHandleContextMenuRequest (const QPoint &)));
    341     connect (mTwFilters, SIGNAL (itemDoubleClicked (QTreeWidgetItem *, int)),
    342              this, SLOT (sltEditFilter()));
    343     connect (mTwFilters, SIGNAL (itemChanged (QTreeWidgetItem *, int)),
    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()));
    361 
    362     /* Setup dialog */
    363     mTwFilters->header()->hide();
    364 
    365     /* Applying language settings */
    366     retranslateUi();
    367 
    368 #ifndef VBOX_WITH_EHCI
    369     mCbUSB2->setHidden(true);
    370 #endif /* VBOX_WITH_EHCI */
     282    , m_pCache(0)
     283{
     284    /* Prepare: */
     285    prepare();
    371286}
    372287
    373288UIMachineSettingsUSB::~UIMachineSettingsUSB()
    374289{
    375     delete m_pMenuUSBDevices;
    376 
    377     /* Cleanup cache: */
    378     delete m_pCache;
    379     m_pCache = 0;
     290    /* Cleanup: */
     291    cleanup();
    380292}
    381293
     
    977889}
    978890
     891void UIMachineSettingsUSB::prepare()
     892{
     893    /* Apply UI decorations: */
     894    Ui::UIMachineSettingsUSB::setupUi(this);
     895
     896    /* Prepare cache: */
     897    m_pCache = new UISettingsCacheMachineUSB;
     898    AssertPtrReturnVoid(m_pCache);
     899
     900    /* Layout created in the .ui file. */
     901    {
     902        /* Prepare USB Filters tree: */
     903        prepareFiltersTree();
     904        /* Prepare USB Filters toolbar: */
     905        prepareFiltersToolbar();
     906        /* Prepare connections: */
     907        prepareConnections();
     908    }
     909
     910    /* Apply language settings: */
     911    retranslateUi();
     912}
     913
     914void UIMachineSettingsUSB::prepareFiltersTree()
     915{
     916    /* USB Filters tree-widget created in the .ui file. */
     917    AssertPtrReturnVoid(mTwFilters);
     918    {
     919        /* Configure tree-widget: */
     920        mTwFilters->header()->hide();
     921    }
     922}
     923
     924void UIMachineSettingsUSB::prepareFiltersToolbar()
     925{
     926    /* USB Filters toolbar created in the .ui file. */
     927    AssertPtrReturnVoid(m_pFiltersToolBar);
     928    {
     929        /* Configure toolbar: */
     930        const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
     931        m_pFiltersToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
     932        m_pFiltersToolBar->setOrientation(Qt::Vertical);
     933
     934        /* Create USB devices menu: */
     935        m_pMenuUSBDevices = new VBoxUSBMenu(this);
     936        AssertPtrReturnVoid(m_pMenuUSBDevices);
     937
     938        /* Create 'New USB Filter' action: */
     939        m_pActionNew = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_new_16px.png",
     940                                                                        ":/usb_new_disabled_16px.png"),
     941                                                    QString(), this, SLOT(sltNewFilter()));
     942        AssertPtrReturnVoid(m_pActionNew);
     943        {
     944            /* Configure action: */
     945            m_pActionNew->setShortcuts(QList<QKeySequence>() << QKeySequence("Ins") << QKeySequence("Ctrl+N"));
     946        }
     947
     948        /* Create 'Add USB Filter' action: */
     949        m_pActionAdd = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_add_16px.png",
     950                                                                        ":/usb_add_disabled_16px.png"),
     951                                                    QString(), this, SLOT(sltAddFilter()));
     952        AssertPtrReturnVoid(m_pActionAdd);
     953        {
     954            /* Configure action: */
     955            m_pActionAdd->setShortcuts(QList<QKeySequence>() << QKeySequence("Alt+Ins") << QKeySequence("Ctrl+A"));
     956        }
     957
     958        /* Create 'Edit USB Filter' action: */
     959        m_pActionEdit = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_filter_edit_16px.png",
     960                                                                         ":/usb_filter_edit_disabled_16px.png"),
     961                                                     QString(), this, SLOT(sltEditFilter()));
     962        AssertPtrReturnVoid(m_pActionEdit);
     963        {
     964            /* Configure action: */
     965            m_pActionEdit->setShortcuts(QList<QKeySequence>() << QKeySequence("Alt+Return") << QKeySequence("Ctrl+Return"));
     966        }
     967
     968        /* Create 'Remove USB Filter' action: */
     969        m_pActionRemove = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_remove_16px.png",
     970                                                                           ":/usb_remove_disabled_16px.png"),
     971                                                       QString(), this, SLOT(sltRemoveFilter()));
     972        AssertPtrReturnVoid(m_pActionRemove);
     973        {
     974            /* Configure action: */
     975            m_pActionRemove->setShortcuts(QList<QKeySequence>() << QKeySequence("Del") << QKeySequence("Ctrl+R"));
     976        }
     977
     978        /* Create 'Move USB Filter Up' action: */
     979        m_pActionMoveUp = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_moveup_16px.png",
     980                                                                           ":/usb_moveup_disabled_16px.png"),
     981                                                       QString(), this, SLOT(sltMoveFilterUp()));
     982        AssertPtrReturnVoid(m_pActionMoveUp);
     983        {
     984            /* Configure action: */
     985            m_pActionMoveUp->setShortcuts(QList<QKeySequence>() << QKeySequence("Alt+Up") << QKeySequence("Ctrl+Up"));
     986        }
     987
     988        /* Create 'Move USB Filter Down' action: */
     989        m_pActionMoveDown = m_pFiltersToolBar->addAction(UIIconPool::iconSet(":/usb_movedown_16px.png",
     990                                                                             ":/usb_movedown_disabled_16px.png"),
     991                                                         QString(), this, SLOT(sltMoveFilterDown()));
     992        AssertPtrReturnVoid(m_pActionMoveDown);
     993        {
     994            /* Configure action: */
     995            m_pActionMoveDown->setShortcuts(QList<QKeySequence>() << QKeySequence("Alt+Down") << QKeySequence("Ctrl+Down"));
     996        }
     997    }
     998}
     999
     1000void UIMachineSettingsUSB::prepareConnections()
     1001{
     1002    /* Configure validation connections: */
     1003    connect(mGbUSB, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     1004    connect(mRbUSB1, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
     1005    connect(mRbUSB2, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
     1006    connect(mRbUSB3, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
     1007
     1008    /* Configure widget connections: */
     1009    connect(mGbUSB, SIGNAL(toggled(bool)),
     1010            this, SLOT(sltHandleUsbAdapterToggle(bool)));
     1011    connect(mTwFilters, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
     1012            this, SLOT(sltHandleCurrentItemChange(QTreeWidgetItem*)));
     1013    connect(mTwFilters, SIGNAL(customContextMenuRequested(const QPoint &)),
     1014            this, SLOT(sltHandleContextMenuRequest(const QPoint &)));
     1015    connect(mTwFilters, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)),
     1016            this, SLOT(sltEditFilter()));
     1017    connect(mTwFilters, SIGNAL(itemChanged(QTreeWidgetItem *, int)),
     1018            this, SLOT(sltHandleActivityStateChange(QTreeWidgetItem *)));
     1019
     1020    /* Configure USB device menu connections: */
     1021    connect(m_pMenuUSBDevices, SIGNAL(triggered(QAction*)),
     1022            this, SLOT(sltAddFilterConfirmed(QAction *)));
     1023}
     1024
     1025void UIMachineSettingsUSB::cleanup()
     1026{
     1027    /* Cleanup USB devices menu: */
     1028    delete m_pMenuUSBDevices;
     1029    m_pMenuUSBDevices = 0;
     1030
     1031    /* Cleanup cache: */
     1032    delete m_pCache;
     1033    m_pCache = 0;
     1034}
     1035
    9791036void UIMachineSettingsUSB::addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fChoose)
    9801037{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h

    r66246 r66345  
    111111private:
    112112
     113    /** Prepares all. */
     114    void prepare();
     115    /** Prepares USB filters tree. */
     116    void prepareFiltersTree();
     117    /** Prepares USB filters toolbar. */
     118    void prepareFiltersToolbar();
     119    /** Prepares connections. */
     120    void prepareConnections();
     121    /** Cleanups all. */
     122    void cleanup();
     123
    113124    /** Adds USB filter item based on a given @a usbFilterData, fChoose if requested. */
    114125    void addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fChoose);
Note: See TracChangeset for help on using the changeset viewer.

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