VirtualBox

Changeset 101717 in vbox


Ignore:
Timestamp:
Nov 2, 2023 12:22:25 PM (13 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: UIEditor and sub-classes: Simplify filterOut stuff; No need to pass everything through whole the hierarchy, enough to handle optional method only.

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

Legend:

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

    r101693 r101717  
    10871087
    10881088    /* Reapply mode: */
    1089     sltHandleModeOrFilterChanged();
    1090 }
    1091 
    1092 void UIAdvancedSettingsDialog::sltHandleModeOrFilterChanged()
     1089    sltApplyFilteringRules();
     1090}
     1091
     1092void UIAdvancedSettingsDialog::sltApplyFilteringRules()
    10931093{
    10941094    /* Filter-out page contents: */
    10951095    foreach (UISettingsPageFrame *pFrame, m_frames.values())
    1096         pFrame->filterOut(m_pCheckBoxMode->isChecked(), m_pEditorFilter->text());
     1096        pFrame->filterOut(m_pCheckBoxMode->isChecked(),
     1097                          m_pEditorFilter->text());
    10971098}
    10981099
     
    11831184    {
    11841185        connect(m_pEditorFilter, &UIFilterEditor::sigTextChanged,
    1185                 this, &UIAdvancedSettingsDialog::sltHandleModeOrFilterChanged);
     1186                this, &UIAdvancedSettingsDialog::sltApplyFilteringRules);
    11861187        m_pLayoutMain->addWidget(m_pEditorFilter, 0, 2);
    11871188    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.h

    r101693 r101717  
    198198    void sltHandleExperienceModeChanged();
    199199
    200     /** Handles changes done to mode checkbox or filter editor. */
    201     void sltHandleModeOrFilterChanged();
     200    /** Applies filtering rules, which can be changed as
     201      * a result of changes in experience mode and filter editor. */
     202    void sltApplyFilteringRules();
    202203    /** Handles frame visivility changes. */
    203204    void sltHandleFrameVisibilityChange(bool fVisible);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAudioSettingsEditor.cpp

    r101511 r101717  
    133133}
    134134
    135 void UIAudioSettingsEditor::filterOut(bool fExpertMode, const QString &strFilter)
    136 {
    137     /* Call to base-class: */
    138     UIEditor::filterOut(fExpertMode, strFilter);
    139 
    140     updateMinimumLayoutHint();
    141 }
    142 
    143135void UIAudioSettingsEditor::retranslateUi()
    144136{
     
    150142    }
    151143
     144    updateMinimumLayoutHint();
     145}
     146
     147void UIAudioSettingsEditor::handleFilterChange()
     148{
    152149    updateMinimumLayoutHint();
    153150}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIAudioSettingsEditor.h

    r101511 r101717  
    106106protected:
    107107
    108     /** Filters out contents.
    109       * @param  fExpertMode  Brings whether settings expert mode is requested.
    110       * @param  strFilter    Brings the filter description should correspond to. */
    111     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    112 
    113108    /** Handles translation event. */
    114109    virtual void retranslateUi() RT_OVERRIDE;
     110
     111    /** Handles filter change. */
     112    virtual void handleFilterChange() RT_OVERRIDE;
    115113
    116114private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIEditor.cpp

    r101693 r101717  
    116116    foreach (QLayout *pLayout, findChildren<QLayout*>())
    117117        pLayout->activate();
     118
     119    /* Call for filter change handler finally: */
     120    handleFilterChange();
    118121}
    119122
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIEditor.h

    r101693 r101717  
    7272    virtual QStringList description() const;
    7373
    74     /** Holds whether widget should be shown in basic mode. */
     74    /** Handles filter change.
     75      * Reimplement this in subclass to handle various filter changes,
     76      * like experience mode change or manual filter editor change. */
     77    virtual void handleFilterChange() {}
     78
     79    /** Holds whether editor should be shown in basic mode. */
    7580    bool  m_fShowInBasicMode;
    7681    /** Holds whether editor is in expert mode. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINetworkAttachmentEditor.cpp

    r101637 r101717  
    198198#endif /* VBOX_WITH_VMNET */
    199199
    200 void UINetworkAttachmentEditor::filterOut(bool fExpertMode, const QString &strFilter)
    201 {
    202     /* Call to base-class: */
    203     UIEditor::filterOut(fExpertMode, strFilter);
    204 
     200void UINetworkAttachmentEditor::retranslateUi()
     201{
     202    /* Translate type label: */
     203    if (m_pLabelType)
     204        m_pLabelType->setText(tr("&Attached to:"));
     205
     206    /* Translate name label: */
     207    if (m_pLabelName)
     208        m_pLabelName->setText(tr("&Name:"));
     209
     210    /* Translate type combo: */
     211    if (m_pComboType)
     212    {
     213        for (int i = 0; i < m_pComboType->count(); ++i)
     214        {
     215            const KNetworkAttachmentType enmType = m_pComboType->itemData(i).value<KNetworkAttachmentType>();
     216            m_pComboType->setItemText(i, gpConverter->toString(enmType));
     217        }
     218        m_pComboType->setToolTip(tr("Holds how this virtual adapter is attached to the real network of the Host OS."));
     219    }
     220
     221    /* Translate name combo: */
     222    retranslateNameDescription();
     223}
     224
     225void UINetworkAttachmentEditor::handleFilterChange()
     226{
    205227    /* Repopulate type combo to make
    206228     * sure excessive types removed: */
    207229    populateTypeCombo();
    208 }
    209 
    210 void UINetworkAttachmentEditor::retranslateUi()
    211 {
    212     /* Translate type label: */
    213     if (m_pLabelType)
    214         m_pLabelType->setText(tr("&Attached to:"));
    215 
    216     /* Translate name label: */
    217     if (m_pLabelName)
    218         m_pLabelName->setText(tr("&Name:"));
    219 
    220     /* Translate type combo: */
    221     if (m_pComboType)
    222     {
    223         for (int i = 0; i < m_pComboType->count(); ++i)
    224         {
    225             const KNetworkAttachmentType enmType = m_pComboType->itemData(i).value<KNetworkAttachmentType>();
    226             m_pComboType->setItemText(i, gpConverter->toString(enmType));
    227         }
    228         m_pComboType->setToolTip(tr("Holds how this virtual adapter is attached to the real network of the Host OS."));
    229     }
    230 
    231     /* Translate name combo: */
    232     retranslateNameDescription();
    233230}
    234231
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINetworkAttachmentEditor.h

    r101637 r101717  
    102102protected:
    103103
    104     /** Filters out contents.
    105       * @param  fExpertMode  Brings whether settings expert mode is requested.
    106       * @param  strFilter    Brings the filter description should correspond to. */
    107     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    108 
    109104    /** Handles translation event. */
    110105    virtual void retranslateUi() RT_OVERRIDE;
     106
     107    /** Handles filter change. */
     108    virtual void handleFilterChange() RT_OVERRIDE;
    111109
    112110private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINetworkSettingsEditor.cpp

    r101529 r101717  
    205205}
    206206
    207 void UINetworkSettingsEditor::filterOut(bool fExpertMode, const QString &strFilter)
    208 {
    209     /* Call to base-class: */
    210     UIEditor::filterOut(fExpertMode, strFilter);
    211 
    212     updateMinimumLayoutHint();
    213 }
    214 
    215207void UINetworkSettingsEditor::retranslateUi()
    216208{
     
    221213    }
    222214
     215    updateMinimumLayoutHint();
     216}
     217
     218void UINetworkSettingsEditor::handleFilterChange()
     219{
    223220    updateMinimumLayoutHint();
    224221}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINetworkSettingsEditor.h

    r101529 r101717  
    149149protected:
    150150
    151     /** Filters out contents.
    152       * @param  fExpertMode  Brings whether settings expert mode is requested.
    153       * @param  strFilter    Brings the filter description should correspond to. */
    154     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    155 
    156151    /** Handles translation event. */
    157152    virtual void retranslateUi() RT_OVERRIDE;
     153
     154    /** Handles filter change. */
     155    virtual void handleFilterChange() RT_OVERRIDE;
    158156
    159157private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUpdateSettingsEditor.cpp

    r101563 r101717  
    6767}
    6868
    69 void UIUpdateSettingsEditor::filterOut(bool fExpertMode, const QString &strFilter)
    70 {
    71     /* Call to base-class: */
    72     UIEditor::filterOut(fExpertMode, strFilter);
    73     fetchValue();
    74 }
    75 
    7669void UIUpdateSettingsEditor::retranslateUi()
    7770{
     
    129122                                                                           "VirtualBox."));
    130123    }
     124}
     125
     126void UIUpdateSettingsEditor::handleFilterChange()
     127{
     128    fetchValue();
    131129}
    132130
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIUpdateSettingsEditor.h

    r101454 r101717  
    6363protected:
    6464
    65     /** Filters out contents.
    66       * @param  fExpertMode  Brings whether settings expert mode is requested.
    67       * @param  strFilter    Brings the filter description should correspond to. */
    68     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    69 
    7065    /** Handles translation event. */
    7166    virtual void retranslateUi() RT_OVERRIDE;
     67
     68    /** Handles filter change. */
     69    virtual void handleFilterChange() RT_OVERRIDE;
    7270
    7371private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp

    r101511 r101717  
    190190}
    191191
    192 void UIGlobalSettingsDisplay::filterOut(bool fExpertMode, const QString &strFilter)
    193 {
    194     /* Call to base-class: */
    195     UIEditor::filterOut(fExpertMode, strFilter);
    196 
     192void UIGlobalSettingsDisplay::retranslateUi()
     193{
    197194    updateMinimumLayoutHint();
    198195}
    199196
    200 void UIGlobalSettingsDisplay::retranslateUi()
     197void UIGlobalSettingsDisplay::handleFilterChange()
    201198{
    202199    updateMinimumLayoutHint();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h

    r101511 r101717  
    7474    virtual void saveFromCacheTo(QVariant &data) RT_OVERRIDE;
    7575
    76     /** Filters out contents.
    77       * @param  fExpertMode  Brings whether settings expert mode is requested.
    78       * @param  strFilter    Brings the filter description should correspond to. */
    79     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    80 
    8176    /** Handles translation event. */
    8277    virtual void retranslateUi() RT_OVERRIDE;
     78
     79    /** Handles filter change. */
     80    virtual void handleFilterChange() RT_OVERRIDE;
    8381
    8482private:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp

    r101511 r101717  
    154154}
    155155
    156 void UIGlobalSettingsGeneral::filterOut(bool fExpertMode, const QString &strFilter)
    157 {
    158     /* Call to base-class: */
    159     UIEditor::filterOut(fExpertMode, strFilter);
    160 
     156void UIGlobalSettingsGeneral::retranslateUi()
     157{
    161158    updateMinimumLayoutHint();
    162159}
    163160
    164 void UIGlobalSettingsGeneral::retranslateUi()
     161void UIGlobalSettingsGeneral::handleFilterChange()
    165162{
    166163    updateMinimumLayoutHint();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h

    r101511 r101717  
    7272    virtual void saveFromCacheTo(QVariant &data) RT_OVERRIDE;
    7373
    74     /** Filters out contents.
    75       * @param  fExpertMode  Brings whether settings expert mode is requested.
    76       * @param  strFilter    Brings the filter description should correspond to. */
    77     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    78 
    7974    /** Handles translation event. */
    8075    virtual void retranslateUi() RT_OVERRIDE;
     76
     77    /** Handles filter change. */
     78    virtual void handleFilterChange() RT_OVERRIDE;
    8179
    8280private:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r101520 r101717  
    751751}
    752752
    753 void UIMachineSettingsDisplay::filterOut(bool fExpertMode, const QString &strFilter)
    754 {
    755     /* Call to base-class: */
    756     UIEditor::filterOut(fExpertMode, strFilter);
    757 
    758     updateMinimumLayoutHint();
    759 }
    760 
    761753void UIMachineSettingsDisplay::retranslateUi()
    762754{
     
    766758    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabRecording), tr("Re&cording"));
    767759
     760    updateMinimumLayoutHint();
     761}
     762
     763void UIMachineSettingsDisplay::handleFilterChange()
     764{
    768765    updateMinimumLayoutHint();
    769766}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r101511 r101717  
    9999    virtual void setOrderAfter(QWidget *pWidget) RT_OVERRIDE;
    100100
    101     /** Filters out contents.
    102       * @param  fExpertMode  Brings whether settings expert mode is requested.
    103       * @param  strFilter    Brings the filter description should correspond to. */
    104     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    105 
    106101    /** Handles translation event. */
    107102    virtual void retranslateUi() RT_OVERRIDE;
     103
     104    /** Handles filter change. */
     105    virtual void handleFilterChange() RT_OVERRIDE;
    108106
    109107    /** Performs final page polishing. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r101511 r101717  
    463463}
    464464
    465 void UIMachineSettingsGeneral::filterOut(bool fExpertMode, const QString &strFilter)
    466 {
    467     /* Call to base-class: */
    468     UIEditor::filterOut(fExpertMode, strFilter);
    469 
    470     updateMinimumLayoutHint();
    471 }
    472 
    473465void UIMachineSettingsGeneral::retranslateUi()
    474466{
     
    478470    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabEncryption), tr("Disk Enc&ryption"));
    479471
     472    updateMinimumLayoutHint();
     473}
     474
     475void UIMachineSettingsGeneral::handleFilterChange()
     476{
    480477    updateMinimumLayoutHint();
    481478}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r101511 r101717  
    8686    virtual void setOrderAfter(QWidget *pWidget) RT_OVERRIDE;
    8787
    88     /** Filters out contents.
    89       * @param  fExpertMode  Brings whether settings expert mode is requested.
    90       * @param  strFilter    Brings the filter description should correspond to. */
    91     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    92 
    9388    /** Handles translation event. */
    9489    virtual void retranslateUi() RT_OVERRIDE;
     90
     91    /** Handles filter change. */
     92    virtual void handleFilterChange() RT_OVERRIDE;
    9593
    9694    /** Performs final page polishing. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp

    r101511 r101717  
    333333}
    334334
    335 void UIMachineSettingsInterface::filterOut(bool fExpertMode, const QString &strFilter)
    336 {
    337     /* Call to base-class: */
    338     UIEditor::filterOut(fExpertMode, strFilter);
    339 
     335void UIMachineSettingsInterface::retranslateUi()
     336{
    340337    updateMinimumLayoutHint();
    341338}
    342339
    343 void UIMachineSettingsInterface::retranslateUi()
     340void UIMachineSettingsInterface::handleFilterChange()
    344341{
    345342    updateMinimumLayoutHint();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h

    r101511 r101717  
    7676    virtual void saveFromCacheTo(QVariant &data) RT_OVERRIDE;
    7777
    78     /** Filters out contents.
    79       * @param  fExpertMode  Brings whether settings expert mode is requested.
    80       * @param  strFilter    Brings the filter description should correspond to. */
    81     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    82 
    8378    /** Handles translation event. */
    8479    virtual void retranslateUi() RT_OVERRIDE;
     80
     81    /** Handles filter change. */
     82    virtual void handleFilterChange() RT_OVERRIDE;
    8583
    8684    /** Performs final page polishing. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r101605 r101717  
    348348}
    349349
     350void UIMachineSettingsNetwork::handleFilterChange()
     351{
     352    /* Show tabs from 2nd to 4th in expert mode only: */
     353    if (m_pTabWidget)
     354        for (int i = 1; i < m_pTabWidget->count(); ++i)
     355            m_pTabWidget->setTabVisible(i, m_fInExpertMode);
     356}
     357
    350358void UIMachineSettingsNetwork::polishPage()
    351359{
     
    364372        polishTab(iSlot);
    365373    }
    366 }
    367 
    368 void UIMachineSettingsNetwork::filterOut(bool fExpertMode, const QString &strFilter)
    369 {
    370     /* Call to base class: */
    371     UISettingsPageMachine::filterOut(fExpertMode, strFilter);
    372 
    373     /* Show tabs from 2nd to 4th in expert mode only: */
    374     if (m_pTabWidget)
    375         for (int i = 1; i < m_pTabWidget->count(); ++i)
    376             m_pTabWidget->setTabVisible(i, m_fInExpertMode);
    377374}
    378375
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h

    r101596 r101717  
    101101    virtual void retranslateUi() RT_OVERRIDE;
    102102
     103    /** Handles filter change. */
     104    virtual void handleFilterChange() RT_OVERRIDE;
     105
    103106    /** Performs final page polishing. */
    104107    virtual void polishPage() RT_OVERRIDE;
    105 
    106     /** Filters out contents.
    107       * @param  fExpertMode  Brings whether settings expert mode is requested.
    108       * @param  strFilter    Brings the filter description should correspond to. */
    109     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    110108
    111109private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r101511 r101717  
    610610}
    611611
    612 void UIMachineSettingsSystem::filterOut(bool fExpertMode, const QString &strFilter)
    613 {
    614     /* Call to base-class: */
    615     UIEditor::filterOut(fExpertMode, strFilter);
    616 
    617     updateMinimumLayoutHint();
    618 }
    619 
    620612void UIMachineSettingsSystem::retranslateUi()
    621613{
     
    624616    m_pTabWidget->setTabText(m_pTabWidget->indexOf(m_pTabAcceleration), tr("Acce&leration"));
    625617
     618    updateMinimumLayoutHint();
     619}
     620
     621void UIMachineSettingsSystem::handleFilterChange()
     622{
    626623    updateMinimumLayoutHint();
    627624}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r101511 r101717  
    110110    virtual void setOrderAfter(QWidget *pWidget) RT_OVERRIDE;
    111111
    112     /** Filters out contents.
    113       * @param  fExpertMode  Brings whether settings expert mode is requested.
    114       * @param  strFilter    Brings the filter description should correspond to. */
    115     virtual void filterOut(bool fExpertMode, const QString &strFilter) RT_OVERRIDE;
    116 
    117112    /** Handles translation event. */
    118113    virtual void retranslateUi() RT_OVERRIDE;
     114
     115    /** Handles filter change. */
     116    virtual void handleFilterChange() RT_OVERRIDE;
    119117
    120118    /** Performs final page polishing. */
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