diff --git a/src/app/Application.cpp b/src/app/Application.cpp index c06bb2e2..a0884bd1 100644 --- a/src/app/Application.cpp +++ b/src/app/Application.cpp @@ -25,7 +25,6 @@ QString Application::GetWorkSpacePath() { void Application::Init() { Singleton::Create(this); - //Singleton::Create(this); Singleton::Create(this); Singleton::Create(this); Singleton::Create(this); @@ -39,6 +38,5 @@ void Application::Uninit() { Singleton::Destory(); Singleton::Destory(); Singleton::Destory(); - //Singleton::Destory(); Singleton::Destory(); } diff --git a/src/translations/Dyt_zh_CN.ts b/src/translations/Dyt_zh_CN.ts index a6789c74..87e57480 100644 --- a/src/translations/Dyt_zh_CN.ts +++ b/src/translations/Dyt_zh_CN.ts @@ -96,6 +96,26 @@ + Wave文件 + + + + + Report文件 + + + + + RD文件 + + + + + Matlab文件 + + + + Run Simu diff --git a/src/ui/Dialog.cpp b/src/ui/Dialog.cpp index 28042aa8..4b490c42 100644 --- a/src/ui/Dialog.cpp +++ b/src/ui/Dialog.cpp @@ -9,8 +9,7 @@ Dialog::Dialog(QWidget* parent) : QDialog(parent) - , ui_(new Ui::Dialog) - /*, delegate_(FramelessDelegate::Create(this)) */{ + , ui_(new Ui::Dialog) { setWindowFlags(windowFlags() | Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint); ui_->setupUi(this); @@ -20,8 +19,6 @@ Dialog::Dialog(QWidget* parent) Dialog::~Dialog() { delete ui_; - //delete delegate_; - //delegate_ = nullptr; } void Dialog::DeleteThisOnClose() { @@ -30,10 +27,6 @@ void Dialog::DeleteThisOnClose() { void Dialog::SetTitleBar(FrameTitleBar* titleBar) { - /* delegate_->SetTitleBar(titleBar); - - QVBoxLayout* layout = reinterpret_cast(this->layout()); - layout->insertWidget(0, titleBar, 0);*/ } void Dialog::SetTitle(const QString& title) { @@ -53,9 +46,6 @@ bool Dialog::nativeEvent(const QByteArray& eventType, void* message, long* resul bool Dialog::nativeEvent(const QByteArray& eventType, void* message, qintptr* result) { #endif return QDialog::nativeEvent(eventType, message, result); - /*if (!delegate_->nativeEvent(eventType, message, result)) { - return QDialog::nativeEvent(eventType, message, result); - }*/ return true; } @@ -68,21 +58,4 @@ void Dialog::paintEvent(QPaintEvent* event) { } void Dialog::InitFrame() { - /* ui-> - FrameTitleBar* titleBar = new FrameTitleBar(this); - titleBar->SetMainWidget(this); - - titleBar->SetSysButton(FrameTitleBar::FTB_ICON | FrameTitleBar::FTB_CLOSE | FrameTitleBar::FTB_TTILE); - - QVBoxLayout* layout = new QVBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(0); - - layout->setStretch(0, 0); - layout->setStretch(1, 1); - layout->setAlignment(Qt::AlignLeft | Qt::AlignTop); - SetTitleBar(titleBar); - - mainDilag_ = new QWidget(this); - layout->addWidget(mainDilag_, 1);*/ } diff --git a/src/ui/Menu/ChartPlotMenu.cpp b/src/ui/Menu/ChartPlotMenu.cpp index 7d4d9407..b6415578 100644 --- a/src/ui/Menu/ChartPlotMenu.cpp +++ b/src/ui/Menu/ChartPlotMenu.cpp @@ -6,6 +6,8 @@ #include "workspace/WorkSpaceManager.h" #include +#include + ChartPlotMenu::ChartPlotMenu(QWidget *parent) : QWidget(parent) { @@ -24,13 +26,9 @@ void ChartPlotMenu::InitMenu() connect(ui.toolButton, &QToolButton::clicked, this, [=] { if (WorkSpaceManager::Get().GetCurrent()) { - QString strFile = WorkSpaceManager::Get().GetCurrent()->GetSimMatlab(); if (!strFile.isEmpty()) { - strFile = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetSimMatlab(); - - //MatlabObject::GetInstance()->RunMatlabFile("D:\\DYT\\TestGUI\\xierutest.m"); MatlabObject::GetInstance()->RunMatlabFile(strFile); } else @@ -39,4 +37,149 @@ void ChartPlotMenu::InitMenu() } } }); + + connect(ui.toolButton_2, &QToolButton::clicked, this, [=] { + auto current = WorkSpaceManager::Get().GetCurrent(); + if (nullptr == current) { + QMessageBox::information(nullptr, QString::fromLocal8Bit("Ìáʾ"), QString::fromLocal8Bit("ÇëÏÈ´´½¨¿Õ¼ä£¡")); + return; + } + QString strSel = QFileDialog::getOpenFileName(this, u8"Ñ¡Ôñ·ÂÕæÔËÐÐÎļþ", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.m"); + if (strSel.isEmpty()) { + LOG_WARN("Ñ¡ÔñÎļþΪ¿Õ"); + return; + } + + const QString old = current->GetSimMatlab(); + if (old == strSel) { + LOG_INFO("Ñ¡ÔñÎļþÓ뵱ǰÎļþÏàͬ"); + return; + } else if (!old.isEmpty()) { + if (QMessageBox::Yes == QMessageBox::question(nullptr, + QString::fromLocal8Bit("ѯÎÊ"), + QString::fromLocal8Bit("Ìæ»»µ±Ç°·ÂÕæÎļþ£¡"), + QMessageBox::Yes | QMessageBox::No) + ) { + if (!QFile::remove(old)) { + LOG_WARN("ɾ³ýÎļþʧ°Ü"); + QMessageBox::information(nullptr, + QString::fromLocal8Bit("Ìáʾ"), + QString::fromLocal8Bit("ɾ³ýÎļþʧ°Ü£¡")); + return; + } + } + } + + current->SetSimMatlab(strSel); + }); + + connect(ui.toolButton_5, &QToolButton::clicked, this, [=] { + auto current = WorkSpaceManager::Get().GetCurrent(); + if (nullptr == current) { + QMessageBox::information(nullptr, QString::fromLocal8Bit("Ìáʾ"), QString::fromLocal8Bit("ÇëÏÈ´´½¨¿Õ¼ä£¡")); + return; + } + QString strSel = QFileDialog::getOpenFileName(this, u8"Ñ¡ÔñWaveÎļþ", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt"); + if (strSel.isEmpty()) { + LOG_WARN("Ñ¡ÔñÎļþΪ¿Õ"); + return; + } + + const QString old = current->GetWavePath(); + if (old == strSel) { + LOG_INFO("Ñ¡ÔñÎļþÓ뵱ǰÎļþÏàͬ"); + return; + } + else if (!old.isEmpty()) { + if (QMessageBox::Yes == QMessageBox::question(nullptr, + QString::fromLocal8Bit("ѯÎÊ"), + QString::fromLocal8Bit("Ìæ»»µ±Ç°WaveÎļþ£¡"), + QMessageBox::Yes | QMessageBox::No) + ) { + if (!QFile::remove(old)) { + LOG_WARN("ɾ³ýÎļþʧ°Ü"); + QMessageBox::information(nullptr, + QString::fromLocal8Bit("Ìáʾ"), + QString::fromLocal8Bit("ɾ³ýÎļþʧ°Ü£¡")); + return; + } + } + } + + current->SetWavePath(strSel); + }); + + connect(ui.toolButton_3, &QToolButton::clicked, this, [=] { + auto current = WorkSpaceManager::Get().GetCurrent(); + if (nullptr == current) { + QMessageBox::information(nullptr, QString::fromLocal8Bit("Ìáʾ"), QString::fromLocal8Bit("ÇëÏÈ´´½¨¿Õ¼ä£¡")); + return; + } + QString strSel = QFileDialog::getOpenFileName(this, u8"Ñ¡ÔñRDÎļþ", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt"); + if (strSel.isEmpty()) { + LOG_WARN("Ñ¡ÔñÎļþΪ¿Õ"); + return; + } + + const QString old = current->GetRDPath(); + if (old == strSel) { + LOG_INFO("Ñ¡ÔñÎļþÓ뵱ǰÎļþÏàͬ"); + return; + } + else if (!old.isEmpty()) { + if (QFileInfo(old).isFile()) { + if (QMessageBox::Yes == QMessageBox::question(nullptr, + QString::fromLocal8Bit("ѯÎÊ"), + QString::fromLocal8Bit("Ìæ»»µ±Ç°RDÎļþ£¡"), + QMessageBox::Yes | QMessageBox::No) + ) { + if (!QFile::remove(old)) { + LOG_WARN("ɾ³ýÎļþʧ°Ü"); + QMessageBox::information(nullptr, + QString::fromLocal8Bit("Ìáʾ"), + QString::fromLocal8Bit("ɾ³ýÎļþʧ°Ü£¡")); + return; + } + } + } + } + + current->SetRDPath(strSel); + }); + + connect(ui.toolButton_4, &QToolButton::clicked, this, [=] { + auto current = WorkSpaceManager::Get().GetCurrent(); + if (nullptr == current) { + QMessageBox::information(nullptr, QString::fromLocal8Bit("Ìáʾ"), QString::fromLocal8Bit("ÇëÏÈ´´½¨¿Õ¼ä£¡")); + return; + } + QString strSel = QFileDialog::getOpenFileName(this, u8"Ñ¡ÔñReportÎļþ", RecourceHelper::Get().GetBasePath() + "/workspace/", "*.txt"); + if (strSel.isEmpty()) { + LOG_WARN("Ñ¡ÔñÎļþΪ¿Õ"); + return; + } + + const QString old = current->GetReportPath(); + if (old == strSel) { + LOG_INFO("Ñ¡ÔñÎļþÓ뵱ǰÎļþÏàͬ"); + return; + } + else if (!old.isEmpty()) { + if (QMessageBox::Yes == QMessageBox::question(nullptr, + QString::fromLocal8Bit("ѯÎÊ"), + QString::fromLocal8Bit("Ìæ»»µ±Ç°ReportÎļþ£¡"), + QMessageBox::Yes | QMessageBox::No) + ) { + if (!QFile::remove(old)) { + LOG_WARN("ɾ³ýÎļþʧ°Ü"); + QMessageBox::information(nullptr, + QString::fromLocal8Bit("Ìáʾ"), + QString::fromLocal8Bit("ɾ³ýÎļþʧ°Ü£¡")); + return; + } + } + } + + current->SetReportPath(strSel); + }); } diff --git a/src/ui/Menu/ChartPlotMenu.ui b/src/ui/Menu/ChartPlotMenu.ui index 6fed6772..bb5c389d 100644 --- a/src/ui/Menu/ChartPlotMenu.ui +++ b/src/ui/Menu/ChartPlotMenu.ui @@ -16,6 +16,58 @@ + + + + + 60 + 30 + + + + Wave文件 + + + + + + + + 60 + 30 + + + + Report文件 + + + + + + + + 60 + 30 + + + + RD文件 + + + + + + + + 60 + 30 + + + + Matlab文件 + + + diff --git a/src/ui/ModelBrowser/ModelTreeWidget.cpp b/src/ui/ModelBrowser/ModelTreeWidget.cpp index dad2bb61..c92e7ff3 100644 --- a/src/ui/ModelBrowser/ModelTreeWidget.cpp +++ b/src/ui/ModelBrowser/ModelTreeWidget.cpp @@ -346,37 +346,6 @@ void ModelTreeWidget::OnTrackEntity(Entity* entity) { LOG_INFO("track entity: {}", entity->GetName().toStdString()); workspace->TrackEntity(entity); - //scene->Track - //MainWindow:: - //OsgCameraManipulator* manipulator = OsgViewer::Get().GetView()->GetCameraManipulator(); - //if (nullptr == manipulator) { - // LOG_WARN("manipulator is nullptr"); - // return; - //} - - // - //osgGA::CameraManipulator* gaManipulator = manipulator->GetManipulator(); - //osgEarth::Util::EarthManipulator* ccm = dynamic_cast(gaManipulator); - //if (nullptr != ccm) { - // if (nullptr != entity) { - // osg::MatrixTransform* mt = entity->GetRootComponent()->GetMatrixTransform(); - // ccm->setNode(mt); - // ccm->getSettings()->setTetherMode(osgEarth::Util::EarthManipulator::TETHER_CENTER); - // osgEarth::Util::Viewpoint newVP; - // newVP.setNode(mt); - // double range = mt->getBound().radius() * 10.0; - // newVP.range()->set(range, osgEarth::Units::METERS); - - // const osg::Vec3 rotation = entity->GetRootComponent()->GetTransform()->GetRotation(); - // newVP.heading()->set(rotation.x(), osgEarth::Units::DEGREES); - // newVP.pitch()->set(rotation.y() - 15.0, osgEarth::Units::DEGREES); - // //newVP.roll()->set(rotation.z(), osgEarth::Units::DEGREES); - // ccm->setViewpoint(newVP, 1.5); - // //ccm->setTetherMode(osgGA::CameraManipulator::TETHER_CENTER_AND_ROTATION); - // } else { - // ccm->clearViewpoint(); - // } - //} } void ModelTreeWidget::AddEntity(class QTreeWidgetItem* parent, Entity* entity) {