添加仿真命令文件

This commit is contained in:
brige 2025-10-11 08:32:25 +08:00
parent 209d3efe02
commit bfd45c3a4a
6 changed files with 103 additions and 20 deletions

View File

@ -1762,21 +1762,32 @@
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="63"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="63"/>
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="94"/>
<source>...</source> <source>...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="74"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="74"/>
<source>commond Path</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="87"/>
<source>select commond file path</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="105"/>
<source>describe</source> <source>describe</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="101"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="132"/>
<source>Sure</source> <source>Sure</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="108"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.ui" line="139"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1786,49 +1797,54 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="51"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="52"/>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="57"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="58"/>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="67"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="68"/>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="74"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="75"/>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="83"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="84"/>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="89"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="90"/>
<source>warning</source> <source>warning</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="51"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="52"/>
<source>name or save path is empty, please check it</source> <source>name or save path is empty, please check it</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="57"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="58"/>
<source>save current workspace?</source> <source>save current workspace?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="67"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="68"/>
<source>current path is contains current folder, do you want to overwrite it?</source> <source>current path is contains current folder, do you want to overwrite it?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="74"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="75"/>
<source>removeRecursively failed</source> <source>removeRecursively failed</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="83"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="84"/>
<source>mkpath failed</source> <source>mkpath failed</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="89"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="90"/>
<source>name is exits</source> <source>name is exits</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="104"/> <location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="106"/>
<source>save spaceWork directory</source> <source>save spaceWork directory</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../ui/WorkSpace/WorkSpaceDlg.cpp" line="119"/>
<source>select commond file directory</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View File

@ -33,6 +33,7 @@ void WorkSpaceDlg::InitConnect() {
connect(ui->pbSure, &QPushButton::clicked, this, &WorkSpaceDlg::OnSure); connect(ui->pbSure, &QPushButton::clicked, this, &WorkSpaceDlg::OnSure);
connect(ui->pbCancel, &QPushButton::clicked, this, &WorkSpaceDlg::reject); connect(ui->pbCancel, &QPushButton::clicked, this, &WorkSpaceDlg::reject);
connect(ui->tbPath, &QPushButton::clicked, this, &WorkSpaceDlg::OnSelectSavePath); 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) { connect(ui->leName, &QLineEdit::textChanged, [this](const QString& txt) {
QString path = QString("%1/%2").arg(path_).arg(txt); QString path = QString("%1/%2").arg(path_).arg(txt);
ui->lePath->setText(path); ui->lePath->setText(path);
@ -93,6 +94,7 @@ void WorkSpaceDlg::OnSure() {
workspacePath += QString("/%1.dyt").arg(name); workspacePath += QString("/%1.dyt").arg(name);
WorkSpace* workSpace = WorkSpaceManager::Get().GetOrCreate(workspacePath, name); WorkSpace* workSpace = WorkSpaceManager::Get().GetOrCreate(workspacePath, name);
workSpace->SetDescribe(ui->etDescribe->toPlainText()); workSpace->SetDescribe(ui->etDescribe->toPlainText());
workSpace->SetCommondFilePath(commondPath_);
WorkSpaceManager::Get().SetCurrent(workSpace); WorkSpaceManager::Get().SetCurrent(workSpace);
accept(); accept();
@ -110,6 +112,19 @@ void WorkSpaceDlg::OnSelectSavePath() {
ui->lePath->setText(QString("%1/%2").arg(path_).arg(ui->leName->text())); ui->lePath->setText(QString("%1/%2").arg(path_).arg(ui->leName->text()));
LOG_INFO("save path: {}", path_.toLocal8Bit().constData()); 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() { //void WorkSpaceDlg::InitFrame() {
// FrameTitleBar* titleBar = new FrameTitleBar(this); // FrameTitleBar* titleBar = new FrameTitleBar(this);

View File

@ -18,10 +18,12 @@ protected:
void OnSure(); void OnSure();
void OnSelectSavePath(); void OnSelectSavePath();
void OnSelectCommondPath();
//void InitFrame(); //void InitFrame();
private: private:
Ui::WorkSpaceDlg* ui; Ui::WorkSpaceDlg* ui;
QString path_; QString path_;
QString commondPath_;
}; };

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>345</width> <width>528</width>
<height>243</height> <height>418</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -66,6 +66,37 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>commond Path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="leCommondPath">
<property name="text">
<string/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>select commond file path</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tbCommondPath">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@ -113,8 +144,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources> <resources/>
<include location="../Hydro.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -39,6 +39,22 @@ const QString WorkSpace::GetDir() const {
return info.absolutePath(); 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) { void WorkSpace::SetSimMatlab(const QString& path) {
QFileInfo fileInfo(path); QFileInfo fileInfo(path);
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName()); QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());

View File

@ -46,6 +46,10 @@ public:
inline const QString& GetDescribe() const { inline const QString& GetDescribe() const {
return describe_; return describe_;
} }
void SetCommondFilePath(const QString& path);
const QString GetCommondFilePath() const;
void SetSimMatlab(const QString& path); void SetSimMatlab(const QString& path);
const QString GetSimMatlab() const; const QString GetSimMatlab() const;
@ -134,6 +138,7 @@ private:
QString uuid_; QString uuid_;
QString describe_; QString describe_;
QString path_; QString path_;
QString commondPath_;
QString simMatlabPath_; QString simMatlabPath_;
QString waveFile_; QString waveFile_;