code: Establish the theoretical transmission process.

This commit is contained in:
2025-06-18 15:10:28 +08:00
parent a53657df30
commit 5dee6ea41d
7 changed files with 24 additions and 16 deletions

View File

@@ -98,6 +98,9 @@ void ClientCore::UseFrame(QSharedPointer<FrameBuffer> frame)
pathCall_(info.msg); pathCall_(info.msg);
break; break;
} }
case FrameBufferType::FBT_SER_MSG_FORWARD_FAILED: {
break;
}
default: default:
frameCall_[static_cast<uint32_t>(frame->type)](frame); frameCall_[static_cast<uint32_t>(frame->type)](frame);
break; break;

View File

@@ -42,11 +42,6 @@ void FileManager::SetModeStr(const QString& modeStr, int type, ClientCore* clien
ui->tableWidget->setBasePathCall([this]() { return curRoot_; }); ui->tableWidget->setBasePathCall([this]() { return curRoot_; });
} }
void FileManager::SetOtherSidePathCall(const std::function<QString()>& call)
{
ui->tableWidget->setOtherSidePathCall(call);
}
void FileManager::InitControl() void FileManager::InitControl()
{ {
QStringList headers; QStringList headers;
@@ -77,6 +72,8 @@ void FileManager::InitControl()
connect(ui->btnVisit, &QPushButton::clicked, this, &FileManager::evtFile); connect(ui->btnVisit, &QPushButton::clicked, this, &FileManager::evtFile);
connect(ui->tableWidget, &QTableWidget::cellDoubleClicked, this, &FileManager::doubleClick); connect(ui->tableWidget, &QTableWidget::cellDoubleClicked, this, &FileManager::doubleClick);
connect(ui->btnUp, &QPushButton::clicked, this, &FileManager::evtUp); connect(ui->btnUp, &QPushButton::clicked, this, &FileManager::evtUp);
connect(ui->tableWidget, &CustomTableWidget::sigTasks, this,
[this](const QVector<TransTask>& tasks) { emit sigSendTasks(tasks); });
} }
void FileManager::InitMenu(bool remote) void FileManager::InitMenu(bool remote)

View File

@@ -2,6 +2,7 @@
#define FILECONTROL_H #define FILECONTROL_H
#include <ClientCore.h> #include <ClientCore.h>
#include <FileTrans.h>
#include <InfoDirFile.h> #include <InfoDirFile.h>
#include <QWidget> #include <QWidget>
#include <Util.h> #include <Util.h>
@@ -21,9 +22,11 @@ public:
public: public:
void SetModeStr(const QString& modeStr, int type = 0, ClientCore* clientCore = nullptr); void SetModeStr(const QString& modeStr, int type = 0, ClientCore* clientCore = nullptr);
void SetOtherSidePathCall(const std::function<QString()>& call);
QString GetCurRoot(); QString GetCurRoot();
signals:
void sigSendTasks(const QVector<TransTask>& tasks);
private: private:
void InitControl(); void InitControl();
void InitMenu(bool remote = false); void InitMenu(bool remote = false);

View File

@@ -26,11 +26,6 @@ void CustomTableWidget::setBasePathCall(const std::function<QString()>& call)
basePathCall_ = call; basePathCall_ = call;
} }
void CustomTableWidget::setOtherSidePathCall(const std::function<QString()>& call)
{
otherSideCall_ = call;
}
QString FileManager::GetCurRoot() QString FileManager::GetCurRoot()
{ {
return curRoot_; return curRoot_;
@@ -74,10 +69,10 @@ void CustomTableWidget::dragEnterEvent(QDragEnterEvent* event)
task.remoteId = ridCall_(); task.remoteId = ridCall_();
if (isRemote_) { if (isRemote_) {
task.remotePath = basePathCall_(); task.remotePath = basePathCall_();
task.localPath = Util::Join(otherSideCall_(), df.name); task.localPath = Util::Join(dirinfo.root, df.name);
} }
else { else {
task.remotePath = Util::Join(otherSideCall_(), df.name); task.remotePath = Util::Join(dirinfo.root, df.name);
task.localPath = basePathCall_(); task.localPath = basePathCall_();
} }
tasks.push_back(task); tasks.push_back(task);
@@ -106,6 +101,7 @@ void CustomTableWidget::mouseMoveEvent(QMouseEvent* event)
if (item->column() == 1) { if (item->column() == 1) {
DirFileInfo df; DirFileInfo df;
df.name = item->text(); df.name = item->text();
v.vec.push_back(df);
} }
} }
mimeData->setData("application/x-custom-data", infoPack<DirFileInfoVec>(v)); mimeData->setData("application/x-custom-data", infoPack<DirFileInfoVec>(v));

View File

@@ -18,7 +18,6 @@ signals:
public: public:
void setIsRemote(bool isRemote); void setIsRemote(bool isRemote);
void setBasePathCall(const std::function<QString()>& call); void setBasePathCall(const std::function<QString()>& call);
void setOtherSidePathCall(const std::function<QString()>& call);
void setOwnIDCall(const std::function<QString()>& call); void setOwnIDCall(const std::function<QString()>& call);
void setRemoteIDCall(const std::function<QString()>& call); void setRemoteIDCall(const std::function<QString()>& call);

View File

@@ -44,11 +44,12 @@ void frelayGUI::InitControl()
localFile_ = new FileManager(this); localFile_ = new FileManager(this);
remoteFile_ = new FileManager(this); remoteFile_ = new FileManager(this);
localFile_->SetModeStr(tr("Local:")); localFile_->SetModeStr(tr("Local:"));
localFile_->SetOtherSidePathCall([this]() { return remoteFile_->GetCurRoot(); });
remoteFile_->SetModeStr(tr("Remote:"), 1, clientCore_); remoteFile_->SetModeStr(tr("Remote:"), 1, clientCore_);
remoteFile_->SetOtherSidePathCall([this]() { return localFile_->GetCurRoot(); });
tabWidget_ = new QTabWidget(this); tabWidget_ = new QTabWidget(this);
connect(localFile_, &FileManager::sigSendTasks, this, &frelayGUI::HandleTask);
connect(remoteFile_, &FileManager::sigSendTasks, this, &frelayGUI::HandleTask);
} }
void frelayGUI::ControlSignal() void frelayGUI::ControlSignal()
@@ -104,6 +105,12 @@ void frelayGUI::ControlMsgHander(QtMsgType type, const QMessageLogContext& conte
} }
} }
void frelayGUI::HandleTask(const QVector<TransTask>& tasks)
{
transform_->SetTasks(tasks);
transform_->exec();
}
void frelayGUI::closeEvent(QCloseEvent* event) void frelayGUI::closeEvent(QCloseEvent* event)
{ {
QMainWindow::closeEvent(event); QMainWindow::closeEvent(event);

View File

@@ -35,6 +35,9 @@ private:
public: public:
static void ControlMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg); static void ControlMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg);
public slots:
void HandleTask(const QVector<TransTask>& tasks);
protected: protected:
void closeEvent(QCloseEvent* event) override; void closeEvent(QCloseEvent* event) override;