The dockable "Process output" console: numbered, colour-coded lines of git/pass/gpg output with a line cap and sticky auto-scroll.
More...
#include <processoutputpanel.h>
|
| void | clear () |
| | Drop all output, reset the counter, re-arm auto-scroll.
|
|
| | ProcessOutputPanel (QWidget *parent=nullptr) |
| | Build the console (Clear button + read-only text edit).
|
| void | append (const QString &output, bool isError, const QString &linePrefix=QString()) |
| | Append output, one numbered line per non-empty input line.
|
| auto | lineCount () const -> int |
| | Number of lines appended since the last clear().
|
| auto | autoScroll () const -> bool |
| | Whether new output scrolls the view to the bottom.
|
|
| static auto | processName (Enums::PROCESS pid) -> QString |
| | Human-readable command label for a process id.
|
| 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, pass insert; pass grep, should it ever run again).
|
|
| static constexpr int | MaxLines = 1000 |
| | Oldest lines are dropped once the document holds more than this.
|
|
| void | limitLines () |
| | Drop the oldest text blocks once the document holds more than MaxLines; called after every append().
|
|
| QTextEdit * | m_edit = nullptr |
| | Read-only text edit holding the output; child of the dock.
|
| QToolButton * | m_clearButton = nullptr |
| | The "Clear" button wired to clear().
|
| int | m_counter = 0 |
| | Running line number shown in front of each line; reset by clear(). Keeps counting past MaxLines.
|
| bool | m_autoScroll = true |
| | Whether append() scrolls to the bottom: cleared when the user scrolls up, set again when the scroll bar reaches its maximum or on clear(). Only updated on slider release while dragging.
|
The dockable "Process output" console: numbered, colour-coded lines of git/pass/gpg output with a line cap and sticky auto-scroll.
A QDockWidget at the bottom dock area is the conventional place for an IDE-style console and gives users detach/move for free. The panel knows nothing about settings or the tree; MainWindow decides when to feed it and when to show it.
Definition at line 30 of file processoutputpanel.h.
◆ ProcessOutputPanel()
| ProcessOutputPanel::ProcessOutputPanel |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Build the console (Clear button + read-only text edit).
- Parameters
-
| parent | The main window; it adds the dock to an area itself. |
Definition at line 17 of file processoutputpanel.cpp.
◆ append()
| void ProcessOutputPanel::append |
( |
const QString & | output, |
|
|
bool | isError, |
|
|
const QString & | linePrefix = QString() ) |
Append output, one numbered line per non-empty input line.
Lines are right-trimmed (CR and trailing whitespace), empty ones are skipped, and each gets the running counter and, when given, the command prefix so multi-line output stays attributed. Errors are red. Keeps the view at the bottom unless the user scrolled up.
- Parameters
-
| output | Raw stdout/stderr text. |
| isError | true for stderr styling. |
| linePrefix | Command label, e.g. "git push"; empty for none. |
Definition at line 59 of file processoutputpanel.cpp.
◆ autoScroll()
| auto ProcessOutputPanel::autoScroll |
( |
| ) |
const -> bool |
|
inlinenodiscard |
Whether new output scrolls the view to the bottom.
- Returns
- false after the user scrolled up, true again at the bottom or after clear().
Definition at line 68 of file processoutputpanel.h.
◆ clear
| void ProcessOutputPanel::clear |
( |
| ) |
|
|
slot |
◆ isSensitiveProcess()
| auto ProcessOutputPanel::isSensitiveProcess |
( |
Enums::PROCESS | pid | ) |
-> bool |
|
static |
Whether a process's output may carry secrets and must never reach this long-lived panel (pass show, pass insert; pass grep, should it ever run again).
- Parameters
-
- Returns
- true when the output must be dropped.
Definition at line 120 of file processoutputpanel.cpp.
◆ limitLines()
| void ProcessOutputPanel::limitLines |
( |
| ) |
|
|
private |
◆ lineCount()
| auto ProcessOutputPanel::lineCount |
( |
| ) |
const -> int |
|
inlinenodiscard |
Number of lines appended since the last clear().
- Returns
- The running counter shown as the line number.
Definition at line 61 of file processoutputpanel.h.
◆ processName()
Human-readable command label for a process id.
- Parameters
-
- Returns
- e.g. "git push"; empty for processes that are never shown.
Definition at line 116 of file processoutputpanel.cpp.
◆ m_autoScroll
| bool ProcessOutputPanel::m_autoScroll = true |
|
private |
Whether append() scrolls to the bottom: cleared when the user scrolls up, set again when the scroll bar reaches its maximum or on clear(). Only updated on slider release while dragging.
Definition at line 113 of file processoutputpanel.h.
◆ m_clearButton
| QToolButton* ProcessOutputPanel::m_clearButton = nullptr |
|
private |
◆ m_counter
| int ProcessOutputPanel::m_counter = 0 |
|
private |
◆ m_edit
| QTextEdit* ProcessOutputPanel::m_edit = nullptr |
|
private |
◆ MaxLines
| int ProcessOutputPanel::MaxLines = 1000 |
|
staticconstexpr |
Oldest lines are dropped once the document holds more than this.
Definition at line 35 of file processoutputpanel.h.
The documentation for this class was generated from the following files: