diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts
index 9fd52a0a..41b77004 100644
--- a/src/translations/Dyt_zh_CN.ts
+++ b/src/translations/Dyt_zh_CN.ts
@@ -1762,21 +1762,32 @@
+
...
+ commond Path
+
+
+
+
+ select commond file path
+
+
+
+
describe
-
+
Sure
-
+
Cancel
@@ -1786,49 +1797,54 @@
-
-
-
-
-
-
+
+
+
+
+
+
warning
-
+
name or save path is empty, please check it
-
+
save current workspace?
-
+
current path is contains current folder, do you want to overwrite it?
-
+
removeRecursively failed
-
+
mkpath failed
-
+
name is exits
-
+
save spaceWork directory
+
+
+ select commond file directory
+
+
diff --git a/src/ui/WorkSpace/WorkSpaceDlg.cpp b/src/ui/WorkSpace/WorkSpaceDlg.cpp
index 4918bb9e..525d10ca 100644
--- a/src/ui/WorkSpace/WorkSpaceDlg.cpp
+++ b/src/ui/WorkSpace/WorkSpaceDlg.cpp
@@ -33,6 +33,7 @@ void WorkSpaceDlg::InitConnect() {
connect(ui->pbSure, &QPushButton::clicked, this, &WorkSpaceDlg::OnSure);
connect(ui->pbCancel, &QPushButton::clicked, this, &WorkSpaceDlg::reject);
connect(ui->tbPath, &QPushButton::clicked, this, &WorkSpaceDlg::OnSelectSavePath);
+ connect(ui->tbCommondPath, &QPushButton::clicked, this, &WorkSpaceDlg::OnSelectCommondPath);
connect(ui->leName, &QLineEdit::textChanged, [this](const QString& txt) {
QString path = QString("%1/%2").arg(path_).arg(txt);
ui->lePath->setText(path);
@@ -93,6 +94,7 @@ void WorkSpaceDlg::OnSure() {
workspacePath += QString("/%1.dyt").arg(name);
WorkSpace* workSpace = WorkSpaceManager::Get().GetOrCreate(workspacePath, name);
workSpace->SetDescribe(ui->etDescribe->toPlainText());
+ workSpace->SetCommondFilePath(commondPath_);
WorkSpaceManager::Get().SetCurrent(workSpace);
accept();
@@ -110,6 +112,19 @@ void WorkSpaceDlg::OnSelectSavePath() {
ui->lePath->setText(QString("%1/%2").arg(path_).arg(ui->leName->text()));
LOG_INFO("save path: {}", path_.toLocal8Bit().constData());
}
+
+void WorkSpaceDlg::OnSelectCommondPath() {
+ const QString workspacePath = Application::GetWorkSpacePath();
+ const QString savePath = QFileDialog::getExistingDirectory(this,
+ tr("select commond file directory"), workspacePath, QFileDialog::DontResolveSymlinks);
+ if (savePath.isEmpty()) {
+ LOG_WARN("save commond file is empty");
+ return;
+ }
+ commondPath_ = savePath;
+ ui->leCommondPath->setText(QString("%1").arg(commondPath_));
+ LOG_INFO("select path: {}", commondPath_.toLocal8Bit().constData());
+}
//
//void WorkSpaceDlg::InitFrame() {
// FrameTitleBar* titleBar = new FrameTitleBar(this);
diff --git a/src/ui/WorkSpace/WorkSpaceDlg.h b/src/ui/WorkSpace/WorkSpaceDlg.h
index 1719ae5f..5f5dd525 100644
--- a/src/ui/WorkSpace/WorkSpaceDlg.h
+++ b/src/ui/WorkSpace/WorkSpaceDlg.h
@@ -18,10 +18,12 @@ protected:
void OnSure();
void OnSelectSavePath();
+ void OnSelectCommondPath();
//void InitFrame();
private:
Ui::WorkSpaceDlg* ui;
QString path_;
+ QString commondPath_;
};
\ No newline at end of file
diff --git a/src/ui/WorkSpace/WorkSpaceDlg.ui b/src/ui/WorkSpace/WorkSpaceDlg.ui
index cc58cbd1..ed2de71d 100644
--- a/src/ui/WorkSpace/WorkSpaceDlg.ui
+++ b/src/ui/WorkSpace/WorkSpaceDlg.ui
@@ -6,8 +6,8 @@
0
0
- 345
- 243
+ 528
+ 418
@@ -66,6 +66,37 @@
+ -
+
+
-
+
+
+ commond Path
+
+
+
+ -
+
+
+
+
+
+ true
+
+
+ select commond file path
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
-
-
@@ -113,8 +144,6 @@
-
-
-
+
diff --git a/src/workspace/WorkSpace.cpp b/src/workspace/WorkSpace.cpp
index 9836479f..e78296d9 100644
--- a/src/workspace/WorkSpace.cpp
+++ b/src/workspace/WorkSpace.cpp
@@ -39,6 +39,22 @@ const QString WorkSpace::GetDir() const {
return info.absolutePath();
}
+void WorkSpace::SetCommondFilePath(const QString& path) {
+ QFileInfo fileInfo(path);
+ QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
+ bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
+ LOG_INFO("copy commond file {}: {} to {}",
+ path.toLocal8Bit().data(),
+ dirPath.toLocal8Bit().data(),
+ sucess);
+ commondPath_ = fileInfo.fileName();
+}
+
+const QString WorkSpace::GetCommondFilePath() const {
+ QString path = QString("%1/%2").arg(GetDir(), commondPath_);
+ return path;
+}
+
void WorkSpace::SetSimMatlab(const QString& path) {
QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
diff --git a/src/workspace/WorkSpace.h b/src/workspace/WorkSpace.h
index b5b44259..ff39f11a 100644
--- a/src/workspace/WorkSpace.h
+++ b/src/workspace/WorkSpace.h
@@ -46,6 +46,10 @@ public:
inline const QString& GetDescribe() const {
return describe_;
}
+
+ void SetCommondFilePath(const QString& path);
+ const QString GetCommondFilePath() const;
+
void SetSimMatlab(const QString& path);
const QString GetSimMatlab() const;
@@ -134,6 +138,7 @@ private:
QString uuid_;
QString describe_;
QString path_;
+ QString commondPath_;
QString simMatlabPath_;
QString waveFile_;