#ifndef ORBITHUB_SESSION_TAB_H #define ORBITHUB_SESSION_TAB_H #include "profile_repository.h" #include "session_backend.h" #include #include class QLabel; class QPlainTextEdit; class QPushButton; class QThread; class SessionBackend; class SessionTab : public QWidget { Q_OBJECT public: explicit SessionTab(const Profile& profile, QWidget* parent = nullptr); ~SessionTab() override; QString tabTitle() const; signals: void tabTitleChanged(const QString& title); void requestConnect(const SessionConnectOptions& options); void requestDisconnect(); void requestReconnect(const SessionConnectOptions& options); private slots: void onConnectClicked(); void onDisconnectClicked(); void onReconnectClicked(); void onCopyErrorClicked(); void onBackendStateChanged(SessionState state, const QString& message); void onBackendEventLogged(const QString& message); void onBackendConnectionError(const QString& displayMessage, const QString& rawMessage); private: Profile m_profile; QThread* m_backendThread; SessionBackend* m_backend; SessionState m_state; QString m_lastError; QLabel* m_statusLabel; QLabel* m_errorLabel; QPlainTextEdit* m_eventLog; QPushButton* m_connectButton; QPushButton* m_disconnectButton; QPushButton* m_reconnectButton; QPushButton* m_copyErrorButton; void setupUi(); std::optional buildConnectOptions(); bool validateProfileForConnect(); void appendEvent(const QString& message); void setState(SessionState state, const QString& message); QString stateSuffix() const; void refreshActionButtons(); }; #endif