modified simurun
This commit is contained in:
parent
ff5e3e74ad
commit
b7e775ef33
BIN
doc/~$$流程图.~vsdx
Normal file
BIN
doc/~$$流程图.~vsdx
Normal file
Binary file not shown.
58
src/Dyt.qrc
58
src/Dyt.qrc
@ -1,39 +1,39 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>res/sys_close.png</file>
|
||||
<file>res/sys_float.png</file>
|
||||
<file>res/sys_float.png</file>
|
||||
<file>res/sys_max.png</file>
|
||||
<file>res/sys_min.png</file>
|
||||
<file>res/sys_restore.png</file>
|
||||
<file>res/sys_icon.png</file>
|
||||
<file>res/sys_down.png</file>
|
||||
<file>res/sys_up.png</file>
|
||||
<file>res/select_file.ico</file>
|
||||
<file>res/default/menu_new_file.png</file>
|
||||
<file>res/default/menu_open_file.png</file>
|
||||
<file>res/default/menu_save_file.png</file>
|
||||
<file>res/default/menu_wave_file.png</file>
|
||||
<file>res/default/menu_light_file.png</file>
|
||||
<file>res/default/menu_table_file.png</file>
|
||||
<file>res/default/menu_surface_file.png</file>
|
||||
<file>res/default/menu_save_shape_file.png</file>
|
||||
<file>res/default/menu_save_store_file.png</file>
|
||||
<file>res/default/menu_report_mesh.png</file>
|
||||
<file>res/default/menu_exit.png</file>
|
||||
<file>res/default/menu_helper.png</file>
|
||||
<file>res/default/menu_license.png</file>
|
||||
<file>res/default/menu_logs.png</file>
|
||||
<file>res/default/menu_logs_clean.png</file>
|
||||
<file>res/default/menu_restart.png</file>
|
||||
<file>res/default/menu_setting_restore.png</file>
|
||||
<file>res/default/menu_setting.png</file>
|
||||
<file>res/default/menu_uisetting.png</file>
|
||||
<file>res/default/menu_window_manager.png</file>
|
||||
<file>res/default/menu_window_setting.png</file>
|
||||
<file>res/sys_down.png</file>
|
||||
<file>res/sys_up.png</file>
|
||||
<file>res/select_file.ico</file>
|
||||
<file>res/default/menu_new_file.png</file>
|
||||
<file>res/default/menu_open_file.png</file>
|
||||
<file>res/default/menu_save_file.png</file>
|
||||
<file>res/default/menu_wave_file.png</file>
|
||||
<file>res/default/menu_light_file.png</file>
|
||||
<file>res/default/menu_table_file.png</file>
|
||||
<file>res/default/menu_surface_file.png</file>
|
||||
<file>res/default/menu_save_shape_file.png</file>
|
||||
<file>res/default/menu_save_store_file.png</file>
|
||||
<file>res/default/menu_report_mesh.png</file>
|
||||
<file>res/default/menu_exit.png</file>
|
||||
<file>res/default/menu_helper.png</file>
|
||||
<file>res/default/menu_license.png</file>
|
||||
<file>res/default/menu_logs.png</file>
|
||||
<file>res/default/menu_logs_clean.png</file>
|
||||
<file>res/default/menu_restart.png</file>
|
||||
<file>res/default/menu_setting_restore.png</file>
|
||||
<file>res/default/menu_setting.png</file>
|
||||
<file>res/default/menu_uisetting.png</file>
|
||||
<file>res/default/menu_window_manager.png</file>
|
||||
<file>res/default/menu_window_setting.png</file>
|
||||
<file>res/default/Command.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/qss">
|
||||
<qresource prefix="/qss"/>
|
||||
<qresource prefix="/fonts">
|
||||
<file>res/fonts/fontawesome-webfont.ttf</file>
|
||||
</qresource>
|
||||
<qresource prefix="/fonts">
|
||||
<file>res/fonts/fontawesome-webfont.ttf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
src/res/default/Command.png
Normal file
BIN
src/res/default/Command.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
BIN
src/res/dyt.aps
Normal file
BIN
src/res/dyt.aps
Normal file
Binary file not shown.
@ -34,6 +34,8 @@ DockWidget::DockWidget(const QString& title, QWidget* parent)
|
||||
if (nullptr != windowManagerMenu) {
|
||||
windowManagerMenu->AddDockWidget(this);
|
||||
}
|
||||
|
||||
//setStyleSheet(QString("border: 1px solid #A2C2DB;"));
|
||||
}
|
||||
|
||||
DockWidget::DockWidget(QWidget* parent)
|
||||
|
||||
@ -41,6 +41,8 @@ AddParamSetting::AddParamSetting(const QString& strDir, QWidget* parent)
|
||||
horizontalHeader->setStyleSheet(QString("QHeaderView::section {background-color: %1;}").arg(headerColor.name()));
|
||||
horizontalHeader->setStretchLastSection(true);
|
||||
|
||||
ui.tableWidget->verticalHeader()->setStyleSheet(QString("QHeaderView::section {background-color: %1;}").arg(headerColor.name()));
|
||||
|
||||
connect(ui.pushButton, &QPushButton::clicked, this, &AddParamSetting::slotButtonAdd);
|
||||
connect(ui.pushButton_2, &QPushButton::clicked, this, &AddParamSetting::slotButtonRemove);
|
||||
connect(ui.pushButton_3, &QPushButton::clicked, this, &AddParamSetting::slotButtonCommit);
|
||||
@ -414,20 +416,20 @@ void AddParamSetting::slotButtonRemove()
|
||||
|
||||
void AddParamSetting::slotButtonCommit()
|
||||
{
|
||||
QString strMatlabFile ="";
|
||||
if (WorkSpaceManager::Get().GetCurrent())
|
||||
{
|
||||
if (!WorkSpaceManager::Get().GetCurrent()->GetMatlabParam().isEmpty())
|
||||
{
|
||||
strMatlabFile = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetMatlabParam();
|
||||
}
|
||||
}
|
||||
QString strMatlabFile = m_strDir + "/MatlabParam.m";
|
||||
//if (WorkSpaceManager::Get().GetCurrent())
|
||||
//{
|
||||
// if (!WorkSpaceManager::Get().GetCurrent()->GetMatlabParam().isEmpty())
|
||||
// {
|
||||
// strMatlabFile = RecourceHelper::Get().GetBasePath() + "/" + WorkSpaceManager::Get().GetCurrent()->GetMatlabParam();
|
||||
// }
|
||||
//}
|
||||
|
||||
if (strMatlabFile.isEmpty())
|
||||
{
|
||||
strMatlabFile = RecourceHelper::Get().GetBasePath() + "/workspace/MatlabParam.m";
|
||||
WorkSpaceManager::Get().GetCurrent()->SetMatlabParam("MatlabParam.m");
|
||||
}
|
||||
//if (strMatlabFile.isEmpty())
|
||||
//{
|
||||
// strMatlabFile = RecourceHelper::Get().GetBasePath() + "/workspace/MatlabParam.m";
|
||||
// WorkSpaceManager::Get().GetCurrent()->SetMatlabParam("MatlabParam.m");
|
||||
//}
|
||||
|
||||
QFile file(strMatlabFile);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
|
||||
@ -28,7 +28,6 @@ protected slots:
|
||||
void slotButtonRemove();
|
||||
void slotButtonCommit();
|
||||
|
||||
|
||||
void slotIntMaxValueChanged(int iValue);
|
||||
void slotIntMinValueChanged(int iValue);
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>AddParamSetting</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="editTriggers">
|
||||
@ -65,13 +65,26 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -83,8 +96,8 @@
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -96,8 +109,8 @@
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -105,19 +118,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@ -114,98 +114,98 @@ void MainWindow::InitUI() {
|
||||
}
|
||||
}
|
||||
|
||||
DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0);
|
||||
fitCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitCurveDock));
|
||||
fitCurveDock->setObjectName("Dock.WaveCurveDialog");
|
||||
fitCurveDlg_ = new FitCurveDialog();
|
||||
fitCurveDlg_->AttachDock(fitCurveDock);
|
||||
m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, fitCurveDock);
|
||||
//DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0);
|
||||
//fitCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitCurveDock));
|
||||
//fitCurveDock->setObjectName("Dock.WaveCurveDialog");
|
||||
//fitCurveDlg_ = new FitCurveDialog();
|
||||
//fitCurveDlg_->AttachDock(fitCurveDock);
|
||||
//m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock);
|
||||
//addDockWidget(Qt::BottomDockWidgetArea, fitCurveDock);
|
||||
|
||||
//fitCurveDlg_->InitWaveFile(wavePath);
|
||||
DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0);
|
||||
fitLgCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitLgCurveDock));
|
||||
fitLgCurveDock->setObjectName("Dock.SpeedCurveDialog");
|
||||
//DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0);
|
||||
//fitLgCurveDock->SetDockWidgetTitleBar(new DockTitleBar(fitLgCurveDock));
|
||||
//fitLgCurveDock->setObjectName("Dock.SpeedCurveDialog");
|
||||
|
||||
fitYLgCurveDlg_ = new FitCurveDialog();
|
||||
fitYLgCurveDlg_->AttachDock(fitLgCurveDock);
|
||||
m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, fitLgCurveDock);
|
||||
tabifyDockWidget(fitCurveDock, fitLgCurveDock);
|
||||
//fitYLgCurveDlg_ = new FitCurveDialog();
|
||||
//fitYLgCurveDlg_->AttachDock(fitLgCurveDock);
|
||||
//m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock);
|
||||
//addDockWidget(Qt::BottomDockWidgetArea, fitLgCurveDock);
|
||||
//tabifyDockWidget(fitCurveDock, fitLgCurveDock);
|
||||
|
||||
|
||||
//fitYLgCurveDlg_->InitReportFile(speedPath);
|
||||
|
||||
DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0);
|
||||
surfaceCurveDock->SetDockWidgetTitleBar(new DockTitleBar(surfaceCurveDock));
|
||||
surfaceCurveDock->setObjectName("Dock.3DCurveDialog");
|
||||
//DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0);
|
||||
//surfaceCurveDock->SetDockWidgetTitleBar(new DockTitleBar(surfaceCurveDock));
|
||||
//surfaceCurveDock->setObjectName("Dock.3DCurveDialog");
|
||||
|
||||
surfaceDlg_ = new SurfaceDialog();
|
||||
surfaceDlg_->AttachDock(surfaceCurveDock);
|
||||
m_mapDockWidget.insert("3DCurveDialog", surfaceCurveDock);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, surfaceCurveDock);
|
||||
tabifyDockWidget(fitCurveDock, surfaceCurveDock);
|
||||
//surfaceDlg_ = new SurfaceDialog();
|
||||
//surfaceDlg_->AttachDock(surfaceCurveDock);
|
||||
//m_mapDockWidget.insert("3DCurveDialog", surfaceCurveDock);
|
||||
//addDockWidget(Qt::BottomDockWidgetArea, surfaceCurveDock);
|
||||
//tabifyDockWidget(fitCurveDock, surfaceCurveDock);
|
||||
|
||||
//surfaceDlg_->InitRD(rdPath);
|
||||
|
||||
{
|
||||
targetUITable_ = new TargetListWgt;
|
||||
//{
|
||||
// targetUITable_ = new TargetListWgt;
|
||||
|
||||
QStringList headerLabels;
|
||||
headerLabels << tr("Target number") << tr("Signal-to-noise ratio")
|
||||
<< tr("Azimuth line of sight") << tr("Pitch gaze angle")
|
||||
<< tr("azimuth") << tr("Pitch angle")
|
||||
<< tr("attribute") << tr("Doppler")
|
||||
<< tr("course") << tr("Speed")
|
||||
<< tr("longitude") << tr("latitude")
|
||||
<< tr("distance") << tr("velocity")
|
||||
<< tr("Radial dimensions") << tr("Target RCS");
|
||||
// QStringList headerLabels;
|
||||
// headerLabels << tr("Target number") << tr("Signal-to-noise ratio")
|
||||
// << tr("Azimuth line of sight") << tr("Pitch gaze angle")
|
||||
// << tr("azimuth") << tr("Pitch angle")
|
||||
// << tr("attribute") << tr("Doppler")
|
||||
// << tr("course") << tr("Speed")
|
||||
// << tr("longitude") << tr("latitude")
|
||||
// << tr("distance") << tr("velocity")
|
||||
// << tr("Radial dimensions") << tr("Target RCS");
|
||||
|
||||
targetUITable_->SetHeader(headerLabels);
|
||||
//const QString reportPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt";
|
||||
//targetUITable_->InitFile(speedPath, 50);
|
||||
// targetUITable_->SetHeader(headerLabels);
|
||||
// //const QString reportPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt";
|
||||
// //targetUITable_->InitFile(speedPath, 50);
|
||||
|
||||
DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0);
|
||||
dataTableDock->SetDockWidgetTitleBar(new DockTitleBar(dataTableDock));
|
||||
dataTableDock->setObjectName("Dock.TargetListWgt_Table");
|
||||
// addDockWidget(pSettingUI->GetArea("TargetListWgt"), dataTableDock);
|
||||
targetUITable_->AttachDock(dataTableDock);
|
||||
m_mapDockWidget.insert("TargetListWgt_Table", dataTableDock);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, dataTableDock);
|
||||
tabifyDockWidget(fitCurveDock, dataTableDock);
|
||||
// DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0);
|
||||
// dataTableDock->SetDockWidgetTitleBar(new DockTitleBar(dataTableDock));
|
||||
// dataTableDock->setObjectName("Dock.TargetListWgt_Table");
|
||||
// // addDockWidget(pSettingUI->GetArea("TargetListWgt"), dataTableDock);
|
||||
// targetUITable_->AttachDock(dataTableDock);
|
||||
// m_mapDockWidget.insert("TargetListWgt_Table", dataTableDock);
|
||||
// addDockWidget(Qt::BottomDockWidgetArea, dataTableDock);
|
||||
// tabifyDockWidget(fitCurveDock, dataTableDock);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
const QString lampPath = RecourceHelper::Get().GetBasePath() + "/workspace/Lamp.txt";
|
||||
//const QString lampPath = RecourceHelper::Get().GetBasePath() + "/workspace/Lamp.txt";
|
||||
|
||||
DockWidget* signalIndicatorLampDock = new DockWidget(tr("Signal Indicator Lamp"), 0);
|
||||
signalIndicatorLampDock->SetDockWidgetTitleBar(new DockTitleBar(signalIndicatorLampDock));
|
||||
signalIndicatorLampDock->setObjectName("Dock.SignalIndicatorLampUI");
|
||||
signalIndicatorLampUI_ = new SignalIndicatorLampUI;
|
||||
signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
|
||||
//signalIndicatorLampUI_->InitLamp(lampPath);
|
||||
//DockWidget* signalIndicatorLampDock = new DockWidget(tr("Signal Indicator Lamp"), 0);
|
||||
//signalIndicatorLampDock->SetDockWidgetTitleBar(new DockTitleBar(signalIndicatorLampDock));
|
||||
//signalIndicatorLampDock->setObjectName("Dock.SignalIndicatorLampUI");
|
||||
//signalIndicatorLampUI_ = new SignalIndicatorLampUI;
|
||||
//signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
|
||||
////signalIndicatorLampUI_->InitLamp(lampPath);
|
||||
|
||||
m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, signalIndicatorLampDock);
|
||||
tabifyDockWidget(fitCurveDock, signalIndicatorLampDock);
|
||||
//m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
|
||||
//addDockWidget(Qt::BottomDockWidgetArea, signalIndicatorLampDock);
|
||||
//tabifyDockWidget(fitCurveDock, signalIndicatorLampDock);
|
||||
|
||||
DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0);
|
||||
addParamSettingDock->SetDockWidgetTitleBar(new DockTitleBar(addParamSettingDock));
|
||||
addParamSettingDock->setObjectName("Dock.ParamSetting");
|
||||
addParamDlg_ = new AddParamSetting(matlabParam);
|
||||
addParamDlg_->AttachDock(addParamSettingDock);
|
||||
m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, addParamSettingDock);
|
||||
tabifyDockWidget(fitCurveDock, addParamSettingDock);
|
||||
// DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0);
|
||||
// addParamSettingDock->SetDockWidgetTitleBar(new DockTitleBar(addParamSettingDock));
|
||||
// addParamSettingDock->setObjectName("Dock.ParamSetting");
|
||||
// addParamDlg_ = new AddParamSetting(matlabParam);
|
||||
// addParamDlg_->AttachDock(addParamSettingDock);
|
||||
// m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
|
||||
// addDockWidget(Qt::BottomDockWidgetArea, addParamSettingDock);
|
||||
// tabifyDockWidget(fitCurveDock, addParamSettingDock);
|
||||
|
||||
DockWidget* matlabDock = new DockWidget(tr("bat File"), 0);
|
||||
matlabDock->SetDockWidgetTitleBar(new DockTitleBar(matlabDock));
|
||||
matlabDock->setObjectName("Dock.Matlab");
|
||||
matlabFileDlg_ = new CodeEdtUI;
|
||||
matlabFileDlg_->AttachDock(matlabDock);
|
||||
m_mapDockWidget.insert("Matlab", matlabDock);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, matlabDock);
|
||||
tabifyDockWidget(fitCurveDock, matlabDock);
|
||||
//DockWidget* matlabDock = new DockWidget(tr("bat File"), 0);
|
||||
//matlabDock->SetDockWidgetTitleBar(new DockTitleBar(matlabDock));
|
||||
//matlabDock->setObjectName("Dock.Matlab");
|
||||
//matlabFileDlg_ = new CodeEdtUI;
|
||||
//matlabFileDlg_->AttachDock(matlabDock);
|
||||
//m_mapDockWidget.insert("Matlab", matlabDock);
|
||||
// addDockWidget(Qt::BottomDockWidgetArea, matlabDock);
|
||||
// tabifyDockWidget(fitCurveDock, matlabDock);
|
||||
|
||||
//ui->discript->setText(tr("name: 5year 0412"));
|
||||
//ui->status->setText(tr("start: no start"));
|
||||
|
||||
@ -1,22 +1,23 @@
|
||||
#include "ui/Menu/SimuRunMenu.h"
|
||||
#include "ui/Layout/AddParamSetting.h"
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QGroupBox>
|
||||
|
||||
#include "workspace/WorkSpaceManager.h"
|
||||
#include "workspace/WorkSpace.h"
|
||||
#include "workspace/CommandManager.h"
|
||||
|
||||
SimuRunMenu::SimuRunMenu(QWidget *parent)
|
||||
: QWidget(parent) {
|
||||
ui.setupUi(this);
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_pParam = NULL;
|
||||
|
||||
// Create a vertical layout to host grouped command rows
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(9, 0, 0, 0);
|
||||
layout->setSpacing(6);
|
||||
setLayout(layout);
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(9, 0, 0, 0);
|
||||
layout->setSpacing(6);
|
||||
setLayout(layout);
|
||||
|
||||
// Refresh when workspace changes
|
||||
connect(&WorkSpaceManager::Get(), &WorkSpaceManager::WorkSpaceChanged,
|
||||
@ -36,72 +37,154 @@ void SimuRunMenu::OnWorkspaceChanged(WorkSpace* ws) {
|
||||
|
||||
void SimuRunMenu::RefreshButtons() {
|
||||
// Clear existing buttons
|
||||
if (auto* layout = qobject_cast<QVBoxLayout*>(this->layout())) {
|
||||
while (layout->count() > 0) {
|
||||
QLayoutItem* item = layout->takeAt(0);
|
||||
if (item) {
|
||||
if (auto* w = item->widget()) {
|
||||
w->deleteLater();
|
||||
}
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
}
|
||||
ClearAllBtn();
|
||||
|
||||
CreateMatlabParam();
|
||||
CreateLine();
|
||||
|
||||
auto* ws = WorkSpaceManager::Get().GetCurrent();
|
||||
if (!ws) {
|
||||
if (!ws)
|
||||
{
|
||||
// Show hint when no workspace
|
||||
if (auto* layout = qobject_cast<QVBoxLayout*>(this->layout())) {
|
||||
if (auto* layout = qobject_cast<QHBoxLayout*>(this->layout())) {
|
||||
auto* hint = new QLabel(tr("no workspace"), this);
|
||||
layout->addWidget(hint);
|
||||
}
|
||||
|
||||
CreateSpacer();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CommandManager mgr;
|
||||
const auto items = mgr.ListCommands(ws);
|
||||
if (items.empty()) {
|
||||
if (auto* layout = qobject_cast<QVBoxLayout*>(this->layout())) {
|
||||
if (items.empty())
|
||||
{
|
||||
if (auto* layout = qobject_cast<QHBoxLayout*>(this->layout())) {
|
||||
auto* hint = new QLabel(tr("no commands"), this);
|
||||
layout->addWidget(hint);
|
||||
}
|
||||
|
||||
CreateSpacer();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Render all commands in a single group without trigger distinction
|
||||
CreateGroup(tr("Commands"), items);
|
||||
|
||||
CreateSpacer();
|
||||
}
|
||||
|
||||
void SimuRunMenu::CreateGroup(const QString& title,
|
||||
const std::vector<Command>& items) {
|
||||
auto* root = qobject_cast<QVBoxLayout*>(this->layout());
|
||||
auto* root = qobject_cast<QHBoxLayout*>(this->layout());
|
||||
if (!root) return;
|
||||
|
||||
auto* label = new QLabel(title, this);
|
||||
root->addWidget(label);
|
||||
QGroupBox * groupBox = new QGroupBox;
|
||||
QHBoxLayout * hGroupLayout = new QHBoxLayout;
|
||||
hGroupLayout->setContentsMargins(10, 0, 10, 0);
|
||||
groupBox->setTitle(title);
|
||||
groupBox->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
auto* row = new QHBoxLayout();
|
||||
row->setSpacing(6);
|
||||
for (const auto& item : items) {
|
||||
auto* btn = new QToolButton(this);
|
||||
btn->setText(item.name.isEmpty() ? tr("unnamed") : item.name);
|
||||
QString tip = item.descript;
|
||||
if (!item.program.isEmpty()) {
|
||||
tip += QStringLiteral("\nprog: ") + item.program;
|
||||
}
|
||||
if (!item.path.isEmpty()) {
|
||||
tip += QStringLiteral("\npath: ") + item.path;
|
||||
}
|
||||
btn->setToolTip(tip);
|
||||
row->addWidget(btn);
|
||||
for (const auto& item : items) {
|
||||
auto* btn = new QToolButton(this);
|
||||
btn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
btn->setText(item.name.isEmpty() ? tr("unnamed") : item.name);
|
||||
btn->setIcon(QIcon(":/res/default/Command.png"));
|
||||
QString tip = item.descript;
|
||||
if (!item.program.isEmpty()) {
|
||||
tip += QStringLiteral("\nprog: ") + item.program;
|
||||
}
|
||||
if (!item.path.isEmpty()) {
|
||||
tip += QStringLiteral("\npath: ") + item.path;
|
||||
}
|
||||
btn->setToolTip(tip);
|
||||
hGroupLayout->addWidget(btn);
|
||||
|
||||
connect(btn, &QToolButton::clicked, this, [name = item.name]() {
|
||||
auto* wsCur = WorkSpaceManager::Get().GetCurrent();
|
||||
if (!wsCur) return;
|
||||
CommandManager execMgr;
|
||||
execMgr.ExecuteByName(wsCur, name);
|
||||
});
|
||||
}
|
||||
row->addStretch(1);
|
||||
root->addLayout(row);
|
||||
connect(btn, &QToolButton::clicked, this, [name = item.name]() {
|
||||
auto* wsCur = WorkSpaceManager::Get().GetCurrent();
|
||||
if (!wsCur) return;
|
||||
CommandManager execMgr;
|
||||
execMgr.ExecuteByName(wsCur, name);
|
||||
});
|
||||
}
|
||||
|
||||
groupBox->setLayout(hGroupLayout);
|
||||
root->addWidget(groupBox);
|
||||
}
|
||||
|
||||
void SimuRunMenu::CreateMatlabParam()
|
||||
{
|
||||
QHBoxLayout* layout = qobject_cast<QHBoxLayout*>(this->layout());
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
QToolButton *pBtn = new QToolButton();
|
||||
pBtn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
pBtn->setText(tr("MatlabParam"));
|
||||
pBtn->setIcon(QIcon(":/res/default/menu_setting_restore.png"));
|
||||
pBtn->setToolTip(tr("MatlabParam"));
|
||||
|
||||
connect(pBtn, SIGNAL(clicked()), this, SLOT(slotHandleMatlabParam()));
|
||||
|
||||
layout->addWidget(pBtn);
|
||||
}
|
||||
|
||||
void SimuRunMenu::CreateLine()
|
||||
{
|
||||
QHBoxLayout* layout = qobject_cast<QHBoxLayout*>(this->layout());
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
QFrame *line = new QFrame(this);
|
||||
line->setObjectName(QString::fromUtf8("line"));
|
||||
line->setFrameShadow(QFrame::Plain);
|
||||
line->setFrameShape(QFrame::VLine);
|
||||
|
||||
layout->addWidget(line);
|
||||
}
|
||||
|
||||
void SimuRunMenu::CreateSpacer()
|
||||
{
|
||||
QHBoxLayout* layout = qobject_cast<QHBoxLayout*>(this->layout());
|
||||
if (!layout)
|
||||
return;
|
||||
|
||||
QSpacerItem *horizontalSpacer = new QSpacerItem(441, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
layout->addItem(horizontalSpacer);
|
||||
}
|
||||
|
||||
void SimuRunMenu::ClearAllBtn()
|
||||
{
|
||||
if (auto* layout = qobject_cast<QHBoxLayout*>(this->layout()))
|
||||
{
|
||||
while (layout->count() > 0)
|
||||
{
|
||||
QLayoutItem* item = layout->takeAt(0);
|
||||
if (item)
|
||||
{
|
||||
if (auto* w = item->widget())
|
||||
{
|
||||
w->deleteLater();
|
||||
}
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SimuRunMenu::slotHandleMatlabParam()
|
||||
{
|
||||
if (WorkSpaceManager::Get().GetCurrent())
|
||||
{
|
||||
if (!m_pParam)
|
||||
{
|
||||
QString strDir = WorkSpaceManager::Get().GetCurrent()->GetDir();
|
||||
m_pParam = new AddParamSetting(strDir);
|
||||
}
|
||||
|
||||
m_pParam->setWindowTitle(tr("MatlabParam"));
|
||||
m_pParam->show();
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_SimuRunMenu.h"
|
||||
#include <QToolButton>
|
||||
#include "workspace/CommandManager.h"
|
||||
#include "workspace/CommandExecutor.h"
|
||||
|
||||
class AddParamSetting;
|
||||
|
||||
class SimuRunMenu : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
@ -15,12 +17,18 @@ public:
|
||||
private slots:
|
||||
void OnWorkspaceChanged(class WorkSpace* ws);
|
||||
|
||||
void slotHandleMatlabParam();
|
||||
|
||||
private:
|
||||
void RefreshButtons();
|
||||
void CreateGroup(const QString& title,
|
||||
const std::vector<Command>& items);
|
||||
void CreateMatlabParam();
|
||||
void CreateLine();
|
||||
void CreateSpacer();
|
||||
|
||||
void ClearAllBtn();
|
||||
|
||||
private:
|
||||
Ui::SimuRunMenuClass ui;
|
||||
AddParamSetting *m_pParam;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user