VirtualBox

Changeset 82713 in vbox


Ignore:
Timestamp:
Jan 10, 2020 12:39:04 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9241: VirtualBox Manager: Proper retranslation procedure for Tools popup pane unjustly forgotten.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r82187 r82713  
    633633    virtual void updateShortcuts();
    634634
    635     /** Hadles translation event. */
     635    /** Handles translation event. */
    636636    virtual void retranslateUi() /* override */;
    637637
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp

    r76606 r82713  
    237237    updatePixmap();
    238238
     239    /* Update name finally: */
     240    reconfigure(strName);
     241}
     242
     243void UIToolsItem::reconfigure(const QString &strName)
     244{
    239245    /* If name is changed: */
    240246    if (m_strName != strName)
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.h

    r76581 r82713  
    9393        UIToolsModel *model() const;
    9494
    95         /** Reconfigures icon with new @a enmClass, @a enmType, @a icon and @a strName. */
     95        /** Reconfigures item with new @a enmClass, @a enmType, @a icon and @a strName. */
    9696        void reconfigure(UIToolClass enmClass, UIToolType enmType,
    9797                         const QIcon &icon, const QString &strName);
     98        /** Reconfigures item with @a strName. */
     99        void reconfigure(const QString &strName);
    98100
    99101        /** Returns item class. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp

    r80881 r82713  
    5555
    5656UIToolsModel:: UIToolsModel(UITools *pParent)
    57     : QObject(pParent)
     57    : QIWithRetranslateUI3<QObject>(pParent)
    5858    , m_pTools(pParent)
    5959    , m_pScene(0)
     
    392392    /* Process only scene events: */
    393393    if (pWatched != scene())
    394         return QObject::eventFilter(pWatched, pEvent);
     394        return QIWithRetranslateUI3<QObject>::eventFilter(pWatched, pEvent);
    395395
    396396    /* Process only item focused by model: */
    397397    if (scene()->focusItem())
    398         return QObject::eventFilter(pWatched, pEvent);
     398        return QIWithRetranslateUI3<QObject>::eventFilter(pWatched, pEvent);
    399399
    400400    /* Do not handle disabled items: */
    401401    if (!currentItem()->isEnabled())
    402         return QObject::eventFilter(pWatched, pEvent);
     402        return QIWithRetranslateUI3<QObject>::eventFilter(pWatched, pEvent);
    403403
    404404    /* Checking event-type: */
     
    420420
    421421    /* Call to base-class: */
    422     return QObject::eventFilter(pWatched, pEvent);
     422    return QIWithRetranslateUI3<QObject>::eventFilter(pWatched, pEvent);
     423}
     424
     425void UIToolsModel::retranslateUi()
     426{
     427    foreach (UIToolsItem *pItem, m_items)
     428    {
     429        switch (pItem->itemType())
     430        {
     431            case UIToolType_Welcome:   pItem->reconfigure(tr("Welcome")); break;
     432            case UIToolType_Media:     pItem->reconfigure(tr("Media")); break;
     433            case UIToolType_Network:   pItem->reconfigure(tr("Network")); break;
     434            case UIToolType_Cloud:     pItem->reconfigure(tr("Cloud")); break;
     435            case UIToolType_Details:   pItem->reconfigure(tr("Details")); break;
     436            case UIToolType_Snapshots: pItem->reconfigure(tr("Snapshots")); break;
     437            case UIToolType_Logs:      pItem->reconfigure(tr("Logs")); break;
     438            default: break;
     439        }
     440    }
    423441}
    424442
     
    438456    /* Prepare connections: */
    439457    prepareConnections();
     458    /* Apply language settings: */
     459    retranslateUi();
    440460}
    441461
     
    458478
    459479    /* Welcome: */
    460     m_items << new UIToolsItem(scene(), UIToolClass_Global, UIToolType_Welcome, tr("Welcome"),
    461                                UIIconPool::iconSet(":/welcome_screen_24px.png", ":/welcome_screen_24px.png")); /// @todo fix icon!
     480    m_items << new UIToolsItem(scene(), UIToolClass_Global, UIToolType_Welcome, QString(),
     481                               UIIconPool::iconSet(":/welcome_screen_24px.png", ":/welcome_screen_24px.png"));
    462482
    463483    /* Media: */
    464     m_items << new UIToolsItem(scene(), UIToolClass_Global, UIToolType_Media, tr("Media"),
     484    m_items << new UIToolsItem(scene(), UIToolClass_Global, UIToolType_Media, QString(),
    465485                               UIIconPool::iconSet(":/media_manager_24px.png", ":/media_manager_disabled_24px.png"));
    466486
    467487    /* Network: */
    468     m_items << new UIToolsItem(scene(), UIToolClass_Global, UIToolType_Network, tr("Network"),
     488    m_items << new UIToolsItem(scene(), UIToolClass_Global, UIToolType_Network, QString(),
    469489                               UIIconPool::iconSet(":/host_iface_manager_24px.png", ":/host_iface_manager_disabled_24px.png"));
    470490
    471491    /* Cloud: */
    472492    if (fExtPackAccessible)
    473         m_items << new UIToolsItem(scene(), UIToolClass_Global, UIToolType_Cloud, tr("Cloud"),
     493        m_items << new UIToolsItem(scene(), UIToolClass_Global, UIToolType_Cloud, QString(),
    474494                                   UIIconPool::iconSet(":/cloud_profile_manager_24px.png", ":/cloud_profile_manager_disabled_24px.png"));
    475495
    476496    /* Details: */
    477     m_items << new UIToolsItem(scene(), UIToolClass_Machine, UIToolType_Details, tr("Details"),
     497    m_items << new UIToolsItem(scene(), UIToolClass_Machine, UIToolType_Details, QString(),
    478498                               UIIconPool::iconSet(":/machine_details_manager_24px.png", ":/machine_details_manager_disabled_24px.png"));
    479499
    480500    /* Snapshots: */
    481     m_items << new UIToolsItem(scene(), UIToolClass_Machine, UIToolType_Snapshots, tr("Snapshots"),
    482                                UIIconPool::iconSet(":/snapshot_manager_24px.png",        ":/snapshot_manager_disabled_24px.png"));
     501    m_items << new UIToolsItem(scene(), UIToolClass_Machine, UIToolType_Snapshots, QString(),
     502                               UIIconPool::iconSet(":/snapshot_manager_24px.png", ":/snapshot_manager_disabled_24px.png"));
    483503
    484504    /* Logs: */
    485     m_items << new UIToolsItem(scene(), UIToolClass_Machine, UIToolType_Logs, tr("Logs"),
     505    m_items << new UIToolsItem(scene(), UIToolClass_Machine, UIToolType_Logs, QString(),
    486506                               UIIconPool::iconSet(":/vm_show_logs_24px.png", ":/vm_show_logs_disabled_24px.png"));
    487507}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h

    r80802 r82713  
    2929
    3030/* GUI includes: */
     31#include "QIWithRetranslateUI.h"
    3132#include "UIToolsItem.h"
    3233
     
    4748
    4849/** QObject extension used as VM Tools-pane model: */
    49 class UIToolsModel : public QObject
     50class UIToolsModel : public QIWithRetranslateUI3<QObject>
    5051{
    5152    Q_OBJECT;
     
    187188        /** Preprocesses Qt @a pEvent for passed @a pObject. */
    188189        virtual bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
     190
     191        /** Handles translation event. */
     192        virtual void retranslateUi() /* override */;
    189193    /** @} */
    190194
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