VirtualBox

Changeset 102727 in vbox


Ignore:
Timestamp:
Dec 29, 2023 2:48:26 PM (11 months ago)
Author:
vboxsync
Message:

FE/Qt: Reworking r160895 to move Detach button to global UIPaneContainer interface instead of particular log viewer preferences page.

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  
    4848                                                       UIVMLogViewerWidget *pViewer,
    4949                                                       EmbedTo enmEmbedTo /* = EmbedTo_Stack */)
    50     : UIPaneContainer(pParent, enmEmbedTo)
     50    : UIPaneContainer(pParent, enmEmbedTo, true /* detach allowed */)
    5151    , m_pViewer(pViewer)
    5252    , m_pSearchWidget(0)
     
    103103    connect(m_pPreferencesWidget, &UIVMLogViewerPreferencesWidget::sigResetToDefaults,
    104104            this, &UIVMLogViewerPaneContainer::sigResetToDefaults);
    105     connect(m_pPreferencesWidget, &UIVMLogViewerPreferencesWidget::sigDetach,
    106             this, &UIVMLogViewerPaneContainer::sigDetach);
    107105
    108106    retranslateUi();
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h

    r102726 r102727  
    6363    void sigChangeFont(QFont font);
    6464    void sigResetToDefaults();
    65     void sigDetach();
    6665
    6766    void sigShowSearchPane();
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPreferencesWidget.cpp

    r102723 r102727  
    3636
    3737/* GUI includes: */
    38 #include "QIDialogButtonBox.h"
    3938#include "QIToolButton.h"
    4039#include "UIIconPool.h"
     
    5453    , m_pOpenFontDialogButton(0)
    5554    , m_pResetToDefaultsButton(0)
    56     , m_pButtonBox(0)
    5755    , m_iDefaultFontSize(9)
    5856{
     
    156154    pMainLayout->addLayout(pContainerLayout);
    157155    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     }
    172156}
    173157
     
    201185    m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));
    202186    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     }
    209187}
    210188
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPreferencesWidget.h

    r102723 r102727  
    3939class QSpinBox;
    4040class QLabel;
    41 class QIDialogButtonBox;
    4241class QIToolButton;
    4342class UIVMLogViewerWidget;
     
    5554    void sigChangeFont(QFont font);
    5655    void sigResetToDefaults();
    57     void sigDetach();
    5856
    5957public:
     
    8987    QIToolButton *m_pResetToDefaultsButton;
    9088
    91     QIDialogButtonBox *m_pButtonBox;
    92 
    9389    /** Default font size in points. */
    9490    const int    m_iDefaultFontSize;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPaneContainer.cpp

    r102726 r102727  
    3030#include <QLabel>
    3131#include <QPlainTextEdit>
     32#include <QPushButton>
    3233#include <QTextCursor>
    3334#include <QToolButton>
     
    3536
    3637/* GUI includes: */
     38#include "QIDialogButtonBox.h"
    3739#include "UIIconPool.h"
    3840#include "UIPaneContainer.h"
     
    4446#include <iprt/assert.h>
    4547
    46 UIPaneContainer::UIPaneContainer(QWidget *pParent, EmbedTo enmEmbedTo /* = EmbedTo_Stack */)
     48UIPaneContainer::UIPaneContainer(QWidget *pParent, EmbedTo enmEmbedTo /* = EmbedTo_Stack */, bool fDetachAllowed /* = false */)
    4749    : QIWithRetranslateUI<QWidget>(pParent)
    4850    , m_enmEmbedTo(enmEmbedTo)
     51    , m_fDetachAllowed(fDetachAllowed)
    4952    , m_pTabWidget(0)
     53    , m_pButtonBox(0)
    5054{
    5155    prepare();
     
    5559void UIPaneContainer::retranslateUi()
    5660{
     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    }
    5766}
    5867
     
    6877    connect(m_pTabWidget, &QTabWidget::currentChanged, this, &UIPaneContainer::sigCurrentTabChanged);
    6978    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);
    7097}
    7198
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPaneContainer.h

    r102726 r102727  
    4242/* Forward declarations: */
    4343class QHBoxLayout;
     44class QIDialogButtonBox;
    4445
    4546/** QWidget extension acting as the base class for all the dialog panels like file manager, logviewer etc. */
     
    5253    void sigCurrentTabChanged(int iIndex);
    5354    void sigHidden();
     55    void sigDetach();
    5456
    5557public:
    5658
    57     UIPaneContainer(QWidget *pParent, EmbedTo enmEmbedTo = EmbedTo_Stack);
     59    UIPaneContainer(QWidget *pParent, EmbedTo enmEmbedTo = EmbedTo_Stack, bool fDetachAllowed = false);
    5860    void setCurrentIndex(int iIndex);
    5961    int currentIndex() const;
     
    7375
    7476    EmbedTo  m_enmEmbedTo;
     77    bool     m_fDetachAllowed;
    7578
    7679    QTabWidget *m_pTabWidget;
     80
     81    QIDialogButtonBox *m_pButtonBox;
    7782};
    7883
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