2021-04-22 14:00:42 +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 14:00:42 +00:00
|
|
|
*/
|
|
|
|
|
|
2024-08-07 14:05:18 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-08-08 17:41:59 +00:00
|
|
|
#include "gui/config/IAppConfig.h"
|
2021-04-22 14:00:42 +00:00
|
|
|
|
2024-08-08 17:41:59 +00:00
|
|
|
#include "gui/messages.h"
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
2021-04-22 14:00:42 +00:00
|
|
|
#include <QString>
|
2024-08-07 14:05:18 +00:00
|
|
|
#include <QWidget>
|
2024-08-08 17:41:59 +00:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
class QWidget;
|
2021-04-22 14:00:42 +00:00
|
|
|
|
2024-09-17 19:00:25 +00:00
|
|
|
namespace deskflow::gui {
|
2021-04-22 14:00:42 +00:00
|
|
|
|
2024-10-17 18:04:35 +00:00
|
|
|
class ClientConnection : public QObject
|
|
|
|
|
{
|
2024-08-08 17:41:59 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
2021-04-22 14:00:42 +00:00
|
|
|
public:
|
2024-10-17 18:04:35 +00:00
|
|
|
struct Deps
|
|
|
|
|
{
|
2024-08-08 17:41:59 +00:00
|
|
|
virtual ~Deps() = default;
|
2024-10-17 18:04:35 +00:00
|
|
|
virtual void showError(QWidget *parent, messages::ClientError error, const QString &address) const;
|
2024-08-08 17:41:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
explicit ClientConnection(
|
2024-10-17 18:04:35 +00:00
|
|
|
QWidget *parent, IAppConfig &appConfig, std::shared_ptr<Deps> deps = std::make_shared<Deps>()
|
|
|
|
|
)
|
2024-08-08 17:41:59 +00:00
|
|
|
: m_pParent(parent),
|
|
|
|
|
m_appConfig(appConfig),
|
2024-10-17 18:04:35 +00:00
|
|
|
m_deps(deps)
|
|
|
|
|
{
|
|
|
|
|
}
|
2024-08-08 17:41:59 +00:00
|
|
|
|
|
|
|
|
void handleLogLine(const QString &line);
|
2024-10-17 18:04:35 +00:00
|
|
|
void setShowMessage()
|
|
|
|
|
{
|
|
|
|
|
m_showMessage = true;
|
|
|
|
|
}
|
2024-08-08 17:41:59 +00:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void messageShowing();
|
2021-04-22 14:00:42 +00:00
|
|
|
|
|
|
|
|
private:
|
2024-08-08 17:41:59 +00:00
|
|
|
void showMessage(const QString &logLine);
|
2024-08-07 14:05:18 +00:00
|
|
|
|
2024-08-08 17:41:59 +00:00
|
|
|
QWidget *m_pParent;
|
|
|
|
|
IAppConfig &m_appConfig;
|
|
|
|
|
std::shared_ptr<Deps> m_deps;
|
|
|
|
|
bool m_showMessage = true;
|
2021-04-22 14:00:42 +00:00
|
|
|
};
|
|
|
|
|
|
2024-09-17 19:00:25 +00:00
|
|
|
} // namespace deskflow::gui
|