VirtualBox

Changeset 84335 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
May 18, 2020 4:06:45 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: UIErrorPane: Remove refresh button, it's represented by refresh action now.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIErrorPane.cpp

    r84078 r84335  
    1717
    1818/* Qt includes: */
    19 #include <QAction>
    20 #include <QHBoxLayout>
    21 #include <QLabel>
    22 #include <QStyle>
    2319#include <QTextBrowser>
    24 #include <QToolButton>
    2520#include <QVBoxLayout>
    2621
    27 /* GUI includes */
    28 #include "QIWithRetranslateUI.h"
     22/* GUI includes: */
    2923#include "UIErrorPane.h"
    3024
    31 /* Other VBox includes: */
    32 #include <iprt/assert.h>
    3325
    34 
    35 UIErrorPane::UIErrorPane(QAction *pRefreshAction /* = 0 */, QWidget *pParent /* = 0 */)
    36     : QIWithRetranslateUI<QWidget>(pParent)
    37     , m_pActionRefresh(pRefreshAction)
    38     , m_pButtonRefresh(0)
     26UIErrorPane::UIErrorPane(QWidget *pParent /* = 0 */)
     27    : QWidget(pParent)
    3928    , m_pBrowserDetails(0)
    4029{
    41     /* Prepare: */
    4230    prepare();
    4331}
     
    4533void UIErrorPane::setErrorDetails(const QString &strDetails)
    4634{
    47     /* Define error details: */
     35    /* Redirect to details browser: */
    4836    m_pBrowserDetails->setText(strDetails);
    49 }
    50 
    51 void UIErrorPane::retranslateUi()
    52 {
    53     /* Translate refresh button: */
    54     if (m_pActionRefresh && m_pButtonRefresh)
    55     {
    56         m_pButtonRefresh->setText(m_pActionRefresh->text());
    57         m_pButtonRefresh->setIcon(m_pActionRefresh->icon());
    58         m_pButtonRefresh->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    59     }
    6037}
    6138
    6239void UIErrorPane::prepare()
    6340{
    64     /* Create main layout: */
     41    /* Prepare main layout: */
    6542    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    6643    if (pMainLayout)
    6744    {
    68         /* Configure layout: */
    6945        pMainLayout->setContentsMargins(0, 0, 0, 0);
    7046
    71         /* Create details browser: */
     47        /* Prepare details browser: */
    7248        m_pBrowserDetails = new QTextBrowser;
    7349        if (m_pBrowserDetails)
    7450        {
    75             /* Configure browser: */
    7651            m_pBrowserDetails->setFocusPolicy(Qt::StrongFocus);
    7752            m_pBrowserDetails->document()->setDefaultStyleSheet("a { text-decoration: none; }");
     
    8055            pMainLayout->addWidget(m_pBrowserDetails);
    8156        }
    82 
    83         /* If refresh action was set: */
    84         if (m_pActionRefresh)
    85         {
    86             /* Create Refresh button layout: */
    87             QHBoxLayout *pButtonLayout = new QHBoxLayout;
    88             if (pButtonLayout)
    89             {
    90                 /* Add stretch first: */
    91                 pButtonLayout->addStretch();
    92 
    93                 /* Create refresh button: */
    94                 m_pButtonRefresh = new QToolButton;
    95                 if (m_pButtonRefresh)
    96                 {
    97                     /* Configure button: */
    98                     m_pButtonRefresh->setFocusPolicy(Qt::StrongFocus);
    99                     connect(m_pButtonRefresh, &QToolButton::clicked,
    100                             m_pActionRefresh, &QAction::triggered);
    101 
    102                     /* Add into layout: */
    103                     pButtonLayout->addWidget(m_pButtonRefresh);
    104                 }
    105             }
    106 
    107             /* Add into layout: */
    108             pMainLayout->addLayout(pButtonLayout);
    109         }
    110 
    111         /* Add stretch finally: */
    112         pMainLayout->addStretch();
    11357    }
    114 
    115     /* Retranslate finally: */
    116     retranslateUi();
    11758}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIErrorPane.h

    r84077 r84335  
    2525#include <QWidget>
    2626
    27 /* GUI includes: */
    28 #include "QIWithRetranslateUI.h"
     27/* Forward declarations: */
     28class QTextBrowser;
    2929
    30 /* Forward declarations: */
    31 class QAction;
    32 class QString;
    33 class QTextBrowser;
    34 class QToolButton;
    35 
    36 
    37 /** QWidget subclass representing error pane reflecting information
    38   * about currently chosen inaccessible VM and allowing to operate over it. */
    39 class UIErrorPane : public QIWithRetranslateUI<QWidget>
     30/** QWidget subclass representing error pane reflecting
     31  * information about currently chosen inaccessible VM. */
     32class UIErrorPane : public QWidget
    4033{
    4134    Q_OBJECT;
     
    4336public:
    4437
    45     /** Constructs error pane passing @a pParent to the base-class.
    46       * @param  pRefreshAction  Brings the refresh action reference. */
    47     UIErrorPane(QAction *pRefreshAction = 0, QWidget *pParent = 0);
     38    /** Constructs error pane passing @a pParent to the base-class. */
     39    UIErrorPane(QWidget *pParent = 0);
    4840
    4941    /** Defines error @a strDetails. */
    5042    void setErrorDetails(const QString &strDetails);
    51 
    52 protected:
    53 
    54     /** Handles translation event. */
    55     virtual void retranslateUi() /* override */;
    5643
    5744private:
     
    6047    void prepare();
    6148
    62     /** Holds the Refresh action refrence. */
    63     QAction     *m_pActionRefresh;
    64     /** Holds the VM refresh button instance. */
    65     QToolButton *m_pButtonRefresh;
    66 
    6749    /** Holds the text-browser instance. */
    6850    QTextBrowser *m_pBrowserDetails;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp

    r84078 r84335  
    109109            {
    110110                /* Create Error pane: */
    111                 m_pPaneError = new UIErrorPane(m_pActionPool->action(UIActionIndexST_M_Group_S_Refresh));
     111                m_pPaneError = new UIErrorPane;
    112112                if (m_pPaneError)
    113113                {
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