1 | /* $Id: UIVMLogViewerPanel.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_UIVMLogViewerPanel_h
|
---|
29 | #define FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerPanel_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UIPaneContainer.h"
|
---|
36 | #include "UIVMLogBookmark.h"
|
---|
37 |
|
---|
38 | /* Forward declarations: */
|
---|
39 | class QPlainTextEdit;
|
---|
40 | class QTextDocument;
|
---|
41 | class UIVMLogViewerWidget;
|
---|
42 | class UIVMLogViewerSearchWidget;
|
---|
43 | class UIVMLogViewerFilterWidget;
|
---|
44 | class UIVMLogViewerBookmarksWidget;
|
---|
45 | class UIVMLogViewerPreferencesWidget;
|
---|
46 |
|
---|
47 | class UIVMLogViewerPaneContainer : public UIPaneContainer
|
---|
48 | {
|
---|
49 | Q_OBJECT;
|
---|
50 |
|
---|
51 | signals:
|
---|
52 |
|
---|
53 | void sigHighlightingUpdated();
|
---|
54 | void sigSearchUpdated();
|
---|
55 | void sigFilterApplied();
|
---|
56 | void sigDeleteBookmarkByIndex(int bookmarkIndex);
|
---|
57 | void sigDeleteAllBookmarks();
|
---|
58 | void sigBookmarkSelected(int index);
|
---|
59 |
|
---|
60 | void sigShowLineNumbers(bool show);
|
---|
61 | void sigWrapLines(bool show);
|
---|
62 | void sigChangeFontSizeInPoints(int size);
|
---|
63 | void sigChangeFont(QFont font);
|
---|
64 | void sigResetToDefaults();
|
---|
65 |
|
---|
66 | void sigShowSearchPane();
|
---|
67 |
|
---|
68 | public:
|
---|
69 |
|
---|
70 | UIVMLogViewerPaneContainer(QWidget *pParent,
|
---|
71 | UIVMLogViewerWidget *pViewer,
|
---|
72 | EmbedTo enmEmbedTo = EmbedTo_Stack);
|
---|
73 |
|
---|
74 | /** @name Search page pass through functions
|
---|
75 | * @{ */
|
---|
76 | void refreshSearch();
|
---|
77 | QVector<float> matchLocationVector() const;
|
---|
78 | /** Returns the number of the matches to the current search. */
|
---|
79 | int matchCount() const;
|
---|
80 | /** @} */
|
---|
81 |
|
---|
82 | /** @name Filter page pass through functions
|
---|
83 | * @{ */
|
---|
84 | void applyFilter();
|
---|
85 | /** @} */
|
---|
86 |
|
---|
87 | /** @name Bookmark page pass through functions
|
---|
88 | * @{ */
|
---|
89 | void updateBookmarkList(const QVector<UIVMLogBookmark>& bookmarkList);
|
---|
90 | void disableEnableBookmarking(bool flag);
|
---|
91 | /** @} */
|
---|
92 |
|
---|
93 | /** @name Preferences page pass through functions
|
---|
94 | * @{ */
|
---|
95 | void setShowLineNumbers(bool bShowLineNumbers);
|
---|
96 | void setWrapLines(bool bWrapLines);
|
---|
97 | void setFontSizeInPoints(int fontSizeInPoints);
|
---|
98 | /** @} */
|
---|
99 |
|
---|
100 | enum Page
|
---|
101 | {
|
---|
102 | Page_Search = 0,
|
---|
103 | Page_Filter,
|
---|
104 | Page_Bookmark,
|
---|
105 | Page_Preferences,
|
---|
106 | Page_Max
|
---|
107 | };
|
---|
108 |
|
---|
109 | protected:
|
---|
110 |
|
---|
111 | virtual bool eventFilter(QObject *pObject, QEvent *pEvent) override;
|
---|
112 |
|
---|
113 | private slots:
|
---|
114 |
|
---|
115 | void sltRetranslateUI();
|
---|
116 |
|
---|
117 | private:
|
---|
118 |
|
---|
119 | void prepare() override;
|
---|
120 |
|
---|
121 | UIVMLogViewerWidget *m_pViewer;
|
---|
122 | UIVMLogViewerSearchWidget *m_pSearchWidget;
|
---|
123 | UIVMLogViewerFilterWidget *m_pFilterWidget;
|
---|
124 | UIVMLogViewerBookmarksWidget *m_pBookmarksWidget;
|
---|
125 | UIVMLogViewerPreferencesWidget *m_pPreferencesWidget;
|
---|
126 | };
|
---|
127 |
|
---|
128 | /** UIDialonPanel extension acting as the base class for UIVMLogViewerXXXPanel widgets. */
|
---|
129 | class UIVMLogViewerPane : public QWidget
|
---|
130 | {
|
---|
131 | Q_OBJECT;
|
---|
132 |
|
---|
133 | public:
|
---|
134 |
|
---|
135 | UIVMLogViewerPane(QWidget *pParent, UIVMLogViewerWidget *pViewer);
|
---|
136 |
|
---|
137 | protected:
|
---|
138 |
|
---|
139 | virtual void prepareWidgets() = 0;
|
---|
140 | virtual void prepareConnections() = 0;
|
---|
141 |
|
---|
142 | /* Access functions for children classes. */
|
---|
143 | UIVMLogViewerWidget *viewer();
|
---|
144 | const UIVMLogViewerWidget *viewer() const;
|
---|
145 | QTextDocument *textDocument();
|
---|
146 | QPlainTextEdit *textEdit();
|
---|
147 | /* Return the unmodified log. */
|
---|
148 | const QString *logString() const;
|
---|
149 |
|
---|
150 | private:
|
---|
151 |
|
---|
152 | /** Holds the reference to VM Log-Viewer this panel belongs to. */
|
---|
153 | UIVMLogViewerWidget *m_pViewer;
|
---|
154 | };
|
---|
155 |
|
---|
156 | #endif /* !FEQT_INCLUDED_SRC_logviewer_UIVMLogViewerPanel_h */
|
---|