From 5dee6ea41d4087f3ea82a4d7555286a9699f4672 Mon Sep 17 00:00:00 2001 From: taynpg Date: Wed, 18 Jun 2025 15:10:28 +0800 Subject: [PATCH] code: Establish the theoretical transmission process. --- ClientCore/ClientCore.cpp | 3 +++ Gui/Control/FileControl.cpp | 7 ++----- Gui/Control/FileControl.h | 5 ++++- Gui/Control/cusTableWidget.cpp | 10 +++------- Gui/Control/cusTableWidget.h | 1 - Gui/frelayGUI.cpp | 11 +++++++++-- Gui/frelayGUI.h | 3 +++ 7 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ClientCore/ClientCore.cpp b/ClientCore/ClientCore.cpp index 9cba6b4..8bd02d9 100644 --- a/ClientCore/ClientCore.cpp +++ b/ClientCore/ClientCore.cpp @@ -98,6 +98,9 @@ void ClientCore::UseFrame(QSharedPointer frame) pathCall_(info.msg); break; } + case FrameBufferType::FBT_SER_MSG_FORWARD_FAILED: { + break; + } default: frameCall_[static_cast(frame->type)](frame); break; diff --git a/Gui/Control/FileControl.cpp b/Gui/Control/FileControl.cpp index 11cae2c..4c97307 100644 --- a/Gui/Control/FileControl.cpp +++ b/Gui/Control/FileControl.cpp @@ -42,11 +42,6 @@ void FileManager::SetModeStr(const QString& modeStr, int type, ClientCore* clien ui->tableWidget->setBasePathCall([this]() { return curRoot_; }); } -void FileManager::SetOtherSidePathCall(const std::function& call) -{ - ui->tableWidget->setOtherSidePathCall(call); -} - void FileManager::InitControl() { QStringList headers; @@ -77,6 +72,8 @@ void FileManager::InitControl() connect(ui->btnVisit, &QPushButton::clicked, this, &FileManager::evtFile); connect(ui->tableWidget, &QTableWidget::cellDoubleClicked, this, &FileManager::doubleClick); connect(ui->btnUp, &QPushButton::clicked, this, &FileManager::evtUp); + connect(ui->tableWidget, &CustomTableWidget::sigTasks, this, + [this](const QVector& tasks) { emit sigSendTasks(tasks); }); } void FileManager::InitMenu(bool remote) diff --git a/Gui/Control/FileControl.h b/Gui/Control/FileControl.h index 4dbb903..debb4ac 100644 --- a/Gui/Control/FileControl.h +++ b/Gui/Control/FileControl.h @@ -2,6 +2,7 @@ #define FILECONTROL_H #include +#include #include #include #include @@ -21,9 +22,11 @@ public: public: void SetModeStr(const QString& modeStr, int type = 0, ClientCore* clientCore = nullptr); - void SetOtherSidePathCall(const std::function& call); QString GetCurRoot(); +signals: + void sigSendTasks(const QVector& tasks); + private: void InitControl(); void InitMenu(bool remote = false); diff --git a/Gui/Control/cusTableWidget.cpp b/Gui/Control/cusTableWidget.cpp index 23d7176..4599cee 100644 --- a/Gui/Control/cusTableWidget.cpp +++ b/Gui/Control/cusTableWidget.cpp @@ -26,11 +26,6 @@ void CustomTableWidget::setBasePathCall(const std::function& call) basePathCall_ = call; } -void CustomTableWidget::setOtherSidePathCall(const std::function& call) -{ - otherSideCall_ = call; -} - QString FileManager::GetCurRoot() { return curRoot_; @@ -74,10 +69,10 @@ void CustomTableWidget::dragEnterEvent(QDragEnterEvent* event) task.remoteId = ridCall_(); if (isRemote_) { task.remotePath = basePathCall_(); - task.localPath = Util::Join(otherSideCall_(), df.name); + task.localPath = Util::Join(dirinfo.root, df.name); } else { - task.remotePath = Util::Join(otherSideCall_(), df.name); + task.remotePath = Util::Join(dirinfo.root, df.name); task.localPath = basePathCall_(); } tasks.push_back(task); @@ -106,6 +101,7 @@ void CustomTableWidget::mouseMoveEvent(QMouseEvent* event) if (item->column() == 1) { DirFileInfo df; df.name = item->text(); + v.vec.push_back(df); } } mimeData->setData("application/x-custom-data", infoPack(v)); diff --git a/Gui/Control/cusTableWidget.h b/Gui/Control/cusTableWidget.h index fb4a038..ffa2de9 100644 --- a/Gui/Control/cusTableWidget.h +++ b/Gui/Control/cusTableWidget.h @@ -18,7 +18,6 @@ signals: public: void setIsRemote(bool isRemote); void setBasePathCall(const std::function& call); - void setOtherSidePathCall(const std::function& call); void setOwnIDCall(const std::function& call); void setRemoteIDCall(const std::function& call); diff --git a/Gui/frelayGUI.cpp b/Gui/frelayGUI.cpp index 4fae481..59ddc67 100644 --- a/Gui/frelayGUI.cpp +++ b/Gui/frelayGUI.cpp @@ -44,11 +44,12 @@ void frelayGUI::InitControl() localFile_ = new FileManager(this); remoteFile_ = new FileManager(this); localFile_->SetModeStr(tr("Local:")); - localFile_->SetOtherSidePathCall([this]() { return remoteFile_->GetCurRoot(); }); remoteFile_->SetModeStr(tr("Remote:"), 1, clientCore_); - remoteFile_->SetOtherSidePathCall([this]() { return localFile_->GetCurRoot(); }); tabWidget_ = new QTabWidget(this); + + connect(localFile_, &FileManager::sigSendTasks, this, &frelayGUI::HandleTask); + connect(remoteFile_, &FileManager::sigSendTasks, this, &frelayGUI::HandleTask); } void frelayGUI::ControlSignal() @@ -104,6 +105,12 @@ void frelayGUI::ControlMsgHander(QtMsgType type, const QMessageLogContext& conte } } +void frelayGUI::HandleTask(const QVector& tasks) +{ + transform_->SetTasks(tasks); + transform_->exec(); +} + void frelayGUI::closeEvent(QCloseEvent* event) { QMainWindow::closeEvent(event); diff --git a/Gui/frelayGUI.h b/Gui/frelayGUI.h index 870f6fd..5586ee9 100644 --- a/Gui/frelayGUI.h +++ b/Gui/frelayGUI.h @@ -35,6 +35,9 @@ private: public: static void ControlMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg); +public slots: + void HandleTask(const QVector& tasks); + protected: void closeEvent(QCloseEvent* event) override;