up:文件校验功能进度更新。
This commit is contained in:
@@ -173,8 +173,8 @@ std::string Connecter::getCurClient()
|
||||
void Connecter::InitControl()
|
||||
{
|
||||
ui->edOwnID->setReadOnly(true);
|
||||
ui->label->setStyleSheet("color: blue;");
|
||||
ui->edOwnID->setStyleSheet("color: blue;");
|
||||
ui->label->setStyleSheet("color: green;");
|
||||
ui->edOwnID->setStyleSheet("color: green;");
|
||||
|
||||
ui->btnDisconnect->setEnabled(false);
|
||||
ui->comboBox->setEditable(true);
|
||||
@@ -191,7 +191,7 @@ void Connecter::InitControl()
|
||||
connect(ui->btnDisconnect, &QPushButton::clicked, this, &Connecter::Disconnect);
|
||||
|
||||
menu_ = new QMenu(this);
|
||||
QAction* acUseThis = menu_->addAction(tr("UseThis"));
|
||||
QAction* acUseThis = menu_->addAction(tr("与此客户端通信"));
|
||||
connect(acUseThis, &QAction::triggered, this, [this]() {
|
||||
auto index = ui->listView->currentIndex();
|
||||
if (!index.isValid()) {
|
||||
|
||||
@@ -165,7 +165,7 @@ void CheckCondition::SetTasks(const QVector<TransTask>& tasks)
|
||||
void CheckCondition::recvFrame(QSharedPointer<FrameBuffer> frame)
|
||||
{
|
||||
InfoMsg info = infoUnpack<InfoMsg>(frame->data);
|
||||
if (info.command == STRMSG_ANSWER_CHECK_FILE_EXIST) {
|
||||
if (info.command == STRMSG_AC_ANSWER_FILE_EXIST) {
|
||||
remoteNotExits_ = info.list;
|
||||
qInfo() << tr("检查结束,远端不存在的文件数:") << remoteNotExits_.size();
|
||||
msg_ = info.command;
|
||||
@@ -187,9 +187,6 @@ void CheckCondition::interrupCheck()
|
||||
void CheckCondition::run()
|
||||
{
|
||||
qInfo() << tr("开始文件校验......");
|
||||
|
||||
resultMsgMap_.clear();
|
||||
checkRet_.clear();
|
||||
isRun_ = true;
|
||||
msg_.clear();
|
||||
isAlreadyInter_ = false;
|
||||
@@ -197,22 +194,14 @@ void CheckCondition::run()
|
||||
// 先检查本地文件是否存在
|
||||
for (const auto& task : tasks_) {
|
||||
if (task.isUpload && !Util::FileExist(task.localPath)) {
|
||||
resultMsgMap_[CCR_CHECK_LOCAL_NOT_EXIT].push_back(task.localPath);
|
||||
if (!checkRet_.contains(CCR_CHECK_LOCAL_NOT_EXIT)) {
|
||||
checkRet_.push_back(CCR_CHECK_LOCAL_NOT_EXIT);
|
||||
}
|
||||
}
|
||||
if (!task.isUpload && Util::FileExist(task.localPath)) {
|
||||
resultMsgMap_[CCR_CHECK_LOCAL_EXIT].push_back(task.localPath);
|
||||
if (!checkRet_.contains(CCR_CHECK_LOCAL_EXIT)) {
|
||||
checkRet_.push_back(CCR_CHECK_LOCAL_EXIT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 再检查远程文件是否存在
|
||||
InfoMsg msg;
|
||||
msg.command = STRMSG_REQUEST_CHECK_FILE_EXIST;
|
||||
msg.command = STRMSG_AC_CHECK_FILE_EXIST;
|
||||
for (const auto& task : tasks_) {
|
||||
msg.list.push_back(task.remotePath);
|
||||
}
|
||||
@@ -220,10 +209,6 @@ void CheckCondition::run()
|
||||
auto f = clientCore_->GetBuffer(msg, FBT_MSGINFO_ASK, clientCore_->GetRemoteID());
|
||||
if (!ClientCore::syncInvoke(clientCore_, f)) {
|
||||
auto errMsg = tr("检查远程文件存在性数据发送失败。");
|
||||
if (!checkRet_.contains(CCR_CHECK_FAILED)) {
|
||||
checkRet_.push_back(CCR_CHECK_FAILED);
|
||||
resultMsgMap_[CCR_CHECK_FAILED].push_back(errMsg);
|
||||
}
|
||||
emit sigCheckOver();
|
||||
qCritical() << errMsg;
|
||||
return;
|
||||
@@ -233,16 +218,6 @@ void CheckCondition::run()
|
||||
if (msg_.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (msg_ != STRMSG_ANSWER_CHECK_FILE_EXIST) {
|
||||
if (!checkRet_.contains(CCR_CHECK_FAILED)) {
|
||||
checkRet_.push_back(CCR_CHECK_FAILED);
|
||||
resultMsgMap_[CCR_CHECK_FAILED].push_back(msg_);
|
||||
}
|
||||
} else {
|
||||
if (!checkRet_.contains(CCR_CHECK_PASSED)) {
|
||||
checkRet_.push_back(CCR_CHECK_PASSED);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
isAlreadyInter_ = true;
|
||||
|
||||
@@ -75,17 +75,6 @@ private:
|
||||
TransForm* tf_;
|
||||
};
|
||||
|
||||
enum CondCheckResult {
|
||||
CCR_NO_CHECK = 0,
|
||||
CCR_CHECK_PASSED,
|
||||
CCR_CHECK_FAILED,
|
||||
CCR_CHECK_INTERRUPT,
|
||||
CCR_CHECK_LOCAL_EXIT,
|
||||
CCR_CHECK_REMOTE_EXIT,
|
||||
CCR_CHECK_LOCAL_NOT_EXIT,
|
||||
CCR_CHECK_REMOTE_NOT_EXIT
|
||||
};
|
||||
|
||||
class CheckCondition : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -114,8 +103,6 @@ private:
|
||||
QVector<TransTask> tasks_;
|
||||
ClientCore* clientCore_{};
|
||||
QVector<QString> remoteNotExits_;
|
||||
QVector<CondCheckResult> checkRet_;
|
||||
std::unordered_map<CondCheckResult, QVector<QString>> resultMsgMap_;
|
||||
};
|
||||
|
||||
#endif // TRANSFORM_H
|
||||
Reference in New Issue
Block a user