mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
chore: update files of project
This commit is contained in:
parent
0dc3bd1fc0
commit
1d7e7cc985
@ -36,3 +36,8 @@ SAKBaseTool::~SAKBaseTool()
|
||||
wait();
|
||||
}
|
||||
}
|
||||
|
||||
void SAKBaseTool::inputBytes(const QByteArray &bytes)
|
||||
{
|
||||
emit bytesOutput(bytes);
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ class SAKBaseTool : public QThread
|
||||
public:
|
||||
explicit SAKBaseTool(QObject *parent = Q_NULLPTR);
|
||||
virtual ~SAKBaseTool();
|
||||
virtual void inputBytes(const QByteArray &bytes) = 0;
|
||||
virtual void inputBytes(const QByteArray &bytes);
|
||||
|
||||
int toolType() { return m_type; }
|
||||
void setToolType(int type) { m_type = type; }
|
||||
|
||||
@ -280,10 +280,9 @@ void SAKPrestorerTool::send(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void SAKPrestorerTool::inputBytes(const QByteArray &bytes, const QVariant &context)
|
||||
void SAKPrestorerTool::inputBytes(const QByteArray &bytes)
|
||||
{
|
||||
Q_UNUSED(bytes);
|
||||
Q_UNUSED(context);
|
||||
Q_UNUSED(bytes)
|
||||
}
|
||||
|
||||
void SAKPrestorerTool::run()
|
||||
|
||||
@ -76,20 +76,18 @@ public:
|
||||
Q_INVOKABLE void send(int index);
|
||||
|
||||
protected:
|
||||
virtual void inputBytes(const QByteArray &bytes, const QVariant &context) final;
|
||||
void inputBytes(const QByteArray &bytes) override;
|
||||
void run() final;
|
||||
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
virtual bool setData(const QModelIndex &index,
|
||||
const QVariant &value,
|
||||
int role = Qt::EditRole) override;
|
||||
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
virtual QVariant headerData(int section,
|
||||
Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
QVariant headerData(int section,
|
||||
Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
|
||||
private:
|
||||
void try2send();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2023 Qsaker(qsaker@foxmail.com). All rights reserved.
|
||||
* Copyright 2023-2024 Qsaker(qsaker@foxmail.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of QtSwissArmyKnife project.
|
||||
*
|
||||
@ -33,14 +33,12 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
virtual bool setData(const QModelIndex &index,
|
||||
const QVariant &value,
|
||||
int role = Qt::EditRole) override;
|
||||
virtual QVariant headerData(int section,
|
||||
Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
QVariant headerData(int section,
|
||||
Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
};
|
||||
|
||||
#endif // SAKSOCKETCLIENTTRANSMITTERTOOL_H
|
||||
|
||||
@ -20,10 +20,8 @@ SAKStatisticianTool::SAKStatisticianTool(QObject *parent)
|
||||
});
|
||||
}
|
||||
|
||||
void SAKStatisticianTool::inputBytes(const QByteArray &bytes, const QVariant &context)
|
||||
void SAKStatisticianTool::inputBytes(const QByteArray &bytes)
|
||||
{
|
||||
Q_UNUSED(context)
|
||||
|
||||
mFrames += 1;
|
||||
emit framesChanged(mFrames);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/***************************************************************************************************
|
||||
* Copyright 2023 Qsaker(qsaker@foxmail.com). All rights reserved.
|
||||
* Copyright 2023-2024 Qsaker(qsaker@foxmail.com). All rights reserved.
|
||||
*
|
||||
* The file is encoded using "utf8 with bom", it is a part of QtSwissArmyKnife project.
|
||||
*
|
||||
@ -19,7 +19,7 @@ class SAKStatisticianTool : public SAKBaseTool
|
||||
public:
|
||||
explicit SAKStatisticianTool(QObject *parent = nullptr);
|
||||
|
||||
virtual void inputBytes(const QByteArray &bytes, const QVariant &context = QJsonObject()) final;
|
||||
void inputBytes(const QByteArray &bytes) override;
|
||||
|
||||
protected:
|
||||
virtual void run() final;
|
||||
|
||||
@ -16,7 +16,7 @@ class SAKUdpTransmitterTool : public SAKSocketClientTransmitterTool
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SAKUdpTransmitterTool(QObject *parent = nullptr);
|
||||
virtual SAKCommunicationTool *createTool() override;
|
||||
SAKCommunicationTool *createTool() override;
|
||||
};
|
||||
|
||||
#endif // SAKUDPTRANSMITTERTOOL_H
|
||||
|
||||
@ -13,15 +13,11 @@ SAKVelometerTool::SAKVelometerTool(QObject *parent)
|
||||
: SAKBaseTool{parent}
|
||||
{}
|
||||
|
||||
void SAKVelometerTool::inputBytes(const QByteArray &bytes, const QVariant &context)
|
||||
void SAKVelometerTool::inputBytes(const QByteArray &bytes)
|
||||
{
|
||||
if (isRunning()) {
|
||||
InputBytesContext ctx;
|
||||
ctx.bytes = bytes;
|
||||
ctx.context = context;
|
||||
|
||||
mInputBytesContextListMutex.lock();
|
||||
mInputBytesContextList.append(ctx);
|
||||
mInputBytesContextList.append(bytes);
|
||||
mInputBytesContextListMutex.unlock();
|
||||
}
|
||||
}
|
||||
@ -38,8 +34,8 @@ void SAKVelometerTool::run()
|
||||
this->mInputBytesContextListMutex.unlock();
|
||||
|
||||
int v = 0;
|
||||
for (auto &ctx : list) {
|
||||
v += ctx.bytes.length();
|
||||
for (auto &bytes : list) {
|
||||
v += bytes.length();
|
||||
}
|
||||
|
||||
QString cookedVelocity;
|
||||
|
||||
@ -20,18 +20,13 @@ class SAKVelometerTool : public SAKBaseTool
|
||||
public:
|
||||
explicit SAKVelometerTool(QObject *parent = nullptr);
|
||||
|
||||
virtual void inputBytes(const QByteArray &bytes, const QVariant &context = QJsonObject()) final;
|
||||
void inputBytes(const QByteArray &bytes) override;
|
||||
|
||||
protected:
|
||||
void run();
|
||||
void run() override;
|
||||
|
||||
private:
|
||||
struct InputBytesContext
|
||||
{
|
||||
QByteArray bytes;
|
||||
QVariant context;
|
||||
};
|
||||
QList<struct InputBytesContext> mInputBytesContextList;
|
||||
QList<QByteArray> mInputBytesContextList;
|
||||
QMutex mInputBytesContextListMutex;
|
||||
QString mVelocity;
|
||||
QMutex mVelocityMutex;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user