VirtualBox

Ignore:
Timestamp:
Mar 19, 2024 1:44:53 PM (12 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
162292
Message:

FE/Qt. bugref:10622. Some more additions to UITranslationEventListener.

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

Legend:

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

    r103914 r103918  
    306306    retranslateUi();
    307307
    308     m_pTranlationEventListener = new UITranslationEventListener(this);
     308    /* Create translation event listener instance: */
     309    UITranslationEventListener::create();
    309310
    310311    connect(gEDataManager, &UIExtraDataManager::sigLanguageChange,
     
    842843    /* Destroy desktop-widget watchdog: */
    843844    UIDesktopWidgetWatchdog::destroy();
     845
     846    /* Destroy translation event listener instance: */
     847    UITranslationEventListener::destroy();
    844848
    845849    m_fValid = false;
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/globals/UITranslationEventListener.cpp

    r103914 r103918  
    3333#include "UITranslator.h"
    3434
     35/* static */
     36UITranslationEventListener *UITranslationEventListener::s_pInstance = 0;
     37
     38UITranslationEventListener *UITranslationEventListener::instance()
     39{
     40    return s_pInstance;
     41}
     42
     43/* static */
     44void UITranslationEventListener::create()
     45{
     46    /* Make sure instance is NOT created yet: */
     47    if (s_pInstance)
     48        return;
     49
     50    /* Create instance: */
     51    new UITranslationEventListener;
     52}
     53
     54/* static */
     55void UITranslationEventListener::destroy()
     56{
     57    /* Make sure instance is NOT destroyed yet: */
     58    if (!s_pInstance)
     59        return;
     60
     61    /* Destroy instance: */
     62    delete s_pInstance;
     63}
    3564
    3665
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/globals/UITranslationEventListener.h

    r103914 r103918  
    4747public:
    4848
    49     UITranslationEventListener(QObject *pParent = 0);
     49    /** Creates message-center singleton. */
     50    static void create();
     51    /** Destroys message-center singleton. */
     52    static void destroy();
    5053
    5154protected:
    5255
    5356    bool eventFilter(QObject *pObject, QEvent *pEvent) override final;
     57
     58private:
     59
     60    UITranslationEventListener(QObject *pParent = 0);
     61
     62    static UITranslationEventListener *s_pInstance;
     63    /** Returns the singleton instance. */
     64    static UITranslationEventListener *instance();
     65    /** Allows for shortcut access. */
     66    friend UITranslationEventListener &translationEventListener();
     67
    5468};
    5569
     70inline UITranslationEventListener &translationEventListener() { return *UITranslationEventListener::instance(); }
     71
    5672#endif /* !FEQT_INCLUDED_SRC_globals_UITranslationEventListener_h */
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