|
|
|
@ -0,0 +1,954 @@
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QStackedLayout>
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QWidgetAction>
|
|
|
|
|
#include <QScrollBar>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QTableView>
|
|
|
|
|
#include <QSplitter>
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
// 是å<C2AF>¦å<C2A6>¯ç”¨QMainWindow自带的è<E2809E>œå<C593>•æ <20>
|
|
|
|
|
//#define USE_DEFAULT_MENU_BAR
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
|
QMainWindow(parent),
|
|
|
|
|
ui(new Ui::MainWindow)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
this->variate_map = new Variate_Map;
|
|
|
|
|
// 建立项目与主界é<C592>¢çš„è<E2809E>”ç³»
|
|
|
|
|
this->work_project = new Work_Project;
|
|
|
|
|
this->work_project->father = this;
|
|
|
|
|
|
|
|
|
|
// syn界é<C592>¢å¸ƒå±€è®¾ç½®
|
|
|
|
|
qmainwindow_syn = new QMainWindow();
|
|
|
|
|
QWidget *widget_syn = new QWidget();
|
|
|
|
|
|
|
|
|
|
QHBoxLayout *layout_syn = new QHBoxLayout(widget_syn);
|
|
|
|
|
layout_syn->addWidget(ui->widget);
|
|
|
|
|
widget_syn->setLayout(layout_syn);
|
|
|
|
|
qmainwindow_syn->setCentralWidget(widget_syn);
|
|
|
|
|
qmainwindow_syn->addDockWidget(Qt::TopDockWidgetArea, ui->dockWidget_src_syn);
|
|
|
|
|
|
|
|
|
|
// qmainwindow_syn->addDockWidget(Qt::BottomDockWidgetArea, ui->dockWidget_cmd_syn);
|
|
|
|
|
|
|
|
|
|
// QVBoxLayout *layout = new QVBoxLayout(widget_syn);
|
|
|
|
|
// layout->addWidget(ui->widget, 0, Qt::AlignLeft);
|
|
|
|
|
// QVBoxLayout *layout = new QVBoxLayout;
|
|
|
|
|
// layout->addWidget(ui->widget);
|
|
|
|
|
// QHBoxLayout *hLayout = new QHBoxLayout;
|
|
|
|
|
// hLayout->addWidget(ui->widget);
|
|
|
|
|
// QWidget *centralWidget = new QWidget;
|
|
|
|
|
// centralWidget->setLayout(hLayout);
|
|
|
|
|
// qmainwindow_syn->setCentralWidget(ui->widget);
|
|
|
|
|
// layout1->addWidget(button);
|
|
|
|
|
// ui->widget->setLayout(layout1);
|
|
|
|
|
// ui->widget->setGeometry(0, 0, 150, 600);
|
|
|
|
|
|
|
|
|
|
ui->tabWidget_flow->addTab(qmainwindow_syn, "Syn");
|
|
|
|
|
ui->tabWidget_flow->removeTab(0);
|
|
|
|
|
|
|
|
|
|
// pt界é<C592>¢å¸ƒå±€è®¾ç½®
|
|
|
|
|
qmainwindow_pt = new QMainWindow();
|
|
|
|
|
qmainwindow_pt->setCentralWidget(new QWidget());
|
|
|
|
|
qmainwindow_pt->addDockWidget(Qt::TopDockWidgetArea, ui->dockWidget_src_pt);
|
|
|
|
|
qmainwindow_pt->addDockWidget(Qt::BottomDockWidgetArea, ui->dockWidget_cmd_pt);
|
|
|
|
|
|
|
|
|
|
ui->tabWidget_flow->removeTab(0);
|
|
|
|
|
ui->tabWidget_flow->addTab(qmainwindow_pt, "PT");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 在å<C2A8>³ä¾§æµ®åŠ¨çª—å<E28094>£ä¸æ·»åŠ report窗å<E28094>£
|
|
|
|
|
// dockWidget_report_syn = new QDockWidget(tr("report"), this);
|
|
|
|
|
// dockWidget_report_syn->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetClosable);
|
|
|
|
|
// dockWidget_report_syn->setVisible(true);
|
|
|
|
|
// addDockWidget(Qt::RightDockWidgetArea, dockWidget_report_syn);
|
|
|
|
|
// qmainwindow_syn->tabifyDockWidget(ui->dockWidget_src_syn, dockWidget_report_syn);
|
|
|
|
|
// ui->dockWidget_src_syn->raise();
|
|
|
|
|
|
|
|
|
|
// 在左侧浮动窗å<E28094>£ä¸æ·»åŠ module窗å<E28094>£
|
|
|
|
|
tabifyDockWidget(ui->dockWidget_file, ui->dockWidget_module);
|
|
|
|
|
ui->dockWidget_file->raise();
|
|
|
|
|
|
|
|
|
|
//指定è<C5A1>œå<C593>•æ <20>
|
|
|
|
|
#ifdef USE_DEFAULT_MENU_BAR
|
|
|
|
|
//æ·»åŠ è<>œå<C593>•æ <20>(æ¤å¤„æ·»åŠ ä¸ºçš„ä¸ºQMainWindow自带的è<E2809E>œå<C593>•)
|
|
|
|
|
pMenuBar = this->menuBar();
|
|
|
|
|
#else
|
|
|
|
|
//æ·»åŠ è‡ªå®šä¹‰è<E280B0>œå<C593>•
|
|
|
|
|
pMenuBar = new QMenuBar(this);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//定义è<E280B0>œå<C593>•项
|
|
|
|
|
//(&n)代表快æ<C2AB>·æ–¹å¼<C3A5>,当窗å<E28094>£èŽ·å¾—ç„¦ç‚¹æ—¶æŒ‰alt+nå<6E>³å<C2B3>¯æ‰“开“测试â€<C3A2>è<EFBFBD>œå<C593>•项
|
|
|
|
|
pMenu1 = new QMenu("文件(&n)",this);
|
|
|
|
|
pMenu2 = new QMenu("执行",this);
|
|
|
|
|
pMenu3 = new QMenu("工具",this);
|
|
|
|
|
|
|
|
|
|
//定义å<C3A5>è<EFBFBD>œå<C593>•
|
|
|
|
|
//(&s)为å<C3A5>è<EFBFBD>œå<C593>•å¿«æ<C2AB>·é”®ï¼Œå½“打开该è<C2A5>œå<C593>•项å<C2B9>Žï¼ŒæŒ‰ä¸‹â€˜s’键å<C2AE>³å<C2B3>¯å“<C3A5>应
|
|
|
|
|
pAction_newproject = new QAction("新建项目(&s)",this);
|
|
|
|
|
//æ–°å»ºä¸€ä¸ªå¸¦å›¾æ ‡çš„è<E2809E>œå<C593>•é¡¹ï¼Œå›¾æ ‡ä½¿ç”¨èµ„æº<C3A6>文件ä¸çš„资æº<C3A6>
|
|
|
|
|
pAction_openproject = new QAction(QIcon(":/new/prefix1/resource/soccer_ball.ico"),"打开项目",this);
|
|
|
|
|
pAction_save = new QAction("ä¿<C3A4>å˜",this);
|
|
|
|
|
pAction_syn = new QAction("run syn(&y)",this);
|
|
|
|
|
pAction_parameter_config = new QAction("å<>‚æ•°é…<C3A9>ç½®",this);
|
|
|
|
|
pActionTest5 = new QAction("测试5(&M)",this);
|
|
|
|
|
pActionTest6 = new QAction("测试6",this);
|
|
|
|
|
|
|
|
|
|
//å°†è<E280A0>œå<C593>•é¡¹æ·»åŠ åˆ°å<C3A5>è<EFBFBD>œå<C593>•
|
|
|
|
|
pMenu1->addAction(pAction_newproject);
|
|
|
|
|
pMenu1->addAction(pAction_openproject);
|
|
|
|
|
//在è<C2A8>œå<C593>•é¡¹ä¹‹é—´æ·»åŠ åˆ†å‰²çº¿
|
|
|
|
|
pMenu1->addSeparator();
|
|
|
|
|
pMenu1->addAction(pAction_save);
|
|
|
|
|
|
|
|
|
|
pMenu2->addAction(pAction_parameter_config);
|
|
|
|
|
pMenu2->addAction(pAction_syn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pMenu3->addAction(pActionTest5);
|
|
|
|
|
pMenu3->addAction(pActionTest6);
|
|
|
|
|
|
|
|
|
|
//å°†å<C3A5>è<EFBFBD>œå<C593>•æ·»åŠ åˆ°è<C2B0>œå<C593>•æ <20>
|
|
|
|
|
pMenuBar->addMenu(pMenu1);
|
|
|
|
|
pMenuBar->addMenu(pMenu2);
|
|
|
|
|
pMenuBar->addMenu(pMenu3);
|
|
|
|
|
|
|
|
|
|
// 终端窗å<E28094>£
|
|
|
|
|
ui->pushButton_run_cmd_syn->setFocus();
|
|
|
|
|
ui->pushButton_run_cmd_syn->setShortcut(Qt::Key_Return);
|
|
|
|
|
|
|
|
|
|
m_process_bash = new QProcess;
|
|
|
|
|
m_process_bash->start("bash");
|
|
|
|
|
m_process_bash->waitForStarted();
|
|
|
|
|
m_process_bash->write("cd / \n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置module列表
|
|
|
|
|
this->model_module = new QStandardItemModel;
|
|
|
|
|
model_module->setHorizontalHeaderLabels(QStringList()<<"module name"<<"state");
|
|
|
|
|
this->ui->treeView_module->setModel(model_module);
|
|
|
|
|
this->ui->treeView_module->setColumnWidth(0, 200);
|
|
|
|
|
this->ui->treeView_module->setColumnWidth(1, 50);
|
|
|
|
|
|
|
|
|
|
QMenu *menu_module = new QMenu(this);
|
|
|
|
|
QAction *pAction_newmodule = new QAction("new module", this);
|
|
|
|
|
QAction *pAction_delmodule = new QAction("delete module", this);
|
|
|
|
|
menu_module->addAction(pAction_newmodule);
|
|
|
|
|
menu_module->addAction(pAction_delmodule);
|
|
|
|
|
ui->treeView_module->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
|
|
|
|
|
|
|
|
// 建立信å<C2A1>·æ§½è¿žæŽ¥ï¼Œå¤„ç<E2809E>†moduleæ ‘å½¢åˆ—è¡¨å<C2A8>³é”®è<C2AE>œå<C593>•事件
|
|
|
|
|
connect(ui->treeView_module, &QTreeView::customContextMenuRequested, this, [=](const QPoint &pos) {
|
|
|
|
|
// 显示å<C2BA>³é”®è<C2AE>œå<C593>•
|
|
|
|
|
menu_module->popup(ui->treeView_module->viewport()->mapToGlobal(pos));
|
|
|
|
|
});
|
|
|
|
|
// new mdoule槽连接
|
|
|
|
|
connect(pAction_newmodule, &QAction::triggered, this, &MainWindow::New_module);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef USE_DEFAULT_MENU_BAR
|
|
|
|
|
//当ä¸<C3A4>使用QMainWindow自带的è<E2809E>œå<C593>•æ <20>时,必须è¦<C3A8>åŠ ä¸Šæ¤è¡Œ
|
|
|
|
|
setMenuBar(pMenuBar);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//æ·»åŠ è<>œå<C593>•å“<C3A5>应函数
|
|
|
|
|
connect(pAction_newproject, &QAction::triggered, this->work_project, &Work_Project::New_Project_1);
|
|
|
|
|
connect(pAction_openproject,&QAction::triggered,this,&MainWindow::OpenProject);
|
|
|
|
|
connect(pAction_parameter_config, &QAction::triggered, this, &MainWindow::Parameter_Config);
|
|
|
|
|
|
|
|
|
|
connect(m_process_bash, &QProcess::readyReadStandardOutput, this, &MainWindow::readBashStandardOutputInfo);
|
|
|
|
|
connect(m_process_bash, &QProcess::readyReadStandardError, this, &MainWindow::readBashStandardErrorInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 打开项目å“<C3A5>应函数
|
|
|
|
|
void MainWindow::OpenProject()
|
|
|
|
|
{
|
|
|
|
|
this->work_project->uwe_project_path = QFileDialog::getExistingDirectory(this, "打开项目", "/home/UWE/zj");
|
|
|
|
|
chdir(work_project->uwe_project_path.toStdString().data());
|
|
|
|
|
work_project->Get_Work_config();
|
|
|
|
|
|
|
|
|
|
//è®¾ç½®æ ‘å½¢æ–‡ä»¶åˆ—è¡¨
|
|
|
|
|
this->model_file = new QFileSystemModel;
|
|
|
|
|
this->model_file->setRootPath(this->work_project->uwe_project_path);
|
|
|
|
|
this->ui->treeView_file->setModel(this->model_file);
|
|
|
|
|
this->ui->treeView_file->setRootIndex(this->model_file->index(this->work_project->uwe_project_path));
|
|
|
|
|
this->ui->treeView_file->setHeaderHidden(true);
|
|
|
|
|
this->ui->treeView_file->setColumnHidden(1, true);
|
|
|
|
|
this->ui->treeView_file->setColumnHidden(2, true);
|
|
|
|
|
this->ui->treeView_file->setColumnHidden(3, true);
|
|
|
|
|
|
|
|
|
|
connect(this->ui->treeView_file, &QTreeView::clicked, this, &MainWindow::TreeClicked);
|
|
|
|
|
|
|
|
|
|
//终端进入工作项目
|
|
|
|
|
string cmd_cd = "cd " + work_project->uwe_project_path.toStdString() + "\n pwd \n";
|
|
|
|
|
this->m_process_bash->write(cmd_cd.data());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string get_current_date();
|
|
|
|
|
// å<>‚æ•°é…<C3A9>ç½®å“<C3A5>应函数
|
|
|
|
|
void MainWindow::Parameter_Config()
|
|
|
|
|
{
|
|
|
|
|
this->variate_map->add_variate("TCLPATH", ".");
|
|
|
|
|
this->variate_map->add_variate("DCWORK", "./dc.work");
|
|
|
|
|
this->variate_map->add_variate("current_date", get_current_date());
|
|
|
|
|
//this->variate_map->Generate_Config_File();
|
|
|
|
|
|
|
|
|
|
this->ui->textEdit_cmd_syn->append("Parameter config completed!\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新建项目1å“<C3A5>应函数
|
|
|
|
|
void Work_Project::New_Project_1()
|
|
|
|
|
{
|
|
|
|
|
QDialog *qdialog = new QDialog;
|
|
|
|
|
qdialog->setWindowTitle("新建项目");
|
|
|
|
|
qdialog->setFixedSize(800, 450);
|
|
|
|
|
|
|
|
|
|
QHBoxLayout *layout = new QHBoxLayout(qdialog);
|
|
|
|
|
QListWidget *listWidget = new QListWidget;
|
|
|
|
|
listWidget->setMinimumWidth(150);
|
|
|
|
|
listWidget->setFont(QFont("宋体",14));
|
|
|
|
|
listWidget->addItem("Project1");
|
|
|
|
|
listWidget->addItem("");
|
|
|
|
|
QWidget *widget1 = new QWidget, *widget2 = new QWidget;
|
|
|
|
|
widget1->setMaximumHeight(350); widget2->setMaximumHeight(350);
|
|
|
|
|
QLabel *lab1 = new QLabel("创建项目æµ<C3A6>程主è¦<C3A8>包括导入项目路径ã€<C3A3>导入代ç <20>\n路径ã€<C3A3>选择顶层模å<C2A1>—", widget1);
|
|
|
|
|
lab1->setFont(QFont("宋体", 15));
|
|
|
|
|
lab1->setWordWrap(true);
|
|
|
|
|
lab1->adjustSize();
|
|
|
|
|
lab1->setMinimumSize(500, 100);
|
|
|
|
|
QLabel *lab2 = new QLabel("", widget2);
|
|
|
|
|
QStackedLayout *stackedLayout = new QStackedLayout;
|
|
|
|
|
stackedLayout->addWidget(widget1);
|
|
|
|
|
stackedLayout->addWidget(widget2);
|
|
|
|
|
|
|
|
|
|
layout->addWidget(listWidget, 2);
|
|
|
|
|
layout->addLayout(stackedLayout, 3);
|
|
|
|
|
qdialog->setLayout(layout);
|
|
|
|
|
|
|
|
|
|
QPushButton *button_next = new QPushButton("下一æ¥", qdialog);
|
|
|
|
|
button_next->move(568, 400);
|
|
|
|
|
QPushButton *button_cancel = new QPushButton("å<>–消", qdialog);
|
|
|
|
|
button_cancel->move(675, 400);
|
|
|
|
|
|
|
|
|
|
QObject::connect(listWidget, &QListWidget::currentRowChanged, stackedLayout, &QStackedLayout::setCurrentIndex);
|
|
|
|
|
QObject::connect(button_next, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
QObject::connect(button_next, &QPushButton::clicked, this, &Work_Project::New_Project_2);
|
|
|
|
|
QObject::connect(button_cancel, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
|
|
|
|
|
qdialog->exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 新建项目2å“<C3A5>应函数(新建项目2对è¯<C3A8>框)
|
|
|
|
|
void Work_Project::New_Project_2()
|
|
|
|
|
{
|
|
|
|
|
QDialog *qdialog = new QDialog;
|
|
|
|
|
qdialog->setWindowTitle("新建项目");
|
|
|
|
|
qdialog->setFixedSize(800,450);
|
|
|
|
|
|
|
|
|
|
//æ·»åŠ è¡¨æ ¼å¸ƒå±€
|
|
|
|
|
QFormLayout* layout = new QFormLayout();
|
|
|
|
|
layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
|
|
|
|
|
edit_uwe_project_path = new QLineEdit();
|
|
|
|
|
edit_uwe_project_name = new QLineEdit();
|
|
|
|
|
layout->addRow("项目路径:", edit_uwe_project_path);
|
|
|
|
|
layout->addRow("新建项目å<C2AE><C3A5>ç§°:", edit_uwe_project_name);
|
|
|
|
|
|
|
|
|
|
// 选择路径按钮
|
|
|
|
|
QPushButton *button_work_project_path = new QPushButton(edit_uwe_project_path);
|
|
|
|
|
button_work_project_path->setText("......");
|
|
|
|
|
button_work_project_path->setCursor(Qt::ArrowCursor);
|
|
|
|
|
QWidgetAction* action = new QWidgetAction(edit_uwe_project_path);
|
|
|
|
|
action->setDefaultWidget(button_work_project_path);
|
|
|
|
|
edit_uwe_project_path->addAction(action, QLineEdit::TrailingPosition);
|
|
|
|
|
|
|
|
|
|
// å°†å¸ƒå±€æ·»åŠ åˆ°å¯¹è¯<C3A8>框
|
|
|
|
|
qdialog->setLayout(layout);
|
|
|
|
|
|
|
|
|
|
// æ“<C3A6>作按键
|
|
|
|
|
QPushButton *button_next = new QPushButton("下一æ¥", qdialog);
|
|
|
|
|
button_next->move(568, 400);
|
|
|
|
|
QPushButton *button_back = new QPushButton("上一æ¥", qdialog);
|
|
|
|
|
button_back->move(675, 400);
|
|
|
|
|
|
|
|
|
|
// 按键å“<C3A5>应信å<C2A1>·æ§½å‡½æ•°
|
|
|
|
|
connect(button_work_project_path, &QPushButton::clicked, [=](){
|
|
|
|
|
this->uwe_project_path = QFileDialog::getExistingDirectory(0, "选择目录", "/home/UWE/zj");
|
|
|
|
|
edit_uwe_project_path->setText(uwe_project_path);
|
|
|
|
|
});
|
|
|
|
|
connect(button_next, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
connect(button_next, &QPushButton::clicked, this, &Work_Project::New_setup_lib_path);
|
|
|
|
|
QObject::connect(button_back, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
QObject::connect(button_back, &QPushButton::clicked, this, &Work_Project::New_Project_1);
|
|
|
|
|
|
|
|
|
|
// 显示对è¯<C3A8>框
|
|
|
|
|
qdialog->exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// lib_path setup设置界é<C592>¢
|
|
|
|
|
void Work_Project::New_setup_lib_path()
|
|
|
|
|
{
|
|
|
|
|
// ä¿<C3A4>å˜UWE项目信æ<C2A1>¯
|
|
|
|
|
uwe_project_name = edit_uwe_project_name->text();
|
|
|
|
|
uwe_project_path = edit_uwe_project_path->text();
|
|
|
|
|
|
|
|
|
|
// 新建对è¯<C3A8>框
|
|
|
|
|
QDialog *qdialog = new QDialog;
|
|
|
|
|
qdialog->setWindowTitle("库路径é…<C3A9>ç½®");
|
|
|
|
|
qdialog->setFixedSize(800,400);
|
|
|
|
|
|
|
|
|
|
// 新建my_lib_path列表
|
|
|
|
|
QListWidget *qlistwidget_lib_path = new QListWidget(qdialog);
|
|
|
|
|
qlistwidget_lib_path->resize(600, 350);
|
|
|
|
|
// 如果list_lib_pathä¸<C3A4>为空(å<CB86>³ä¸Šä¸€æ¥é€€å›žï¼‰
|
|
|
|
|
if (!list_lib_path.isEmpty()){
|
|
|
|
|
foreach(QString lib_path, list_lib_path)
|
|
|
|
|
qlistwidget_lib_path->addItem(lib_path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// æ·»åŠ æ·»åŠ è·¯å¾„, åˆ é™¤è·¯å¾„ï¼Œä¸‹ä¸€æ¥ï¼Œä¸Šä¸€æ¥æŒ‰é”®
|
|
|
|
|
QPushButton *button_addpath = new QPushButton("æ·»åŠ è·¯å¾„", qdialog);
|
|
|
|
|
button_addpath->move(650, 100);
|
|
|
|
|
QPushButton *button_delpath = new QPushButton("åˆ é™¤è·¯å¾„", qdialog);
|
|
|
|
|
button_delpath->move(650, 160);
|
|
|
|
|
QPushButton *button_next = new QPushButton("下一æ¥", qdialog);
|
|
|
|
|
button_next->move(670, 270);
|
|
|
|
|
QPushButton *button_previous = new QPushButton("上一æ¥", qdialog);
|
|
|
|
|
button_previous->move(670, 310);
|
|
|
|
|
|
|
|
|
|
// add path按键å“<C3A5>应
|
|
|
|
|
connect(button_addpath, &QPushButton::clicked, [=](){
|
|
|
|
|
QString lib_path = QFileDialog::getExistingDirectory(0, "选择库路径", "/home/UWE/zj", QFileDialog::ShowDirsOnly);
|
|
|
|
|
if (!list_lib_path.contains(lib_path)){
|
|
|
|
|
qlistwidget_lib_path->addItem(lib_path);
|
|
|
|
|
list_lib_path.append(lib_path);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// del path按键å“<C3A5>应
|
|
|
|
|
connect(button_delpath, &QPushButton::clicked, [=](){
|
|
|
|
|
QListWidgetItem* selectedItem = qlistwidget_lib_path->currentItem();
|
|
|
|
|
if (selectedItem != nullptr) {
|
|
|
|
|
QString lib_path = selectedItem->text();
|
|
|
|
|
list_lib_path.removeOne(lib_path);
|
|
|
|
|
qlistwidget_lib_path->takeItem(qlistwidget_lib_path->row(selectedItem));
|
|
|
|
|
delete selectedItem;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// next step按键å“<C3A5>应
|
|
|
|
|
connect(button_next, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
connect(button_next, &QPushButton::clicked, this, &Work_Project::New_setup_target_library);
|
|
|
|
|
// previous step按键å“<C3A5>应
|
|
|
|
|
connect(button_previous, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
connect(button_previous, &QPushButton::clicked, this, &Work_Project::New_Project_2);
|
|
|
|
|
|
|
|
|
|
// 显示对è¯<C3A8>框
|
|
|
|
|
qdialog->exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 从lib_path䏿<C2AD><C3A6>å<EFBFBD>–lib 函数
|
|
|
|
|
void Work_Project::Extract_lib()
|
|
|
|
|
{
|
|
|
|
|
// lib_pathä¸<C3A4>为空
|
|
|
|
|
if (!list_lib_path.isEmpty()){
|
|
|
|
|
// é<><C3A9>历所有lib_path,æ<C592><C3A6>å<EFBFBD>–å…¶ä¸çš„lib
|
|
|
|
|
foreach (QString lib_path, list_lib_path){
|
|
|
|
|
QDir dir(lib_path);
|
|
|
|
|
QFileInfoList list = dir.entryInfoList();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
|
|
|
QFileInfo fileInfo = list.at(i);
|
|
|
|
|
if (fileInfo.isFile()) {
|
|
|
|
|
QString fileName = fileInfo.fileName();
|
|
|
|
|
if ((list_lib.indexOf(fileName) == -1) && (fileName.endsWith(".db", Qt::CaseInsensitive) || fileName.endsWith(".lib", Qt::CaseInsensitive)))
|
|
|
|
|
list_lib.append(fileName);
|
|
|
|
|
QString filePath = fileInfo.filePath();
|
|
|
|
|
// 处ç<E2809E>†å<C3A5>目录
|
|
|
|
|
} else if (fileInfo.isDir() && fileInfo.fileName() != "." && fileInfo.fileName() != "..") {
|
|
|
|
|
QDir subDir(fileInfo.filePath());
|
|
|
|
|
subDir.setFilter(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
|
|
|
|
QFileInfoList subList = subDir.entryInfoList();
|
|
|
|
|
for (int j = 0; j < subList.size(); ++j) {
|
|
|
|
|
QFileInfo subFileInfo = subList.at(j);
|
|
|
|
|
QString fileName = subFileInfo.fileName();
|
|
|
|
|
if ((list_lib.indexOf(fileName) == -1) && (fileName.endsWith(".db", Qt::CaseInsensitive) || fileName.endsWith(".lib", Qt::CaseInsensitive)))
|
|
|
|
|
list_lib.append(fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 展示lib 函数
|
|
|
|
|
QTableView* Work_Project::Show_lib(QList<QString>& list_lib, QStandardItemModel *model)
|
|
|
|
|
{
|
|
|
|
|
QTableView *tableView = new QTableView();
|
|
|
|
|
int size = list_lib.size();
|
|
|
|
|
int remainder = size % 4;
|
|
|
|
|
for (int i = 0; i < size-remainder; i=i+4) {
|
|
|
|
|
QList<QStandardItem*> rowItems;
|
|
|
|
|
rowItems.append(new QStandardItem(list_lib[i]));
|
|
|
|
|
rowItems.append(new QStandardItem(list_lib[i+1]));
|
|
|
|
|
rowItems.append(new QStandardItem(list_lib[i+2]));
|
|
|
|
|
rowItems.append(new QStandardItem(list_lib[i+3]));
|
|
|
|
|
model->appendRow(rowItems);
|
|
|
|
|
}
|
|
|
|
|
QList<QStandardItem*> rowItems;
|
|
|
|
|
for (int i = size-remainder; i < size; i++)
|
|
|
|
|
rowItems.append(new QStandardItem(list_lib[i]));
|
|
|
|
|
model->appendRow(rowItems);
|
|
|
|
|
|
|
|
|
|
tableView->setModel(model);
|
|
|
|
|
tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
|
|
|
tableView->resizeColumnsToContents();
|
|
|
|
|
tableView->resizeRowsToContents();
|
|
|
|
|
tableView->setWordWrap(true);
|
|
|
|
|
|
|
|
|
|
return tableView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// target_library选择界é<C592>¢
|
|
|
|
|
void Work_Project::New_setup_target_library()
|
|
|
|
|
{
|
|
|
|
|
// æ<><C3A6>å<EFBFBD>–lib
|
|
|
|
|
Extract_lib();
|
|
|
|
|
|
|
|
|
|
// 展示lib
|
|
|
|
|
QStandardItemModel *model = new QStandardItemModel();
|
|
|
|
|
QTableView *tableView = Show_lib(list_lib, model);
|
|
|
|
|
|
|
|
|
|
// 对è¯<C3A8>框å<E280A0>ŠæŒ‰é”®
|
|
|
|
|
QDialog *dialog = new QDialog();
|
|
|
|
|
dialog->setWindowTitle("target_library选择");
|
|
|
|
|
dialog->resize(1400, 800);
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout();
|
|
|
|
|
layout->addWidget(tableView);
|
|
|
|
|
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
|
|
|
|
QPushButton *button_next = new QPushButton("确定");
|
|
|
|
|
QPushButton *button_previous = new QPushButton("上一æ¥");
|
|
|
|
|
buttonLayout->addWidget(button_next);
|
|
|
|
|
buttonLayout->addWidget(button_previous);
|
|
|
|
|
layout->addLayout(buttonLayout);
|
|
|
|
|
dialog->setLayout(layout);
|
|
|
|
|
|
|
|
|
|
// å“<C3A5>应函数
|
|
|
|
|
connect(button_next, &QPushButton::clicked, dialog, &QDialog::accept);
|
|
|
|
|
connect(button_previous, &QPushButton::clicked, dialog, &QDialog::close);
|
|
|
|
|
connect(button_previous, &QPushButton::clicked, this, &Work_Project::New_setup_lib_path);
|
|
|
|
|
|
|
|
|
|
if (dialog->exec() == QDialog::Accepted) {
|
|
|
|
|
QItemSelectionModel *selectionModel = tableView->selectionModel();
|
|
|
|
|
QModelIndexList selectedIndexes = selectionModel->selectedIndexes();
|
|
|
|
|
|
|
|
|
|
// iterate over the selected indexes and add their rows to the set
|
|
|
|
|
for (const QModelIndex &index : selectedIndexes) {
|
|
|
|
|
QString lib = model->data(model->index(index.row(), index.column())).toString();
|
|
|
|
|
list_target_lib_selected.append(lib);
|
|
|
|
|
}
|
|
|
|
|
// 进入下一界é<C592>¢
|
|
|
|
|
New_setup_link_library();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// link_library选择界é<C592>¢
|
|
|
|
|
void Work_Project::New_setup_link_library()
|
|
|
|
|
{
|
|
|
|
|
// 展示lib
|
|
|
|
|
QStandardItemModel *model = new QStandardItemModel();
|
|
|
|
|
QTableView *tableView = Show_lib(list_lib, model);
|
|
|
|
|
|
|
|
|
|
// 对è¯<C3A8>框å<E280A0>ŠæŒ‰é”®
|
|
|
|
|
QDialog *dialog = new QDialog();
|
|
|
|
|
dialog->setWindowTitle("link_library选择");
|
|
|
|
|
dialog->resize(1400, 800);
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout();
|
|
|
|
|
layout->addWidget(tableView);
|
|
|
|
|
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
|
|
|
|
QPushButton *button_next = new QPushButton("确定");
|
|
|
|
|
QPushButton *button_previous = new QPushButton("上一æ¥");
|
|
|
|
|
buttonLayout->addWidget(button_next);
|
|
|
|
|
buttonLayout->addWidget(button_previous);
|
|
|
|
|
layout->addLayout(buttonLayout);
|
|
|
|
|
dialog->setLayout(layout);
|
|
|
|
|
|
|
|
|
|
// å“<C3A5>应函数
|
|
|
|
|
connect(button_next, &QPushButton::clicked, dialog, &QDialog::accept);
|
|
|
|
|
connect(button_previous, &QPushButton::clicked, dialog, &QDialog::close);
|
|
|
|
|
connect(button_previous, &QPushButton::clicked, this, &Work_Project::New_setup_target_library);
|
|
|
|
|
|
|
|
|
|
if (dialog->exec() == QDialog::Accepted) {
|
|
|
|
|
QItemSelectionModel *selectionModel = tableView->selectionModel();
|
|
|
|
|
QModelIndexList selectedIndexes = selectionModel->selectedIndexes();
|
|
|
|
|
|
|
|
|
|
// iterate over the selected indexes and add their rows to the set
|
|
|
|
|
for (const QModelIndex &index : selectedIndexes) {
|
|
|
|
|
QString lib = model->data(model->index(index.row(), index.column())).toString();
|
|
|
|
|
list_link_lib_selected.append(lib);
|
|
|
|
|
}
|
|
|
|
|
// 进入下一界é<C592>¢
|
|
|
|
|
Src_Project_Environment_set();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 芯片环境设置å“<C3A5>应函数
|
|
|
|
|
void Work_Project::Src_Project_Environment_set()
|
|
|
|
|
{
|
|
|
|
|
QDialog *qdialog = new QDialog;
|
|
|
|
|
qdialog->setWindowTitle("芯片项目环境设置");
|
|
|
|
|
qdialog->setFixedSize(800, 450);
|
|
|
|
|
|
|
|
|
|
//输入框å<E280A0>Šå…¶æŒ‰é’®
|
|
|
|
|
QFormLayout *layout = new QFormLayout;
|
|
|
|
|
layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
|
|
|
|
|
edit_src_project_path = new QLineEdit;
|
|
|
|
|
edit_src_path = new QLineEdit;
|
|
|
|
|
layout->addRow("芯片项目路径:", edit_src_project_path);
|
|
|
|
|
layout->addRow("代ç <20>路径", edit_src_path);
|
|
|
|
|
|
|
|
|
|
QPushButton *button_src_project_path = new QPushButton(edit_src_project_path);
|
|
|
|
|
QPushButton *button_src_path = new QPushButton(edit_src_path);
|
|
|
|
|
button_src_project_path->setText("..."); button_src_path->setText("...");
|
|
|
|
|
button_src_project_path->setCursor(Qt::ArrowCursor); button_src_path->setCursor(Qt::ArrowCursor);
|
|
|
|
|
QWidgetAction *action_Project_path = new QWidgetAction(edit_src_project_path), *action_src_path = new QWidgetAction(edit_src_path);
|
|
|
|
|
action_Project_path->setDefaultWidget(button_src_project_path); action_src_path->setDefaultWidget(button_src_path);
|
|
|
|
|
edit_src_project_path->addAction(action_Project_path, QLineEdit::TrailingPosition); edit_src_path->addAction(action_src_path, QLineEdit::TrailingPosition);
|
|
|
|
|
qdialog->setLayout(layout);
|
|
|
|
|
|
|
|
|
|
//å<>•独按钮
|
|
|
|
|
QPushButton *button_determine = new QPushButton("确定", qdialog), *button_back = new QPushButton("上一æ¥", qdialog);
|
|
|
|
|
button_determine->move(568, 400); button_back->move(675, 400);
|
|
|
|
|
|
|
|
|
|
//按钮对应槽函数
|
|
|
|
|
connect(button_src_project_path, &QPushButton::clicked, [=](){
|
|
|
|
|
this->src_project_path = QFileDialog::getExistingDirectory(0, "选择目录", "/home/UWE/zj");
|
|
|
|
|
edit_src_project_path->setText(src_project_path);
|
|
|
|
|
});
|
|
|
|
|
connect(button_src_path, &QPushButton::clicked, [=](){
|
|
|
|
|
src_path = QFileDialog::getExistingDirectory(0, "选择目录", "/home/UWE/zj");
|
|
|
|
|
edit_src_path->setText(src_path);
|
|
|
|
|
});
|
|
|
|
|
connect(button_determine, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
connect(button_determine, &QPushButton::clicked, this, &Work_Project::Src_Project_Environment_set_Determine);
|
|
|
|
|
connect(button_back, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
connect(button_back, &QPushButton::clicked, this, &Work_Project::New_setup_link_library);
|
|
|
|
|
|
|
|
|
|
qdialog->exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 芯片项目环境é…<C3A9>置确定å“<C3A5>应函数
|
|
|
|
|
void Work_Project::Src_Project_Environment_set_Determine()
|
|
|
|
|
{
|
|
|
|
|
src_project_path = edit_src_project_path->text();
|
|
|
|
|
src_path = edit_src_path->text();
|
|
|
|
|
// module_name = edit_module_name->text();
|
|
|
|
|
|
|
|
|
|
// 生æˆ<C3A6>工作项目对应文件夹
|
|
|
|
|
string str_work_project_path = uwe_project_path.toStdString(), str_work_project_name = uwe_project_name.toStdString();
|
|
|
|
|
chdir(str_work_project_path.data());
|
|
|
|
|
mkdir(str_work_project_name.data(), 0755);
|
|
|
|
|
str_work_project_path += '/' + str_work_project_name;
|
|
|
|
|
chdir(str_work_project_path.data());
|
|
|
|
|
uwe_project_path = QString::fromStdString(str_work_project_path);
|
|
|
|
|
qDebug() << uwe_project_path;
|
|
|
|
|
|
|
|
|
|
// ä¿<C3A4>å˜é…<C3A9>置信æ<C2A1>¯
|
|
|
|
|
Generate_UWE_Work_config();
|
|
|
|
|
|
|
|
|
|
// è®¾ç½®æ ‘å½¢æ–‡ä»¶åˆ—è¡¨
|
|
|
|
|
this->father->model_file = new QFileSystemModel;
|
|
|
|
|
this->father->model_file->setRootPath(uwe_project_path);
|
|
|
|
|
this->father->ui->treeView_file->setModel(this->father->model_file);
|
|
|
|
|
this->father->ui->treeView_file->setRootIndex(this->father->model_file->index(uwe_project_path));
|
|
|
|
|
this->father->ui->treeView_file->setHeaderHidden(true);
|
|
|
|
|
this->father->ui->treeView_file->setColumnHidden(1, true);
|
|
|
|
|
this->father->ui->treeView_file->setColumnHidden(2, true);
|
|
|
|
|
this->father->ui->treeView_file->setColumnHidden(3, true);
|
|
|
|
|
|
|
|
|
|
connect(this->father->ui->treeView_file, &QTreeView::clicked, this->father, &MainWindow::TreeClicked);
|
|
|
|
|
|
|
|
|
|
// 终端进入项目文件夹,链接src代ç <20>文件夹
|
|
|
|
|
string ln_cmd = " ln -s " + this->src_path.toStdString() + ' ' + "./src"; ln_cmd += "\nln -s /home/UWE/zj/tmp/Scripts ./Scripts";
|
|
|
|
|
string cmd_1 = "cd "+str_work_project_path+'\n' + "pwd\n" + ln_cmd+'\n';
|
|
|
|
|
this->father->m_process_bash->write(cmd_1.data());
|
|
|
|
|
|
|
|
|
|
// 生æˆ<C3A6>执行所需tcl文件
|
|
|
|
|
ofstream out1("ProjectPathSetting.tcl", ios::out);
|
|
|
|
|
out1 << "set PROJECTPATH " << this->src_project_path.toStdString() << "\n" << "puts ${PROJECTPATH}";
|
|
|
|
|
out1.close();
|
|
|
|
|
|
|
|
|
|
// make Prepare的一系列æ“<C3A6>作
|
|
|
|
|
string cmd_2 = "echo 'ProjectPathSetting.tcl is generated successfully!\n./src soft link is created.'\n";
|
|
|
|
|
string cmd_cp = "cp -r /home/UWE/zj/tmp/Template/* ./ \ntouch tmp.log \necho 'copy files in Template here.' \ncp -r /home/UWE/zj/tmp/Makefile ./ \n"
|
|
|
|
|
"cp -r /home/UWE/zj/test_1/syn_main.tcl ./ \n";
|
|
|
|
|
string cmd_flist = "filelistpath=`find ./src/ -maxdepth 1 -name '*flist*' -type f` \nfilelistname=${filelistpath#*src/} \necho '`include \"./\"' > ./dc.work/filelist.v \n";
|
|
|
|
|
string cmd_incdir = "incdirlistpath=`find ./src/ -maxdepth 1 -name '*incdir*' -type f` \nincdirlistname=${incdirlistpath#*src/} \necho -f ./src/$incdirlistname \ > ./nc.work/sim_filelist.f \n";
|
|
|
|
|
string cmd_nc = "echo '-f ./src/'$filelistname'' \ >> ./nc.work/sim_filelist.f \necho \" \" >> ./nc.work/sim_filelist.f \necho //Add simulation files bellow >> ./nc.work/sim_filelist.f \n";
|
|
|
|
|
string cmd_mv = "mv ./spyglass.work/demo.prj ./spyglass.work/"; cmd_mv += this->module_name.toStdString(); cmd_mv += ".prj \n";
|
|
|
|
|
cmd_mv += "mv ./spyglass.work/waiver/demo.awl ./spyglass.work/waiver/"+this->module_name.toStdString()+".awl\n";
|
|
|
|
|
cmd_2 += cmd_cp + cmd_flist + cmd_incdir + cmd_nc + cmd_mv;
|
|
|
|
|
//cout << cmd_2;
|
|
|
|
|
this->father->m_process_bash->write(cmd_2.data());
|
|
|
|
|
|
|
|
|
|
// 生æˆ<C3A6>synopsys_dc.setup文件
|
|
|
|
|
Generate_Setup_File();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 生æˆ<C3A6>工作项目é…<C3A9>置文件
|
|
|
|
|
void Work_Project::Generate_UWE_Work_config()
|
|
|
|
|
{
|
|
|
|
|
ofstream out("UWE_Project_config", ios::out);
|
|
|
|
|
out << "uwe_project_path = " << uwe_project_path.toStdString() << endl;
|
|
|
|
|
out << "uwe_project_name = " << uwe_project_name.toStdString() << endl;
|
|
|
|
|
out << "src_project_path = " << src_project_path.toStdString() << endl;
|
|
|
|
|
out << "src_path = " << src_path.toStdString() << endl;
|
|
|
|
|
out.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 生æˆ<C3A6>setup文件
|
|
|
|
|
void Work_Project::Generate_Setup_File()
|
|
|
|
|
{
|
|
|
|
|
// é…<C3A9>ç½®setup默认值
|
|
|
|
|
edit_designer = new QLineEdit(); edit_designer->setText("{c64 group}");
|
|
|
|
|
edit_company = new QLineEdit(); edit_company->setText("{nudt c64}");
|
|
|
|
|
edit_synthetic_library = new QLineEdit(); edit_synthetic_library->setText("{dw_foundation.sldb}");
|
|
|
|
|
edit_target_library = new QLineEdit();
|
|
|
|
|
edit_link_library = new QLineEdit();
|
|
|
|
|
edit_symbol_library=new QLineEdit(); edit_symbol_library->setText("{dw_foundation.sldb}");
|
|
|
|
|
edit_cache_write=new QLineEdit(); edit_cache_write->setText("./cache");
|
|
|
|
|
edit_cache_read=new QLineEdit(); edit_cache_read->setText("$cache_write");
|
|
|
|
|
edit_my_lib_path=new QLineEdit();
|
|
|
|
|
edit_search_path=new QLineEdit(); edit_search_path->setText("$search_path $my_lib_path ");
|
|
|
|
|
edit_suppress_message=new QLineEdit(); edit_suppress_message->setText("{UID-401}");
|
|
|
|
|
edit_define_design_lib=new QLineEdit(); edit_define_design_lib->setText("-path ./analyzed");
|
|
|
|
|
edit_view_script_submenu_items=new QLineEdit(); edit_view_script_submenu_items->setText("{\"Clean Sweep" "remove_design -design\"}");
|
|
|
|
|
|
|
|
|
|
// 生æˆ<C3A6>synopsys_dc.setup文件
|
|
|
|
|
ofstream out_setup("synopsys_dc.setup", ios::out);
|
|
|
|
|
out_setup << "set designer " << this->edit_designer->text().toStdString() << '\n';
|
|
|
|
|
out_setup << "set company " << this->edit_company->text().toStdString() << '\n';
|
|
|
|
|
|
|
|
|
|
out_setup << "set synthetic_library " << this->edit_synthetic_library->text().toStdString() << '\n';
|
|
|
|
|
out_setup << "set target_library {";
|
|
|
|
|
for (int i = 0; i < list_target_lib_selected.size(); i++){
|
|
|
|
|
out_setup << list_target_lib_selected.at(i).toStdString() << ' ';
|
|
|
|
|
} out_setup << '}' << endl;
|
|
|
|
|
|
|
|
|
|
out_setup << "set link_library {";
|
|
|
|
|
for (int i = 0; i < list_link_lib_selected.size(); i++){
|
|
|
|
|
out_setup << list_link_lib_selected.at(i).toStdString() << ' ';
|
|
|
|
|
} out_setup << '}' << endl;
|
|
|
|
|
|
|
|
|
|
out_setup << "set symbol_library " << this->edit_symbol_library->text().toStdString() << '\n';
|
|
|
|
|
out_setup << "set cache_write " << this->edit_cache_write->text().toStdString() << '\n';
|
|
|
|
|
out_setup << "set cache_read $cache_write\n";
|
|
|
|
|
|
|
|
|
|
out_setup << "set my_lib_path \" ../ \\n ./ \\n";
|
|
|
|
|
for (int i = 0; i < list_lib_path.size()-1; i++){
|
|
|
|
|
out_setup << list_lib_path.at(i).toStdString() << " \\\t";
|
|
|
|
|
} out_setup << list_lib_path.at(list_lib_path.size()-1).toStdString() << " \"" << endl;
|
|
|
|
|
|
|
|
|
|
out_setup << "set search_path " << this->edit_search_path->text().toStdString() << '\n';
|
|
|
|
|
out_setup << "suppress_message " << this->edit_suppress_message->text().toStdString() << '\n';
|
|
|
|
|
out_setup << "define_design_lib DEFAULT -path " << this->edit_define_design_lib->text().toStdString() << '\n';
|
|
|
|
|
out_setup << "set view_script_submenu_items " << this->edit_view_script_submenu_items->text().toStdString() << '\n';
|
|
|
|
|
out_setup.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// æ ¹æ<C2B9>®é…<C3A9>置文件获å<C2B7>–工作项目é…<C3A9>ç½®
|
|
|
|
|
void Work_Project::Get_Work_config()
|
|
|
|
|
{
|
|
|
|
|
ifstream in("UWE_Project_config", ios::in);
|
|
|
|
|
string str;
|
|
|
|
|
in >> str >> str >> str;
|
|
|
|
|
in >> str >> str >> str; uwe_project_name = QString::fromStdString(str);
|
|
|
|
|
in >> str >> str >> str; src_project_path = QString::fromStdString(str);
|
|
|
|
|
in >> str >> str >> str; src_path = QString::fromStdString(str);
|
|
|
|
|
in >> str >> str >> str; module_name = QString::fromStdString(str);
|
|
|
|
|
in.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获å<C2B7>–当å‰<C3A5>系统时间
|
|
|
|
|
string get_current_date()
|
|
|
|
|
{
|
|
|
|
|
time_t timeReal;
|
|
|
|
|
time(&timeReal);
|
|
|
|
|
timeReal = timeReal + 8*3600;
|
|
|
|
|
tm* t = gmtime(&timeReal);
|
|
|
|
|
string str = to_string(t->tm_year+1900) + '_' + to_string(t->tm_mon+1)+to_string(t->tm_mday) + '_' + to_string(t->tm_hour)+to_string(t->tm_min);
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ç‚¹å‡»æ ‘å½¢æ–‡ä»¶åˆ—è¡¨å±•ç¤ºæ–‡æœ¬å†…å®¹
|
|
|
|
|
void MainWindow::TreeClicked(const QModelIndex &index)
|
|
|
|
|
{
|
|
|
|
|
ui->dockWidget_src_syn->show();
|
|
|
|
|
QString context, file_name = model_file->fileName(index);
|
|
|
|
|
QString path = model_file->filePath(index);
|
|
|
|
|
QFile file(path);
|
|
|
|
|
file.open(QFile::ReadOnly | QFile::Text);
|
|
|
|
|
while (!file.atEnd()) {
|
|
|
|
|
QByteArray line = file.readLine();
|
|
|
|
|
QString str(line);
|
|
|
|
|
context.append(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!context.isEmpty()){
|
|
|
|
|
QTextEdit *textEdit_src = new QTextEdit;
|
|
|
|
|
textEdit_src->setText(context);
|
|
|
|
|
textEdit_src->setFont(QFont("Consolas", 12));
|
|
|
|
|
|
|
|
|
|
ui->tabWidget_src_syn->addTab(textEdit_src, file_name);
|
|
|
|
|
ui->tabWidget_src_syn->setCurrentWidget(textEdit_src);
|
|
|
|
|
}
|
|
|
|
|
ui->dockWidget_src_syn->raise();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 终端输出内容å“<C3A5>应函数
|
|
|
|
|
void MainWindow::readBashStandardOutputInfo()
|
|
|
|
|
{
|
|
|
|
|
QByteArray cmdout = m_process_bash->readAllStandardOutput();
|
|
|
|
|
|
|
|
|
|
// 综å<C2BC>ˆå®Œæˆ<C3A6>å“<C3A5>应函数
|
|
|
|
|
if (cmdout.indexOf("Thank you...") != -1){
|
|
|
|
|
qDebug() << "syn sucessfully!" << endl;
|
|
|
|
|
QStandardItem *item = model_module->item(row_current_module_treeview, 1);
|
|
|
|
|
item->setIcon(style()->standardIcon(QStyle::SP_DialogApplyButton));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!cmdout.isEmpty()){
|
|
|
|
|
ui->textEdit_cmd_syn->append(QString::fromLocal8Bit(cmdout));
|
|
|
|
|
}
|
|
|
|
|
QScrollBar *scroll = ui->textEdit_cmd_syn->verticalScrollBar();
|
|
|
|
|
scroll->setSliderPosition(scroll->maximum());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 终端输出错误信æ<C2A1>¯å“<C3A5>应函数
|
|
|
|
|
void MainWindow::readBashStandardErrorInfo()
|
|
|
|
|
{
|
|
|
|
|
QByteArray cmdout = m_process_bash->readAllStandardError();
|
|
|
|
|
if (!cmdout.isEmpty()){
|
|
|
|
|
ui->textEdit_cmd_syn->append(QString::fromLocal8Bit(cmdout));
|
|
|
|
|
}
|
|
|
|
|
QScrollBar *scroll = ui->textEdit_cmd_syn->verticalScrollBar();
|
|
|
|
|
scroll->setSliderPosition(scroll->maximum());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// å—符串å<C2B2>˜é‡<C3A9>替æ<C2BF>¢
|
|
|
|
|
void MainWindow::String_Replace(string &str, string variate_key)
|
|
|
|
|
{
|
|
|
|
|
string variate_value = this->variate_map->get_value(variate_key);
|
|
|
|
|
int variate_size = variate_key.size();
|
|
|
|
|
while (str.find(variate_key) != string::npos)
|
|
|
|
|
str = str.replace(str.find(variate_key), variate_size, variate_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 生æˆ<C3A6>é…<C3A9>置文件
|
|
|
|
|
void Variate_Map::Generate_Parameter_File()
|
|
|
|
|
{
|
|
|
|
|
ofstream out("parameter.tcl", ios::out);
|
|
|
|
|
for (auto i : mapper)
|
|
|
|
|
out << "set " << i.first << ' ' << i.second << endl;
|
|
|
|
|
out.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ä¿<C3A4>å˜å<CB9C>‚æ•°é…<C3A9>ç½®
|
|
|
|
|
void MainWindow::on_buttonBox_Save_accepted()
|
|
|
|
|
{
|
|
|
|
|
string FLOW_value = (ui->radioButton_FLOW_TRUE->isChecked()) ? "TRUE" : "FALSE";
|
|
|
|
|
variate_map->add_variate("FLOW", FLOW_value);
|
|
|
|
|
string LOADDDC_value = (ui->radioButton_LOADDDC_TRUE->isChecked()) ? "TRUE" : "FALSE";
|
|
|
|
|
variate_map->add_variate("LOADDDC", LOADDDC_value);
|
|
|
|
|
string CHECKCODE_value = (ui->radioButton_CHECKCODE_TRUE->isChecked()) ? "TRUE" : "FALSE";
|
|
|
|
|
variate_map->add_variate("CHECKCODE", CHECKCODE_value);
|
|
|
|
|
string DEBUGSDC_value = (ui->radioButton_DEBUGSDC_TRUE->isChecked()) ? "TRUE" : "FALSE";
|
|
|
|
|
variate_map->add_variate("DEBUGSDC", DEBUGSDC_value);
|
|
|
|
|
|
|
|
|
|
variate_map->Generate_Parameter_File();
|
|
|
|
|
ui->textEdit_cmd_syn->append("parameter.tcl has been generated sucessfully!\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// è¿<C3A8>行综å<C2BC>ˆæŒ‰é’®å“<C3A5>应函数
|
|
|
|
|
void MainWindow::on_pushButton_runsyn_clicked()
|
|
|
|
|
{
|
|
|
|
|
Parameter_Config();
|
|
|
|
|
|
|
|
|
|
string syn_cmd = "dc_shell-t -f TCLPATH/syn_main.tcl | tee dc.log DCWORK/Logs/dc_current_date.log \nmake c_R0 \n";
|
|
|
|
|
this->String_Replace(syn_cmd, "TCLPATH");
|
|
|
|
|
this->String_Replace(syn_cmd, "DCWORK");
|
|
|
|
|
this->String_Replace(syn_cmd, "current_date");
|
|
|
|
|
cout << syn_cmd << endl;
|
|
|
|
|
this->ui->textEdit_cmd_syn->append("run syn \n");
|
|
|
|
|
this->m_process_bash->write(syn_cmd.data());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 代ç <20>窗å<E28094>£å…³é—å“<C3A5>应函数
|
|
|
|
|
void MainWindow::on_tabWidget_src_tabCloseRequested(int index)
|
|
|
|
|
{
|
|
|
|
|
ui->tabWidget_src_syn->removeTab(index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// R0_check result按钮å“<C3A5>应函数
|
|
|
|
|
void MainWindow::on_pushButton_result_clicked()
|
|
|
|
|
{
|
|
|
|
|
ktextEdit = new KTextEdit(dockWidget_report_syn);
|
|
|
|
|
//获å<C2B7>–result内容
|
|
|
|
|
QString result_path = QDir::currentPath() + "/R0_check.result";
|
|
|
|
|
QFile file(result_path);
|
|
|
|
|
QString context;
|
|
|
|
|
file.open(QFile::ReadOnly | QFile::Text);
|
|
|
|
|
while (!file.atEnd()) {
|
|
|
|
|
QByteArray line = file.readLine();
|
|
|
|
|
QString str(line);
|
|
|
|
|
context.append(str);
|
|
|
|
|
}
|
|
|
|
|
ktextEdit->SetText(context);
|
|
|
|
|
//è®¾ç½®æ–‡æœ¬æ¸¸æ ‡åˆ°æ–‡æœ¬å¤´
|
|
|
|
|
QTextCursor cursor = ktextEdit->textCursor();
|
|
|
|
|
cursor.movePosition(QTextCursor::Start);
|
|
|
|
|
ktextEdit->setTextCursor(cursor);
|
|
|
|
|
|
|
|
|
|
dockWidget_report_syn->setWidget(ktextEdit);
|
|
|
|
|
|
|
|
|
|
dockWidget_report_syn->raise();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//终端è¿<C3A8>行按钮å“<C3A5>应函数
|
|
|
|
|
void MainWindow::on_pushButton_run_cmd_clicked()
|
|
|
|
|
{
|
|
|
|
|
QString strCmd = ui->lineEdit_syn->text();
|
|
|
|
|
ui->textEdit_cmd_syn->append("Linux:~$ " + strCmd);
|
|
|
|
|
m_process_bash->write(ui->lineEdit_syn->text().toLocal8Bit() + '\n');
|
|
|
|
|
ui->lineEdit_syn->clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// New noduleå“<C3A5>应函数
|
|
|
|
|
void MainWindow::New_module()
|
|
|
|
|
{
|
|
|
|
|
QDialog *qdialog = new QDialog;
|
|
|
|
|
qdialog->setWindowTitle("module name");
|
|
|
|
|
qdialog->setFixedSize(500, 50);
|
|
|
|
|
|
|
|
|
|
//输入框å<E280A0>Šå…¶æŒ‰é’®
|
|
|
|
|
QFormLayout *layout = new QFormLayout;
|
|
|
|
|
layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
|
|
|
|
|
QLineEdit *edit_module_name = new QLineEdit;
|
|
|
|
|
layout->addRow("module name:", edit_module_name);
|
|
|
|
|
|
|
|
|
|
qdialog->setLayout(layout);
|
|
|
|
|
|
|
|
|
|
//å<>•独按钮
|
|
|
|
|
QPushButton *button_determine = new QPushButton("确定", qdialog);
|
|
|
|
|
button_determine->move(300, 100);
|
|
|
|
|
|
|
|
|
|
//按钮对应槽函数
|
|
|
|
|
connect(button_determine, &QPushButton::clicked, qdialog, &QDialog::close);
|
|
|
|
|
connect(button_determine, &QPushButton::clicked, this, [=]{
|
|
|
|
|
QList<QStandardItem *> items;
|
|
|
|
|
items.append(new QStandardItem(edit_module_name->text()));
|
|
|
|
|
// childItem->setIcon(style()->standardIcon(QStyle::SP_DialogApplyButton));
|
|
|
|
|
QStandardItem *Item_state = new QStandardItem();
|
|
|
|
|
Item_state->setIcon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion));
|
|
|
|
|
items.append(Item_state);
|
|
|
|
|
model_module->appendRow(items);
|
|
|
|
|
row_current_module_treeview++;
|
|
|
|
|
|
|
|
|
|
this->work_project->module_name = edit_module_name->text();
|
|
|
|
|
ofstream out2("setModuleName.tcl", ios::out);
|
|
|
|
|
out2 << "set Design " << edit_module_name->text().toStdString() << "\n" << "puts ${Design}";
|
|
|
|
|
out2.close();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
qdialog->exec();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// code_checkå“<C3A5>应函数
|
|
|
|
|
void MainWindow::on_pushButton_code_check_clicked()
|
|
|
|
|
{
|
|
|
|
|
string cmd_code_check_date = "c_date=`date +%Y_%m%d_%H%M` \n";
|
|
|
|
|
string cmd_code_check_filelist = "echo 'Checking filelist.v ...' > code_check.result \n"
|
|
|
|
|
"filelistpath=`find ./src/ -name '*flist*' -type f` \n"
|
|
|
|
|
"echo filelistpath: $filelistpath \n"
|
|
|
|
|
"for file in $filelistpath; \n"
|
|
|
|
|
"do filelistname+=${file#*src/}' ' \n done \n"
|
|
|
|
|
"echo filelistname: $filelistname \n"
|
|
|
|
|
"if [ -z \"$filelistname\" ]; \n then echo \"Error: Filelist is not exist or the name is not matching '*_filelist' format. exit.\" "
|
|
|
|
|
"echo \"Error: Filelist is not exist or the name is not matching '*_filelist' format. exit.\" >> code_check.result exit \n fi \n"
|
|
|
|
|
"SIMEMU=`grep -n \"_SIMULATION_\|_EMULATION_\" $filelistpath` \n"
|
|
|
|
|
"if [ -z \"$SIMEMU\" ]; \n then echo \"Info: There are no _SIMULATION_ or _EMULATION_ definition in file $filelistname .\" \n fi \n";
|
|
|
|
|
string cmd_code_check_src = "echo " " >> code_check.result \n"
|
|
|
|
|
"echo \"Checking 'timescale' in *.v files ... (Warning)\" >> code_check.result \n"
|
|
|
|
|
"find ./src/ -name \"*.v\" | xargs grep -n 'timescale' >> code_check.result \n"
|
|
|
|
|
"echo " " >> code_check.result \n"
|
|
|
|
|
"echo \"Checking Chinese words in *.v files .. (Warning).\" >> code_check.result \n"
|
|
|
|
|
"find ./src/ -name \"*.v\" | xargs grep -nP '[\p{Han}]' >> code_check.result \n"
|
|
|
|
|
"echo " " >> code_check.result \n"
|
|
|
|
|
"echo \"Checking Synophsis key words in *.v files ... (Info)\" >> code_check.result \n"
|
|
|
|
|
"find ./src/ -name \"*.v\" | xargs grep -n 'full_case' >> code_check.result \n"
|
|
|
|
|
"find ./src/ -name \"*.v\" | xargs grep -n 'parallel_case' >> code_check.result \n"
|
|
|
|
|
"find ./src/ -name \"*.v\" | xargs grep -n 'translate on' >> code_check.result \n"
|
|
|
|
|
"find ./src/ -name \"*.v\" | xargs grep -n 'translate off' >> code_check.result \n";
|
|
|
|
|
string cmd_code_check_author = "echo " " >> code_check.result \n"
|
|
|
|
|
"echo \"Checking author notes in *.v files .. (Warning).\" >> code_check.result \n"
|
|
|
|
|
"for file in `find ./src/ -regex \".*\.vh\|.*\.v\|.*\.h\"` \n"
|
|
|
|
|
"do authorname=`grep -n \"author\|Author\|AUTHOR\|Generated by\|created\" $file` \n"
|
|
|
|
|
"if [ -z \"$authorname\" ]; \n "
|
|
|
|
|
"then echo \"Warning: Author notes is not exist or the name is not matching 'author|Author|AUTHOR|Generated by|created' format in file $file\" \n"
|
|
|
|
|
"echo \"Warning: Author notes is not exist or the name is not matching 'author|Author|AUTHOR|Generated by|created' format in file $file\" >> code_check.result \n"
|
|
|
|
|
"fi \n done \n";
|
|
|
|
|
string cmd_code_check_xrun_log = "echo \" \" >> code_check.result \n"
|
|
|
|
|
"echo \"Checking NC log in xrun.log ... \" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"xrun.log\" | xargs grep \"*E\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"xrun.log\" | xargs grep \"*W,RECOME\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"xrun.log\" | xargs grep \"*W,CUVWSP\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"xrun.log\" | xargs grep \"*W,CUVWSI\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"xrun.log\" | xargs grep \"*W,CUVMPW\" >> code_check.result \n";
|
|
|
|
|
string cmd_code_check_dc_log = "echo \" \" >> code_check.result \n"
|
|
|
|
|
"echo \"Checking DC dc.log ...\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"Error:\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"Latch \" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"Timing loop\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"FFGEN\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"have the default net type\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"unresolved\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"unmapped\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"(LINT-5)\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"sensiti\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"MV-038\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"MV-039\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"MV-513\" >> code_check.result \n"
|
|
|
|
|
"find . -maxdepth 1 -name \"dc.log\" | xargs grep \"MV-514\" >> code_check.result \n";
|
|
|
|
|
string cmd_code_check_copy = "cp code_check.result Logs/code_check_${c_date}.result \n";
|
|
|
|
|
string cmd_code_check = cmd_code_check_date + cmd_code_check_filelist + cmd_code_check_src + cmd_code_check_author + cmd_code_check_xrun_log + cmd_code_check_dc_log + cmd_code_check_copy;
|
|
|
|
|
|
|
|
|
|
this->ui->textEdit_cmd_syn->append("Beginning check code \n");
|
|
|
|
|
|
|
|
|
|
this->m_process_bash->write(cmd_code_check.data());
|
|
|
|
|
}
|