some change.
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
ClientCore::ClientCore(QObject* parent) : QObject(parent)
|
||||
{
|
||||
qRegisterMetaType<QSharedPointer<FrameBuffer>>("QSharedPointer<FrameBuffer>");
|
||||
qRegisterMetaType<InfoClientVec>("InfoClientVec");
|
||||
qRegisterMetaType<DirFileInfoVec>("DirFileInfoVec");
|
||||
|
||||
socket_ = new QTcpSocket(this);
|
||||
connect(socket_, &QTcpSocket::readyRead, this, &ClientCore::onReadyRead);
|
||||
connect(socket_, &QTcpSocket::disconnected, this, &ClientCore::onDisconnected);
|
||||
@@ -113,7 +117,6 @@ void ClientCore::UseFrame(QSharedPointer<FrameBuffer> frame)
|
||||
case FrameBufferType::FBT_CLI_TRANS_DONE: {
|
||||
sigTransDone(frame);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case FrameBufferType::FBT_CLI_CAN_SEND: {
|
||||
sigCanSend(frame);
|
||||
|
||||
@@ -102,7 +102,6 @@ public:
|
||||
QByteArray recvBuffer_;
|
||||
|
||||
LocalFile localFile_;
|
||||
std::array<std::function<void(QSharedPointer<FrameBuffer>)>, 256> frameCall_;
|
||||
};
|
||||
|
||||
class SocketWorker : public QThread
|
||||
|
||||
@@ -290,7 +290,7 @@ void SendThread::run()
|
||||
// shoule add abort action mark.
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(this, [this, frame] {
|
||||
QMetaObject::invokeMethod(cliCore_, [this, frame] {
|
||||
frame->sendRet = cliCore_->Send(frame);
|
||||
if (frame->call) {
|
||||
frame->call(frame);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "LogControl.h"
|
||||
#include "LogControl.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QListWidgetItem>
|
||||
#include <QStandardItem>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
@@ -15,8 +16,6 @@ LogPrint::LogPrint(QWidget* parent) : QWidget(parent), ui(new Ui::LogPrint)
|
||||
|
||||
void LogPrint::InitControl()
|
||||
{
|
||||
model_ = new QStandardItemModel(this);
|
||||
ui->listView->setModel(model_);
|
||||
}
|
||||
|
||||
std::string LogPrint::now_str()
|
||||
@@ -56,8 +55,8 @@ void LogPrint::Debug(const QString& message)
|
||||
void LogPrint::Print(const QString& message, const QBrush& color)
|
||||
{
|
||||
auto timeStr = QString("%1%2").arg(QString::fromStdString(now_str())).arg(message);
|
||||
auto* item = new QStandardItem(timeStr);
|
||||
QListWidgetItem* item = new QListWidgetItem(timeStr);
|
||||
item->setForeground(color);
|
||||
model_->appendRow(item);
|
||||
ui->listView->scrollToBottom();
|
||||
ui->listWidget->addItem(item);
|
||||
ui->listWidget->scrollToBottom();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QListView" name="listView"/>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -103,7 +103,7 @@ void TransForm::showEvent(QShowEvent* event)
|
||||
{
|
||||
QDialog::showEvent(event);
|
||||
workTh_ = new TranFromTh(this, this);
|
||||
//fileTrans_->moveToThread(workTh_);
|
||||
fileTrans_->moveToThread(workTh_);
|
||||
connect(workTh_, &QThread::finished, fileTrans_, &QObject::deleteLater);
|
||||
workTh_->start();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "Control/LogControl.h"
|
||||
|
||||
static LogPrint* logPrint = nullptr;
|
||||
static QMutex logMut;
|
||||
|
||||
frelayGUI::frelayGUI(QWidget* parent) : QMainWindow(parent), ui(new Ui::frelayGUI)
|
||||
{
|
||||
@@ -27,7 +28,9 @@ frelayGUI::frelayGUI(QWidget* parent) : QMainWindow(parent), ui(new Ui::frelayGU
|
||||
|
||||
frelayGUI::~frelayGUI()
|
||||
{
|
||||
QMutexLocker locker(&logMut);
|
||||
delete ui;
|
||||
logPrint = nullptr;
|
||||
}
|
||||
|
||||
void frelayGUI::InitControl()
|
||||
@@ -89,6 +92,9 @@ void frelayGUI::ControlLayout()
|
||||
void frelayGUI::ControlMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||
{
|
||||
Q_UNUSED(context);
|
||||
|
||||
QMutexLocker locker(&logMut);
|
||||
|
||||
if (!logPrint) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#include <QMetaType>
|
||||
|
||||
constexpr quint32 CHUNK_BUF_SIZE = 1 * 1024 * 1024;
|
||||
|
||||
@@ -52,4 +53,5 @@ public:
|
||||
static QByteArray PackBuffer(const QSharedPointer<FrameBuffer>& frame);
|
||||
};
|
||||
|
||||
|
||||
#endif // PROTOCOL_H
|
||||
|
||||
Reference in New Issue
Block a user