VirtualBox

Changeset 71373 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 19, 2018 12:36:23 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Cleanup for UIModalWindowManager: Doxygen and coding-style.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp

    r71371 r71373  
    55
    66/*
    7  * Copyright (C) 2013-2017 Oracle Corporation
     7 * Copyright (C) 2013-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2727#  include "UINetworkManager.h"
    2828#  include "UINetworkManagerDialog.h"
    29 # endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
     29# endif
    3030# include "UIProgressDialog.h"
    3131# include "UISelectorWindow.h"
     
    3838
    3939/* static */
    40 UIModalWindowManager* UIModalWindowManager::m_spInstance = 0;
    41 UIModalWindowManager* UIModalWindowManager::instance() { return m_spInstance; }
     40UIModalWindowManager *UIModalWindowManager::s_pInstance = 0;
     41UIModalWindowManager *UIModalWindowManager::instance() { return s_pInstance; }
    4242
    4343/* static */
     
    4545{
    4646    /* Make sure instance is NOT created yet: */
    47     if (m_spInstance)
     47    if (s_pInstance)
    4848    {
    4949        AssertMsgFailed(("UIModalWindowManager instance is already created!"));
     
    5959{
    6060    /* Make sure instance is NOT destroyed yet: */
    61     if (!m_spInstance)
     61    if (!s_pInstance)
    6262    {
    6363        AssertMsgFailed(("UIModalWindowManager instance is already destroyed!"));
     
    6666
    6767    /* Destroy instance: */
    68     delete m_spInstance;
     68    delete s_pInstance;
    6969}
    7070
     
    7272{
    7373    /* Assign instance: */
    74     m_spInstance = this;
     74    s_pInstance = this;
    7575}
    7676
     
    7878{
    7979    /* Unassign instance: */
    80     m_spInstance = 0;
    81 }
    82 
    83 QWidget* UIModalWindowManager::mainWindowShown() const
     80    s_pInstance = 0;
     81}
     82
     83QWidget *UIModalWindowManager::mainWindowShown() const
    8484{
    8585    /* It may happen that this method is called before VBoxGlobal initialization
     
    112112
    113113#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    114 QWidget* UIModalWindowManager::networkManagerOrMainWindowShown() const
    115 {
    116     /* It may happen that this method is called before network-manager initialization
    117      * or when the network-manager is hidden, return main application window in this case: */
     114QWidget *UIModalWindowManager::networkManagerOrMainWindowShown() const
     115{
     116    /* Return main application window before network-manager initialization: */
    118117    return gNetworkManager && gNetworkManager->window()->isVisible() ? gNetworkManager->window() : mainWindowShown();
    119118}
    120119#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    121120
    122 QWidget* UIModalWindowManager::realParentWindow(QWidget *pWidget)
     121QWidget *UIModalWindowManager::realParentWindow(QWidget *pWidget)
    123122{
    124123    /* Null if widget pointer is null: */
     
    163162}
    164163
    165 void UIModalWindowManager::registerNewParent(QWidget *pWindow, QWidget *pParentWindow /* = 0*/)
     164void UIModalWindowManager::registerNewParent(QWidget *pWindow, QWidget *pParentWindow /* = 0 */)
    166165{
    167166    /* Make sure passed-widget-pointer is not null: */
     
    274273}
    275274
    276 bool UIModalWindowManager::contains(QWidget *pParentWindow, bool fAsTheTopOfStack /* = false*/)
     275bool UIModalWindowManager::contains(QWidget *pParentWindow, bool fAsTheTopOfStack /* = false */)
    277276{
    278277    /* False if passed-parent-widget pointer is null: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.h

    r69500 r71373  
    55
    66/*
    7  * Copyright (C) 2013-2017 Oracle Corporation
     7 * Copyright (C) 2013-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 */
    1717
    18 #ifndef __UIModalWindowManager_h__
    19 #define __UIModalWindowManager_h__
     18#ifndef ___UIModalWindowManager_h___
     19#define ___UIModalWindowManager_h___
    2020
    2121/* Qt includes: */
     
    2424#include <QList>
    2525
    26 /* Object which contains stack(s) of guarded-pointer(s)
    27  * to the current top-level modal-window(s)
    28  * which could be used to determine top-level modal-dialog(s): */
     26/** QObject subclass which contains a stack(s) of guarded-pointer(s) to the current top-level
     27  * modal-window(s) which could be used to determine parents for new top-level modal-dialog(s). */
    2928class UIModalWindowManager : public QObject
    3029{
     
    3837public:
    3938
    40     /* Static API: Create/destroy stuff: */
     39    /** Creates the static singleton instance. */
    4140    static void create();
     41    /** Destroys the static singleton instance. */
    4242    static void destroy();
    4343
    44     /* API: Access stuff: */
    45     QWidget* realParentWindow(QWidget *pPossibleParentWidget);
     44    /** Returns actual top-level parent window for a passed @a pPossibleParentWidget. */
     45    QWidget *realParentWindow(QWidget *pPossibleParentWidget);
     46    /** Returns whether passed @a pWindow is in the modal window stack. */
    4647    bool isWindowInTheModalWindowStack(QWidget *pWindow);
     48    /** Returns whether passed @a pWindow is on the top of the modal window stack. */
    4749    bool isWindowOnTheTopOfTheModalWindowStack(QWidget *pWindow);
    4850
    49     /* API: Register stuff: */
     51    /** Registers new parent @a pWindow above the passed @a pParentWindow or as separate stack. */
    5052    void registerNewParent(QWidget *pWindow, QWidget *pParentWindow = 0);
    5153
    52     /* API: Main application window stuff: */
    53     QWidget* mainWindowShown() const;
     54    /** Returns main application window. */
     55    QWidget *mainWindowShown() const;
    5456#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     57    /** Returns network manager or main window shown. */
    5558    QWidget* networkManagerOrMainWindowShown() const;
    56 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
     59#endif
    5760
    5861private slots:
    5962
    60     /* Handler: Stack cleanup stuff: */
     63    /** Removes window with base-class @a pObject pointer from the stack. */
    6164    void sltRemoveFromStack(QObject *pObject);
    6265
    6366private:
    6467
    65     /* Constructor/destructor: */
     68    /** Constructs Modal Window Manager instance. */
    6669    UIModalWindowManager();
     70    /** Destructs Modal Window Manager instance. */
    6771    ~UIModalWindowManager();
    6872
    69     /* Helper: Stack stuff: */
     73    /** Returns whether stack contains @a pParentWindow at all or @a fAsTheTopOfStack. */
    7074    bool contains(QWidget *pParentWindow, bool fAsTheTopOfStack = false);
    7175
    72     /* Static helper: Access stuff: */
     76    /** WORKAROUND: Preprocess (show) real parent for a passed @a pParent. */
    7377    static void preprocessRealParent(QWidget *pParent);
    7478
    75     /* Variables: */
     79    /** Holds the list of the top-level window stacks. */
    7680    QList<QList<QWidget*> > m_windows;
    7781
    78     /* Static API: Instance stuff: */
    79     static UIModalWindowManager* m_spInstance;
    80     static UIModalWindowManager* instance();
    81     friend UIModalWindowManager& windowManager();
     82    /** Holds the static singleton instance. */
     83    static UIModalWindowManager *s_pInstance;
     84    /** Returns the static singleton instance. */
     85    static UIModalWindowManager *instance();
     86    /** Allows friend-access for static singleton instance. */
     87    friend UIModalWindowManager &windowManager();
    8288};
    8389
    84 /* Shortcut to the static UIModalWindowManager::instance() method: */
    85 inline UIModalWindowManager& windowManager() { return *(UIModalWindowManager::instance()); }
     90/** Singleton Modal Window Manager 'official' name. */
     91inline UIModalWindowManager &windowManager() { return *(UIModalWindowManager::instance()); }
    8692
    87 #endif /* !__UIModalWindowManager_h__ */
     93#endif /* !___UIModalWindowManager_h___ */
     94
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