From 6941e1b89370b2985c136960862bd1ac6d19317c Mon Sep 17 00:00:00 2001 From: taynpg Date: Fri, 20 Jun 2025 16:05:37 +0800 Subject: [PATCH] remove: get root callback. --- ClientCore/ClientCore.cpp | 2 +- Gui/Control/FileControl.cpp | 6 ------ Gui/Control/FileControl.h | 1 - Gui/Control/cusTableWidget.cpp | 18 ++++-------------- Gui/Control/cusTableWidget.h | 4 ---- Gui/frelayGUI.cpp | 2 -- 6 files changed, 5 insertions(+), 28 deletions(-) diff --git a/ClientCore/ClientCore.cpp b/ClientCore/ClientCore.cpp index 9fbb0c1..f729717 100644 --- a/ClientCore/ClientCore.cpp +++ b/ClientCore/ClientCore.cpp @@ -20,7 +20,7 @@ ClientCore::~ClientCore() void ClientCore::DoConnect(const QString& ip, quint16 port) { - qDebug() << "doConnect thread:" << QThread::currentThread(); + //qDebug() << "doConnect thread:" << QThread::currentThread(); emit connecting(); if (!Connect(ip, port)) { emit conFailed(); diff --git a/Gui/Control/FileControl.cpp b/Gui/Control/FileControl.cpp index 41712c2..32c84ae 100644 --- a/Gui/Control/FileControl.cpp +++ b/Gui/Control/FileControl.cpp @@ -39,17 +39,11 @@ void FileManager::SetModeStr(const QString& modeStr, int type, ClientCore* clien ui->tableWidget->setOwnIDCall([this]() { return cliCore_->GetOwnID(); }); ui->tableWidget->setRemoteIDCall([this]() { return cliCore_->GetRemoteID(); }); - ui->tableWidget->setBasePathCall([this]() { return GetRoot(); }); connect(fileHelper_.get(), &DirFileHelper::sigHome, this, &FileManager::ShowPath); connect(fileHelper_.get(), &DirFileHelper::sigDirFile, this, &FileManager::ShowFile); } -void FileManager::SetOtherSideCall(const std::function& call) -{ - ui->tableWidget->setOtherSideCall(call); -} - void FileManager::InitControl() { QStringList headers; diff --git a/Gui/Control/FileControl.h b/Gui/Control/FileControl.h index a62a43d..d5a6c6a 100644 --- a/Gui/Control/FileControl.h +++ b/Gui/Control/FileControl.h @@ -24,7 +24,6 @@ public: public: QString GetRoot(); void SetModeStr(const QString& modeStr, int type = 0, ClientCore* clientCore = nullptr); - void SetOtherSideCall(const std::function& call); signals: void sigSendTasks(const QVector& tasks); diff --git a/Gui/Control/cusTableWidget.cpp b/Gui/Control/cusTableWidget.cpp index c8e6668..c6d91c3 100644 --- a/Gui/Control/cusTableWidget.cpp +++ b/Gui/Control/cusTableWidget.cpp @@ -22,11 +22,6 @@ void CustomTableWidget::setIsRemote(bool isRemote) isRemote_ = isRemote; } -void CustomTableWidget::setBasePathCall(const std::function& call) -{ - basePathCall_ = call; -} - void CustomTableWidget::setOwnIDCall(const std::function& call) { oidCall_ = call; @@ -37,11 +32,6 @@ void CustomTableWidget::setRemoteIDCall(const std::function& call) ridCall_ = call; } -void CustomTableWidget::setOtherSideCall(const std::function& call) -{ - otherSideCall_ = call; -} - void CustomTableWidget::dropEvent(QDropEvent* event) { if (!event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) { @@ -65,11 +55,11 @@ void CustomTableWidget::dropEvent(QDropEvent* event) task.localId = oidCall_(); task.remoteId = ridCall_(); if (isRemote_) { - task.remotePath = basePathCall_(); - task.localPath = Util::Join(otherSideCall_(), roleData[Qt::DisplayRole].toString()); + task.remotePath = GlobalData::Ins()->GetRemoteRoot(); + task.localPath = Util::Join(GlobalData::Ins()->GetLocalRoot(), roleData[Qt::DisplayRole].toString()); } else { - task.localPath = basePathCall_(); - task.remotePath = Util::Join(otherSideCall_(), roleData[Qt::DisplayRole].toString()); + task.localPath = GlobalData::Ins()->GetLocalRoot(); + task.remotePath = Util::Join(GlobalData::Ins()->GetRemoteRoot(), roleData[Qt::DisplayRole].toString()); } tasks.push_back(task); } diff --git a/Gui/Control/cusTableWidget.h b/Gui/Control/cusTableWidget.h index a9cc0bc..7fe3f1c 100644 --- a/Gui/Control/cusTableWidget.h +++ b/Gui/Control/cusTableWidget.h @@ -17,10 +17,8 @@ signals: public: void setIsRemote(bool isRemote); - void setBasePathCall(const std::function& call); void setOwnIDCall(const std::function& call); void setRemoteIDCall(const std::function& call); - void setOtherSideCall(const std::function& call); protected: void dropEvent(QDropEvent* event) override; @@ -29,8 +27,6 @@ protected: protected: bool isRemote_{false}; QPoint startPos_; - std::function basePathCall_; - std::function otherSideCall_; std::function oidCall_; std::function ridCall_; }; diff --git a/Gui/frelayGUI.cpp b/Gui/frelayGUI.cpp index 75ac4c4..6c52b9e 100644 --- a/Gui/frelayGUI.cpp +++ b/Gui/frelayGUI.cpp @@ -47,9 +47,7 @@ void frelayGUI::InitControl() remoteFile_ = new FileManager(this); localFile_->SetModeStr(tr("Local:"), 0, clientCore_); - localFile_->SetOtherSideCall([this]() { return remoteFile_->GetRoot(); }); remoteFile_->SetModeStr(tr("Remote:"), 1, clientCore_); - remoteFile_->SetOtherSideCall([this]() { return localFile_->GetRoot(); }); tabWidget_ = new QTabWidget(this);