Terminal core (src/core, QtCore only, headless testable): - VT100/xterm parser: CSI/OSC/DCS, SGR 256/truecolor, scroll regions, insert/delete, DEC special graphics, alternate screen - cell grid with 5000 line scrollback, CJK wide chars, combining marks - xterm 256 color palette Terminal widget (src/term): - QPainter renderer with run batching, wide char clipping, cursor blink - mouse selection (char/word/line), auto copy, middle click paste - full key encoding: arrows + DECCKM, F1-F12, modifiers, ctrl/alt - IME support via inputMethodEvent Transports (src/session): - SSH through the system OpenSSH client on a forkpty pseudo terminal, so agent, ProxyJump, known_hosts and 2FA keep working - Telnet with IAC negotiation (NAWS, ECHO, SGA) - Serial via QSerialPort UI (src/ui): - tabbed main window, session dialog with saved profiles - dark violet theme, CLI targets (user@host:port, telnet://, serial:) Tests: - tests/test_core: escape sequence and layout assertions - tests/test_widget: offscreen render checks and key encoding
43 lines
990 B
C++
43 lines
990 B
C++
#pragma once
|
|
|
|
#include "SessionSpec.h"
|
|
#include "Transport.h"
|
|
|
|
#include <QSet>
|
|
|
|
class QTcpSocket;
|
|
|
|
namespace vx {
|
|
|
|
class TelnetTransport : public Transport
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit TelnetTransport(const SessionSpec &spec, QObject *parent = nullptr);
|
|
|
|
bool start(int cols, int rows) override;
|
|
void write(const QByteArray &data) override;
|
|
void resizeTerminal(int cols, int rows) override;
|
|
QString description() const override { return m_description; }
|
|
|
|
private:
|
|
enum State { Data, Iac, Will, Wont, Do, Dont, Sub, SubIac };
|
|
enum Option { OptEcho = 1, OptSga = 3, OptTtype = 24, OptNaws = 31 };
|
|
|
|
void onReadyRead();
|
|
void sendCommand(char command, char option);
|
|
void sendWindowSize();
|
|
|
|
SessionSpec m_spec;
|
|
QString m_description;
|
|
QTcpSocket *m_socket = nullptr;
|
|
State m_state = Data;
|
|
int m_columns = 80;
|
|
int m_rows = 24;
|
|
bool m_naws = false;
|
|
QSet<int> m_negotiated;
|
|
QByteArray m_pendingOut;
|
|
};
|
|
|
|
} // namespace vx
|