2 Star 2 Fork 1

softxing/Xiasl

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
dlgdecompile.cpp 2.96 KB
一键复制 编辑 原始数据 按行查看 历史
ic005k 提交于 2021-04-19 11:35 . Add files via upload
#include "dlgdecompile.h"
#include "mainwindow.h"
#include "ui_dlgdecompile.h"
extern MainWindow* mw_one;
dlgDecompile::dlgDecompile(QWidget* parent)
: QDialog(parent)
, ui(new Ui::dlgDecompile)
{
ui->setupUi(this);
ui->tabWidget->tabBar()->setCurrentIndex(0);
}
dlgDecompile::~dlgDecompile()
{
delete ui;
}
void dlgDecompile::on_btnAddDSDT_clicked()
{
QString file;
file = QFileDialog::getOpenFileName(
this, tr("Select files to open"),
"", "aml list (*.aml);;dat list(*.dat);;All files(*.*)");
if (file != "")
ui->editDSDT->setText(file);
}
void dlgDecompile::on_btnAddSSDT_clicked()
{
QStringList list;
list = QFileDialog::getOpenFileNames(
this, tr("Select files to open"),
"", "aml list (*.aml);;dat list(*.dat);;All files(*.*)");
ui->listSSDT->addItems(list);
}
void dlgDecompile::on_btnRemoveSSDT_clicked()
{
QListWidgetItem* sel = ui->listSSDT->currentItem();
int r = ui->listSSDT->row(sel);
QListWidgetItem* item = ui->listSSDT->takeItem(r);
ui->listSSDT->removeItemWidget(item);
delete item;
}
void dlgDecompile::on_btnDecompile_clicked()
{
QFileInfo appInfo(qApp->applicationDirPath());
Decompile = new QProcess;
QStringList list;
for (int i = 0; i < ui->listSSDT->count(); i++) {
ui->listSSDT->setCurrentRow(i);
list.append(ui->listSSDT->currentItem()->text());
}
#ifdef Q_OS_WIN32
Decompile->start(appInfo.filePath() + "/iasl.exe", QStringList() << "-e" << list << "-d" << ui->editDSDT->text());
#endif
#ifdef Q_OS_LINUX
Decompile->start(appInfo.filePath() + "/iasl", QStringList() << "-e" << list << "-d" << ui->editDSDT->text());
#endif
#ifdef Q_OS_MAC
Decompile->start(appInfo.filePath() + "/iasl", QStringList() << "-e" << list << "-d" << ui->editDSDT->text());
#endif
connect(Decompile, SIGNAL(finished(int)), this, SLOT(readDecompileResult(int)));
#ifdef Q_OS_WIN32
Decompile->execute(appInfo.filePath() + "/iasl.exe", QStringList() << "-e" << list << "-d" << ui->editDSDT->text());
#endif
#ifdef Q_OS_LINUX
Decompile->execute(appInfo.filePath() + "/iasl", QStringList() << "-e" << list << "-d" << ui->editDSDT->text());
#endif
#ifdef Q_OS_MAC
Decompile->execute(appInfo.filePath() + "/iasl", QStringList() << "-e" << list << "-d" << ui->editDSDT->text());
#endif
QFileInfo fi(ui->editDSDT->text());
QString file = fi.path() + "/" + fi.baseName() + ".dsl";
QFileInfo out(file);
if (out.exists())
mw_one->loadFile(file, -1, -1);
}
void dlgDecompile::on_btnClearList_clicked()
{
ui->listSSDT->clear();
}
void dlgDecompile::readDecompileResult(int exitCode)
{
QString result, result1;
result = QString::fromUtf8(Decompile->readAllStandardOutput());
result1 = QString::fromUtf8(Decompile->readAllStandardError());
ui->textLog->clear();
ui->textLog->append(result);
ui->textLog->append(result1);
if (exitCode == 0) {
//成功
} else {
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/softxing/Xiasl.git
[email protected]:softxing/Xiasl.git
softxing
Xiasl
Xiasl
master

搜索帮助