1 | /* $Id: UIVMLogViewer.h 59833 2016-02-26 10:19:23Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIVMLogViewer class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2015 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___UIVMLogViewer_h___
|
---|
19 | #define ___UIVMLogViewer_h___
|
---|
20 |
|
---|
21 | /* Qt includes: */
|
---|
22 | #include <QMainWindow>
|
---|
23 | #include <QMap>
|
---|
24 | #include <QPair>
|
---|
25 |
|
---|
26 | /* GUI includes: */
|
---|
27 | #include "QIWithRetranslateUI.h"
|
---|
28 | #include "UIVMLogViewer.gen.h"
|
---|
29 |
|
---|
30 | /* COM includes: */
|
---|
31 | #include "COMEnums.h"
|
---|
32 | #include "CMachine.h"
|
---|
33 |
|
---|
34 | /* Forward declarations: */
|
---|
35 | class QComboBox;
|
---|
36 | class QITabWidget;
|
---|
37 | class QPushButton;
|
---|
38 | class QTextEdit;
|
---|
39 | class UIVMLogViewer;
|
---|
40 | class UIVMLogViewerFilterPanel;
|
---|
41 | class UIVMLogViewerSearchPanel;
|
---|
42 |
|
---|
43 | /* Type definitions: */
|
---|
44 | typedef QMap<QString, UIVMLogViewer*> VMLogViewerMap;
|
---|
45 | typedef QPair<QString, QTextEdit*> LogPage;
|
---|
46 | typedef QList<LogPage> LogBook;
|
---|
47 | typedef QMap<QTextEdit*, QString> VMLogMap;
|
---|
48 |
|
---|
49 | /** QMainWindow extension
|
---|
50 | * providing GUI with VirtualBox LogViewer. */
|
---|
51 | class UIVMLogViewer : public QIWithRetranslateUI2<QMainWindow>,
|
---|
52 | public Ui::UIVMLogViewer
|
---|
53 | {
|
---|
54 | Q_OBJECT;
|
---|
55 |
|
---|
56 | public:
|
---|
57 |
|
---|
58 | /** Static method to create/show VM Log Viewer by passing @a pParent to QWidget base-class constructor.
|
---|
59 | * @param machine Specifies the machine for which VM Log-Viewer is requested. */
|
---|
60 | static void showLogViewerFor(QWidget *pParent, const CMachine &machine);
|
---|
61 |
|
---|
62 | protected:
|
---|
63 |
|
---|
64 | /** Constructs the VM Log-Viewer by passing @a pParent to QWidget base-class constructor.
|
---|
65 | * @param flags Specifies Qt window flags.
|
---|
66 | * @param machine Specifies the machine for which VM Log-Viewer is requested. */
|
---|
67 | UIVMLogViewer(QWidget *pParent, Qt::WindowFlags flags, const CMachine &machine);
|
---|
68 | /** Destructs the VM Log-Viewer. */
|
---|
69 | ~UIVMLogViewer();
|
---|
70 |
|
---|
71 | private slots:
|
---|
72 |
|
---|
73 | /** Handles search action triggering. */
|
---|
74 | void search();
|
---|
75 | /** Handles refresh action triggering. */
|
---|
76 | void refresh();
|
---|
77 | /** Handles close action triggering. */
|
---|
78 | bool close();
|
---|
79 | /** Handles save action triggering. */
|
---|
80 | void save();
|
---|
81 | /** Handles filter action triggering. */
|
---|
82 | void filter();
|
---|
83 |
|
---|
84 | private:
|
---|
85 |
|
---|
86 | /** @name Prepare/Cleanup
|
---|
87 | * @{ */
|
---|
88 | /** Prepares VM Log-Viewer. */
|
---|
89 | void prepare();
|
---|
90 | /** Prepares widgets. */
|
---|
91 | void prepareWidgets();
|
---|
92 | /** Prepares connections. */
|
---|
93 | void prepareConnections();
|
---|
94 | /** Load settings helper. */
|
---|
95 | void loadSettings();
|
---|
96 |
|
---|
97 | /** Save settings helper. */
|
---|
98 | void saveSettings();
|
---|
99 | /** Cleanups VM Log-Viewer. */
|
---|
100 | void cleanup();
|
---|
101 | /** @} */
|
---|
102 |
|
---|
103 | /** @name Event handling stuff.
|
---|
104 | * @{ */
|
---|
105 | /** Handles translation event. */
|
---|
106 | void retranslateUi();
|
---|
107 |
|
---|
108 | /** Handles Qt show @a pEvent. */
|
---|
109 | void showEvent(QShowEvent *pEvent);
|
---|
110 | /** Handles Qt key-press @a pEvent. */
|
---|
111 | void keyPressEvent(QKeyEvent *pEvent);
|
---|
112 | /** @} */
|
---|
113 |
|
---|
114 | /** Returns the current log-page. */
|
---|
115 | QTextEdit* currentLogPage();
|
---|
116 | /** Returns the newly created log-page using @a strPage filename. */
|
---|
117 | QTextEdit* createLogPage(const QString &strPage);
|
---|
118 | /** Returns the content of current log-page. */
|
---|
119 | const QString& currentLog();
|
---|
120 |
|
---|
121 | /** Holds the list of all VM Log Viewers. */
|
---|
122 | static VMLogViewerMap m_viewers;
|
---|
123 |
|
---|
124 | /** Holds whether the dialog is polished. */
|
---|
125 | bool m_fIsPolished;
|
---|
126 |
|
---|
127 | /** Holds the machine instance. */
|
---|
128 | CMachine m_machine;
|
---|
129 |
|
---|
130 | /** Holds container for log-pages. */
|
---|
131 | QITabWidget *m_pViewerContainer;
|
---|
132 |
|
---|
133 | /** Holds the instance of search-panel. */
|
---|
134 | UIVMLogViewerSearchPanel *m_pSearchPanel;
|
---|
135 |
|
---|
136 | /** Holds the list of log-pages. */
|
---|
137 | LogBook m_book;
|
---|
138 |
|
---|
139 | /** Holds the instance of filter panel. */
|
---|
140 | UIVMLogViewerFilterPanel *m_pFilterPanel;
|
---|
141 |
|
---|
142 | /** Holds the list of log-content. */
|
---|
143 | VMLogMap m_logMap;
|
---|
144 |
|
---|
145 | /** Holds the current dialog geometry. */
|
---|
146 | QRect m_geometry;
|
---|
147 |
|
---|
148 | /** Holds the help button instance. */
|
---|
149 | QPushButton *m_pButtonHelp;
|
---|
150 | /** Holds the find button instance. */
|
---|
151 | QPushButton *m_pButtonFind;
|
---|
152 | /** Holds the refresh button instance. */
|
---|
153 | QPushButton *m_pButtonRefresh;
|
---|
154 | /** Holds the close button instance. */
|
---|
155 | QPushButton *m_pButtonClose;
|
---|
156 | /** Holds the save button instance. */
|
---|
157 | QPushButton *m_pButtonSave;
|
---|
158 | /** Holds the filter button instance. */
|
---|
159 | QPushButton *m_pButtonFilter;
|
---|
160 |
|
---|
161 | friend class UIVMLogViewerSearchPanel;
|
---|
162 | friend class UIVMLogViewerFilterPanel;
|
---|
163 | };
|
---|
164 |
|
---|
165 | #endif /* !___UIVMLogViewer_h___ */
|
---|
166 |
|
---|