1 | /* $Id: UIVMLogViewerPanel.cpp 76954 2019-01-23 12:56:07Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIVMLogViewer class implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2019 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 | /* Qt includes: */
|
---|
19 | #include <QComboBox>
|
---|
20 | #include <QHBoxLayout>
|
---|
21 | #include <QLabel>
|
---|
22 | #include <QPlainTextEdit>
|
---|
23 | #include <QTextCursor>
|
---|
24 | #include <QToolButton>
|
---|
25 |
|
---|
26 | /* GUI includes: */
|
---|
27 | #include "QIToolButton.h"
|
---|
28 | #include "UIIconPool.h"
|
---|
29 | #include "UIVMLogPage.h"
|
---|
30 | #include "UIVMLogViewerPanel.h"
|
---|
31 | #include "UIVMLogViewerWidget.h"
|
---|
32 | #ifdef VBOX_WS_MAC
|
---|
33 | # include "VBoxUtils-darwin.h"
|
---|
34 | #endif
|
---|
35 |
|
---|
36 |
|
---|
37 | UIVMLogViewerPanel::UIVMLogViewerPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)
|
---|
38 | : UIDialogPanel(pParent)
|
---|
39 | , m_pViewer(pViewer)
|
---|
40 | {
|
---|
41 | }
|
---|
42 |
|
---|
43 | void UIVMLogViewerPanel::retranslateUi()
|
---|
44 | {
|
---|
45 | }
|
---|
46 |
|
---|
47 | UIVMLogViewerWidget* UIVMLogViewerPanel::viewer()
|
---|
48 | {
|
---|
49 | return m_pViewer;
|
---|
50 | }
|
---|
51 |
|
---|
52 | const UIVMLogViewerWidget* UIVMLogViewerPanel::viewer() const
|
---|
53 | {
|
---|
54 | return m_pViewer;
|
---|
55 | }
|
---|
56 |
|
---|
57 | QTextDocument *UIVMLogViewerPanel::textDocument()
|
---|
58 | {
|
---|
59 | QPlainTextEdit *pEdit = textEdit();
|
---|
60 | if (!pEdit)
|
---|
61 | return 0;
|
---|
62 | return textEdit()->document();
|
---|
63 | }
|
---|
64 |
|
---|
65 | QPlainTextEdit *UIVMLogViewerPanel::textEdit()
|
---|
66 | {
|
---|
67 | if (!viewer())
|
---|
68 | return 0;
|
---|
69 | UIVMLogPage *logPage = viewer()->currentLogPage();
|
---|
70 | if (!logPage)
|
---|
71 | return 0;
|
---|
72 | return logPage->textEdit();
|
---|
73 | }
|
---|
74 |
|
---|
75 | const QString* UIVMLogViewerPanel::logString() const
|
---|
76 | {
|
---|
77 | if (!viewer())
|
---|
78 | return 0;
|
---|
79 | const UIVMLogPage* const page = qobject_cast<const UIVMLogPage* const>(viewer()->currentLogPage());
|
---|
80 | if (!page)
|
---|
81 | return 0;
|
---|
82 | return &(page->logString());
|
---|
83 | }
|
---|