Internal
Public Access
Add threaded session backend architecture with real SSH backend
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#ifndef ORBITHUB_SESSION_BACKEND_H
|
||||
#define ORBITHUB_SESSION_BACKEND_H
|
||||
|
||||
#include "profile_repository.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class SessionConnectOptions
|
||||
{
|
||||
public:
|
||||
QString password;
|
||||
QString privateKeyPath;
|
||||
QString knownHostsPolicy;
|
||||
};
|
||||
|
||||
enum class SessionState {
|
||||
Disconnected,
|
||||
Connecting,
|
||||
Connected,
|
||||
Failed,
|
||||
};
|
||||
|
||||
class SessionBackend : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SessionBackend(const Profile& profile, QObject* parent = nullptr)
|
||||
: QObject(parent), m_profile(profile)
|
||||
{
|
||||
}
|
||||
~SessionBackend() override = default;
|
||||
|
||||
const Profile& profile() const
|
||||
{
|
||||
return m_profile;
|
||||
}
|
||||
|
||||
public slots:
|
||||
virtual void connectSession(const SessionConnectOptions& options) = 0;
|
||||
virtual void disconnectSession() = 0;
|
||||
virtual void reconnectSession(const SessionConnectOptions& options) = 0;
|
||||
|
||||
signals:
|
||||
void stateChanged(SessionState state, const QString& message);
|
||||
void eventLogged(const QString& message);
|
||||
void connectionError(const QString& displayMessage, const QString& rawMessage);
|
||||
|
||||
private:
|
||||
Profile m_profile;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(SessionConnectOptions)
|
||||
Q_DECLARE_METATYPE(SessionState)
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user