Changeset 102727 in vbox
- Timestamp:
- Dec 29, 2023 2:48:26 PM (11 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp
r102726 r102727 48 48 UIVMLogViewerWidget *pViewer, 49 49 EmbedTo enmEmbedTo /* = EmbedTo_Stack */) 50 : UIPaneContainer(pParent, enmEmbedTo )50 : UIPaneContainer(pParent, enmEmbedTo, true /* detach allowed */) 51 51 , m_pViewer(pViewer) 52 52 , m_pSearchWidget(0) … … 103 103 connect(m_pPreferencesWidget, &UIVMLogViewerPreferencesWidget::sigResetToDefaults, 104 104 this, &UIVMLogViewerPaneContainer::sigResetToDefaults); 105 connect(m_pPreferencesWidget, &UIVMLogViewerPreferencesWidget::sigDetach,106 this, &UIVMLogViewerPaneContainer::sigDetach);107 105 108 106 retranslateUi(); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h
r102726 r102727 63 63 void sigChangeFont(QFont font); 64 64 void sigResetToDefaults(); 65 void sigDetach();66 65 67 66 void sigShowSearchPane(); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPreferencesWidget.cpp
r102723 r102727 36 36 37 37 /* GUI includes: */ 38 #include "QIDialogButtonBox.h"39 38 #include "QIToolButton.h" 40 39 #include "UIIconPool.h" … … 54 53 , m_pOpenFontDialogButton(0) 55 54 , m_pResetToDefaultsButton(0) 56 , m_pButtonBox(0)57 55 , m_iDefaultFontSize(9) 58 56 { … … 156 154 pMainLayout->addLayout(pContainerLayout); 157 155 pMainLayout->addStretch(1); 158 159 /* Create button-box: */160 m_pButtonBox = new QIDialogButtonBox;161 if (m_pButtonBox)162 {163 /* Configure button-box: */164 m_pButtonBox->setVisible(viewer()->embeddingType() == EmbedTo_Stack);165 m_pButtonBox->setStandardButtons(QDialogButtonBox::Close);166 connect(m_pButtonBox->button(QIDialogButtonBox::Close), &QPushButton::pressed,167 this, &UIVMLogViewerPreferencesWidget::sigDetach);168 169 /* Add into layout: */170 pMainLayout->addWidget(m_pButtonBox);171 }172 156 } 173 157 … … 201 185 m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer")); 202 186 m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset options to application defaults")); 203 204 if (m_pButtonBox)205 {206 m_pButtonBox->button(QDialogButtonBox::Close)->setText(tr("Detach"));207 m_pButtonBox->button(QDialogButtonBox::Close)->setStatusTip(tr("Open the tool in separate window"));208 }209 187 } 210 188 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPreferencesWidget.h
r102723 r102727 39 39 class QSpinBox; 40 40 class QLabel; 41 class QIDialogButtonBox;42 41 class QIToolButton; 43 42 class UIVMLogViewerWidget; … … 55 54 void sigChangeFont(QFont font); 56 55 void sigResetToDefaults(); 57 void sigDetach();58 56 59 57 public: … … 89 87 QIToolButton *m_pResetToDefaultsButton; 90 88 91 QIDialogButtonBox *m_pButtonBox;92 93 89 /** Default font size in points. */ 94 90 const int m_iDefaultFontSize; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPaneContainer.cpp
r102726 r102727 30 30 #include <QLabel> 31 31 #include <QPlainTextEdit> 32 #include <QPushButton> 32 33 #include <QTextCursor> 33 34 #include <QToolButton> … … 35 36 36 37 /* GUI includes: */ 38 #include "QIDialogButtonBox.h" 37 39 #include "UIIconPool.h" 38 40 #include "UIPaneContainer.h" … … 44 46 #include <iprt/assert.h> 45 47 46 UIPaneContainer::UIPaneContainer(QWidget *pParent, EmbedTo enmEmbedTo /* = EmbedTo_Stack */ )48 UIPaneContainer::UIPaneContainer(QWidget *pParent, EmbedTo enmEmbedTo /* = EmbedTo_Stack */, bool fDetachAllowed /* = false */) 47 49 : QIWithRetranslateUI<QWidget>(pParent) 48 50 , m_enmEmbedTo(enmEmbedTo) 51 , m_fDetachAllowed(fDetachAllowed) 49 52 , m_pTabWidget(0) 53 , m_pButtonBox(0) 50 54 { 51 55 prepare(); … … 55 59 void UIPaneContainer::retranslateUi() 56 60 { 61 if (m_pButtonBox) 62 { 63 m_pButtonBox->button(QDialogButtonBox::Cancel)->setText(tr("Detach")); 64 m_pButtonBox->button(QDialogButtonBox::Cancel)->setStatusTip(tr("Open the tool in separate window")); 65 } 57 66 } 58 67 … … 68 77 connect(m_pTabWidget, &QTabWidget::currentChanged, this, &UIPaneContainer::sigCurrentTabChanged); 69 78 pLayout->addWidget(m_pTabWidget); 79 80 /* Add the button-box: */ 81 QWidget *pContainer = new QWidget; 82 AssertReturnVoid(pContainer); 83 pContainer->setVisible(m_enmEmbedTo == EmbedTo_Stack && m_fDetachAllowed); 84 QHBoxLayout *pSubLayout = new QHBoxLayout(pContainer); 85 AssertReturnVoid(pSubLayout); 86 const int iL = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); 87 const int iR = qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin); 88 const int iB = qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin); 89 pSubLayout->setContentsMargins(iL, 0, iR, iB); 90 m_pButtonBox = new QIDialogButtonBox; 91 AssertReturnVoid(m_pButtonBox); 92 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel); 93 connect(m_pButtonBox->button(QIDialogButtonBox::Cancel), &QPushButton::pressed, 94 this, &UIPaneContainer::sigDetach); 95 pSubLayout->addWidget(m_pButtonBox); 96 pLayout->addWidget(pContainer); 70 97 } 71 98 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPaneContainer.h
r102726 r102727 42 42 /* Forward declarations: */ 43 43 class QHBoxLayout; 44 class QIDialogButtonBox; 44 45 45 46 /** QWidget extension acting as the base class for all the dialog panels like file manager, logviewer etc. */ … … 52 53 void sigCurrentTabChanged(int iIndex); 53 54 void sigHidden(); 55 void sigDetach(); 54 56 55 57 public: 56 58 57 UIPaneContainer(QWidget *pParent, EmbedTo enmEmbedTo = EmbedTo_Stack );59 UIPaneContainer(QWidget *pParent, EmbedTo enmEmbedTo = EmbedTo_Stack, bool fDetachAllowed = false); 58 60 void setCurrentIndex(int iIndex); 59 61 int currentIndex() const; … … 73 75 74 76 EmbedTo m_enmEmbedTo; 77 bool m_fDetachAllowed; 75 78 76 79 QTabWidget *m_pTabWidget; 80 81 QIDialogButtonBox *m_pButtonBox; 77 82 }; 78 83
Note:
See TracChangeset
for help on using the changeset viewer.