remove: get root callback.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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<QString()>& call)
|
||||
{
|
||||
ui->tableWidget->setOtherSideCall(call);
|
||||
}
|
||||
|
||||
void FileManager::InitControl()
|
||||
{
|
||||
QStringList headers;
|
||||
|
||||
@@ -24,7 +24,6 @@ public:
|
||||
public:
|
||||
QString GetRoot();
|
||||
void SetModeStr(const QString& modeStr, int type = 0, ClientCore* clientCore = nullptr);
|
||||
void SetOtherSideCall(const std::function<QString()>& call);
|
||||
|
||||
signals:
|
||||
void sigSendTasks(const QVector<TransTask>& tasks);
|
||||
|
||||
@@ -22,11 +22,6 @@ void CustomTableWidget::setIsRemote(bool isRemote)
|
||||
isRemote_ = isRemote;
|
||||
}
|
||||
|
||||
void CustomTableWidget::setBasePathCall(const std::function<QString()>& call)
|
||||
{
|
||||
basePathCall_ = call;
|
||||
}
|
||||
|
||||
void CustomTableWidget::setOwnIDCall(const std::function<QString()>& call)
|
||||
{
|
||||
oidCall_ = call;
|
||||
@@ -37,11 +32,6 @@ void CustomTableWidget::setRemoteIDCall(const std::function<QString()>& call)
|
||||
ridCall_ = call;
|
||||
}
|
||||
|
||||
void CustomTableWidget::setOtherSideCall(const std::function<QString()>& 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);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ signals:
|
||||
|
||||
public:
|
||||
void setIsRemote(bool isRemote);
|
||||
void setBasePathCall(const std::function<QString()>& call);
|
||||
void setOwnIDCall(const std::function<QString()>& call);
|
||||
void setRemoteIDCall(const std::function<QString()>& call);
|
||||
void setOtherSideCall(const std::function<QString()>& call);
|
||||
|
||||
protected:
|
||||
void dropEvent(QDropEvent* event) override;
|
||||
@@ -29,8 +27,6 @@ protected:
|
||||
protected:
|
||||
bool isRemote_{false};
|
||||
QPoint startPos_;
|
||||
std::function<QString()> basePathCall_;
|
||||
std::function<QString()> otherSideCall_;
|
||||
std::function<QString()> oidCall_;
|
||||
std::function<QString()> ridCall_;
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user