diff --git a/.qtcreator/CMakeLists.txt.user b/.qtcreator/CMakeLists.txt.user
new file mode 100644
index 0000000..26b5bc0
--- /dev/null
+++ b/.qtcreator/CMakeLists.txt.user
@@ -0,0 +1,603 @@
+
+
+
+
+
+ EnvironmentId
+ {8ef8e4d9-104a-416c-806b-9f180c9cbc0a}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ true
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 0
+ 80
+ true
+ true
+ 1
+ 0
+ false
+ true
+ false
+ 2
+ true
+ true
+ 0
+ 8
+ true
+ false
+ 1
+ true
+ true
+ true
+ *.md, *.MD, Makefile
+ false
+ true
+ true
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ true
+ false
+ true
+ true
+ true
+ true
+
+ false
+
+
+ 0
+ true
+
+ true
+ true
+ Builtin.DefaultTidyAndClazy
+ 6
+ true
+
+
+
+ true
+
+ 0
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop
+ true
+ x86-windows-msys-pe-64bit
+ x86-windows-msys-pe-64bit
+ {91740fcb-06a8-437e-9899-e11928f5b8f6}
+ 0
+ 0
+ 4
+
+ Debug
+ 2
+ false
+
+ -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
+-DCOMPILE_GUI:STRING=ON
+-DCMAKE_BUILD_TYPE:STRING=Debug
+-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
+-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
+-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
+-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
+-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON
+-DQT_DEFAULT_MAJOR_VERSION:STRING=6
+-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
+-DCMAKE_GENERATOR:STRING=MinGW Makefiles
+ 0
+ D:\Git\frelay\build\x86_windows_msys_pe_64bit-Debug
+
+
+
+
+ all
+
+ false
+
+ true
+ 构建
+ CMakeProjectManager.MakeStep
+
+ 1
+ 构建
+ 构建
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ clean
+
+ false
+
+ true
+ 构建
+ CMakeProjectManager.MakeStep
+
+ 1
+ 清除
+ 清除
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Debug
+ CMakeProjectManager.CMakeBuildConfiguration
+ 0
+ 4
+
+
+ 0
+ 部署
+ 部署
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+
+
+
+
+
+
+
+ false
+
+ true
+ 构建
+ ApplicationManagerPlugin.Deploy.CMakePackageStep
+
+
+ install-package --acknowledge
+ true
+ Install Application Manager package
+ ApplicationManagerPlugin.Deploy.InstallPackageStep
+
+
+
+
+
+
+
+ 2
+ 部署
+ 部署
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ApplicationManagerPlugin.Deploy.Configuration
+
+ 2
+
+ false
+
+ false
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayBaseTest
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayConsole
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayServer
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayTest
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayGUI
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+ 5
+
+
+ Release
+ 2
+ false
+
+ -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
+-DCMAKE_BUILD_TYPE:STRING=Release
+-DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
+-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
+-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
+-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
+-DCMAKE_COLOR_DIAGNOSTICS:BOOL=ON
+-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
+-DCMAKE_GENERATOR:STRING=MinGW Makefiles
+ D:\Git\frelay\build\x86_windows_msys_pe_64bit-Release
+
+
+
+
+ all
+
+ false
+
+ true
+ CMakeProjectManager.MakeStep
+
+ 1
+ 构建
+ 构建
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ clean
+
+ false
+
+ true
+ CMakeProjectManager.MakeStep
+
+ 1
+ 清除
+ 清除
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ false
+
+ Release
+ CMakeProjectManager.CMakeBuildConfiguration
+ 1
+ 0
+
+
+ 0
+ 部署
+ 部署
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+
+
+
+
+
+
+
+ false
+
+ true
+ ApplicationManagerPlugin.Deploy.CMakePackageStep
+
+
+ install-package --acknowledge
+ true
+ Install Application Manager package
+ ApplicationManagerPlugin.Deploy.InstallPackageStep
+
+
+
+
+
+
+
+ 2
+ 部署
+ 部署
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ApplicationManagerPlugin.Deploy.Configuration
+
+ 2
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ ProjectExplorer.CustomExecutableRunConfiguration
+
+ false
+
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+ 1
+
+ 2
+
+
+ 0
+ 部署
+ 部署
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ProjectExplorer.DefaultDeployConfiguration
+
+
+
+
+
+
+
+
+ false
+
+ true
+ 构建
+ ApplicationManagerPlugin.Deploy.CMakePackageStep
+
+
+ install-package --acknowledge
+ true
+ Install Application Manager package
+ ApplicationManagerPlugin.Deploy.InstallPackageStep
+
+
+
+
+
+
+
+ 2
+ 部署
+ 部署
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+
+ false
+ ApplicationManagerPlugin.Deploy.Configuration
+
+ 2
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayBaseTest
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayConsole
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayServer
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayTest
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+
+ true
+ true
+ 0
+ true
+
+ 2
+
+ false
+ -e cpu-cycles --call-graph "dwarf,4096" -F 250
+
+ CMakeProjectManager.CMakeRunConfiguration.
+ frelayGUI
+ false
+
+ true
+ true
+ true
+ %{RunConfig:Executable:Path}
+
+ 5
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ Version
+ 22
+
+
diff --git a/ClientCore/ClientCore.cpp b/ClientCore/ClientCore.cpp
index ea56bbc..061fe92 100644
--- a/ClientCore/ClientCore.cpp
+++ b/ClientCore/ClientCore.cpp
@@ -89,12 +89,12 @@ void ClientCore::handleAsk(QSharedPointer frame)
if (msg.command == STRMSG_AC_CHECK_FILE_EXIST) {
msg.command = STRMSG_AC_ANSWER_FILE_EXIST;
for (auto& item : msg.mapData) {
- if (item.mark == STRMSG_AC_UP) {
- if (!Util::DirExist(item.key, true)) {
+ if (item.command == STRMSG_AC_UP) {
+ if (!Util::DirExist(item.path, false)) {
item.state = static_cast(FCS_DIR_NOT_EXIST);
}
} else {
- if (!Util::FileExist(item.key)) {
+ if (!Util::FileExist(item.path)) {
item.state = static_cast(FCS_FILE_NOT_EXIST);
}
}
diff --git a/ClientCore/FileTrans.cpp b/ClientCore/FileTrans.cpp
index 22219ca..b7634d3 100644
--- a/ClientCore/FileTrans.cpp
+++ b/ClientCore/FileTrans.cpp
@@ -1,5 +1,6 @@
#include "FileTrans.h"
+#include
#include
FileTrans::FileTrans(ClientCore* clientCore) : clientCore_(clientCore)
@@ -164,6 +165,19 @@ void FileTrans::fbtReqSend(QSharedPointer frame)
}
// recv
+ if (!Util::DirExist(info.toPath, false)) {
+ QDir dir;
+ if (!dir.mkpath(info.toPath)) {
+ info.msg = QString(tr("创建目录失败:%1")).arg(info.toPath);
+ qCritical() << info.msg;
+ auto f = clientCore_->GetBuffer(info, FBT_CLI_CANOT_SEND, frame->fid);
+ if (!ClientCore::syncInvoke(clientCore_, f)) {
+ qCritical() << QString(tr("%1 回复 %2 失败。")).arg(info.msg, f->fid);
+ }
+ return;
+ }
+ qInfo() << QString(tr("目录 %1 不存在,已自动创建。")).arg(info.toPath);
+ }
auto newerPath = Util::Get2FilePath(info.fromPath, info.toPath);
downTask_->file.setFileName(newerPath);
if (!downTask_->file.open(QIODevice::WriteOnly)) {
@@ -171,9 +185,8 @@ void FileTrans::fbtReqSend(QSharedPointer frame)
qCritical() << info.msg;
auto f = clientCore_->GetBuffer(info, FBT_CLI_CANOT_SEND, frame->fid);
if (!ClientCore::syncInvoke(clientCore_, f)) {
- qCritical() << QString(tr("打开接收文件 %2 失败,回复 %2 失败。")).arg(info.msg, f->fid);
+ qCritical() << QString(tr("打开接收文件 %1 失败,回复 %2 失败。")).arg(info.msg, f->fid);
downTask_->file.close();
- return;
}
return;
}
diff --git a/Gui/CMakeLists.txt b/Gui/CMakeLists.txt
index 2e6bec9..ce39bbf 100644
--- a/Gui/CMakeLists.txt
+++ b/Gui/CMakeLists.txt
@@ -27,6 +27,7 @@ Control/cusTableWidget.cpp Control/cusTableWidget.h
Control/cpTableWidget.h Control/cpTableWidget.cpp
GuiUtil/Config.h GuiUtil/Config.cpp
../Res/qss.qrc Form/Loading.h Form/Loading.cpp
+Control/Common.h Control/Common.cpp
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
diff --git a/Gui/Control/Common.cpp b/Gui/Control/Common.cpp
new file mode 100644
index 0000000..c8ce514
--- /dev/null
+++ b/Gui/Control/Common.cpp
@@ -0,0 +1,24 @@
+#include "Common.h"
+
+#include
+
+Common::Common() : QWidget(nullptr)
+{
+}
+
+int Common::GetAcceptThree(QWidget* parent, const QString& notice, const QString& title)
+{
+ QMessageBox msgBox(parent);
+ msgBox.setWindowTitle(notice);
+ msgBox.setText(title);
+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::Cancel);
+ int result = msgBox.exec();
+ switch (result) {
+ case QMessageBox::Yes:
+ return 0;
+ case QMessageBox::YesToAll:
+ return 1;
+ default:
+ return -1;
+ }
+}
diff --git a/Gui/Control/Common.h b/Gui/Control/Common.h
new file mode 100644
index 0000000..3ce5f4b
--- /dev/null
+++ b/Gui/Control/Common.h
@@ -0,0 +1,16 @@
+#ifndef COMMON_H
+#define COMMON_H
+
+#include
+
+class Common : public QWidget
+{
+ Q_OBJECT
+public:
+ Common();
+
+public:
+ static int GetAcceptThree(QWidget* parent, const QString& notice, const QString& title);
+};
+
+#endif // COMMON_H
\ No newline at end of file
diff --git a/Gui/Form/Transform.cpp b/Gui/Form/Transform.cpp
index 2634dba..133c873 100644
--- a/Gui/Form/Transform.cpp
+++ b/Gui/Form/Transform.cpp
@@ -162,16 +162,25 @@ void CheckCondition::SetTasks(const QVector& tasks)
tasks_ = tasks;
}
-InfoMsg CheckCondition::GetInfoMsg() const
+QVector CheckCondition::GetTasks() const
{
- return infoMsg_;
+ return tasks_;
}
void CheckCondition::recvFrame(QSharedPointer frame)
{
InfoMsg info = infoUnpack(frame->data);
if (info.command == STRMSG_AC_ANSWER_FILE_EXIST) {
- infoMsg_ = info;
+
+ for (auto& item : info.mapData) {
+ auto it =
+ std::find_if(tasks_.begin(), tasks_.end(), [&item](const TransTask& task) { return task.taskUUID == item.uuid; });
+ if (it == tasks_.end()) {
+ continue;
+ }
+ it->remoteCheckState = static_cast(item.state);
+ }
+
qInfo() << tr("检查结束......");
msg_ = info.command;
return;
@@ -209,9 +218,11 @@ void CheckCondition::run()
// 再检查远程文件是否存在
InfoMsg msg;
msg.command = STRMSG_AC_CHECK_FILE_EXIST;
- for (const auto& task : tasks_) {
- msg.mapData[task.taskUUID].mark = task.isUpload ? STRMSG_AC_UP : STRMSG_AC_DOWN;
- msg.mapData[task.taskUUID].key = task.remotePath;
+
+ for (auto& task : tasks_) {
+ msg.mapData[task.taskUUID].uuid = task.taskUUID;
+ msg.mapData[task.taskUUID].command = task.isUpload ? STRMSG_AC_UP : STRMSG_AC_DOWN;
+ msg.mapData[task.taskUUID].path = task.remotePath;
}
auto f = clientCore_->GetBuffer(msg, FBT_MSGINFO_ASK, clientCore_->GetRemoteID());
diff --git a/Gui/Form/Transform.h b/Gui/Form/Transform.h
index 8f1a39b..2e47b46 100644
--- a/Gui/Form/Transform.h
+++ b/Gui/Form/Transform.h
@@ -85,7 +85,7 @@ public:
public:
void SetClientCore(ClientCore* clientCore);
void SetTasks(const QVector& tasks);
- InfoMsg GetInfoMsg() const;
+ QVector GetTasks() const;
Q_SIGNALS:
void sigCheckOver();
@@ -103,7 +103,6 @@ private:
bool isAlreadyInter_;
QVector tasks_;
ClientCore* clientCore_{};
- InfoMsg infoMsg_;
};
#endif // TRANSFORM_H
\ No newline at end of file
diff --git a/Gui/frelayGUI.cpp b/Gui/frelayGUI.cpp
index 69bf7f8..e0a16b3 100644
--- a/Gui/frelayGUI.cpp
+++ b/Gui/frelayGUI.cpp
@@ -2,10 +2,12 @@
#include