1 Star 0 Fork 0

其实那是风景/coderdbc_win

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
widget.cpp 2.89 KB
一键复制 编辑 原始数据 按行查看 历史
#include "widget.h"
#include "ui_widget.h"
#include <QFileDialog>
#include <iostream>
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
// Set up ThreadLogStream, which redirect cout to signal sendLogString
// Set up MessageHandler, wgucg catch message from sendLogString and Display
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
m_qd = new ThreadLogStream(std::cout); //Redirect Console output to QTextEdit
this->msgHandler = new MessageHandler(this->ui->logText, this);
connect(m_qd, &ThreadLogStream::sendLogString, msgHandler, &MessageHandler::catchMessage);
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
}
Widget::~Widget()
{
delete ui;
}
void Widget::QMessageOutput(QtMsgType, const QMessageLogContext &, const QString &msg)
{
std::cout<<msg.toStdString().c_str()<<std::endl;
}
void Widget::on_btn_SelectDbcfile_clicked()
{
QString srcDirPath = ui->lineEdit_dbcFilePath->text();
srcDirPath = QFileDialog::getOpenFileName(
this, "选择要分析文件",
srcDirPath,
"二进制文件 (*.dbc *.bin);; 所有文件 (*.*);; ");
if (!srcDirPath.isEmpty())
{
ui->lineEdit_dbcFilePath->setText( srcDirPath );
}
}
void Widget::on_btn_analyse_clicked()
{
ui->logText->clear();
textbuf.clear();
if( !ui->lineEdit_dbcFilePath->text().isEmpty() )
{
if( !ui->lineEdit_outCodeFilePath->text().isEmpty() )
{
if( !ui->lineEdit_DrvName->text().isEmpty() )
{
QStringList strList;
strList.append(ui->lineEdit_dbcFilePath->text());
strList.append(ui->lineEdit_outCodeFilePath->text());
strList.append(ui->lineEdit_DrvName->text());
setStrOpts(strList);
workThreadInit();
}
}
}
}
void Widget::Append(const QString &text)
{
// static QString textbuf;
textbuf+=text;
ui->logText->setText(textbuf);
}
void Widget::dealsigResult(QString, unsigned int)
{
std::cout<< "dealsigResult" << std::endl;
}
void Widget::workThreadInit()
{
QThread *workerThread= new QThread;
ThreadWorker *worker = new ThreadWorker();
worker->moveToThread(workerThread);
connect(workerThread, SIGNAL(started()), worker, SLOT(doWork()));
connect(worker, SIGNAL(finished()), workerThread, SLOT(quit()));
connect(worker, SIGNAL(finished()), worker, SLOT(deleteLater()));
connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));
workerThread->start();
}
void Widget::on_btn_SelectOutCodeFilePath_clicked()
{
QString srcDirPath = ui->lineEdit_outCodeFilePath->text();
srcDirPath = QFileDialog::getExistingDirectory(
this, "choose src Directory",
srcDirPath);
if (!srcDirPath.isEmpty())
{
ui->lineEdit_outCodeFilePath->setText( srcDirPath );
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/kjfb/coderdbc_win.git
git@gitee.com:kjfb/coderdbc_win.git
kjfb
coderdbc_win
coderdbc_win
master

搜索帮助