VirtualBox

Changeset 9056 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 22, 2008 1:56:00 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: Use QIWithRetranslateUI as base for all classes that need translation (Still not all classes transfered). Language could be switched online with VBoxManage.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
1 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/QIDialogButtonBox.h

    r8946 r9056  
    2424#define __QIDialogButtonBox_h__
    2525
     26#include "QIWithRetranslateUI.h"
     27
    2628/* Qt includes */
    2729#include <QDialogButtonBox>
    2830
    29 class QIDialogButtonBox: public QDialogButtonBox
     31class QIDialogButtonBox: public QIWithRetranslateUI<QDialogButtonBox>
    3032{
    3133public:
    32     QIDialogButtonBox (QWidget *aParent = 0) :QDialogButtonBox (aParent) {}
    33     QIDialogButtonBox (Qt::Orientation aOrientation, QWidget *aParent = 0) :QDialogButtonBox (aOrientation, aParent) {}
     34    QIDialogButtonBox (QWidget *aParent = 0) :QIWithRetranslateUI<QDialogButtonBox> (aParent) {}
     35    QIDialogButtonBox (Qt::Orientation aOrientation, QWidget *aParent = 0) :QIWithRetranslateUI<QDialogButtonBox> (aParent) { setOrientation (aOrientation); }
    3436    QIDialogButtonBox (StandardButtons aButtons, Qt::Orientation aOrientation = Qt::Horizontal, QWidget *aParent = 0);
    3537
     
    4042
    4143protected:
    42     virtual void changeEvent (QEvent *aEvent);
     44
    4345    void retranslateUi();
    4446};
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxCloseVMDlg.h

    r8332 r9056  
    2424#define __VBoxCloseVMDlg_h__
    2525
    26 #include <VBoxCloseVMDlg.gen.h>
    27 #include <QIDialog.h>
     26#include "VBoxCloseVMDlg.gen.h"
     27#include "QIWithRetranslateUI.h"
     28#include "QIDialog.h"
    2829
    29 class VBoxCloseVMDlg : public QIDialog, public Ui::VBoxCloseVMDlg
     30class VBoxCloseVMDlg : public QIWithRetranslateUI2<QIDialog>,
     31                       public Ui::VBoxCloseVMDlg
    3032{
    31     Q_OBJECT
     33    Q_OBJECT;
    3234
    3335public:
    3436
    3537    VBoxCloseVMDlg (QWidget *aParent);
     38
     39protected:
     40
     41    void retranslateUi();
    3642};
    3743
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h

    r8946 r9056  
    2525
    2626#include "COMDefs.h"
     27#include "QIWithRetranslateUI.h"
    2728
    2829/* Qt includes */
     
    5455class VBoxSwitchMenu;
    5556
    56 class VBoxConsoleWnd : public QMainWindow
     57class VBoxConsoleWnd : public QIWithRetranslateUI2<QMainWindow>
    5758{
    58     Q_OBJECT
     59    Q_OBJECT;
    5960
    6061public:
     
    9798#endif
    9899
    99     virtual void changeEvent (QEvent *aEvent);
    100100    void retranslateUi();
    101101
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDefs.h

    r8219 r9056  
    150150        ShowWindowEventType,
    151151#endif
     152        ChangeGUILanguageEventType,
    152153    };
    153154
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDownloaderWgt.h

    r8946 r9056  
    2525
    2626#include "HappyHttp.h"
     27#include "QIWithRetranslateUI.h"
    2728
    2829/* Qt includes */
     
    4647 *  into the VM console status bar.
    4748 */
    48 class VBoxDownloaderWgt : public QWidget
     49class VBoxDownloaderWgt : public QIWithRetranslateUI<QWidget>
    4950{
    50     Q_OBJECT
     51    Q_OBJECT;
    5152
    5253public:
     
    5960
    6061protected:
    61     virtual void changeEvent (QEvent *aEvent);
     62
    6263    void retranslateUi();
    6364
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r8946 r9056  
    137137
    138138    const bool mCanShow;
     139};
     140
     141class VBoxChangeGUILanguageEvent : public QEvent
     142{
     143public:
     144    VBoxChangeGUILanguageEvent (QString aLangId)
     145        : QEvent ((QEvent::Type) VBoxDefs::ChangeGUILanguageEventType)
     146        , mLangId (aLangId)
     147        {}
     148
     149    const QString mLangId;
    139150};
    140151
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h

    r8946 r9056  
    2626#include "COMDefs.h"
    2727
     28#include "QIWithRetranslateUI.h"
    2829#include "VBoxGlobal.h"
    2930
     
    4445class QUuid;
    4546
    46 class VBoxSelectorWnd: public QMainWindow
     47class VBoxSelectorWnd: public QIWithRetranslateUI2<QMainWindow>
    4748{
    48     Q_OBJECT
     49    Q_OBJECT;
    4950
    5051public:
     
    8586    bool event (QEvent *e);
    8687
    87     virtual void changeEvent (QEvent *aEvent);
    8888    void retranslateUi();
    8989
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSnapshotDetailsDlg.h

    r8740 r9056  
    2424#define __VBoxSnapshotDetailsDlg_h__
    2525
    26 #include <VBoxSnapshotDetailsDlg.gen.h>
    27 #include <COMDefs.h>
     26#include "VBoxSnapshotDetailsDlg.gen.h"
     27#include "QIWithRetranslateUI.h"
     28#include "COMDefs.h"
    2829
    29 class VBoxSnapshotDetailsDlg : public QDialog, public Ui::VBoxSnapshotDetailsDlg
     30class VBoxSnapshotDetailsDlg : public QIWithRetranslateUI<QDialog>,
     31                               public Ui::VBoxSnapshotDetailsDlg
    3032{
    3133    Q_OBJECT;
     
    3739    void getFromSnapshot (const CSnapshot &aSnapshot);
    3840    void putBackToSnapshot();
     41
     42protected:
     43
     44    void retranslateUi();
    3945
    4046private slots:
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSnapshotsWgt.h

    r8946 r9056  
    2424#define __VBoxSnapshotsWgt_h__
    2525
    26 #include <VBoxSnapshotsWgt.gen.h>
    27 #include <VBoxGlobal.h>
     26#include "VBoxSnapshotsWgt.gen.h"
     27#include "VBoxGlobal.h"
     28#include "QIWithRetranslateUI.h"
     29
     30/* Qt includes */
    2831#include <QUuid>
    29 #include <COMDefs.h>
    3032
    3133class SnapshotWgtItem;
     
    3335class QMenu;
    3436
    35 class VBoxSnapshotsWgt : public QWidget, public Ui::VBoxSnapshotsWgt
     37class VBoxSnapshotsWgt : public QIWithRetranslateUI<QWidget>,
     38                         public Ui::VBoxSnapshotsWgt
    3639{
    3740    Q_OBJECT;
     
    4346    void setMachine (const CMachine &aMachine);
    4447
     48protected:
    4549
    46     virtual void changeEvent (QEvent *aEvent);
    4750    void retranslateUi();
    4851
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMInformationDlg.h

    r8946 r9056  
    2424#define __VBoxVMInformationDlg_h__
    2525
    26 #include <VBoxVMInformationDlg.gen.h>
    27 #include <QIAbstractDialog.h>
    28 #include <COMDefs.h>
     26#include "VBoxVMInformationDlg.gen.h"
     27#include "QIAbstractDialog.h"
     28#include "COMDefs.h"
     29#include "QIWithRetranslateUI.h"
    2930
    3031class VBoxConsoleView;
    3132class QTimer;
    3233
    33 class VBoxVMInformationDlg : public QIAbstractDialog, public Ui::VBoxVMInformationDlg
     34class VBoxVMInformationDlg : public QIWithRetranslateUI2<QIAbstractDialog>,
     35                             public Ui::VBoxVMInformationDlg
    3436{
    35     Q_OBJECT
     37    Q_OBJECT;
    3638
    3739public:
     
    5153protected:
    5254
    53     virtual void changeEvent (QEvent *aEvent);
    5455    void retranslateUi();
    5556
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIDialogButtonBox.cpp

    r8946 r9056  
    2828
    2929QIDialogButtonBox::QIDialogButtonBox (StandardButtons aButtons, Qt::Orientation aOrientation, QWidget *aParent)
    30    : QDialogButtonBox (aButtons, aOrientation, aParent)
     30   : QIWithRetranslateUI<QDialogButtonBox> (aParent)
    3131{
     32    setOrientation (aOrientation);
     33    setStandardButtons (aButtons);
     34
    3235    retranslateUi();
    3336}
     
    5356}
    5457
    55 void QIDialogButtonBox::changeEvent (QEvent *aEvent)
    56 {
    57     QDialogButtonBox::changeEvent (aEvent);
    58     switch (aEvent->type())
    59     {
    60         case QEvent::LanguageChange:
    61         {
    62             retranslateUi();
    63             aEvent->accept();
    64             break;
    65         }
    66         default:
    67             break;
    68     }
    69 }
    70 
    7158void QIDialogButtonBox::retranslateUi()
    7259{
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxCloseVMDlg.cpp

    r8741 r9056  
    2828
    2929VBoxCloseVMDlg::VBoxCloseVMDlg (QWidget *aParent)
    30     : QIDialog (aParent, Qt::Sheet)
     30    : QIWithRetranslateUI2<QIDialog> (aParent, Qt::Sheet)
    3131{
    3232    /* Apply UI decorations */
    33     setupUi (this);
     33    Ui::VBoxCloseVMDlg::setupUi (this);
    3434
    3535    /* Set fixed size */
     
    4040}
    4141
     42void VBoxCloseVMDlg::retranslateUi()
     43{
     44    /* Translate uic generated strings */
     45    Ui::VBoxCloseVMDlg::retranslateUi (this);
     46}
     47
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r9053 r9056  
    112112VBoxConsoleWnd (VBoxConsoleWnd **aSelf, QWidget* aParent,
    113113                Qt::WFlags aFlags)
    114     : QMainWindow (aParent, aFlags)
     114    : QIWithRetranslateUI2<QMainWindow> (aParent, aFlags)
    115115    , mMainMenu (0)
    116116#ifdef VBOX_WITH_DEBUGGER_GUI
     
    14581458#endif
    14591459
    1460 void VBoxConsoleWnd::changeEvent (QEvent *aEvent)
    1461 {
    1462     QMainWindow::changeEvent (aEvent);
    1463     switch (aEvent->type())
    1464     {
    1465         case QEvent::LanguageChange:
    1466         {
    1467             retranslateUi();
    1468             aEvent->accept();
    1469             break;
    1470         }
    1471         default:
    1472             break;
    1473     }
    1474 }
    1475 
    14761460/**
    14771461 *  Sets the strings of the subwidgets using the current
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDownloaderWgt.cpp

    r8946 r9056  
    127127VBoxDownloaderWgt::VBoxDownloaderWgt (QStatusBar *aStatusBar, QAction *aAction,
    128128                                      const QString &aUrl, const QString &aTarget)
    129     : QWidget ()
     129    : QIWithRetranslateUI<QWidget> ()
    130130    , mUrl (aUrl), mTarget (aTarget)
    131131    , mStatusBar (aStatusBar), mAction (aAction)
     
    172172    /* Try to get the required file for the information */
    173173    getFile();
    174 }
    175 
    176 void VBoxDownloaderWgt::changeEvent (QEvent *aEvent)
    177 {
    178     QWidget::changeEvent (aEvent);
    179     switch (aEvent->type())
    180     {
    181         case QEvent::LanguageChange:
    182         {
    183             retranslateUi();
    184             aEvent->accept();
    185             break;
    186         }
    187         default:
    188             break;
    189     }
    190174}
    191175
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r8946 r9056  
    280280                        QApplication::postEvent (&mGlobal, new VBoxCanShowRegDlgEvent (false));
    281281                }
     282                if (sKey == "GUI/LanguageID")
     283                    QApplication::postEvent (&mGlobal, new VBoxChangeGUILanguageEvent (sVal));
    282284
    283285                mMutex.lock();
     
    40114013            return true;
    40124014        }
     4015        case VBoxDefs::ChangeGUILanguageEventType:
     4016        {
     4017            loadLanguage (static_cast<VBoxChangeGUILanguageEvent*> (e)->mLangId);
     4018            return true;
     4019        }
    40134020
    40144021        default:
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r8946 r9056  
    5454 *  and another one for inaccessibility errors.
    5555 */
    56 class VBoxVMDetailsView : public QStackedWidget
     56class VBoxVMDetailsView : public QIWithRetranslateUI<QStackedWidget>
    5757{
    5858    Q_OBJECT;
     
    8888protected:
    8989
    90     virtual void changeEvent (QEvent *aEvent);
    9190    void retranslateUi();
    9291
     
    119118VBoxVMDetailsView::VBoxVMDetailsView (QWidget *aParent,
    120119                                      QAction *aRefreshAction /* = NULL */)
    121     : QStackedWidget (aParent)
     120    : QIWithRetranslateUI<QStackedWidget> (aParent)
    122121    , mErrBox (NULL), mErrLabel (NULL), mErrText (NULL)
    123122    , mRefreshButton (NULL)
     
    184183
    185184    retranslateUi();
    186 }
    187 
    188 void VBoxVMDetailsView::changeEvent (QEvent *aEvent)
    189 {
    190     QStackedWidget::changeEvent (aEvent);
    191     switch (aEvent->type())
    192     {
    193         case QEvent::LanguageChange:
    194         {
    195             retranslateUi();
    196             aEvent->accept();
    197             break;
    198         }
    199         default:
    200             break;
    201     }
    202185}
    203186
     
    229212 *  Comments page widget to represent VM comments.
    230213 */
    231 class VBoxVMDescriptionPage : public QWidget
     214class VBoxVMDescriptionPage : public QIWithRetranslateUI<QWidget>
    232215{
    233216    Q_OBJECT;
     
    244227protected:
    245228
    246     virtual void changeEvent (QEvent *aEvent);
    247229    void retranslateUi();
    248230
     
    262244
    263245VBoxVMDescriptionPage::VBoxVMDescriptionPage (VBoxSelectorWnd *aParent)
    264     : QWidget (aParent)
     246    : QIWithRetranslateUI<QWidget> (aParent)
    265247    , mItem (NULL), mParent (aParent)
    266248    , mBtnEdit (0), mBrowser (0), mLabel (0)
     
    342324    /* check initial machine and session states */
    343325    updateState();
    344 }
    345 
    346 void VBoxVMDescriptionPage::changeEvent (QEvent *aEvent)
    347 {
    348     QWidget::changeEvent (aEvent);
    349     switch (aEvent->type())
    350     {
    351         case QEvent::LanguageChange:
    352         {
    353             retranslateUi();
    354             aEvent->accept();
    355             break;
    356         }
    357         default:
    358             break;
    359     }
    360326}
    361327
     
    421387VBoxSelectorWnd (VBoxSelectorWnd **aSelf, QWidget* aParent,
    422388                 Qt::WFlags aFlags)
    423     : QMainWindow (aParent, aFlags)
     389    : QIWithRetranslateUI2<QMainWindow> (aParent, aFlags)
    424390    , doneInaccessibleWarningOnce (false)
    425391{
     
    11631129}
    11641130
    1165 void VBoxSelectorWnd::changeEvent (QEvent *aEvent)
    1166 {
    1167     QMainWindow::changeEvent (aEvent);
    1168     switch (aEvent->type())
    1169     {
    1170         case QEvent::LanguageChange:
    1171         {
    1172             retranslateUi();
    1173             aEvent->accept();
    1174             break;
    1175         }
    1176         default:
    1177             break;
    1178     }
    1179 }
    1180 
    11811131/**
    11821132 *  Sets the strings of the subwidgets using the current
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSnapshotDetailsDlg.cpp

    r8740 r9056  
    3030
    3131VBoxSnapshotDetailsDlg::VBoxSnapshotDetailsDlg (QWidget *aParent)
    32     : QDialog (aParent)
     32    : QIWithRetranslateUI<QDialog> (aParent)
    3333{
    3434    /* Apply UI decorations */
    35     setupUi (this);
     35    Ui::VBoxSnapshotDetailsDlg::setupUi (this);
    3636
    3737    /* Setup mTeSummary browser. */
     
    5757    mTeDescription->setText (aSnapshot.GetDescription());
    5858
    59     /* Compose summary */
    60     mTeSummary->setText (
    61         vboxGlobal().detailsReport (machine, false /* isNewVM */,
    62                                              false /* withLinks */));
    63     setWindowTitle (tr ("Details of %1 (%2)")
    64                     .arg (mSnapshot.GetName()).arg (machine.GetName()));
     59    retranslateUi();
    6560}
    6661
     
    7368}
    7469
     70void VBoxSnapshotDetailsDlg::retranslateUi()
     71{
     72    /* Translate uic generated strings */
     73    Ui::VBoxSnapshotDetailsDlg::retranslateUi (this);
     74
     75    if(mSnapshot.isNull())
     76        return;
     77
     78    CMachine machine = mSnapshot.GetMachine();
     79
     80    setWindowTitle (tr ("Details of %1 (%2)")
     81                    .arg (mSnapshot.GetName()).arg (machine.GetName()));
     82
     83    /* Compose summary */
     84    mTeSummary->setText (
     85        vboxGlobal().detailsReport (machine, false /* isNewVM */,
     86                                             false /* withLinks */));
     87}
     88
    7589void VBoxSnapshotDetailsDlg::onNameChanged (const QString &aText)
    7690{
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSnapshotsWgt.cpp

    r8946 r9056  
    244244
    245245VBoxSnapshotsWgt::VBoxSnapshotsWgt (QWidget *aParent)
    246     : QWidget (aParent)
     246    : QIWithRetranslateUI<QWidget> (aParent)
    247247    , mCurSnapshotItem (0)
    248248    , mContextMenu (new QMenu (this))
     
    665665}
    666666
    667 void VBoxSnapshotsWgt::changeEvent (QEvent *aEvent)
    668 {
    669     QWidget::changeEvent (aEvent);
    670     switch (aEvent->type())
    671     {
    672         case QEvent::LanguageChange:
    673         {
    674             retranslateUi();
    675             aEvent->accept();
    676             break;
    677         }
    678         default:
    679             break;
    680     }
    681 }
    682 
    683667void VBoxSnapshotsWgt::retranslateUi()
    684668{
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMInformationDlg.cpp

    r8946 r9056  
    5252                                            const CSession &aSession,
    5353                                            Qt::WindowFlags aFlags)
    54     : QIAbstractDialog (aConsole, aFlags)
     54    : QIWithRetranslateUI2<QIAbstractDialog> (aConsole, aFlags)
    5555    , mIsPolished (false)
    5656    , mConsole (aConsole)
     
    128128}
    129129
    130 void VBoxVMInformationDlg::changeEvent (QEvent *aEvent)
    131 {
    132     QIAbstractDialog::changeEvent (aEvent);
    133     switch (aEvent->type())
    134     {
    135         case QEvent::LanguageChange:
    136         {
    137             retranslateUi();
    138             aEvent->accept();
    139             break;
    140         }
    141         default:
    142             break;
    143     }
    144 }
    145 
    146130void VBoxVMInformationDlg::retranslateUi()
    147131{
    148132    /* Translate uic generated strings */
    149133    Ui::VBoxVMInformationDlg::retranslateUi (this);
     134
     135    updateDetails();
    150136   
    151137    AssertReturnVoid (!mSession.isNull());
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