Changeset 84335 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 18, 2020 4:06:45 PM (5 years ago)
- 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 17 17 18 18 /* Qt includes: */ 19 #include <QAction>20 #include <QHBoxLayout>21 #include <QLabel>22 #include <QStyle>23 19 #include <QTextBrowser> 24 #include <QToolButton>25 20 #include <QVBoxLayout> 26 21 27 /* GUI includes */ 28 #include "QIWithRetranslateUI.h" 22 /* GUI includes: */ 29 23 #include "UIErrorPane.h" 30 24 31 /* Other VBox includes: */32 #include <iprt/assert.h>33 25 34 35 UIErrorPane::UIErrorPane(QAction *pRefreshAction /* = 0 */, QWidget *pParent /* = 0 */) 36 : QIWithRetranslateUI<QWidget>(pParent) 37 , m_pActionRefresh(pRefreshAction) 38 , m_pButtonRefresh(0) 26 UIErrorPane::UIErrorPane(QWidget *pParent /* = 0 */) 27 : QWidget(pParent) 39 28 , m_pBrowserDetails(0) 40 29 { 41 /* Prepare: */42 30 prepare(); 43 31 } … … 45 33 void UIErrorPane::setErrorDetails(const QString &strDetails) 46 34 { 47 /* Define error details: */35 /* Redirect to details browser: */ 48 36 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 }60 37 } 61 38 62 39 void UIErrorPane::prepare() 63 40 { 64 /* Create main layout: */41 /* Prepare main layout: */ 65 42 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 66 43 if (pMainLayout) 67 44 { 68 /* Configure layout: */69 45 pMainLayout->setContentsMargins(0, 0, 0, 0); 70 46 71 /* Create details browser: */47 /* Prepare details browser: */ 72 48 m_pBrowserDetails = new QTextBrowser; 73 49 if (m_pBrowserDetails) 74 50 { 75 /* Configure browser: */76 51 m_pBrowserDetails->setFocusPolicy(Qt::StrongFocus); 77 52 m_pBrowserDetails->document()->setDefaultStyleSheet("a { text-decoration: none; }"); … … 80 55 pMainLayout->addWidget(m_pBrowserDetails); 81 56 } 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();113 57 } 114 115 /* Retranslate finally: */116 retranslateUi();117 58 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIErrorPane.h
r84077 r84335 25 25 #include <QWidget> 26 26 27 /* GUI includes: */28 #include "QIWithRetranslateUI.h" 27 /* Forward declarations: */ 28 class QTextBrowser; 29 29 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. */ 32 class UIErrorPane : public QWidget 40 33 { 41 34 Q_OBJECT; … … 43 36 public: 44 37 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); 48 40 49 41 /** Defines error @a strDetails. */ 50 42 void setErrorDetails(const QString &strDetails); 51 52 protected:53 54 /** Handles translation event. */55 virtual void retranslateUi() /* override */;56 43 57 44 private: … … 60 47 void prepare(); 61 48 62 /** Holds the Refresh action refrence. */63 QAction *m_pActionRefresh;64 /** Holds the VM refresh button instance. */65 QToolButton *m_pButtonRefresh;66 67 49 /** Holds the text-browser instance. */ 68 50 QTextBrowser *m_pBrowserDetails; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp
r84078 r84335 109 109 { 110 110 /* Create Error pane: */ 111 m_pPaneError = new UIErrorPane (m_pActionPool->action(UIActionIndexST_M_Group_S_Refresh));111 m_pPaneError = new UIErrorPane; 112 112 if (m_pPaneError) 113 113 {
Note:
See TracChangeset
for help on using the changeset viewer.