-
Notifications
You must be signed in to change notification settings - Fork 26
/
dlgdecompile.cpp
130 lines (91 loc) · 2.96 KB
/
dlgdecompile.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#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 {
}
}