VirtualBox

Changeset 57897 in vbox


Ignore:
Timestamp:
Sep 25, 2015 2:24:50 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Mac OS X: Window menu Manager cleanup/rework (step 7): Prepare/cleanup adjustment.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r56217 r57897  
    956956    retranslateUi();
    957957
    958 #ifdef Q_WS_MAC
    959     /* Prepare Mac window-menu.
    960      * Should go *after* translation! */
    961     prepareMacWindowMenu();
    962 #endif /* Q_WS_MAC */
    963 
    964958    /* Center according pseudo-parent widget: */
    965959    VBoxGlobal::centerWidget(this, m_pPseudoParentWidget, false);
     
    10811075void UIMediumManager::prepareMenuBar()
    10821076{
    1083     /* Create menu-bar-menu: */
     1077    /* Create 'Actions' menu: */
    10841078    m_pMenu = menuBar()->addMenu(QString());
    10851079    AssertPtrReturnVoid(m_pMenu);
    10861080    {
    1087         /* Configure menu-bar-menu: */
     1081        /* Configure 'Actions' menu: */
    10881082        m_pMenu->addAction(m_pActionCopy);
    10891083        m_pMenu->addAction(m_pActionModify);
     
    10921086        m_pMenu->addAction(m_pActionRefresh);
    10931087    }
     1088
     1089#ifdef Q_WS_MAC
     1090    /* Prepare 'Window' menu: */
     1091    AssertPtrReturnVoid(gpWindowMenuManager);
     1092    menuBar()->addMenu(gpWindowMenuManager->createMenu(this));
     1093    gpWindowMenuManager->addWindow(this);
     1094#endif /* Q_WS_MAC */
    10941095}
    10951096
     
    13291330}
    13301331
    1331 #ifdef Q_WS_MAC
    1332 void UIMediumManager::prepareMacWindowMenu()
    1333 {
    1334     /* Create window-menu for menu-bar: */
    1335     menuBar()->addMenu(UIWindowMenuManager::instance()->createMenu(this));
    1336     UIWindowMenuManager::instance()->addWindow(this);
    1337 }
    1338 #endif /* Q_WS_MAC */
    1339 
    13401332void UIMediumManager::repopulateTreeWidgets()
    13411333{
     
    17091701}
    17101702
     1703void UIMediumManager::cleanupMenuBar()
     1704{
    17111705#ifdef Q_WS_MAC
    1712 void UIMediumManager::cleanupMacWindowMenu()
    1713 {
    1714     /* Destroy window-menu of menu-bar: */
    1715     UIWindowMenuManager::instance()->removeWindow(this);
    1716     UIWindowMenuManager::instance()->destroyMenu(this);
    1717 }
     1706    /* Cleanup 'Window' menu: */
     1707    AssertPtrReturnVoid(gpWindowMenuManager);
     1708    gpWindowMenuManager->removeWindow(this);
     1709    gpWindowMenuManager->destroyMenu(this);
    17181710#endif /* Q_WS_MAC */
     1711}
    17191712
    17201713void UIMediumManager::cleanup()
    17211714{
    1722 #ifdef Q_WS_MAC
    1723     /* Cleanup Mac window-menu: */
    1724     cleanupMacWindowMenu();
    1725 #endif /* Q_WS_MAC */
     1715    /* Cleanup menu-bar: */
     1716    cleanupMenuBar();
    17261717}
    17271718
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h

    r55401 r57897  
    134134    /** Prepare progress-bar. */
    135135    void prepareProgressBar();
    136 #ifdef Q_WS_MAC
    137     /** Mac OS X: Prepare <i>Window</i> menu. */
    138     void prepareMacWindowMenu();
    139 #endif /* Q_WS_MAC */
    140136
    141137    /** Repopulates tree-widgets content. */
     
    164160    void updateInformationFieldsFD();
    165161
    166 #ifdef Q_WS_MAC
    167     /** Mac OS X: Cleanup <i>Window</i> menu. */
    168     void cleanupMacWindowMenu();
    169 #endif /* Q_WS_MAC */
     162    /** Cleanup menu-bar. */
     163    void cleanupMenuBar();
    170164    /** General cleanup wrapper. */
    171165    void cleanup();
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp

    r57895 r57897  
    196196
    197197/* static */
    198 UIWindowMenuManager* UIWindowMenuManager::instance()
    199 {
    200     /* Make sure 'Window' menu Manager is created: */
    201     if (!m_spInstance)
    202         m_spInstance = new UIWindowMenuManager;
    203 
    204     /* Return 'Window' menu Manager: */
    205     return m_spInstance;
     198void UIWindowMenuManager::create()
     199{
     200    /* Make sure 'Window' menu Manager is not created: */
     201    AssertReturnVoid(!m_spInstance);
     202
     203    /* Create 'Window' menu Manager: */
     204    new UIWindowMenuManager;
    206205}
    207206
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.h

    r57892 r57897  
    3838public:
    3939
    40     /** Static constructor and instance provider. */
    41     static UIWindowMenuManager* instance();
     40    /** Static constructor. */
     41    static void create();
    4242    /** Static destructor. */
    4343    static void destroy();
     44    /** Static instance provider. */
     45    static UIWindowMenuManager* instance() { return m_spInstance; }
    4446
    4547    /** Creates 'Window' menu for passed @a pWindow. */
     
    7880};
    7981
     82#define gpWindowMenuManager UIWindowMenuManager::instance()
     83
    8084#endif /* !___UIWindowMenuManager_h___ */
    8185
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r57891 r57897  
    11551155# endif /* MAC_LEOPARD_STYLE */
    11561156
    1157     UIWindowMenuManager::instance()->addWindow(this);
    11581157    /* Beta label? */
    11591158    if (vboxGlobal().isBeta())
     
    12121211
    12131212#ifdef Q_WS_MAC
    1214     menuBar()->addMenu(UIWindowMenuManager::instance()->createMenu(this));
     1213    /* Prepare 'Window' menu: */
     1214    UIWindowMenuManager::create();
     1215    menuBar()->addMenu(gpWindowMenuManager->createMenu(this));
     1216    gpWindowMenuManager->addWindow(this);
    12151217#endif /* Q_WS_MAC */
    12161218
     
    17071709void UISelectorWindow::cleanupMenuBar()
    17081710{
     1711#ifdef Q_WS_MAC
     1712    /* Cleanup 'Window' menu: */
     1713    UIWindowMenuManager::destroy();
     1714#endif /* Q_WS_MAC */
     1715
    17091716    /* Destroy action-pool: */
    17101717    UIActionPool::destroy(m_pActionPool);
     
    17151722    /* Destroy event handlers: */
    17161723    UIVirtualBoxEventHandler::destroy();
    1717 
    1718 #ifdef Q_WS_MAC
    1719     UIWindowMenuManager::destroy();
    1720 #endif /* Q_WS_MAC */
    17211724
    17221725    /* Save settings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h

    r57844 r57897  
    5252    /** Static destructor. */
    5353    static void destroy();
    54     /** Static instance. */
     54    /** Static instance provider. */
    5555    static UISelectorWindow* instance() { return m_spInstance; }
    5656
     
    6060protected:
    6161
    62     /** Constructs selector-window.
    63       * @param ppSelf brings the pointer to pointer to this window instance used by the external caller.
    64       * @param flags  brings the selector-window flags dialogs should have. */
     62    /** Constructs selector-window. */
    6563    UISelectorWindow();
    6664    /** Destructs selector-window. */
     
    259257    /** @} */
    260258
    261     /** Static instance. */
     259    /** Holds the static instance. */
    262260    static UISelectorWindow *m_spInstance;
    263261
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