2021-04-22 07:29:46 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2021 Symless Ltd.
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2021-04-22 07:29:46 +00:00
|
|
|
*/
|
|
|
|
|
|
2024-08-07 14:05:18 +00:00
|
|
|
#pragma once
|
2021-04-22 07:29:46 +00:00
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
2024-08-07 14:05:18 +00:00
|
|
|
#include "gui/config/IServerConfig.h"
|
2024-08-10 23:58:24 +00:00
|
|
|
#include "gui/config/ServerConfigDialogState.h"
|
2024-08-08 17:41:59 +00:00
|
|
|
#include "gui/messages.h"
|
2021-04-22 07:29:46 +00:00
|
|
|
|
2024-09-17 19:00:25 +00:00
|
|
|
namespace deskflow::gui {
|
2024-08-07 14:05:18 +00:00
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
class ServerConnection : public QObject
|
|
|
|
|
{
|
2024-08-07 14:05:18 +00:00
|
|
|
Q_OBJECT
|
2024-09-17 19:00:25 +00:00
|
|
|
using IServerConfig = deskflow::gui::IServerConfig;
|
2021-04-22 07:29:46 +00:00
|
|
|
|
|
|
|
|
public:
|
2024-10-17 18:04:35 +00:00
|
|
|
struct Deps
|
|
|
|
|
{
|
2024-08-08 17:41:59 +00:00
|
|
|
virtual ~Deps() = default;
|
2025-02-15 04:37:15 +00:00
|
|
|
virtual messages::NewClientPromptResult
|
2025-02-17 19:16:20 +00:00
|
|
|
showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth = false) const;
|
2024-08-08 17:41:59 +00:00
|
|
|
};
|
|
|
|
|
|
2024-08-07 14:05:18 +00:00
|
|
|
explicit ServerConnection(
|
2025-03-08 16:41:14 +00:00
|
|
|
QWidget *parent, IServerConfig &serverConfig, const config::ServerConfigDialogState &serverConfigDialogState,
|
2024-10-17 18:04:35 +00:00
|
|
|
std::shared_ptr<Deps> deps = std::make_shared<Deps>()
|
|
|
|
|
);
|
2024-08-08 17:41:59 +00:00
|
|
|
void handleLogLine(const QString &logLine);
|
2021-04-22 07:29:46 +00:00
|
|
|
|
2024-08-07 14:05:18 +00:00
|
|
|
signals:
|
2024-08-08 17:41:59 +00:00
|
|
|
void messageShowing();
|
2024-08-07 14:05:18 +00:00
|
|
|
void configureClient(const QString &clientName);
|
|
|
|
|
|
2021-04-22 07:29:46 +00:00
|
|
|
private:
|
2024-08-08 17:41:59 +00:00
|
|
|
void handleNewClient(const QString &clientName);
|
2024-08-07 14:05:18 +00:00
|
|
|
|
2024-08-08 17:41:59 +00:00
|
|
|
QWidget *m_pParent;
|
2024-08-07 14:05:18 +00:00
|
|
|
IServerConfig &m_serverConfig;
|
2024-08-10 23:58:24 +00:00
|
|
|
const config::ServerConfigDialogState &m_serverConfigDialogState;
|
2024-08-08 17:41:59 +00:00
|
|
|
std::shared_ptr<Deps> m_pDeps;
|
2024-08-09 18:20:10 +00:00
|
|
|
QStringList m_receivedClients;
|
|
|
|
|
bool m_messageShowing = false;
|
2021-04-22 07:29:46 +00:00
|
|
|
};
|
|
|
|
|
|
2024-09-17 19:00:25 +00:00
|
|
|
} // namespace deskflow::gui
|