Files
qt6-migration-pipeline/Lts/Common/LtsProjectionWorkstation/vnc_server_manager.h
T

70 lines
1006 B
C++
Executable File

#pragma once
#include <QObject>
#include <QProcess>
#include <QRect>
#include <QString>
#include <QVector>
#include "logger.h"
class QScreen;
namespace LtsProjectionWorkstation
{
class SingleShotProcess
{
public:
explicit SingleShotProcess(const QString &cmd, bool startImmediatly = false);
bool execute();
private:
QProcess m_process;
QString m_cmd;
};
struct VncScreen
{
QString name;
QProcess *proc = nullptr;
QRect geometry;
quint16 port = 0;
};
class VncServerManager : public QObject
{
Q_OBJECT
public:
explicit VncServerManager(LOGGER_T &logger, QObject *parent = nullptr);
~VncServerManager();
bool init(const QList<QScreen *> &screens);
const QVector<VncScreen> &screens() const { return m_vncScreens; }
void startScreens();
void stopScreens();
void killScreens();
void createPwdFile();
private slots:
void slotReadStandardOutput();
void slotErrorOccured();
private:
QVector<VncScreen> m_vncScreens;
LOGGER_T &m_logger;
};
}