QtPass
2.0.0
Developer documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
processoutputpanel.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2026 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
8
#ifndef SRC_PROCESSOUTPUTPANEL_H_
9
#define SRC_PROCESSOUTPUTPANEL_H_
10
11
#include "
enums.h
"
12
#include <QDockWidget>
13
#include <QString>
14
15
class
QTextEdit;
16
class
QToolButton;
17
30
class
ProcessOutputPanel
:
public
QDockWidget {
31
Q_OBJECT
32
33
public
:
35
static
constexpr
int
MaxLines
= 1000;
36
41
explicit
ProcessOutputPanel
(QWidget *parent =
nullptr
);
42
54
void
append
(
const
QString &output,
bool
isError,
55
const
QString &linePrefix = QString());
56
61
[[nodiscard]]
auto
lineCount
() const ->
int
{
return
m_counter
; }
62
68
[[nodiscard]]
auto
autoScroll
() const ->
bool
{
return
m_autoScroll
; }
69
75
static
auto
processName
(
Enums::PROCESS
pid) -> QString;
76
84
static
auto
isSensitiveProcess
(
Enums::PROCESS
pid) -> bool;
85
86
public
slots:
90
void
clear
();
91
92
private
:
97
void
limitLines
();
98
100
QTextEdit *
m_edit
=
nullptr
;
102
QToolButton *
m_clearButton
=
nullptr
;
107
int
m_counter
= 0;
113
bool
m_autoScroll
=
true
;
114
};
115
116
#endif
// SRC_PROCESSOUTPUTPANEL_H_
ProcessOutputPanel::MaxLines
static constexpr int MaxLines
Oldest lines are dropped once the document holds more than this.
Definition
processoutputpanel.h:35
ProcessOutputPanel::limitLines
void limitLines()
Drop the oldest text blocks once the document holds more than MaxLines; called after every append().
Definition
processoutputpanel.cpp:98
ProcessOutputPanel::isSensitiveProcess
static auto isSensitiveProcess(Enums::PROCESS pid) -> bool
Whether a process's output may carry secrets and must never reach this long-lived panel (pass show,...
Definition
processoutputpanel.cpp:120
ProcessOutputPanel::clear
void clear()
Drop all output, reset the counter, re-arm auto-scroll.
Definition
processoutputpanel.cpp:110
ProcessOutputPanel::m_counter
int m_counter
Running line number shown in front of each line; reset by clear(). Keeps counting past MaxLines.
Definition
processoutputpanel.h:107
ProcessOutputPanel::ProcessOutputPanel
ProcessOutputPanel(QWidget *parent=nullptr)
Build the console (Clear button + read-only text edit).
Definition
processoutputpanel.cpp:17
ProcessOutputPanel::processName
static auto processName(Enums::PROCESS pid) -> QString
Human-readable command label for a process id.
Definition
processoutputpanel.cpp:116
ProcessOutputPanel::m_autoScroll
bool m_autoScroll
Whether append() scrolls to the bottom: cleared when the user scrolls up, set again when the scroll b...
Definition
processoutputpanel.h:113
ProcessOutputPanel::lineCount
auto lineCount() const -> int
Number of lines appended since the last clear().
Definition
processoutputpanel.h:61
ProcessOutputPanel::autoScroll
auto autoScroll() const -> bool
Whether new output scrolls the view to the bottom.
Definition
processoutputpanel.h:68
ProcessOutputPanel::m_edit
QTextEdit * m_edit
Read-only text edit holding the output; child of the dock.
Definition
processoutputpanel.h:100
ProcessOutputPanel::m_clearButton
QToolButton * m_clearButton
The "Clear" button wired to clear().
Definition
processoutputpanel.h:102
ProcessOutputPanel::append
void append(const QString &output, bool isError, const QString &linePrefix=QString())
Append output, one numbered line per non-empty input line.
Definition
processoutputpanel.cpp:59
enums.h
The Enums namespace: clipboard behaviour and the identifiers of the subprocess kinds QtPass queues.
Enums::PROCESS
PROCESS
Identifies different subprocess operations used in QtPass.
Definition
enums.h:43
src
processoutputpanel.h
Generated by
1.18.0