VirtualBox

Changeset 68235 in vbox for trunk/src


Ignore:
Timestamp:
Aug 2, 2017 10:23:07 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8900: Extending UIDesktopPane with tool-pane which describes existing (actually integrated) tools; Separate descriptions for Machine and Global tool-panes.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
9 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc

    r68200 r68235  
    186186        <file alias="statusbar_settings_16px.png">images/statusbar_settings_16px.png</file>
    187187        <file alias="statusbar_settings_disabled_16px.png">images/statusbar_settings_disabled_16px.png</file>
     188        <file alias="tools_200px.png">images/tools_200px.png</file>
    188189        <file alias="tools_global_32px.png">images/tools_global_32px.png</file>
    189190        <file alias="tools_machine_32px.png">images/tools_machine_32px.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc

    r68200 r68235  
    195195        <file alias="statusbar_settings_16px_hidpi.png">images/hidpi/statusbar_settings_16px_hidpi.png</file>
    196196        <file alias="statusbar_settings_disabled_16px_hidpi.png">images/hidpi/statusbar_settings_disabled_16px_hidpi.png</file>
     197        <file alias="tools_200px_hidpi.png">images/hidpi/tools_200px_hidpi.png</file>
    197198        <file alias="tools_global_32px_hidpi.png">images/hidpi/tools_global_32px_hidpi.png</file>
    198199        <file alias="tools_machine_32px_hidpi.png">images/hidpi/tools_machine_32px_hidpi.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIDesktopPane.cpp

    r68195 r68235  
    55
    66/*
    7  * Copyright (C) 2010-2016 Oracle Corporation
     7 * Copyright (C) 2010-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2222/* Qt includes: */
    2323# include <QAction>
     24# include <QGridLayout>
     25# include <QHBoxLayout>
    2426# include <QLabel>
     27# include <QPainter>
    2528# include <QStackedWidget>
     29# include <QStyle>
    2630# include <QToolButton>
     31# include <QUuid>
    2732# include <QVBoxLayout>
    2833
    2934/* GUI includes */
     35# include "QILabel.h"
    3036# include "QIWithRetranslateUI.h"
    3137# include "UIDesktopPane.h"
     38# include "UIIconPool.h"
    3239# include "VBoxUtils.h"
    3340
     
    3542# include <iprt/assert.h>
    3643
     44/* Forward declarations: */
     45class QEvent;
     46class QGridLayout;
     47class QHBoxLayout;
     48class QIcon;
     49class QLabel;
     50class QPaintEvent;
     51class QResizeEvent;
     52class QString;
     53class QUuid;
     54class QVBoxLayout;
     55class QWidget;
     56
    3757#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     58
     59
     60/** Our own skinnable implementation of tool widget header for UIDesktopPane. */
     61class UIToolWidgetHeader : public QLabel
     62{
     63    Q_OBJECT;
     64
     65public:
     66
     67    /** Constructs tool widget header passing @a pParent to the base-class. */
     68    UIToolWidgetHeader(QWidget *pParent = 0);
     69
     70protected:
     71
     72    /** Handles resuze @a pEvent. */
     73    virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
     74
     75    /** Handles paint @a pEvent. */
     76    virtual void paintEvent(QPaintEvent *pEvent) /* override */;
     77};
     78
     79
     80/** Our own skinnable implementation of tool widget for UIDesktopPane. */
     81class UIToolWidget : public QWidget
     82{
     83    Q_OBJECT;
     84
     85public:
     86
     87    /** Constructs tool widget on the basis of passed @a pAction and @a strDescription. */
     88    UIToolWidget(QAction *pAction, const QString &strDescription);
     89
     90protected:
     91
     92    /** Handles any Qt @a pEvent. */
     93    virtual bool event(QEvent *pEvent) /* override */;
     94
     95    /** Handles paint @a pEvent. */
     96    virtual void paintEvent(QPaintEvent *pEvent) /* override */;
     97
     98private:
     99
     100    /** Prepares all. */
     101    void prepare();
     102
     103    /** Holds the action reference. */
     104    QAction *m_pAction;
     105    /** Holds the widget description. */
     106    QString  m_strDescription;
     107
     108    /** Holds whether the widget is hovered. */
     109    bool  m_fHovered;
     110
     111    /** Holds the main layout instance. */
     112    QGridLayout *m_pLayout;
     113    /** Holds the icon label instance. */
     114    QLabel      *m_pLabelIcon;
     115    /** Holds the name label instance. */
     116    QLabel      *m_pLabelName;
     117    /** Holds the description label instance. */
     118    QILabel     *m_pLabelDescription;
     119};
    38120
    39121
     
    57139    void setError(const QString &strError);
    58140
     141    /** Defines a tools pane welcome @a strText. */
     142    void setToolsPaneText(const QString &strText);
     143    /** Add a tool element.
     144      * @param  pAction         Brings tool action reference.
     145      * @param  strDescription  Brings the tool description. */
     146    void addToolDescription(QAction *pAction, const QString &strDescription);
     147    /** Removes all tool elements. */
     148    void removeToolDescriptions();
     149
    59150protected:
    60151
     
    66157    /** Prepares error pane. */
    67158    void prepareErrorPane();
     159
     160    /** Prepares tools pane. */
     161    void prepareToolsPane();
    68162
    69163private:
     
    82176    /** Holds the VM refresh action reference. */
    83177    QAction *m_pRefreshAction;
     178
     179    /** Holds the tools pane instance. */
     180    QWidget     *m_pToolsPane;
     181    /** Holds the tools pane widget layout instance. */
     182    QVBoxLayout *m_pLayoutWidget;
     183    /** Holds the tools pane text label instance. */
     184    QILabel     *m_pLabelToolsPaneText;
    84185};
     186
     187
     188/*********************************************************************************************************************************
     189*   Class UIToolWidgetHeader implementation.                                                                                     *
     190*********************************************************************************************************************************/
     191
     192UIToolWidgetHeader::UIToolWidgetHeader(QWidget *pParent /* = 0 */)
     193    : QLabel(pParent)
     194{
     195}
     196
     197void UIToolWidgetHeader::resizeEvent(QResizeEvent *pEvent)
     198{
     199    /* Call to base-class: */
     200    QLabel::resizeEvent(pEvent);
     201
     202#if 0
     203    /* Get basic palette: */
     204    QPalette pal = qApp->palette();
     205
     206    /* Prepare new foreground: */
     207    const QColor color0 = pal.color(QPalette::Active, QPalette::HighlightedText);
     208    const QColor color1 = pal.color(QPalette::Active, QPalette::WindowText);
     209    QLinearGradient grad(QPointF(0, 0), QPointF(width(), height()));
     210    {
     211        grad.setColorAt(0, color0);
     212        grad.setColorAt(1, color1);
     213    }
     214
     215    /* Apply palette changes: */
     216    pal.setBrush(QPalette::Active, QPalette::WindowText, grad);
     217    setPalette(pal);
     218#endif
     219}
     220
     221void UIToolWidgetHeader::paintEvent(QPaintEvent *pEvent)
     222{
     223    /* Prepare painter: */
     224    QPainter painter(this);
     225
     226    /* Prepare palette colors: */
     227    const QPalette pal = palette();
     228    const QColor color0 = pal.color(QPalette::Highlight).lighter(130);
     229    QColor color1 = color0;
     230    color1.setAlpha(0);
     231
     232    /* Prepare background: */
     233    QLinearGradient grad(QPointF(0, 0), QPointF(width(), height()));
     234    {
     235        grad.setColorAt(0,   color1);
     236        grad.setColorAt(0.2, color0);
     237        grad.setColorAt(1,   color1);
     238    }
     239
     240    /* Paint background: */
     241    painter.fillRect(QRect(0, 0, width(), height()), grad);
     242
     243    /* Call to base-class: */
     244    QLabel::paintEvent(pEvent);
     245}
     246
     247
     248/*********************************************************************************************************************************
     249*   Class UIToolWidget implementation.                                                                                           *
     250*********************************************************************************************************************************/
     251
     252UIToolWidget::UIToolWidget(QAction *pAction, const QString &strDescription)
     253    : m_pAction(pAction)
     254    , m_strDescription(strDescription)
     255    , m_fHovered(false)
     256    , m_pLayout(0)
     257    , m_pLabelIcon(0)
     258    , m_pLabelName(0)
     259    , m_pLabelDescription(0)
     260{
     261    /* Prepare: */
     262    prepare();
     263}
     264
     265bool UIToolWidget::event(QEvent *pEvent)
     266{
     267    /* Handle known event types: */
     268    switch (pEvent->type())
     269    {
     270        /* Update the hovered state on/off: */
     271        case QEvent::Enter:
     272        {
     273            m_fHovered = true;
     274            update();
     275            break;
     276        }
     277        case QEvent::Leave:
     278        {
     279            m_fHovered = false;
     280            update();
     281            break;
     282        }
     283
     284        /* Notify listeners about the item was clicked: */
     285        case QEvent::MouseButtonRelease:
     286        {
     287            m_pAction->trigger();
     288            break;
     289        }
     290
     291        default:
     292            break;
     293    }
     294    /* Call to base-class: */
     295    return QWidget::event(pEvent);
     296}
     297
     298void UIToolWidget::paintEvent(QPaintEvent * /* pEvent */)
     299{
     300    /* Prepare painter: */
     301    QPainter painter(this);
     302
     303    /* Prepare palette colors: */
     304    const QPalette pal = palette();
     305    const QColor color0 = m_fHovered
     306                        ? pal.color(QPalette::Highlight).lighter(160)
     307                        : pal.color(QPalette::Base);
     308    const QColor color1 = color0.lighter(120);
     309    QColor color2 = pal.color(QPalette::Window).lighter(110);
     310    color2.setAlpha(0);
     311    QColor color3 = pal.color(QPalette::Window).darker(200);
     312
     313    /* Invent pixel metric: */
     314    const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
     315
     316    /* Background gradient: */
     317    QLinearGradient grad(QPointF(0, height()), QPointF(0, 0));
     318    {
     319        grad.setColorAt(0, color0);
     320        grad.setColorAt(1, color1);
     321    }
     322
     323    /* Top-left corner: */
     324    QRadialGradient grad1(QPointF(iMetric, iMetric), iMetric);
     325    {
     326        grad1.setColorAt(0, color3);
     327        grad1.setColorAt(1, color2);
     328    }
     329    /* Top-right corner: */
     330    QRadialGradient grad2(QPointF(width() - iMetric, iMetric), iMetric);
     331    {
     332        grad2.setColorAt(0, color3);
     333        grad2.setColorAt(1, color2);
     334    }
     335    /* Bottom-left corner: */
     336    QRadialGradient grad3(QPointF(iMetric, height() - iMetric), iMetric);
     337    {
     338        grad3.setColorAt(0, color3);
     339        grad3.setColorAt(1, color2);
     340    }
     341    /* Botom-right corner: */
     342    QRadialGradient grad4(QPointF(width() - iMetric, height() - iMetric), iMetric);
     343    {
     344        grad4.setColorAt(0, color3);
     345        grad4.setColorAt(1, color2);
     346    }
     347
     348    /* Top line: */
     349    QLinearGradient grad5(QPointF(iMetric, 0), QPointF(iMetric, iMetric));
     350    {
     351        grad5.setColorAt(0, color2);
     352        grad5.setColorAt(1, color3);
     353    }
     354    /* Bottom line: */
     355    QLinearGradient grad6(QPointF(iMetric, height()), QPointF(iMetric, height() - iMetric));
     356    {
     357        grad6.setColorAt(0, color2);
     358        grad6.setColorAt(1, color3);
     359    }
     360    /* Left line: */
     361    QLinearGradient grad7(QPointF(0, height() - iMetric), QPointF(iMetric, height() - iMetric));
     362    {
     363        grad7.setColorAt(0, color2);
     364        grad7.setColorAt(1, color3);
     365    }
     366    /* Right line: */
     367    QLinearGradient grad8(QPointF(width(), height() - iMetric), QPointF(width() - iMetric, height() - iMetric));
     368    {
     369        grad8.setColorAt(0, color2);
     370        grad8.setColorAt(1, color3);
     371    }
     372
     373    /* Paint shape/shadow: */
     374    painter.fillRect(QRect(iMetric,           iMetric,            width() - iMetric * 2, height() - iMetric * 2), grad);
     375    painter.fillRect(QRect(0,                 0,                  iMetric,               iMetric),                grad1);
     376    painter.fillRect(QRect(width() - iMetric, 0,                  iMetric,               iMetric),                grad2);
     377    painter.fillRect(QRect(0,                 height() - iMetric, iMetric,               iMetric),                grad3);
     378    painter.fillRect(QRect(width() - iMetric, height() - iMetric, iMetric,               iMetric),                grad4);
     379    painter.fillRect(QRect(iMetric,           0,                  width() - iMetric * 2, iMetric),                grad5);
     380    painter.fillRect(QRect(iMetric,           height() - iMetric, width() - iMetric * 2, iMetric),                grad6);
     381    painter.fillRect(QRect(0,                 iMetric,            iMetric,               height() - iMetric * 2), grad7);
     382    painter.fillRect(QRect(width() - iMetric, iMetric,            iMetric,               height() - iMetric * 2), grad8);
     383}
     384
     385void UIToolWidget::prepare()
     386{
     387    /* Configure self: */
     388    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     389
     390    /* Create main layout: */
     391    m_pLayout = new QGridLayout(this);
     392    AssertPtrReturnVoid(m_pLayout);
     393    {
     394        /* Invent pixel metric: */
     395        const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) * 1.375;
     396        const int iMargin = iMetric / 2;
     397        const int iSpacing = iMargin / 2;
     398
     399        /* Configure layout: */
     400        m_pLayout->setContentsMargins(iMargin + iSpacing, iMargin, iMargin, iMargin);
     401        m_pLayout->setSpacing(iSpacing);
     402
     403        /* Create name label: */
     404        m_pLabelName = new UIToolWidgetHeader;
     405        AssertPtrReturnVoid(m_pLabelName);
     406        {
     407            /* Configure label: */
     408            QFont fontLabel = m_pLabelName->font();
     409            fontLabel.setBold(true);
     410            m_pLabelName->setFont(fontLabel);
     411            m_pLabelName->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     412            m_pLabelName->setText(QString("%1     ").arg(m_pAction->text().remove('&')));
     413
     414            /* Add into layout: */
     415            m_pLayout->addWidget(m_pLabelName, 0, 0);
     416        }
     417
     418        /* Create description label: */
     419        m_pLabelDescription = new QILabel;
     420        AssertPtrReturnVoid(m_pLabelDescription);
     421        {
     422            /* Configure label: */
     423            m_pLabelDescription->setAttribute(Qt::WA_TransparentForMouseEvents);
     424            m_pLabelDescription->setWordWrap(true);
     425            m_pLabelDescription->useSizeHintForWidth(400);
     426            m_pLabelDescription->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
     427            m_pLabelDescription->setText(m_strDescription);
     428
     429            /* Add into layout: */
     430            m_pLayout->addWidget(m_pLabelDescription, 1, 0);
     431        }
     432
     433        /* Create icon label: */
     434        m_pLabelIcon = new QLabel;
     435        AssertPtrReturnVoid(m_pLabelIcon);
     436        {
     437            /* Configure label: */
     438            m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     439            m_pLabelIcon->setPixmap(m_pAction->icon().pixmap(iMetric));
     440
     441            /* Add into layout: */
     442            m_pLayout->addWidget(m_pLabelIcon, 0, 1, 2, 1);
     443            m_pLayout->setAlignment(m_pLabelIcon, Qt::AlignHCenter | Qt::AlignTop);
     444        }
     445    }
     446}
    85447
    86448
     
    94456    , m_pErrBox(0), m_pErrLabel(0), m_pErrText(0)
    95457    , m_pRefreshButton(0), m_pRefreshAction(pRefreshAction)
     458    , m_pToolsPane(0), m_pLayoutWidget(0), m_pLabelToolsPaneText(0)
    96459{
    97460    /* Translate finally: */
     
    121484    /* Raise corresponding widget: */
    122485    setCurrentIndex(indexOf(m_pErrBox));
     486}
     487
     488void UIDesktopPanePrivate::setToolsPaneText(const QString &strText)
     489{
     490    /* Prepare tools pane if necessary: */
     491    prepareToolsPane();
     492
     493    /* Assign corresponding text: */
     494    m_pLabelToolsPaneText->setText(strText);
     495
     496    /* Raise corresponding widget: */
     497    setCurrentWidget(m_pToolsPane);
     498}
     499
     500void UIDesktopPanePrivate::addToolDescription(QAction *pAction, const QString &strDescription)
     501{
     502    /* Prepare tools pane if necessary: */
     503    prepareToolsPane();
     504
     505    /* Add tool widget on the basis of passed description: */
     506    UIToolWidget *pWidget = new UIToolWidget(pAction, strDescription);
     507    AssertPtrReturnVoid(pWidget);
     508    {
     509        /* Add into layout: */
     510        m_pLayoutWidget->addWidget(pWidget);
     511    }
     512
     513    /* Raise corresponding widget: */
     514    setCurrentWidget(m_pToolsPane);
     515}
     516
     517void UIDesktopPanePrivate::removeToolDescriptions()
     518{
     519    /* Clear the layout: */
     520    QLayoutItem *pChild = 0;
     521    while ((pChild = m_pLayoutWidget->takeAt(0)) != 0)
     522        delete pChild;
    123523}
    124524
     
    219619}
    220620
     621void UIDesktopPanePrivate::prepareToolsPane()
     622{
     623    /* Do nothing if already exists: */
     624    if (m_pToolsPane)
     625        return;
     626
     627    /* Create tool pane: */
     628    m_pToolsPane = new QWidget;
     629    AssertPtrReturnVoid(m_pToolsPane);
     630    {
     631        /* Create main layout: */
     632        QVBoxLayout *pMainLayout = new QVBoxLayout(m_pToolsPane);
     633        AssertPtrReturnVoid(pMainLayout);
     634        {
     635            /* Create welcome layout: */
     636            QHBoxLayout *pLayoutWelcome = new QHBoxLayout;
     637            AssertPtrReturnVoid(pLayoutWelcome);
     638            {
     639                /* Invent pixel metric: */
     640                const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
     641
     642                /* Configure layout: */
     643                pLayoutWelcome->setContentsMargins(iMetric, 0, 0, 0);
     644                pLayoutWelcome->setSpacing(10);
     645
     646                /* Create welcome text label: */
     647                m_pLabelToolsPaneText = new QILabel;
     648                AssertPtrReturnVoid(m_pLabelToolsPaneText);
     649                {
     650                    /* Configure label: */
     651                    m_pLabelToolsPaneText->setWordWrap(true);
     652                    m_pLabelToolsPaneText->useSizeHintForWidth(200);
     653                    m_pLabelToolsPaneText->setAlignment(Qt::AlignLeading | Qt::AlignTop);
     654                    m_pLabelToolsPaneText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     655
     656                    /* Add into layout: */
     657                    pLayoutWelcome->addWidget(m_pLabelToolsPaneText);
     658                }
     659
     660                /* Create picture label: */
     661                QLabel *pLabelPicture = new QLabel;
     662                AssertPtrReturnVoid(pLabelPicture);
     663                {
     664                    /* Configure label: */
     665                    const QIcon icon = UIIconPool::iconSet(":/tools_200px.png");
     666                    pLabelPicture->setPixmap(icon.pixmap(QSize(200, 200)));
     667                    pLabelPicture->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     668
     669                    /* Add into layout: */
     670                    pLayoutWelcome->addWidget(pLabelPicture);
     671                    pLayoutWelcome->setAlignment(pLabelPicture, Qt::AlignHCenter | Qt::AlignTop);
     672                }
     673
     674                /* Add into layout: */
     675                pMainLayout->addLayout(pLayoutWelcome);
     676            }
     677
     678            /* Create widget layout: */
     679            m_pLayoutWidget = new QVBoxLayout(m_pToolsPane);
     680            AssertPtrReturnVoid(m_pLayoutWidget);
     681            {
     682                /* Add into layout: */
     683                pMainLayout->addLayout(m_pLayoutWidget);
     684            }
     685
     686            /* Add stretch: */
     687            pMainLayout->addStretch();
     688        }
     689
     690        /* Add into the stack: */
     691        addWidget(m_pToolsPane);
     692    }
     693}
     694
    221695
    222696/*********************************************************************************************************************************
     
    248722}
    249723
     724void UIDesktopPane::setToolsPaneText(const QString &strText)
     725{
     726    m_pDesktopPrivate->setToolsPaneText(strText);
     727}
     728
     729void UIDesktopPane::addToolDescription(QAction *pAction, const QString &strDescription)
     730{
     731    m_pDesktopPrivate->addToolDescription(pAction, strDescription);
     732}
     733
     734void UIDesktopPane::removeToolDescriptions()
     735{
     736    m_pDesktopPrivate->removeToolDescriptions();
     737}
     738
    250739#include "UIDesktopPane.moc"
    251740
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIDesktopPane.h

    r68195 r68235  
    55
    66/*
    7  * Copyright (C) 2010-2016 Oracle Corporation
     7 * Copyright (C) 2010-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2323
    2424/* Forward declarations: */
     25class QAction;
    2526class UIDesktopPanePrivate;
    2627
     
    4546    void updateDetailsError(const QString &strError);
    4647
     48    /** Defines a tools pane welcome @a strText. */
     49    void setToolsPaneText(const QString &strText);
     50    /** Add a tool element.
     51      * @param  pAction         Brings tool action reference.
     52      * @param  strDescription  Brings the tool description. */
     53    void addToolDescription(QAction *pAction, const QString &strDescription);
     54    /** Removes all tool elements. */
     55    void removeToolDescriptions();
     56
    4757private:
    4858
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r68230 r68235  
    11591159    setWindowTitle(strTitle);
    11601160
    1161     /* Translate Machine Tools welcome screen: */
    1162     m_pPaneToolsMachine->setDetailsText(
    1163         tr("<h3>Welcome to VirtualBox!</h3>"
    1164            "<p>The left part of this window is a list of all virtual machines "
    1165            "and virtual machine groups on your computer. "
    1166            "<img src=:/welcome.png align=right/></p>"
    1167            "<p>The right part of this window represents a set of tools "
    1168            "you have opened for the currently chosen machine. "
    1169            "For more tools check the corresponding menu at the right side "
    1170            "of the main tool bar located at the top of the window.</p>"
    1171            "<p>You can press the <b>%1</b> key to get instant help, "
    1172            "or visit "
    1173            "<a href=https://www.virtualbox.org>www.virtualbox.org</a> "
    1174            "for the latest information and news.</p>")
    1175            .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));
    1176 
    1177     /* Translate Global Tools welcome screen: */
    1178     m_pPaneToolsGlobal->setDetailsText(
    1179         tr("<h3>Welcome to VirtualBox!</h3>"
    1180            "<p>This window represents a set of global tools "
    1181            "you have opened. They are not related to any particular machine "
    1182            "but to whole VirtualBox instead. This list will be extended with "
    1183            "new tools in the future releases. "
    1184            "<img src=:/welcome.png align=right/></p>"
    1185            "For more tools check the corresponding menu at the right side "
    1186            "of the main tool bar located at the top of the window.</p>"
    1187            "<p>You can press the <b>%1</b> key to get instant help, "
    1188            "or visit "
    1189            "<a href=https://www.virtualbox.org>www.virtualbox.org</a> "
    1190            "for the latest information and news.</p>")
    1191            .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));
    1192 
    11931161    /* Make sure details and snapshot panes are updated: */
    11941162    sltHandleChooserPaneIndexChange(false /* update details? */, false /* update snapshots? */);
     
    19401908#endif
    19411909
    1942                     /* Prepare Chooser-pane: */
     1910                    /* Create Chooser-pane: */
    19431911                    m_pPaneChooser = new UIGChooser(this);
    19441912                    AssertPtrReturnVoid(m_pPaneChooser);
     
    19481916                    }
    19491917
    1950                     /* Prepare Machine Tools-pane: */
     1918                    /* Create Machine Tools-pane: */
    19511919                    m_pPaneToolsMachine = new UIToolsPaneMachine(actionPool());
    19521920                    AssertPtrReturnVoid(m_pPaneToolsMachine);
     
    19641932                }
    19651933
    1966                 /* Prepare Global Tools-pane: */
     1934                /* Create Global Tools-pane: */
    19671935                m_pPaneToolsGlobal = new UIToolsPaneGlobal(actionPool());
    19681936                AssertPtrReturnVoid(m_pPaneToolsGlobal);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.cpp

    r68221 r68235  
    2222/* Qt includes: */
    2323# include <QStackedLayout>
     24# include <QUuid>
    2425
    2526/* GUI includes */
     
    3738
    3839UIToolsPaneGlobal::UIToolsPaneGlobal(UIActionPool *pActionPool, QWidget *pParent /* = 0 */)
    39     : QWidget(pParent)
     40    : QIWithRetranslateUI<QWidget>(pParent)
    4041    , m_pActionPool(pActionPool)
    4142    , m_pLayout(0)
     
    169170    /* Update desktop pane: */
    170171    AssertPtrReturnVoid(m_pPaneDesktop);
    171     m_pPaneDesktop->updateDetailsText(strText);
     172    m_pPaneDesktop->setToolsPaneText(strText);
    172173}
    173174
     
    179180}
    180181
     182void UIToolsPaneGlobal::retranslateUi()
     183{
     184    /* Translate Global Tools welcome screen: */
     185    setDetailsText(
     186        tr("<h3>Welcome to VirtualBox!</h3>"
     187           "<p>This window represents a set of global tools "
     188           "which are currently opened (or can be opened). "
     189           "They are not related to any particular machine but "
     190           "to whole VirtualBox instead. For list of currently "
     191           "available tools check the corresponding menu at the right "
     192           "side of the main tool bar located at the top of the window. "
     193           "This list will be extended with new tools in the future releases.</p>"
     194           "<p>You can press the <b>%1</b> key to get instant help, or visit "
     195           "<a href=https://www.virtualbox.org>www.virtualbox.org</a> "
     196           "for the latest information and news.</p>")
     197           .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));
     198
     199    /* Wipe out the tool descriptions: */
     200    m_pPaneDesktop->removeToolDescriptions();
     201
     202    /* Add tool descriptions: */
     203    QAction *pAction1 = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager);
     204    m_pPaneDesktop->addToolDescription(pAction1,
     205                                       tr("Tool to observe virtual storage media. "
     206                                          "Reflects all the chains of <u>virtual disks</u> you have registered "
     207                                          "(per each storage type) within your virtual machines and allows for media "
     208                                          "manipulations like possibility to <u>copy</u>, <u>remove</u>, <u>release</u> "
     209                                          "(detach from VMs it currently attached to) and observe their properties. "
     210                                          "Allows to <u>edit</u> medium attributes like <u>type</u>, "
     211                                          "<u>location/name</u>, <u>description</u> and <u>size</u> (for dynamical storages "
     212                                          "only)."));
     213    QAction *pAction2 = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager);
     214    m_pPaneDesktop->addToolDescription(pAction2,
     215                                       tr("Tool to control host-only network interfaces. "
     216                                          "Reflects <u>host-only networks</u>, their DHCP servers and allows "
     217                                          "for network manipulations like possibility to <u>create</u>, <u>remove</u> "
     218                                          "and observe their properties. Allows to <u>edit</u> various "
     219                                          "<u>attributes</u> for host-only interface and corresponding DHCP server."));
     220}
     221
    181222void UIToolsPaneGlobal::prepare()
    182223{
     
    192233    /* Create desktop pane: */
    193234    openTool(ToolTypeGlobal_Desktop);
     235
     236    /* Apply language settings: */
     237    retranslateUi();
    194238}
    195239
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.h

    r68221 r68235  
    2121/* Qt includes: */
    2222#include <QWidget>
     23
     24/* GUI includes: */
     25#include "QIWithRetranslateUI.h"
    2326
    2427/* Forward declarations: */
     
    4851
    4952/** QWidget subclass representing container for tool panes. */
    50 class UIToolsPaneGlobal : public QWidget
     53class UIToolsPaneGlobal : public QIWithRetranslateUI<QWidget>
    5154{
    5255    Q_OBJECT;
     
    7275    /** Defines @a strError and switches to error details pane. */
    7376    void setDetailsError(const QString &strError);
     77
     78protected:
     79
     80    /** Handles translation event. */
     81    virtual void retranslateUi() /* override */;
    7482
    7583private:
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.cpp

    r68221 r68235  
    2222/* Qt includes: */
    2323# include <QStackedLayout>
     24# include <QUuid>
    2425
    2526/* GUI includes */
     
    3738
    3839UIToolsPaneMachine::UIToolsPaneMachine(UIActionPool *pActionPool, QWidget *pParent /* = 0 */)
    39     : QWidget(pParent)
     40    : QIWithRetranslateUI<QWidget>(pParent)
    4041    , m_pActionPool(pActionPool)
    4142    , m_pLayout(0)
     
    173174    /* Update desktop pane: */
    174175    AssertPtrReturnVoid(m_pPaneDesktop);
    175     m_pPaneDesktop->updateDetailsText(strText);
     176    m_pPaneDesktop->setToolsPaneText(strText);
    176177}
    177178
     
    197198}
    198199
     200void UIToolsPaneMachine::retranslateUi()
     201{
     202    /* Translate Machine Tools welcome screen: */
     203    setDetailsText(
     204        tr("<h3>Welcome to VirtualBox!</h3>"
     205           "<p>The left part of this window is a list of all virtual "
     206           "machines and virtual machine groups on your computer.</p>"
     207           "<p>The right part of this window represents a set of "
     208           "tools which are currently opened (or can be opened) for "
     209           "the currently chosen machine. For list of currently "
     210           "available tools check the corresponding menu at the right "
     211           "side of the main tool bar located at the top of the window. "
     212           "This list will be extended with new tools in the future releases.</p>"
     213           "<p>You can press the <b>%1</b> key to get instant help, or visit "
     214           "<a href=https://www.virtualbox.org>www.virtualbox.org</a> "
     215           "for the latest information and news.</p>")
     216           .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));
     217
     218    /* Wipe out the tool descriptions: */
     219    m_pPaneDesktop->removeToolDescriptions();
     220
     221    /* Add tool descriptions: */
     222    QAction *pAction1 = m_pActionPool->action(UIActionIndexST_M_Tools_M_Machine_Details);
     223    m_pPaneDesktop->addToolDescription(pAction1,
     224                                       tr("Tool to observe virtual machine (VM) details. "
     225                                          "Reflects groups of <u>properties</u> for the currently chosen VM and allows "
     226                                          "for basic manipulations on few of them (like the machine storage devices)."));
     227    QAction *pAction2 = m_pActionPool->action(UIActionIndexST_M_Tools_M_Machine_Snapshots);
     228    m_pPaneDesktop->addToolDescription(pAction2,
     229                                       tr("Tool to control virtual machine (VM) snapshots. "
     230                                          "Reflects <u>snapshots</u> created for the currently chosen VM and allows "
     231                                          "for snapshot manipulations like possibility to <u>create</u>, <u>remove</u>, "
     232                                          "<u>restore</u> (make current) and observe their properties. Allows to "
     233                                          "<u>edit</u> snapshot attributes like <u>name</u> and <u>description</u>."));
     234}
     235
    199236void UIToolsPaneMachine::prepare()
    200237{
     
    210247    /* Create desktop pane: */
    211248    openTool(ToolTypeMachine_Desktop);
     249
     250    /* Apply language settings: */
     251    retranslateUi();
    212252}
    213253
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.h

    r68221 r68235  
    2121/* Qt includes: */
    2222#include <QWidget>
     23
     24/* GUI includes: */
     25#include "QIWithRetranslateUI.h"
    2326
    2427/* Forward declarations: */
     
    4851
    4952/** QWidget subclass representing container for tool panes. */
    50 class UIToolsPaneMachine : public QWidget
     53class UIToolsPaneMachine : public QIWithRetranslateUI<QWidget>
    5154{
    5255    Q_OBJECT;
     
    9093    void setMachine(const CMachine &comMachine);
    9194
     95protected:
     96
     97    /** Handles translation event. */
     98    virtual void retranslateUi() /* override */;
     99
    92100private:
    93101
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