VirtualBox

Changeset 47573 in vbox


Ignore:
Timestamp:
Aug 7, 2013 9:57:28 AM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Settings dialog: New validation stuff: Step 3 (Reworking validation encapsulation).

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

Legend:

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

    r47563 r47573  
    337337    QString strPageTitle = m_pSelector->itemTextByPage(pSettingsPage);
    338338    QString strMessageText;
    339     bool fIsValid = pSettingsPage->revalidate(strMessageText, strPageTitle);
     339    bool fIsValid = pSettingsPage->validate(strMessageText, strPageTitle);
    340340
    341341    /* Remember revalidation result: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp

    r36594 r47573  
    1818 */
    1919
    20 /* Local includes */
     20/* GUI includes: */
    2121#include "UISettingsPage.h"
     22#include "QIWidgetValidator.h"
    2223
    2324/* Settings page constructor, hidden: */
     
    2930    , m_fFailed(false)
    3031    , m_pFirstWidget(0)
     32    , m_pValidator(0)
    3133{
     34}
     35
     36void UISettingsPage::setValidator(UIPageValidator *pValidator)
     37{
     38    /* Make sure validator is not yet assigned: */
     39    AssertMsg(!m_pValidator, ("Validator already assigned!\n"));
     40    if (m_pValidator)
     41        return;
     42
     43    /* Assign validator: */
     44    m_pValidator = pValidator;
     45}
     46
     47void UISettingsPage::revalidate()
     48{
     49    /* Revalidate if possible: */
     50    if (m_pValidator)
     51        m_pValidator->revalidate();
    3252}
    3353
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r47563 r47573  
    9393
    9494    /* Validation stuff: */
    95     virtual void setValidator(UIPageValidator* /* pValidator */) {}
    96     virtual bool revalidate(QString& /* strWarningText */, QString& /* strTitle */) { return true; }
     95    void setValidator(UIPageValidator *pValidator);
     96    virtual bool validate(QString& /* strWarningText */, QString& /* strTitle */) { return true; }
    9797
    9898    /* Navigation stuff: */
     
    129129    virtual void polishPage() {}
    130130
     131public slots:
     132
     133    /* Handler: Validation stuff: */
     134    void revalidate();
     135
    131136protected:
    132137
     
    136141private:
    137142
    138     /* Private variables: */
     143    /* Variables: */
    139144    UISettingsPageType m_pageType;
    140145    SettingsDialogType m_dialogType;
     
    143148    bool m_fFailed;
    144149    QWidget *m_pFirstWidget;
     150    UIPageValidator *m_pValidator;
    145151};
    146152
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp

    r47563 r47573  
    3636/* Input page constructor: */
    3737UIGlobalSettingsInput::UIGlobalSettingsInput()
    38     : m_pValidator(0)
    39     , m_pTabWidget(0)
     38    : m_pTabWidget(0)
    4039    , m_pSelectorFilterEditor(0), m_pSelectorModel(0), m_pSelectorTable(0)
    4140    , m_pMachineFilterEditor(0), m_pMachineModel(0), m_pMachineTable(0)
     
    8180    setTabOrder(m_pMachineFilterEditor, m_pMachineTable);
    8281
     82    /* Prepare validation: */
     83    prepareValidation();
     84
    8385    /* Apply language settings: */
    8486    retranslateUi();
     
    120122    m_pEnableAutoGrabCheckbox->setChecked(m_cache.m_fAutoCapture);
    121123
    122     /* Revalidate if possible: */
    123     if (m_pValidator)
    124         m_pValidator->revalidate();
     124    /* Revalidate: */
     125    revalidate();
    125126}
    126127
     
    160161}
    161162
    162 void UIGlobalSettingsInput::setValidator(UIPageValidator *pValidator)
    163 {
    164     /* Configure validation: */
    165     m_pValidator = pValidator;
    166     connect(m_pSelectorModel, SIGNAL(sigRevalidationRequired()), m_pValidator, SLOT(revalidate()));
    167     connect(m_pMachineModel, SIGNAL(sigRevalidationRequired()), m_pValidator, SLOT(revalidate()));
    168 }
    169 
    170 bool UIGlobalSettingsInput::revalidate(QString &strWarning, QString &strTitle)
     163bool UIGlobalSettingsInput::validate(QString &strWarning, QString &strTitle)
    171164{
    172165    /* Check for unique shortcuts: */
     
    184177    }
    185178
     179    /* Pass by default: */
    186180    return true;
    187181}
     
    209203    m_pSelectorFilterEditor->setWhatsThis(tr("Enter a sequence to filter the shortcut list."));
    210204    m_pMachineFilterEditor->setWhatsThis(tr("Enter a sequence to filter the shortcut list."));
     205}
     206
     207void UIGlobalSettingsInput::prepareValidation()
     208{
     209    /* Prepare validation: */
     210    connect(m_pSelectorModel, SIGNAL(sigRevalidationRequired()), this, SLOT(revalidate()));
     211    connect(m_pMachineModel, SIGNAL(sigRevalidationRequired()), this, SLOT(revalidate()));
    211212}
    212213
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h

    r47563 r47573  
    140140
    141141    /* API: Validation stuff: */
    142     void setValidator(UIPageValidator *pValidator);
    143     bool revalidate(QString &strWarning, QString &strTitle);
     142    bool validate(QString &strWarning, QString &strTitle);
    144143
    145144    /* Helper: Navigation stuff: */
     
    151150private:
    152151
    153     /* Variable: Validation stuff: */
    154     UIPageValidator *m_pValidator;
     152    /* Helper: Prepare stuff: */
     153    void prepareValidation();
    155154
    156155    /* Cache: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp

    r47563 r47573  
    5858
    5959/* Validation stuff: */
    60 bool UIHostInterfaceItem::revalidate(QString &strWarning, QString & /* strTitle */)
     60bool UIHostInterfaceItem::validate(QString &strWarning, QString&)
    6161{
    6262    /* Host-only interface validation: */
     
    196196/* Network page constructor: */
    197197UIGlobalSettingsNetwork::UIGlobalSettingsNetwork()
    198     : m_pValidator(0)
    199     , m_pAddAction(0), m_pDelAction(0), m_pEditAction(0)
     198    : m_pAddAction(0), m_pDelAction(0), m_pEditAction(0)
    200199    , m_fChanged(false)
    201200{
     
    276275    sltUpdateCurrentItem();
    277276
    278     /* Revalidate if possible: */
    279     if (m_pValidator)
    280         m_pValidator->revalidate();
     277    /* Revalidate: */
     278    revalidate();
    281279}
    282280
     
    372370}
    373371
    374 void UIGlobalSettingsNetwork::setValidator(UIPageValidator *pValidator)
    375 {
    376     /* Configure validation: */
    377     m_pValidator = pValidator;
    378 }
    379 
    380372/* Validation processing: */
    381 bool UIGlobalSettingsNetwork::revalidate(QString &strWarning, QString &strTitle)
    382 {
     373bool UIGlobalSettingsNetwork::validate(QString &strWarning, QString &strTitle)
     374{
     375    /* Redirect validation to items: */
    383376    UIHostInterfaceItem *pItem = static_cast<UIHostInterfaceItem*>(m_pInterfacesTree->currentItem());
    384     return pItem ? pItem->revalidate(strWarning, strTitle) : true;
     377    return pItem ? pItem->validate(strWarning, strTitle) : true;
    385378}
    386379
     
    505498        m_fChanged = true;
    506499
    507         /* Revalidate if possible: */
    508         if (m_pValidator)
    509             m_pValidator->revalidate();
     500        /* Revalidate: */
     501        revalidate();
    510502    }
    511503}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h

    r47563 r47573  
    9797
    9898    /* API: Validation stuff: */
    99     bool revalidate(QString &strWarning, QString &strTitle);
     99    bool validate(QString &strWarning, QString &strTitle);
    100100
    101101    /* API: Update stuff: */
     
    164164
    165165    /* API: Validation stuff: */
    166     void setValidator(UIPageValidator *pValidator);
    167     bool revalidate(QString &strWarning, QString &strTitle);
     166    bool validate(QString &strWarning, QString &strTitle);
    168167
    169168    /* Navigation stuff: */
     
    190189    void removeListItem(UIHostInterfaceItem *pItem);
    191190
    192     /* Variable: Validation stuff: */
    193     UIPageValidator *m_pValidator;
    194 
    195191    /* Helper actions: */
    196192    QAction *m_pAddAction;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp

    r47563 r47573  
    2828/* General page constructor: */
    2929UIGlobalSettingsProxy::UIGlobalSettingsProxy()
    30     : m_pValidator(0)
    3130{
    3231    /* Apply UI decorations: */
     
    7271    sltProxyToggled();
    7372
    74     /* Revalidate if possible: */
    75     if (m_pValidator)
    76         m_pValidator->revalidate();
     73    /* Revalidate: */
     74    revalidate();
    7775}
    7876
     
    104102}
    105103
    106 void UIGlobalSettingsProxy::setValidator(UIPageValidator *pValidator)
     104bool UIGlobalSettingsProxy::validate(QString &strWarning, QString&)
    107105{
    108     /* Configure validation: */
    109     m_pValidator = pValidator;
     106    /* Pass if proxy is disabled: */
     107    if (!m_pCheckboxProxy->isChecked())
     108        return true;
     109
     110    /* Check for host/port values: */
     111    if (m_pHostEditor->text().trimmed().isEmpty())
     112    {
     113        strWarning = tr("host is not specified.");
     114        return false;
     115    }
     116    else if (m_pPortEditor->text().trimmed().isEmpty())
     117    {
     118        strWarning = tr("port is not specified.");
     119        return false;
     120    }
     121
     122    /* Pass by default: */
     123    return true;
    110124}
    111125
     
    129143    m_pContainerProxy->setEnabled(m_pCheckboxProxy->isChecked());
    130144
    131     /* Revalidate if possible: */
    132     if (m_pValidator)
    133         m_pValidator->revalidate();
     145    /* Revalidate: */
     146    revalidate();
    134147}
    135148
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h

    r47563 r47573  
    6262
    6363    /* API: Validation stuff: */
    64     void setValidator(UIPageValidator *pValidator);
     64    bool validate(QString &strWarning, QString &strTitle);
    6565
    6666    /* Helper: Navigation stuff: */
     
    7777private:
    7878
    79     /* Variable: Validation stuff: */
    80     UIPageValidator *m_pValidator;
    81 
    8279    /* Cache: */
    8380    UISettingsCacheGlobalProxy m_cache;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r47563 r47573  
    3232
    3333UIMachineSettingsDisplay::UIMachineSettingsDisplay()
    34     : m_pValidator(0)
    35     , m_iMinVRAM(0)
     34    : m_iMinVRAM(0)
    3635    , m_iMaxVRAM(0)
    3736    , m_iMaxVRAMVisible(0)
     
    7170    checkVRAMRequirements();
    7271
    73     /* Revalidate if possible: */
    74     if (m_pValidator)
    75         m_pValidator->revalidate();
     72    /* Revalidate: */
     73    revalidate();
    7674}
    7775
     
    177175    polishPage();
    178176
    179     /* Revalidate if possible: */
    180     if (m_pValidator)
    181         m_pValidator->revalidate();
     177    /* Revalidate: */
     178    revalidate();
    182179}
    183180
     
    304301}
    305302
    306 void UIMachineSettingsDisplay::setValidator(UIPageValidator *pValidator)
    307 {
    308     /* Configure validation: */
    309     m_pValidator = pValidator;
    310     connect(m_pCheckbox3D, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate()));
    311 #ifdef VBOX_WITH_VIDEOHWACCEL
    312     connect(m_pCheckbox2DVideo, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate()));
    313 #endif /* VBOX_WITH_VIDEOHWACCEL */
    314     connect(m_pCheckboxRemoteDisplay, SIGNAL(toggled(bool)), m_pValidator, SLOT(revalidate()));
    315     connect(m_pEditorRemoteDisplayPort, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    316     connect(m_pEditorRemoteDisplayTimeout, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    317 }
    318 
    319 bool UIMachineSettingsDisplay::revalidate(QString &strWarning, QString& /* strTitle */)
     303bool UIMachineSettingsDisplay::validate(QString &strWarning, QString&)
    320304{
    321305    /* Check if video RAM requirement changed first: */
     
    403387    }
    404388
     389    /* Pass by default: */
    405390    return true;
    406391}
     
    498483    m_pEditorVideoMemorySize->blockSignals(false);
    499484
    500     /* Revalidate if possible: */
    501     if (m_pValidator)
    502         m_pValidator->revalidate();
     485    /* Revalidate: */
     486    revalidate();
    503487}
    504488
     
    510494    m_pSliderVideoMemorySize->blockSignals(false);
    511495
    512     /* Revalidate if possible: */
    513     if (m_pValidator)
    514         m_pValidator->revalidate();
     496    /* Revalidate: */
     497    revalidate();
    515498}
    516499
     
    528511    updateVideoCaptureScreenCount();
    529512
    530     /* Revalidate if possible: */
    531     if (m_pValidator)
    532         m_pValidator->revalidate();
     513    /* Revalidate: */
     514    revalidate();
    533515}
    534516
     
    546528    updateVideoCaptureScreenCount();
    547529
    548     /* Revalidate if possible: */
    549     if (m_pValidator)
    550         m_pValidator->revalidate();
     530    /* Revalidate: */
     531    revalidate();
    551532}
    552533
     
    667648    prepareRemoteDisplayTab();
    668649    prepareVideoCaptureTab();
     650
     651    /* Prepare validation: */
     652    prepareValidation();
    669653
    670654    /* Translate finally: */
     
    812796}
    813797
     798void UIMachineSettingsDisplay::prepareValidation()
     799{
     800    /* Configure validation: */
     801    connect(m_pCheckbox3D, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     802#ifdef VBOX_WITH_VIDEOHWACCEL
     803    connect(m_pCheckbox2DVideo, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     804#endif /* VBOX_WITH_VIDEOHWACCEL */
     805    connect(m_pCheckboxRemoteDisplay, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
     806    connect(m_pEditorRemoteDisplayPort, SIGNAL(textChanged(const QString&)), this, SLOT(revalidate()));
     807    connect(m_pEditorRemoteDisplayTimeout, SIGNAL(textChanged(const QString&)), this, SLOT(revalidate()));
     808}
     809
    814810void UIMachineSettingsDisplay::checkVRAMRequirements()
    815811{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r47563 r47573  
    146146
    147147    /* API: Validation stuff: */
    148     void setValidator(UIPageValidator *pValidator);
    149     bool revalidate(QString &strWarning, QString &strTitle);
     148    bool validate(QString &strWarning, QString &strTitle);
    150149
    151150    /* Helper: Navigation stuff: */
     
    183182    void prepareRemoteDisplayTab();
    184183    void prepareVideoCaptureTab();
     184    void prepareValidation();
    185185
    186186    /* Helpers: Video stuff: */
     
    195195    static int calculateBitRate(int iFrameWidth, int iFrameHeight, int iFrameRate, int iQuality);
    196196    static int calculateQuality(int iFrameWidth, int iFrameHeight, int iFrameRate, int iBitRate);
    197 
    198     /* Variable: Validation stuff: */
    199     UIPageValidator *m_pValidator;
    200197
    201198    /* Guest OS type id: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp

    r47563 r47573  
    2929
    3030UIMachineSettingsGeneral::UIMachineSettingsGeneral()
    31     : m_pValidator(0)
    32     , m_fHWVirtExEnabled(false)
     31    : m_fHWVirtExEnabled(false)
    3332{
    3433    /* Apply UI decorations */
     
    5453#endif /* Q_WS_MAC */
    5554
     55    /* Prepare validation: */
     56    prepareValidation();
     57
    5658    /* Applying language settings */
    5759    retranslateUi();
     
    7274    m_fHWVirtExEnabled = fEnabled;
    7375
    74     /* Revalidate if possible: */
    75     if (m_pValidator)
    76         m_pValidator->revalidate();
     76    /* Revalidate: */
     77    revalidate();
    7778}
    7879
     
    146147    polishPage();
    147148
    148     /* Revalidate if possible: */
    149     if (m_pValidator)
    150         m_pValidator->revalidate();
     149    /* Revalidate: */
     150    revalidate();
    151151}
    152152
     
    224224}
    225225
    226 void UIMachineSettingsGeneral::setValidator(UIPageValidator *pValidator)
    227 {
    228     /* Configure validation: */
    229     m_pValidator = pValidator;
    230     connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), m_pValidator, SLOT(revalidate()));
    231     connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    232 }
    233 
    234 bool UIMachineSettingsGeneral::revalidate(QString &strWarning, QString& /* strTitle */)
     226bool UIMachineSettingsGeneral::validate(QString &strWarning, QString&)
    235227{
    236228    /* VM name validation: */
     
    250242    }
    251243
     244    /* Pass by default: */
    252245    return true;
    253246}
     
    293286    mCbDragAndDrop->setItemText (2, gpConverter->toString (KDragAndDropMode_GuestToHost));
    294287    mCbDragAndDrop->setItemText (3, gpConverter->toString (KDragAndDropMode_Bidirectional));
     288}
     289
     290void UIMachineSettingsGeneral::prepareValidation()
     291{
     292    /* Prepare validation: */
     293    connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(revalidate()));
     294    connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), this, SLOT(revalidate()));
    295295}
    296296
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h

    r47563 r47573  
    107107
    108108    /* API: Validation stuff: */
    109     void setValidator(UIPageValidator *pValidator);
    110     bool revalidate(QString &strWarning, QString &strTitle);
     109    bool validate(QString &strWarning, QString &strTitle);
    111110
    112111    void setOrderAfter (QWidget *aWidget);
     
    116115private:
    117116
     117    /* Helper: Prepare stuff: */
     118    void prepareValidation();
     119
    118120    void polishPage();
    119 
    120     /* Variable: Validation stuff: */
    121     UIPageValidator *m_pValidator;
    122121
    123122    /* Cache: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r47563 r47573  
    4848    : QIWithRetranslateUI<QWidget>(0)
    4949    , m_pParent(pParent)
    50     , m_pValidator(0)
    5150    , m_iSlot(-1)
    5251{
     
    6968    connect(this, SIGNAL(sigTabUpdated()), m_pParent, SLOT(sltHandleUpdatedTab()));
    7069
     70    /* Prepare validation: */
     71    prepareValidation();
     72
    7173    /* Applying language settings: */
    7274    retranslateUi();
     
    161163}
    162164
    163 void UIMachineSettingsNetwork::setValidator(UIPageValidator *pValidator)
    164 {
    165     /* Configure validation: */
    166     m_pValidator = pValidator;
    167     connect(m_pMACEditor, SIGNAL(textEdited(const QString &)), m_pValidator, SLOT(revalidate()));
    168 }
    169 
    170 bool UIMachineSettingsNetwork::revalidate(QString &strWarning, QString &strTitle)
    171 {
    172     /* 'True' for disabled adapter: */
     165bool UIMachineSettingsNetwork::validate(QString &strWarning, QString &strTitle)
     166{
     167    /* Pass if adapter is disabled: */
    173168    if (!m_pEnableAdapterCheckBox->isChecked())
    174169        return true;
     
    219214
    220215    /* Validate MAC-address length: */
    221     if (m_pMACEditor->text().size() < 12)
     216    if (fValid && m_pMACEditor->text().size() < 12)
    222217    {
    223218        strWarning = tr("the MAC address must be 12 hexadecimal digits long.");
     
    225220    }
    226221    /* Make sure MAC-address is unicast: */
    227     if (m_pMACEditor->text().size() >= 2)
     222    if (fValid && m_pMACEditor->text().size() >= 2)
    228223    {
    229224        QRegExp validator("^[0-9A-Fa-f][02468ACEace]");
     
    358353    m_pAdapterOptionsContainer->setEnabled(m_pEnableAdapterCheckBox->isChecked());
    359354
    360     /* Revalidate if possible: */
    361     if (m_pValidator)
    362         m_pValidator->revalidate();
     355    /* Revalidate: */
     356    m_pParent->revalidate();
    363357}
    364358
     
    484478    }
    485479
    486     /* Revalidate if possible: */
    487     if (m_pValidator)
    488         m_pValidator->revalidate();
     480    /* Revalidate: */
     481    m_pParent->revalidate();
    489482}
    490483
     
    517510    if (dlg.exec() == QDialog::Accepted)
    518511        m_portForwardingRules = dlg.rules();
     512}
     513
     514void UIMachineSettingsNetwork::prepareValidation()
     515{
     516    /* Configure validation: */
     517    connect(m_pMACEditor, SIGNAL(textEdited(const QString &)), m_pParent, SLOT(revalidate()));
    519518}
    520519
     
    727726/* UIMachineSettingsNetworkPage Stuff: */
    728727UIMachineSettingsNetworkPage::UIMachineSettingsNetworkPage()
    729     : m_pValidator(0)
    730     , m_pTwAdapters(0)
     728    : m_pTwAdapters(0)
    731729{
    732730    /* Setup main layout: */
     
    832830        pTab->fetchAdapterCache(m_cache.child(iSlot));
    833831
    834         /* Setup page validation: */
    835         pTab->setValidator(m_pValidator);
    836 
    837832        /* Setup tab order: */
    838833        pLastFocusWidget = pTab->setOrderAfter(pLastFocusWidget);
     
    845840    polishPage();
    846841
    847     /* Revalidate if possible: */
    848     if (m_pValidator)
    849         m_pValidator->revalidate();
     842    /* Revalidate: */
     843    revalidate();
    850844}
    851845
     
    945939}
    946940
    947 void UIMachineSettingsNetworkPage::setValidator(UIPageValidator *pValidator)
    948 {
    949     /* Configure validation: */
    950     m_pValidator = pValidator;
    951 }
    952 
    953 bool UIMachineSettingsNetworkPage::revalidate(QString &strWarning, QString &strTitle)
    954 {
     941bool UIMachineSettingsNetworkPage::validate(QString &strWarning, QString &strTitle)
     942{
     943    /* Pass by default: */
    955944    bool fValid = true;
    956945
     946    /* Delegate validation to adapters: */
    957947    for (int i = 0; i < m_pTwAdapters->count(); ++i)
    958948    {
    959949        UIMachineSettingsNetwork *pTab = qobject_cast<UIMachineSettingsNetwork*>(m_pTwAdapters->widget(i));
    960950        Assert(pTab);
    961         fValid = pTab->revalidate(strWarning, strTitle);
     951        fValid = pTab->validate(strWarning, strTitle);
    962952        if (!fValid)
    963953            break;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h

    r47563 r47573  
    110110
    111111    /* API: Validation stuff: */
    112     void setValidator(UIPageValidator *pValidator);
    113     bool revalidate(QString &strWarning, QString &strTitle);
     112    bool validate(QString &strWarning, QString &strTitle);
    114113
    115114    /* Navigation stuff: */
     
    145144private:
    146145
     146    /* Helper: Prepare stuff: */
     147    void prepareValidation();
     148
    147149    /* Helping stuff: */
    148150    void populateComboboxes();
     
    156158    /* Parent page: */
    157159    UIMachineSettingsNetworkPage *m_pParent;
    158 
    159     /* Variable: Validation stuff: */
    160     UIPageValidator *m_pValidator;
    161160
    162161    /* Other variables: */
     
    208207
    209208    /* API: Validation stuff: */
    210     void setValidator(UIPageValidator *pValidator);
    211     bool revalidate(QString &strWarning, QString &strTitle);
     209    bool validate(QString &strWarning, QString &strTitle);
    212210
    213211    /* Translation stuff: */
     
    234232    static void updateGenericProperties(CNetworkAdapter &adapter, const QString &strPropText);
    235233
    236     /* Variable: Validation stuff: */
    237     UIPageValidator *m_pValidator;
    238 
    239234    /* Tab holder: */
    240235    QITabWidget *m_pTwAdapters;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp

    r47563 r47573  
    3333UIMachineSettingsParallel::UIMachineSettingsParallel(UIMachineSettingsParallelPage *pParent)
    3434    : QIWithRetranslateUI<QWidget> (0)
    35     , m_pValidator(0)
    3635    , m_pParent(pParent)
    3736    , m_iSlot(-1)
     
    5958    connect (mCbNumber, SIGNAL (activated (const QString &)),
    6059             this, SLOT (mCbNumberActivated (const QString &)));
     60
     61    /* Prepare validation: */
     62    prepareValidation();
    6163
    6264    /* Applying language settings */
     
    114116}
    115117
    116 void UIMachineSettingsParallel::setValidator(UIPageValidator *pValidator)
    117 {
    118     /* Configure validation: */
    119     m_pValidator = pValidator;
    120     connect(mLeIRQ, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    121     connect(mLeIOPort, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    122     connect(mLePath, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    123 }
    124 
    125118QWidget* UIMachineSettingsParallel::setOrderAfter (QWidget *aAfter)
    126119{
     
    157150        mCbNumberActivated (mCbNumber->currentText());
    158151
    159     /* Revalidate if possible: */
    160     if (m_pValidator)
    161         m_pValidator->revalidate();
     152    /* Revalidate: */
     153    m_pParent->revalidate();
    162154}
    163155
     
    175167    }
    176168
    177     /* Revalidate if possible: */
    178     if (m_pValidator)
    179         m_pValidator->revalidate();
     169    /* Revalidate: */
     170    m_pParent->revalidate();
     171}
     172
     173void UIMachineSettingsParallel::prepareValidation()
     174{
     175    /* Prepare validation: */
     176    connect(mLeIRQ, SIGNAL(textChanged(const QString&)), m_pParent, SLOT(revalidate()));
     177    connect(mLeIOPort, SIGNAL(textChanged(const QString&)), m_pParent, SLOT(revalidate()));
     178    connect(mLePath, SIGNAL(textChanged(const QString&)), m_pParent, SLOT(revalidate()));
    180179}
    181180
     
    183182/* UIMachineSettingsParallelPage stuff */
    184183UIMachineSettingsParallelPage::UIMachineSettingsParallelPage()
    185     : m_pValidator(0)
    186     , mTabWidget(0)
     184    : mTabWidget(0)
    187185{
    188186    /* TabWidget creation */
     
    257255        pPage->fetchPortData(m_cache.child(iPort));
    258256
    259         /* Setup page validation: */
    260         pPage->setValidator(m_pValidator);
    261 
    262257        /* Setup tab order: */
    263258        pLastFocusWidget = pPage->setOrderAfter(pLastFocusWidget);
     
    270265    polishPage();
    271266
    272     /* Revalidate if possible: */
    273     if (m_pValidator)
    274         m_pValidator->revalidate();
     267    /* Revalidate: */
     268    revalidate();
    275269}
    276270
     
    331325}
    332326
    333 void UIMachineSettingsParallelPage::setValidator(UIPageValidator *pValidator)
    334 {
    335     /* Configure validation: */
    336     m_pValidator = pValidator;
    337 }
    338 
    339 bool UIMachineSettingsParallelPage::revalidate (QString &aWarning, QString &aTitle)
     327bool UIMachineSettingsParallelPage::validate(QString &strWarning, QString &strTitle)
    340328{
    341329    bool valid = true;
     
    362350            {
    363351                if (strIRQ.isEmpty())
    364                     aWarning = tr("IRC not specified.");
     352                    strWarning = tr("IRC not specified.");
    365353                else if (strIOPort.isEmpty())
    366                     aWarning = tr("IO port not specified.");
     354                    strWarning = tr("IO port not specified.");
    367355                else
    368                     aWarning = tr ("duplicate port attributes specified.");
    369                 aTitle += ": " +
     356                    strWarning = tr ("duplicate port attributes specified.");
     357                strTitle += ": " +
    370358                    vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(tab)));
    371359            }
     
    379367            if (!valid)
    380368            {
    381                 aWarning = path.isEmpty() ?
     369                strWarning = path.isEmpty() ?
    382370                    tr ("Port path not specified ") :
    383371                    tr ("Duplicate port path entered ");
    384                 aTitle += ": " +
     372                strTitle += ": " +
    385373                    vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
    386374                break;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h

    r47563 r47573  
    8484    void uploadPortData(UICacheSettingsMachineParallelPort &portCache);
    8585
    86     /* API: Validation stuff: */
    87     void setValidator(UIPageValidator *pValidator);
    88 
    8986    QWidget* setOrderAfter (QWidget *aAfter);
    9087
     
    103100private:
    104101
    105     /* Variable: Validation stuff: */
    106     UIPageValidator *m_pValidator;
     102    /* Helper: Prepare stuff: */
     103    void prepareValidation();
    107104
    108105    UIMachineSettingsParallelPage *m_pParent;
     
    139136
    140137    /* API: Validation stuff: */
    141     void setValidator(UIPageValidator *pValidator);
    142     bool revalidate (QString &aWarning, QString &aTitle);
     138    bool validate(QString &strWarning, QString &strTitle);
    143139
    144140    void retranslateUi();
     
    147143
    148144    void polishPage();
    149 
    150     /* Variable: Validation stuff: */
    151     UIPageValidator *m_pValidator;
    152145
    153146    QITabWidget *mTabWidget;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r47563 r47573  
    3434UIMachineSettingsSerial::UIMachineSettingsSerial(UIMachineSettingsSerialPage *pParent)
    3535    : QIWithRetranslateUI<QWidget> (0)
    36     , m_pValidator(0)
    3736    , m_pParent(pParent)
    3837    , m_iSlot(-1)
     
    6766    connect (mCbMode, SIGNAL (activated (const QString &)),
    6867             this, SLOT (mCbModeActivated (const QString &)));
     68
     69    /* Prepare validation: */
     70    prepareValidation();
    6971
    7072    /* Applying language settings */
     
    130132}
    131133
    132 void UIMachineSettingsSerial::setValidator(UIPageValidator *pValidator)
    133 {
    134     /* Configure validation: */
    135     m_pValidator = pValidator;
    136     connect(mLeIRQ, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    137     connect(mLeIOPort, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    138     connect(mLePath, SIGNAL(textChanged(const QString&)), m_pValidator, SLOT(revalidate()));
    139 }
    140 
    141134QWidget* UIMachineSettingsSerial::setOrderAfter (QWidget *aAfter)
    142135{
     
    183176    }
    184177
    185     /* Revalidate if possible: */
    186     if (m_pValidator)
    187         m_pValidator->revalidate();
     178    /* Revalidate: */
     179    m_pParent->revalidate();
    188180}
    189181
     
    201193    }
    202194
    203     /* Revalidate if possible: */
    204     if (m_pValidator)
    205         m_pValidator->revalidate();
     195    /* Revalidate: */
     196    m_pParent->revalidate();
    206197}
    207198
     
    212203    mLePath->setEnabled (mode != KPortMode_Disconnected);
    213204
    214     /* Revalidate if possible: */
    215     if (m_pValidator)
    216         m_pValidator->revalidate();
     205    /* Revalidate: */
     206    m_pParent->revalidate();
     207}
     208
     209void UIMachineSettingsSerial::prepareValidation()
     210{
     211    /* Prepare validation: */
     212    connect(mLeIRQ, SIGNAL(textChanged(const QString&)), m_pParent, SLOT(revalidate()));
     213    connect(mLeIOPort, SIGNAL(textChanged(const QString&)), m_pParent, SLOT(revalidate()));
     214    connect(mLePath, SIGNAL(textChanged(const QString&)), m_pParent, SLOT(revalidate()));
    217215}
    218216
     
    220218/* UIMachineSettingsSerialPage stuff */
    221219UIMachineSettingsSerialPage::UIMachineSettingsSerialPage()
    222     : m_pValidator(0)
    223     , mTabWidget(0)
     220    : mTabWidget(0)
    224221{
    225222    /* TabWidget creation */
     
    296293        pPage->fetchPortData(m_cache.child(iPort));
    297294
    298         /* Setup page validation: */
    299         pPage->setValidator(m_pValidator);
    300 
    301295        /* Setup tab order: */
    302296        pLastFocusWidget = pPage->setOrderAfter(pLastFocusWidget);
     
    309303    polishPage();
    310304
    311     /* Revalidate if possible: */
    312     if (m_pValidator)
    313         m_pValidator->revalidate();
     305    /* Revalidate: */
     306    revalidate();
    314307}
    315308
     
    375368}
    376369
    377 void UIMachineSettingsSerialPage::setValidator(UIPageValidator *pValidator)
    378 {
    379     /* Configure validation: */
    380     m_pValidator = pValidator;
    381 }
    382 
    383 bool UIMachineSettingsSerialPage::revalidate (QString &aWarning, QString &aTitle)
     370bool UIMachineSettingsSerialPage::validate(QString &strWarning, QString &strTitle)
    384371{
    385372    bool valid = true;
     
    406393            {
    407394                if (strIRQ.isEmpty())
    408                     aWarning = tr("IRC not specified.");
     395                    strWarning = tr("IRC not specified.");
    409396                else if (strIOPort.isEmpty())
    410                     aWarning = tr("IO port not specified.");
     397                    strWarning = tr("IO port not specified.");
    411398                else
    412                     aWarning = tr ("duplicate port attributes specified.");
    413                 aTitle += ": " +
     399                    strWarning = tr ("duplicate port attributes specified.");
     400                strTitle += ": " +
    414401                    vboxGlobal().removeAccelMark(mTabWidget->tabText(mTabWidget->indexOf(tab)));
    415402            }
     
    430417                else
    431418                {
    432                     aWarning = path.isEmpty() ?
     419                    strWarning = path.isEmpty() ?
    433420                        tr ("port path not specified.") :
    434421                        tr ("duplicate port path entered.");
    435                     aTitle += ": " +
     422                    strTitle += ": " +
    436423                        vboxGlobal().removeAccelMark (mTabWidget->tabText (mTabWidget->indexOf (tab)));
    437424                    break;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h

    r47563 r47573  
    9090    void uploadPortData(UICacheSettingsMachineSerialPort &data);
    9191
    92     /* API: Validation stuff: */
    93     void setValidator(UIPageValidator *pValidator);
    94 
    9592    QWidget* setOrderAfter (QWidget *aAfter);
    9693
     
    110107private:
    111108
    112     /* Variable: Validation stuff: */
    113     UIPageValidator *m_pValidator;
     109    /* Helper: Prepare stuff: */
     110    void prepareValidation();
    114111
    115112    UIMachineSettingsSerialPage *m_pParent;
     
    146143
    147144    /* API: Validation stuff: */
    148     void setValidator(UIPageValidator *pValidator);
    149     bool revalidate (QString &aWarning, QString &aTitle);
     145    bool validate(QString &strWarning, QString &strTitle);
    150146
    151147    void retranslateUi();
     
    154150
    155151    void polishPage();
    156 
    157     /* Variable: Validation stuff: */
    158     UIPageValidator *m_pValidator;
    159152
    160153    QITabWidget *mTabWidget;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r47563 r47573  
    17191719 */
    17201720UIMachineSettingsStorage::UIMachineSettingsStorage()
    1721     : m_pValidator(0)
    1722     , mStorageModel(0)
     1721    : mStorageModel(0)
    17231722    , mAddCtrAction(0), mDelCtrAction(0)
    17241723    , mAddIDECtrAction(0), mAddSATACtrAction(0), mAddSCSICtrAction(0), mAddSASCtrAction(0), mAddFloppyCtrAction(0)
     
    18961895    updateActionsState();
    18971896
    1898     /* Revalidate if possible: */
    1899     if (m_pValidator)
    1900         m_pValidator->revalidate();
     1897    /* Revalidate: */
     1898    revalidate();
    19011899}
    19021900
     
    20372035    polishPage();
    20382036
    2039     /* Revalidate if possible: */
    2040     if (m_pValidator)
    2041         m_pValidator->revalidate();
     2037    /* Revalidate: */
     2038    revalidate();
    20422039}
    20432040
     
    21072104}
    21082105
    2109 void UIMachineSettingsStorage::setValidator(UIPageValidator *pValidator)
    2110 {
    2111     /* Configure validation: */
    2112     m_pValidator = pValidator;
    2113 }
    2114 
    2115 bool UIMachineSettingsStorage::revalidate (QString &strWarning, QString& /* strTitle */)
     2106bool UIMachineSettingsStorage::validate(QString &strWarning, QString&)
    21162107{
    21172108    /* Check controllers for name emptiness & coincidence.
     
    21912182    }
    21922183
     2184    /* Pass by default: */
    21932185    return true;
    21942186}
     
    22802272                mStorageModel->setData (attIndex, attMediumId, StorageModel::R_AttMediumId);
    22812273
    2282                 /* Revalidate if possible: */
    2283                 if (m_pValidator)
    2284                     m_pValidator->revalidate();
     2274                /* Revalidate: */
     2275                revalidate();
    22852276            }
    22862277        }
     
    23022293                mStorageModel->setData (attIndex, UIMedium().id(), StorageModel::R_AttMediumId);
    23032294
    2304                 /* Revalidate if possible: */
    2305                 if (m_pValidator)
    2306                     m_pValidator->revalidate();
     2295                /* Revalidate: */
     2296                revalidate();
    23072297            }
    23082298        }
     
    23542344    emit storageChanged();
    23552345
    2356     /* Revalidate if possible: */
    2357     if (m_pValidator)
    2358         m_pValidator->revalidate();
     2346    /* Revalidate: */
     2347    revalidate();
    23592348}
    23602349
     
    24362425    emit storageChanged();
    24372426
    2438     /* Revalidate if possible: */
    2439     if (m_pValidator)
    2440         m_pValidator->revalidate();
     2427    /* Revalidate: */
     2428    revalidate();
    24412429}
    24422430
     
    25642552    }
    25652553
    2566     /* Revalidate if possible: */
    2567     if (m_pValidator)
    2568         m_pValidator->revalidate();
     2554    /* Revalidate: */
     2555    revalidate();
    25692556
    25702557    mIsLoadingInProgress = false;
     
    31023089        emit storageChanged();
    31033090
    3104         /* Revalidate if possible: */
    3105         if (m_pValidator)
    3106             m_pValidator->revalidate();
     3091        /* Revalidate: */
     3092        revalidate();
    31073093    }
    31083094}
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h

    r47563 r47573  
    674674
    675675    /* API: Validation stuff: */
    676     void setValidator(UIPageValidator *pValidator);
    677     bool revalidate (QString &aWarning, QString &aTitle);
     676    bool validate(QString &strWarning, QString &strTitle);
    678677
    679678    void retranslateUi();
     
    757756    void polishPage();
    758757
    759     /* Variable: Validation stuff: */
    760     UIPageValidator *m_pValidator;
    761 
    762758    QString m_strMachineId;
    763759    QString m_strMachineSettingsFilePath;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r47563 r47573  
    3535
    3636UIMachineSettingsSystem::UIMachineSettingsSystem()
    37     : m_pValidator(0)
    38     , m_uMinGuestCPU(0), m_uMaxGuestCPU(0)
     37    : m_uMinGuestCPU(0), m_uMaxGuestCPU(0)
    3938    , m_uMinGuestCPUExecCap(0), m_uMedGuestCPUExecCap(0), m_uMaxGuestCPUExecCap(0)
    4039    , m_fOHCIEnabled(false)
     
    6867    m_fOHCIEnabled = fEnabled;
    6968
    70     /* Revalidate if possible: */
    71     if (m_pValidator)
    72         m_pValidator->revalidate();
     69    /* Revalidate: */
     70    revalidate();
    7371}
    7472
     
    187185    polishPage();
    188186
    189     /* Revalidate if possible: */
    190     if (m_pValidator)
    191         m_pValidator->revalidate();
     187    /* Revalidate: */
     188    revalidate();
    192189}
    193190
     
    288285}
    289286
    290 void UIMachineSettingsSystem::setValidator(UIPageValidator *pValidator)
    291 {
    292     /* Configure validation: */
    293     m_pValidator = pValidator;
    294     connect(m_pComboChipsetType, SIGNAL(currentIndexChanged(int)), m_pValidator, SLOT(revalidate()));
    295     connect(m_pComboPointingHIDType, SIGNAL(currentIndexChanged(int)), m_pValidator, SLOT(revalidate()));
    296     connect(m_pCheckBoxApic, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate()));
    297     connect(m_pCheckBoxVirtualization, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate()));
    298 }
    299 
    300 bool UIMachineSettingsSystem::revalidate(QString &strWarning, QString& /* strTitle */)
     287bool UIMachineSettingsSystem::validate(QString &strWarning, QString&)
    301288{
    302289    /* RAM amount test: */
     
    506493    m_pEditorMemorySize->blockSignals(false);
    507494
    508     /* Revalidate if possible: */
    509     if (m_pValidator)
    510         m_pValidator->revalidate();
     495    /* Revalidate: */
     496    revalidate();
    511497}
    512498
     
    518504    m_pSliderMemorySize->blockSignals(false);
    519505
    520     /* Revalidate if possible: */
    521     if (m_pValidator)
    522         m_pValidator->revalidate();
     506    /* Revalidate: */
     507    revalidate();
    523508}
    524509
     
    542527    m_pEditorCPUCount->blockSignals(false);
    543528
    544     /* Revalidate if possible: */
    545     if (m_pValidator)
    546         m_pValidator->revalidate();
     529    /* Revalidate: */
     530    revalidate();
    547531}
    548532
     
    554538    m_pSliderCPUCount->blockSignals(false);
    555539
    556     /* Revalidate if possible: */
    557     if (m_pValidator)
    558         m_pValidator->revalidate();
     540    /* Revalidate: */
     541    revalidate();
    559542}
    560543
     
    566549    m_pEditorCPUExecCap->blockSignals(false);
    567550
    568     /* Revalidate if possible: */
    569     if (m_pValidator)
    570         m_pValidator->revalidate();
     551    /* Revalidate: */
     552    revalidate();
    571553}
    572554
     
    578560    m_pSliderCPUExecCap->blockSignals(false);
    579561
    580     /* Revalidate if possible: */
    581     if (m_pValidator)
    582         m_pValidator->revalidate();
     562    /* Revalidate: */
     563    revalidate();
    583564}
    584565
     
    588569    Ui::UIMachineSettingsSystem::setupUi(this);
    589570
    590     /* Prepare 'motherboard' tab: */
     571    /* Prepare tabs: */
    591572    prepareTabMotherboard();
    592 
    593     /* Prepare 'processor' tab: */
    594573    prepareTabProcessor();
     574
     575    /* Prepare validation: */
     576    prepareValidation();
    595577
    596578    /* Retranslate finally: */
     
    711693    connect(m_pSliderCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapSliderChange()));
    712694    connect(m_pEditorCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapEditorChange()));
     695}
     696
     697void UIMachineSettingsSystem::prepareValidation()
     698{
     699    /* Prepare validation: */
     700    connect(m_pComboChipsetType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate()));
     701    connect(m_pComboPointingHIDType, SIGNAL(currentIndexChanged(int)), this, SLOT(revalidate()));
     702    connect(m_pCheckBoxApic, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     703    connect(m_pCheckBoxVirtualization, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
    713704}
    714705
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h

    r47563 r47573  
    153153
    154154    /* API: Validation stuff: */
    155     void setValidator(UIPageValidator *pValidator);
    156     bool revalidate(QString &strWarning, QString &strTitle);
     155    bool validate(QString &strWarning, QString &strTitle);
    157156
    158157    /* Helper: Navigation stuff: */
     
    186185    void prepareTabMotherboard();
    187186    void prepareTabProcessor();
     187    void prepareValidation();
    188188
    189189    /* Helper: Pointing HID type combo stuff: */
     
    199199    /* Handler: Event-filtration stuff: */
    200200    bool eventFilter(QObject *aObject, QEvent *aEvent);
    201 
    202     /* Variable: Validation stuff: */
    203     UIPageValidator *m_pValidator;
    204201
    205202    /* Variable: Boot-table stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r47563 r47573  
    140140UIMachineSettingsUSB::UIMachineSettingsUSB(UISettingsPageType type)
    141141    : UISettingsPage(type)
    142     , m_pValidator(0)
    143142    , m_pToolBar(0)
    144143    , mNewAction(0), mAddAction(0), mEdtAction(0), mDelAction(0)
     
    218217    /* Setup dialog */
    219218    mTwFilters->header()->hide();
     219
     220    /* Prepare validation: */
     221    prepareValidation();
    220222
    221223    /* Applying language settings */
     
    386388    polishPage();
    387389
    388     /* Revalidate if possible: */
    389     if (m_pValidator)
    390         m_pValidator->revalidate();
     390    /* Revalidate: */
     391    revalidate();
    391392}
    392393
     
    564565}
    565566
    566 void UIMachineSettingsUSB::setValidator(UIPageValidator *pValidator)
    567 {
    568     /* Configure validation: */
    569     m_pValidator = pValidator;
    570     connect(mGbUSB, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate()));
    571     connect(mCbUSB2, SIGNAL(stateChanged(int)), m_pValidator, SLOT(revalidate()));
    572 }
    573 
    574 bool UIMachineSettingsUSB::revalidate(QString &strWarningText, QString& /* strTitle */)
    575 {
     567bool UIMachineSettingsUSB::validate(QString &strWarningText, QString&)
     568{
     569    NOREF(strWarningText);
     570
     571#ifdef VBOX_WITH_EXTPACK
    576572    /* USB 2.0 Extension Pack presence test: */
    577     NOREF(strWarningText);
    578 #ifdef VBOX_WITH_EXTPACK
    579573    CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
    580574    if (mGbUSB->isChecked() && mCbUSB2->isChecked() && (extPack.isNull() || !extPack.GetUsable()))
     
    590584        return true;
    591585    }
    592 #endif
     586#endif /* VBOX_WITH_EXTPACK */
     587
     588    /* Pass by default: */
    593589    return true;
    594590}
     
    712708    addUSBFilter(usbFilterData, true /* its new? */);
    713709
    714     /* Revalidate if possible: */
    715     if (m_pValidator)
    716         m_pValidator->revalidate();
     710    /* Revalidate: */
     711    revalidate();
    717712}
    718713
     
    760755    addUSBFilter(usbFilterData, true /* its new? */);
    761756
    762     /* Revalidate if possible: */
    763     if (m_pValidator)
    764         m_pValidator->revalidate();
     757    /* Revalidate: */
     758    revalidate();
    765759}
    766760
     
    858852    /* Update current item: */
    859853    currentChanged(mTwFilters->currentItem());
    860     /* Revalidate if possible: */
    861     if (!mTwFilters->topLevelItemCount())
    862     {
    863         /* Revalidate if possible: */
    864         if (m_pValidator)
    865             m_pValidator->revalidate();
    866     }
     854
     855    /* Revalidate: */
     856    revalidate();
    867857}
    868858
     
    924914}
    925915
     916void UIMachineSettingsUSB::prepareValidation()
     917{
     918    /* Prepare validation: */
     919    connect(mGbUSB, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     920    connect(mCbUSB2, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
     921}
     922
    926923void UIMachineSettingsUSB::addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fIsNew)
    927924{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h

    r47563 r47573  
    143143
    144144    /* API: Validation stuff: */
    145     void setValidator(UIPageValidator *pValidator);
    146     bool revalidate(QString &strWarningText, QString &strTitle);
     145    bool validate(QString &strWarningText, QString &strTitle);
    147146
    148147    void setOrderAfter (QWidget *aWidget);
     
    167166private:
    168167
     168    /* Helper: Prepare stuff: */
     169    void prepareValidation();
     170
    169171    void addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fIsNew);
    170172
     
    179181
    180182    void polishPage();
    181 
    182     /* Variable: Validation stuff: */
    183     UIPageValidator *m_pValidator;
    184183
    185184    /* Global data source: */
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