VirtualBox

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


Ignore:
Timestamp:
Nov 16, 2018 4:47:56 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9289: VirtualBox Manager / Details pane: A bit of refactoring, proper prepare/cleanup cascade.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/details
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.cpp

    r75525 r75526  
    4646    , m_pAnimationCallback(0)
    4747{
    48     /* Prepare scene: */
    49     prepareScene();
    50 
    51     /* Prepare root: */
    52     prepareRoot();
    53 
    54     /* Load settings: */
    55     loadSettings();
    56 
    57     /* Register meta-type: */
    58     qRegisterMetaType<DetailsElementType>();
     48    prepare();
    5949}
    6050
    6151UIDetailsModel::~UIDetailsModel()
    6252{
    63     /* Save settings: */
    64     saveSettings();
    65 
    66     /* Cleanup root: */
    67     cleanupRoot();
    68 
    69     /* Cleanup scene: */
    70     cleanupScene();
    71  }
     53    cleanup();
     54}
    7255
    7356QGraphicsScene* UIDetailsModel::scene() const
     
    222205}
    223206
     207void UIDetailsModel::prepare()
     208{
     209    /* Register meta-types: */
     210    qRegisterMetaType<DetailsElementType>();
     211
     212    /* Prepare things: */
     213    prepareScene();
     214    prepareRoot();
     215    loadSettings();
     216}
     217
    224218void UIDetailsModel::prepareScene()
    225219{
    226220    m_pScene = new QGraphicsScene(this);
    227     m_pScene->installEventFilter(this);
     221    if (m_pScene)
     222        m_pScene->installEventFilter(this);
    228223}
    229224
     
    235230void UIDetailsModel::loadSettings()
    236231{
    237     /* Load settings: */
    238232    m_categories = gEDataManager->selectorWindowDetailsElements();
    239233}
     
    241235void UIDetailsModel::saveSettings()
    242236{
    243     /* Save settings: */
    244237    gEDataManager->setSelectorWindowDetailsElements(m_categories);
    245238}
     
    255248    delete m_pScene;
    256249    m_pScene = 0;
     250}
     251
     252void UIDetailsModel::cleanup()
     253{
     254    /* Cleanup things: */
     255    saveSettings();
     256    cleanupRoot();
     257    cleanupScene();
    257258}
    258259
     
    268269
    269270    /* Process context menu event: */
    270     return processContextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent*>(pEvent));
     271        return processContextMenuEvent(static_cast<QGraphicsSceneContextMenuEvent*>(pEvent));
    271272}
    272273
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsModel.h

    r75525 r75526  
    108108private:
    109109
    110     /* Helpers: Prepare stuff: */
    111     void prepareScene();
    112     void prepareRoot();
    113     void loadSettings();
     110    /** @name Prepare/Cleanup cascade.
     111      * @{ */
     112        /** Prepares all. */
     113        void prepare();
     114        /** Prepares scene. */
     115        void prepareScene();
     116        /** Prepares root. */
     117        void prepareRoot();
     118        /** Loads settings. */
     119        void loadSettings();
    114120
    115     /* Helpers: Cleanup stuff: */
    116     void saveSettings();
    117     void cleanupRoot();
    118     void cleanupScene();
     121        /** Saves settings. */
     122        void saveSettings();
     123        /** Cleanups root. */
     124        void cleanupRoot();
     125        /** Cleanups scene. */
     126        void cleanupScene();
     127        /** Cleanups all. */
     128        void cleanup();
     129    /** @} */
    119130
    120131    /* Handler: Event-filter: */
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