2013-07-24 16:41:12 +00:00
|
|
|
/*
|
|
|
|
|
* synergy -- mouse and keyboard sharing utility
|
2024-07-26 22:53:52 +00:00
|
|
|
* Copyright (C) 2012 Symless Ltd.
|
2013-07-24 16:41:12 +00:00
|
|
|
*
|
|
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2013-07-24 16:41:12 +00:00
|
|
|
*
|
|
|
|
|
* 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QMutex>
|
2024-07-02 19:07:06 +00:00
|
|
|
#include <QObject>
|
2013-07-24 16:41:12 +00:00
|
|
|
|
|
|
|
|
class QTcpSocket;
|
|
|
|
|
|
2024-07-02 19:07:06 +00:00
|
|
|
class IpcReader : public QObject {
|
|
|
|
|
Q_OBJECT;
|
2013-07-24 16:41:12 +00:00
|
|
|
|
|
|
|
|
public:
|
2024-07-02 19:07:06 +00:00
|
|
|
IpcReader(QTcpSocket *socket);
|
|
|
|
|
virtual ~IpcReader();
|
|
|
|
|
void start();
|
|
|
|
|
void stop();
|
2013-07-24 16:41:12 +00:00
|
|
|
|
|
|
|
|
signals:
|
2024-07-02 19:07:06 +00:00
|
|
|
void readLogLine(const QString &text);
|
2013-07-24 16:41:12 +00:00
|
|
|
|
|
|
|
|
private:
|
2024-07-02 19:07:06 +00:00
|
|
|
bool readStream(char *buffer, int length);
|
|
|
|
|
int bytesToInt(const char *buffer, int size);
|
2013-07-24 16:41:12 +00:00
|
|
|
|
|
|
|
|
private slots:
|
2024-07-02 19:07:06 +00:00
|
|
|
void read();
|
2013-07-24 16:41:12 +00:00
|
|
|
|
|
|
|
|
private:
|
2024-07-02 19:07:06 +00:00
|
|
|
QTcpSocket *m_Socket;
|
|
|
|
|
QMutex m_Mutex;
|
2013-07-24 16:41:12 +00:00
|
|
|
};
|