VirtualBox

Ignore:
Timestamp:
May 20, 2008 9:51:01 AM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: Replaced languageChange by the appropriate QEvent & retranslateUi.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
16 edited

Legend:

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

    r8740 r8946  
    3939    void setStandardButtons (StandardButtons aButtons);
    4040
    41 private:
    42     void initHelpButton();
     41protected:
     42    virtual void changeEvent (QEvent *aEvent);
     43    void retranslateUi();
    4344};
    4445
  • trunk/src/VBox/Frontends/VirtualBox4/include/QIHotKeyEdit.h

    r8170 r8946  
    6868
    6969#if defined (Q_WS_PM) || defined (Q_WS_X11)
    70     static void languageChange_qt3();
     70    static void retranslateUi();
    7171#endif
    7272    static QString keyName (int aKeyVal);
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h

    r8600 r8946  
    9696    bool x11Event (XEvent *event);
    9797#endif
     98
     99    virtual void changeEvent (QEvent *aEvent);
     100    void retranslateUi();
     101
    98102#ifdef VBOX_WITH_DEBUGGER_GUI
    99103    bool dbgCreated();
     
    121125    };
    122126
    123     void languageChange();
    124 
    125127    void updateAppearanceOf (int element);
    126128
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDownloaderWgt.h

    r8155 r8946  
    5555                       const QString &aUrl, const QString &aTarget);
    5656
    57     void languageChange();
    5857
    5958    bool isCheckingPresence() { return mIsChecking; }
     59
     60protected:
     61    virtual void changeEvent (QEvent *aEvent);
     62    void retranslateUi();
    6063
    6164private slots:
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r8915 r8946  
    488488    QString languageTranslators() const;
    489489
    490     void languageChange();
     490    void retranslateUi();
    491491
    492492    /** @internal made public for internal purposes */
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h

    r8159 r8946  
    8585    bool event (QEvent *e);
    8686
    87 protected slots:
    88 
    89 private:
    90 
    91     void languageChange();
     87    virtual void changeEvent (QEvent *aEvent);
     88    void retranslateUi();
    9289
    9390private slots:
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSnapshotsWgt.h

    r8742 r8946  
    4343    void setMachine (const CMachine &aMachine);
    4444
     45
     46    virtual void changeEvent (QEvent *aEvent);
     47    void retranslateUi();
     48
    4549private slots:
    4650
     
    6266
    6367private:
    64 
    65     bool event (QEvent *aEvent);
    66     void languageChange();
    6768
    6869    void refreshAll (bool aKeepSelected = true);
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMInformationDlg.h

    r8790 r8946  
    4747    VBoxVMInformationDlg (VBoxConsoleView *aConsole, const CSession &aSession,
    4848                          Qt::WindowFlags aFlags);
    49    ~VBoxVMInformationDlg();
     49    ~VBoxVMInformationDlg();
    5050
    5151protected:
    5252
    53     virtual void languageChange();
     53    virtual void changeEvent (QEvent *aEvent);
     54    void retranslateUi();
    5455
    5556    virtual bool event (QEvent *aEvent);
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIDialogButtonBox.cpp

    r8740 r8946  
    2525/* Qt includes */
    2626#include <QPushButton>
     27#include <QEvent>
    2728
    2829QIDialogButtonBox::QIDialogButtonBox (StandardButtons aButtons, Qt::Orientation aOrientation, QWidget *aParent)
    2930   : QDialogButtonBox (aButtons, aOrientation, aParent)
    3031{
    31     initHelpButton ();
     32    retranslateUi();
    3233}
    3334
     
    3536{
    3637    QPushButton *btn = QDialogButtonBox::addButton (aText, aRole);
    37     initHelpButton();
     38    retranslateUi();
    3839    return btn;
    3940}
     
    4243{
    4344    QPushButton *btn = QDialogButtonBox::addButton (aButton);
    44     initHelpButton();
     45    retranslateUi();
    4546    return btn;
    4647}
     
    4950{
    5051    QDialogButtonBox::setStandardButtons (aButtons);
    51     initHelpButton();
     52    retranslateUi();
    5253}
    5354
    54 void QIDialogButtonBox::initHelpButton()
     55void 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
     71void QIDialogButtonBox::retranslateUi()
    5572{
    5673    QPushButton *btn = button (QDialogButtonBox::Help);
    5774    if (btn)
    5875    {
    59         if (btn->text() == tr ("Help"))
    60             btn->setText (tr ("&Help"));
     76        btn->setText (tr ("&Help"));
    6177        if (btn->shortcut().isEmpty())
    6278            btn->setShortcut (QKeySequence (tr ("F1")));
    6379    }
    6480}
    65 
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIHotKeyEdit.cpp

    r8170 r8946  
    214214//                                      QSize (w + m, h + m)
    215215//                                      .expandedTo(QApplication::globalStrut())));
    216     QSize(10,10);
     216    return QSize(10,10);
    217217}
    218218
     
    286286 *  keys to human readable key names.
    287287 */
    288 /* static */
    289 void QIHotKeyEdit::languageChange_qt3()
    290 {
    291     /* Note: strings for the same key must match strings in languageChange()
     288void QIHotKeyEdit::retranslateUi()
     289{
     290    /* Note: strings for the same key must match strings in retranslateUi()
    292291     * versions for all platforms, to keep translators happy. */
    293292
     
    341340 *  readable key names.
    342341 */
    343 /* static */
    344 void QIHotKeyEdit::languageChange_qt3()
    345 {
    346     /* Note: strings for the same key must match strings in languageChange()
     342void QIHotKeyEdit::retranslateUi()
     343{
     344    /* Note: strings for the same key must match strings in retranslateUi()
    347345     * versions for all platforms, to keep translators happy. */
    348346
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r8918 r8946  
    481481    /////////////////////////////////////////////////////////////////////////
    482482
    483     languageChange();
     483    retranslateUi();
    484484
    485485    setWindowTitle (caption_prefix);
     
    14581458#endif
    14591459
    1460 //
    1461 // Private members
    1462 /////////////////////////////////////////////////////////////////////////////
     1460void 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}
    14631475
    14641476/**
     
    14661478 *  language.
    14671479 */
    1468 void VBoxConsoleWnd::languageChange()
     1480void VBoxConsoleWnd::retranslateUi()
    14691481{
    14701482#ifdef VBOX_OSE
     
    16461658}
    16471659
     1660//
     1661// Private members
     1662/////////////////////////////////////////////////////////////////////////////
    16481663
    16491664void VBoxConsoleWnd::updateAppearanceOf (int element)
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDownloaderWgt.cpp

    r8865 r8946  
    167167    mConn->setcallbacks (OnBegin, OnData, OnComplete, this);
    168168
    169     languageChange();
     169    retranslateUi();
    170170    mStatusBar->addWidget (this, 1);
    171171
     
    174174}
    175175
    176 void VBoxDownloaderWgt::languageChange()
     176void 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    }
     190}
     191
     192void VBoxDownloaderWgt::retranslateUi()
    177193{
    178194    mCancelButton->setText (tr ("Cancel"));
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r8920 r8946  
    24212421 *  currently installed translations tables.
    24222422 */
    2423 void VBoxGlobal::languageChange()
     2423void VBoxGlobal::retranslateUi()
    24242424{
    24252425    machineStates [KMachineState_PoweredOff] =  tr ("Powered Off", "MachineState");
     
    25782578     * updated when the language is changed. */
    25792579#warning port me
    2580     QIHotKeyEdit::languageChange_qt3();
     2580    QIHotKeyEdit::retranslateUi();
    25812581#endif
    25822582}
     
    40334033            /* call this only once per every language change (see
    40344034             * QApplication::installTranslator() for details) */
    4035             languageChange();
     4035            retranslateUi();
    40364036        }
    40374037    }
     
    41884188        loadLanguage (languageId);
    41894189
    4190     languageChange();
     4190    retranslateUi();
    41914191
    41924192    /* process command line */
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r8907 r8946  
    5656class VBoxVMDetailsView : public QStackedWidget
    5757{
    58     Q_OBJECT
     58    Q_OBJECT;
    5959
    6060public:
     
    6262    VBoxVMDetailsView (QWidget *aParent,
    6363                       QAction *aRefreshAction = NULL);
    64 
    65     void languageChange();
    6664
    6765    void setDetailsText (const QString &aText)
     
    8785
    8886    void linkClicked (const QString &aURL);
     87
     88protected:
     89
     90    virtual void changeEvent (QEvent *aEvent);
     91    void retranslateUi();
    8992
    9093private slots:
     
    180183    addWidget (mErrBox);
    181184
    182     languageChange();
    183 }
    184 
    185 void VBoxVMDetailsView::languageChange()
     185    retranslateUi();
     186}
     187
     188void 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    }
     202}
     203
     204void VBoxVMDetailsView::retranslateUi()
    186205{
    187206    if (mErrLabel)
     
    212231class VBoxVMDescriptionPage : public QWidget
    213232{
    214     Q_OBJECT
     233    Q_OBJECT;
    215234
    216235public:
     
    221240    void setMachineItem (VBoxVMItem *aItem);
    222241
    223     void languageChange();
    224242    void updateState();
     243
     244protected:
     245
     246    virtual void changeEvent (QEvent *aEvent);
     247    void retranslateUi();
    225248
    226249private slots:
     
    289312
    290313    /* apply language settings */
    291     languageChange();
     314    retranslateUi();
    292315
    293316    updateState();
     
    321344}
    322345
    323 void VBoxVMDescriptionPage::languageChange()
     346void 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    }
     360}
     361
     362void VBoxVMDescriptionPage::retranslateUi()
    324363{
    325364    mLabel->setText (tr ("No description. Press the Edit button below to add it."));
     
    587626    mHelpMenu->addAction (helpResetMessagesAction);
    588627
    589     languageChange();
     628    retranslateUi();
    590629
    591630    /* restore the position of the window */
     
    11161155            break;
    11171156        }
    1118         case QEvent::LanguageChange:
    1119         {
    1120             languageChange();
    1121             break;
    1122         }
    11231157
    11241158        default:
     
    11291163}
    11301164
    1131 // Private members
    1132 /////////////////////////////////////////////////////////////////////////////
     1165void 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}
    11331180
    11341181/**
     
    11361183 *  language.
    11371184 */
    1138 void VBoxSelectorWnd::languageChange()
     1185void VBoxSelectorWnd::retranslateUi()
    11391186{
    11401187#ifdef VBOX_OSE
     
    12311278    mVMMenu->setTitle (tr ("&Machine"));
    12321279    mHelpMenu->setTitle (tr ("&Help"));
    1233 
    1234     vmDetailsView->languageChange();
    1235     vmDescriptionPage->languageChange();
    1236 }
     1280}
     1281
     1282
     1283// Private members
     1284/////////////////////////////////////////////////////////////////////////////
    12371285
    12381286//
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSnapshotsWgt.cpp

    r8742 r8946  
    258258{
    259259    /* Apply UI decorations */
    260     setupUi (this);
     260    Ui::VBoxSnapshotsWgt::setupUi (this);
    261261
    262262    mTreeWidget->header()->hide();
     
    332332             this, SLOT (snapshotChanged (const VBoxSnapshotEvent&)));
    333333
    334     languageChange();
     334    retranslateUi();
    335335}
    336336
     
    665665}
    666666
    667 
    668 bool VBoxSnapshotsWgt::event (QEvent *aEvent)
    669 {
     667void VBoxSnapshotsWgt::changeEvent (QEvent *aEvent)
     668{
     669    QWidget::changeEvent (aEvent);
    670670    switch (aEvent->type())
    671671    {
    672672        case QEvent::LanguageChange:
    673673        {
    674             languageChange();
     674            retranslateUi();
     675            aEvent->accept();
    675676            break;
    676677        }
    677 
    678         default:
     678        default:
    679679            break;
    680680    }
    681 
    682     return QWidget::event (aEvent);
    683 }
    684 
    685 void VBoxSnapshotsWgt::languageChange()
    686 {
     681}
     682
     683void VBoxSnapshotsWgt::retranslateUi()
     684{
     685    /* Translate uic generated strings */
     686    Ui::VBoxSnapshotsWgt::retranslateUi (this);
     687
    687688    mDiscardSnapshotAction->setText ("&Discard Snapshot");
    688689    mTakeSnapshotAction->setText ("Take &Snapshot");
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMInformationDlg.cpp

    r8918 r8946  
    5959{
    6060    /* Apply UI decorations */
    61     setupUi (this);
     61    Ui::VBoxVMInformationDlg::setupUi (this);
    6262
    6363    /* Initialize parent defaults */
     
    8888
    8989    /* Loading language constants */
    90     languageChange();
     90    retranslateUi();
    9191
    9292    /* Details page update */
     
    128128}
    129129
    130 
    131 void VBoxVMInformationDlg::languageChange()
    132 {
     130void 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
     146void VBoxVMInformationDlg::retranslateUi()
     147{
     148    /* Translate uic generated strings */
     149    Ui::VBoxVMInformationDlg::retranslateUi (this);
     150   
    133151    AssertReturnVoid (!mSession.isNull());
    134152        CMachine machine = mSession.GetMachine();
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