VirtualBox

Changeset 36324 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 21, 2011 12:34:49 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70651
Message:

FE/Qt: Settings page API: Some internal cleanup and refactoring.

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

Legend:

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

    r34740 r36324  
    77
    88/*
    9  * Copyright (C) 2006-2010 Oracle Corporation
     9 * Copyright (C) 2006-2011 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121#include "UISettingsPage.h"
    2222
    23 /* Returns settings page type: */
    24 UISettingsPageType UISettingsPage::type() const
    25 {
    26     return m_type;
    27 }
    28 
    29 /* Validation stuff: */
    30 void UISettingsPage::setValidator(QIWidgetValidator *pValidator)
    31 {
    32     Q_UNUSED(pValidator);
    33 }
    34 
    35 /* Validation stuff: */
    36 bool UISettingsPage::revalidate(QString &strWarningText, QString &strTitle)
    37 {
    38     Q_UNUSED(strWarningText);
    39     Q_UNUSED(strTitle);
    40     return true;
    41 }
    42 
    43 /* Navigation stuff: */
    44 void UISettingsPage::setOrderAfter(QWidget *pWidget)
    45 {
    46     m_pFirstWidget = pWidget;
    47 }
    48 
    49 /* Page 'ID' stuff: */
    50 int UISettingsPage::id() const
    51 {
    52     return m_cId;
    53 }
    54 
    55 /* Page 'ID' stuff: */
    56 void UISettingsPage::setId(int cId)
    57 {
    58     m_cId = cId;
    59 }
    60 
    61 /* Page 'processed' stuff: */
    62 bool UISettingsPage::processed() const
    63 {
    64     return m_fProcessed;
    65 }
    66 
    67 /* Page 'processed' stuff: */
    68 void UISettingsPage::setProcessed(bool fProcessed)
    69 {
    70     m_fProcessed = fProcessed;
    71 }
    72 
    73 /* Page 'failed' stuff: */
    74 bool UISettingsPage::failed() const
    75 {
    76     return m_fFailed;
    77 }
    78 
    79 /* Page 'failed' stuff: */
    80 void UISettingsPage::setFailed(bool fFailed)
    81 {
    82     m_fFailed = fFailed;
    83 }
    84 
    8523/* Settings page constructor, hidden: */
    86 UISettingsPage::UISettingsPage(UISettingsPageType type, QWidget *pParent)
    87     : QIWithRetranslateUI<QWidget>(pParent)
    88     , m_type(type)
     24UISettingsPage::UISettingsPage(UISettingsPageType pageType)
     25    : m_pageType(pageType)
    8926    , m_cId(-1)
    9027    , m_fProcessed(false)
    9128    , m_fFailed(false)
    9229    , m_pFirstWidget(0)
     30{
     31}
     32
     33/* Global settings page constructor, hidden: */
     34UISettingsPageGlobal::UISettingsPageGlobal()
     35    : UISettingsPage(UISettingsPageType_Global)
    9336{
    9437}
     
    10750}
    10851
    109 /* Global settings page constructor, hidden: */
    110 UISettingsPageGlobal::UISettingsPageGlobal(QWidget *pParent)
    111     : UISettingsPage(UISettingsPageType_Global, pParent)
     52/* Machine settings page constructor, hidden: */
     53UISettingsPageMachine::UISettingsPageMachine()
     54    : UISettingsPage(UISettingsPageType_Machine)
    11255{
    11356}
     
    12568}
    12669
    127 /* Machine settings page constructor, hidden: */
    128 UISettingsPageMachine::UISettingsPageMachine(QWidget *pParent)
    129     : UISettingsPage(UISettingsPageType_Machine, pParent)
    130 {
    131 }
    132 
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h

    r34740 r36324  
    66
    77/*
    8  * Copyright (C) 2006-2010 Oracle Corporation
     8 * Copyright (C) 2006-2011 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#define __UISettingsPage_h__
    2121
    22 /* Global includes */
     22/* Qt includes */
    2323#include <QWidget>
    2424#include <QVariant>
    2525
    26 /* Local includes */
     26/* Other includes */
    2727#include "QIWithRetranslateUI.h"
    2828#include "COMDefs.h"
     
    8181    virtual void saveFromCacheTo(QVariant &data) = 0;
    8282
    83     /* Returns settings page type: */
    84     virtual UISettingsPageType type() const;
    85 
    8683    /* Validation stuff: */
    87     virtual void setValidator(QIWidgetValidator *pValidator);
    88     virtual bool revalidate(QString &strWarningText, QString &strTitle);
     84    virtual void setValidator(QIWidgetValidator* /* pValidator */) {}
     85    virtual bool revalidate(QString& /* strWarningText */, QString& /* strTitle */) { return true; }
    8986
    9087    /* Navigation stuff: */
    91     virtual void setOrderAfter(QWidget *pWidget);
     88    QWidget* firstWidget() const { return m_pFirstWidget; }
     89    virtual void setOrderAfter(QWidget *pWidget) { m_pFirstWidget = pWidget; }
     90
     91    /* Settings page type stuff: */
     92    UISettingsPageType pageType() const { return m_pageType; }
    9293
    9394    /* Page 'ID' stuff: */
    94     int id() const;
    95     void setId(int cId);
     95    int id() const { return m_cId; }
     96    void setId(int cId) { m_cId = cId; }
    9697
    9798    /* Page 'processed' stuff: */
    98     bool processed() const;
    99     void setProcessed(bool fProcessed);
     99    bool processed() const { return m_fProcessed; }
     100    void setProcessed(bool fProcessed) { m_fProcessed = fProcessed; }
    100101
    101102    /* Page 'failed' stuff: */
    102     bool failed() const;
    103     void setFailed(bool fFailed);
     103    bool failed() const { return m_fFailed; }
     104    void setFailed(bool fFailed) { m_fFailed = fFailed; }
    104105
    105106protected:
    106107
    107108    /* Settings page constructor, hidden: */
    108     UISettingsPage(UISettingsPageType type, QWidget *pParent = 0);
     109    UISettingsPage(UISettingsPageType type);
    109110
    110     /* Variables: */
    111     UISettingsPageType m_type;
     111private:
     112
     113    /* Private variables: */
     114    UISettingsPageType m_pageType;
    112115    int m_cId;
    113116    bool m_fProcessed;
     
    123126protected:
    124127
     128    /* Global settings page constructor, hidden: */
     129    UISettingsPageGlobal();
     130
    125131    /* Fetch data to m_properties & m_settings: */
    126132    void fetchData(const QVariant &data);
     
    128134    /* Upload m_properties & m_settings to data: */
    129135    void uploadData(QVariant &data) const;
    130 
    131     /* Global settings page constructor, hidden: */
    132     UISettingsPageGlobal(QWidget *pParent = 0);
    133136
    134137    /* Global data source: */
     
    144147protected:
    145148
     149    /* Machine settings page constructor, hidden: */
     150    UISettingsPageMachine();
     151
    146152    /* Fetch data to m_machine: */
    147153    void fetchData(const QVariant &data);
     
    149155    /* Upload m_machine to data: */
    150156    void uploadData(QVariant &data) const;
    151 
    152     /* Machine settings page constructor, hidden: */
    153     UISettingsPageMachine(QWidget *pParent = 0);
    154157
    155158    /* Machine data source: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r36104 r36324  
    318318
    319319    /* Update alternative-name combo-box availability: */
    320     m_pAdapterNameLabel->setEnabled(attachmentType() != KNetworkAttachmentType_Null &&
    321                                     attachmentType() != KNetworkAttachmentType_NAT);
    322320    m_pAdapterNameCombo->setEnabled(attachmentType() != KNetworkAttachmentType_Null &&
    323321                                    attachmentType() != KNetworkAttachmentType_NAT);
    324     m_pPromiscuousModeLabel->setEnabled(attachmentType() != KNetworkAttachmentType_Null &&
    325                                         attachmentType() != KNetworkAttachmentType_NAT);
    326322    m_pPromiscuousModeCombo->setEnabled(attachmentType() != KNetworkAttachmentType_Null &&
    327323                                        attachmentType() != KNetworkAttachmentType_NAT);
     
    827823{
    828824    /* Setup tab order: */
    829     Assert(m_pFirstWidget);
    830     setTabOrder(m_pFirstWidget, m_pTwAdapters->focusProxy());
     825    Assert(firstWidget());
     826    setTabOrder(firstWidget(), m_pTwAdapters->focusProxy());
    831827    QWidget *pLastFocusWidget = m_pTwAdapters->focusProxy();
    832828
     
    911907                adapter.AttachToHostOnlyInterface();
    912908                break;
    913     #ifdef VBOX_WITH_VDE
     909#ifdef VBOX_WITH_VDE
    914910            case KNetworkAttachmentType_VDE:
    915911                adapter.SetVDENetwork(data.m_strVDENetworkName);
    916912                adapter.AttachToVDE();
    917913                break;
    918     #endif
     914#endif /* VBOX_WITH_VDE */
    919915            default:
    920916                break;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp

    r33882 r36324  
    77
    88/*
    9  * Copyright (C) 2006-2010 Oracle Corporation
     9 * Copyright (C) 2006-2011 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    196196void UIMachineSettingsParallelPage::getFromCache()
    197197{
    198     Assert(m_pFirstWidget);
    199     setTabOrder(m_pFirstWidget, mTabWidget->focusProxy());
     198    Assert(firstWidget());
     199    setTabOrder(firstWidget(), mTabWidget->focusProxy());
    200200    QWidget *pLastFocusWidget = mTabWidget->focusProxy();
    201201
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp

    r33909 r36324  
    77
    88/*
    9  * Copyright (C) 2006-2008 Oracle Corporation
     9 * Copyright (C) 2006-2011 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    172172    KPortMode mode = vboxGlobal().toPortMode (aText);
    173173    mCbPipe->setEnabled (mode == KPortMode_HostPipe);
    174     mLbPath->setEnabled (mode != KPortMode_Disconnected);
    175174    mLePath->setEnabled (mode != KPortMode_Disconnected);
    176175    if (mValidator)
     
    245244void UIMachineSettingsSerialPage::getFromCache()
    246245{
    247     Assert(m_pFirstWidget);
    248     setTabOrder(m_pFirstWidget, mTabWidget->focusProxy());
     246    Assert(firstWidget());
     247    setTabOrder(firstWidget(), mTabWidget->focusProxy());
    249248    QWidget *pLastFocusWidget = mTabWidget->focusProxy();
    250249
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp

    r33912 r36324  
    77
    88/*
    9  * Copyright (C) 2006-2010 Oracle Corporation
     9 * Copyright (C) 2006-2011 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    154154
    155155    /* Depending on page type: */
    156     switch (type())
     156    switch (pageType())
    157157    {
    158158        case UISettingsPageType_Global:
     
    237237{
    238238    /* Depending on page type: */
    239     switch (type())
     239    switch (pageType())
    240240    {
    241241        case UISettingsPageType_Global:
     
    275275{
    276276    /* Depending on page type: */
    277     switch (type())
     277    switch (pageType())
    278278    {
    279279        case UISettingsPageType_Machine:
     
    297297
    298298    /* Depending on page type: */
    299     switch (type())
     299    switch (pageType())
    300300    {
    301301        case UISettingsPageType_Global:
     
    470470    /* Add new corresponding list item to the cache: */
    471471    UIUSBFilterData data;
    472     switch (type())
     472    switch (pageType())
    473473    {
    474474        case UISettingsPageType_Global:
     
    507507    /* Add new corresponding list item to the cache: */
    508508    UIUSBFilterData data;
    509     switch (type())
     509    switch (pageType())
    510510    {
    511511        case UISettingsPageType_Global:
     
    555555
    556556    /* Configure USB filter details dialog: */
    557     UIMachineSettingsUSBFilterDetails dlgFilterDetails(type(), this);
     557    UIMachineSettingsUSBFilterDetails dlgFilterDetails(pageType(), this);
    558558    dlgFilterDetails.mLeName->setText(data.m_strName);
    559559    dlgFilterDetails.mLeVendorID->setText(data.m_strVendorId);
     
    564564    dlgFilterDetails.mLeProduct->setText(data.m_strProduct);
    565565    dlgFilterDetails.mLeSerialNo->setText(data.m_strSerialNumber);
    566     switch (type())
     566    switch (pageType())
    567567    {
    568568        case UISettingsPageType_Global:
     
    602602        data.m_strSerialNumber = dlgFilterDetails.mLeSerialNo->text().isEmpty() ? QString::null : dlgFilterDetails.mLeSerialNo->text();
    603603        data.m_strPort = dlgFilterDetails.mLePort->text().isEmpty() ? QString::null : dlgFilterDetails.mLePort->text();
    604         switch (type())
     604        switch (pageType())
    605605        {
    606606            case UISettingsPageType_Global:
     
    724724void UIMachineSettingsUSB::fetchData(const QVariant &data)
    725725{
    726     switch (type())
     726    switch (pageType())
    727727    {
    728728        case UISettingsPageType_Global:
     
    745745void UIMachineSettingsUSB::uploadData(QVariant &data) const
    746746{
    747     switch (type())
     747    switch (pageType())
    748748    {
    749749        case UISettingsPageType_Global:
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