VirtualBox

Ignore:
Timestamp:
Sep 25, 2015 12:12:40 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Mac OS X: Window menu Manager cleanup/rework (step 1): Doxy.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp

    r52730 r57890  
    55
    66/*
    7  * Copyright (C) 2010-2012 Oracle Corporation
     7 * Copyright (C) 2010-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
    2121
    22 /* Local includes */
     22/* GUI includes: */
    2323# include "UIWindowMenuManager.h"
    2424
    25 /* Global includes */
     25/* Qt includes: */
    2626# include <QApplication>
    2727# include <QMenu>
     
    2929#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3030
    31 
     31/** QObject extension
     32  * used as Mac OS X 'Window' menu helper. */
    3233class UIMenuHelper: public QObject
    3334{
     
    3536
    3637public:
     38
     39    /** Constructs menu-helper on the basis of passed @a winList. */
    3740    UIMenuHelper(const QList<QWidget*> &winList)
    3841    {
     
    5154        retranslateUi();
    5255    }
     56
     57    /** Destructs menu-helper. */
    5358    ~UIMenuHelper()
    5459    {
     
    5762    }
    5863
     64    /** Returns 'Window' menu. */
    5965    QMenu *menu() const { return m_pWindowMenu; }
    6066
     67    /** Adds window into 'Window' menu. */
    6168    QAction* addWindow(QWidget *pWindow)
    6269    {
     
    8491        return pAction;
    8592    }
     93
     94    /** Removes window from 'Window' menu. */
    8695    void removeWindow(QWidget *pWindow)
    8796    {
     
    93102    }
    94103
     104    /** Handles translation event. */
    95105    void retranslateUi()
    96106    {
     
    100110    }
    101111
     112    /** Updates toggle action states according to passed @a pActive. */
    102113    void updateStatus(QWidget *pActive)
    103114    {
     
    118129private slots:
    119130
     131    /** Handles request to minimize active-window. */
    120132    void minimizeActive(bool /* fToggle */)
    121133    {
     
    123135            pActive->showMinimized();
    124136    }
     137
     138    /** Handles request to raise sender window. */
    125139    void raiseSender(bool /* fToggle */)
    126140    {
     
    138152private:
    139153
    140     /* Private member vars */
     154    /** Holds the 'Window' menu instance. */
    141155    QMenu *m_pWindowMenu;
     156    /** Holds the action group instance. */
    142157    QActionGroup *m_pGroup;
     158    /** Holds the 'Minimize' action instance. */
    143159    QAction *m_pMinimizeAction;
     160    /** Holds the hash of the registered menu-helper instances. */
    144161    QHash<QString, QAction*> m_regWindows;
    145162};
    146163
     164/* static */
    147165UIWindowMenuManager *UIWindowMenuManager::m_pInstance = 0;
    148166
     167/* static */
    149168UIWindowMenuManager *UIWindowMenuManager::instance(QWidget *pParent /* = 0 */)
    150169{
     
    155174}
    156175
     176/* static */
    157177void UIWindowMenuManager::destroy()
    158178{
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.h

    r55401 r57890  
    55
    66/*
    7  * Copyright (C) 2010 Oracle Corporation
     7 * Copyright (C) 2010-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 */
    1717
    18 #ifndef __UIWindowMenuManager_h__
    19 #define __UIWindowMenuManager_h__
     18#ifndef ___UIWindowMenuManager_h___
     19#define ___UIWindowMenuManager_h___
    2020
    21 /* Global includes */
     21/* Qt includes: */
    2222#include <QObject>
    2323#include <QHash>
    2424
    25 /* Local forward declarations */
     25/* Forward declarations: */
    2626class UIMenuHelper;
    27 
    28 /* Global forward declarations */
    2927class QMenu;
    3028
     29/** Singleton QObject extension
     30  * used as Mac OS X 'Window' menu Manager. */
    3131class UIWindowMenuManager: public QObject
    3232{
     
    3535public:
    3636
     37    /** Static constructor and instance provider. */
    3738    static UIWindowMenuManager *instance(QWidget *pParent = 0);
     39    /** Static destructor. */
    3840    static void destroy();
    3941
     42    /** Creates 'Window' menu for passed @a pWindow. */
    4043    QMenu *createMenu(QWidget *pWindow);
     44    /** Destroys 'Window' menu for passed @a pWindow. */
    4145    void destroyMenu(QWidget *pWindow);
    4246
     47    /** Adds @a pWindow to all 'Window' menus. */
    4348    void addWindow(QWidget *pWindow);
     49    /** Removes @a pWindow from all 'Window' menus. */
    4450    void removeWindow(QWidget *pWindow);
    4551
     52    /** Handles translation event. */
    4653    void retranslateUi();
    4754
    4855protected:
    4956
     57    /** Preprocesses any Qt @a pEvent for passed @a pObject. */
    5058    bool eventFilter(QObject *pObj, QEvent *pEvent);
    5159
    5260private:
    5361
     62    /** Constructs 'Window' menu Manager. */
    5463    UIWindowMenuManager(QWidget *pParent = 0);
     64    /** Destructs 'Window' menu Manager. */
    5565    ~UIWindowMenuManager();
    5666
    57     /* Private member vars */
     67    /** Holds the static instance. */
    5868    static UIWindowMenuManager *m_pInstance;
     69
     70    /** Holds the passed parent reference. */
    5971    QWidget *m_pParent;
     72
     73    /** Holds the list of the registered window references. */
    6074    QList<QWidget*> m_regWindows;
     75
     76    /** Holds the hash of the registered menu-helper instances. */
    6177    QHash<QWidget*, UIMenuHelper*> m_helpers;
    6278};
    6379
    64 #endif /* __UIWindowMenuManager_h__ */
     80#endif /* !___UIWindowMenuManager_h___ */
    6581
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