VirtualBox

Changeset 76954 in vbox


Ignore:
Timestamp:
Jan 23, 2019 12:56:07 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9072: Use UIDialogPanel as the base in log viewer panels

Location:
trunk/src/VBox/Frontends/VirtualBox/src/logviewer
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp

    r76890 r76954  
    8484}
    8585
     86QString UIVMLogViewerBookmarksPanel::panelName() const
     87{
     88    return "FilterPanel";
     89}
     90
    8691void UIVMLogViewerBookmarksPanel::setBookmarkIndex(int index)
    8792{
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.h

    r76581 r76954  
    3636    Q_OBJECT;
    3737
    38 signals:
    39 
    40     void sigDeleteBookmark(int bookmarkIndex);
    41     void sigDeleteAllBookmarks();
    42     void sigBookmarkSelected(int index);
    43 
    4438public:
    4539
     
    5549    /** Disable/enable all the widget except the close button */
    5650    void disableEnableBookmarking(bool flag);
     51    virtual QString panelName() const /* override */;
     52signals:
    5753
    58 public slots:
     54    void sigDeleteBookmark(int bookmarkIndex);
     55    void sigDeleteAllBookmarks();
     56    void sigBookmarkSelected(int index);
    5957
    6058protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp

    r76607 r76954  
    259259}
    260260
     261QString UIVMLogViewerFilterPanel::panelName() const
     262{
     263    return "FilterPanel";
     264}
     265
    261266void UIVMLogViewerFilterPanel::applyFilter(const int iCurrentIndex /* = 0 */)
    262267{
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.h

    r76581 r76954  
    5757      * @param  pViewer  Specifies reference to the VM Log-Viewer this filter-panel belongs to. */
    5858    UIVMLogViewerFilterPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer);
     59    virtual QString panelName() const /* override */;
    5960
    6061public slots:
     
    113114
    114115#endif /* !FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerFilterPanel_h */
    115 
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerOptionsPanel.cpp

    r76606 r76954  
    7070        return;
    7171    m_pFontSizeSpinBox->setValue(fontSizeInPoints);
     72}
     73
     74QString UIVMLogViewerOptionsPanel::panelName() const
     75{
     76    return "OptionsPanel";
    7277}
    7378
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerOptionsPanel.h

    r76581 r76954  
    5252    void setWrapLines(bool bWrapLines);
    5353    void setFontSizeInPoints(int fontSizeInPoints);
     54    virtual QString panelName() const /* override */;
    5455
    5556public slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp

    r76606 r76954  
    3636
    3737UIVMLogViewerPanel::UIVMLogViewerPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)
    38     : QIWithRetranslateUI<QWidget>(pParent)
     38    : UIDialogPanel(pParent)
    3939    , m_pViewer(pViewer)
    40     , m_pMainLayout(0)
    41     , m_pCloseButton(0)
    4240{
    43     prepare();
    4441}
    4542
    46 void UIVMLogViewerPanel::setCloseButtonShortCut(QKeySequence shortCut)
     43void UIVMLogViewerPanel::retranslateUi()
    4744{
    48     if (!m_pCloseButton)
    49         return;
    50     m_pCloseButton->setShortcut(shortCut);
    5145}
    5246
     
    5953{
    6054    return m_pViewer;
    61 }
    62 
    63 QHBoxLayout* UIVMLogViewerPanel::mainLayout()
    64 {
    65     return m_pMainLayout;
    66 }
    67 
    68 void UIVMLogViewerPanel::prepare()
    69 {
    70     prepareWidgets();
    71     prepareConnections();
    72     retranslateUi();
    73 }
    74 
    75 void UIVMLogViewerPanel::prepareWidgets()
    76 {
    77     m_pMainLayout = new QHBoxLayout(this);
    78     if (m_pMainLayout)
    79     {
    80 #ifdef VBOX_WS_MAC
    81         m_pMainLayout->setContentsMargins(5 /* since there is always a button */, 0, 10 /* standard */, 0);
    82         m_pMainLayout->setSpacing(10);
    83 #else
    84         m_pMainLayout->setContentsMargins(qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2, 0,
    85                                           qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) / 2,
    86                                           qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) / 2);
    87         m_pMainLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
    88 #endif
    89     }
    90     m_pCloseButton = new QIToolButton;
    91     if (m_pCloseButton)
    92     {
    93         m_pCloseButton->setIcon(UIIconPool::iconSet(":/close_16px.png"));
    94         m_pMainLayout->addWidget(m_pCloseButton, 0, Qt::AlignLeft);
    95     }
    96 }
    97 
    98 void UIVMLogViewerPanel::prepareConnections()
    99 {
    100     if (m_pCloseButton)
    101         connect(m_pCloseButton, &QIToolButton::clicked, this, &UIVMLogViewerPanel::hide);
    102 }
    103 
    104 void UIVMLogViewerPanel::retranslateUi()
    105 {
    106     if (m_pCloseButton)
    107         m_pCloseButton->setToolTip(UIVMLogViewerWidget::tr("Close the pane"));
    108 }
    109 
    110 bool UIVMLogViewerPanel::eventFilter(QObject *pObject, QEvent *pEvent)
    111 {
    112     Q_UNUSED(pObject);
    113     Q_UNUSED(pEvent);
    114     /* Dont consume this event. Pass it back to Qt's event system: */
    115     return false;
    116 }
    117 
    118 void UIVMLogViewerPanel::showEvent(QShowEvent *pEvent)
    119 {
    120     QWidget::showEvent(pEvent);
    121 }
    122 
    123 void UIVMLogViewerPanel::hideEvent(QHideEvent *pEvent)
    124 {
    125     /* Get focused widget: */
    126     QWidget *pFocus = QApplication::focusWidget();
    127     /* If focus-widget is valid and child-widget of search-panel,
    128      * focus next child-widget in line: */
    129     if (pFocus && pFocus->parent() == this)
    130         focusNextPrevChild(true);
    131     if (m_pViewer)
    132         m_pViewer->hidePanel(this);
    133 
    134     QWidget::hideEvent(pEvent);
    13555}
    13656
     
    16282    return &(page->logString());
    16383}
    164 
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h

    r76910 r76954  
    2323
    2424/* Qt includes: */
    25 #include <QWidget>
    2625#include <QKeySequence>
     26
    2727/* GUI includes: */
    28 #include "QIWithRetranslateUI.h"
     28#include "UIDialogPanel.h"
    2929
    3030/* Forward declarations: */
    31 class QHBoxLayout;
    3231class QPlainTextEdit;
    3332class QTextDocument;
    34 class QIToolButton;
    3533class UIVMLogViewerWidget;
    3634
    3735
    38 /** QWidget extension acting as the base class for UIVMLogViewerXXXPanel widgets. */
    39 class UIVMLogViewerPanel : public QIWithRetranslateUI<QWidget>
     36/** UIDialonPanel extension acting as the base class for UIVMLogViewerXXXPanel widgets. */
     37class UIVMLogViewerPanel : public UIDialogPanel
    4038{
    4139    Q_OBJECT;
     
    4442
    4543    UIVMLogViewerPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer);
    46     void setCloseButtonShortCut(QKeySequence shortCut);
    4744
    4845protected:
    4946
    50     virtual void prepare();
    51     virtual void prepareWidgets();
    52     virtual void prepareConnections();
     47    virtual void retranslateUi() /* override */;
    5348
    5449    /* Access functions for children classes. */
    55     UIVMLogViewerWidget*       viewer();
    56     const UIVMLogViewerWidget* viewer() const;
    57     QHBoxLayout*               mainLayout();
    58 
    59     /** Handles the translation event. */
    60     void retranslateUi() /* override */;
    61 
    62     /** Handles Qt @a pEvent, used for keyboard processing. */
    63     bool eventFilter(QObject *pObject, QEvent *pEvent);
    64     /** Handles the Qt show @a pEvent. */
    65     void showEvent(QShowEvent *pEvent);
    66     /** Handles the Qt hide @a pEvent. */
    67     void hideEvent(QHideEvent *pEvent);
    68 
     50    UIVMLogViewerWidget        *viewer();
     51    const UIVMLogViewerWidget  *viewer() const;
    6952    QTextDocument  *textDocument();
    7053    QPlainTextEdit *textEdit();
    7154    /* Return the unmodified log. */
    72     const QString* logString() const;
     55    const QString *logString() const;
    7356
    7457private:
     
    7659    /** Holds the reference to VM Log-Viewer this panel belongs to. */
    7760    UIVMLogViewerWidget *m_pViewer;
    78     QHBoxLayout         *m_pMainLayout;
    79     QIToolButton        *m_pCloseButton;
    8061};
    8162
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp

    r76606 r76954  
    108108{
    109109    return m_matchLocationVector;
     110}
     111
     112QString UIVMLogViewerSearchPanel::panelName() const
     113{
     114    return "SearchPanel";
    110115}
    111116
     
    612617
    613618#include "UIVMLogViewerSearchPanel.moc"
    614 
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.h

    r76581 r76954  
    5656    void reset();
    5757    const QVector<float> &getMatchLocationVector() const;
     58    virtual QString panelName() const /* override */;
    5859
    5960protected:
     
    131132
    132133#endif /* !FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerSearchPanel_h */
    133 
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