[70027] | 1 | /* $Id: UIVMLogViewerFilterWidget.h 103923 2024-03-19 17:01:11Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
| 3 | * VBox Qt GUI - UIVMLogViewer class declaration.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
[70027] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
| 25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
[70027] | 26 | */
|
---|
| 27 |
|
---|
[100936] | 28 | #ifndef FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerFilterWidget_h
|
---|
| 29 | #define FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerFilterWidget_h
|
---|
[76532] | 30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 31 | # pragma once
|
---|
| 32 | #endif
|
---|
[70027] | 33 |
|
---|
[70645] | 34 | /* Qt includes: */
|
---|
| 35 | # include <QSet>
|
---|
[70027] | 36 |
|
---|
| 37 | /* GUI includes: */
|
---|
[70500] | 38 | #include "UIVMLogViewerPanel.h"
|
---|
[70027] | 39 |
|
---|
| 40 | /* Forward declarations: */
|
---|
[94045] | 41 | class QAbstractButton;
|
---|
[70466] | 42 | class QButtonGroup;
|
---|
[70027] | 43 | class QComboBox;
|
---|
[70473] | 44 | class QFrame;
|
---|
[70027] | 45 | class QLabel;
|
---|
[70466] | 46 | class QLineEdit;
|
---|
[100926] | 47 | class QVBoxLayout;
|
---|
[70610] | 48 | class QIToolButton;
|
---|
[70466] | 49 | class QRadioButton;
|
---|
| 50 | class UIVMFilterLineEdit;
|
---|
[70027] | 51 |
|
---|
[70466] | 52 |
|
---|
[70027] | 53 | /** QWidget extension
|
---|
| 54 | * providing GUI for filter panel in VM Log Viewer. */
|
---|
[100963] | 55 | class UIVMLogViewerFilterWidget : public UIVMLogViewerPane
|
---|
[70027] | 56 | {
|
---|
| 57 | Q_OBJECT;
|
---|
| 58 |
|
---|
[70308] | 59 | signals:
|
---|
| 60 |
|
---|
[88735] | 61 | void sigFilterApplied();
|
---|
[70308] | 62 |
|
---|
[70027] | 63 | public:
|
---|
| 64 |
|
---|
| 65 | /** Constructs the filter-panel by passing @a pParent to the QWidget base-class constructor.
|
---|
| 66 | * @param pViewer Specifies reference to the VM Log-Viewer this filter-panel belongs to. */
|
---|
[100936] | 67 | UIVMLogViewerFilterWidget(QWidget *pParent, UIVMLogViewerWidget *pViewer);
|
---|
[70027] | 68 |
|
---|
| 69 | public slots:
|
---|
| 70 |
|
---|
[88728] | 71 | /** Applies filter settings and filters the current log-page. */
|
---|
| 72 | void applyFilter();
|
---|
[70308] | 73 |
|
---|
[70500] | 74 | protected:
|
---|
| 75 |
|
---|
[93990] | 76 | virtual void prepareWidgets() RT_OVERRIDE;
|
---|
| 77 | virtual void prepareConnections() RT_OVERRIDE;
|
---|
[70500] | 78 |
|
---|
| 79 | /** Handles Qt @a pEvent, used for keyboard processing. */
|
---|
[93990] | 80 | bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
|
---|
| 81 | void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
|
---|
| 82 | void hideEvent(QHideEvent *pEvent) RT_OVERRIDE;
|
---|
[70500] | 83 |
|
---|
[70027] | 84 | private slots:
|
---|
| 85 |
|
---|
[70466] | 86 | /** Adds the new filter term and reapplies the filter. */
|
---|
| 87 | void sltAddFilterTerm();
|
---|
| 88 | /** Clear all the filter terms and reset the filtering. */
|
---|
| 89 | void sltClearFilterTerms();
|
---|
[70474] | 90 | /** Executes the necessary code to handle filter's boolean operator change ('And', 'Or'). */
|
---|
[94045] | 91 | void sltOperatorButtonChanged(QAbstractButton *pButton);
|
---|
[70466] | 92 | void sltRemoveFilterTerm(const QString &termString);
|
---|
[103923] | 93 | void sltRetranslateUI();
|
---|
[70027] | 94 |
|
---|
| 95 | private:
|
---|
[70474] | 96 |
|
---|
[70466] | 97 | enum FilterOperatorButton{
|
---|
[70645] | 98 | AndButton = 0,/* Don't change this value */
|
---|
[70466] | 99 | OrButton,
|
---|
| 100 | ButtonEnd
|
---|
| 101 | };
|
---|
[70027] | 102 |
|
---|
[100926] | 103 | void prepareRadioButtonGroup(QVBoxLayout *pLayout);
|
---|
[70027] | 104 |
|
---|
[70466] | 105 | bool applyFilterTermsToString(const QString& string);
|
---|
[70473] | 106 | void filter();
|
---|
[88728] | 107 | /** Revert the document to original. */
|
---|
| 108 | void resetFiltering();
|
---|
[70466] | 109 |
|
---|
[70308] | 110 | QLabel *m_pFilterLabel;
|
---|
| 111 | QComboBox *m_pFilterComboBox;
|
---|
[70466] | 112 | QButtonGroup *m_pButtonGroup;
|
---|
| 113 | QRadioButton *m_pAndRadioButton;
|
---|
| 114 | QRadioButton *m_pOrRadioButton;
|
---|
[70473] | 115 | QFrame *m_pRadioButtonContainer;
|
---|
[70610] | 116 | QIToolButton *m_pAddFilterTermButton;
|
---|
[70645] | 117 | QSet<QString> m_filterTermSet;
|
---|
[70466] | 118 | FilterOperatorButton m_eFilterOperatorButton;
|
---|
| 119 | UIVMFilterLineEdit *m_pFilterTermsLineEdit;
|
---|
[70473] | 120 | QLabel *m_pResultLabel;
|
---|
| 121 | int m_iUnfilteredLineCount;
|
---|
| 122 | int m_iFilteredLineCount;
|
---|
[70027] | 123 | };
|
---|
| 124 |
|
---|
[100936] | 125 | #endif /* !FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerFilterWidget_h */
|
---|