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
|
|
|
|
|
|
2025-11-28 17:55:57 +00:00
|
|
|
#include "common/Enums.h"
|
2025-03-19 21:47:24 +00:00
|
|
|
#include "gui/Messages.h"
|
2024-08-08 17:41:59 +00:00
|
|
|
|
|
|
|
|
#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;
|
2025-11-28 17:55:57 +00:00
|
|
|
virtual void showError(QWidget *parent, deskflow::client::ErrorType error, const QString &address) const;
|
2024-08-08 17:41:59 +00:00
|
|
|
};
|
|
|
|
|
|
2025-03-08 15:34:45 +00:00
|
|
|
explicit ClientConnection(QWidget *parent, std::shared_ptr<Deps> deps = std::make_shared<Deps>())
|
2024-08-08 17:41:59 +00:00
|
|
|
: m_pParent(parent),
|
2024-10-17 18:04:35 +00:00
|
|
|
m_deps(deps)
|
|
|
|
|
{
|
2025-05-20 14:39:18 +00:00
|
|
|
// do nothing
|
2024-10-17 18:04:35 +00:00
|
|
|
}
|
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
|
|
|
|
2025-05-31 15:35:37 +00:00
|
|
|
Q_SIGNALS:
|
2025-11-27 14:21:43 +00:00
|
|
|
/**
|
|
|
|
|
* @brief requestShowError, This signal is emitted when the client
|
|
|
|
|
* connection would like the owning process to report an error message
|
|
|
|
|
* @param error the type of error being reported
|
|
|
|
|
* @param address of the host
|
|
|
|
|
*/
|
2025-11-28 17:55:57 +00:00
|
|
|
void requestShowError(deskflow::client::ErrorType error, const QString &address);
|
2024-08-08 17:41:59 +00:00
|
|
|
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;
|
|
|
|
|
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
|