Changeset 84022 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 27, 2020 7:18:37 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/extensions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogContainer.cpp
r84016 r84022 18 18 /* Qt includes: */ 19 19 #include <QGridLayout> 20 #include <QLabel> 20 21 #include <QProgressBar> 21 22 #include <QPushButton> … … 30 31 31 32 QIDialogContainer::QIDialogContainer(QWidget *pParent /* = 0 */, Qt::WindowFlags enmFlags /* = Qt::WindowFlags() */) 32 : Q Dialog(pParent, enmFlags)33 : QIWithRetranslateUI2<QDialog>(pParent, enmFlags) 33 34 , m_pLayout(0) 34 35 , m_pWidget(0) 36 , m_pProgressLabel(0) 35 37 , m_pProgressBar(0) 36 38 , m_pButtonBox(0) … … 49 51 void QIDialogContainer::setProgressBarHidden(bool fHidden) 50 52 { 53 AssertPtrReturnVoid(m_pProgressLabel); 51 54 AssertPtrReturnVoid(m_pProgressBar); 55 m_pProgressLabel->setHidden(fHidden); 52 56 m_pProgressBar->setHidden(fHidden); 53 57 } … … 60 64 } 61 65 66 void QIDialogContainer::retranslateUi() 67 { 68 m_pProgressLabel->setText(tr("Loading")); 69 } 70 62 71 void QIDialogContainer::prepare() 63 72 { … … 66 75 if (m_pLayout) 67 76 { 68 /* Prepare horizontal layout: */69 QHBoxLayout *pHLayout = new QHBoxLayout;70 if ( pHLayout)77 /* Prepare dialog button-box: */ 78 m_pButtonBox = new QIDialogButtonBox(this); 79 if (m_pButtonBox) 71 80 { 72 /* Prepare progress-bar: */ 73 m_pProgressBar = new QProgressBar(this); 74 if (m_pProgressBar) 81 m_pButtonBox->setStandardButtons(QDialogButtonBox::Ok); 82 connect(m_pButtonBox, &QIDialogButtonBox::accepted, 83 this, &QDialog::accept); 84 connect(m_pButtonBox, &QIDialogButtonBox::rejected, 85 this, &QDialog::reject); 86 87 /* Prepare progress-layout: */ 88 QHBoxLayout *pHLayout = new QHBoxLayout; 89 if (pHLayout) 75 90 { 76 m_pProgressBar->setHidden(true); 77 m_pProgressBar->setMinimum(0); 78 m_pProgressBar->setMaximum(0); 91 pHLayout->setContentsMargins(0, 0, 0, 0); 79 92 80 /* Add into layout: */ 81 pHLayout->addWidget(m_pProgressBar); 82 } 93 /* Prepare progress-label: */ 94 m_pProgressLabel = new QLabel(this); 95 if (m_pProgressLabel) 96 { 97 m_pProgressLabel->setHidden(true); 83 98 84 /* Prepare dialog button-box: */ 85 m_pButtonBox = new QIDialogButtonBox(this); 86 if (m_pButtonBox) 87 { 88 m_pButtonBox->setStandardButtons(QDialogButtonBox::Ok); 89 connect(m_pButtonBox, &QIDialogButtonBox::accepted, 90 this, &QDialog::accept); 91 connect(m_pButtonBox, &QIDialogButtonBox::rejected, 92 this, &QDialog::reject); 99 /* Add into layout: */ 100 pHLayout->addWidget(m_pProgressLabel); 101 } 102 /* Prepare progress-bar: */ 103 m_pProgressBar = new QProgressBar(this); 104 if (m_pProgressBar) 105 { 106 m_pProgressBar->setHidden(true); 107 m_pProgressBar->setTextVisible(false); 108 m_pProgressBar->setMinimum(0); 109 m_pProgressBar->setMaximum(0); 93 110 94 /* Add into layout: */ 95 pHLayout->addWidget(m_pButtonBox); 111 /* Add into layout: */ 112 pHLayout->addWidget(m_pProgressBar); 113 } 114 115 /* Add into button-box: */ 116 m_pButtonBox->addExtraLayout(pHLayout); 96 117 } 97 118 98 119 /* Add into layout: */ 99 m_pLayout->add Layout(pHLayout, 1, 0);120 m_pLayout->addWidget(m_pButtonBox, 1, 0); 100 121 } 101 122 } 123 124 /* Apply language settings: */ 125 retranslateUi(); 102 126 } -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogContainer.h
r84016 r84022 26 26 27 27 /* GUI includes: */ 28 #include "QIWithRetranslateUI.h" 28 29 #include "UILibraryDefs.h" 29 30 30 31 /* Forward declarations: */ 31 32 class QGridLayout; 33 class QLabel; 32 34 class QProgressBar; 33 35 class QWidget; … … 36 38 /** QDialog sub-class used as executable input container for passed widget. 37 39 * Should be used as popup or modal dialog wrapping functionality of the passed widget. */ 38 class SHARED_LIBRARY_STUFF QIDialogContainer : public Q Dialog40 class SHARED_LIBRARY_STUFF QIDialogContainer : public QIWithRetranslateUI2<QDialog> 39 41 { 40 42 Q_OBJECT; … … 59 61 void setOkButtonEnabled(bool fEnabled); 60 62 63 protected: 64 65 /** Handles translation event. */ 66 virtual void retranslateUi() /* override */; 67 61 68 private: 62 69 … … 69 76 QWidget *m_pWidget; 70 77 /** Holds the progress-bar instance. */ 78 QLabel *m_pProgressLabel; 79 /** Holds the progress-bar instance. */ 71 80 QProgressBar *m_pProgressBar; 72 81 /** Holds the button-box instance. */
Note:
See TracChangeset
for help on using the changeset viewer.