6月20日版本

Jing
xiaokai 2 years ago
commit 1eaa67539f

@ -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());
}

@ -0,0 +1,49 @@
#-------------------------------------------------
#
# Project created by QtCreator 2022-09-13T16:59:02
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = test
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
SOURCES += \
highlighter.cpp \
ktextedit.cpp \
main.cpp \
mainwindow.cpp \
mytreeview.cpp
HEADERS += \
highlighter.h \
mainwindow.h \
mytreeview.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

@ -0,0 +1,326 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2023-06-07T11:08:23. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{a65e2026-5075-402d-8461-16bc6af287b9}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">GBK</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.12.2 GCC 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.12.2 GCC 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5122.gcc_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/UWE/zj/Qt/Project/build-test-ZJ-Desktop_Qt_5_12_2_GCC_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/UWE/zj/Qt/Project/build-test-ZJ-Desktop_Qt_5_12_2_GCC_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/UWE/zj/Qt/Project/build-test-ZJ-Desktop_Qt_5_12_2_GCC_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy Configuration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">test-ZJ</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/UWE/zj/Qt/Project/UWE/test-ZJ.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">test-ZJ.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/UWE/zj/Qt/Project/build-test-ZJ-Desktop_Qt_5_12_2_GCC_64bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">20</value>
</data>
<data>
<variable>Version</variable>
<value type="int">20</value>
</data>
</qtcreator>

@ -0,0 +1,53 @@
#ifndef _FINDDIALOG_H_
#define _FINDDIALOG_H_
#include <QDialog>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QRadioButton>
#include <QCheckBox>
#include <QGroupBox>
#include <QPlainTextEdit>
#include <QPointer>
class FindDialog : public QDialog
{
Q_OBJECT
protected:
QGroupBox m_radioGrpBx;
QGridLayout m_layout;
QHBoxLayout m_hbLayout;
QLabel m_findLbl;
QLineEdit m_findEdit;
QPushButton m_findBtn;
QPushButton m_closeBtn;
QCheckBox m_matchChkBx;
QRadioButton m_forwardBtn;
QRadioButton m_backwardBtn;
QPointer<QPlainTextEdit> m_pText; // FindDialog ¾ÛºÏʹÓà QPlainTextEdit
QSharedPointer<FindDialog> m_pFindDlg;
QTextCharFormat m_format;
void initControl();
void connectSlot();
protected slots:
void onFindClicked();
void onCloseClicked();
public:
explicit FindDialog(QWidget* parent = 0, QPlainTextEdit* pText = 0);
void setPlainTextEdit(QPlainTextEdit* pText);
void highlightText(QPlainTextEdit* pText);
QPlainTextEdit* getPlainTextEdit();
bool event(QEvent* evt);
};
#endif // _FINDDIALOG_H_

@ -0,0 +1,11 @@
#ifndef FINDDIALOG_H
#define FINDDIALOG_H
class finddialog
{
public:
finddialog();
};
#endif // FINDDIALOG_H

@ -0,0 +1,94 @@
#include "highlighter.h"
normol_HighLighter::normol_HighLighter(QTextDocument *parent) :
QSyntaxHighlighter(parent)
{
/*m_moduleFormat.setForeground(Qt::blue);
m_taskFormat.setForeground(Qt::red);
m_functionFormat.setForeground(Qt::darkGreen);
m_assertFormat.setForeground(Qt::magenta);*/
// HighlightRule num_rule;
// num_rule.pattern.setPattern("[0-9]{1,1}");
// num_rule.format.setForeground(QColor(144,238,144));
// highlightrules.append(num_rule);
normol_HighLighteRule key_rule;
key_rule.pattern.setPattern("\\b(char|string|int|double|bool|void|true|false)\\b");
key_rule.format.setForeground(QColor(30,144,255));
highlightrules.append(key_rule);
normol_HighLighteRule code_rule;
code_rule.pattern.setPattern("\\b(if|while|for|else|break|return|switch|case)\\b");
code_rule.format.setForeground(QColor(186,85,211));
highlightrules.append(code_rule);
}
/*void normol_HighLighter::setVerilogKeywordFormat(QStringList keywordList, QTextCharFormat format)
{
foreach (const QString &keyword, keywordList) {
QRegularExpression expression("\\b" + keyword + "\\b");
QRegularExpressionMatchIterator itr = expression.globalMatch(currentBlock().text());
while (itr.hasNext()) {
QRegularExpressionMatch match = itr.next();
setFormat(match.capturedStart(), match.capturedLength(), format);
}
}
}*/
void normol_HighLighter::highlightBlock(const QString &text)
{
for(const normol_HighLighteRule &rule : highlightrules){
QRegExp expression(rule.pattern);
int index = expression.indexIn(text);
while(index>=0){
int length = expression.matchedLength();
setFormat(index,length,rule.format);
index = expression.indexIn(text,index+length);}
}
}
///////////////////////////////////
SV_HighLighter::SV_HighLighter(QTextDocument *parent) :
QSyntaxHighlighter(parent)
{
SV_HighLighteRule key_rule;
key_rule.pattern.setPattern("\\b(class|virtual|function|typedef|interface|modport|new|this|override|final)\\b");
key_rule.format.setForeground(QColor(30,144,255));
highlightrules.append(key_rule);
}
void SV_HighLighter::highlightBlock(const QString &text)
{
for(const SV_HighLighteRule &rule : highlightrules){
QRegExp expression(rule.pattern);
int index = expression.indexIn(text);
while(index>=0){
int length = expression.matchedLength();
setFormat(index,length,rule.format);
index = expression.indexIn(text,index+length);}
}
}
////////////////////////////////////
V_HighLighter::V_HighLighter(QTextDocument *parent) :
QSyntaxHighlighter(parent)
{
V_HighLighteRule key_rule;
key_rule.pattern.setPattern("\\b(module|endmodule|input|output|wire|reg|assign|always|initial|if|else)\\b");
key_rule.format.setForeground(QColor(30,144,255));
highlightrules.append(key_rule);
}
void V_HighLighter::highlightBlock(const QString &text)
{
for(const V_HighLighteRule &rule : highlightrules){
QRegExp expression(rule.pattern);
int index = expression.indexIn(text);
while(index>=0){
int length = expression.matchedLength();
setFormat(index,length,rule.format);
index = expression.indexIn(text,index+length);}
}
}

@ -0,0 +1,58 @@
#ifndef HIGHLIGHTER_H
#define HIGHLIGHTER_H
#include<QSyntaxHighlighter>
#include<QTextCharFormat>
#include<QTextDocument>
#include<QRegularExpression>
class normol_HighLighter :public QSyntaxHighlighter{
Q_OBJECT
public:
explicit normol_HighLighter(QTextDocument *parent=0);
protected:
void highlightBlock(const QString &text);
private:
/*void setVerilogKeywordFormat(QStringList keywordList, QTextCharFormat format);
QTextCharFormat m_moduleFormat;
QTextCharFormat m_taskFormat;
QTextCharFormat m_functionFormat;
QTextCharFormat m_assertFormat;*/
struct normol_HighLighteRule{
QRegExp pattern;
QTextCharFormat format;
};
QVector<normol_HighLighteRule> highlightrules;
};
class SV_HighLighter : public QSyntaxHighlighter{
Q_OBJECT
public:
explicit SV_HighLighter(QTextDocument *parent=0);
protected:
void highlightBlock(const QString &text);
private:
struct SV_HighLighteRule{
QRegExp pattern;
QTextCharFormat format;
};
QVector<SV_HighLighteRule> highlightrules;
};
class V_HighLighter : public QSyntaxHighlighter{
Q_OBJECT
public:
explicit V_HighLighter(QTextDocument *parent=0);
protected:
void highlightBlock(const QString &text);
private:
struct V_HighLighteRule{
QRegExp pattern;
QTextCharFormat format;
};
QVector<V_HighLighteRule> highlightrules;
};
#endif // HIGHLIGHTER_H

File diff suppressed because it is too large Load Diff

@ -0,0 +1,237 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMenuBar>
#include <QDialog>
#include <QLineEdit>
#include <QPushButton>
#include <QFileSystemModel>
#include <QProcess>
#include <map>
#include <string>
#include <fstream>
#include <QObject>
#include <QTextEdit>
#include <QTreeView>
#include <QStandardItemModel>
#include <QTableView>
using namespace std;
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class Variate_Map;
class Work_Project;
class KTextEdit;
class normol_HighLighter;
class SV_HighLighter;
class V_HighLighter;
//
class MainWindow : public QMainWindow
{
Q_OBJECT
private:
normol_HighLighter *n_highlighter;
SV_HighLighter *sv_highlighter;
V_HighLighter *v_highlighter;
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
void String_Replace(string& str, string variate);
void keyPressEvent(QKeyEvent *k);
void New_Project();
// 菜单栏
QMenuBar *pMenuBar;
QMenu *pMenu1;
QMenu *pMenu2;
QMenu *pMenu3;
QMenu *pMenu4;
QMenu *pMenu5;
//pmenu1
QAction *pAction_newproject;
QAction *pAction_openproject;
QAction *pAction_save;
QAction *pAction_openrecentproject;
QAction *pAction_print;
QAction *pAction_exit;
//pmenu2
QAction *pAction_parameter_config;
QAction *pAction_startdebug;
QAction *pAction_stopdebug;
QAction *pAction_restartdebug;
QAction *pAction_skip;
QAction *pAction_continue;
QAction *pAction_syn;
//pmenu3
QAction *pAction_revoke;
QAction *pAction_restore;
QAction *pAction_shear;
QAction *pAction_copy;
QAction *pAction_paste;
QAction *pAction_seek;
QAction *pAction_replace;
//pmenu4
QAction *pAction_changeappearance;
QAction *pAction_reportdata;
QAction *pAction_error;
QAction *pAction_control;
//pmeun5
QAction *pAction_alltutorial;
QAction *pAction_fasttutorial;
QAction *pAction_about;
QAction *pAction_search;
QFileSystemModel *model_file;
Ui::MainWindow *ui;
// bash窗口
QProcess *m_process_bash[4];
Variate_Map *variate_map;
QDockWidget *dockWidget_report_check, *dockWidget_module;
KTextEdit *ktextEdit;
// flow界面窗口
QMainWindow *qmainwindow_precheck, *qmainwindow_syn, *qmainwindow_pt, *qmainwindow_fm, *qmainwindow_design_check;
// flag set
bool ready_syn, ready_r0_result, ready_setup, ready_prepare;
// 工作项目
Work_Project *work_project;
// 存储work_flow对象的列表
QTabWidget *tabwidget_flow_src_list[4];
QDockWidget *dockwidget_flow_src_list[4];
public slots:
//????????
//????????
void OpenProject();
void TreeClicked(const QModelIndex &index);
void readBashStandardOutputInfo_precheck();
void readBashStandardErrorInfo_precheck();
void readBashStandardOutputInfo_syn();
void readBashStandardErrorInfo_syn();
void readBashStandardOutputInfo_pt();
void readBashStandardErrorInfo_pt();
void readBashStandardOutputInfo_fm();
void readBashStandardErrorInfo_fm();
// void Parameter_Config();
private slots:
void find();
void on_buttonBox_Save_accepted();
void on_pushButton_runsyn_clicked();
void on_pushButton_result_clicked();
// void on_pushButton_run_cmd_clicked();
// void on_treeView_module_clicked(const QModelIndex &index);
void on_pushButton_code_check_clicked();
void on_pushButton_run_cmd_syn_clicked();
// void on_tabWidget_src_syn_tabCloseRequested(int index);
void on_pushButton_run_cmd_pt_clicked();
// void on_tabWidget_src_pt_tabCloseRequested(int index);
void on_buttonBox_Save_pt_accepted();
void on_pushButton_runpt_clicked();
void on_pushButton_runformality_clicked();
void on_pushButton_run_cmd_fm_clicked();
void on_tabWidget_src_tabCloseRequested(int index);
void on_pushButton_run_cmd_precheck_clicked();
void on_pushButton_result_design_check_clicked();
void on_pushButton_sg_clicked();
};
//????map?
class Variate_Map
{
public:
Variate_Map(){}
~Variate_Map(){}
string get_value(string str){return mapper[str];}
int add_variate(string key, string value){mapper[key] = value;}
bool alter_variate(string key, string value)
{
if (mapper.find(key) == mapper.end())
return false;
else{
mapper[key] = value;
return true;
}
}
void Generate_Parameter_File();
private:
map<string, string> mapper;
};
// 工作项目类
class Work_Project : public QObject
{
Q_OBJECT
public:
MainWindow *father;
QLineEdit *edit_uwe_project_path, *edit_uwe_project_name,
*edit_src_project_path, *edit_src_path, *edit_module_name;
QLineEdit *edit_designer, *edit_company, *edit_synthetic_library,
*edit_target_library, *edit_link_library, *edit_symbol_library, *edit_cache_write,
*edit_cache_read, *edit_my_lib_path, *edit_search_path,
*edit_suppress_message, *edit_define_design_lib , *edit_view_script_submenu_items;
// 判断信号
bool bool_Current_Design_ready;
// 需要存储的变量
QString uwe_project_path, uwe_project_name, src_project_path, src_path, current_module_name;
QList<QString> list_lib_path, list_lib, list_target_lib_selected, list_link_lib_selected;
// int current_module_row;
Work_Project(){}
~Work_Project(){}
void Generate_UWE_Project_config();
void Get_UWE_Project_config();
void Extract_lib();
void Module_Set();
QTableView* Show_lib(QList<QString>& list_lib, QStandardItemModel *model);
public slots:
void New_Project_1();
void New_Project_2();
void New_setup_lib_path();
void New_setup_target_library();
void New_setup_link_library();
void Src_Project_Environment_set();
void Src_Project_Environment_set_Determine();
void Generate_Setup_File();
};
class KTextEdit : public QTextEdit
{
Q_OBJECT
public:
KTextEdit(QWidget *parent = nullptr);
void SetText(const QString &text);
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
QList<QString> clickable_text_list;
QString error_type;
QProcess *m_process_report_man;
QByteArray man_out;
public slots:
void OnCursorMove();
void readBash_manOutputInfo();
};
#endif // MAINWINDOW_H

File diff suppressed because it is too large Load Diff

@ -0,0 +1,236 @@
#include "mytreeview.h"
#include "ui_mainwindow.h"
#include <iostream>
#include <QStandardItemModel>
#include <QDockWidget>
#include <QVBoxLayout>
#include <QTextEdit>
#include <QPushButton>
#include <QDialog>
#include <QFormLayout>
#include <QLineEdit>
#include <iostream>
#include <QMainWindow>
#include "ui_mainwindow.h"
MyTreeView::MyTreeView(QWidget *parent)
: QTreeView(parent)
{
// 初始化
this->model_module = new QStandardItemModel;
cnt_module = 0;
list_actionof_modules = new QList<QAction*>();
map_name_2_item = new std::map<QString, QStandardItem*>();
model_module->setHorizontalHeaderLabels(QStringList()<<"module name"<<"state");
setModel(model_module);
setColumnWidth(0, 200);
setColumnWidth(1, 50);
setContextMenuPolicy(Qt::CustomContextMenu);
setSelectionMode(QAbstractItemView::SingleSelection);
// actions
action_new_module1 = new QAction("new module", this);
action_new_module2 = new QAction("new module", this);
action_del_module = new QAction("del module", this);
// menu_module_blank
menu_module_blank = new QMenu(this);
menu_module_blank->addAction(action_new_module1);
// menu_module_withmodule
menu_module_withmodule = new QMenu(this);
menu_module_withmodule->addAction(action_new_module2);
menu_module_move = menu_module_withmodule->addMenu(tr("move to")); menu_module_move->addAction(new QAction("顶层"));
menu_module_withmodule->addAction(action_del_module);
// 空白处菜单new module信号槽
connect(action_new_module1, &QAction::triggered, this, [=]() {
New_Module(nullptr);
});
// 有module处菜单new module信号槽
connect(action_new_module2, &QAction::triggered, this, [this](){
New_Module(selecteditem);
});
// 有module处菜单move to信号槽
connect(menu_module_move, &QMenu::triggered, this, &MyTreeView::on_MoveMenu_Triggered);
// del module信号槽
connect(action_del_module, &QAction::triggered, this, [this](){
Del_Module(selecteditem);
});
}
// 鼠标点击treeview响应函数
void MyTreeView::mousePressEvent(QMouseEvent *event)
{
QPoint p = event->pos();
QModelIndex index = indexAt(p);
QStandardItemModel *model;
if (event->buttons() & Qt::RightButton){ // 鼠标右键点击
if (!index.isValid()){ // 点击空白处
menu_module_blank->popup(viewport()->mapToGlobal(p));
}
else { // 点击有module处
menu_module_withmodule->popup(viewport()->mapToGlobal(p));
model = qobject_cast<QStandardItemModel *>(this->model());
selecteditem = model->itemFromIndex(index);
}
}
if(!index.isValid())
{
clearSelection(); //实现点空白处取消选择
// if (father->ui->treeView_module->selectionModel())
// father->ui->treeView_module->selectionModel()->clear();
// emit sigPressEmpty();
// return;
}
QTreeView::mousePressEvent(event);
}
// new module响应槽函数
void MyTreeView::New_Module(QStandardItem* selecteditem)
{
QDialog *qdialog = new QDialog;
qdialog->setWindowTitle("module name");
qdialog->setFixedSize(500, 50);
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, [=]{
QString module_name = edit_module_name->text();
QStandardItem *item_new = new QStandardItem(module_name);
QStandardItem *Item_state = new QStandardItem();
Item_state->setIcon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion));
// 直接创建new module
if (selecteditem == nullptr){
QList<QStandardItem *> items;
items.append(item_new);
items.append(Item_state);
model_module->appendRow(items);
}
// 创建子module
else{
int row = selecteditem->rowCount();
selecteditem->setChild(row, 0, item_new);
selecteditem->setChild(row, 1, Item_state);
}
// 添加module信息
map_name_2_item->insert(std::pair<QString, QStandardItem*>(module_name, item_new));
QAction *action_tmp = new QAction(module_name, this); list_actionof_modules->append(action_tmp);
cnt_module++;
// 更新MoveMenu菜单信息
menu_module_move->addAction(action_tmp);
});
qdialog->exec();
}
//
QStandardItem* MyTreeView::Name_get_Item(QString name_module)
{
std::map<QString,QStandardItem*>::iterator it = map_name_2_item->find(name_module);
if (it != map_name_2_item->end()) // 找到
return it->second;
else // 没找到
std::cout << "map中不存在该元素\n";
return nullptr;
}
// move_to菜单列表点击action响应函数 目前还存在的bug父项移到子项下寄
void MyTreeView::on_MoveMenu_Triggered(QAction* action)
{
if (action){
QString father_item_name = action->text();
QString selected_item_name = selecteditem->text();
if (father_item_name == "顶层"){ // 如果移动到顶层
if (selecteditem->parent() == nullptr) // 选中item没有父项
return;
else{ //选中item有原父项
QStandardItem *old_father_item = selecteditem->parent();
QString old_father_item_name = old_father_item->text();
// 移动(重新添加)
model_module->appendRow(old_father_item->takeRow(selecteditem->row()));
}
}
else{ // 不是移动到顶层
// 获取父项item
QStandardItem *fatherItem = Name_get_Item(father_item_name);
if (father_item_name == selected_item_name)
return;
else{
if (selecteditem->parent() == nullptr){ // 选中item没有父项
// 移动(重新添加)
fatherItem->appendRow(model_module->takeRow(selecteditem->row()));
}
else{ //选中item有原父项
QStandardItem *old_father_item = selecteditem->parent();
QString old_father_item_name = old_father_item->text();
if (old_father_item_name == father_item_name) // 新旧父项相同
return;
// 移动(重新添加)
fatherItem->appendRow(old_father_item->takeRow(selecteditem->row()));
}
}
}
}
}
//
void MyTreeView::Add_Module(QString module_name, QStandardItem* father)
{
// 图标item
QStandardItem *Item_state = new QStandardItem();
Item_state->setIcon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion));
if (father){
father->setChild(father->rowCount(), 0, new QStandardItem(module_name));
father->setChild(father->rowCount(), 1, Item_state);
}
else {
QList<QStandardItem*> item_row;
item_row.append(new QStandardItem(module_name));
item_row.append(Item_state);
model_module->appendRow(item_row);
}
}
// del module响应函数
void MyTreeView::Del_Module(QStandardItem* selecteditem)
{
// 在model中删除
QStandardItem* parentItem = selecteditem->parent();
if (parentItem){
parentItem->removeRow(selecteditem->row());
}
else{
model_module->removeRow(selecteditem->row());
}
// 获取当前model所有module name将不在其中的action对象删除
QList<QString> list_del_module;
for (int i = 0; i < model_module->rowCount(); ++i) {
QStandardItem* item = model_module->item(i, 0);
if (item) {
QString text = item->text();
list_del_module.append(text);
}
}
foreach(QAction* action, menu_module_move->actions()){
if (!list_del_module.contains(action->text()) && action->text() != "顶层") {
menu_module_move->removeAction(action);
action->deleteLater(); // 删除该QAction对象并释放内存
}
}
}

@ -0,0 +1,47 @@
#ifndef MYTREEVIEW_H
#define MYTREEVIEW_H
#include <QTreeView>
#include <QMouseEvent>
#include "mainwindow.h"
#include <map>
#include <QStandardItem>
//改造QTreeView实现点击空白处时取消选择
class MyTreeView : public QTreeView
{
Q_OBJECT
public:
MainWindow* father = nullptr;
QStandardItemModel* model_module; // module数据模型
QMenu *menu_module_blank, *menu_module_withmodule; // 右键菜单选项
QAction *action_new_module1, *action_new_module2, *action_del_module, *action_move_module; // 动作
// 数据结构
std::map<QString, QStandardItem*> *map_name_2_item; // module名和item对应表
QStandardItem *selecteditem = nullptr; // 当前鼠标选中的item对象
QList<QAction*> *list_actionof_modules; // module对应action列表
int cnt_module; // module计数
QMenu *menu_module_move; // move to菜单
//
MyTreeView(QWidget *parent = Q_NULLPTR);
QStandardItem* Name_get_Item(QString);
void Add_Module(QString, QStandardItem*);
public slots:
void New_Module(QStandardItem*);
void Del_Module(QStandardItem*);
void on_MoveMenu_Triggered(QAction*); // menu按键响应槽函数
signals:
void sigPressEmpty();
protected:
void mousePressEvent ( QMouseEvent * event ) ;
};
#endif
Loading…
Cancel
Save