NDEVR
API Documentation
TerminalDialog

Provides the user access to sending or receiving data to a specified connection over a terminal interface. More...

Inheritance diagram for TerminalDialog:
[legend]
Collaboration diagram for TerminalDialog:
[legend]

Public Member Functions

 TerminalDialog (QWidget *parent=nullptr)
 Constructs a TerminalDialog.
virtual ~TerminalDialog ()
 Destructor.
void addMessage (uint04 id, const LogMessage &message) override
 Adds a log message to the terminal display queue.
void putData (const StringView &data)
 Writes data to the terminal display.
void setAsLogger (InfoPipe *log)
 Configures the terminal as a log output for an InfoPipe.
void setAutoEcho (bool auto_echo)
 Sets whether sent commands are automatically echoed to the terminal display.
void setAutoPullData (bool set)
 Sets whether the terminal automatically polls the connection for data.
void setCommandTermination (const StringView &termination)
 Sets the string appended to commands when sent to the connection.
void setConnection (Connection *connection, bool add_all)
 Sets the connection to an existing Connection object.
void setConnection (const ConnectionInfo &info)
 Sets the connection using connection info, creating a new connection.
void setProgress (uint04, fltp04) override
 No-op implementation of LogStream progress reporting.
void setPushDataOnEnter (bool set)
 Sets whether pressing Enter sends the current input to the connection.
Public Member Functions inherited from LogStream
virtual ~LogStream ()
 Destructor.
virtual void addMessages (uint04 id, const Buffer< LogMessage > &messages)
 Adds multiple log messages to this stream at once.
virtual void addProgressSource (const TranslatedString &name, uint04 idx, fltp04 progress)
 Registers a new progress source to be tracked by this stream.
virtual void allowCancel (bool)
 Sets whether this stream allows the user to cancel an in-progress operation.
virtual void allowInput (bool)
 Sets whether this stream allows user input during an operation.
virtual void attach (InfoPipe *stream)
 Attaches this LogStream to the given InfoPipe so it receives log updates.
void clearLinks ()
 Detaches this LogStream from all linked InfoPipe objects and clears the link list.
virtual void detach (InfoPipe *stream)
 Detaches this LogStream from the given InfoPipe, stopping further updates from it.
bool ignoringMessages () const
 Returns whether this stream is currently ignoring messages.
virtual void removeProgressSource (uint04 idx)
 Removes a previously registered progress source from this stream.
void setIgnoreMessages (bool ignore)
 Sets whether this stream should ignore incoming messages.

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *e) override
 Handles context menu events for copy/paste operations.
void keyPressEvent (QKeyEvent *e) override
 Handles key press events for terminal input.
void mouseDoubleClickEvent (QMouseEvent *e) override
 Handles mouse double-click events for text selection.
void mousePressEvent (QMouseEvent *e) override
 Handles mouse press events for cursor positioning.
void pullDataSlot ()
 Slot that polls the connection for new data.
void showEvent (QShowEvent *e) override
 Handles the widget show event and starts data pulling if configured.

Additional Inherited Members

Protected Attributes inherited from LogStream
bool m_ignore_message = false
 Whether this stream should ignore incoming messages.
Buffer< InfoPipe * > m_linked_logs
 Collection of InfoPipe objects this stream is listening to.
Dictionary< uint04, ProgressSourcem_progress_sources
 Maps progress source indices to their ProgressSource data.

Detailed Description

Provides the user access to sending or receiving data to a specified connection over a terminal interface.


Terminal supports ANSI escape codes as well as correct return carriage behavior. Default look is a black background with white text.

The Terminal can passively listen to a connection or actively request the connection for information using Connection::rx(). If the connection is shared by a Device that is expected to pull the data , setAutoPullData using false. If this connection needs to be actively polled, setAutoPullData using true. In addition to looking at a connection, the Terminal can also be set as a log. This can be used with logs sent by ApplicationManager to pipe the results of running an application.

Terminal fully supports ANSI escape codes: https://en.wikipedia.org/wiki/ANSI_escape_code with the exception of cursor settings.

Definition at line 30 of file TerminalDialog.h.

Constructor & Destructor Documentation

◆ TerminalDialog()

TerminalDialog::TerminalDialog ( QWidget * parent = nullptr)
explicit

Constructs a TerminalDialog.

Parameters
[in]parentThe parent widget.

◆ ~TerminalDialog()

virtual TerminalDialog::~TerminalDialog ( )
virtual

Destructor.

Cleans up the connection if owned.

Member Function Documentation

◆ addMessage()

void TerminalDialog::addMessage ( uint04 id,
const LogMessage & message )
overridevirtual

Adds a log message to the terminal display queue.

Parameters
[in]idThe message identifier.
[in]messageThe LogMessage to display.

Implements LogStream.

◆ contextMenuEvent()

void TerminalDialog::contextMenuEvent ( QContextMenuEvent * e)
overrideprotected

Handles context menu events for copy/paste operations.

Parameters
[in]eThe context menu event.

◆ keyPressEvent()

void TerminalDialog::keyPressEvent ( QKeyEvent * e)
overrideprotected

Handles key press events for terminal input.

Parameters
[in]eThe key event.

◆ mouseDoubleClickEvent()

void TerminalDialog::mouseDoubleClickEvent ( QMouseEvent * e)
overrideprotected

Handles mouse double-click events for text selection.

Parameters
[in]eThe mouse event.

◆ mousePressEvent()

void TerminalDialog::mousePressEvent ( QMouseEvent * e)
overrideprotected

Handles mouse press events for cursor positioning.

Parameters
[in]eThe mouse event.

◆ putData()

void TerminalDialog::putData ( const StringView & data)

Writes data to the terminal display.

Parameters
[in]dataThe data string to display.

◆ setAsLogger()

void TerminalDialog::setAsLogger ( InfoPipe * log)

Configures the terminal as a log output for an InfoPipe.

Parameters
[in]logThe InfoPipe to receive log messages from.

◆ setAutoEcho()

void TerminalDialog::setAutoEcho ( bool auto_echo)

Sets whether sent commands are automatically echoed to the terminal display.

Parameters
[in]auto_echoWhether to enable auto-echo.

◆ setAutoPullData()

void TerminalDialog::setAutoPullData ( bool set)

Sets whether the terminal automatically polls the connection for data.

Parameters
[in]setWhether to enable automatic data pulling.

◆ setCommandTermination()

void TerminalDialog::setCommandTermination ( const StringView & termination)

Sets the string appended to commands when sent to the connection.

Parameters
[in]terminationThe command termination string (e.g., newline).

◆ setConnection() [1/2]

void TerminalDialog::setConnection ( Connection * connection,
bool add_all )

Sets the connection to an existing Connection object.

Parameters
[in]connectionThe Connection to attach to.
[in]add_allWhether to display all existing data from the connection.

◆ setConnection() [2/2]

void TerminalDialog::setConnection ( const ConnectionInfo & info)

Sets the connection using connection info, creating a new connection.

Parameters
[in]infoThe ConnectionInfo describing the connection to establish.

◆ setPushDataOnEnter()

void TerminalDialog::setPushDataOnEnter ( bool set)

Sets whether pressing Enter sends the current input to the connection.

Parameters
[in]setWhether to push data on Enter key press.

◆ showEvent()

void TerminalDialog::showEvent ( QShowEvent * e)
overrideprotected

Handles the widget show event and starts data pulling if configured.

Parameters
[in]eThe show event.

The documentation for this class was generated from the following file: