VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h@ 28800

Last change on this file since 28800 was 28800, checked in by vboxsync, 14 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * Declarations of utility classes and functions
5 * VirtualBox Qt extensions: QIWithRetranslateUI class declaration
6 */
7
8/*
9 * Copyright (C) 2008-2010 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef __QIWithRetranslateUI_h
21#define __QIWithRetranslateUI_h
22
23/* Global includes */
24#include <QObject>
25#include <QEvent>
26
27template <class Base>
28class QIWithRetranslateUI: public Base
29{
30public:
31
32 QIWithRetranslateUI(QWidget *pParent = 0) : Base(pParent) {}
33
34protected:
35
36 virtual void changeEvent(QEvent *pEvent)
37 {
38 Base::changeEvent (pEvent);
39 switch (pEvent->type())
40 {
41 case QEvent::LanguageChange:
42 {
43 retranslateUi();
44 pEvent->accept();
45 break;
46 }
47 default:
48 break;
49 }
50 }
51
52 virtual void retranslateUi() = 0;
53};
54
55template <class Base>
56class QIWithRetranslateUI2: public Base
57{
58public:
59
60 QIWithRetranslateUI2(QWidget *pParent = 0, Qt::WindowFlags fFlags = 0) : Base(pParent, fFlags) {}
61
62protected:
63
64 virtual void changeEvent(QEvent *pEvent)
65 {
66 Base::changeEvent (pEvent);
67 switch (pEvent->type())
68 {
69 case QEvent::LanguageChange:
70 {
71 retranslateUi();
72 pEvent->accept();
73 break;
74 }
75 default:
76 break;
77 }
78 }
79
80 virtual void retranslateUi() = 0;
81};
82
83template <class Base>
84class QIWithRetranslateUI3: public Base
85{
86public:
87
88 QIWithRetranslateUI3(QObject *pParent = 0) : Base(pParent) {}
89
90protected:
91
92 virtual bool event(QEvent *pEvent)
93 {
94 bool bResult = Base::event(pEvent);
95 switch (pEvent->type())
96 {
97 case QEvent::LanguageChange:
98 {
99 retranslateUi();
100 pEvent->accept();
101 bResult = true;
102 break;
103 }
104 default:
105 break;
106 }
107 return bResult;
108 }
109
110 virtual void retranslateUi() = 0;
111};
112
113#endif /* __QIWithRetranslateUI_h */
114
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use