Internal
Public Access
QWidget's default handling intercepts Tab/Shift+Tab for focus-chain navigation before they ever reach keyPressEvent(), so pressing Tab in an RDP session moved focus to the OrbitHub UI (e.g. the Show Events button) instead of reaching the remote machine. KodoTerm (SSH) already overrides focusNextPrevChild() to opt out of this; RdpDisplayWidget and TerminalView did not. Both already handle Key_Tab in their own keyPressEvent, so this is enough to let it reach them. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
69 lines
1.7 KiB
C++
69 lines
1.7 KiB
C++
#ifndef ORBITHUB_TERMINAL_VIEW_H
|
|
#define ORBITHUB_TERMINAL_VIEW_H
|
|
|
|
#include <QTextEdit>
|
|
|
|
#include <array>
|
|
|
|
class QKeyEvent;
|
|
class QFocusEvent;
|
|
class QResizeEvent;
|
|
|
|
class TerminalView : public QTextEdit
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit TerminalView(QWidget* parent = nullptr);
|
|
|
|
static QStringList themeNames();
|
|
void setThemeName(const QString& themeName);
|
|
void appendTerminalData(const QString& data);
|
|
void setFontPointSize(int pointSize);
|
|
|
|
signals:
|
|
void inputGenerated(const QString& input);
|
|
void terminalSizeChanged(int columns, int rows);
|
|
|
|
protected:
|
|
void keyPressEvent(QKeyEvent* event) override;
|
|
void focusInEvent(QFocusEvent* event) override;
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
bool focusNextPrevChild(bool next) override;
|
|
|
|
private:
|
|
struct ThemePalette {
|
|
QString name;
|
|
QColor background;
|
|
QColor foreground;
|
|
std::array<QColor, 8> normal;
|
|
std::array<QColor, 8> bright;
|
|
};
|
|
|
|
ThemePalette m_palette;
|
|
QString m_pendingEscape;
|
|
QString m_rawHistory;
|
|
bool m_bold;
|
|
bool m_hasFgColor;
|
|
bool m_hasBgColor;
|
|
QColor m_fgColor;
|
|
QColor m_bgColor;
|
|
QTextCharFormat m_currentFormat;
|
|
|
|
static ThemePalette paletteByName(const QString& themeName);
|
|
static QColor colorFrom256Index(int index);
|
|
|
|
void applyThemePalette(const ThemePalette& palette);
|
|
void applyCurrentFormat();
|
|
void resetSgrState();
|
|
void handleSgrSequence(const QString& params);
|
|
void appendTextChunk(const QString& text);
|
|
QColor paletteColor(bool background, int index, bool bright) const;
|
|
void processData(const QString& data, bool storeInHistory);
|
|
int terminalColumns() const;
|
|
int terminalRows() const;
|
|
void emitTerminalSize();
|
|
};
|
|
|
|
#endif
|