1 | /* $Id: UIVMLogViewerFilterWidget.h 103923 2024-03-19 17:01:11Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIVMLogViewer class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
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
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerFilterWidget_h
|
---|
29 | #define FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerFilterWidget_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | # include <QSet>
|
---|
36 |
|
---|
37 | /* GUI includes: */
|
---|
38 | #include "UIVMLogViewerPanel.h"
|
---|
39 |
|
---|
40 | /* Forward declarations: */
|
---|
41 | class QAbstractButton;
|
---|
42 | class QButtonGroup;
|
---|
43 | class QComboBox;
|
---|
44 | class QFrame;
|
---|
45 | class QLabel;
|
---|
46 | class QLineEdit;
|
---|
47 | class QVBoxLayout;
|
---|
48 | class QIToolButton;
|
---|
49 | class QRadioButton;
|
---|
50 | class UIVMFilterLineEdit;
|
---|
51 |
|
---|
52 |
|
---|
53 | /** QWidget extension
|
---|
54 | * providing GUI for filter panel in VM Log Viewer. */
|
---|
55 | class UIVMLogViewerFilterWidget : public UIVMLogViewerPane
|
---|
56 | {
|
---|
57 | Q_OBJECT;
|
---|
58 |
|
---|
59 | signals:
|
---|
60 |
|
---|
61 | void sigFilterApplied();
|
---|
62 |
|
---|
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. */
|
---|
67 | UIVMLogViewerFilterWidget(QWidget *pParent, UIVMLogViewerWidget *pViewer);
|
---|
68 |
|
---|
69 | public slots:
|
---|
70 |
|
---|
71 | /** Applies filter settings and filters the current log-page. */
|
---|
72 | void applyFilter();
|
---|
73 |
|
---|
74 | protected:
|
---|
75 |
|
---|
76 | virtual void prepareWidgets() RT_OVERRIDE;
|
---|
77 | virtual void prepareConnections() RT_OVERRIDE;
|
---|
78 |
|
---|
79 | /** Handles Qt @a pEvent, used for keyboard processing. */
|
---|
80 | bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
|
---|
81 | void showEvent(QShowEvent *pEvent) RT_OVERRIDE;
|
---|
82 | void hideEvent(QHideEvent *pEvent) RT_OVERRIDE;
|
---|
83 |
|
---|
84 | private slots:
|
---|
85 |
|
---|
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();
|
---|
90 | /** Executes the necessary code to handle filter's boolean operator change ('And', 'Or'). */
|
---|
91 | void sltOperatorButtonChanged(QAbstractButton *pButton);
|
---|
92 | void sltRemoveFilterTerm(const QString &termString);
|
---|
93 | void sltRetranslateUI();
|
---|
94 |
|
---|
95 | private:
|
---|
96 |
|
---|
97 | enum FilterOperatorButton{
|
---|
98 | AndButton = 0,/* Don't change this value */
|
---|
99 | OrButton,
|
---|
100 | ButtonEnd
|
---|
101 | };
|
---|
102 |
|
---|
103 | void prepareRadioButtonGroup(QVBoxLayout *pLayout);
|
---|
104 |
|
---|
105 | bool applyFilterTermsToString(const QString& string);
|
---|
106 | void filter();
|
---|
107 | /** Revert the document to original. */
|
---|
108 | void resetFiltering();
|
---|
109 |
|
---|
110 | QLabel *m_pFilterLabel;
|
---|
111 | QComboBox *m_pFilterComboBox;
|
---|
112 | QButtonGroup *m_pButtonGroup;
|
---|
113 | QRadioButton *m_pAndRadioButton;
|
---|
114 | QRadioButton *m_pOrRadioButton;
|
---|
115 | QFrame *m_pRadioButtonContainer;
|
---|
116 | QIToolButton *m_pAddFilterTermButton;
|
---|
117 | QSet<QString> m_filterTermSet;
|
---|
118 | FilterOperatorButton m_eFilterOperatorButton;
|
---|
119 | UIVMFilterLineEdit *m_pFilterTermsLineEdit;
|
---|
120 | QLabel *m_pResultLabel;
|
---|
121 | int m_iUnfilteredLineCount;
|
---|
122 | int m_iFilteredLineCount;
|
---|
123 | };
|
---|
124 |
|
---|
125 | #endif /* !FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerFilterWidget_h */
|
---|