Internal
Public Access
58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
#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
|