Adds initial intermediate qt6 porting state
This commit is contained in:
11247 files changed
+1891537
No files matched your search
+128
@@ -0,0 +1,128 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QMap>
|
||||
#include <QPointer>
|
||||
#include <QObject>
|
||||
|
||||
#include "tcpserver_export.h"
|
||||
|
||||
class QAbstractSocket;
|
||||
class CommandInterface;
|
||||
|
||||
|
||||
|
||||
class TCPSERVER_EXPORT WorkerBase
|
||||
{
|
||||
public:
|
||||
typedef QMap< QByteArray, CommandInterface *> CommandMap;
|
||||
public:
|
||||
|
||||
|
||||
WorkerBase(qintptr sd, unsigned short port);
|
||||
|
||||
|
||||
virtual ~WorkerBase() = default;
|
||||
|
||||
|
||||
QAbstractSocket *connection();
|
||||
|
||||
|
||||
|
||||
const QAbstractSocket *connection() const;
|
||||
|
||||
|
||||
|
||||
void redirectDataHandling(bool bDoRedirect, CommandInterface *newDataHandler = nullptr);
|
||||
|
||||
|
||||
|
||||
static QByteArray formatForDebug(const QByteArray &data);
|
||||
|
||||
|
||||
|
||||
static QByteArray formatForDebug(const QAbstractSocket *dev);
|
||||
|
||||
|
||||
|
||||
CommandMap getCommands() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
void newDataInternal();
|
||||
|
||||
|
||||
int initCommands(unsigned short port);
|
||||
|
||||
|
||||
|
||||
void cleanupCommands();
|
||||
|
||||
|
||||
|
||||
qintptr m_socketDescriptor;
|
||||
|
||||
|
||||
QPointer<QAbstractSocket> m_connection;
|
||||
|
||||
|
||||
unsigned short m_port;
|
||||
|
||||
|
||||
QByteArray m_connString;
|
||||
|
||||
|
||||
bool m_bRedirectIncomingData;
|
||||
|
||||
|
||||
CommandInterface *m_bRedirectDataHandler;
|
||||
|
||||
|
||||
|
||||
CommandMap m_registeredCommands;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class WorkerInstance final : public QObject, public WorkerBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
WorkerInstance(qintptr sd, unsigned short port, QObject *parent = nullptr);
|
||||
virtual ~WorkerInstance();
|
||||
|
||||
|
||||
|
||||
bool isRunning() const;
|
||||
|
||||
|
||||
bool isFinished() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
|
||||
void quit();
|
||||
|
||||
|
||||
|
||||
void doWork();
|
||||
|
||||
protected Q_SLOTS:
|
||||
|
||||
|
||||
void newData();
|
||||
|
||||
|
||||
void connectionDisconnected();
|
||||
|
||||
Q_SIGNALS:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
bool m_bFinished;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user