2021-04-22 14:00:42 +00:00
|
|
|
/*
|
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
2024-08-07 14:05:18 +00:00
|
|
|
* Copyright (C) 2021 Symless Ltd.
|
2021-04-22 14:00:42 +00:00
|
|
|
*
|
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
|
|
|
|
*
|
|
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
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-08-07 14:05:18 +00:00
|
|
|
namespace synergy::gui {
|
2021-04-22 14:00:42 +00:00
|
|
|
|
2024-08-08 17:41:59 +00:00
|
|
|
class ClientConnection : public QObject {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2021-04-22 14:00:42 +00:00
|
|
|
public:
|
2024-08-08 17:41:59 +00:00
|
|
|
struct Deps {
|
|
|
|
|
virtual ~Deps() = default;
|
|
|
|
|
virtual void showError(
|
|
|
|
|
QWidget *parent, messages::ClientError error,
|
|
|
|
|
const QString &address) const;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
explicit ClientConnection(
|
|
|
|
|
QWidget *parent, IAppConfig &appConfig,
|
|
|
|
|
std::shared_ptr<Deps> deps = std::make_shared<Deps>())
|
|
|
|
|
: m_pParent(parent),
|
|
|
|
|
m_appConfig(appConfig),
|
|
|
|
|
m_deps(deps) {}
|
|
|
|
|
|
|
|
|
|
void handleLogLine(const QString &line);
|
|
|
|
|
void setShowMessage() { m_showMessage = true; }
|
|
|
|
|
|
|
|
|
|
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-08-07 14:05:18 +00:00
|
|
|
} // namespace synergy::gui
|