VirtualBox

Changeset 66169 in vbox


Ignore:
Timestamp:
Mar 20, 2017 2:18:54 PM (8 years ago)
Author:
vboxsync
Message:

FE/Qt: Global preferences: Refactoring some of help-classes like cache related stuff to be in sources, not headers.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/global
Files:
17 edited

Legend:

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

    r65681 r66169  
    2727
    2828
     29/** Global settings: Display page data structure. */
     30struct UIDataSettingsGlobalDisplay
     31{
     32    /** Constructs data. */
     33    UIDataSettingsGlobalDisplay()
     34        : m_strMaxGuestResolution(QString())
     35        , m_fActivateHoveredMachineWindow(false)
     36    {}
     37
     38    /** Returns whether the @a other passed data is equal to this one. */
     39    bool equal(const UIDataSettingsGlobalDisplay &other) const
     40    {
     41        return true
     42               && (m_strMaxGuestResolution == other.m_strMaxGuestResolution)
     43               && (m_fActivateHoveredMachineWindow == other.m_fActivateHoveredMachineWindow)
     44               ;
     45    }
     46
     47    /** Returns whether the @a other passed data is equal to this one. */
     48    bool operator==(const UIDataSettingsGlobalDisplay &other) const { return equal(other); }
     49    /** Returns whether the @a other passed data is different from this one. */
     50    bool operator!=(const UIDataSettingsGlobalDisplay &other) const { return !equal(other); }
     51
     52    /** Holds the maximum guest resolution or preset name. */
     53    QString m_strMaxGuestResolution;
     54    /** Holds whether we should automatically activate machine window under the mouse cursor. */
     55    bool m_fActivateHoveredMachineWindow;
     56};
     57
     58
    2959UIGlobalSettingsDisplay::UIGlobalSettingsDisplay()
     60    : m_pCache(new UISettingsCacheGlobalDisplay)
    3061{
    3162    /* Apply UI decorations: */
     
    4879}
    4980
     81UIGlobalSettingsDisplay::~UIGlobalSettingsDisplay()
     82{
     83    /* Cleanup cache: */
     84    delete m_pCache;
     85    m_pCache = 0;
     86}
     87
    5088void UIGlobalSettingsDisplay::loadToCacheFrom(QVariant &data)
    5189{
     
    5492
    5593    /* Clear cache initially: */
    56     m_cache.clear();
     94    m_pCache->clear();
    5795
    5896    /* Prepare old data: */
     
    64102
    65103    /* Cache old data: */
    66     m_cache.cacheInitialData(oldData);
     104    m_pCache->cacheInitialData(oldData);
    67105
    68106    /* Upload properties & settings to data: */
     
    73111{
    74112    /* Get old data from cache: */
    75     const UIDataSettingsGlobalDisplay &oldData = m_cache.base();
     113    const UIDataSettingsGlobalDisplay &oldData = m_pCache->base();
    76114
    77115    /* Load old data from cache: */
     
    104142{
    105143    /* Prepare new data: */
    106     UIDataSettingsGlobalDisplay newData = m_cache.base();
     144    UIDataSettingsGlobalDisplay newData = m_pCache->base();
    107145
    108146    /* Gather new data: */
     
    127165
    128166    /* Cache new data: */
    129     m_cache.cacheCurrentData(newData);
     167    m_pCache->cacheCurrentData(newData);
    130168}
    131169
     
    136174
    137175    /* Save new data from cache: */
    138     if (m_cache.wasChanged())
    139     {
    140         if (m_cache.data().m_strMaxGuestResolution != m_cache.base().m_strMaxGuestResolution)
    141             m_settings.setMaxGuestRes(m_cache.data().m_strMaxGuestResolution);
    142         if (m_cache.data().m_fActivateHoveredMachineWindow != m_cache.base().m_fActivateHoveredMachineWindow)
    143             gEDataManager->setActivateHoveredMachineWindow(m_cache.data().m_fActivateHoveredMachineWindow);
     176    if (m_pCache->wasChanged())
     177    {
     178        if (m_pCache->data().m_strMaxGuestResolution != m_pCache->base().m_strMaxGuestResolution)
     179            m_settings.setMaxGuestRes(m_pCache->data().m_strMaxGuestResolution);
     180        if (m_pCache->data().m_fActivateHoveredMachineWindow != m_pCache->base().m_fActivateHoveredMachineWindow)
     181            gEDataManager->setActivateHoveredMachineWindow(m_pCache->data().m_fActivateHoveredMachineWindow);
    144182    }
    145183
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h

    r66163 r66169  
    2323#include "UIGlobalSettingsDisplay.gen.h"
    2424
    25 
    26 /** Global settings: Display page data structure. */
    27 struct UIDataSettingsGlobalDisplay
    28 {
    29     /** Constructs data. */
    30     UIDataSettingsGlobalDisplay()
    31         : m_strMaxGuestResolution(QString())
    32         , m_fActivateHoveredMachineWindow(false)
    33     {}
    34 
    35     /** Returns whether the @a other passed data is equal to this one. */
    36     bool equal(const UIDataSettingsGlobalDisplay &other) const
    37     {
    38         return true
    39                && (m_strMaxGuestResolution == other.m_strMaxGuestResolution)
    40                && (m_fActivateHoveredMachineWindow == other.m_fActivateHoveredMachineWindow)
    41                ;
    42     }
    43 
    44     /** Returns whether the @a other passed data is equal to this one. */
    45     bool operator==(const UIDataSettingsGlobalDisplay &other) const { return equal(other); }
    46     /** Returns whether the @a other passed data is different from this one. */
    47     bool operator!=(const UIDataSettingsGlobalDisplay &other) const { return !equal(other); }
    48 
    49     /** Holds the maximum guest resolution or preset name. */
    50     QString m_strMaxGuestResolution;
    51     /** Holds whether we should automatically activate machine window under the mouse cursor. */
    52     bool m_fActivateHoveredMachineWindow;
    53 };
     25/* Forward declarations: */
     26struct UIDataSettingsGlobalDisplay;
    5427typedef UISettingsCache<UIDataSettingsGlobalDisplay> UISettingsCacheGlobalDisplay;
    5528
     
    6235public:
    6336
    64     /* Constructor: */
     37    /** Constructs Display settings page. */
    6538    UIGlobalSettingsDisplay();
     39    /** Destructs Display settings page. */
     40    ~UIGlobalSettingsDisplay();
    6641
    6742protected:
     
    9772    void populate();
    9873
    99     /* Cache: */
    100     UISettingsCacheGlobalDisplay m_cache;
     74    /** Holds the page data cache instance. */
     75    UISettingsCacheGlobalDisplay *m_pCache;
    10176};
    10277
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp

    r65690 r66169  
    3939
    4040
     41/** Global settings: Extension page item data structure. */
     42struct UIDataSettingsGlobalExtensionItem
     43{
     44    /** Constructs data. */
     45    UIDataSettingsGlobalExtensionItem()
     46        : m_strName(QString())
     47        , m_strDescription(QString())
     48        , m_strVersion(QString())
     49        , m_uRevision(0)
     50        , m_fIsUsable(false)
     51        , m_strWhyUnusable(QString())
     52    {}
     53
     54    /** Returns whether the @a other passed data is equal to this one. */
     55    bool equal(const UIDataSettingsGlobalExtensionItem &other) const
     56    {
     57        return true
     58               && (m_strName == other.m_strName)
     59               && (m_strDescription == other.m_strDescription)
     60               && (m_strVersion == other.m_strVersion)
     61               && (m_uRevision == other.m_uRevision)
     62               && (m_fIsUsable == other.m_fIsUsable)
     63               && (m_strWhyUnusable == other.m_strWhyUnusable)
     64               ;
     65    }
     66
     67    /** Returns whether the @a other passed data is equal to this one. */
     68    bool operator==(const UIDataSettingsGlobalExtensionItem &other) const { return equal(other); }
     69    /** Returns whether the @a other passed data is different from this one. */
     70    bool operator!=(const UIDataSettingsGlobalExtensionItem &other) const { return !equal(other); }
     71
     72    /** Holds the extension item name. */
     73    QString m_strName;
     74    /** Holds the extension item description. */
     75    QString m_strDescription;
     76    /** Holds the extension item version. */
     77    QString m_strVersion;
     78    /** Holds the extension item revision. */
     79    ULONG m_uRevision;
     80    /** Holds whether the extension item usable. */
     81    bool m_fIsUsable;
     82    /** Holds why the extension item is unusable. */
     83    QString m_strWhyUnusable;
     84};
     85
     86
     87/** Global settings: Extension page data structure. */
     88struct UIDataSettingsGlobalExtension
     89{
     90    /** Constructs data. */
     91    UIDataSettingsGlobalExtension()
     92        : m_items(QList<UIDataSettingsGlobalExtensionItem>())
     93    {}
     94
     95    /** Returns whether the @a other passed data is equal to this one. */
     96    bool equal(const UIDataSettingsGlobalExtension &other) const
     97    {
     98        return true
     99               && (m_items == other.m_items)
     100               ;
     101    }
     102
     103    /** Returns whether the @a other passed data is equal to this one. */
     104    bool operator==(const UIDataSettingsGlobalExtension &other) const { return equal(other); }
     105    /** Returns whether the @a other passed data is different from this one. */
     106    bool operator!=(const UIDataSettingsGlobalExtension &other) const { return !equal(other); }
     107
     108    /** Holds the extension items. */
     109    QList<UIDataSettingsGlobalExtensionItem> m_items;
     110};
     111
     112
    41113/* Extension package item: */
    42114class UIExtensionPackageItem : public QITreeWidgetItem
     
    100172UIGlobalSettingsExtension::UIGlobalSettingsExtension()
    101173    : m_pActionAdd(0), m_pActionRemove(0)
     174    , m_pCache(new UISettingsCacheGlobalExtension)
    102175{
    103176    /* Apply UI decorations: */
     
    140213}
    141214
     215UIGlobalSettingsExtension::~UIGlobalSettingsExtension()
     216{
     217    /* Cleanup cache: */
     218    delete m_pCache;
     219    m_pCache = 0;
     220}
     221
    142222/* static */
    143223void UIGlobalSettingsExtension::doInstallation(QString const &strFilePath, QString const &strDigest,
     
    243323
    244324    /* Clear cache initially: */
    245     m_cache.clear();
     325    m_pCache->clear();
    246326
    247327    /* Prepare old data: */
     
    252332    const CExtPackVector &packages = manager.GetInstalledExtPacks();
    253333    for (int i = 0; i < packages.size(); ++i)
    254         oldData.m_items << fetchData(packages[i]);
     334    {
     335        UIDataSettingsGlobalExtensionItem item;
     336        fetchData(packages[i], item);
     337        oldData.m_items << item;
     338    }
    255339
    256340    /* Cache old data: */
    257     m_cache.cacheInitialData(oldData);
     341    m_pCache->cacheInitialData(oldData);
    258342
    259343    /* Upload properties & settings to data: */
     
    264348{
    265349    /* Get old data from cache: */
    266     const UIDataSettingsGlobalExtension &oldData = m_cache.base();
     350    const UIDataSettingsGlobalExtension &oldData = m_pCache->base();
    267351
    268352    /* Load old data from cache: */
     
    378462        {
    379463            /* Remove it from the cache. */
    380             for (int i = 0; i < m_cache.data().m_items.size(); ++i)
     464            for (int i = 0; i < m_pCache->data().m_items.size(); ++i)
    381465            {
    382                 if (!strExtPackName.compare(m_cache.data().m_items.at(i).m_strName, Qt::CaseInsensitive))
     466                if (!strExtPackName.compare(m_pCache->data().m_items.at(i).m_strName, Qt::CaseInsensitive))
    383467                {
    384                     m_cache.data().m_items.removeAt(i);
     468                    m_pCache->data().m_items.removeAt(i);
    385469                    break;
    386470                }
     
    404488            if (package.isOk())
    405489            {
    406                 m_cache.data().m_items << fetchData(package);
    407 
    408                 UIExtensionPackageItem *pItem = new UIExtensionPackageItem(m_pPackagesTree, m_cache.data().m_items.last());
     490                UIDataSettingsGlobalExtensionItem item;
     491                fetchData(package, item);
     492                m_pCache->data().m_items << item;
     493
     494                UIExtensionPackageItem *pItem = new UIExtensionPackageItem(m_pPackagesTree, m_pCache->data().m_items.last());
    409495                m_pPackagesTree->setCurrentItem(pItem);
    410496                m_pPackagesTree->sortByColumn(1, Qt::AscendingOrder);
     
    447533                {
    448534                    /* Remove selected package from cache: */
    449                     for (int i = 0; i < m_cache.data().m_items.size(); ++i)
     535                    for (int i = 0; i < m_pCache->data().m_items.size(); ++i)
    450536                    {
    451                         if (!strSelectedPackageName.compare(m_cache.data().m_items.at(i).m_strName, Qt::CaseInsensitive))
     537                        if (!strSelectedPackageName.compare(m_pCache->data().m_items.at(i).m_strName, Qt::CaseInsensitive))
    452538                        {
    453                             m_cache.data().m_items.removeAt(i);
     539                            m_pCache->data().m_items.removeAt(i);
    454540                            break;
    455541                        }
     
    467553}
    468554
    469 UIDataSettingsGlobalExtensionItem UIGlobalSettingsExtension::fetchData(const CExtPack &package) const
    470 {
    471     UIDataSettingsGlobalExtensionItem item;
     555void UIGlobalSettingsExtension::fetchData(const CExtPack &package, UIDataSettingsGlobalExtensionItem &item) const
     556{
    472557    item.m_strName = package.GetName();
    473558    item.m_strDescription = package.GetDescription();
     
    477562    if (!item.m_fIsUsable)
    478563        item.m_strWhyUnusable = package.GetWhyUnusable();
    479     return item;
    480 }
    481 
     564}
     565
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.h

    r66163 r66169  
    2323#include "UIGlobalSettingsExtension.gen.h"
    2424
    25 
    26 /** Global settings: Extension page item data structure. */
    27 struct UIDataSettingsGlobalExtensionItem
    28 {
    29     /** Constructs data. */
    30     UIDataSettingsGlobalExtensionItem()
    31         : m_strName(QString())
    32         , m_strDescription(QString())
    33         , m_strVersion(QString())
    34         , m_uRevision(0)
    35         , m_fIsUsable(false)
    36         , m_strWhyUnusable(QString())
    37     {}
    38 
    39     /** Returns whether the @a other passed data is equal to this one. */
    40     bool equal(const UIDataSettingsGlobalExtensionItem &other) const
    41     {
    42         return true
    43                && (m_strName == other.m_strName)
    44                && (m_strDescription == other.m_strDescription)
    45                && (m_strVersion == other.m_strVersion)
    46                && (m_uRevision == other.m_uRevision)
    47                && (m_fIsUsable == other.m_fIsUsable)
    48                && (m_strWhyUnusable == other.m_strWhyUnusable)
    49                ;
    50     }
    51 
    52     /** Returns whether the @a other passed data is equal to this one. */
    53     bool operator==(const UIDataSettingsGlobalExtensionItem &other) const { return equal(other); }
    54     /** Returns whether the @a other passed data is different from this one. */
    55     bool operator!=(const UIDataSettingsGlobalExtensionItem &other) const { return !equal(other); }
    56 
    57     /** Holds the extension item name. */
    58     QString m_strName;
    59     /** Holds the extension item description. */
    60     QString m_strDescription;
    61     /** Holds the extension item version. */
    62     QString m_strVersion;
    63     /** Holds the extension item revision. */
    64     ULONG m_uRevision;
    65     /** Holds whether the extension item usable. */
    66     bool m_fIsUsable;
    67     /** Holds why the extension item is unusable. */
    68     QString m_strWhyUnusable;
    69 };
    70 
    71 
    72 /** Global settings: Extension page data structure. */
    73 struct UIDataSettingsGlobalExtension
    74 {
    75     /** Constructs data. */
    76     UIDataSettingsGlobalExtension()
    77         : m_items(QList<UIDataSettingsGlobalExtensionItem>())
    78     {}
    79 
    80     /** Returns whether the @a other passed data is equal to this one. */
    81     bool equal(const UIDataSettingsGlobalExtension &other) const
    82     {
    83         return true
    84                && (m_items == other.m_items)
    85                ;
    86     }
    87 
    88     /** Returns whether the @a other passed data is equal to this one. */
    89     bool operator==(const UIDataSettingsGlobalExtension &other) const { return equal(other); }
    90     /** Returns whether the @a other passed data is different from this one. */
    91     bool operator!=(const UIDataSettingsGlobalExtension &other) const { return !equal(other); }
    92 
    93     /** Holds the extension items. */
    94     QList<UIDataSettingsGlobalExtensionItem> m_items;
    95 };
     25/* Forward declarations: */
     26struct UIDataSettingsGlobalExtension;
     27struct UIDataSettingsGlobalExtensionItem;
    9628typedef UISettingsCache<UIDataSettingsGlobalExtension> UISettingsCacheGlobalExtension;
    9729
     
    10436public:
    10537
    106     /* Constructor: */
     38    /** Constructs Extension settings page. */
    10739    UIGlobalSettingsExtension();
     40    /** Destructs Extension settings page. */
     41    ~UIGlobalSettingsExtension();
    10842
    10943    static void doInstallation(QString const &strFilePath, QString const &strDigest, QWidget *pParent, QString *pstrExtPackName);
     
    14478
    14579    /* Prepare UIDataSettingsGlobalExtensionItem basing on CExtPack: */
    146     UIDataSettingsGlobalExtensionItem fetchData(const CExtPack &package) const;
     80    void fetchData(const CExtPack &package, UIDataSettingsGlobalExtensionItem &item) const;
    14781
    14882    /* Variables: Actions: */
     
    15084    QAction *m_pActionRemove;
    15185
    152     /* Cache: */
    153     UISettingsCacheGlobalExtension m_cache;
     86    /** Holds the page data cache instance. */
     87    UISettingsCacheGlobalExtension *m_pCache;
    15488};
    15589
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp

    r65684 r66169  
    3030
    3131
     32/** Global settings: General page data structure. */
     33struct UIDataSettingsGlobalGeneral
     34{
     35    /** Constructs data. */
     36    UIDataSettingsGlobalGeneral()
     37        : m_strDefaultMachineFolder(QString())
     38        , m_strVRDEAuthLibrary(QString())
     39        , m_fHostScreenSaverDisabled(false)
     40    {}
     41
     42    /** Returns whether the @a other passed data is equal to this one. */
     43    bool equal(const UIDataSettingsGlobalGeneral &other) const
     44    {
     45        return true
     46               && (m_strDefaultMachineFolder == other.m_strDefaultMachineFolder)
     47               && (m_strVRDEAuthLibrary == other.m_strVRDEAuthLibrary)
     48               && (m_fHostScreenSaverDisabled == other.m_fHostScreenSaverDisabled)
     49               ;
     50    }
     51
     52    /** Returns whether the @a other passed data is equal to this one. */
     53    bool operator==(const UIDataSettingsGlobalGeneral &other) const { return equal(other); }
     54    /** Returns whether the @a other passed data is different from this one. */
     55    bool operator!=(const UIDataSettingsGlobalGeneral &other) const { return !equal(other); }
     56
     57    /** Holds the default machine folder path. */
     58    QString m_strDefaultMachineFolder;
     59    /** Holds the VRDE authentication library name. */
     60    QString m_strVRDEAuthLibrary;
     61    /** Holds whether host screen-saver should be disabled. */
     62    bool m_fHostScreenSaverDisabled;
     63};
     64
     65
    3266UIGlobalSettingsGeneral::UIGlobalSettingsGeneral()
     67    : m_pCache(new UISettingsCacheGlobalGeneral)
    3368{
    3469    /* Apply UI decorations: */
     
    4883}
    4984
     85UIGlobalSettingsGeneral::~UIGlobalSettingsGeneral()
     86{
     87    /* Cleanup cache: */
     88    delete m_pCache;
     89    m_pCache = 0;
     90}
     91
    5092void UIGlobalSettingsGeneral::loadToCacheFrom(QVariant &data)
    5193{
     
    5496
    5597    /* Clear cache initially: */
    56     m_cache.clear();
     98    m_pCache->clear();
    5799
    58100    /* Prepare old data: */
     
    65107
    66108    /* Cache old data: */
    67     m_cache.cacheInitialData(oldData);
     109    m_pCache->cacheInitialData(oldData);
    68110
    69111    /* Upload properties & settings to data: */
     
    74116{
    75117    /* Get old data from cache: */
    76     const UIDataSettingsGlobalGeneral &oldData = m_cache.base();
     118    const UIDataSettingsGlobalGeneral &oldData = m_pCache->base();
    77119
    78120    /* Load old data from cache: */
     
    85127{
    86128    /* Prepare new data: */
    87     UIDataSettingsGlobalGeneral newData = m_cache.base();
     129    UIDataSettingsGlobalGeneral newData = m_pCache->base();
    88130
    89131    /* Gather new data: */
     
    93135
    94136    /* Cache new data: */
    95     m_cache.cacheCurrentData(newData);
     137    m_pCache->cacheCurrentData(newData);
    96138}
    97139
     
    102144
    103145    /* Save new data from cache: */
    104     if (m_cache.wasChanged())
     146    if (m_pCache->wasChanged())
    105147    {
    106148        if (   m_properties.isOk()
    107             && m_cache.data().m_strDefaultMachineFolder != m_cache.base().m_strDefaultMachineFolder)
    108             m_properties.SetDefaultMachineFolder(m_cache.data().m_strDefaultMachineFolder);
     149            && m_pCache->data().m_strDefaultMachineFolder != m_pCache->base().m_strDefaultMachineFolder)
     150            m_properties.SetDefaultMachineFolder(m_pCache->data().m_strDefaultMachineFolder);
    109151        if (   m_properties.isOk()
    110             && m_cache.data().m_strVRDEAuthLibrary != m_cache.base().m_strVRDEAuthLibrary)
    111             m_properties.SetVRDEAuthLibrary(m_cache.data().m_strVRDEAuthLibrary);
    112         if (m_cache.data().m_fHostScreenSaverDisabled != m_cache.base().m_fHostScreenSaverDisabled)
    113             m_settings.setHostScreenSaverDisabled(m_cache.data().m_fHostScreenSaverDisabled);
     152            && m_pCache->data().m_strVRDEAuthLibrary != m_pCache->base().m_strVRDEAuthLibrary)
     153            m_properties.SetVRDEAuthLibrary(m_pCache->data().m_strVRDEAuthLibrary);
     154        if (m_pCache->data().m_fHostScreenSaverDisabled != m_pCache->base().m_fHostScreenSaverDisabled)
     155            m_settings.setHostScreenSaverDisabled(m_pCache->data().m_fHostScreenSaverDisabled);
    114156    }
    115157
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h

    r66163 r66169  
    2323#include "UIGlobalSettingsGeneral.gen.h"
    2424
    25 
    26 /** Global settings: General page data structure. */
    27 struct UIDataSettingsGlobalGeneral
    28 {
    29     /** Constructs data. */
    30     UIDataSettingsGlobalGeneral()
    31         : m_strDefaultMachineFolder(QString())
    32         , m_strVRDEAuthLibrary(QString())
    33         , m_fHostScreenSaverDisabled(false)
    34     {}
    35 
    36     /** Returns whether the @a other passed data is equal to this one. */
    37     bool equal(const UIDataSettingsGlobalGeneral &other) const
    38     {
    39         return true
    40                && (m_strDefaultMachineFolder == other.m_strDefaultMachineFolder)
    41                && (m_strVRDEAuthLibrary == other.m_strVRDEAuthLibrary)
    42                && (m_fHostScreenSaverDisabled == other.m_fHostScreenSaverDisabled)
    43                ;
    44     }
    45 
    46     /** Returns whether the @a other passed data is equal to this one. */
    47     bool operator==(const UIDataSettingsGlobalGeneral &other) const { return equal(other); }
    48     /** Returns whether the @a other passed data is different from this one. */
    49     bool operator!=(const UIDataSettingsGlobalGeneral &other) const { return !equal(other); }
    50 
    51     /** Holds the default machine folder path. */
    52     QString m_strDefaultMachineFolder;
    53     /** Holds the VRDE authentication library name. */
    54     QString m_strVRDEAuthLibrary;
    55     /** Holds whether host screen-saver should be disabled. */
    56     bool m_fHostScreenSaverDisabled;
    57 };
     25/* Forward declarations: */
     26struct UIDataSettingsGlobalGeneral;
    5827typedef UISettingsCache<UIDataSettingsGlobalGeneral> UISettingsCacheGlobalGeneral;
    5928
     
    6635public:
    6736
    68     /* Constructor: */
     37    /** Constructs General settings page. */
    6938    UIGlobalSettingsGeneral();
     39    /** Destructs General settings page. */
     40    ~UIGlobalSettingsGeneral();
    7041
    7142protected:
     
    9364private:
    9465
    95     /* Cache: */
    96     UISettingsCacheGlobalGeneral m_cache;
     66    /** Holds the page data cache instance. */
     67    UISettingsCacheGlobalGeneral *m_pCache;
    9768};
    9869
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h

    r66163 r66169  
    4646public:
    4747
    48     /* Constructor: */
     48    /** Constructs Input settings page. */
    4949    UIGlobalSettingsInput();
    50     /* Destructor: */
     50    /** Destructs Input settings page. */
    5151    ~UIGlobalSettingsInput();
    5252
     
    8989    UIHotKeyTable *m_pMachineTable;
    9090
    91     /** Holds the cache instance. */
     91    /** Holds the page data cache instance. */
    9292    UISettingsCacheGlobalInput *m_pCache;
    9393};
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp

    r66163 r66169  
    4848
    4949
     50/** Global settings: Language page data structure. */
     51struct UIDataSettingsGlobalLanguage
     52{
     53    /** Constructs data. */
     54    UIDataSettingsGlobalLanguage()
     55        : m_strLanguageId(QString())
     56    {}
     57
     58    /** Returns whether the @a other passed data is equal to this one. */
     59    bool equal(const UIDataSettingsGlobalLanguage &other) const
     60    {
     61        return true
     62               && (m_strLanguageId == other.m_strLanguageId)
     63               ;
     64    }
     65
     66    /** Returns whether the @a other passed data is equal to this one. */
     67    bool operator==(const UIDataSettingsGlobalLanguage &other) const { return equal(other); }
     68    /** Returns whether the @a other passed data is different from this one. */
     69    bool operator!=(const UIDataSettingsGlobalLanguage &other) const { return !equal(other); }
     70
     71    /** Holds the current language id. */
     72    QString m_strLanguageId;
     73};
     74
     75
    5076/* Language item: */
    5177class UILanguageItem : public QITreeWidgetItem
     
    181207UIGlobalSettingsLanguage::UIGlobalSettingsLanguage()
    182208    : m_fPolished(false)
     209    , m_pCache(new UISettingsCacheGlobalLanguage)
    183210{
    184211    /* Apply UI decorations: */
     
    204231}
    205232
     233UIGlobalSettingsLanguage::~UIGlobalSettingsLanguage()
     234{
     235    /* Cleanup cache: */
     236    delete m_pCache;
     237    m_pCache = 0;
     238}
     239
    206240void UIGlobalSettingsLanguage::loadToCacheFrom(QVariant &data)
    207241{
     
    210244
    211245    /* Clear cache initially: */
    212     m_cache.clear();
     246    m_pCache->clear();
    213247
    214248    /* Prepare old data: */
     
    219253
    220254    /* Cache old data: */
    221     m_cache.cacheInitialData(oldData);
     255    m_pCache->cacheInitialData(oldData);
    222256
    223257    /* Upload properties & settings to data: */
     
    228262{
    229263    /* Get old data from cache: */
    230     const UIDataSettingsGlobalLanguage &oldData = m_cache.base();
     264    const UIDataSettingsGlobalLanguage &oldData = m_pCache->base();
    231265
    232266    /* Load old data from cache: */
     
    237271{
    238272    /* Prepare new data: */
    239     UIDataSettingsGlobalLanguage newData = m_cache.base();
     273    UIDataSettingsGlobalLanguage newData = m_pCache->base();
    240274
    241275    /* Gather new data: */
     
    246280
    247281    /* Cache new data: */
    248     m_cache.cacheCurrentData(newData);
     282    m_pCache->cacheCurrentData(newData);
    249283}
    250284
     
    255289
    256290    /* Save new data from cache: */
    257     if (m_cache.wasChanged())
     291    if (m_pCache->wasChanged())
    258292    {
    259293        /* Save from cache: */
    260         if (m_cache.data().m_strLanguageId != m_cache.base().m_strLanguageId)
    261             m_settings.setLanguageId(m_cache.data().m_strLanguageId);
     294        if (m_pCache->data().m_strLanguageId != m_pCache->base().m_strLanguageId)
     295            m_settings.setLanguageId(m_pCache->data().m_strLanguageId);
    262296    }
    263297
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h

    r66163 r66169  
    2323#include "UIGlobalSettingsLanguage.gen.h"
    2424
    25 
    26 /** Global settings: Language page data structure. */
    27 struct UIDataSettingsGlobalLanguage
    28 {
    29     /** Constructs data. */
    30     UIDataSettingsGlobalLanguage()
    31         : m_strLanguageId(QString())
    32     {}
    33 
    34     /** Returns whether the @a other passed data is equal to this one. */
    35     bool equal(const UIDataSettingsGlobalLanguage &other) const
    36     {
    37         return true
    38                && (m_strLanguageId == other.m_strLanguageId)
    39                ;
    40     }
    41 
    42     /** Returns whether the @a other passed data is equal to this one. */
    43     bool operator==(const UIDataSettingsGlobalLanguage &other) const { return equal(other); }
    44     /** Returns whether the @a other passed data is different from this one. */
    45     bool operator!=(const UIDataSettingsGlobalLanguage &other) const { return !equal(other); }
    46 
    47     /** Holds the current language id. */
    48     QString m_strLanguageId;
    49 };
     25/* Forward declartions: */
     26struct UIDataSettingsGlobalLanguage;
    5027typedef UISettingsCache<UIDataSettingsGlobalLanguage> UISettingsCacheGlobalLanguage;
    5128
     
    5835public:
    5936
    60     /* Constructor: */
     37    /** Constructs Language settings page. */
    6138    UIGlobalSettingsLanguage();
     39    /** Destructs Language settings page. */
     40    ~UIGlobalSettingsLanguage();
    6241
    6342protected:
     
    10483    bool m_fPolished;
    10584
    106     /* Cache: */
    107     UISettingsCacheGlobalLanguage m_cache;
     85    /** Holds the page data cache instance. */
     86    UISettingsCacheGlobalLanguage *m_pCache;
    10887};
    10988
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp

    r66163 r66169  
    4343/* COM includes: */
    4444#include "CDHCPServer.h"
     45
     46
     47/** Global settings: Network page data structure. */
     48struct UIDataSettingsGlobalNetwork
     49{
     50    /** Constructs data. */
     51    UIDataSettingsGlobalNetwork()
     52        : m_networksNAT(QList<UIDataSettingsGlobalNetworkNAT>())
     53        , m_networksHost(QList<UIDataSettingsGlobalNetworkHost>())
     54    {}
     55
     56    /** Returns whether the @a other passed data is equal to this one. */
     57    bool equal(const UIDataSettingsGlobalNetwork &other) const
     58    {
     59        return true
     60               && (m_networksNAT == other.m_networksNAT)
     61               && (m_networksHost == other.m_networksHost)
     62               ;
     63    }
     64
     65    /** Returns whether the @a other passed data is equal to this one. */
     66    bool operator==(const UIDataSettingsGlobalNetwork &other) const { return equal(other); }
     67    /** Returns whether the @a other passed data is different from this one. */
     68    bool operator!=(const UIDataSettingsGlobalNetwork &other) const { return !equal(other); }
     69
     70    /** Holds the NAT network data. */
     71    QList<UIDataSettingsGlobalNetworkNAT> m_networksNAT;
     72    /** Holds the host network data. */
     73    QList<UIDataSettingsGlobalNetworkHost> m_networksHost;
     74};
    4575
    4676
     
    393423    : m_pActionAddNetworkNAT(0), m_pActionDelNetworkNAT(0), m_pActionEditNetworkNAT(0)
    394424    , m_pActionAddNetworkHost(0), m_pActionDelNetworkHost(0), m_pActionEditNetworkHost(0)
     425    , m_pCache(new UISettingsCacheGlobalNetwork)
    395426{
    396427    /* Apply UI decorations: */
     
    511542}
    512543
     544UIGlobalSettingsNetwork::~UIGlobalSettingsNetwork()
     545{
     546    /* Cleanup cache: */
     547    delete m_pCache;
     548    m_pCache = 0;
     549}
     550
    513551void UIGlobalSettingsNetwork::loadToCacheFrom(QVariant &data)
    514552{
     
    517555
    518556    /* Clear cache initially: */
    519     m_cache.clear();
     557    m_pCache->clear();
    520558
    521559    /* Prepare old data: */
     
    524562    /* Gather old data: */
    525563    foreach (const CNATNetwork &network, vboxGlobal().virtualBox().GetNATNetworks())
    526         oldData.m_networksNAT << generateDataNetworkNAT(network);
     564    {
     565        UIDataSettingsGlobalNetworkNAT data;
     566        generateDataNetworkNAT(network, data);
     567        oldData.m_networksNAT << data;
     568    }
    527569    foreach (const CHostNetworkInterface &iface, vboxGlobal().host().GetNetworkInterfaces())
    528570        if (iface.GetInterfaceType() == KHostNetworkInterfaceType_HostOnly)
    529             oldData.m_networksHost << generateDataNetworkHost(iface);
     571        {
     572            UIDataSettingsGlobalNetworkHost data;
     573            generateDataNetworkHost(iface, data);
     574            oldData.m_networksHost << data;
     575        }
    530576
    531577    /* Cache old data: */
    532     m_cache.cacheInitialData(oldData);
     578    m_pCache->cacheInitialData(oldData);
    533579
    534580    /* Upload properties & settings to data: */
     
    539585{
    540586    /* Get old data from cache: */
    541     const UIDataSettingsGlobalNetwork &oldData = m_cache.base();
     587    const UIDataSettingsGlobalNetwork &oldData = m_pCache->base();
    542588
    543589    /* Load old data from cache: */
     
    560606{
    561607    /* Prepare new data: */
    562     UIDataSettingsGlobalNetwork newData = m_cache.base();
     608    UIDataSettingsGlobalNetwork newData = m_pCache->base();
    563609
    564610    /* Gather new data: */
     
    581627
    582628    /* Cache new data: */
    583     m_cache.cacheCurrentData(newData);
     629    m_pCache->cacheCurrentData(newData);
    584630}
    585631
     
    590636
    591637    /* Save new data from cache: */
    592     if (m_cache.wasChanged())
    593     {
    594         if (m_cache.data().m_networksNAT != m_cache.base().m_networksNAT)
    595             foreach (const UIDataSettingsGlobalNetworkNAT &data, m_cache.data().m_networksNAT)
     638    if (m_pCache->wasChanged())
     639    {
     640        if (m_pCache->data().m_networksNAT != m_pCache->base().m_networksNAT)
     641            foreach (const UIDataSettingsGlobalNetworkNAT &data, m_pCache->data().m_networksNAT)
    596642                saveCacheItemNetworkNAT(data);
    597         if (m_cache.data().m_networksHost != m_cache.base().m_networksHost)
    598             foreach (const UIDataSettingsGlobalNetworkHost &data, m_cache.data().m_networksHost)
     643        if (m_pCache->data().m_networksHost != m_pCache->base().m_networksHost)
     644            foreach (const UIDataSettingsGlobalNetworkHost &data, m_pCache->data().m_networksHost)
    599645                saveCacheItemNetworkHost(data);
    600646    }
     
    750796
    751797    /* Update tree: */
    752     createTreeItemNetworkNAT(generateDataNetworkNAT(network), true);
     798    UIDataSettingsGlobalNetworkNAT data;
     799    generateDataNetworkNAT(network, data);
     800    createTreeItemNetworkNAT(data, true);
    753801    m_pTreeNetworkNAT->sortByColumn(1, Qt::AscendingOrder);
    754802}
     
    839887
    840888    /* Update tree: */
    841     createTreeItemNetworkHost(generateDataNetworkHost(iface), true);
     889    UIDataSettingsGlobalNetworkHost data;
     890    generateDataNetworkHost(iface, data);
     891    createTreeItemNetworkHost(data, true);
    842892    m_pTreeNetworkHost->sortByColumn(0, Qt::AscendingOrder);
    843893}
     
    9561006}
    9571007
    958 UIDataSettingsGlobalNetworkNAT UIGlobalSettingsNetwork::generateDataNetworkNAT(const CNATNetwork &network)
    959 {
    960     /* Prepare data: */
    961     UIDataSettingsGlobalNetworkNAT data;
    962 
     1008void UIGlobalSettingsNetwork::generateDataNetworkNAT(const CNATNetwork &network, UIDataSettingsGlobalNetworkNAT &data)
     1009{
    9631010    /* Load NAT network settings: */
    9641011    data.m_fEnabled = network.GetEnabled();
     
    10171064                                                 rules[5].toUInt());
    10181065    }
    1019 
    1020     /* Return data: */
    1021     return data;
    10221066}
    10231067
     
    10751119}
    10761120
    1077 UIDataSettingsGlobalNetworkHost UIGlobalSettingsNetwork::generateDataNetworkHost(const CHostNetworkInterface &iface)
    1078 {
    1079     /* Prepare data: */
    1080     UIDataSettingsGlobalNetworkHost data;
    1081 
     1121void UIGlobalSettingsNetwork::generateDataNetworkHost(const CHostNetworkInterface &iface, UIDataSettingsGlobalNetworkHost &data)
     1122{
    10821123    /* Get DHCP server (create if necessary): */
    10831124    CDHCPServer dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName());
     
    10891130        {
    10901131            msgCenter().cannotCreateDHCPServer(vbox, this);
    1091             return data;
     1132            return;
    10921133        }
    10931134        dhcp = vboxGlobal().virtualBox().FindDHCPServerByNetworkName(iface.GetNetworkName());
     
    10951136    Assert(!dhcp.isNull());
    10961137    if (dhcp.isNull())
    1097         return data;
     1138        return;
    10981139
    10991140    /* Host interface settings: */
     
    11121153    data.m_dhcpserver.m_strDhcpLowerAddress = dhcp.GetLowerIP();
    11131154    data.m_dhcpserver.m_strDhcpUpperAddress = dhcp.GetUpperIP();
    1114 
    1115     /* Return data: */
    1116     return data;
    11171155}
    11181156
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h

    r66163 r66169  
    2222#include "UISettingsPage.h"
    2323#include "UIGlobalSettingsNetwork.gen.h"
    24 #include "UIPortForwardingTable.h"
    2524
    2625/* Forward declarations: */
    2726class UIItemNetworkNAT;
    2827class UIItemNetworkHost;
    29 
    30 
    31 /** Global settings: Network page: NAT network data structure. */
    32 struct UIDataSettingsGlobalNetworkNAT
    33 {
    34     /** Constructs data. */
    35     UIDataSettingsGlobalNetworkNAT()
    36         : m_fEnabled(false)
    37         , m_strName(QString())
    38         , m_strNewName(QString())
    39         , m_strCIDR(QString())
    40         , m_fSupportsDHCP(false)
    41         , m_fSupportsIPv6(false)
    42         , m_fAdvertiseDefaultIPv6Route(false)
    43         , m_ipv4rules(QList<UIPortForwardingData>())
    44         , m_ipv6rules(QList<UIPortForwardingData>())
    45     {}
    46 
    47     /** Returns whether the @a other passed data is equal to this one. */
    48     bool equal(const UIDataSettingsGlobalNetworkNAT &other) const
    49     {
    50         return true
    51                && (m_fEnabled == other.m_fEnabled)
    52                && (m_strName == other.m_strName)
    53                && (m_strNewName == other.m_strNewName)
    54                && (m_strCIDR == other.m_strCIDR)
    55                && (m_fSupportsDHCP == other.m_fSupportsDHCP)
    56                && (m_fSupportsIPv6 == other.m_fSupportsIPv6)
    57                && (m_fAdvertiseDefaultIPv6Route == other.m_fAdvertiseDefaultIPv6Route)
    58                && (m_ipv4rules == other.m_ipv4rules)
    59                && (m_ipv6rules == other.m_ipv6rules)
    60                ;
    61     }
    62 
    63     /** Returns whether the @a other passed data is equal to this one. */
    64     bool operator==(const UIDataSettingsGlobalNetworkNAT &other) const { return equal(other); }
    65     /** Returns whether the @a other passed data is different from this one. */
    66     bool operator!=(const UIDataSettingsGlobalNetworkNAT &other) const { return !equal(other); }
    67 
    68     /** Holds whether this network enabled. */
    69     bool m_fEnabled;
    70     /** Holds network name. */
    71     QString m_strName;
    72     /** Holds new network name. */
    73     QString m_strNewName;
    74     /** Holds network CIDR. */
    75     QString m_strCIDR;
    76     /** Holds whether this network supports DHCP. */
    77     bool m_fSupportsDHCP;
    78     /** Holds whether this network supports IPv6. */
    79     bool m_fSupportsIPv6;
    80     /** Holds whether this network advertised as default IPv6 route. */
    81     bool m_fAdvertiseDefaultIPv6Route;
    82     /** Holds IPv4 port forwarding rules. */
    83     UIPortForwardingDataList m_ipv4rules;
    84     /** Holds IPv6 port forwarding rules. */
    85     UIPortForwardingDataList m_ipv6rules;
    86 };
    87 
    88 
    89 /** Global settings: Network page: Host interface data structure. */
    90 struct UIDataSettingsGlobalNetworkHostInterface
    91 {
    92     /** Constructs data. */
    93     UIDataSettingsGlobalNetworkHostInterface()
    94         : m_strName(QString())
    95         , m_fDhcpClientEnabled(false)
    96         , m_strInterfaceAddress(QString())
    97         , m_strInterfaceMask(QString())
    98         , m_fIpv6Supported(false)
    99         , m_strInterfaceAddress6(QString())
    100         , m_strInterfaceMaskLength6(QString())
    101     {}
    102 
    103     /** Returns whether the @a other passed data is equal to this one. */
    104     bool equal(const UIDataSettingsGlobalNetworkHostInterface &other) const
    105     {
    106         return true
    107                && (m_strName == other.m_strName)
    108                && (m_fDhcpClientEnabled == other.m_fDhcpClientEnabled)
    109                && (m_strInterfaceAddress == other.m_strInterfaceAddress)
    110                && (m_strInterfaceMask == other.m_strInterfaceMask)
    111                && (m_fIpv6Supported == other.m_fIpv6Supported)
    112                && (m_strInterfaceAddress6 == other.m_strInterfaceAddress6)
    113                && (m_strInterfaceMaskLength6 == other.m_strInterfaceMaskLength6)
    114                ;
    115     }
    116 
    117     /** Returns whether the @a other passed data is equal to this one. */
    118     bool operator==(const UIDataSettingsGlobalNetworkHostInterface &other) const { return equal(other); }
    119     /** Returns whether the @a other passed data is different from this one. */
    120     bool operator!=(const UIDataSettingsGlobalNetworkHostInterface &other) const { return !equal(other); }
    121 
    122     /** Holds host interface name. */
    123     QString m_strName;
    124     /** Holds whether DHCP client enabled. */
    125     bool m_fDhcpClientEnabled;
    126     /** Holds IPv4 interface address. */
    127     QString m_strInterfaceAddress;
    128     /** Holds IPv4 interface mask. */
    129     QString m_strInterfaceMask;
    130     /** Holds whether IPv6 protocol supported. */
    131     bool m_fIpv6Supported;
    132     /** Holds IPv6 interface address. */
    133     QString m_strInterfaceAddress6;
    134     /** Holds IPv6 interface mask length. */
    135     QString m_strInterfaceMaskLength6;
    136 };
    137 
    138 
    139 /** Global settings: Network page: DHCP server data structure. */
    140 struct UIDataSettingsGlobalNetworkDHCPServer
    141 {
    142     /** Constructs data. */
    143     UIDataSettingsGlobalNetworkDHCPServer()
    144         : m_fDhcpServerEnabled(false)
    145         , m_strDhcpServerAddress(QString())
    146         , m_strDhcpServerMask(QString())
    147         , m_strDhcpLowerAddress(QString())
    148         , m_strDhcpUpperAddress(QString())
    149     {}
    150 
    151     /** Returns whether the @a other passed data is equal to this one. */
    152     bool equal(const UIDataSettingsGlobalNetworkDHCPServer &other) const
    153     {
    154         return true
    155                && (m_fDhcpServerEnabled == other.m_fDhcpServerEnabled)
    156                && (m_strDhcpServerAddress == other.m_strDhcpServerAddress)
    157                && (m_strDhcpServerMask == other.m_strDhcpServerMask)
    158                && (m_strDhcpLowerAddress == other.m_strDhcpLowerAddress)
    159                && (m_strDhcpUpperAddress == other.m_strDhcpUpperAddress)
    160                ;
    161     }
    162 
    163     /** Returns whether the @a other passed data is equal to this one. */
    164     bool operator==(const UIDataSettingsGlobalNetworkDHCPServer &other) const { return equal(other); }
    165     /** Returns whether the @a other passed data is different from this one. */
    166     bool operator!=(const UIDataSettingsGlobalNetworkDHCPServer &other) const { return !equal(other); }
    167 
    168     /** Holds whether DHCP server enabled. */
    169     bool m_fDhcpServerEnabled;
    170     /** Holds DHCP server address. */
    171     QString m_strDhcpServerAddress;
    172     /** Holds DHCP server mask. */
    173     QString m_strDhcpServerMask;
    174     /** Holds DHCP server lower address. */
    175     QString m_strDhcpLowerAddress;
    176     /** Holds DHCP server upper address. */
    177     QString m_strDhcpUpperAddress;
    178 };
    179 
    180 
    181 /** Global settings: Network page: Host network data structure. */
    182 struct UIDataSettingsGlobalNetworkHost
    183 {
    184     /** Constructs data. */
    185     UIDataSettingsGlobalNetworkHost()
    186         : m_interface(UIDataSettingsGlobalNetworkHostInterface())
    187         , m_dhcpserver(UIDataSettingsGlobalNetworkDHCPServer())
    188     {}
    189 
    190     /** Returns whether the @a other passed data is equal to this one. */
    191     bool equal(const UIDataSettingsGlobalNetworkHost &other) const
    192     {
    193         return true
    194                && (m_interface == other.m_interface)
    195                && (m_dhcpserver == other.m_dhcpserver)
    196                ;
    197     }
    198 
    199     /** Returns whether the @a other passed data is equal to this one. */
    200     bool operator==(const UIDataSettingsGlobalNetworkHost &other) const { return equal(other); }
    201     /** Returns whether the @a other passed data is different from this one. */
    202     bool operator!=(const UIDataSettingsGlobalNetworkHost &other) const { return !equal(other); }
    203 
    204     /** Holds the host interface data. */
    205     UIDataSettingsGlobalNetworkHostInterface m_interface;
    206     /** Holds the DHCP server data. */
    207     UIDataSettingsGlobalNetworkDHCPServer m_dhcpserver;
    208 };
    209 
    210 
    211 /** Global settings: Network page data structure. */
    212 struct UIDataSettingsGlobalNetwork
    213 {
    214     /** Constructs data. */
    215     UIDataSettingsGlobalNetwork()
    216         : m_networksNAT(QList<UIDataSettingsGlobalNetworkNAT>())
    217         , m_networksHost(QList<UIDataSettingsGlobalNetworkHost>())
    218     {}
    219 
    220     /** Returns whether the @a other passed data is equal to this one. */
    221     bool equal(const UIDataSettingsGlobalNetwork &other) const
    222     {
    223         return true
    224                && (m_networksNAT == other.m_networksNAT)
    225                && (m_networksHost == other.m_networksHost)
    226                ;
    227     }
    228 
    229     /** Returns whether the @a other passed data is equal to this one. */
    230     bool operator==(const UIDataSettingsGlobalNetwork &other) const { return equal(other); }
    231     /** Returns whether the @a other passed data is different from this one. */
    232     bool operator!=(const UIDataSettingsGlobalNetwork &other) const { return !equal(other); }
    233 
    234     /** Holds the NAT network data. */
    235     QList<UIDataSettingsGlobalNetworkNAT> m_networksNAT;
    236     /** Holds the host network data. */
    237     QList<UIDataSettingsGlobalNetworkHost> m_networksHost;
    238 };
     28struct UIDataSettingsGlobalNetwork;
     29struct UIDataSettingsGlobalNetworkNAT;
     30struct UIDataSettingsGlobalNetworkHost;
    23931typedef UISettingsCache<UIDataSettingsGlobalNetwork> UISettingsCacheGlobalNetwork;
    24032
     
    24739public:
    24840
    249     /* Constructor: */
     41    /** Constructs Network settings page. */
    25042    UIGlobalSettingsNetwork();
     43    /** Destructs Network settings page. */
     44    ~UIGlobalSettingsNetwork();
    25145
    25246protected:
     
    29589
    29690    /* Helpers: NAT network cache stuff: */
    297     UIDataSettingsGlobalNetworkNAT generateDataNetworkNAT(const CNATNetwork &network);
     91    void generateDataNetworkNAT(const CNATNetwork &network, UIDataSettingsGlobalNetworkNAT &data);
    29892    void saveCacheItemNetworkNAT(const UIDataSettingsGlobalNetworkNAT &data);
    29993
     
    30397
    30498    /* Helpers: Host network cache stuff: */
    305     UIDataSettingsGlobalNetworkHost generateDataNetworkHost(const CHostNetworkInterface &iface);
     99    void generateDataNetworkHost(const CHostNetworkInterface &iface, UIDataSettingsGlobalNetworkHost &data);
    306100    void saveCacheItemNetworkHost(const UIDataSettingsGlobalNetworkHost &data);
    307101
     
    320114    QAction *m_pActionEditNetworkHost;
    321115
    322     /* Variable: Cache: */
    323     UISettingsCacheGlobalNetwork m_cache;
     116    /** Holds the page data cache instance. */
     117    UISettingsCacheGlobalNetwork *m_pCache;
    324118};
    325119
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.h

    r65629 r66169  
    1919#define __UIGlobalSettingsNetworkDetailsHost_h__
    2020
    21 /* Local includes */
     21/* GUI includes: */
    2222#include "QIDialog.h"
    2323#include "QIWithRetranslateUI.h"
    2424#include "UIGlobalSettingsNetworkDetailsHost.gen.h"
    2525
    26 /* Forward decalrations: */
    27 struct UIDataSettingsGlobalNetworkHost;
     26
     27/** Global settings: Network page: Host interface data structure. */
     28struct UIDataSettingsGlobalNetworkHostInterface
     29{
     30    /** Constructs data. */
     31    UIDataSettingsGlobalNetworkHostInterface()
     32        : m_strName(QString())
     33        , m_fDhcpClientEnabled(false)
     34        , m_strInterfaceAddress(QString())
     35        , m_strInterfaceMask(QString())
     36        , m_fIpv6Supported(false)
     37        , m_strInterfaceAddress6(QString())
     38        , m_strInterfaceMaskLength6(QString())
     39    {}
     40
     41    /** Returns whether the @a other passed data is equal to this one. */
     42    bool equal(const UIDataSettingsGlobalNetworkHostInterface &other) const
     43    {
     44        return true
     45               && (m_strName == other.m_strName)
     46               && (m_fDhcpClientEnabled == other.m_fDhcpClientEnabled)
     47               && (m_strInterfaceAddress == other.m_strInterfaceAddress)
     48               && (m_strInterfaceMask == other.m_strInterfaceMask)
     49               && (m_fIpv6Supported == other.m_fIpv6Supported)
     50               && (m_strInterfaceAddress6 == other.m_strInterfaceAddress6)
     51               && (m_strInterfaceMaskLength6 == other.m_strInterfaceMaskLength6)
     52               ;
     53    }
     54
     55    /** Returns whether the @a other passed data is equal to this one. */
     56    bool operator==(const UIDataSettingsGlobalNetworkHostInterface &other) const { return equal(other); }
     57    /** Returns whether the @a other passed data is different from this one. */
     58    bool operator!=(const UIDataSettingsGlobalNetworkHostInterface &other) const { return !equal(other); }
     59
     60    /** Holds host interface name. */
     61    QString m_strName;
     62    /** Holds whether DHCP client enabled. */
     63    bool m_fDhcpClientEnabled;
     64    /** Holds IPv4 interface address. */
     65    QString m_strInterfaceAddress;
     66    /** Holds IPv4 interface mask. */
     67    QString m_strInterfaceMask;
     68    /** Holds whether IPv6 protocol supported. */
     69    bool m_fIpv6Supported;
     70    /** Holds IPv6 interface address. */
     71    QString m_strInterfaceAddress6;
     72    /** Holds IPv6 interface mask length. */
     73    QString m_strInterfaceMaskLength6;
     74};
     75
     76
     77/** Global settings: Network page: DHCP server data structure. */
     78struct UIDataSettingsGlobalNetworkDHCPServer
     79{
     80    /** Constructs data. */
     81    UIDataSettingsGlobalNetworkDHCPServer()
     82        : m_fDhcpServerEnabled(false)
     83        , m_strDhcpServerAddress(QString())
     84        , m_strDhcpServerMask(QString())
     85        , m_strDhcpLowerAddress(QString())
     86        , m_strDhcpUpperAddress(QString())
     87    {}
     88
     89    /** Returns whether the @a other passed data is equal to this one. */
     90    bool equal(const UIDataSettingsGlobalNetworkDHCPServer &other) const
     91    {
     92        return true
     93               && (m_fDhcpServerEnabled == other.m_fDhcpServerEnabled)
     94               && (m_strDhcpServerAddress == other.m_strDhcpServerAddress)
     95               && (m_strDhcpServerMask == other.m_strDhcpServerMask)
     96               && (m_strDhcpLowerAddress == other.m_strDhcpLowerAddress)
     97               && (m_strDhcpUpperAddress == other.m_strDhcpUpperAddress)
     98               ;
     99    }
     100
     101    /** Returns whether the @a other passed data is equal to this one. */
     102    bool operator==(const UIDataSettingsGlobalNetworkDHCPServer &other) const { return equal(other); }
     103    /** Returns whether the @a other passed data is different from this one. */
     104    bool operator!=(const UIDataSettingsGlobalNetworkDHCPServer &other) const { return !equal(other); }
     105
     106    /** Holds whether DHCP server enabled. */
     107    bool m_fDhcpServerEnabled;
     108    /** Holds DHCP server address. */
     109    QString m_strDhcpServerAddress;
     110    /** Holds DHCP server mask. */
     111    QString m_strDhcpServerMask;
     112    /** Holds DHCP server lower address. */
     113    QString m_strDhcpLowerAddress;
     114    /** Holds DHCP server upper address. */
     115    QString m_strDhcpUpperAddress;
     116};
     117
     118
     119/** Global settings: Network page: Host network data structure. */
     120struct UIDataSettingsGlobalNetworkHost
     121{
     122    /** Constructs data. */
     123    UIDataSettingsGlobalNetworkHost()
     124        : m_interface(UIDataSettingsGlobalNetworkHostInterface())
     125        , m_dhcpserver(UIDataSettingsGlobalNetworkDHCPServer())
     126    {}
     127
     128    /** Returns whether the @a other passed data is equal to this one. */
     129    bool equal(const UIDataSettingsGlobalNetworkHost &other) const
     130    {
     131        return true
     132               && (m_interface == other.m_interface)
     133               && (m_dhcpserver == other.m_dhcpserver)
     134               ;
     135    }
     136
     137    /** Returns whether the @a other passed data is equal to this one. */
     138    bool operator==(const UIDataSettingsGlobalNetworkHost &other) const { return equal(other); }
     139    /** Returns whether the @a other passed data is different from this one. */
     140    bool operator!=(const UIDataSettingsGlobalNetworkHost &other) const { return !equal(other); }
     141
     142    /** Holds the host interface data. */
     143    UIDataSettingsGlobalNetworkHostInterface m_interface;
     144    /** Holds the DHCP server data. */
     145    UIDataSettingsGlobalNetworkDHCPServer m_dhcpserver;
     146};
     147
    28148
    29149/* Global settings / Network page / Details sub-dialog: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h

    r65629 r66169  
    1919#define __UIGlobalSettingsNetworkDetailsNAT_h__
    2020
    21 /* Local includes */
     21/* GUI includes: */
    2222#include "QIDialog.h"
    2323#include "QIWithRetranslateUI.h"
    2424#include "UIGlobalSettingsNetworkDetailsNAT.gen.h"
     25#include "UIPortForwardingTable.h"
    2526
    26 /* Forward decalrations: */
    27 struct UIDataSettingsGlobalNetworkNAT;
     27
     28/** Global settings: Network page: NAT network data structure. */
     29struct UIDataSettingsGlobalNetworkNAT
     30{
     31    /** Constructs data. */
     32    UIDataSettingsGlobalNetworkNAT()
     33        : m_fEnabled(false)
     34        , m_strName(QString())
     35        , m_strNewName(QString())
     36        , m_strCIDR(QString())
     37        , m_fSupportsDHCP(false)
     38        , m_fSupportsIPv6(false)
     39        , m_fAdvertiseDefaultIPv6Route(false)
     40        , m_ipv4rules(QList<UIPortForwardingData>())
     41        , m_ipv6rules(QList<UIPortForwardingData>())
     42    {}
     43
     44    /** Returns whether the @a other passed data is equal to this one. */
     45    bool equal(const UIDataSettingsGlobalNetworkNAT &other) const
     46    {
     47        return true
     48               && (m_fEnabled == other.m_fEnabled)
     49               && (m_strName == other.m_strName)
     50               && (m_strNewName == other.m_strNewName)
     51               && (m_strCIDR == other.m_strCIDR)
     52               && (m_fSupportsDHCP == other.m_fSupportsDHCP)
     53               && (m_fSupportsIPv6 == other.m_fSupportsIPv6)
     54               && (m_fAdvertiseDefaultIPv6Route == other.m_fAdvertiseDefaultIPv6Route)
     55               && (m_ipv4rules == other.m_ipv4rules)
     56               && (m_ipv6rules == other.m_ipv6rules)
     57               ;
     58    }
     59
     60    /** Returns whether the @a other passed data is equal to this one. */
     61    bool operator==(const UIDataSettingsGlobalNetworkNAT &other) const { return equal(other); }
     62    /** Returns whether the @a other passed data is different from this one. */
     63    bool operator!=(const UIDataSettingsGlobalNetworkNAT &other) const { return !equal(other); }
     64
     65    /** Holds whether this network enabled. */
     66    bool m_fEnabled;
     67    /** Holds network name. */
     68    QString m_strName;
     69    /** Holds new network name. */
     70    QString m_strNewName;
     71    /** Holds network CIDR. */
     72    QString m_strCIDR;
     73    /** Holds whether this network supports DHCP. */
     74    bool m_fSupportsDHCP;
     75    /** Holds whether this network supports IPv6. */
     76    bool m_fSupportsIPv6;
     77    /** Holds whether this network advertised as default IPv6 route. */
     78    bool m_fAdvertiseDefaultIPv6Route;
     79    /** Holds IPv4 port forwarding rules. */
     80    UIPortForwardingDataList m_ipv4rules;
     81    /** Holds IPv6 port forwarding rules. */
     82    UIPortForwardingDataList m_ipv6rules;
     83};
     84
    2885
    2986/* Global settings / Network page / Details sub-dialog: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp

    r65688 r66169  
    3131
    3232
     33/** Global settings: Proxy page data structure. */
     34struct UIDataSettingsGlobalProxy
     35{
     36    /** Constructs data. */
     37    UIDataSettingsGlobalProxy()
     38        : m_enmProxyState(UIProxyManager::ProxyState_Auto)
     39        , m_strProxyHost(QString())
     40        , m_strProxyPort(QString())
     41    {}
     42
     43    /** Returns whether the @a other passed data is equal to this one. */
     44    bool equal(const UIDataSettingsGlobalProxy &other) const
     45    {
     46        return true
     47               && (m_enmProxyState == other.m_enmProxyState)
     48               && (m_strProxyHost == other.m_strProxyHost)
     49               && (m_strProxyPort == other.m_strProxyPort)
     50               ;
     51    }
     52
     53    /** Returns whether the @a other passed data is equal to this one. */
     54    bool operator==(const UIDataSettingsGlobalProxy &other) const { return equal(other); }
     55    /** Returns whether the @a other passed data is different from this one. */
     56    bool operator!=(const UIDataSettingsGlobalProxy &other) const { return !equal(other); }
     57
     58    /** Holds the proxy state. */
     59    UIProxyManager::ProxyState m_enmProxyState;
     60    /** Holds the proxy host. */
     61    QString m_strProxyHost;
     62    /** Holds the proxy port. */
     63    QString m_strProxyPort;
     64};
     65
     66
    3367UIGlobalSettingsProxy::UIGlobalSettingsProxy()
     68    : m_pCache(new UISettingsCacheGlobalProxy)
    3469{
    3570    /* Apply UI decorations: */
     
    5489}
    5590
     91UIGlobalSettingsProxy::~UIGlobalSettingsProxy()
     92{
     93    /* Cleanup cache: */
     94    delete m_pCache;
     95    m_pCache = 0;
     96}
     97
    5698void UIGlobalSettingsProxy::loadToCacheFrom(QVariant &data)
    5799{
     
    60102
    61103    /* Clear cache initially: */
    62     m_cache.clear();
     104    m_pCache->clear();
    63105
    64106    /* Prepare old data: */
     
    72114
    73115    /* Cache old data: */
    74     m_cache.cacheInitialData(oldData);
     116    m_pCache->cacheInitialData(oldData);
    75117
    76118    /* Upload properties & settings to data: */
     
    81123{
    82124    /* Get old data from cache: */
    83     const UIDataSettingsGlobalProxy &oldData = m_cache.base();
     125    const UIDataSettingsGlobalProxy &oldData = m_pCache->base();
    84126
    85127    /* Load old data from cache: */
     
    101143{
    102144    /* Prepare new data: */
    103     UIDataSettingsGlobalProxy newData = m_cache.base();
     145    UIDataSettingsGlobalProxy newData = m_pCache->base();
    104146
    105147    /* Gather new data: */
     
    111153
    112154    /* Cache new data: */
    113     m_cache.cacheCurrentData(newData);
     155    m_pCache->cacheCurrentData(newData);
    114156}
    115157
     
    120162
    121163    /* Save new data from cache: */
    122     if (m_cache.wasChanged())
     164    if (m_pCache->wasChanged())
    123165    {
    124166        UIProxyManager proxyManager;
    125         proxyManager.setProxyState(m_cache.data().m_enmProxyState);
    126         proxyManager.setProxyHost(m_cache.data().m_strProxyHost);
    127         proxyManager.setProxyPort(m_cache.data().m_strProxyPort);
     167        proxyManager.setProxyState(m_pCache->data().m_enmProxyState);
     168        proxyManager.setProxyHost(m_pCache->data().m_strProxyHost);
     169        proxyManager.setProxyPort(m_pCache->data().m_strProxyPort);
    128170        m_settings.setProxySettings(proxyManager.toString());
    129171    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h

    r66163 r66169  
    2424#include "VBoxUtils.h"
    2525
    26 
    27 /** Global settings: Proxy page data structure. */
    28 struct UIDataSettingsGlobalProxy
    29 {
    30     /** Constructs data. */
    31     UIDataSettingsGlobalProxy()
    32         : m_enmProxyState(UIProxyManager::ProxyState_Auto)
    33         , m_strProxyHost(QString())
    34         , m_strProxyPort(QString())
    35     {}
    36 
    37     /** Returns whether the @a other passed data is equal to this one. */
    38     bool equal(const UIDataSettingsGlobalProxy &other) const
    39     {
    40         return true
    41                && (m_enmProxyState == other.m_enmProxyState)
    42                && (m_strProxyHost == other.m_strProxyHost)
    43                && (m_strProxyPort == other.m_strProxyPort)
    44                ;
    45     }
    46 
    47     /** Returns whether the @a other passed data is equal to this one. */
    48     bool operator==(const UIDataSettingsGlobalProxy &other) const { return equal(other); }
    49     /** Returns whether the @a other passed data is different from this one. */
    50     bool operator!=(const UIDataSettingsGlobalProxy &other) const { return !equal(other); }
    51 
    52     /** Holds the proxy state. */
    53     UIProxyManager::ProxyState m_enmProxyState;
    54     /** Holds the proxy host. */
    55     QString m_strProxyHost;
    56     /** Holds the proxy port. */
    57     QString m_strProxyPort;
    58 };
     26/* Forward declarations: */
     27struct UIDataSettingsGlobalProxy;
    5928typedef UISettingsCache<UIDataSettingsGlobalProxy> UISettingsCacheGlobalProxy;
    6029
     
    6736public:
    6837
    69     /* Constructor: */
     38    /** Constructs Proxy settings page. */
    7039    UIGlobalSettingsProxy();
     40    /** Destructs Proxy settings page. */
     41    ~UIGlobalSettingsProxy();
    7142
    7243protected:
     
    10273private:
    10374
    104     /* Cache: */
    105     UISettingsCacheGlobalProxy m_cache;
     75    /** Holds the page data cache instance. */
     76    UISettingsCacheGlobalProxy *m_pCache;
    10677};
    10778
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp

    r65689 r66169  
    2828
    2929
     30/** Global settings: Update page data structure. */
     31struct UIDataSettingsGlobalUpdate
     32{
     33    /** Constructs data. */
     34    UIDataSettingsGlobalUpdate()
     35        : m_fCheckEnabled(false)
     36        , m_periodIndex(VBoxUpdateData::PeriodUndefined)
     37        , m_branchIndex(VBoxUpdateData::BranchStable)
     38        , m_strDate(QString())
     39    {}
     40
     41    /** Returns whether the @a other passed data is equal to this one. */
     42    bool equal(const UIDataSettingsGlobalUpdate &other) const
     43    {
     44        return true
     45               && (m_fCheckEnabled == other.m_fCheckEnabled)
     46               && (m_periodIndex == other.m_periodIndex)
     47               && (m_branchIndex == other.m_branchIndex)
     48               && (m_strDate == other.m_strDate)
     49               ;
     50    }
     51
     52    /** Returns whether the @a other passed data is equal to this one. */
     53    bool operator==(const UIDataSettingsGlobalUpdate &other) const { return equal(other); }
     54    /** Returns whether the @a other passed data is different from this one. */
     55    bool operator!=(const UIDataSettingsGlobalUpdate &other) const { return !equal(other); }
     56
     57    /** Holds whether the update check is enabled. */
     58    bool m_fCheckEnabled;
     59    /** Holds the update check period. */
     60    VBoxUpdateData::PeriodType m_periodIndex;
     61    /** Holds the update branch type. */
     62    VBoxUpdateData::BranchType m_branchIndex;
     63    /** Holds the next update date. */
     64    QString m_strDate;
     65};
     66
     67
    3068UIGlobalSettingsUpdate::UIGlobalSettingsUpdate()
    3169    : m_pLastChosenRadio(0)
     70    , m_pCache(new UISettingsCacheGlobalUpdate)
    3271{
    3372    /* Apply UI decorations: */
     
    4281}
    4382
     83UIGlobalSettingsUpdate::~UIGlobalSettingsUpdate()
     84{
     85    /* Cleanup cache: */
     86    delete m_pCache;
     87    m_pCache = 0;
     88}
     89
    4490void UIGlobalSettingsUpdate::loadToCacheFrom(QVariant &data)
    4591{
     
    4894
    4995    /* Clear cache initially: */
    50     m_cache.clear();
     96    m_pCache->clear();
    5197
    5298    /* Prepare old data: */
     
    61107
    62108    /* Cache old data: */
    63     m_cache.cacheInitialData(oldData);
     109    m_pCache->cacheInitialData(oldData);
    64110
    65111    /* Upload properties & settings to data: */
     
    70116{
    71117    /* Get old data from cache: */
    72     const UIDataSettingsGlobalUpdate &oldData = m_cache.base();
     118    const UIDataSettingsGlobalUpdate &oldData = m_pCache->base();
    73119
    74120    /* Load old data from cache: */
     
    91137{
    92138    /* Prepare new data: */
    93     UIDataSettingsGlobalUpdate newData = m_cache.base();
     139    UIDataSettingsGlobalUpdate newData = m_pCache->base();
    94140
    95141    /* Gather new data: */
     
    98144
    99145    /* Cache new data: */
    100     m_cache.cacheCurrentData(newData);
     146    m_pCache->cacheCurrentData(newData);
    101147}
    102148
     
    107153
    108154    /* Save new data from cache: */
    109     if (m_cache.wasChanged())
     155    if (m_pCache->wasChanged())
    110156    {
    111157        /* Gather corresponding values from internal variables: */
    112         VBoxUpdateData newData(m_cache.data().m_periodIndex, m_cache.data().m_branchIndex);
     158        VBoxUpdateData newData(m_pCache->data().m_periodIndex, m_pCache->data().m_branchIndex);
    113159        gEDataManager->setApplicationUpdateData(newData.data());
    114160    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h

    r66163 r66169  
    2424#include "UIUpdateDefs.h"
    2525
    26 
    27 /** Global settings: Update page data structure. */
    28 struct UIDataSettingsGlobalUpdate
    29 {
    30     /** Constructs data. */
    31     UIDataSettingsGlobalUpdate()
    32         : m_fCheckEnabled(false)
    33         , m_periodIndex(VBoxUpdateData::PeriodUndefined)
    34         , m_branchIndex(VBoxUpdateData::BranchStable)
    35         , m_strDate(QString())
    36     {}
    37 
    38     /** Returns whether the @a other passed data is equal to this one. */
    39     bool equal(const UIDataSettingsGlobalUpdate &other) const
    40     {
    41         return true
    42                && (m_fCheckEnabled == other.m_fCheckEnabled)
    43                && (m_periodIndex == other.m_periodIndex)
    44                && (m_branchIndex == other.m_branchIndex)
    45                && (m_strDate == other.m_strDate)
    46                ;
    47     }
    48 
    49     /** Returns whether the @a other passed data is equal to this one. */
    50     bool operator==(const UIDataSettingsGlobalUpdate &other) const { return equal(other); }
    51     /** Returns whether the @a other passed data is different from this one. */
    52     bool operator!=(const UIDataSettingsGlobalUpdate &other) const { return !equal(other); }
    53 
    54     /** Holds whether the update check is enabled. */
    55     bool m_fCheckEnabled;
    56     /** Holds the update check period. */
    57     VBoxUpdateData::PeriodType m_periodIndex;
    58     /** Holds the update branch type. */
    59     VBoxUpdateData::BranchType m_branchIndex;
    60     /** Holds the next update date. */
    61     QString m_strDate;
    62 };
     26/* Forward declarations: */
     27struct UIDataSettingsGlobalUpdate;
    6328typedef UISettingsCache<UIDataSettingsGlobalUpdate> UISettingsCacheGlobalUpdate;
    6429
     
    7136public:
    7237
    73     /* Constructor: */
     38    /** Constructs Update settings page. */
    7439    UIGlobalSettingsUpdate();
     40    /** Destructs Update settings page. */
     41    ~UIGlobalSettingsUpdate();
    7542
    7643protected:
     
    11178    QRadioButton *m_pLastChosenRadio;
    11279
    113     /* Cache: */
    114     UISettingsCacheGlobalUpdate m_cache;
     80    /** Holds the page data cache instance. */
     81    UISettingsCacheGlobalUpdate *m_pCache;
    11582};
    11683
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