mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 05:45:27 +00:00
format ****(seed)
This commit is contained in:
parent
b91ea94543
commit
b12f665668
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
# The final executable after `make clean`
|
# The final executable after `make clean`
|
||||||
|
|
||||||
iaito
|
iaito
|
||||||
|
AStyle*
|
||||||
|
|
||||||
# C++ objects and libs
|
# C++ objects and libs
|
||||||
|
|
||||||
|
10
README.md
10
README.md
@ -18,6 +18,16 @@ Iaitō is not aimed at existing radare2 users, it is focused on those whose are
|
|||||||
|
|
||||||
Yes, the code sucks. Hopefully we will be able to remove this statement from the README one day, but I had never coded Qt nor C++ until I started Iaitō, so obviously the code is ugly and not well designed.
|
Yes, the code sucks. Hopefully we will be able to remove this statement from the README one day, but I had never coded Qt nor C++ until I started Iaitō, so obviously the code is ugly and not well designed.
|
||||||
|
|
||||||
|
### Code formatting
|
||||||
|
|
||||||
|
We use [AStyle 2.06](https://sourceforge.net/projects/astyle/files/astyle/astyle%202.06/) to format the code. The command line for formatting the code according to the style is:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
AStyle --style=allman --convert-tabs --align-pointer=name --align-reference=name --indent=spaces --indent-namespaces --indent-col1-comments --pad-oper --pad-header --unpad-paren --keep-one-line-blocks --close-templates $(git ls-files *.cpp *.h *.c *.hpp)
|
||||||
|
```
|
||||||
|
|
||||||
|
**If in doubt, check the source around you and follow that style!**
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- **Radare2**: Make sure that, when cloning the project, you use `git clone --recurse-submodules` or run `git submodule init` and `git submodule update` to clone the correct radare2 version. Then execute the following command in the radare2 folder:
|
- **Radare2**: Make sure that, when cloning the project, you use `git clone --recurse-submodules` or run `git submodule init` and `git submodule update` to clone the correct radare2 version. Then execute the following command in the radare2 folder:
|
||||||
|
@ -11,7 +11,8 @@ AnalThread::AnalThread(QWidget *parent) :
|
|||||||
|
|
||||||
AnalThread::~AnalThread()
|
AnalThread::~AnalThread()
|
||||||
{
|
{
|
||||||
if (isRunning()) {
|
if (isRunning())
|
||||||
|
{
|
||||||
quit();
|
quit();
|
||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
|
@ -35,24 +35,36 @@ void createNewDialog::on_exampleButton_clicked()
|
|||||||
{
|
{
|
||||||
QString type = ui->comboType->currentText();
|
QString type = ui->comboType->currentText();
|
||||||
QString str;
|
QString str;
|
||||||
if (type == "Assembler") {
|
if (type == "Assembler")
|
||||||
|
{
|
||||||
str = "; Sample program code\nmov eax, 1\nint 0x80";
|
str = "; Sample program code\nmov eax, 1\nint 0x80";
|
||||||
} else if (type == "Text") {
|
}
|
||||||
|
else if (type == "Text")
|
||||||
|
{
|
||||||
str = "Hello World";
|
str = "Hello World";
|
||||||
} else if (type == "Rapatch") {
|
}
|
||||||
|
else if (type == "Rapatch")
|
||||||
|
{
|
||||||
str = "; Sample rapatch script\n"
|
str = "; Sample rapatch script\n"
|
||||||
"0x0 \"Hello World\n"
|
"0x0 \"Hello World\n"
|
||||||
"0x10 909090";
|
"0x10 909090";
|
||||||
} else if (type == "C Code") {
|
}
|
||||||
|
else if (type == "C Code")
|
||||||
|
{
|
||||||
str = "int main() {\n"
|
str = "int main() {\n"
|
||||||
" write (1, \"Hello World\", 12);\n"
|
" write (1, \"Hello World\", 12);\n"
|
||||||
" exit (0);\n"
|
" exit (0);\n"
|
||||||
"}";
|
"}";
|
||||||
} else if (type == "Radare2 script") {
|
}
|
||||||
|
else if (type == "Radare2 script")
|
||||||
|
{
|
||||||
str = "w Hello\ns+5\nw World";
|
str = "w Hello\ns+5\nw World";
|
||||||
} else if (type == "Hexpairs") {
|
}
|
||||||
|
else if (type == "Hexpairs")
|
||||||
|
{
|
||||||
str = "48656c6c6f20576f726c6400";
|
str = "48656c6c6f20576f726c6400";
|
||||||
} else fprintf (stderr, "Unknown combo value selected");
|
}
|
||||||
|
else fprintf(stderr, "Unknown combo value selected");
|
||||||
if (str.length() > 0)
|
if (str.length() > 0)
|
||||||
ui->plainTextEdit->setPlainText(str);
|
ui->plainTextEdit->setPlainText(str);
|
||||||
// }
|
// }
|
||||||
@ -69,102 +81,148 @@ void createNewDialog::on_buttonCreate_clicked()
|
|||||||
int fsize = r_num_math(NULL, ui->entrySize->text().toUtf8().constData());
|
int fsize = r_num_math(NULL, ui->entrySize->text().toUtf8().constData());
|
||||||
QString format = ui->comboFormat->currentText();
|
QString format = ui->comboFormat->currentText();
|
||||||
|
|
||||||
if (type == "Assembler") {
|
if (type == "Assembler")
|
||||||
|
{
|
||||||
RAsmCode *code = r_asm_massemble(lcore->assembler, ui->plainTextEdit->toPlainText().toUtf8().constData());
|
RAsmCode *code = r_asm_massemble(lcore->assembler, ui->plainTextEdit->toPlainText().toUtf8().constData());
|
||||||
if (code && code->len>0) {
|
if (code && code->len > 0)
|
||||||
|
{
|
||||||
char file[32];
|
char file[32];
|
||||||
snprintf(file, sizeof(file) - 1, "malloc://%d", code->len);
|
snprintf(file, sizeof(file) - 1, "malloc://%d", code->len);
|
||||||
if (w->core->loadFile(file,0,0,1,0,0,false)) {
|
if (w->core->loadFile(file, 0, 0, 1, 0, 0, false))
|
||||||
|
{
|
||||||
created = true;
|
created = true;
|
||||||
r_core_write_at(lcore, 0, code->buf, code->len);
|
r_core_write_at(lcore, 0, code->buf, code->len);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("Failed to create file");
|
__alert("Failed to create file");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("Invalid assembler code");
|
__alert("Invalid assembler code");
|
||||||
}
|
}
|
||||||
r_asm_code_free(code);
|
r_asm_code_free(code);
|
||||||
} else if (type == "Rapatch") {
|
}
|
||||||
if (fsize>0) {
|
else if (type == "Rapatch")
|
||||||
|
{
|
||||||
|
if (fsize > 0)
|
||||||
|
{
|
||||||
char file[32];
|
char file[32];
|
||||||
created = true;
|
created = true;
|
||||||
snprintf(file, sizeof(file) - 1, "malloc://%d", fsize);
|
snprintf(file, sizeof(file) - 1, "malloc://%d", fsize);
|
||||||
if (w->core->loadFile(file,0,0,1,0,0,false)) {
|
if (w->core->loadFile(file, 0, 0, 1, 0, 0, false))
|
||||||
|
{
|
||||||
r_core_patch(lcore, ui->plainTextEdit->toPlainText().toUtf8().constData());
|
r_core_patch(lcore, ui->plainTextEdit->toPlainText().toUtf8().constData());
|
||||||
r_core_seek(lcore, 0, 1);
|
r_core_seek(lcore, 0, 1);
|
||||||
created = true;
|
created = true;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("failed to open file");
|
__alert("failed to open file");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("Invalid file size");
|
__alert("Invalid file size");
|
||||||
}
|
}
|
||||||
} else if (type == "C Code") {
|
}
|
||||||
|
else if (type == "C Code")
|
||||||
|
{
|
||||||
__alert("C Code: TODO");
|
__alert("C Code: TODO");
|
||||||
// ragg2-cc -x
|
// ragg2-cc -x
|
||||||
} else if (type == "Radare2 script") {
|
}
|
||||||
if (fsize>0) {
|
else if (type == "Radare2 script")
|
||||||
|
{
|
||||||
|
if (fsize > 0)
|
||||||
|
{
|
||||||
char file[32];
|
char file[32];
|
||||||
created = true;
|
created = true;
|
||||||
snprintf(file, sizeof(file) - 1, "malloc://%d", fsize);
|
snprintf(file, sizeof(file) - 1, "malloc://%d", fsize);
|
||||||
if (w->core->loadFile(file,0,0,1,0,0,false)) {
|
if (w->core->loadFile(file, 0, 0, 1, 0, 0, false))
|
||||||
|
{
|
||||||
created = true;
|
created = true;
|
||||||
QString str = ui->plainTextEdit->toPlainText();
|
QString str = ui->plainTextEdit->toPlainText();
|
||||||
QList <QString> lines = str.split("\n");
|
QList <QString> lines = str.split("\n");
|
||||||
foreach (QString str, lines) {
|
foreach (QString str, lines)
|
||||||
|
{
|
||||||
w->core->cmd(str);
|
w->core->cmd(str);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("failed to open file");
|
__alert("failed to open file");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("Invalid file size");
|
__alert("Invalid file size");
|
||||||
}
|
}
|
||||||
} else if (type == "Text") {
|
}
|
||||||
|
else if (type == "Text")
|
||||||
|
{
|
||||||
char file[32];
|
char file[32];
|
||||||
QByteArray hexpairs = ui->plainTextEdit->toPlainText().toUtf8();
|
QByteArray hexpairs = ui->plainTextEdit->toPlainText().toUtf8();
|
||||||
int sz = strlen(hexpairs.constData());
|
int sz = strlen(hexpairs.constData());
|
||||||
if (sz>0) {
|
if (sz > 0)
|
||||||
|
{
|
||||||
snprintf(file, sizeof(file) - 1, "malloc://%d", sz);
|
snprintf(file, sizeof(file) - 1, "malloc://%d", sz);
|
||||||
if (w->core->loadFile(file,0,0,1,0,0,false)) {
|
if (w->core->loadFile(file, 0, 0, 1, 0, 0, false))
|
||||||
|
{
|
||||||
created = true;
|
created = true;
|
||||||
r_core_write_at(lcore, 0, (const ut8 *)hexpairs.constData(), sz);
|
r_core_write_at(lcore, 0, (const ut8 *)hexpairs.constData(), sz);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("failed to open file");
|
__alert("failed to open file");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("Empty string?");
|
__alert("Empty string?");
|
||||||
}
|
}
|
||||||
} else if (type == "Hexpairs") {
|
}
|
||||||
|
else if (type == "Hexpairs")
|
||||||
|
{
|
||||||
char file[32];
|
char file[32];
|
||||||
int sz;
|
int sz;
|
||||||
QByteArray hexpairs = ui->plainTextEdit->toPlainText().toUtf8();
|
QByteArray hexpairs = ui->plainTextEdit->toPlainText().toUtf8();
|
||||||
ut8 *buf = (ut8 *)malloc(strlen(hexpairs.constData()) + 1);
|
ut8 *buf = (ut8 *)malloc(strlen(hexpairs.constData()) + 1);
|
||||||
sz = r_hex_str2bin(hexpairs.constData(), buf);
|
sz = r_hex_str2bin(hexpairs.constData(), buf);
|
||||||
if (sz>0) {
|
if (sz > 0)
|
||||||
|
{
|
||||||
snprintf(file, sizeof(file) - 1, "malloc://%d", sz);
|
snprintf(file, sizeof(file) - 1, "malloc://%d", sz);
|
||||||
if (w->core->loadFile(file,0,0,1,0,0,false)) {
|
if (w->core->loadFile(file, 0, 0, 1, 0, 0, false))
|
||||||
|
{
|
||||||
created = true;
|
created = true;
|
||||||
r_core_write_at(lcore, 0, buf, sz);
|
r_core_write_at(lcore, 0, buf, sz);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("failed to open file");
|
__alert("failed to open file");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("Invalid hexpair string");
|
__alert("Invalid hexpair string");
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("Unknown combo value selected");
|
__alert("Unknown combo value selected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format != "Raw") {
|
if (format != "Raw")
|
||||||
|
{
|
||||||
__alert("TODO: non-raw fileformat is not yet supported");
|
__alert("TODO: non-raw fileformat is not yet supported");
|
||||||
created = false;
|
created = false;
|
||||||
delete w->core;
|
delete w->core;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (created) {
|
if (created)
|
||||||
|
{
|
||||||
|
|
||||||
// Close dialog and open OptionsDialog
|
// Close dialog and open OptionsDialog
|
||||||
close();
|
close();
|
||||||
@ -174,7 +232,9 @@ void createNewDialog::on_buttonCreate_clicked()
|
|||||||
w->setFilename("-");
|
w->setFilename("-");
|
||||||
w->add_output("Finished, check its contents");
|
w->add_output("Finished, check its contents");
|
||||||
w->showMaximized();
|
w->showMaximized();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
__alert("No file created.");
|
__alert("No file created.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class createNewDialog;
|
class createNewDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class AboutDialog;
|
class AboutDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ void CommentsDialog::on_buttonBox_rejected()
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CommentsDialog::getComment() {
|
QString CommentsDialog::getComment()
|
||||||
|
{
|
||||||
QString ret = ui->lineEdit->text();
|
QString ret = ui->lineEdit->text();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class CommentsDialog;
|
class CommentsDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class RenameDialog;
|
class RenameDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,9 +27,11 @@ XrefsDialog::~XrefsDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XrefsDialog::fillRefs(QList<QStringList> refs, QList<QStringList> xrefs) {
|
void XrefsDialog::fillRefs(QList<QStringList> refs, QList<QStringList> xrefs)
|
||||||
|
{
|
||||||
ui->fromTreeWidget->clear();
|
ui->fromTreeWidget->clear();
|
||||||
for (int i = 0; i < refs.size(); ++i) {
|
for (int i = 0; i < refs.size(); ++i)
|
||||||
|
{
|
||||||
//this->add_debug_output(refs.at(i).at(0) + " " + refs.at(i).at(1));
|
//this->add_debug_output(refs.at(i).at(0) + " " + refs.at(i).at(1));
|
||||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||||
tempItem->setText(0, refs.at(i).at(0));
|
tempItem->setText(0, refs.at(i).at(0));
|
||||||
@ -40,12 +42,14 @@ void XrefsDialog::fillRefs(QList<QStringList> refs, QList<QStringList> xrefs) {
|
|||||||
}
|
}
|
||||||
// Adjust columns to content
|
// Adjust columns to content
|
||||||
int count = ui->fromTreeWidget->columnCount();
|
int count = ui->fromTreeWidget->columnCount();
|
||||||
for (int i = 0; i != count; ++i) {
|
for (int i = 0; i != count; ++i)
|
||||||
|
{
|
||||||
ui->fromTreeWidget->resizeColumnToContents(i);
|
ui->fromTreeWidget->resizeColumnToContents(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->toTreeWidget->clear();
|
ui->toTreeWidget->clear();
|
||||||
for (int i = 0; i < xrefs.size(); ++i) {
|
for (int i = 0; i < xrefs.size(); ++i)
|
||||||
|
{
|
||||||
//this->add_debug_output(xrefs.at(i).at(0) + " " + xrefs.at(i).at(1));
|
//this->add_debug_output(xrefs.at(i).at(0) + " " + xrefs.at(i).at(1));
|
||||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||||
tempItem->setText(0, xrefs.at(i).at(0));
|
tempItem->setText(0, xrefs.at(i).at(0));
|
||||||
@ -56,7 +60,8 @@ void XrefsDialog::fillRefs(QList<QStringList> refs, QList<QStringList> xrefs) {
|
|||||||
}
|
}
|
||||||
// Adjust columns to content
|
// Adjust columns to content
|
||||||
int count2 = ui->toTreeWidget->columnCount();
|
int count2 = ui->toTreeWidget->columnCount();
|
||||||
for (int i = 0; i != count2; ++i) {
|
for (int i = 0; i != count2; ++i)
|
||||||
|
{
|
||||||
ui->toTreeWidget->resizeColumnToContents(i);
|
ui->toTreeWidget->resizeColumnToContents(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,24 +89,30 @@ void XrefsDialog::on_toTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int c
|
|||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString XrefsDialog::normalizeAddr(QString addr) {
|
QString XrefsDialog::normalizeAddr(QString addr)
|
||||||
|
{
|
||||||
QString base = addr.split("0x")[1].trimmed();
|
QString base = addr.split("0x")[1].trimmed();
|
||||||
int len = base.length();
|
int len = base.length();
|
||||||
if (len < 8) {
|
if (len < 8)
|
||||||
|
{
|
||||||
int padding = 8 - len;
|
int padding = 8 - len;
|
||||||
QString zero = "0";
|
QString zero = "0";
|
||||||
QString zeroes = zero.repeated(padding);
|
QString zeroes = zero.repeated(padding);
|
||||||
QString s = "0x" + zeroes + base;
|
QString s = "0x" + zeroes + base;
|
||||||
return s;
|
return s;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XrefsDialog::highlightCurrentLine() {
|
void XrefsDialog::highlightCurrentLine()
|
||||||
|
{
|
||||||
QList<QTextEdit::ExtraSelection> extraSelections;
|
QList<QTextEdit::ExtraSelection> extraSelections;
|
||||||
|
|
||||||
if (ui->previewTextEdit->isReadOnly()) {
|
if (ui->previewTextEdit->isReadOnly())
|
||||||
|
{
|
||||||
QTextEdit::ExtraSelection selection;
|
QTextEdit::ExtraSelection selection;
|
||||||
|
|
||||||
QColor lineColor = QColor(190, 144, 212);
|
QColor lineColor = QColor(190, 144, 212);
|
||||||
@ -139,7 +150,8 @@ void XrefsDialog::on_toTreeWidget_itemSelectionChanged()
|
|||||||
ui->previewTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
|
ui->previewTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XrefsDialog::updateLabels(QString name) {
|
void XrefsDialog::updateLabels(QString name)
|
||||||
|
{
|
||||||
ui->label_2->setText(ui->label_2->text() + name);
|
ui->label_2->setText(ui->label_2->text() + name);
|
||||||
ui->label_3->setText(ui->label_3->text() + name);
|
ui->label_3->setText(ui->label_3->text() + name);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class XrefsDialog;
|
class XrefsDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@ namespace qhelpers
|
|||||||
|
|
||||||
// TODO: wouldn't it be enough to setFont on the QWidget?
|
// TODO: wouldn't it be enough to setFont on the QWidget?
|
||||||
|
|
||||||
void normalizeFont(QPlainTextEdit *edit) {
|
void normalizeFont(QPlainTextEdit *edit)
|
||||||
|
{
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
QFont anonFont("Inconsolata", 12);
|
QFont anonFont("Inconsolata", 12);
|
||||||
QTextDocument *out_doc = edit->document();
|
QTextDocument *out_doc = edit->document();
|
||||||
@ -16,7 +17,8 @@ void normalizeFont(QPlainTextEdit *edit) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void normalizeEditFont(QTextEdit *edit) {
|
void normalizeEditFont(QTextEdit *edit)
|
||||||
|
{
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
QFont anonFont("Inconsolata", 12);
|
QFont anonFont("Inconsolata", 12);
|
||||||
QTextDocument *out_doc = edit->document();
|
QTextDocument *out_doc = edit->document();
|
||||||
|
@ -18,10 +18,12 @@ AsciiHighlighter::AsciiHighlighter(QTextDocument *parent)
|
|||||||
|
|
||||||
void AsciiHighlighter::highlightBlock(const QString &text)
|
void AsciiHighlighter::highlightBlock(const QString &text)
|
||||||
{
|
{
|
||||||
foreach (const HighlightingRule &rule, highlightingRules) {
|
foreach (const HighlightingRule &rule, highlightingRules)
|
||||||
|
{
|
||||||
QRegExp expression(rule.pattern);
|
QRegExp expression(rule.pattern);
|
||||||
int index = expression.indexIn(text);
|
int index = expression.indexIn(text);
|
||||||
while (index >= 0) {
|
while (index >= 0)
|
||||||
|
{
|
||||||
int length = expression.matchedLength();
|
int length = expression.matchedLength();
|
||||||
setFormat(index, length, rule.format);
|
setFormat(index, length, rule.format);
|
||||||
index = expression.indexIn(text, index + length);
|
index = expression.indexIn(text, index + length);
|
||||||
@ -33,13 +35,17 @@ void AsciiHighlighter::highlightBlock(const QString &text)
|
|||||||
if (previousBlockState() != 1)
|
if (previousBlockState() != 1)
|
||||||
startIndex = commentStartExpression.indexIn(text);
|
startIndex = commentStartExpression.indexIn(text);
|
||||||
|
|
||||||
while (startIndex >= 0) {
|
while (startIndex >= 0)
|
||||||
|
{
|
||||||
int endIndex = commentEndExpression.indexIn(text, startIndex);
|
int endIndex = commentEndExpression.indexIn(text, startIndex);
|
||||||
int commentLength;
|
int commentLength;
|
||||||
if (endIndex == -1) {
|
if (endIndex == -1)
|
||||||
|
{
|
||||||
setCurrentBlockState(1);
|
setCurrentBlockState(1);
|
||||||
commentLength = text.length() - startIndex;
|
commentLength = text.length() - startIndex;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
commentLength = endIndex - startIndex
|
commentLength = endIndex - startIndex
|
||||||
+ commentEndExpression.matchedLength();
|
+ commentEndExpression.matchedLength();
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ HexHighlighter::HexHighlighter(QTextDocument *parent)
|
|||||||
<< "\\b6e\\b" << "\\b6f\\b" << "\\b70\\b" << "\\b71\\b" << "\\b72\\b" << "\\b73\\b" << "\\b74\\b"
|
<< "\\b6e\\b" << "\\b6f\\b" << "\\b70\\b" << "\\b71\\b" << "\\b72\\b" << "\\b73\\b" << "\\b74\\b"
|
||||||
<< "\\b75\\b" << "\\b76\\b" << "\\b77\\b" << "\\b78\\b" << "\\b79\\b" << "\\b7a\\b" << "\\b7b\\b"
|
<< "\\b75\\b" << "\\b76\\b" << "\\b77\\b" << "\\b78\\b" << "\\b79\\b" << "\\b7a\\b" << "\\b7b\\b"
|
||||||
<< "\\b7c\\b" << "\\b7d\\b" << "\\b7e\\b" << "\\b7f\\b";
|
<< "\\b7c\\b" << "\\b7d\\b" << "\\b7e\\b" << "\\b7f\\b";
|
||||||
foreach (const QString &pattern, keywordPatterns) {
|
foreach (const QString &pattern, keywordPatterns)
|
||||||
|
{
|
||||||
rule.pattern = QRegExp(pattern);
|
rule.pattern = QRegExp(pattern);
|
||||||
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
|
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
rule.format = keywordFormat;
|
rule.format = keywordFormat;
|
||||||
@ -44,10 +45,12 @@ HexHighlighter::HexHighlighter(QTextDocument *parent)
|
|||||||
|
|
||||||
void HexHighlighter::highlightBlock(const QString &text)
|
void HexHighlighter::highlightBlock(const QString &text)
|
||||||
{
|
{
|
||||||
foreach (const HighlightingRule &rule, highlightingRules) {
|
foreach (const HighlightingRule &rule, highlightingRules)
|
||||||
|
{
|
||||||
QRegExp expression(rule.pattern);
|
QRegExp expression(rule.pattern);
|
||||||
int index = expression.indexIn(text);
|
int index = expression.indexIn(text);
|
||||||
while (index >= 0) {
|
while (index >= 0)
|
||||||
|
{
|
||||||
int length = expression.matchedLength();
|
int length = expression.matchedLength();
|
||||||
setFormat(index, length, rule.format);
|
setFormat(index, length, rule.format);
|
||||||
index = expression.indexIn(text, index + length);
|
index = expression.indexIn(text, index + length);
|
||||||
@ -59,13 +62,17 @@ void HexHighlighter::highlightBlock(const QString &text)
|
|||||||
if (previousBlockState() != 1)
|
if (previousBlockState() != 1)
|
||||||
startIndex = commentStartExpression.indexIn(text);
|
startIndex = commentStartExpression.indexIn(text);
|
||||||
|
|
||||||
while (startIndex >= 0) {
|
while (startIndex >= 0)
|
||||||
|
{
|
||||||
int endIndex = commentEndExpression.indexIn(text, startIndex);
|
int endIndex = commentEndExpression.indexIn(text, startIndex);
|
||||||
int commentLength;
|
int commentLength;
|
||||||
if (endIndex == -1) {
|
if (endIndex == -1)
|
||||||
|
{
|
||||||
setCurrentBlockState(1);
|
setCurrentBlockState(1);
|
||||||
commentLength = text.length() - startIndex;
|
commentLength = text.length() - startIndex;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
commentLength = endIndex - startIndex
|
commentLength = endIndex - startIndex
|
||||||
+ commentEndExpression.matchedLength();
|
+ commentEndExpression.matchedLength();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,8 @@ Highlighter::Highlighter(MainWindow *main, QTextDocument *parent) :
|
|||||||
keywordFormat.setForeground(QColor(65, 131, 215));
|
keywordFormat.setForeground(QColor(65, 131, 215));
|
||||||
keywordFormat.setFontWeight(QFont::Bold);
|
keywordFormat.setFontWeight(QFont::Bold);
|
||||||
|
|
||||||
foreach (const QString &pattern, this->main->core->opcodes) {
|
foreach (const QString &pattern, this->main->core->opcodes)
|
||||||
|
{
|
||||||
rule.pattern = QRegExp("\\b" + pattern + "\\b");
|
rule.pattern = QRegExp("\\b" + pattern + "\\b");
|
||||||
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
|
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
rule.format = keywordFormat;
|
rule.format = keywordFormat;
|
||||||
@ -24,7 +25,8 @@ Highlighter::Highlighter(MainWindow *main, QTextDocument *parent) :
|
|||||||
regFormat.setForeground(QColor(236, 100, 75));
|
regFormat.setForeground(QColor(236, 100, 75));
|
||||||
regFormat.setFontWeight(QFont::Bold);
|
regFormat.setFontWeight(QFont::Bold);
|
||||||
|
|
||||||
foreach (const QString &pattern, this->main->core->regs) {
|
foreach (const QString &pattern, this->main->core->regs)
|
||||||
|
{
|
||||||
rule.pattern = QRegExp("\\b" + pattern + "\\b");
|
rule.pattern = QRegExp("\\b" + pattern + "\\b");
|
||||||
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
|
rule.pattern.setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
rule.format = regFormat;
|
rule.format = regFormat;
|
||||||
@ -44,10 +46,12 @@ Highlighter::Highlighter(MainWindow *main, QTextDocument *parent) :
|
|||||||
|
|
||||||
void Highlighter::highlightBlock(const QString &text)
|
void Highlighter::highlightBlock(const QString &text)
|
||||||
{
|
{
|
||||||
foreach (const HighlightingRule &rule, highlightingRules) {
|
foreach (const HighlightingRule &rule, highlightingRules)
|
||||||
|
{
|
||||||
QRegExp expression(rule.pattern);
|
QRegExp expression(rule.pattern);
|
||||||
int index = expression.indexIn(text);
|
int index = expression.indexIn(text);
|
||||||
while (index >= 0) {
|
while (index >= 0)
|
||||||
|
{
|
||||||
int length = expression.matchedLength();
|
int length = expression.matchedLength();
|
||||||
setFormat(index, length, rule.format);
|
setFormat(index, length, rule.format);
|
||||||
index = expression.indexIn(text, index + length);
|
index = expression.indexIn(text, index + length);
|
||||||
@ -59,13 +63,17 @@ void Highlighter::highlightBlock(const QString &text)
|
|||||||
if (previousBlockState() != 1)
|
if (previousBlockState() != 1)
|
||||||
startIndex = commentStartExpression.indexIn(text);
|
startIndex = commentStartExpression.indexIn(text);
|
||||||
|
|
||||||
while (startIndex >= 0) {
|
while (startIndex >= 0)
|
||||||
|
{
|
||||||
int endIndex = commentEndExpression.indexIn(text, startIndex);
|
int endIndex = commentEndExpression.indexIn(text, startIndex);
|
||||||
int commentLength;
|
int commentLength;
|
||||||
if (endIndex == -1) {
|
if (endIndex == -1)
|
||||||
|
{
|
||||||
setCurrentBlockState(1);
|
setCurrentBlockState(1);
|
||||||
commentLength = text.length() - startIndex;
|
commentLength = text.length() - startIndex;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
commentLength = endIndex - startIndex
|
commentLength = endIndex - startIndex
|
||||||
+ commentEndExpression.matchedLength();
|
+ commentEndExpression.matchedLength();
|
||||||
}
|
}
|
||||||
|
@ -232,12 +232,14 @@ MainWindow::MainWindow(QWidget *parent, QRCore *kore) :
|
|||||||
connect(&webserverThread, SIGNAL(finished()), this, SLOT(webserverThreadFinished()));
|
connect(&webserverThread, SIGNAL(finished()), this, SLOT(webserverThreadFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
delete core;
|
delete core;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::start_web_server() {
|
void MainWindow::start_web_server()
|
||||||
|
{
|
||||||
// Start web server
|
// Start web server
|
||||||
webserverThread.startServer();
|
webserverThread.startServer();
|
||||||
}
|
}
|
||||||
@ -252,15 +254,18 @@ void MainWindow::webserverThreadFinished()
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::adjustColumns(QTreeWidget *tw) {
|
void MainWindow::adjustColumns(QTreeWidget *tw)
|
||||||
|
{
|
||||||
int count = tw->columnCount();
|
int count = tw->columnCount();
|
||||||
for (int i = 0; i != count; ++i) {
|
for (int i = 0; i != count; ++i)
|
||||||
|
{
|
||||||
tw->resizeColumnToContents(i);
|
tw->resizeColumnToContents(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::appendRow(QTreeWidget *tw, const QString &str, const QString &str2,
|
void MainWindow::appendRow(QTreeWidget *tw, const QString &str, const QString &str2,
|
||||||
const QString &str3, const QString &str4, const QString &str5) {
|
const QString &str3, const QString &str4, const QString &str5)
|
||||||
|
{
|
||||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||||
// Fill dummy hidden column
|
// Fill dummy hidden column
|
||||||
tempItem->setText(0, "0");
|
tempItem->setText(0, "0");
|
||||||
@ -278,19 +283,23 @@ void MainWindow::appendRow(QTreeWidget *tw, const QString &str, const QString &s
|
|||||||
|
|
||||||
void MainWindow::setWebServerState(bool start)
|
void MainWindow::setWebServerState(bool start)
|
||||||
{
|
{
|
||||||
if (start) {
|
if (start)
|
||||||
|
{
|
||||||
webserverThread.startServer();
|
webserverThread.startServer();
|
||||||
|
|
||||||
// Open web interface on default browser
|
// Open web interface on default browser
|
||||||
// ballessay: well isn't this possible with =H&
|
// ballessay: well isn't this possible with =H&
|
||||||
//QString link = "http://localhost:9090/";
|
//QString link = "http://localhost:9090/";
|
||||||
//QDesktopServices::openUrl(QUrl(link));
|
//QDesktopServices::openUrl(QUrl(link));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
webserverThread.stopServer();
|
webserverThread.stopServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::hideDummyColumns() {
|
void MainWindow::hideDummyColumns()
|
||||||
|
{
|
||||||
// UGLY, should be a loop over all treewidgets...
|
// UGLY, should be a loop over all treewidgets...
|
||||||
this->functionsDock->functionsTreeWidget->setColumnHidden(0, true);
|
this->functionsDock->functionsTreeWidget->setColumnHidden(0, true);
|
||||||
this->importsDock->importsTreeWidget->setColumnHidden(0, true);
|
this->importsDock->importsTreeWidget->setColumnHidden(0, true);
|
||||||
@ -301,7 +310,8 @@ void MainWindow::hideDummyColumns() {
|
|||||||
this->commentsDock->commentsTreeWidget->setColumnHidden(0, true);
|
this->commentsDock->commentsTreeWidget->setColumnHidden(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setFilename(QString fn) {
|
void MainWindow::setFilename(QString fn)
|
||||||
|
{
|
||||||
|
|
||||||
// Add file name to window title
|
// Add file name to window title
|
||||||
this->filename = fn;
|
this->filename = fn;
|
||||||
@ -328,7 +338,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||||||
"Do you really want to exit?\nSave your project before closing!",
|
"Do you really want to exit?\nSave your project before closing!",
|
||||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
//qDebug() << ret;
|
//qDebug() << ret;
|
||||||
if (ret == QMessageBox::Save) {
|
if (ret == QMessageBox::Save)
|
||||||
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue("geometry", saveGeometry());
|
settings.setValue("geometry", saveGeometry());
|
||||||
settings.setValue("size", size());
|
settings.setValue("size", size());
|
||||||
@ -339,13 +350,17 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||||||
//this->add_debug_output(notes);
|
//this->add_debug_output(notes);
|
||||||
this->core->cmd("Pnj " + notes);
|
this->core->cmd("Pnj " + notes);
|
||||||
QMainWindow::closeEvent(event);
|
QMainWindow::closeEvent(event);
|
||||||
} else if (ret == QMessageBox::Discard) {
|
}
|
||||||
|
else if (ret == QMessageBox::Discard)
|
||||||
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue("geometry", saveGeometry());
|
settings.setValue("geometry", saveGeometry());
|
||||||
settings.setValue("size", size());
|
settings.setValue("size", size());
|
||||||
settings.setValue("pos", pos());
|
settings.setValue("pos", pos());
|
||||||
settings.setValue("state", saveState());
|
settings.setValue("state", saveState());
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -357,20 +372,23 @@ void MainWindow::readSettings()
|
|||||||
restoreGeometry(geo);
|
restoreGeometry(geo);
|
||||||
QByteArray state = settings.value("state", QByteArray()).toByteArray();
|
QByteArray state = settings.value("state", QByteArray()).toByteArray();
|
||||||
restoreState(state);
|
restoreState(state);
|
||||||
if (settings.value("dark").toBool()) {
|
if (settings.value("dark").toBool())
|
||||||
|
{
|
||||||
this->dark();
|
this->dark();
|
||||||
}
|
}
|
||||||
this->responsive = settings.value("responsive").toBool();
|
this->responsive = settings.value("responsive").toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::dark() {
|
void MainWindow::dark()
|
||||||
|
{
|
||||||
qApp->setStyleSheet("QPlainTextEdit { background-color: rgb(64, 64, 64); color: rgb(222, 222, 222);} QTextEdit { background-color: rgb(64, 64, 64); color: rgb(222, 222, 222);} ");
|
qApp->setStyleSheet("QPlainTextEdit { background-color: rgb(64, 64, 64); color: rgb(222, 222, 222);} QTextEdit { background-color: rgb(64, 64, 64); color: rgb(222, 222, 222);} ");
|
||||||
this->memoryDock->switchTheme(true);
|
this->memoryDock->switchTheme(true);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue("dark", true);
|
settings.setValue("dark", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::def_theme() {
|
void MainWindow::def_theme()
|
||||||
|
{
|
||||||
qApp->setStyleSheet("");
|
qApp->setStyleSheet("");
|
||||||
this->memoryDock->switchTheme(false);
|
this->memoryDock->switchTheme(false);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
@ -381,20 +399,24 @@ void MainWindow::def_theme() {
|
|||||||
* Refresh widget functions
|
* Refresh widget functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void MainWindow::refreshFunctions() {
|
void MainWindow::refreshFunctions()
|
||||||
|
{
|
||||||
this->functionsDock->refreshTree();
|
this->functionsDock->refreshTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshComments() {
|
void MainWindow::refreshComments()
|
||||||
|
{
|
||||||
this->commentsDock->refreshTree();
|
this->commentsDock->refreshTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshFlagspaces() {
|
void MainWindow::refreshFlagspaces()
|
||||||
|
{
|
||||||
int cur_idx = this->flagsDock->flagspaceCombo->currentIndex();
|
int cur_idx = this->flagsDock->flagspaceCombo->currentIndex();
|
||||||
if (cur_idx < 0)cur_idx = 0;
|
if (cur_idx < 0)cur_idx = 0;
|
||||||
this->flagsDock->flagspaceCombo->clear();
|
this->flagsDock->flagspaceCombo->clear();
|
||||||
this->flagsDock->flagspaceCombo->addItem("(all)");
|
this->flagsDock->flagspaceCombo->addItem("(all)");
|
||||||
for (auto i : core->getList("flagspaces")) {
|
for (auto i : core->getList("flagspaces"))
|
||||||
|
{
|
||||||
this->flagsDock->flagspaceCombo->addItem(i);
|
this->flagsDock->flagspaceCombo->addItem(i);
|
||||||
}
|
}
|
||||||
if (cur_idx > 0)
|
if (cur_idx > 0)
|
||||||
@ -402,7 +424,8 @@ void MainWindow::refreshFlagspaces() {
|
|||||||
refreshFlags();
|
refreshFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshFlags() {
|
void MainWindow::refreshFlags()
|
||||||
|
{
|
||||||
QString flagspace = this->flagsDock->flagspaceCombo->currentText();
|
QString flagspace = this->flagsDock->flagspaceCombo->currentText();
|
||||||
this->omnibar->clearFlags();
|
this->omnibar->clearFlags();
|
||||||
if (flagspace == "(all)")
|
if (flagspace == "(all)")
|
||||||
@ -410,13 +433,16 @@ void MainWindow::refreshFlags() {
|
|||||||
|
|
||||||
this->flagsDock->flagsTreeWidget->clear();
|
this->flagsDock->flagsTreeWidget->clear();
|
||||||
|
|
||||||
for (auto i: core->getList("flags", flagspace)) {
|
for (auto i : core->getList("flags", flagspace))
|
||||||
|
{
|
||||||
QStringList a = i.split(",");
|
QStringList a = i.split(",");
|
||||||
if (a.length()>3) {
|
if (a.length() > 3)
|
||||||
|
{
|
||||||
appendRow(this->flagsDock->flagsTreeWidget, a[1], a[2], a[0], a[3]);
|
appendRow(this->flagsDock->flagsTreeWidget, a[1], a[2], a[0], a[3]);
|
||||||
this->omnibar->fillFlags(a[0]);
|
this->omnibar->fillFlags(a[0]);
|
||||||
}
|
}
|
||||||
else if (a.length()>2) {
|
else if (a.length() > 2)
|
||||||
|
{
|
||||||
appendRow(this->flagsDock->flagsTreeWidget, a[1], a[2], a[0], "");
|
appendRow(this->flagsDock->flagsTreeWidget, a[1], a[2], a[0], "");
|
||||||
this->omnibar->fillFlags(a[0]);
|
this->omnibar->fillFlags(a[0]);
|
||||||
}
|
}
|
||||||
@ -426,18 +452,22 @@ void MainWindow::refreshFlags() {
|
|||||||
this->omnibar->setupCompleter();
|
this->omnibar->setupCompleter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateFrames() {
|
void MainWindow::updateFrames()
|
||||||
|
{
|
||||||
if (core == NULL)
|
if (core == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static bool first_time = true;
|
static bool first_time = true;
|
||||||
if (first_time) {
|
if (first_time)
|
||||||
|
{
|
||||||
setup_mem();
|
setup_mem();
|
||||||
this->add_output(" > Adding binary information to notepad");
|
this->add_output(" > Adding binary information to notepad");
|
||||||
notepadDock->setText("# Binary information\n\n" + core->cmd("i") +
|
notepadDock->setText("# Binary information\n\n" + core->cmd("i") +
|
||||||
"\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n");
|
"\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n");
|
||||||
//first_time = false;
|
//first_time = false;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
refreshMem("");
|
refreshMem("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +478,8 @@ void MainWindow::updateFrames() {
|
|||||||
|
|
||||||
// TODO: make this configurable by the user?
|
// TODO: make this configurable by the user?
|
||||||
const bool use_scrollperpixel = true;
|
const bool use_scrollperpixel = true;
|
||||||
if (use_scrollperpixel) {
|
if (use_scrollperpixel)
|
||||||
|
{
|
||||||
this->flagsDock->flagsTreeWidget->setVerticalScrollMode(spp);
|
this->flagsDock->flagsTreeWidget->setVerticalScrollMode(spp);
|
||||||
this->symbolsDock->symbolsTreeWidget->setVerticalScrollMode(spp);
|
this->symbolsDock->symbolsTreeWidget->setVerticalScrollMode(spp);
|
||||||
this->importsDock->importsTreeWidget->setVerticalScrollMode(spp);
|
this->importsDock->importsTreeWidget->setVerticalScrollMode(spp);
|
||||||
@ -457,7 +488,9 @@ void MainWindow::updateFrames() {
|
|||||||
this->relocsDock->relocsTreeWidget->setVerticalScrollMode(spp);
|
this->relocsDock->relocsTreeWidget->setVerticalScrollMode(spp);
|
||||||
this->memoryDock->xreFromTreeWidget_2->setVerticalScrollMode(spp);
|
this->memoryDock->xreFromTreeWidget_2->setVerticalScrollMode(spp);
|
||||||
this->memoryDock->xrefToTreeWidget_2->setVerticalScrollMode(spp);
|
this->memoryDock->xrefToTreeWidget_2->setVerticalScrollMode(spp);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->flagsDock->flagsTreeWidget->setVerticalScrollMode(spi);
|
this->flagsDock->flagsTreeWidget->setVerticalScrollMode(spi);
|
||||||
this->symbolsDock->symbolsTreeWidget->setVerticalScrollMode(spi);
|
this->symbolsDock->symbolsTreeWidget->setVerticalScrollMode(spi);
|
||||||
this->importsDock->importsTreeWidget->setVerticalScrollMode(spi);
|
this->importsDock->importsTreeWidget->setVerticalScrollMode(spi);
|
||||||
@ -485,7 +518,8 @@ void MainWindow::updateFrames() {
|
|||||||
adjustColumns(this->importsDock->importsTreeWidget);
|
adjustColumns(this->importsDock->importsTreeWidget);
|
||||||
|
|
||||||
this->relocsDock->relocsTreeWidget->clear();
|
this->relocsDock->relocsTreeWidget->clear();
|
||||||
for (auto i: core->getList ("bin","relocs")) {
|
for (auto i : core->getList("bin", "relocs"))
|
||||||
|
{
|
||||||
QStringList pieces = i.split(",");
|
QStringList pieces = i.split(",");
|
||||||
if (pieces.length() == 3)
|
if (pieces.length() == 3)
|
||||||
appendRow(this->relocsDock->relocsTreeWidget, pieces[0], pieces[1], pieces[2]);
|
appendRow(this->relocsDock->relocsTreeWidget, pieces[0], pieces[1], pieces[2]);
|
||||||
@ -495,7 +529,8 @@ void MainWindow::updateFrames() {
|
|||||||
this->symbolsDock->fillSymbols();
|
this->symbolsDock->fillSymbols();
|
||||||
|
|
||||||
this->stringsDock->stringsTreeWidget->clear();
|
this->stringsDock->stringsTreeWidget->clear();
|
||||||
for (auto i : core->getList ("bin", "strings")) {
|
for (auto i : core->getList("bin", "strings"))
|
||||||
|
{
|
||||||
QStringList pieces = i.split(",");
|
QStringList pieces = i.split(",");
|
||||||
if (pieces.length() == 2)
|
if (pieces.length() == 2)
|
||||||
appendRow(this->stringsDock->stringsTreeWidget, pieces[0], pieces[1]);
|
appendRow(this->stringsDock->stringsTreeWidget, pieces[0], pieces[1]);
|
||||||
@ -504,7 +539,8 @@ void MainWindow::updateFrames() {
|
|||||||
|
|
||||||
this->commentsDock->commentsTreeWidget->clear();
|
this->commentsDock->commentsTreeWidget->clear();
|
||||||
QList<QList<QString>> comments = this->core->getComments();
|
QList<QList<QString>> comments = this->core->getComments();
|
||||||
for (QList<QString> comment: comments) {
|
for (QList<QString> comment : comments)
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
QString name;
|
QString name;
|
||||||
//this->add_debug_output("Comment: " + comment[1] + ": " + comment[0]);
|
//this->add_debug_output("Comment: " + comment[1] + ": " + comment[0]);
|
||||||
@ -522,11 +558,13 @@ void MainWindow::updateFrames() {
|
|||||||
|
|
||||||
// Add nested comments
|
// Add nested comments
|
||||||
QMap<QString, QList<QList<QString>>> cmts = this->core->getNestedComments();
|
QMap<QString, QList<QList<QString>>> cmts = this->core->getNestedComments();
|
||||||
for(auto cmt : cmts.keys()) {
|
for (auto cmt : cmts.keys())
|
||||||
|
{
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(this->commentsDock->nestedCommentsTreeWidget);
|
QTreeWidgetItem *item = new QTreeWidgetItem(this->commentsDock->nestedCommentsTreeWidget);
|
||||||
item->setText(0, cmt);
|
item->setText(0, cmt);
|
||||||
QList<QList<QString>> meow = cmts.value(cmt);
|
QList<QList<QString>> meow = cmts.value(cmt);
|
||||||
for (int i = 0; i < meow.size(); ++i) {
|
for (int i = 0; i < meow.size(); ++i)
|
||||||
|
{
|
||||||
QList<QString> tmp = meow.at(i);
|
QList<QString> tmp = meow.at(i);
|
||||||
QTreeWidgetItem *it = new QTreeWidgetItem();
|
QTreeWidgetItem *it = new QTreeWidgetItem();
|
||||||
it->setText(0, tmp[1]);
|
it->setText(0, tmp[1]);
|
||||||
@ -538,15 +576,19 @@ void MainWindow::updateFrames() {
|
|||||||
adjustColumns(this->commentsDock->nestedCommentsTreeWidget);
|
adjustColumns(this->commentsDock->nestedCommentsTreeWidget);
|
||||||
|
|
||||||
// TODO: FIXME: Remove the check for first_time;
|
// TODO: FIXME: Remove the check for first_time;
|
||||||
if (first_time) {
|
if (first_time)
|
||||||
|
{
|
||||||
sectionsWidget->tree->clear();
|
sectionsWidget->tree->clear();
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (auto i: core->getList("bin","sections")) {
|
for (auto i : core->getList("bin", "sections"))
|
||||||
|
{
|
||||||
QStringList a = i.split(",");
|
QStringList a = i.split(",");
|
||||||
if (a.length()>2) {
|
if (a.length() > 2)
|
||||||
|
{
|
||||||
// Fix to work with ARM bins
|
// Fix to work with ARM bins
|
||||||
//if (a[4].startsWith(".")) {
|
//if (a[4].startsWith(".")) {
|
||||||
if (a[4].contains(".")) {
|
if (a[4].contains("."))
|
||||||
|
{
|
||||||
QString addr = a[1];
|
QString addr = a[1];
|
||||||
QString addr_end = "0x0" + core->itoa(core->math(a[1] + "+" + a[2]));
|
QString addr_end = "0x0" + core->itoa(core->math(a[1] + "+" + a[2]));
|
||||||
QString size = QString::number(core->math(a[2]));
|
QString size = QString::number(core->math(a[2]));
|
||||||
@ -554,9 +596,12 @@ void MainWindow::updateFrames() {
|
|||||||
this->sectionsWidget->fillSections(row, name, size, addr, addr_end);
|
this->sectionsWidget->fillSections(row, name, size, addr, addr_end);
|
||||||
|
|
||||||
// Used to select a color for the sections graph
|
// Used to select a color for the sections graph
|
||||||
if (row == 10) {
|
if (row == 10)
|
||||||
|
{
|
||||||
row = 0;
|
row = 0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -578,12 +623,17 @@ void MainWindow::updateFrames() {
|
|||||||
void MainWindow::on_actionLock_triggered()
|
void MainWindow::on_actionLock_triggered()
|
||||||
{
|
{
|
||||||
doLock = !doLock;
|
doLock = !doLock;
|
||||||
if (doLock) {
|
if (doLock)
|
||||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) {
|
{
|
||||||
|
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||||
|
{
|
||||||
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) {
|
else
|
||||||
|
{
|
||||||
|
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||||
|
{
|
||||||
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,12 +641,17 @@ void MainWindow::on_actionLock_triggered()
|
|||||||
|
|
||||||
void MainWindow::lockUnlock_Docks(bool what)
|
void MainWindow::lockUnlock_Docks(bool what)
|
||||||
{
|
{
|
||||||
if(what) {
|
if (what)
|
||||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) {
|
{
|
||||||
|
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||||
|
{
|
||||||
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) {
|
else
|
||||||
|
{
|
||||||
|
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||||
|
{
|
||||||
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -607,12 +662,16 @@ void MainWindow::on_actionLockUnlock_triggered()
|
|||||||
{
|
{
|
||||||
if (ui->actionLockUnlock->isChecked())
|
if (ui->actionLockUnlock->isChecked())
|
||||||
{
|
{
|
||||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) {
|
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||||
|
{
|
||||||
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
}
|
}
|
||||||
ui->actionLockUnlock->setIcon(QIcon(":/new/prefix1/lock"));
|
ui->actionLockUnlock->setIcon(QIcon(":/new/prefix1/lock"));
|
||||||
} else {
|
}
|
||||||
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>()) {
|
else
|
||||||
|
{
|
||||||
|
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
|
||||||
|
{
|
||||||
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||||
}
|
}
|
||||||
ui->actionLockUnlock->setIcon(QIcon(":/new/prefix1/unlock"));
|
ui->actionLockUnlock->setIcon(QIcon(":/new/prefix1/unlock"));
|
||||||
@ -621,11 +680,14 @@ void MainWindow::on_actionLockUnlock_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionTabs_triggered()
|
void MainWindow::on_actionTabs_triggered()
|
||||||
{
|
{
|
||||||
if (ui->centralTabWidget->tabPosition() == QTabWidget::South) {
|
if (ui->centralTabWidget->tabPosition() == QTabWidget::South)
|
||||||
|
{
|
||||||
ui->centralTabWidget->setTabPosition(QTabWidget::North);
|
ui->centralTabWidget->setTabPosition(QTabWidget::North);
|
||||||
this->memoryDock->memTabWidget->setTabPosition(QTabWidget::North);
|
this->memoryDock->memTabWidget->setTabPosition(QTabWidget::North);
|
||||||
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
|
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->centralTabWidget->setTabPosition(QTabWidget::South);
|
ui->centralTabWidget->setTabPosition(QTabWidget::South);
|
||||||
this->memoryDock->memTabWidget->setTabPosition(QTabWidget::South);
|
this->memoryDock->memTabWidget->setTabPosition(QTabWidget::South);
|
||||||
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::South);
|
this->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::South);
|
||||||
@ -646,9 +708,12 @@ void MainWindow::on_actionMem_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionFunctions_triggered()
|
void MainWindow::on_actionFunctions_triggered()
|
||||||
{
|
{
|
||||||
if (this->functionsDock->isVisible()) {
|
if (this->functionsDock->isVisible())
|
||||||
|
{
|
||||||
this->functionsDock->close();
|
this->functionsDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->functionsDock->show();
|
this->functionsDock->show();
|
||||||
this->functionsDock->raise();
|
this->functionsDock->raise();
|
||||||
}
|
}
|
||||||
@ -656,9 +721,12 @@ void MainWindow::on_actionFunctions_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionImports_triggered()
|
void MainWindow::on_actionImports_triggered()
|
||||||
{
|
{
|
||||||
if (this->importsDock->isVisible()) {
|
if (this->importsDock->isVisible())
|
||||||
|
{
|
||||||
this->importsDock->close();
|
this->importsDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->importsDock->show();
|
this->importsDock->show();
|
||||||
this->importsDock->raise();
|
this->importsDock->raise();
|
||||||
}
|
}
|
||||||
@ -666,9 +734,12 @@ void MainWindow::on_actionImports_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionSymbols_triggered()
|
void MainWindow::on_actionSymbols_triggered()
|
||||||
{
|
{
|
||||||
if (this->symbolsDock->isVisible()) {
|
if (this->symbolsDock->isVisible())
|
||||||
|
{
|
||||||
this->symbolsDock->close();
|
this->symbolsDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->symbolsDock->show();
|
this->symbolsDock->show();
|
||||||
this->symbolsDock->raise();
|
this->symbolsDock->raise();
|
||||||
}
|
}
|
||||||
@ -676,9 +747,12 @@ void MainWindow::on_actionSymbols_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionReloc_triggered()
|
void MainWindow::on_actionReloc_triggered()
|
||||||
{
|
{
|
||||||
if (this->relocsDock->isVisible()) {
|
if (this->relocsDock->isVisible())
|
||||||
|
{
|
||||||
this->relocsDock->close();
|
this->relocsDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->relocsDock->show();
|
this->relocsDock->show();
|
||||||
this->relocsDock->raise();
|
this->relocsDock->raise();
|
||||||
}
|
}
|
||||||
@ -686,9 +760,12 @@ void MainWindow::on_actionReloc_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionStrings_triggered()
|
void MainWindow::on_actionStrings_triggered()
|
||||||
{
|
{
|
||||||
if (this->stringsDock->isVisible()) {
|
if (this->stringsDock->isVisible())
|
||||||
|
{
|
||||||
this->stringsDock->close();
|
this->stringsDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->stringsDock->show();
|
this->stringsDock->show();
|
||||||
this->stringsDock->raise();
|
this->stringsDock->raise();
|
||||||
}
|
}
|
||||||
@ -696,9 +773,12 @@ void MainWindow::on_actionStrings_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionSections_triggered()
|
void MainWindow::on_actionSections_triggered()
|
||||||
{
|
{
|
||||||
if (this->sectionsDock->isVisible()) {
|
if (this->sectionsDock->isVisible())
|
||||||
|
{
|
||||||
this->sectionsDock->close();
|
this->sectionsDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->sectionsDock->show();
|
this->sectionsDock->show();
|
||||||
this->sectionsDock->raise();
|
this->sectionsDock->raise();
|
||||||
}
|
}
|
||||||
@ -706,9 +786,12 @@ void MainWindow::on_actionSections_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionFlags_triggered()
|
void MainWindow::on_actionFlags_triggered()
|
||||||
{
|
{
|
||||||
if (this->flagsDock->isVisible()) {
|
if (this->flagsDock->isVisible())
|
||||||
|
{
|
||||||
this->flagsDock->close();
|
this->flagsDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->flagsDock->show();
|
this->flagsDock->show();
|
||||||
this->flagsDock->raise();
|
this->flagsDock->raise();
|
||||||
}
|
}
|
||||||
@ -716,9 +799,12 @@ void MainWindow::on_actionFlags_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionComents_triggered()
|
void MainWindow::on_actionComents_triggered()
|
||||||
{
|
{
|
||||||
if (this->commentsDock->isVisible()) {
|
if (this->commentsDock->isVisible())
|
||||||
|
{
|
||||||
this->commentsDock->close();
|
this->commentsDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->commentsDock->show();
|
this->commentsDock->show();
|
||||||
this->commentsDock->raise();
|
this->commentsDock->raise();
|
||||||
}
|
}
|
||||||
@ -726,9 +812,12 @@ void MainWindow::on_actionComents_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionNotepad_triggered()
|
void MainWindow::on_actionNotepad_triggered()
|
||||||
{
|
{
|
||||||
if (this->notepadDock->isVisible()) {
|
if (this->notepadDock->isVisible())
|
||||||
|
{
|
||||||
this->notepadDock->close();
|
this->notepadDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->notepadDock->show();
|
this->notepadDock->show();
|
||||||
this->notepadDock->raise();
|
this->notepadDock->raise();
|
||||||
}
|
}
|
||||||
@ -742,13 +831,15 @@ void MainWindow::on_actionAbout_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_consoleInputLineEdit_returnPressed()
|
void MainWindow::on_consoleInputLineEdit_returnPressed()
|
||||||
{
|
{
|
||||||
if (this->core) {
|
if (this->core)
|
||||||
|
{
|
||||||
QString input = ui->consoleInputLineEdit->text();
|
QString input = ui->consoleInputLineEdit->text();
|
||||||
ui->consoleOutputTextEdit->appendPlainText(this->core->cmd(input));
|
ui->consoleOutputTextEdit->appendPlainText(this->core->cmd(input));
|
||||||
ui->consoleOutputTextEdit->verticalScrollBar()->setValue(ui->consoleOutputTextEdit->verticalScrollBar()->maximum());
|
ui->consoleOutputTextEdit->verticalScrollBar()->setValue(ui->consoleOutputTextEdit->verticalScrollBar()->maximum());
|
||||||
// Add new command to history
|
// Add new command to history
|
||||||
QCompleter *completer = ui->consoleInputLineEdit->completer();
|
QCompleter *completer = ui->consoleInputLineEdit->completer();
|
||||||
if ( completer != NULL ) {
|
if (completer != NULL)
|
||||||
|
{
|
||||||
QStringListModel *completerModel = (QStringListModel *)(completer->model());
|
QStringListModel *completerModel = (QStringListModel *)(completer->model());
|
||||||
if (completerModel != NULL)
|
if (completerModel != NULL)
|
||||||
completerModel->setStringList(completerModel->stringList() << input);
|
completerModel->setStringList(completerModel->stringList() << input);
|
||||||
@ -764,11 +855,14 @@ void MainWindow::on_showHistoToolButton_clicked()
|
|||||||
if (completer == NULL)
|
if (completer == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ui->showHistoToolButton->isChecked()) {
|
if (ui->showHistoToolButton->isChecked())
|
||||||
|
{
|
||||||
completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
||||||
// Uhm... shouldn't it be called always?
|
// Uhm... shouldn't it be called always?
|
||||||
completer->complete();
|
completer->complete();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
completer->setCompletionMode(QCompleter::PopupCompletion);
|
completer->setCompletionMode(QCompleter::PopupCompletion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -783,7 +877,8 @@ void MainWindow::on_actionRefresh_Panels_triggered()
|
|||||||
this->updateFrames();
|
this->updateFrames();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::seek(const QString& offset, const QString& name) {
|
void MainWindow::seek(const QString &offset, const QString &name)
|
||||||
|
{
|
||||||
if (offset.length() == 0)
|
if (offset.length() == 0)
|
||||||
return;
|
return;
|
||||||
if (name != NULL)
|
if (name != NULL)
|
||||||
@ -796,7 +891,8 @@ void MainWindow::seek(const QString& offset, const QString& name) {
|
|||||||
this->memoryDock->disasTextEdit->setFocus();
|
this->memoryDock->disasTextEdit->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setup_mem() {
|
void MainWindow::setup_mem()
|
||||||
|
{
|
||||||
QString off = this->core->cmd("afo entry0").trimmed();
|
QString off = this->core->cmd("afo entry0").trimmed();
|
||||||
//graphicsBar->refreshColorBar();
|
//graphicsBar->refreshColorBar();
|
||||||
graphicsBar->fillData();
|
graphicsBar->fillData();
|
||||||
@ -807,7 +903,8 @@ void MainWindow::setup_mem() {
|
|||||||
this->memoryDock->setFcnName(off);
|
this->memoryDock->setFcnName(off);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshMem(QString off) {
|
void MainWindow::refreshMem(QString off)
|
||||||
|
{
|
||||||
//add_debug_output("Refreshing to: " + off);
|
//add_debug_output("Refreshing to: " + off);
|
||||||
//graphicsBar->refreshColorBar();
|
//graphicsBar->refreshColorBar();
|
||||||
this->memoryDock->refreshDisasm(off);
|
this->memoryDock->refreshDisasm(off);
|
||||||
@ -821,7 +918,8 @@ void MainWindow::on_backButton_clicked()
|
|||||||
{
|
{
|
||||||
this->core->cmd("s-");
|
this->core->cmd("s-");
|
||||||
QString back_offset = this->core->cmd("s=").split(" > ").last().trimmed();
|
QString back_offset = this->core->cmd("s=").split(" > ").last().trimmed();
|
||||||
if (back_offset != "") {
|
if (back_offset != "")
|
||||||
|
{
|
||||||
QString fcn = this->core->cmdFunctionAt(back_offset);
|
QString fcn = this->core->cmdFunctionAt(back_offset);
|
||||||
this->seek(this->memoryDock->normalizeAddr(back_offset), fcn);
|
this->seek(this->memoryDock->normalizeAddr(back_offset), fcn);
|
||||||
}
|
}
|
||||||
@ -829,7 +927,8 @@ void MainWindow::on_backButton_clicked()
|
|||||||
|
|
||||||
void MainWindow::on_actionCalculator_triggered()
|
void MainWindow::on_actionCalculator_triggered()
|
||||||
{
|
{
|
||||||
if (!this->sideBar->isVisible()) {
|
if (!this->sideBar->isVisible())
|
||||||
|
{
|
||||||
this->on_actionShow_Hide_mainsidebar_triggered();
|
this->on_actionShow_Hide_mainsidebar_triggered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -842,7 +941,8 @@ void MainWindow::on_actionCreate_File_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionAssembler_triggered()
|
void MainWindow::on_actionAssembler_triggered()
|
||||||
{
|
{
|
||||||
if (!this->sideBar->isVisible()) {
|
if (!this->sideBar->isVisible())
|
||||||
|
{
|
||||||
this->on_actionShow_Hide_mainsidebar_triggered();
|
this->on_actionShow_Hide_mainsidebar_triggered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -859,9 +959,12 @@ void MainWindow::on_actionStart_Web_Server_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionConsoleSync_with_core_triggered()
|
void MainWindow::on_actionConsoleSync_with_core_triggered()
|
||||||
{
|
{
|
||||||
if (ui->actionConsoleSync_with_core->isChecked()) {
|
if (ui->actionConsoleSync_with_core->isChecked())
|
||||||
|
{
|
||||||
//Enable core syncronization
|
//Enable core syncronization
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Disable core sync
|
// Disable core sync
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -928,9 +1031,12 @@ void MainWindow::showDefaultDocks()
|
|||||||
|
|
||||||
void MainWindow::on_actionhide_bottomPannel_triggered()
|
void MainWindow::on_actionhide_bottomPannel_triggered()
|
||||||
{
|
{
|
||||||
if (ui->centralWidget->isVisible()) {
|
if (ui->centralWidget->isVisible())
|
||||||
|
{
|
||||||
ui->centralWidget->hide();
|
ui->centralWidget->hide();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->centralWidget->show();
|
ui->centralWidget->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1022,18 +1128,24 @@ void MainWindow::on_actionLoad_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_actionShow_Hide_mainsidebar_triggered()
|
void MainWindow::on_actionShow_Hide_mainsidebar_triggered()
|
||||||
{
|
{
|
||||||
if (ui->sideToolBar->isVisible()) {
|
if (ui->sideToolBar->isVisible())
|
||||||
|
{
|
||||||
ui->sideToolBar->hide();
|
ui->sideToolBar->hide();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->sideToolBar->show();
|
ui->sideToolBar->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionDashboard_triggered()
|
void MainWindow::on_actionDashboard_triggered()
|
||||||
{
|
{
|
||||||
if (this->dashboardDock->isVisible()) {
|
if (this->dashboardDock->isVisible())
|
||||||
|
{
|
||||||
this->dashboardDock->close();
|
this->dashboardDock->close();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->dashboardDock->show();
|
this->dashboardDock->show();
|
||||||
this->dashboardDock->raise();
|
this->dashboardDock->raise();
|
||||||
}
|
}
|
||||||
@ -1047,10 +1159,13 @@ void MainWindow::showSectionsContextMenu(const QPoint &pt)
|
|||||||
menu->addAction(ui->actionSectionsHorizontal);
|
menu->addAction(ui->actionSectionsHorizontal);
|
||||||
menu->addAction(ui->actionSectionsVertical);
|
menu->addAction(ui->actionSectionsVertical);
|
||||||
|
|
||||||
if (this->sectionsWidget->orientation() == 1) {
|
if (this->sectionsWidget->orientation() == 1)
|
||||||
|
{
|
||||||
ui->actionSectionsHorizontal->setChecked(true);
|
ui->actionSectionsHorizontal->setChecked(true);
|
||||||
ui->actionSectionsVertical->setChecked(false);
|
ui->actionSectionsVertical->setChecked(false);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->actionSectionsVertical->setChecked(true);
|
ui->actionSectionsVertical->setChecked(true);
|
||||||
ui->actionSectionsHorizontal->setChecked(false);
|
ui->actionSectionsHorizontal->setChecked(false);
|
||||||
}
|
}
|
||||||
@ -1074,13 +1189,15 @@ void MainWindow::on_actionForward_triggered()
|
|||||||
{
|
{
|
||||||
this->core->cmd("s+");
|
this->core->cmd("s+");
|
||||||
QString offset = this->core->cmd("s=").split(" > ").last().trimmed();
|
QString offset = this->core->cmd("s=").split(" > ").last().trimmed();
|
||||||
if (offset != "") {
|
if (offset != "")
|
||||||
|
{
|
||||||
this->add_debug_output(offset);
|
this->add_debug_output(offset);
|
||||||
this->seek(offset);
|
this->seek(offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::toggleResponsive(bool maybe) {
|
void MainWindow::toggleResponsive(bool maybe)
|
||||||
|
{
|
||||||
this->responsive = maybe;
|
this->responsive = maybe;
|
||||||
// Save options in settings
|
// Save options in settings
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
@ -1097,7 +1214,8 @@ void MainWindow::on_actionReset_settings_triggered()
|
|||||||
QMessageBox::StandardButton ret = QMessageBox::question(this, "Iaito",
|
QMessageBox::StandardButton ret = QMessageBox::question(this, "Iaito",
|
||||||
"Do you really want to clear all settings?",
|
"Do you really want to clear all settings?",
|
||||||
QMessageBox::Ok | QMessageBox::Cancel);
|
QMessageBox::Ok | QMessageBox::Cancel);
|
||||||
if (ret == QMessageBox::Ok) {
|
if (ret == QMessageBox::Ok)
|
||||||
|
{
|
||||||
// Save options in settings
|
// Save options in settings
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.clear();
|
settings.clear();
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
#include "newfiledialog.h"
|
#include "newfiledialog.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@ MdHighlighter::MdHighlighter(QTextDocument *parent)
|
|||||||
<< "\\*([^\\\\]+)\\*" << "\\_([^\\\\]+)\\_"
|
<< "\\*([^\\\\]+)\\*" << "\\_([^\\\\]+)\\_"
|
||||||
<< "\\_\\_([^\\\\]+)\\_\\_";
|
<< "\\_\\_([^\\\\]+)\\_\\_";
|
||||||
|
|
||||||
foreach (const QString &pattern, keywordPatterns) {
|
foreach (const QString &pattern, keywordPatterns)
|
||||||
|
{
|
||||||
rule.pattern = QRegExp(pattern);
|
rule.pattern = QRegExp(pattern);
|
||||||
rule.format = keywordFormat;
|
rule.format = keywordFormat;
|
||||||
highlightingRules.append(rule);
|
highlightingRules.append(rule);
|
||||||
@ -30,10 +31,12 @@ MdHighlighter::MdHighlighter(QTextDocument *parent)
|
|||||||
|
|
||||||
void MdHighlighter::highlightBlock(const QString &text)
|
void MdHighlighter::highlightBlock(const QString &text)
|
||||||
{
|
{
|
||||||
foreach (const HighlightingRule &rule, highlightingRules) {
|
foreach (const HighlightingRule &rule, highlightingRules)
|
||||||
|
{
|
||||||
QRegExp expression(rule.pattern);
|
QRegExp expression(rule.pattern);
|
||||||
int index = expression.indexIn(text);
|
int index = expression.indexIn(text);
|
||||||
while (index >= 0) {
|
while (index >= 0)
|
||||||
|
{
|
||||||
int length = expression.matchedLength();
|
int length = expression.matchedLength();
|
||||||
setFormat(index, length, rule.format);
|
setFormat(index, length, rule.format);
|
||||||
index = expression.indexIn(text, index + length);
|
index = expression.indexIn(text, index + length);
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
const int NewFileDialog::MaxRecentFiles;
|
const int NewFileDialog::MaxRecentFiles;
|
||||||
|
|
||||||
static QColor getColorFor(QString str, int pos) {
|
static QColor getColorFor(QString str, int pos)
|
||||||
|
{
|
||||||
QNOTUSED(str);
|
QNOTUSED(str);
|
||||||
|
|
||||||
QList<QColor> Colors;
|
QList<QColor> Colors;
|
||||||
@ -25,7 +26,8 @@ static QColor getColorFor(QString str, int pos) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QIcon getIconFor(QString str, int pos) {
|
static QIcon getIconFor(QString str, int pos)
|
||||||
|
{
|
||||||
// Add to the icon list
|
// Add to the icon list
|
||||||
int w = 64;
|
int w = 64;
|
||||||
int h = 64;
|
int h = 64;
|
||||||
@ -60,7 +62,8 @@ NewFileDialog::NewFileDialog(QWidget *parent) :
|
|||||||
|
|
||||||
int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
|
int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
|
||||||
|
|
||||||
for (int i = 0; i < numRecentFiles; ++i) {
|
for (int i = 0; i < numRecentFiles; ++i)
|
||||||
|
{
|
||||||
// Get stored files
|
// Get stored files
|
||||||
//QString text = tr("&%1 %2").arg(i + 1).arg(strippedName(files[i]));
|
//QString text = tr("&%1 %2").arg(i + 1).arg(strippedName(files[i]));
|
||||||
|
|
||||||
@ -93,11 +96,14 @@ void NewFileDialog::on_loadFileButton_clicked()
|
|||||||
// Check that there is a file selected
|
// Check that there is a file selected
|
||||||
QString fname = ui->newFileEdit->text();
|
QString fname = ui->newFileEdit->text();
|
||||||
QFileInfo checkfile(fname);
|
QFileInfo checkfile(fname);
|
||||||
if (!checkfile.exists() || !checkfile.isFile()) {
|
if (!checkfile.exists() || !checkfile.isFile())
|
||||||
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setText("Select a new program or a previous one\nbefore continue");
|
msgBox.setText("Select a new program or a previous one\nbefore continue");
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Add file to recent file list
|
// Add file to recent file list
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
QStringList files = settings.value("recentFileList").toStringList();
|
QStringList files = settings.value("recentFileList").toStringList();
|
||||||
@ -125,7 +131,8 @@ void NewFileDialog::on_newFileButton_clicked()
|
|||||||
QString fileName;
|
QString fileName;
|
||||||
fileName = dialog.getOpenFileName(this, "Select file");
|
fileName = dialog.getOpenFileName(this, "Select file");
|
||||||
|
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty())
|
||||||
|
{
|
||||||
ui->newFileEdit->setText(fileName);
|
ui->newFileEdit->setText(fileName);
|
||||||
ui->loadFileButton->setFocus();
|
ui->loadFileButton->setFocus();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class NewFileDialog;
|
class NewFileDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@ OptionsDialog::OptionsDialog(QString filename, QWidget *parent):
|
|||||||
|
|
||||||
// Fill the plugins combo
|
// Fill the plugins combo
|
||||||
QStringList plugins;
|
QStringList plugins;
|
||||||
for (auto i: this->core->getList ("asm", "plugins")) {
|
for (auto i : this->core->getList("asm", "plugins"))
|
||||||
|
{
|
||||||
this->asm_plugins.append(i);
|
this->asm_plugins.append(i);
|
||||||
plugins.append(i);
|
plugins.append(i);
|
||||||
}
|
}
|
||||||
@ -51,7 +52,8 @@ OptionsDialog::~OptionsDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsDialog::setFilename(QString fn, QString shortfn) {
|
void OptionsDialog::setFilename(QString fn, QString shortfn)
|
||||||
|
{
|
||||||
this->filename = fn;
|
this->filename = fn;
|
||||||
this->shortfn = shortfn;
|
this->shortfn = shortfn;
|
||||||
//qDebug() << QFileInfo(fn).fileName();
|
//qDebug() << QFileInfo(fn).fileName();
|
||||||
@ -94,7 +96,8 @@ void OptionsDialog::on_okButton_clicked()
|
|||||||
ut64 mapaddr = 0LL;
|
ut64 mapaddr = 0LL;
|
||||||
int bits = 0;
|
int bits = 0;
|
||||||
QString sel_bits = ui->bitsComboBox->currentText();
|
QString sel_bits = ui->bitsComboBox->currentText();
|
||||||
if (sel_bits != "Auto") {
|
if (sel_bits != "Auto")
|
||||||
|
{
|
||||||
bits = sel_bits.toInt();
|
bits = sel_bits.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,51 +105,69 @@ void OptionsDialog::on_okButton_clicked()
|
|||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
// Show asm bytes
|
// Show asm bytes
|
||||||
if (ui->bytesCheckBox->isChecked()) {
|
if (ui->bytesCheckBox->isChecked())
|
||||||
|
{
|
||||||
this->w->core->config("asm.bytes", "true");
|
this->w->core->config("asm.bytes", "true");
|
||||||
this->w->core->config("asm.cmtcol", "100");
|
this->w->core->config("asm.cmtcol", "100");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->w->core->config("asm.bytes", "false");
|
this->w->core->config("asm.bytes", "false");
|
||||||
this->w->core->config("asm.cmtcol", "70");
|
this->w->core->config("asm.cmtcol", "70");
|
||||||
}
|
}
|
||||||
settings.setValue("bytes", ui->bytesCheckBox->isChecked());
|
settings.setValue("bytes", ui->bytesCheckBox->isChecked());
|
||||||
|
|
||||||
// Show AT&T syntax
|
// Show AT&T syntax
|
||||||
if (ui->attCheckBox->isChecked()) {
|
if (ui->attCheckBox->isChecked())
|
||||||
|
{
|
||||||
this->w->core->config("asm.syntax", "att");
|
this->w->core->config("asm.syntax", "att");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->w->core->config("asm.syntax", "intel");
|
this->w->core->config("asm.syntax", "intel");
|
||||||
}
|
}
|
||||||
settings.setValue("syntax", ui->attCheckBox->isChecked());
|
settings.setValue("syntax", ui->attCheckBox->isChecked());
|
||||||
|
|
||||||
// Show opcode description
|
// Show opcode description
|
||||||
if (ui->descriptionCheckBox->isChecked()) {
|
if (ui->descriptionCheckBox->isChecked())
|
||||||
|
{
|
||||||
this->w->core->config("asm.describe", "true");
|
this->w->core->config("asm.describe", "true");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->w->core->config("asm.describe", "false");
|
this->w->core->config("asm.describe", "false");
|
||||||
}
|
}
|
||||||
settings.setValue("describe", ui->descriptionCheckBox->isChecked());
|
settings.setValue("describe", ui->descriptionCheckBox->isChecked());
|
||||||
|
|
||||||
// Show stack pointer
|
// Show stack pointer
|
||||||
if (ui->stackCheckBox->isChecked()) {
|
if (ui->stackCheckBox->isChecked())
|
||||||
|
{
|
||||||
this->w->core->config("asm.stackptr", "true");
|
this->w->core->config("asm.stackptr", "true");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->w->core->config("asm.stackptr", "false");
|
this->w->core->config("asm.stackptr", "false");
|
||||||
}
|
}
|
||||||
settings.setValue("stackptr", ui->stackCheckBox->isChecked());
|
settings.setValue("stackptr", ui->stackCheckBox->isChecked());
|
||||||
|
|
||||||
// Show uppercase dasm
|
// Show uppercase dasm
|
||||||
if (ui->ucaseCheckBox->isChecked()) {
|
if (ui->ucaseCheckBox->isChecked())
|
||||||
|
{
|
||||||
this->w->core->config("asm.ucase", "true");
|
this->w->core->config("asm.ucase", "true");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->w->core->config("asm.ucase", "false");
|
this->w->core->config("asm.ucase", "false");
|
||||||
}
|
}
|
||||||
settings.setValue("ucase", ui->ucaseCheckBox->isChecked());
|
settings.setValue("ucase", ui->ucaseCheckBox->isChecked());
|
||||||
|
|
||||||
// Show spaces in dasm
|
// Show spaces in dasm
|
||||||
if (ui->spacyCheckBox->isChecked()) {
|
if (ui->spacyCheckBox->isChecked())
|
||||||
|
{
|
||||||
this->w->core->config("asm.spacy", "true");
|
this->w->core->config("asm.spacy", "true");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->w->core->config("asm.spacy", "false");
|
this->w->core->config("asm.spacy", "false");
|
||||||
}
|
}
|
||||||
settings.setValue("spacy", ui->spacyCheckBox->isChecked());
|
settings.setValue("spacy", ui->spacyCheckBox->isChecked());
|
||||||
@ -154,14 +175,18 @@ void OptionsDialog::on_okButton_clicked()
|
|||||||
bool rw = false;
|
bool rw = false;
|
||||||
bool load_bininfo = ui->binCheckBox->isChecked();
|
bool load_bininfo = ui->binCheckBox->isChecked();
|
||||||
|
|
||||||
if (load_bininfo) {
|
if (load_bininfo)
|
||||||
if (!va) {
|
{
|
||||||
|
if (!va)
|
||||||
|
{
|
||||||
va = 2;
|
va = 2;
|
||||||
loadaddr = UT64_MAX;
|
loadaddr = UT64_MAX;
|
||||||
r_config_set_i(this->core->core()->config, "bin.laddr", loadaddr);
|
r_config_set_i(this->core->core()->config, "bin.laddr", loadaddr);
|
||||||
mapaddr = 0;
|
mapaddr = 0;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
va = false;
|
va = false;
|
||||||
loadaddr = mapaddr = 0;
|
loadaddr = mapaddr = 0;
|
||||||
}
|
}
|
||||||
@ -181,7 +206,8 @@ void OptionsDialog::on_okButton_clicked()
|
|||||||
// connect signal/slot
|
// connect signal/slot
|
||||||
|
|
||||||
int level = 0;
|
int level = 0;
|
||||||
if (anal_level == true) {
|
if (anal_level == true)
|
||||||
|
{
|
||||||
level = ui->analSlider->value();
|
level = ui->analSlider->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,9 +227,12 @@ void OptionsDialog::anal_finished()
|
|||||||
ui->statusLabel->setText("Loading interface");
|
ui->statusLabel->setText("Loading interface");
|
||||||
this->w->add_output(" > Analysis finished");
|
this->w->add_output(" > Analysis finished");
|
||||||
QString initial_seek = ui->entry_initialSeek->text();
|
QString initial_seek = ui->entry_initialSeek->text();
|
||||||
if (initial_seek.length()>0) {
|
if (initial_seek.length() > 0)
|
||||||
|
{
|
||||||
this->w->core->seek(initial_seek);
|
this->w->core->seek(initial_seek);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->w->core->seek("entry0");
|
this->w->core->seek("entry0");
|
||||||
}
|
}
|
||||||
this->w->add_output(" > Populating UI");
|
this->w->add_output(" > Populating UI");
|
||||||
@ -215,7 +244,8 @@ void OptionsDialog::anal_finished()
|
|||||||
// Restore project notes
|
// Restore project notes
|
||||||
QString notes = this->core->cmd("Pn");
|
QString notes = this->core->cmd("Pn");
|
||||||
//qDebug() << "Notes:" << notes;
|
//qDebug() << "Notes:" << notes;
|
||||||
if (notes != "") {
|
if (notes != "")
|
||||||
|
{
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
ba.append(notes);
|
ba.append(notes);
|
||||||
this->w->notepadDock->notesTextEdit->setPlainText(QByteArray::fromBase64(ba));
|
this->w->notepadDock->notesTextEdit->setPlainText(QByteArray::fromBase64(ba));
|
||||||
@ -250,9 +280,12 @@ void OptionsDialog::on_cancelButton_clicked()
|
|||||||
void OptionsDialog::on_analSlider_valueChanged(int value)
|
void OptionsDialog::on_analSlider_valueChanged(int value)
|
||||||
{
|
{
|
||||||
ui->analLevel->setText(QString::number(value));
|
ui->analLevel->setText(QString::number(value));
|
||||||
if (value == 0) {
|
if (value == 0)
|
||||||
|
{
|
||||||
ui->analCheckBox->setChecked(false);
|
ui->analCheckBox->setChecked(false);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->analCheckBox->setChecked(true);
|
ui->analCheckBox->setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -263,7 +296,9 @@ void OptionsDialog::on_AdvOptButton_clicked()
|
|||||||
{
|
{
|
||||||
ui->hideFrame->setVisible(true);
|
ui->hideFrame->setVisible(true);
|
||||||
ui->AdvOptButton->setArrowType(Qt::DownArrow);
|
ui->AdvOptButton->setArrowType(Qt::DownArrow);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->hideFrame->setVisible(false);
|
ui->hideFrame->setVisible(false);
|
||||||
ui->AdvOptButton->setArrowType(Qt::RightArrow);
|
ui->AdvOptButton->setArrowType(Qt::RightArrow);
|
||||||
|
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class OptionsDialog;
|
class OptionsDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
403
src/qrcore.cpp
403
src/qrcore.cpp
@ -61,13 +61,15 @@ QRCore::QRCore(QObject *parent) :
|
|||||||
this->db = sdb_new(NULL, NULL, 0); // WTF NOES
|
this->db = sdb_new(NULL, NULL, 0); // WTF NOES
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> QRCore::getFunctionXrefs(ut64 addr) {
|
QList<QString> QRCore::getFunctionXrefs(ut64 addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<QString> ret = QList<QString>();
|
QList<QString> ret = QList<QString>();
|
||||||
RList *list = r_anal_xrefs_get(core_->anal, addr);
|
RList *list = r_anal_xrefs_get(core_->anal, addr);
|
||||||
RAnalRef *ref;
|
RAnalRef *ref;
|
||||||
RListIter *it;
|
RListIter *it;
|
||||||
QRListForeach (list, it, RAnalRef, ref) {
|
QRListForeach(list, it, RAnalRef, ref)
|
||||||
|
{
|
||||||
ret << QString("%1,0x%2,0x%3").arg(
|
ret << QString("%1,0x%2,0x%3").arg(
|
||||||
QString(ref->type),
|
QString(ref->type),
|
||||||
QString::number(ref->addr, 16),
|
QString::number(ref->addr, 16),
|
||||||
@ -76,19 +78,22 @@ QList<QString> QRCore::getFunctionXrefs(ut64 addr) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> QRCore::getFunctionRefs(ut64 addr, char type) {
|
QList<QString> QRCore::getFunctionRefs(ut64 addr, char type)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<QString> ret = QList<QString>();
|
QList<QString> ret = QList<QString>();
|
||||||
//RAnalFunction *fcn = r_anal_get_fcn_at(core_->anal, addr, addr);
|
//RAnalFunction *fcn = r_anal_get_fcn_at(core_->anal, addr, addr);
|
||||||
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
||||||
if (!fcn) {
|
if (!fcn)
|
||||||
|
{
|
||||||
eprintf("qcore->getFunctionRefs: No function found\n");
|
eprintf("qcore->getFunctionRefs: No function found\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
//eprintf(fcn->name);
|
//eprintf(fcn->name);
|
||||||
RAnalRef *ref;
|
RAnalRef *ref;
|
||||||
RListIter *it;
|
RListIter *it;
|
||||||
QRListForeach (fcn->refs, it, RAnalRef, ref) {
|
QRListForeach(fcn->refs, it, RAnalRef, ref)
|
||||||
|
{
|
||||||
if (type == ref->type || type == 0)
|
if (type == ref->type || type == 0)
|
||||||
ret << QString("%1,0x%2,0x%3").arg(
|
ret << QString("%1,0x%2,0x%3").arg(
|
||||||
QString(ref->type),
|
QString(ref->type),
|
||||||
@ -98,42 +103,53 @@ QList<QString> QRCore::getFunctionRefs(ut64 addr, char type) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QRCore::getCycloComplex(ut64 addr) {
|
int QRCore::getCycloComplex(ut64 addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QString ret = "";
|
QString ret = "";
|
||||||
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
||||||
if (fcn) {
|
if (fcn)
|
||||||
|
{
|
||||||
ret = cmd("afcc @ " + QString(fcn->name));
|
ret = cmd("afcc @ " + QString(fcn->name));
|
||||||
return ret.toInt();
|
return ret.toInt();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
eprintf("qcore->getCycloComplex: no fcn found");
|
eprintf("qcore->getCycloComplex: no fcn found");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int QRCore::getFcnSize(ut64 addr) {
|
int QRCore::getFcnSize(ut64 addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QString ret = "";
|
QString ret = "";
|
||||||
QString tmp_ret = "";
|
QString tmp_ret = "";
|
||||||
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
||||||
if (fcn) {
|
if (fcn)
|
||||||
|
{
|
||||||
tmp_ret = cmd("afi~size[1] " + QString(fcn->name));
|
tmp_ret = cmd("afi~size[1] " + QString(fcn->name));
|
||||||
ret = tmp_ret.split("\n")[0];
|
ret = tmp_ret.split("\n")[0];
|
||||||
return ret.toInt() / 10;
|
return ret.toInt() / 10;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
eprintf("qcore->getFcnSize: no fcn found");
|
eprintf("qcore->getFcnSize: no fcn found");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> QRCore::sdbList(QString path) {
|
QList<QString> QRCore::sdbList(QString path)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<QString> list = QList<QString>();
|
QList<QString> list = QList<QString>();
|
||||||
Sdb *root = sdb_ns_path(core_->sdb, path.toUtf8().constData(), 0);
|
Sdb *root = sdb_ns_path(core_->sdb, path.toUtf8().constData(), 0);
|
||||||
if (root) {
|
if (root)
|
||||||
|
{
|
||||||
void *vsi;
|
void *vsi;
|
||||||
ls_iter_t *iter;
|
ls_iter_t *iter;
|
||||||
ls_foreach(root->ns, iter, vsi) {
|
ls_foreach(root->ns, iter, vsi)
|
||||||
|
{
|
||||||
SdbNs *nsi = (SdbNs *)vsi;
|
SdbNs *nsi = (SdbNs *)vsi;
|
||||||
list << nsi->name;
|
list << nsi->name;
|
||||||
}
|
}
|
||||||
@ -141,15 +157,18 @@ QList<QString> QRCore::sdbList(QString path) {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> QRCore::sdbListKeys(QString path) {
|
QList<QString> QRCore::sdbListKeys(QString path)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<QString> list = QList<QString>();
|
QList<QString> list = QList<QString>();
|
||||||
Sdb *root = sdb_ns_path(core_->sdb, path.toUtf8().constData(), 0);
|
Sdb *root = sdb_ns_path(core_->sdb, path.toUtf8().constData(), 0);
|
||||||
if (root) {
|
if (root)
|
||||||
|
{
|
||||||
void *vsi;
|
void *vsi;
|
||||||
ls_iter_t *iter;
|
ls_iter_t *iter;
|
||||||
SdbList *l = sdb_foreach_list(root, false);
|
SdbList *l = sdb_foreach_list(root, false);
|
||||||
ls_foreach(l, iter, vsi) {
|
ls_foreach(l, iter, vsi)
|
||||||
|
{
|
||||||
SdbKv *nsi = (SdbKv *)vsi;
|
SdbKv *nsi = (SdbKv *)vsi;
|
||||||
list << nsi->key;
|
list << nsi->key;
|
||||||
}
|
}
|
||||||
@ -157,10 +176,12 @@ QList<QString> QRCore::sdbListKeys(QString path) {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::sdbGet(QString path, QString key) {
|
QString QRCore::sdbGet(QString path, QString key)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
Sdb *db = sdb_ns_path(core_->sdb, path.toUtf8().constData(), 0);
|
Sdb *db = sdb_ns_path(core_->sdb, path.toUtf8().constData(), 0);
|
||||||
if (db) {
|
if (db)
|
||||||
|
{
|
||||||
const char *val = sdb_const_get(db, key.toUtf8().constData(), 0);
|
const char *val = sdb_const_get(db, key.toUtf8().constData(), 0);
|
||||||
if (val && *val)
|
if (val && *val)
|
||||||
return val;
|
return val;
|
||||||
@ -168,19 +189,22 @@ QString QRCore::sdbGet(QString path, QString key) {
|
|||||||
return QString("");
|
return QString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QRCore::sdbSet(QString path, QString key, QString val) {
|
bool QRCore::sdbSet(QString path, QString key, QString val)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
Sdb *db = sdb_ns_path(core_->sdb, path.toUtf8().constData(), 1);
|
Sdb *db = sdb_ns_path(core_->sdb, path.toUtf8().constData(), 1);
|
||||||
if (!db) return false;
|
if (!db) return false;
|
||||||
return sdb_set(db, key.toUtf8().constData(), val.toUtf8().constData(), 0);
|
return sdb_set(db, key.toUtf8().constData(), val.toUtf8().constData(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRCore::~QRCore() {
|
QRCore::~QRCore()
|
||||||
|
{
|
||||||
r_core_free(this->core_);
|
r_core_free(this->core_);
|
||||||
r_cons_free();
|
r_cons_free();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::cmd(const QString &str) {
|
QString QRCore::cmd(const QString &str)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QByteArray cmd = str.toUtf8();
|
QByteArray cmd = str.toUtf8();
|
||||||
//r_cons_flush();
|
//r_cons_flush();
|
||||||
@ -191,7 +215,8 @@ QString QRCore::cmd(const QString &str) {
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QRCore::loadFile(QString path, uint64_t loadaddr=0LL, uint64_t mapaddr=0LL, bool rw=false, int va=0, int bits = 0, int idx, bool loadbin) {
|
bool QRCore::loadFile(QString path, uint64_t loadaddr = 0LL, uint64_t mapaddr = 0LL, bool rw = false, int va = 0, int bits = 0, int idx, bool loadbin)
|
||||||
|
{
|
||||||
QNOTUSED(loadaddr);
|
QNOTUSED(loadaddr);
|
||||||
QNOTUSED(idx);
|
QNOTUSED(idx);
|
||||||
|
|
||||||
@ -204,49 +229,70 @@ bool QRCore::loadFile(QString path, uint64_t loadaddr=0LL, uint64_t mapaddr=0LL,
|
|||||||
// mapaddr = 0LL;
|
// mapaddr = 0LL;
|
||||||
printf("FILE OPEN (%s)\n", path.toUtf8().constData());
|
printf("FILE OPEN (%s)\n", path.toUtf8().constData());
|
||||||
f = r_core_file_open(core_, path.toUtf8().constData(), rw ? (R_IO_READ | R_IO_WRITE) : R_IO_READ, mapaddr);
|
f = r_core_file_open(core_, path.toUtf8().constData(), rw ? (R_IO_READ | R_IO_WRITE) : R_IO_READ, mapaddr);
|
||||||
if (!f) {
|
if (!f)
|
||||||
|
{
|
||||||
eprintf("r_core_file_open failed\n");
|
eprintf("r_core_file_open failed\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadbin) {
|
if (loadbin)
|
||||||
if (va==1) {
|
{
|
||||||
if (r_core_bin_load (core_, path.toUtf8().constData(), UT64_MAX)) {
|
if (va == 1)
|
||||||
|
{
|
||||||
|
if (r_core_bin_load(core_, path.toUtf8().constData(), UT64_MAX))
|
||||||
|
{
|
||||||
RBinObject *obj = r_bin_get_object(core_->bin);
|
RBinObject *obj = r_bin_get_object(core_->bin);
|
||||||
if (obj) {
|
if (obj)
|
||||||
|
{
|
||||||
eprintf("BITS %d\n", obj->info->bits);
|
eprintf("BITS %d\n", obj->info->bits);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
eprintf("CANNOT GET RBIN INFO\n");
|
eprintf("CANNOT GET RBIN INFO\n");
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (r_core_bin_load (core_, path.toUtf8().constData(), UT64_MAX)) {
|
else
|
||||||
|
{
|
||||||
|
if (r_core_bin_load(core_, path.toUtf8().constData(), UT64_MAX))
|
||||||
|
{
|
||||||
RBinObject *obj = r_bin_get_object(core_->bin);
|
RBinObject *obj = r_bin_get_object(core_->bin);
|
||||||
if (obj) {
|
if (obj)
|
||||||
|
{
|
||||||
eprintf("BITS %d\n", obj->info->bits);
|
eprintf("BITS %d\n", obj->info->bits);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
eprintf("Bin load failed\n");
|
eprintf("Bin load failed\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
eprintf("CANNOT GET RBIN INFO\n");
|
eprintf("CANNOT GET RBIN INFO\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bits != 0) {
|
if (bits != 0)
|
||||||
|
{
|
||||||
r_config_set_i(core_->config, "asm.bits", bits);
|
r_config_set_i(core_->config, "asm.bits", bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_MULTIPLE_RBIN_FILES_INSIDE_SELECT_WHICH_ONE
|
#if HAVE_MULTIPLE_RBIN_FILES_INSIDE_SELECT_WHICH_ONE
|
||||||
if (!r_core_file_open (core, path.toUtf8(), R_IO_READ|rw?R_IO_WRITE:0, mapaddr)) {
|
if (!r_core_file_open(core, path.toUtf8(), R_IO_READ | rw ? R_IO_WRITE : 0, mapaddr))
|
||||||
|
{
|
||||||
eprintf("Cannot open file\n");
|
eprintf("Cannot open file\n");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// load RBin information
|
// load RBin information
|
||||||
// XXX only for sub-bins
|
// XXX only for sub-bins
|
||||||
r_core_bin_load(core, path.toUtf8(), loadaddr);
|
r_core_bin_load(core, path.toUtf8(), loadaddr);
|
||||||
r_bin_select_idx(core_->bin, NULL, idx);
|
r_bin_select_idx(core_->bin, NULL, idx);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Not loading RBin info coz va = false
|
// Not loading RBin info coz va = false
|
||||||
}
|
}
|
||||||
r_core_hash_load(core_, path.toUtf8().constData());
|
r_core_hash_load(core_, path.toUtf8().constData());
|
||||||
@ -254,7 +300,8 @@ bool QRCore::loadFile(QString path, uint64_t loadaddr=0LL, uint64_t mapaddr=0LL,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::analyze(int level) {
|
void QRCore::analyze(int level)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
/*
|
/*
|
||||||
* Levels
|
* Levels
|
||||||
@ -264,38 +311,51 @@ void QRCore::analyze(int level) {
|
|||||||
* Nivel 4: aaaa
|
* Nivel 4: aaaa
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (level == 1) {
|
if (level == 1)
|
||||||
|
{
|
||||||
r_core_cmd0(core_, "afr@entry0;afr@main");
|
r_core_cmd0(core_, "afr@entry0;afr@main");
|
||||||
} else if (level == 2) {
|
}
|
||||||
|
else if (level == 2)
|
||||||
|
{
|
||||||
r_core_cmd0(core_, "aa");
|
r_core_cmd0(core_, "aa");
|
||||||
} else if (level == 3) {
|
}
|
||||||
|
else if (level == 3)
|
||||||
|
{
|
||||||
r_core_cmd0(core_, "aaa");
|
r_core_cmd0(core_, "aaa");
|
||||||
} else if (level == 4) {
|
}
|
||||||
|
else if (level == 4)
|
||||||
|
{
|
||||||
r_core_cmd0(core_, "aaaa");
|
r_core_cmd0(core_, "aaaa");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::renameFunction(QString prev_name, QString new_name) {
|
void QRCore::renameFunction(QString prev_name, QString new_name)
|
||||||
|
{
|
||||||
cmd("afn " + new_name + " " + prev_name);
|
cmd("afn " + new_name + " " + prev_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::setComment(QString addr, QString cmt) {
|
void QRCore::setComment(QString addr, QString cmt)
|
||||||
|
{
|
||||||
//r_meta_add (core->anal, 'C', addr, 1, cmt.toUtf8());
|
//r_meta_add (core->anal, 'C', addr, 1, cmt.toUtf8());
|
||||||
cmd("CC " + cmt + " @ " + addr);
|
cmd("CC " + cmt + " @ " + addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::delComment(ut64 addr) {
|
void QRCore::delComment(ut64 addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
r_meta_del(core_->anal, 'C', addr, 1, NULL);
|
r_meta_del(core_->anal, 'C', addr, 1, NULL);
|
||||||
//cmd (QString("CC-@")+addr);
|
//cmd (QString("CC-@")+addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QList<QString>> QRCore::getComments() {
|
QList<QList<QString>> QRCore::getComments()
|
||||||
|
{
|
||||||
QList<QList<QString>> ret;
|
QList<QList<QString>> ret;
|
||||||
QString comments = cmd("CC~CCu");
|
QString comments = cmd("CC~CCu");
|
||||||
for (QString line: comments.split ("\n")) {
|
for (QString line : comments.split("\n"))
|
||||||
|
{
|
||||||
QStringList fields = line.split("CCu");
|
QStringList fields = line.split("CCu");
|
||||||
if (fields.length() == 2) {
|
if (fields.length() == 2)
|
||||||
|
{
|
||||||
QList<QString> tmp = QList<QString>();
|
QList<QString> tmp = QList<QString>();
|
||||||
tmp << fields[1].split("\"")[1].trimmed();
|
tmp << fields[1].split("\"")[1].trimmed();
|
||||||
tmp << fields[0].trimmed();
|
tmp << fields[0].trimmed();
|
||||||
@ -305,20 +365,26 @@ QList<QList<QString>> QRCore::getComments() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QList<QList<QString>>> QRCore::getNestedComments() {
|
QMap<QString, QList<QList<QString>>> QRCore::getNestedComments()
|
||||||
|
{
|
||||||
QMap<QString, QList<QList<QString>>> ret;
|
QMap<QString, QList<QList<QString>>> ret;
|
||||||
QString comments = cmd("CC~CCu");
|
QString comments = cmd("CC~CCu");
|
||||||
|
|
||||||
for (QString line: comments.split ("\n")) {
|
for (QString line : comments.split("\n"))
|
||||||
|
{
|
||||||
QStringList fields = line.split("CCu");
|
QStringList fields = line.split("CCu");
|
||||||
if (fields.length() == 2) {
|
if (fields.length() == 2)
|
||||||
|
{
|
||||||
QList<QString> tmp = QList<QString>();
|
QList<QString> tmp = QList<QString>();
|
||||||
tmp << fields[1].split("\"")[1].trimmed();
|
tmp << fields[1].split("\"")[1].trimmed();
|
||||||
tmp << fields[0].trimmed();
|
tmp << fields[0].trimmed();
|
||||||
QString fcn_name = this->cmdFunctionAt(fields[0].trimmed());
|
QString fcn_name = this->cmdFunctionAt(fields[0].trimmed());
|
||||||
if (ret.contains(fcn_name)) {
|
if (ret.contains(fcn_name))
|
||||||
|
{
|
||||||
ret[fcn_name].append(tmp);
|
ret[fcn_name].append(tmp);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ret[fcn_name].append(tmp);
|
ret[fcn_name].append(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,23 +392,27 @@ QMap<QString, QList<QList<QString>>> QRCore::getNestedComments() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::seek(QString addr) {
|
void QRCore::seek(QString addr)
|
||||||
|
{
|
||||||
if (addr.length() > 0)
|
if (addr.length() > 0)
|
||||||
seek(this->math(addr.toUtf8().constData()));
|
seek(this->math(addr.toUtf8().constData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::seek(ut64 addr) {
|
void QRCore::seek(ut64 addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
r_core_seek(this->core_, addr, true);
|
r_core_seek(this->core_, addr, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QRCore::tryFile(QString path, bool rw) {
|
bool QRCore::tryFile(QString path, bool rw)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RCoreFile *cf;
|
RCoreFile *cf;
|
||||||
int flags = R_IO_READ;
|
int flags = R_IO_READ;
|
||||||
if (rw) flags |= R_IO_WRITE;
|
if (rw) flags |= R_IO_WRITE;
|
||||||
cf = r_core_file_open(this->core_, path.toUtf8().constData(), flags, 0LL);
|
cf = r_core_file_open(this->core_, path.toUtf8().constData(), flags, 0LL);
|
||||||
if (!cf) {
|
if (!cf)
|
||||||
|
{
|
||||||
eprintf("QRCore::tryFile: Cannot open file?\n");
|
eprintf("QRCore::tryFile: Cannot open file?\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -358,118 +428,168 @@ bool QRCore::tryFile(QString path, bool rw) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> QRCore::getList(const QString & type, const QString & subtype) {
|
QList<QString> QRCore::getList(const QString &type, const QString &subtype)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RListIter *it;
|
RListIter *it;
|
||||||
QList<QString> ret = QList<QString>();
|
QList<QString> ret = QList<QString>();
|
||||||
|
|
||||||
if (type == "bin") {
|
if (type == "bin")
|
||||||
if (subtype == "sections") {
|
{
|
||||||
|
if (subtype == "sections")
|
||||||
|
{
|
||||||
QString text = cmd("S*~^S");
|
QString text = cmd("S*~^S");
|
||||||
for (QString i: text.split ("\n")) {
|
for (QString i : text.split("\n"))
|
||||||
|
{
|
||||||
ret << i.mid(2).replace(" ", ",");
|
ret << i.mid(2).replace(" ", ",");
|
||||||
}
|
}
|
||||||
} else if (subtype == "types") {
|
}
|
||||||
|
else if (subtype == "types")
|
||||||
|
{
|
||||||
ret << "raw";
|
ret << "raw";
|
||||||
auto ft = sdb_const_get(DB, "try.filetype", 0);
|
auto ft = sdb_const_get(DB, "try.filetype", 0);
|
||||||
if (ft && *ft)
|
if (ft && *ft)
|
||||||
ret << ft;
|
ret << ft;
|
||||||
} else if (subtype == "imports") {
|
}
|
||||||
|
else if (subtype == "imports")
|
||||||
|
{
|
||||||
|
|
||||||
QStringList lines = this->cmd("ii").split("\n");
|
QStringList lines = this->cmd("ii").split("\n");
|
||||||
foreach (QString line, lines) {
|
foreach (QString line, lines)
|
||||||
|
{
|
||||||
QStringList tmp = line.split(" ");
|
QStringList tmp = line.split(" ");
|
||||||
if (tmp.length() > 2) {
|
if (tmp.length() > 2)
|
||||||
|
{
|
||||||
QString final;
|
QString final;
|
||||||
foreach (QString field, tmp) {
|
foreach (QString field, tmp)
|
||||||
|
{
|
||||||
QString value = field.split("=")[1];
|
QString value = field.split("=")[1];
|
||||||
final.append(value + ",");
|
final.append(value + ",");
|
||||||
}
|
}
|
||||||
ret << final;
|
ret << final;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (subtype == "entrypoints") {
|
}
|
||||||
|
else if (subtype == "entrypoints")
|
||||||
|
{
|
||||||
if (math("entry0") != 0)
|
if (math("entry0") != 0)
|
||||||
ret << "entry0";
|
ret << "entry0";
|
||||||
} else if (subtype == "relocs") {
|
}
|
||||||
|
else if (subtype == "relocs")
|
||||||
|
{
|
||||||
RBinReloc *br;
|
RBinReloc *br;
|
||||||
if (core_ && core_->bin && core_->bin->cur && core_->bin->cur->o) {
|
if (core_ && core_->bin && core_->bin->cur && core_->bin->cur->o)
|
||||||
QRListForeach (core_->bin->cur->o->relocs, it, RBinReloc, br) {
|
{
|
||||||
if (br->import) {
|
QRListForeach(core_->bin->cur->o->relocs, it, RBinReloc, br)
|
||||||
|
{
|
||||||
|
if (br->import)
|
||||||
|
{
|
||||||
// TODO: we want the offset too!
|
// TODO: we want the offset too!
|
||||||
QString type = (br->additive ? "ADD_" : "SET_") + QString::number(br->type);
|
QString type = (br->additive ? "ADD_" : "SET_") + QString::number(br->type);
|
||||||
ret << QString("0x%1,%2,%3").arg(QString::number(br->vaddr, 16), type, br->import->name);
|
ret << QString("0x%1,%2,%3").arg(QString::number(br->vaddr, 16), type, br->import->name);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// TODO: we want the offset too!
|
// TODO: we want the offset too!
|
||||||
QString type = (br->additive ? "ADD_" : "SET_") + QString::number(br->type);
|
QString type = (br->additive ? "ADD_" : "SET_") + QString::number(br->type);
|
||||||
ret << QString("0x%1,%2,reloc_%3").arg(QString::number(br->vaddr, 16), type, QString::number(br->vaddr, 16));
|
ret << QString("0x%1,%2,reloc_%3").arg(QString::number(br->vaddr, 16), type, QString::number(br->vaddr, 16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (subtype == "symbols") {
|
}
|
||||||
|
else if (subtype == "symbols")
|
||||||
|
{
|
||||||
RBinSymbol *bs;
|
RBinSymbol *bs;
|
||||||
if (core_ && core_->bin && core_->bin->cur && core_->bin->cur->o) {
|
if (core_ && core_->bin && core_->bin->cur && core_->bin->cur->o)
|
||||||
QRListForeach (core_->bin->cur->o->symbols, it, RBinSymbol, bs) {
|
{
|
||||||
|
QRListForeach(core_->bin->cur->o->symbols, it, RBinSymbol, bs)
|
||||||
|
{
|
||||||
QString type = QString(bs->bind) + " " + QString(bs->type);
|
QString type = QString(bs->bind) + " " + QString(bs->type);
|
||||||
ret << QString("0x%1,%2,%3").arg(QString::number(bs->vaddr, 16), type, bs->name);
|
ret << QString("0x%1,%2,%3").arg(QString::number(bs->vaddr, 16), type, bs->name);
|
||||||
}
|
}
|
||||||
/* list entrypoints as symbols too */
|
/* list entrypoints as symbols too */
|
||||||
int n = 0;
|
int n = 0;
|
||||||
RBinAddr *entry;
|
RBinAddr *entry;
|
||||||
QRListForeach (core_->bin->cur->o->entries, it, RBinAddr, entry) {
|
QRListForeach(core_->bin->cur->o->entries, it, RBinAddr, entry)
|
||||||
|
{
|
||||||
ret << QString("0x%1,%2,%3%4").arg(QString::number(entry->vaddr, 16), "entry", "entry", QString::number(n++));
|
ret << QString("0x%1,%2,%3%4").arg(QString::number(entry->vaddr, 16), "entry", "entry", QString::number(n++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (subtype == "strings") {
|
}
|
||||||
|
else if (subtype == "strings")
|
||||||
|
{
|
||||||
RBinString *bs;
|
RBinString *bs;
|
||||||
if (core_ && core_->bin && core_->bin->cur && core_->bin->cur->o) {
|
if (core_ && core_->bin && core_->bin->cur && core_->bin->cur->o)
|
||||||
QRListForeach (core_->bin->cur->o->strings, it, RBinString, bs) {
|
{
|
||||||
|
QRListForeach(core_->bin->cur->o->strings, it, RBinString, bs)
|
||||||
|
{
|
||||||
ret << QString("0x%1,%2").arg(QString::number(bs->vaddr, 16), bs->string);
|
ret << QString("0x%1,%2").arg(QString::number(bs->vaddr, 16), bs->string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == "asm") {
|
}
|
||||||
if (subtype == "plugins") {
|
else if (type == "asm")
|
||||||
|
{
|
||||||
|
if (subtype == "plugins")
|
||||||
|
{
|
||||||
RAsmPlugin *ap;
|
RAsmPlugin *ap;
|
||||||
QRListForeach (core_->assembler->plugins, it, RAsmPlugin, ap) {
|
QRListForeach(core_->assembler->plugins, it, RAsmPlugin, ap)
|
||||||
|
{
|
||||||
ret << ap->name;
|
ret << ap->name;
|
||||||
}
|
}
|
||||||
} else if (subtype == "cpus") {
|
}
|
||||||
|
else if (subtype == "cpus")
|
||||||
|
{
|
||||||
QString funcs = cmd("e asm.cpu=?");
|
QString funcs = cmd("e asm.cpu=?");
|
||||||
QStringList lines = funcs.split("\n");
|
QStringList lines = funcs.split("\n");
|
||||||
for (auto cpu : lines) {
|
for (auto cpu : lines)
|
||||||
|
{
|
||||||
ret << cpu;
|
ret << cpu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == "anal") {
|
}
|
||||||
if (subtype == "plugins") {
|
else if (type == "anal")
|
||||||
|
{
|
||||||
|
if (subtype == "plugins")
|
||||||
|
{
|
||||||
RAnalPlugin *ap;
|
RAnalPlugin *ap;
|
||||||
QRListForeach (core_->anal->plugins, it, RAnalPlugin, ap) {
|
QRListForeach(core_->anal->plugins, it, RAnalPlugin, ap)
|
||||||
|
{
|
||||||
ret << ap->name;
|
ret << ap->name;
|
||||||
}
|
}
|
||||||
} else if (subtype == "functions") {
|
}
|
||||||
|
else if (subtype == "functions")
|
||||||
|
{
|
||||||
QString funcs = cmd("afl");
|
QString funcs = cmd("afl");
|
||||||
QStringList lines = funcs.split("\n");
|
QStringList lines = funcs.split("\n");
|
||||||
for (auto i : lines) {
|
for (auto i : lines)
|
||||||
if (i != "") {
|
{
|
||||||
|
if (i != "")
|
||||||
|
{
|
||||||
ret << i.replace(" ", ",").replace(",,", ",").replace(",,", ",").replace(",,", ",");
|
ret << i.replace(" ", ",").replace(",,", ",").replace(",,", ",").replace(",,", ",");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == "flagspaces") {
|
}
|
||||||
|
else if (type == "flagspaces")
|
||||||
|
{
|
||||||
QStringList lines = cmd("fs*").split("\n");
|
QStringList lines = cmd("fs*").split("\n");
|
||||||
for (auto i : lines) {
|
for (auto i : lines)
|
||||||
|
{
|
||||||
QStringList a = i.replace("*", "").split(" ");
|
QStringList a = i.replace("*", "").split(" ");
|
||||||
if (a.length() > 1)
|
if (a.length() > 1)
|
||||||
ret << a[1];
|
ret << a[1];
|
||||||
}
|
}
|
||||||
} else if (type == "flags") {
|
}
|
||||||
|
else if (type == "flags")
|
||||||
|
{
|
||||||
if (subtype != NULL && subtype != "")
|
if (subtype != NULL && subtype != "")
|
||||||
cmd("fs " + subtype);
|
cmd("fs " + subtype);
|
||||||
else cmd("fs *");
|
else cmd("fs *");
|
||||||
QString flags = cmd("f*");
|
QString flags = cmd("f*");
|
||||||
QStringList lines = flags.split("\n");
|
QStringList lines = flags.split("\n");
|
||||||
for (auto i : lines) {
|
for (auto i : lines)
|
||||||
|
{
|
||||||
if (i[0] != 0 && i[1] == 's') continue; // skip 'fs ..'
|
if (i[0] != 0 && i[1] == 's') continue; // skip 'fs ..'
|
||||||
ret << i.mid(2).replace(" ", ",");
|
ret << i.mid(2).replace(" ", ",");
|
||||||
}
|
}
|
||||||
@ -477,12 +597,14 @@ QList<QString> QRCore::getList(const QString & type, const QString & subtype) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut64 QRCore::math(const QString &expr) {
|
ut64 QRCore::math(const QString &expr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
return r_num_math(this->core_ ? this->core_->num : NULL, expr.toUtf8().constData());
|
return r_num_math(this->core_ ? this->core_->num : NULL, expr.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
int QRCore::fcnCyclomaticComplexity(ut64 addr) {
|
int QRCore::fcnCyclomaticComplexity(ut64 addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RAnalFunction *fcn = r_anal_get_fcn_at(core_->anal, addr, addr);
|
RAnalFunction *fcn = r_anal_get_fcn_at(core_->anal, addr, addr);
|
||||||
if (fcn)
|
if (fcn)
|
||||||
@ -490,24 +612,29 @@ int QRCore::fcnCyclomaticComplexity(ut64 addr) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QRCore::fcnBasicBlockCount(ut64 addr) {
|
int QRCore::fcnBasicBlockCount(ut64 addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
//RAnalFunction *fcn = r_anal_get_fcn_at (core_->anal, addr, addr);
|
//RAnalFunction *fcn = r_anal_get_fcn_at (core_->anal, addr, addr);
|
||||||
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0);
|
||||||
if (fcn) {
|
if (fcn)
|
||||||
|
{
|
||||||
return r_list_length(fcn->bbs);
|
return r_list_length(fcn->bbs);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QRCore::fcnEndBbs(QString addr) {
|
int QRCore::fcnEndBbs(QString addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
bool ok;
|
bool ok;
|
||||||
int offset = addr.toLong(&ok, 16);
|
int offset = addr.toLong(&ok, 16);
|
||||||
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, offset, 0);
|
RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, offset, 0);
|
||||||
if (fcn) {
|
if (fcn)
|
||||||
|
{
|
||||||
QString tmp = this->cmd("afi @ " + addr + " ~end-bbs").split("\n")[0];
|
QString tmp = this->cmd("afi @ " + addr + " ~end-bbs").split("\n")[0];
|
||||||
if (tmp.contains(":")) {
|
if (tmp.contains(":"))
|
||||||
|
{
|
||||||
QString endbbs = tmp.split(": ")[1];
|
QString endbbs = tmp.split(": ")[1];
|
||||||
return endbbs.toInt();
|
return endbbs.toInt();
|
||||||
}
|
}
|
||||||
@ -516,31 +643,37 @@ int QRCore::fcnEndBbs(QString addr) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::itoa(ut64 num, int rdx) {
|
QString QRCore::itoa(ut64 num, int rdx)
|
||||||
|
{
|
||||||
return QString::number(num, rdx);
|
return QString::number(num, rdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::config(const QString &k, const QString &v) {
|
QString QRCore::config(const QString &k, const QString &v)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QByteArray key = k.toUtf8();
|
QByteArray key = k.toUtf8();
|
||||||
if (v!=NULL) {
|
if (v != NULL)
|
||||||
|
{
|
||||||
r_config_set(core_->config, key.constData(), v.toUtf8().constData());
|
r_config_set(core_->config, key.constData(), v.toUtf8().constData());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return QString(r_config_get(core_->config, key.constData()));
|
return QString(r_config_get(core_->config, key.constData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int QRCore::config(const QString &k, int v) {
|
int QRCore::config(const QString &k, int v)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QByteArray key = k.toUtf8();
|
QByteArray key = k.toUtf8();
|
||||||
if (v!=-1) {
|
if (v != -1)
|
||||||
|
{
|
||||||
r_config_set_i(core_->config, key.constData(), v);
|
r_config_set_i(core_->config, key.constData(), v);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return r_config_get_i(core_->config, key.constData());
|
return r_config_get_i(core_->config, key.constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::setOptions(QString key) {
|
void QRCore::setOptions(QString key)
|
||||||
|
{
|
||||||
QNOTUSED(key);
|
QNOTUSED(key);
|
||||||
|
|
||||||
// va
|
// va
|
||||||
@ -552,24 +685,28 @@ void QRCore::setOptions(QString key) {
|
|||||||
// anal plugin
|
// anal plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::setCPU (QString arch, QString cpu, int bits, bool temporary=false) {
|
void QRCore::setCPU(QString arch, QString cpu, int bits, bool temporary = false)
|
||||||
|
{
|
||||||
config("asm.arch", arch);
|
config("asm.arch", arch);
|
||||||
config("asm.cpu", cpu);
|
config("asm.cpu", cpu);
|
||||||
config("asm.bits", bits);
|
config("asm.bits", bits);
|
||||||
if (!temporary) {
|
if (!temporary)
|
||||||
|
{
|
||||||
default_arch = arch;
|
default_arch = arch;
|
||||||
default_cpu = cpu;
|
default_cpu = cpu;
|
||||||
default_bits = bits;
|
default_bits = bits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::setDefaultCPU() {
|
void QRCore::setDefaultCPU()
|
||||||
|
{
|
||||||
config("asm.arch", default_arch);
|
config("asm.arch", default_arch);
|
||||||
config("asm.cpu", default_cpu);
|
config("asm.cpu", default_cpu);
|
||||||
config("asm.bits", QString::number(default_bits));
|
config("asm.bits", QString::number(default_bits));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::assemble(const QString &code) {
|
QString QRCore::assemble(const QString &code)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RAsmCode *ac = r_asm_massemble(core_->assembler, code.toUtf8().constData());
|
RAsmCode *ac = r_asm_massemble(core_->assembler, code.toUtf8().constData());
|
||||||
QString hex(ac != nullptr ? ac->buf_hex : "");
|
QString hex(ac != nullptr ? ac->buf_hex : "");
|
||||||
@ -577,7 +714,8 @@ QString QRCore::assemble(const QString &code) {
|
|||||||
return hex;
|
return hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::disassemble(const QString &hex) {
|
QString QRCore::disassemble(const QString &hex)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RAsmCode *ac = r_asm_mdisassemble_hexstr(core_->assembler, hex.toUtf8().constData());
|
RAsmCode *ac = r_asm_mdisassemble_hexstr(core_->assembler, hex.toUtf8().constData());
|
||||||
QString code = QString(ac != nullptr ? ac->buf_asm : "");
|
QString code = QString(ac != nullptr ? ac->buf_asm : "");
|
||||||
@ -585,13 +723,15 @@ QString QRCore::disassemble(const QString &hex) {
|
|||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
RAnalFunction* QRCore::functionAt(ut64 addr) {
|
RAnalFunction *QRCore::functionAt(ut64 addr)
|
||||||
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
//return r_anal_fcn_find (core_->anal, addr, addr);
|
//return r_anal_fcn_find (core_->anal, addr, addr);
|
||||||
return r_anal_get_fcn_in(core_->anal, addr, 0);
|
return r_anal_get_fcn_in(core_->anal, addr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::cmdFunctionAt(QString addr) {
|
QString QRCore::cmdFunctionAt(QString addr)
|
||||||
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
//afi~name:1[1] @ 0x08048e44
|
//afi~name:1[1] @ 0x08048e44
|
||||||
//ret = cmd("afi~name[1] @ " + addr);
|
//ret = cmd("afi~name[1] @ " + addr);
|
||||||
@ -619,10 +759,13 @@ QList<QList<QString>> QRCore::get_exec_sections()
|
|||||||
QList<QList<QString>> ret;
|
QList<QList<QString>> ret;
|
||||||
|
|
||||||
QString text = cmd("S*~^S");
|
QString text = cmd("S*~^S");
|
||||||
for (QString line: text.split ("\n")) {
|
for (QString line : text.split("\n"))
|
||||||
|
{
|
||||||
QStringList fields = line.split(" ");
|
QStringList fields = line.split(" ");
|
||||||
if (fields.length() == 7) {
|
if (fields.length() == 7)
|
||||||
if (fields[6].contains("x")) {
|
{
|
||||||
|
if (fields[6].contains("x"))
|
||||||
|
{
|
||||||
QList<QString> tmp = QList<QString>();
|
QList<QString> tmp = QList<QString>();
|
||||||
tmp << fields[2];
|
tmp << fields[2];
|
||||||
tmp << fields[3];
|
tmp << fields[3];
|
||||||
@ -634,21 +777,25 @@ QList<QList<QString>> QRCore::get_exec_sections()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::getOffsetInfo(QString addr) {
|
QString QRCore::getOffsetInfo(QString addr)
|
||||||
|
{
|
||||||
return cmd("ao @ " + addr);
|
return cmd("ao @ " + addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::getOffsetJump(QString addr) {
|
QString QRCore::getOffsetJump(QString addr)
|
||||||
|
{
|
||||||
QString ret = "";
|
QString ret = "";
|
||||||
ret = cmd("ao @" + addr + "~jump[1]");
|
ret = cmd("ao @" + addr + "~jump[1]");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::getDecompiledCode(QString addr) {
|
QString QRCore::getDecompiledCode(QString addr)
|
||||||
|
{
|
||||||
return cmd("pdc @ " + addr);
|
return cmd("pdc @ " + addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::getFileInfo() {
|
QString QRCore::getFileInfo()
|
||||||
|
{
|
||||||
|
|
||||||
QString info;
|
QString info;
|
||||||
info = cmd("ij");
|
info = cmd("ij");
|
||||||
@ -656,7 +803,8 @@ QString QRCore::getFileInfo() {
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList QRCore::getStats() {
|
QStringList QRCore::getStats()
|
||||||
|
{
|
||||||
QStringList stats;
|
QStringList stats;
|
||||||
cmd("fs functions");
|
cmd("fs functions");
|
||||||
stats << cmd("f~?").trimmed();
|
stats << cmd("f~?").trimmed();
|
||||||
@ -678,7 +826,8 @@ QStringList QRCore::getStats() {
|
|||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QRCore::getSimpleGraph(QString function) {
|
QString QRCore::getSimpleGraph(QString function)
|
||||||
|
{
|
||||||
|
|
||||||
// New styles
|
// New styles
|
||||||
QString graph = "graph [bgcolor=invis, splines=polyline];";
|
QString graph = "graph [bgcolor=invis, splines=polyline];";
|
||||||
@ -700,7 +849,8 @@ QString QRCore::getSimpleGraph(QString function) {
|
|||||||
return dot;
|
return dot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::getOpcodes() {
|
void QRCore::getOpcodes()
|
||||||
|
{
|
||||||
QString opcodes = cmd("?O");
|
QString opcodes = cmd("?O");
|
||||||
this->opcodes = opcodes.split("\n");
|
this->opcodes = opcodes.split("\n");
|
||||||
// Remove the last empty element
|
// Remove the last empty element
|
||||||
@ -710,7 +860,8 @@ void QRCore::getOpcodes() {
|
|||||||
this->regs.removeLast();
|
this->regs.removeLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCore::setSettings() {
|
void QRCore::setSettings()
|
||||||
|
{
|
||||||
config("scr.color", "false");
|
config("scr.color", "false");
|
||||||
config("scr.interactive", "false");
|
config("scr.interactive", "false");
|
||||||
config("asm.lines", "false");
|
config("asm.lines", "false");
|
||||||
|
@ -8,7 +8,8 @@ QRDisasm::QRDisasm(QRCore *core)
|
|||||||
this->core = core;
|
this->core = core;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QRDisasm::disassembleAt (ut64 addr, QRDisasmOption opt, QRDisasmRow &dr) {
|
bool QRDisasm::disassembleAt(ut64 addr, QRDisasmOption opt, QRDisasmRow &dr)
|
||||||
|
{
|
||||||
QNOTUSED(addr);
|
QNOTUSED(addr);
|
||||||
QNOTUSED(opt);
|
QNOTUSED(opt);
|
||||||
QNOTUSED(dr);
|
QNOTUSED(dr);
|
||||||
|
@ -3,14 +3,16 @@
|
|||||||
|
|
||||||
#include <qrcore.h>
|
#include <qrcore.h>
|
||||||
|
|
||||||
enum QRDisasmDataType {
|
enum QRDisasmDataType
|
||||||
|
{
|
||||||
STRING = 'z',
|
STRING = 'z',
|
||||||
STRUCT = 's',
|
STRUCT = 's',
|
||||||
DATA = 'd',
|
DATA = 'd',
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum QRDisasmOption {
|
enum QRDisasmOption
|
||||||
|
{
|
||||||
DWARF = 1 << 1,
|
DWARF = 1 << 1,
|
||||||
REFS = 1 << 2,
|
REFS = 1 << 2,
|
||||||
ESIL = 1 << 3,
|
ESIL = 1 << 3,
|
||||||
|
@ -12,7 +12,8 @@ WebServerThread::WebServerThread(QRCore *core, QObject *parent) :
|
|||||||
|
|
||||||
WebServerThread::~WebServerThread()
|
WebServerThread::~WebServerThread()
|
||||||
{
|
{
|
||||||
if (isRunning()) {
|
if (isRunning())
|
||||||
|
{
|
||||||
quit();
|
quit();
|
||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
@ -22,7 +23,8 @@ void WebServerThread::startServer()
|
|||||||
{
|
{
|
||||||
assert(nullptr != core);
|
assert(nullptr != core);
|
||||||
|
|
||||||
if (!isRunning() && !started) {
|
if (!isRunning() && !started)
|
||||||
|
{
|
||||||
QThread::start();
|
QThread::start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +45,8 @@ bool WebServerThread::isStarted() const
|
|||||||
return started;
|
return started;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebServerThread::run() {
|
void WebServerThread::run()
|
||||||
|
{
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
|
|
||||||
if (core == nullptr)
|
if (core == nullptr)
|
||||||
@ -63,13 +66,16 @@ void WebServerThread::toggleWebServer()
|
|||||||
// "=h*", "", "restart current webserver",
|
// "=h*", "", "restart current webserver",
|
||||||
// "=h&", " port", "start http server in background)",
|
// "=h&", " port", "start http server in background)",
|
||||||
|
|
||||||
if (started) {
|
if (started)
|
||||||
|
{
|
||||||
// after this the only reaction to this commands is:
|
// after this the only reaction to this commands is:
|
||||||
// sandbox: connect disabled
|
// sandbox: connect disabled
|
||||||
// and the webserver is still running
|
// and the webserver is still running
|
||||||
// TODO: find out why
|
// TODO: find out why
|
||||||
core->cmd("=h-");
|
core->cmd("=h-");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
core->cmd("=h&");
|
core->cmd("=h&");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,14 +41,16 @@ GraphicsBar::GraphicsBar(MainWindow *main, QWidget *parent) :
|
|||||||
//addWidget(addsCombo);
|
//addWidget(addsCombo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsBar::paintEvent(QPaintEvent *event) {
|
void GraphicsBar::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
QNOTUSED(event);
|
QNOTUSED(event);
|
||||||
|
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
this->fillData();
|
this->fillData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsBar::fillData() {
|
void GraphicsBar::fillData()
|
||||||
|
{
|
||||||
|
|
||||||
// Prepare the graph scene
|
// Prepare the graph scene
|
||||||
int w = this->codeGraphic->width();
|
int w = this->codeGraphic->width();
|
||||||
@ -67,10 +69,12 @@ void GraphicsBar::fillData() {
|
|||||||
QString jsonData = this->main->core->cmd("p-j");
|
QString jsonData = this->main->core->cmd("p-j");
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(jsonData.toUtf8());
|
QJsonDocument doc = QJsonDocument::fromJson(jsonData.toUtf8());
|
||||||
|
|
||||||
if (doc.isNull()) {
|
if (doc.isNull())
|
||||||
|
{
|
||||||
qDebug() << "Invalid json in p-j command";
|
qDebug() << "Invalid json in p-j command";
|
||||||
}
|
}
|
||||||
else if (doc.isObject()) {
|
else if (doc.isObject())
|
||||||
|
{
|
||||||
//get the jsonObject
|
//get the jsonObject
|
||||||
QJsonObject jObject = doc.object();
|
QJsonObject jObject = doc.object();
|
||||||
|
|
||||||
@ -82,15 +86,18 @@ void GraphicsBar::fillData() {
|
|||||||
int block = mainMap["blocksize"].toInt();
|
int block = mainMap["blocksize"].toInt();
|
||||||
int size = (to - from);
|
int size = (to - from);
|
||||||
int num = size / block;
|
int num = size / block;
|
||||||
if (num < 1) {
|
if (num < 1)
|
||||||
|
{
|
||||||
num = 1;
|
num = 1;
|
||||||
}
|
}
|
||||||
int graph_block = w / num;
|
int graph_block = w / num;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
|
||||||
for (auto i : mainMap["blocks"].toList()) {
|
for (auto i : mainMap["blocks"].toList())
|
||||||
|
{
|
||||||
QMap<QString, QVariant> map = i.toMap();
|
QMap<QString, QVariant> map = i.toMap();
|
||||||
if (map.empty()) {
|
if (map.empty())
|
||||||
|
{
|
||||||
// Fill empty color
|
// Fill empty color
|
||||||
// addRect(qreal x, qreal y, qreal w, qreal h, const QPen &pen = QPen(), const QBrush &brush = QBrush())
|
// addRect(qreal x, qreal y, qreal w, qreal h, const QPen &pen = QPen(), const QBrush &brush = QBrush())
|
||||||
//scene->addRect(counter * graph_block, 0, graph_block ,h, QPen(Qt::NoPen), QBrush(QColor(252, 249, 190)));
|
//scene->addRect(counter * graph_block, 0, graph_block ,h, QPen(Qt::NoPen), QBrush(QColor(252, 249, 190)));
|
||||||
@ -99,14 +106,19 @@ void GraphicsBar::fillData() {
|
|||||||
rect->setBrush(QBrush(QColor(252, 249, 190)));
|
rect->setBrush(QBrush(QColor(252, 249, 190)));
|
||||||
rect->setToolTip("Data");
|
rect->setToolTip("Data");
|
||||||
scene->addItem(rect);
|
scene->addItem(rect);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Fill type of color
|
// Fill type of color
|
||||||
//scene->addRect(counter * graph_block, 0, graph_block ,h, QPen(Qt::NoPen), QBrush(QColor(69, 104, 229)));
|
//scene->addRect(counter * graph_block, 0, graph_block ,h, QPen(Qt::NoPen), QBrush(QColor(69, 104, 229)));
|
||||||
QGraphicsRectItem *rect = new QGraphicsRectItem(counter * graph_block, 0, graph_block, h);
|
QGraphicsRectItem *rect = new QGraphicsRectItem(counter * graph_block, 0, graph_block, h);
|
||||||
rect->setPen(Qt::NoPen);
|
rect->setPen(Qt::NoPen);
|
||||||
if (i.toMap()["functions"].toInt() == 0) {
|
if (i.toMap()["functions"].toInt() == 0)
|
||||||
|
{
|
||||||
rect->setBrush(QBrush(QColor(190, 190, 190)));
|
rect->setBrush(QBrush(QColor(190, 190, 190)));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
rect->setBrush(QBrush(QColor(69, 104, 229)));
|
rect->setBrush(QBrush(QColor(69, 104, 229)));
|
||||||
}
|
}
|
||||||
rect->setToolTip("Offset: 0x" + QString::number(i.toMap()["offset"].toInt(), 16) + "\nFunctions: " + QString::number(i.toMap()["functions"].toInt()) + "\nFlags: " + QString::number(i.toMap()["flags"].toInt()));
|
rect->setToolTip("Offset: 0x" + QString::number(i.toMap()["offset"].toInt(), 16) + "\nFunctions: " + QString::number(i.toMap()["functions"].toInt()) + "\nFlags: " + QString::number(i.toMap()["flags"].toInt()));
|
||||||
|
@ -48,10 +48,12 @@ void CommentsWidget::on_commentsTreeWidget_itemDoubleClicked(QTreeWidgetItem *it
|
|||||||
this->main->seek(offset, name);
|
this->main->seek(offset, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommentsWidget::refreshTree() {
|
void CommentsWidget::refreshTree()
|
||||||
|
{
|
||||||
this->commentsTreeWidget->clear();
|
this->commentsTreeWidget->clear();
|
||||||
QList<QList<QString>> comments = this->main->core->getComments();
|
QList<QList<QString>> comments = this->main->core->getComments();
|
||||||
for (QList<QString> comment: comments) {
|
for (QList<QString> comment : comments)
|
||||||
|
{
|
||||||
this->main->add_debug_output(comment[1]);
|
this->main->add_debug_output(comment[1]);
|
||||||
QString fcn_name = this->main->core->cmdFunctionAt(comment[1]);
|
QString fcn_name = this->main->core->cmdFunctionAt(comment[1]);
|
||||||
this->main->appendRow(this->commentsTreeWidget, comment[1], fcn_name, comment[0].remove('"'));
|
this->main->appendRow(this->commentsTreeWidget, comment[1], fcn_name, comment[0].remove('"'));
|
||||||
@ -61,11 +63,13 @@ void CommentsWidget::refreshTree() {
|
|||||||
// Add nested comments
|
// Add nested comments
|
||||||
this->nestedCommentsTreeWidget->clear();
|
this->nestedCommentsTreeWidget->clear();
|
||||||
QMap<QString, QList<QList<QString>>> cmts = this->main->core->getNestedComments();
|
QMap<QString, QList<QList<QString>>> cmts = this->main->core->getNestedComments();
|
||||||
for(auto cmt : cmts.keys()) {
|
for (auto cmt : cmts.keys())
|
||||||
|
{
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(this->nestedCommentsTreeWidget);
|
QTreeWidgetItem *item = new QTreeWidgetItem(this->nestedCommentsTreeWidget);
|
||||||
item->setText(0, cmt);
|
item->setText(0, cmt);
|
||||||
QList<QList<QString>> meow = cmts.value(cmt);
|
QList<QList<QString>> meow = cmts.value(cmt);
|
||||||
for (int i = 0; i < meow.size(); ++i) {
|
for (int i = 0; i < meow.size(); ++i)
|
||||||
|
{
|
||||||
QList<QString> tmp = meow.at(i);
|
QList<QString> tmp = meow.at(i);
|
||||||
QTreeWidgetItem *it = new QTreeWidgetItem();
|
QTreeWidgetItem *it = new QTreeWidgetItem();
|
||||||
it->setText(0, tmp[1]);
|
it->setText(0, tmp[1]);
|
||||||
@ -95,10 +99,13 @@ void CommentsWidget::showTitleContextMenu(const QPoint &pt)
|
|||||||
menu->addAction(ui->actionHorizontal);
|
menu->addAction(ui->actionHorizontal);
|
||||||
menu->addAction(ui->actionVertical);
|
menu->addAction(ui->actionVertical);
|
||||||
|
|
||||||
if (ui->tabWidget->currentIndex() == 0) {
|
if (ui->tabWidget->currentIndex() == 0)
|
||||||
|
{
|
||||||
ui->actionHorizontal->setChecked(true);
|
ui->actionHorizontal->setChecked(true);
|
||||||
ui->actionVertical->setChecked(false);
|
ui->actionVertical->setChecked(false);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->actionVertical->setChecked(true);
|
ui->actionVertical->setChecked(true);
|
||||||
ui->actionHorizontal->setChecked(false);
|
ui->actionHorizontal->setChecked(false);
|
||||||
}
|
}
|
||||||
@ -119,17 +126,23 @@ void CommentsWidget::on_actionVertical_triggered()
|
|||||||
ui->tabWidget->setCurrentIndex(1);
|
ui->tabWidget->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CommentsWidget::eventFilter(QObject *obj, QEvent *event) {
|
bool CommentsWidget::eventFilter(QObject *obj, QEvent *event)
|
||||||
if (this->main->responsive) {
|
{
|
||||||
if (event->type() == QEvent::Resize && obj == this && this->isVisible()) {
|
if (this->main->responsive)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::Resize && obj == this && this->isVisible())
|
||||||
|
{
|
||||||
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
||||||
//qDebug("Dock Resized (New Size) - Width: %d Height: %d",
|
//qDebug("Dock Resized (New Size) - Width: %d Height: %d",
|
||||||
// resizeEvent->size().width(),
|
// resizeEvent->size().width(),
|
||||||
// resizeEvent->size().height());
|
// resizeEvent->size().height());
|
||||||
if (resizeEvent->size().width() >= resizeEvent->size().height()) {
|
if (resizeEvent->size().width() >= resizeEvent->size().height())
|
||||||
|
{
|
||||||
// Set horizontal view (list)
|
// Set horizontal view (list)
|
||||||
this->on_actionHorizontal_triggered();
|
this->on_actionHorizontal_triggered();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Set vertical view (Tree)
|
// Set vertical view (Tree)
|
||||||
this->on_actionVertical_triggered();
|
this->on_actionVertical_triggered();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class CommentsWidget;
|
class CommentsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ Dashboard::~Dashboard()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dashboard::updateContents() {
|
void Dashboard::updateContents()
|
||||||
|
{
|
||||||
|
|
||||||
// Parse and add JSON file info
|
// Parse and add JSON file info
|
||||||
QString info = this->main->core->getFileInfo();
|
QString info = this->main->core->getFileInfo();
|
||||||
@ -61,47 +62,71 @@ void Dashboard::updateContents() {
|
|||||||
|
|
||||||
this->ui->baddrEdit->setText(QString::number(item2["baddr"].toDouble()));
|
this->ui->baddrEdit->setText(QString::number(item2["baddr"].toDouble()));
|
||||||
|
|
||||||
if ( item2["va"].toBool() == true) {
|
if (item2["va"].toBool() == true)
|
||||||
|
{
|
||||||
this->ui->vaEdit->setText("True");
|
this->ui->vaEdit->setText("True");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->ui->vaEdit->setText("False");
|
this->ui->vaEdit->setText("False");
|
||||||
}
|
}
|
||||||
if ( item2["canary"].toBool() == true) {
|
if (item2["canary"].toBool() == true)
|
||||||
|
{
|
||||||
this->ui->canaryEdit->setText("True");
|
this->ui->canaryEdit->setText("True");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->ui->canaryEdit->setText("False");
|
this->ui->canaryEdit->setText("False");
|
||||||
this->ui->canaryEdit->setStyleSheet("color: rgb(255, 0, 0);");
|
this->ui->canaryEdit->setStyleSheet("color: rgb(255, 0, 0);");
|
||||||
}
|
}
|
||||||
if ( item2["crypto"].toBool() == true) {
|
if (item2["crypto"].toBool() == true)
|
||||||
|
{
|
||||||
this->ui->cryptoEdit->setText("True");
|
this->ui->cryptoEdit->setText("True");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->ui->cryptoEdit->setText("False");
|
this->ui->cryptoEdit->setText("False");
|
||||||
}
|
}
|
||||||
if ( item2["nx"].toBool() == true) {
|
if (item2["nx"].toBool() == true)
|
||||||
|
{
|
||||||
this->ui->nxEdit->setText("True");
|
this->ui->nxEdit->setText("True");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->ui->nxEdit->setText("False");
|
this->ui->nxEdit->setText("False");
|
||||||
this->ui->nxEdit->setStyleSheet("color: rgb(255, 0, 0);");
|
this->ui->nxEdit->setStyleSheet("color: rgb(255, 0, 0);");
|
||||||
}
|
}
|
||||||
if ( item2["pic"].toBool() == true) {
|
if (item2["pic"].toBool() == true)
|
||||||
|
{
|
||||||
this->ui->picEdit->setText("True");
|
this->ui->picEdit->setText("True");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->ui->picEdit->setText("False");
|
this->ui->picEdit->setText("False");
|
||||||
this->ui->picEdit->setStyleSheet("color: rgb(255, 0, 0);");
|
this->ui->picEdit->setStyleSheet("color: rgb(255, 0, 0);");
|
||||||
}
|
}
|
||||||
if ( item2["static"].toBool() == true) {
|
if (item2["static"].toBool() == true)
|
||||||
|
{
|
||||||
this->ui->staticEdit->setText("True");
|
this->ui->staticEdit->setText("True");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->ui->staticEdit->setText("False");
|
this->ui->staticEdit->setText("False");
|
||||||
}
|
}
|
||||||
if ( item2["stripped"].toBool() == true) {
|
if (item2["stripped"].toBool() == true)
|
||||||
|
{
|
||||||
this->ui->strippedEdit->setText("True");
|
this->ui->strippedEdit->setText("True");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->ui->strippedEdit->setText("False");
|
this->ui->strippedEdit->setText("False");
|
||||||
}
|
}
|
||||||
if ( item2["relocs"].toBool() == true) {
|
if (item2["relocs"].toBool() == true)
|
||||||
|
{
|
||||||
this->ui->relocsEdit->setText("True");
|
this->ui->relocsEdit->setText("True");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->ui->relocsEdit->setText("False");
|
this->ui->relocsEdit->setText("False");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,11 +138,13 @@ void Dashboard::updateContents() {
|
|||||||
|
|
||||||
QString libs = this->main->core->cmd("il");
|
QString libs = this->main->core->cmd("il");
|
||||||
QStringList lines = libs.split("\n", QString::SkipEmptyParts);
|
QStringList lines = libs.split("\n", QString::SkipEmptyParts);
|
||||||
if (! lines.isEmpty()) {
|
if (! lines.isEmpty())
|
||||||
|
{
|
||||||
lines.removeFirst();
|
lines.removeFirst();
|
||||||
lines.removeLast();
|
lines.removeLast();
|
||||||
}
|
}
|
||||||
foreach (QString lib, lines) {
|
foreach (QString lib, lines)
|
||||||
|
{
|
||||||
QLabel *label = new QLabel(this);
|
QLabel *label = new QLabel(this);
|
||||||
label->setText(lib);
|
label->setText(lib);
|
||||||
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
@ -135,7 +162,8 @@ void Dashboard::updateContents() {
|
|||||||
|
|
||||||
// Add data to HTML graphs (stats)
|
// Add data to HTML graphs (stats)
|
||||||
QFile html(":/html/stats.html");
|
QFile html(":/html/stats.html");
|
||||||
if(!html.open(QIODevice::ReadOnly)) {
|
if (!html.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
QMessageBox::information(0, "error", html.errorString());
|
QMessageBox::information(0, "error", html.errorString());
|
||||||
}
|
}
|
||||||
QString code = html.readAll();
|
QString code = html.readAll();
|
||||||
@ -147,7 +175,8 @@ void Dashboard::updateContents() {
|
|||||||
|
|
||||||
// Add data to polar graph
|
// Add data to polar graph
|
||||||
QFile html2(":/html/radar.html");
|
QFile html2(":/html/radar.html");
|
||||||
if(!html2.open(QIODevice::ReadOnly)) {
|
if (!html2.open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
QMessageBox::information(0, "error", html2.errorString());
|
QMessageBox::information(0, "error", html2.errorString());
|
||||||
}
|
}
|
||||||
QString code2 = html2.readAll();
|
QString code2 = html2.readAll();
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class Dashboard;
|
class Dashboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class FlagsWidget;
|
class FlagsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,15 +47,18 @@ FunctionsWidget::~FunctionsWidget()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionsWidget::fillFunctions() {
|
void FunctionsWidget::fillFunctions()
|
||||||
|
{
|
||||||
this->functionsTreeWidget->clear();
|
this->functionsTreeWidget->clear();
|
||||||
ui->nestedFunctionsTree->clear();
|
ui->nestedFunctionsTree->clear();
|
||||||
for (auto i: this->main->core->getList ("anal", "functions")) {
|
for (auto i : this->main->core->getList("anal", "functions"))
|
||||||
|
{
|
||||||
QStringList a = i.split(",");
|
QStringList a = i.split(",");
|
||||||
// off,sz,unk,name
|
// off,sz,unk,name
|
||||||
// "0x0804ada3,1,13,,fcn.0804ada3"
|
// "0x0804ada3,1,13,,fcn.0804ada3"
|
||||||
// "0x0804ad4a,6,,1,,fcn.0804ad4a"
|
// "0x0804ad4a,6,,1,,fcn.0804ad4a"
|
||||||
if (a.length() == 5) {
|
if (a.length() == 5)
|
||||||
|
{
|
||||||
// Add list function
|
// Add list function
|
||||||
this->main->appendRow(this->functionsTreeWidget, a[0], a[1], a[4]);
|
this->main->appendRow(this->functionsTreeWidget, a[0], a[1], a[4]);
|
||||||
// Add nested function
|
// Add nested function
|
||||||
@ -68,7 +71,9 @@ void FunctionsWidget::fillFunctions() {
|
|||||||
off_it->setText(0, "Size: " + a[1]);
|
off_it->setText(0, "Size: " + a[1]);
|
||||||
item->addChild(off_it);
|
item->addChild(off_it);
|
||||||
ui->nestedFunctionsTree->addTopLevelItem(item);
|
ui->nestedFunctionsTree->addTopLevelItem(item);
|
||||||
} else if (a.length() == 6) {
|
}
|
||||||
|
else if (a.length() == 6)
|
||||||
|
{
|
||||||
// Add list function
|
// Add list function
|
||||||
this->main->appendRow(this->functionsTreeWidget, a[0], a[1], a[5]);
|
this->main->appendRow(this->functionsTreeWidget, a[0], a[1], a[5]);
|
||||||
// Add nested function
|
// Add nested function
|
||||||
@ -81,7 +86,9 @@ void FunctionsWidget::fillFunctions() {
|
|||||||
off_it->setText(0, "Size: " + a[1]);
|
off_it->setText(0, "Size: " + a[1]);
|
||||||
item->addChild(off_it);
|
item->addChild(off_it);
|
||||||
ui->nestedFunctionsTree->addTopLevelItem(item);
|
ui->nestedFunctionsTree->addTopLevelItem(item);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
qDebug() << "fillFunctions()" << a;
|
qDebug() << "fillFunctions()" << a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,25 +120,31 @@ void FunctionsWidget::showFunctionsContextMenu(const QPoint &pt)
|
|||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(ui->action_References);
|
menu->addAction(ui->action_References);
|
||||||
|
|
||||||
if(ui->tabWidget->currentIndex() == 0) {
|
if (ui->tabWidget->currentIndex() == 0)
|
||||||
|
{
|
||||||
this->functionsTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
this->functionsTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
menu->exec(ui->functionsTreeWidget->mapToGlobal(pt));
|
menu->exec(ui->functionsTreeWidget->mapToGlobal(pt));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->nestedFunctionsTree->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->nestedFunctionsTree->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
menu->exec(ui->nestedFunctionsTree->mapToGlobal(pt));
|
menu->exec(ui->nestedFunctionsTree->mapToGlobal(pt));
|
||||||
}
|
}
|
||||||
delete menu;
|
delete menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionsWidget::refreshTree() {
|
void FunctionsWidget::refreshTree()
|
||||||
|
{
|
||||||
this->functionsTreeWidget->clear();
|
this->functionsTreeWidget->clear();
|
||||||
ui->nestedFunctionsTree->clear();
|
ui->nestedFunctionsTree->clear();
|
||||||
for (auto i: this->main->core->getList ("anal", "functions")) {
|
for (auto i : this->main->core->getList("anal", "functions"))
|
||||||
|
{
|
||||||
QStringList a = i.split(",");
|
QStringList a = i.split(",");
|
||||||
// off,sz,unk,name
|
// off,sz,unk,name
|
||||||
// "0x0804ada3,1,13,,fcn.0804ada3"
|
// "0x0804ada3,1,13,,fcn.0804ada3"
|
||||||
// "0x0804ad4a,6,,1,,fcn.0804ad4a"
|
// "0x0804ad4a,6,,1,,fcn.0804ad4a"
|
||||||
if (a.length() == 5) {
|
if (a.length() == 5)
|
||||||
|
{
|
||||||
// Add list function
|
// Add list function
|
||||||
this->main->appendRow(this->functionsTreeWidget, a[0], a[1], a[4]);
|
this->main->appendRow(this->functionsTreeWidget, a[0], a[1], a[4]);
|
||||||
// Add nested function
|
// Add nested function
|
||||||
@ -144,7 +157,9 @@ void FunctionsWidget::refreshTree() {
|
|||||||
off_it->setText(0, "Size: " + a[1]);
|
off_it->setText(0, "Size: " + a[1]);
|
||||||
item->addChild(off_it);
|
item->addChild(off_it);
|
||||||
ui->nestedFunctionsTree->addTopLevelItem(item);
|
ui->nestedFunctionsTree->addTopLevelItem(item);
|
||||||
} else if (a.length() == 6) {
|
}
|
||||||
|
else if (a.length() == 6)
|
||||||
|
{
|
||||||
// Add list function
|
// Add list function
|
||||||
this->main->appendRow(this->functionsTreeWidget, a[0], a[1], a[5]);
|
this->main->appendRow(this->functionsTreeWidget, a[0], a[1], a[5]);
|
||||||
// Add nested function
|
// Add nested function
|
||||||
@ -157,7 +172,9 @@ void FunctionsWidget::refreshTree() {
|
|||||||
off_it->setText(0, "Size: " + a[1]);
|
off_it->setText(0, "Size: " + a[1]);
|
||||||
item->addChild(off_it);
|
item->addChild(off_it);
|
||||||
ui->nestedFunctionsTree->addTopLevelItem(item);
|
ui->nestedFunctionsTree->addTopLevelItem(item);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
qDebug() << "fillFunctions()" << a;
|
qDebug() << "fillFunctions()" << a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,16 +191,20 @@ void FunctionsWidget::on_actionDisasAdd_comment_triggered()
|
|||||||
// Create dialog
|
// Create dialog
|
||||||
CommentsDialog *c = new CommentsDialog(this);
|
CommentsDialog *c = new CommentsDialog(this);
|
||||||
// Get selected item in functions tree widget
|
// Get selected item in functions tree widget
|
||||||
if(ui->tabWidget->currentIndex() == 0) {
|
if (ui->tabWidget->currentIndex() == 0)
|
||||||
|
{
|
||||||
QList<QTreeWidgetItem *> selected_rows = ui->functionsTreeWidget->selectedItems();
|
QList<QTreeWidgetItem *> selected_rows = ui->functionsTreeWidget->selectedItems();
|
||||||
// Get selected function name
|
// Get selected function name
|
||||||
fcn_name = selected_rows.first()->text(3);
|
fcn_name = selected_rows.first()->text(3);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QList<QTreeWidgetItem *> selected_rows = ui->nestedFunctionsTree->selectedItems();
|
QList<QTreeWidgetItem *> selected_rows = ui->nestedFunctionsTree->selectedItems();
|
||||||
// Get selected function name
|
// Get selected function name
|
||||||
fcn_name = selected_rows.first()->text(0);
|
fcn_name = selected_rows.first()->text(0);
|
||||||
}
|
}
|
||||||
if (c->exec()) {
|
if (c->exec())
|
||||||
|
{
|
||||||
// Get new function name
|
// Get new function name
|
||||||
QString comment = c->getComment();
|
QString comment = c->getComment();
|
||||||
this->main->add_debug_output("Comment: " + comment + " at: " + fcn_name);
|
this->main->add_debug_output("Comment: " + comment + " at: " + fcn_name);
|
||||||
@ -196,7 +217,8 @@ void FunctionsWidget::on_actionDisasAdd_comment_triggered()
|
|||||||
this->main->refreshComments();
|
this->main->refreshComments();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionsWidget::addTooltips() {
|
void FunctionsWidget::addTooltips()
|
||||||
|
{
|
||||||
|
|
||||||
// Add comments to list functions
|
// Add comments to list functions
|
||||||
QList<QTreeWidgetItem *> clist = this->functionsTreeWidget->findItems("*", Qt::MatchWildcard, 3);
|
QList<QTreeWidgetItem *> clist = this->functionsTreeWidget->findItems("*", Qt::MatchWildcard, 3);
|
||||||
@ -204,7 +226,8 @@ void FunctionsWidget::addTooltips() {
|
|||||||
{
|
{
|
||||||
QString name = item->text(3);
|
QString name = item->text(3);
|
||||||
QList<QString> info = this->main->core->cmd("afi @ " + name).split("\n");
|
QList<QString> info = this->main->core->cmd("afi @ " + name).split("\n");
|
||||||
if (info.length() > 2) {
|
if (info.length() > 2)
|
||||||
|
{
|
||||||
QString size = info[4].split(" ")[1];
|
QString size = info[4].split(" ")[1];
|
||||||
QString complex = info[8].split(" ")[1];
|
QString complex = info[8].split(" ")[1];
|
||||||
QString bb = info[11].split(" ")[1];
|
QString bb = info[11].split(" ")[1];
|
||||||
@ -223,7 +246,8 @@ void FunctionsWidget::addTooltips() {
|
|||||||
{
|
{
|
||||||
QString name = item->text(0);
|
QString name = item->text(0);
|
||||||
QList<QString> info = this->main->core->cmd("afi @ " + name).split("\n");
|
QList<QString> info = this->main->core->cmd("afi @ " + name).split("\n");
|
||||||
if (info.length() > 2) {
|
if (info.length() > 2)
|
||||||
|
{
|
||||||
QString size = info[4].split(" ")[1];
|
QString size = info[4].split(" ")[1];
|
||||||
QString complex = info[8].split(" ")[1];
|
QString complex = info[8].split(" ")[1];
|
||||||
QString bb = info[11].split(" ")[1];
|
QString bb = info[11].split(" ")[1];
|
||||||
@ -248,7 +272,8 @@ void FunctionsWidget::on_actionFunctionsRename_triggered()
|
|||||||
// Set function name in dialog
|
// Set function name in dialog
|
||||||
r->setFunctionName(old_name);
|
r->setFunctionName(old_name);
|
||||||
// If user accepted
|
// If user accepted
|
||||||
if (r->exec()) {
|
if (r->exec())
|
||||||
|
{
|
||||||
// Get new function name
|
// Get new function name
|
||||||
QString new_name = r->getFunctionName();
|
QString new_name = r->getFunctionName();
|
||||||
// Rename function in r2 core
|
// Rename function in r2 core
|
||||||
@ -288,8 +313,10 @@ void FunctionsWidget::on_action_References_triggered()
|
|||||||
|
|
||||||
// refs = calls q hace esa funcion
|
// refs = calls q hace esa funcion
|
||||||
QList<QString> refs = this->main->core->getFunctionRefs(fcn->addr, 'C');
|
QList<QString> refs = this->main->core->getFunctionRefs(fcn->addr, 'C');
|
||||||
if (refs.size() > 0) {
|
if (refs.size() > 0)
|
||||||
for (int i = 0; i < refs.size(); ++i) {
|
{
|
||||||
|
for (int i = 0; i < refs.size(); ++i)
|
||||||
|
{
|
||||||
//this->main->add_debug_output(refs.at(i));
|
//this->main->add_debug_output(refs.at(i));
|
||||||
QStringList retlist = refs.at(i).split(",");
|
QStringList retlist = refs.at(i).split(",");
|
||||||
QStringList temp;
|
QStringList temp;
|
||||||
@ -304,8 +331,10 @@ void FunctionsWidget::on_action_References_triggered()
|
|||||||
// xrefs = calls a esa funcion
|
// xrefs = calls a esa funcion
|
||||||
//qDebug() << this->main->core->getFunctionXrefs(offset.toLong(&ok, 16));
|
//qDebug() << this->main->core->getFunctionXrefs(offset.toLong(&ok, 16));
|
||||||
QList<QString> xrefs = this->main->core->getFunctionXrefs(fcn->addr);
|
QList<QString> xrefs = this->main->core->getFunctionXrefs(fcn->addr);
|
||||||
if (xrefs.size() > 0) {
|
if (xrefs.size() > 0)
|
||||||
for (int i = 0; i < xrefs.size(); ++i) {
|
{
|
||||||
|
for (int i = 0; i < xrefs.size(); ++i)
|
||||||
|
{
|
||||||
//this->main->add_debug_output(xrefs.at(i));
|
//this->main->add_debug_output(xrefs.at(i));
|
||||||
QStringList retlist = xrefs.at(i).split(",");
|
QStringList retlist = xrefs.at(i).split(",");
|
||||||
QStringList temp;
|
QStringList temp;
|
||||||
@ -328,10 +357,13 @@ void FunctionsWidget::showTitleContextMenu(const QPoint &pt)
|
|||||||
menu->addAction(ui->actionHorizontal);
|
menu->addAction(ui->actionHorizontal);
|
||||||
menu->addAction(ui->actionVertical);
|
menu->addAction(ui->actionVertical);
|
||||||
|
|
||||||
if (ui->tabWidget->currentIndex() == 0) {
|
if (ui->tabWidget->currentIndex() == 0)
|
||||||
|
{
|
||||||
ui->actionHorizontal->setChecked(true);
|
ui->actionHorizontal->setChecked(true);
|
||||||
ui->actionVertical->setChecked(false);
|
ui->actionVertical->setChecked(false);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->actionVertical->setChecked(true);
|
ui->actionVertical->setChecked(true);
|
||||||
ui->actionHorizontal->setChecked(false);
|
ui->actionHorizontal->setChecked(false);
|
||||||
}
|
}
|
||||||
@ -363,17 +395,23 @@ void FunctionsWidget::on_nestedFunctionsTree_itemDoubleClicked(QTreeWidgetItem *
|
|||||||
this->main->memoryDock->raise();
|
this->main->memoryDock->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FunctionsWidget::eventFilter(QObject *obj, QEvent *event) {
|
bool FunctionsWidget::eventFilter(QObject *obj, QEvent *event)
|
||||||
if (this->main->responsive) {
|
{
|
||||||
if (event->type() == QEvent::Resize && obj == this && this->isVisible() == true) {
|
if (this->main->responsive)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::Resize && obj == this && this->isVisible() == true)
|
||||||
|
{
|
||||||
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
||||||
//qDebug("Dock Resized (New Size) - Width: %d Height: %d",
|
//qDebug("Dock Resized (New Size) - Width: %d Height: %d",
|
||||||
// resizeEvent->size().width(),
|
// resizeEvent->size().width(),
|
||||||
// resizeEvent->size().height());
|
// resizeEvent->size().height());
|
||||||
if (resizeEvent->size().width() >= resizeEvent->size().height()) {
|
if (resizeEvent->size().width() >= resizeEvent->size().height())
|
||||||
|
{
|
||||||
// Set horizontal view (list)
|
// Set horizontal view (list)
|
||||||
this->on_actionHorizontal_triggered();
|
this->on_actionHorizontal_triggered();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Set vertical view (Tree)
|
// Set vertical view (Tree)
|
||||||
this->on_actionVertical_triggered();
|
this->on_actionVertical_triggered();
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class FunctionsWidget;
|
class FunctionsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +43,11 @@ ImportsWidget::ImportsWidget(MainWindow *main, QWidget *parent) :
|
|||||||
//ui->importsTreeWidget->setItemDelegate(delegate);
|
//ui->importsTreeWidget->setItemDelegate(delegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportsWidget::fillImports() {
|
void ImportsWidget::fillImports()
|
||||||
|
{
|
||||||
this->importsTreeWidget->clear();
|
this->importsTreeWidget->clear();
|
||||||
for (auto i: this->main->core->getList ("bin", "imports")) {
|
for (auto i : this->main->core->getList("bin", "imports"))
|
||||||
|
{
|
||||||
QStringList a = i.split(",");
|
QStringList a = i.split(",");
|
||||||
// ord,plt,name
|
// ord,plt,name
|
||||||
if (a.length() == 6)
|
if (a.length() == 6)
|
||||||
@ -55,7 +57,8 @@ void ImportsWidget::fillImports() {
|
|||||||
this->main->adjustColumns(this->importsTreeWidget);
|
this->main->adjustColumns(this->importsTreeWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportsWidget::highlightUnsafe() {
|
void ImportsWidget::highlightUnsafe()
|
||||||
|
{
|
||||||
Banned *ban = new Banned();
|
Banned *ban = new Banned();
|
||||||
QList<QTreeWidgetItem *> clist = this->importsTreeWidget->findItems(ban->banned, Qt::MatchRegExp, 4);
|
QList<QTreeWidgetItem *> clist = this->importsTreeWidget->findItems(ban->banned, Qt::MatchRegExp, 4);
|
||||||
foreach (QTreeWidgetItem *item, clist)
|
foreach (QTreeWidgetItem *item, clist)
|
||||||
@ -68,9 +71,11 @@ void ImportsWidget::highlightUnsafe() {
|
|||||||
//ui->importsTreeWidget->setStyleSheet("QTreeWidget::item { padding-left:10px; padding-top: 1px; padding-bottom: 1px; border-left: 10px; }");
|
//ui->importsTreeWidget->setStyleSheet("QTreeWidget::item { padding-left:10px; padding-top: 1px; padding-bottom: 1px; border-left: 10px; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportsWidget::adjustColumns(QTreeWidget *tw) {
|
void ImportsWidget::adjustColumns(QTreeWidget *tw)
|
||||||
|
{
|
||||||
int count = tw->columnCount();
|
int count = tw->columnCount();
|
||||||
for (int i = 0; i != count; ++i) {
|
for (int i = 0; i != count; ++i)
|
||||||
|
{
|
||||||
ui->importsTreeWidget->resizeColumnToContents(i);
|
ui->importsTreeWidget->resizeColumnToContents(i);
|
||||||
int width = ui->importsTreeWidget->columnWidth(i);
|
int width = ui->importsTreeWidget->columnWidth(i);
|
||||||
ui->importsTreeWidget->setColumnWidth(i, width + 10);
|
ui->importsTreeWidget->setColumnWidth(i, width + 10);
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class ImportsWidget;
|
class ImportsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class MemoryWidget;
|
class MemoryWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ Notepad::Notepad(MainWindow *main, QWidget *parent) :
|
|||||||
this, SLOT(showNotepadContextMenu(const QPoint &)));
|
this, SLOT(showNotepadContextMenu(const QPoint &)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad::setText(QString str) {
|
void Notepad::setText(QString str)
|
||||||
|
{
|
||||||
ui->notepadTextEdit->setPlainText(str);
|
ui->notepadTextEdit->setPlainText(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +51,8 @@ void Notepad::on_fontButton_clicked()
|
|||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
QFont font = QFontDialog::getFont(&ok, ui->notepadTextEdit->font(), this) ;
|
QFont font = QFontDialog::getFont(&ok, ui->notepadTextEdit->font(), this) ;
|
||||||
if (ok) {
|
if (ok)
|
||||||
|
{
|
||||||
// the user clicked OK and font is set to the font the user selected
|
// the user clicked OK and font is set to the font the user selected
|
||||||
//ui->notepadTextEdit->setFont(font);
|
//ui->notepadTextEdit->setFont(font);
|
||||||
//ui->previewTextEdit->setFont(font);
|
//ui->previewTextEdit->setFont(font);
|
||||||
@ -58,7 +60,8 @@ void Notepad::on_fontButton_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad::setFonts(QFont font) {
|
void Notepad::setFonts(QFont font)
|
||||||
|
{
|
||||||
ui->notepadTextEdit->setFont(font);
|
ui->notepadTextEdit->setFont(font);
|
||||||
ui->previewTextEdit->setFont(font);
|
ui->previewTextEdit->setFont(font);
|
||||||
}
|
}
|
||||||
@ -66,11 +69,14 @@ void Notepad::setFonts(QFont font) {
|
|||||||
void Notepad::on_boldButton_clicked()
|
void Notepad::on_boldButton_clicked()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
||||||
if (cursor.hasSelection()) {
|
if (cursor.hasSelection())
|
||||||
|
{
|
||||||
QString text = cursor.selectedText();
|
QString text = cursor.selectedText();
|
||||||
cursor.removeSelectedText();
|
cursor.removeSelectedText();
|
||||||
cursor.insertText("**" + text + "**");
|
cursor.insertText("**" + text + "**");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cursor.insertText("****");
|
cursor.insertText("****");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,11 +84,14 @@ void Notepad::on_boldButton_clicked()
|
|||||||
void Notepad::on_italicsButton_clicked()
|
void Notepad::on_italicsButton_clicked()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
||||||
if (cursor.hasSelection()) {
|
if (cursor.hasSelection())
|
||||||
|
{
|
||||||
QString text = cursor.selectedText();
|
QString text = cursor.selectedText();
|
||||||
cursor.removeSelectedText();
|
cursor.removeSelectedText();
|
||||||
cursor.insertText("*" + text + "*");
|
cursor.insertText("*" + text + "*");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cursor.insertText("**");
|
cursor.insertText("**");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,11 +99,14 @@ void Notepad::on_italicsButton_clicked()
|
|||||||
void Notepad::on_h1Button_clicked()
|
void Notepad::on_h1Button_clicked()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
||||||
if (cursor.hasSelection()) {
|
if (cursor.hasSelection())
|
||||||
|
{
|
||||||
QString text = cursor.selectedText();
|
QString text = cursor.selectedText();
|
||||||
cursor.removeSelectedText();
|
cursor.removeSelectedText();
|
||||||
cursor.insertText("# " + text);
|
cursor.insertText("# " + text);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cursor.insertText("# ");
|
cursor.insertText("# ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,11 +114,14 @@ void Notepad::on_h1Button_clicked()
|
|||||||
void Notepad::on_h2Button_clicked()
|
void Notepad::on_h2Button_clicked()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
||||||
if (cursor.hasSelection()) {
|
if (cursor.hasSelection())
|
||||||
|
{
|
||||||
QString text = cursor.selectedText();
|
QString text = cursor.selectedText();
|
||||||
cursor.removeSelectedText();
|
cursor.removeSelectedText();
|
||||||
cursor.insertText("## " + text);
|
cursor.insertText("## " + text);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cursor.insertText("## ");
|
cursor.insertText("## ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,11 +129,14 @@ void Notepad::on_h2Button_clicked()
|
|||||||
void Notepad::on_h3Button_clicked()
|
void Notepad::on_h3Button_clicked()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
QTextCursor cursor = ui->notepadTextEdit->textCursor();
|
||||||
if (cursor.hasSelection()) {
|
if (cursor.hasSelection())
|
||||||
|
{
|
||||||
QString text = cursor.selectedText();
|
QString text = cursor.selectedText();
|
||||||
cursor.removeSelectedText();
|
cursor.removeSelectedText();
|
||||||
cursor.insertText("### " + text);
|
cursor.insertText("### " + text);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cursor.insertText("### ");
|
cursor.insertText("### ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,7 +168,8 @@ void Notepad::on_searchEdit_returnPressed()
|
|||||||
if (isFirstTime == false)
|
if (isFirstTime == false)
|
||||||
document->undo();
|
document->undo();
|
||||||
|
|
||||||
if (!searchString.isEmpty()) {
|
if (!searchString.isEmpty())
|
||||||
|
{
|
||||||
|
|
||||||
QTextCursor highlightCursor(document);
|
QTextCursor highlightCursor(document);
|
||||||
QTextCursor cursor(document);
|
QTextCursor cursor(document);
|
||||||
@ -161,10 +180,12 @@ void Notepad::on_searchEdit_returnPressed()
|
|||||||
QTextCharFormat colorFormat = plainFormat;
|
QTextCharFormat colorFormat = plainFormat;
|
||||||
colorFormat.setForeground(Qt::red);
|
colorFormat.setForeground(Qt::red);
|
||||||
|
|
||||||
while (!highlightCursor.isNull() && !highlightCursor.atEnd()) {
|
while (!highlightCursor.isNull() && !highlightCursor.atEnd())
|
||||||
|
{
|
||||||
highlightCursor = document->find(searchString, highlightCursor, QTextDocument::FindWholeWords);
|
highlightCursor = document->find(searchString, highlightCursor, QTextDocument::FindWholeWords);
|
||||||
|
|
||||||
if (!highlightCursor.isNull()) {
|
if (!highlightCursor.isNull())
|
||||||
|
{
|
||||||
highlightCursor.movePosition(QTextCursor::WordRight,
|
highlightCursor.movePosition(QTextCursor::WordRight,
|
||||||
QTextCursor::KeepAnchor);
|
QTextCursor::KeepAnchor);
|
||||||
highlightCursor.mergeCharFormat(colorFormat);
|
highlightCursor.mergeCharFormat(colorFormat);
|
||||||
@ -186,7 +207,8 @@ void Notepad::on_searchEdit_textEdited(const QString &arg1)
|
|||||||
if (isFirstTime == false)
|
if (isFirstTime == false)
|
||||||
document->undo();
|
document->undo();
|
||||||
|
|
||||||
if (!searchString.isEmpty()) {
|
if (!searchString.isEmpty())
|
||||||
|
{
|
||||||
|
|
||||||
QTextCursor highlightCursor(document);
|
QTextCursor highlightCursor(document);
|
||||||
QTextCursor cursor(document);
|
QTextCursor cursor(document);
|
||||||
@ -197,10 +219,12 @@ void Notepad::on_searchEdit_textEdited(const QString &arg1)
|
|||||||
QTextCharFormat colorFormat = plainFormat;
|
QTextCharFormat colorFormat = plainFormat;
|
||||||
colorFormat.setForeground(Qt::red);
|
colorFormat.setForeground(Qt::red);
|
||||||
|
|
||||||
while (!highlightCursor.isNull() && !highlightCursor.atEnd()) {
|
while (!highlightCursor.isNull() && !highlightCursor.atEnd())
|
||||||
|
{
|
||||||
highlightCursor = document->find(searchString, highlightCursor);
|
highlightCursor = document->find(searchString, highlightCursor);
|
||||||
|
|
||||||
if (!highlightCursor.isNull()) {
|
if (!highlightCursor.isNull())
|
||||||
|
{
|
||||||
//highlightCursor.movePosition(QTextCursor::WordRight,
|
//highlightCursor.movePosition(QTextCursor::WordRight,
|
||||||
// QTextCursor::KeepAnchor);
|
// QTextCursor::KeepAnchor);
|
||||||
highlightCursor.mergeCharFormat(colorFormat);
|
highlightCursor.mergeCharFormat(colorFormat);
|
||||||
@ -222,7 +246,8 @@ void Notepad::on_searchEdit_textChanged(const QString &arg1)
|
|||||||
if (isFirstTime == false)
|
if (isFirstTime == false)
|
||||||
document->undo();
|
document->undo();
|
||||||
|
|
||||||
if (!searchString.isEmpty()) {
|
if (!searchString.isEmpty())
|
||||||
|
{
|
||||||
|
|
||||||
QTextCursor highlightCursor(document);
|
QTextCursor highlightCursor(document);
|
||||||
QTextCursor cursor(document);
|
QTextCursor cursor(document);
|
||||||
@ -233,10 +258,12 @@ void Notepad::on_searchEdit_textChanged(const QString &arg1)
|
|||||||
QTextCharFormat colorFormat = plainFormat;
|
QTextCharFormat colorFormat = plainFormat;
|
||||||
colorFormat.setForeground(Qt::red);
|
colorFormat.setForeground(Qt::red);
|
||||||
|
|
||||||
while (!highlightCursor.isNull() && !highlightCursor.atEnd()) {
|
while (!highlightCursor.isNull() && !highlightCursor.atEnd())
|
||||||
|
{
|
||||||
highlightCursor = document->find(searchString, highlightCursor);
|
highlightCursor = document->find(searchString, highlightCursor);
|
||||||
|
|
||||||
if (!highlightCursor.isNull()) {
|
if (!highlightCursor.isNull())
|
||||||
|
{
|
||||||
//highlightCursor.movePosition(QTextCursor::WordRight,
|
//highlightCursor.movePosition(QTextCursor::WordRight,
|
||||||
// QTextCursor::KeepAnchor);
|
// QTextCursor::KeepAnchor);
|
||||||
highlightCursor.mergeCharFormat(colorFormat);
|
highlightCursor.mergeCharFormat(colorFormat);
|
||||||
@ -255,11 +282,14 @@ void Notepad::showNotepadContextMenu(const QPoint &pt)
|
|||||||
QTextCursor cur = ui->notepadTextEdit->textCursor();
|
QTextCursor cur = ui->notepadTextEdit->textCursor();
|
||||||
QAction *first = menu->actions().at(0);
|
QAction *first = menu->actions().at(0);
|
||||||
|
|
||||||
if (cur.hasSelection()) {
|
if (cur.hasSelection())
|
||||||
|
{
|
||||||
// Get selected text
|
// Get selected text
|
||||||
//this->main->add_debug_output("Selected text: " + cur.selectedText());
|
//this->main->add_debug_output("Selected text: " + cur.selectedText());
|
||||||
this->addr = cur.selectedText();
|
this->addr = cur.selectedText();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Get word under the cursor
|
// Get word under the cursor
|
||||||
cur.select(QTextCursor::WordUnderCursor);
|
cur.select(QTextCursor::WordUnderCursor);
|
||||||
//this->main->add_debug_output("Word: " + cur.selectedText());
|
//this->main->add_debug_output("Word: " + cur.selectedText());
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class Notepad;
|
class Notepad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,8 @@ Omnibar::Omnibar(MainWindow *main, QWidget *parent) :
|
|||||||
clear_shortcut->setContext(Qt::WidgetShortcut);
|
clear_shortcut->setContext(Qt::WidgetShortcut);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Omnibar::setupCompleter() {
|
void Omnibar::setupCompleter()
|
||||||
|
{
|
||||||
// Set gotoEntry completer for jump history
|
// Set gotoEntry completer for jump history
|
||||||
QStringList flagsList = this->getFlags();
|
QStringList flagsList = this->getFlags();
|
||||||
QCompleter *completer = new QCompleter(flagsList, this);
|
QCompleter *completer = new QCompleter(flagsList, this);
|
||||||
@ -66,7 +67,8 @@ void Omnibar::restoreCompleter()
|
|||||||
completer->setFilterMode(Qt::MatchContains);
|
completer->setFilterMode(Qt::MatchContains);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Omnibar::showCommands() {
|
void Omnibar::showCommands()
|
||||||
|
{
|
||||||
this->setFocus();
|
this->setFocus();
|
||||||
this->setText(": ");
|
this->setText(": ");
|
||||||
|
|
||||||
@ -82,7 +84,8 @@ void Omnibar::showCommands() {
|
|||||||
completer->complete();
|
completer->complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Omnibar::clearContents() {
|
void Omnibar::clearContents()
|
||||||
|
{
|
||||||
this->setText("");
|
this->setText("");
|
||||||
// Necessary hack to make it work properly
|
// Necessary hack to make it work properly
|
||||||
this->clearFocus();
|
this->clearFocus();
|
||||||
@ -92,38 +95,69 @@ void Omnibar::clearContents() {
|
|||||||
void Omnibar::on_gotoEntry_returnPressed()
|
void Omnibar::on_gotoEntry_returnPressed()
|
||||||
{
|
{
|
||||||
QString str = this->text();
|
QString str = this->text();
|
||||||
if (str.length()>0) {
|
if (str.length() > 0)
|
||||||
if (str.contains(": ")) {
|
{
|
||||||
if (str.contains("Lock")){
|
if (str.contains(": "))
|
||||||
|
{
|
||||||
|
if (str.contains("Lock"))
|
||||||
|
{
|
||||||
this->main->on_actionLock_triggered();
|
this->main->on_actionLock_triggered();
|
||||||
} else if (str.contains("Functions")) {
|
}
|
||||||
|
else if (str.contains("Functions"))
|
||||||
|
{
|
||||||
this->main->on_actionFunctions_triggered();
|
this->main->on_actionFunctions_triggered();
|
||||||
} else if (str.contains("Flags")) {
|
}
|
||||||
|
else if (str.contains("Flags"))
|
||||||
|
{
|
||||||
this->main->on_actionFlags_triggered();
|
this->main->on_actionFlags_triggered();
|
||||||
} else if (str.contains("Sections")) {
|
}
|
||||||
|
else if (str.contains("Sections"))
|
||||||
|
{
|
||||||
this->main->on_actionSections_triggered();
|
this->main->on_actionSections_triggered();
|
||||||
} else if (str.contains("Strings")) {
|
}
|
||||||
|
else if (str.contains("Strings"))
|
||||||
|
{
|
||||||
this->main->on_actionStrings_triggered();
|
this->main->on_actionStrings_triggered();
|
||||||
} else if (str.contains("Imports")) {
|
}
|
||||||
|
else if (str.contains("Imports"))
|
||||||
|
{
|
||||||
this->main->on_actionImports_triggered();
|
this->main->on_actionImports_triggered();
|
||||||
} else if (str.contains("Symbols")) {
|
}
|
||||||
|
else if (str.contains("Symbols"))
|
||||||
|
{
|
||||||
this->main->on_actionSymbols_triggered();
|
this->main->on_actionSymbols_triggered();
|
||||||
} else if (str.contains("Relocs")) {
|
}
|
||||||
|
else if (str.contains("Relocs"))
|
||||||
|
{
|
||||||
this->main->on_actionReloc_triggered();
|
this->main->on_actionReloc_triggered();
|
||||||
} else if (str.contains("Comments")) {
|
}
|
||||||
|
else if (str.contains("Comments"))
|
||||||
|
{
|
||||||
this->main->on_actionComents_triggered();
|
this->main->on_actionComents_triggered();
|
||||||
} else if (str.contains("Notepad")) {
|
}
|
||||||
|
else if (str.contains("Notepad"))
|
||||||
|
{
|
||||||
this->main->on_actionNotepad_triggered();
|
this->main->on_actionNotepad_triggered();
|
||||||
} else if (str.contains("Dashboard")) {
|
}
|
||||||
|
else if (str.contains("Dashboard"))
|
||||||
|
{
|
||||||
this->main->on_actionDashboard_triggered();
|
this->main->on_actionDashboard_triggered();
|
||||||
} else if (str.contains("Theme")) {
|
}
|
||||||
|
else if (str.contains("Theme"))
|
||||||
|
{
|
||||||
this->main->sideBar->themesButtonToggle();
|
this->main->sideBar->themesButtonToggle();
|
||||||
} else if (str.contains("Script")) {
|
}
|
||||||
|
else if (str.contains("Script"))
|
||||||
|
{
|
||||||
this->main->on_actionRun_Script_triggered();
|
this->main->on_actionRun_Script_triggered();
|
||||||
} else if (str.contains("Tabs")) {
|
}
|
||||||
|
else if (str.contains("Tabs"))
|
||||||
|
{
|
||||||
this->main->on_actionTabs_triggered();
|
this->main->on_actionTabs_triggered();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
//this->main->seek(this->main->core->cmd("?v " + this->text()), this->text());
|
//this->main->seek(this->main->core->cmd("?v " + this->text()), this->text());
|
||||||
QString off = this->main->core->cmd("afo " + this->text());
|
QString off = this->main->core->cmd("afo " + this->text());
|
||||||
this->main->seek(off.trimmed(), this->text());
|
this->main->seek(off.trimmed(), this->text());
|
||||||
@ -137,14 +171,17 @@ void Omnibar::on_gotoEntry_returnPressed()
|
|||||||
this->restoreCompleter();
|
this->restoreCompleter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Omnibar::fillFlags(QString flag) {
|
void Omnibar::fillFlags(QString flag)
|
||||||
|
{
|
||||||
this->flags << flag;
|
this->flags << flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Omnibar::clearFlags() {
|
void Omnibar::clearFlags()
|
||||||
|
{
|
||||||
this->flags.clear();
|
this->flags.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Omnibar::getFlags() {
|
QStringList Omnibar::getFlags()
|
||||||
|
{
|
||||||
return this->flags;
|
return this->flags;
|
||||||
}
|
}
|
||||||
|
@ -74,12 +74,14 @@ void PieView::dataChanged(const QModelIndex &topLeft,
|
|||||||
validItems = 0;
|
validItems = 0;
|
||||||
totalValue = 0.0;
|
totalValue = 0.0;
|
||||||
|
|
||||||
for (int row = 0; row < model()->rowCount(rootIndex()); ++row) {
|
for (int row = 0; row < model()->rowCount(rootIndex()); ++row)
|
||||||
|
{
|
||||||
|
|
||||||
QModelIndex index = model()->index(row, 1, rootIndex());
|
QModelIndex index = model()->index(row, 1, rootIndex());
|
||||||
double value = model()->data(index).toDouble();
|
double value = model()->data(index).toDouble();
|
||||||
|
|
||||||
if (value > 0.0) {
|
if (value > 0.0)
|
||||||
|
{
|
||||||
totalValue += value;
|
totalValue += value;
|
||||||
validItems++;
|
validItems++;
|
||||||
}
|
}
|
||||||
@ -108,7 +110,8 @@ QModelIndex PieView::indexAt(const QPoint &point) const
|
|||||||
int wx = point.x() + horizontalScrollBar()->value();
|
int wx = point.x() + horizontalScrollBar()->value();
|
||||||
int wy = point.y() + verticalScrollBar()->value();
|
int wy = point.y() + verticalScrollBar()->value();
|
||||||
|
|
||||||
if (wx < totalSize) {
|
if (wx < totalSize)
|
||||||
|
{
|
||||||
double cx = wx - totalSize / 2;
|
double cx = wx - totalSize / 2;
|
||||||
double cy = totalSize / 2 - wy; // positive cy for items above the center
|
double cy = totalSize / 2 - wy; // positive cy for items above the center
|
||||||
|
|
||||||
@ -126,12 +129,14 @@ QModelIndex PieView::indexAt(const QPoint &point) const
|
|||||||
// Find the relevant slice of the pie.
|
// Find the relevant slice of the pie.
|
||||||
double startAngle = 0.0;
|
double startAngle = 0.0;
|
||||||
|
|
||||||
for (int row = 0; row < model()->rowCount(rootIndex()); ++row) {
|
for (int row = 0; row < model()->rowCount(rootIndex()); ++row)
|
||||||
|
{
|
||||||
|
|
||||||
QModelIndex index = model()->index(row, 1, rootIndex());
|
QModelIndex index = model()->index(row, 1, rootIndex());
|
||||||
double value = model()->data(index).toDouble();
|
double value = model()->data(index).toDouble();
|
||||||
|
|
||||||
if (value > 0.0) {
|
if (value > 0.0)
|
||||||
|
{
|
||||||
double sliceAngle = 360 * value / totalValue;
|
double sliceAngle = 360 * value / totalValue;
|
||||||
|
|
||||||
if (angle >= startAngle && angle < (startAngle + sliceAngle))
|
if (angle >= startAngle && angle < (startAngle + sliceAngle))
|
||||||
@ -140,15 +145,19 @@ QModelIndex PieView::indexAt(const QPoint &point) const
|
|||||||
startAngle += sliceAngle;
|
startAngle += sliceAngle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
double itemHeight = QFontMetrics(viewOptions().font).height();
|
double itemHeight = QFontMetrics(viewOptions().font).height();
|
||||||
int listItem = int((wy - margin) / itemHeight);
|
int listItem = int((wy - margin) / itemHeight);
|
||||||
int validRow = 0;
|
int validRow = 0;
|
||||||
|
|
||||||
for (int row = 0; row < model()->rowCount(rootIndex()); ++row) {
|
for (int row = 0; row < model()->rowCount(rootIndex()); ++row)
|
||||||
|
{
|
||||||
|
|
||||||
QModelIndex index = model()->index(row, 1, rootIndex());
|
QModelIndex index = model()->index(row, 1, rootIndex());
|
||||||
if (model()->data(index).toDouble() > 0.0) {
|
if (model()->data(index).toDouble() > 0.0)
|
||||||
|
{
|
||||||
|
|
||||||
if (listItem == validRow)
|
if (listItem == validRow)
|
||||||
return model()->index(row, 0, rootIndex());
|
return model()->index(row, 0, rootIndex());
|
||||||
@ -191,14 +200,16 @@ QRect PieView::itemRect(const QModelIndex &index) const
|
|||||||
return QRect();
|
return QRect();
|
||||||
|
|
||||||
int listItem = 0;
|
int listItem = 0;
|
||||||
for (int row = index.row()-1; row >= 0; --row) {
|
for (int row = index.row() - 1; row >= 0; --row)
|
||||||
|
{
|
||||||
if (model()->data(model()->index(row, 1, rootIndex())).toDouble() > 0.0)
|
if (model()->data(model()->index(row, 1, rootIndex())).toDouble() > 0.0)
|
||||||
listItem++;
|
listItem++;
|
||||||
}
|
}
|
||||||
|
|
||||||
double itemHeight;
|
double itemHeight;
|
||||||
|
|
||||||
switch (index.column()) {
|
switch (index.column())
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
itemHeight = QFontMetrics(viewOptions().font).height();
|
itemHeight = QFontMetrics(viewOptions().font).height();
|
||||||
|
|
||||||
@ -223,15 +234,18 @@ QRegion PieView::itemRegion(const QModelIndex &index) const
|
|||||||
return QRegion();
|
return QRegion();
|
||||||
|
|
||||||
double startAngle = 0.0;
|
double startAngle = 0.0;
|
||||||
for (int row = 0; row < model()->rowCount(rootIndex()); ++row) {
|
for (int row = 0; row < model()->rowCount(rootIndex()); ++row)
|
||||||
|
{
|
||||||
|
|
||||||
QModelIndex sliceIndex = model()->index(row, 1, rootIndex());
|
QModelIndex sliceIndex = model()->index(row, 1, rootIndex());
|
||||||
double value = model()->data(sliceIndex).toDouble();
|
double value = model()->data(sliceIndex).toDouble();
|
||||||
|
|
||||||
if (value > 0.0) {
|
if (value > 0.0)
|
||||||
|
{
|
||||||
double angle = 360 * value / totalValue;
|
double angle = 360 * value / totalValue;
|
||||||
|
|
||||||
if (sliceIndex == index) {
|
if (sliceIndex == index)
|
||||||
|
{
|
||||||
QPainterPath slicePath;
|
QPainterPath slicePath;
|
||||||
slicePath.moveTo(totalSize / 2, totalSize / 2);
|
slicePath.moveTo(totalSize / 2, totalSize / 2);
|
||||||
slicePath.arcTo(margin, margin, margin + pieSize, margin + pieSize,
|
slicePath.arcTo(margin, margin, margin + pieSize, margin + pieSize,
|
||||||
@ -283,7 +297,8 @@ QModelIndex PieView::moveCursor(QAbstractItemView::CursorAction cursorAction,
|
|||||||
{
|
{
|
||||||
QModelIndex current = currentIndex();
|
QModelIndex current = currentIndex();
|
||||||
|
|
||||||
switch (cursorAction) {
|
switch (cursorAction)
|
||||||
|
{
|
||||||
case MoveLeft:
|
case MoveLeft:
|
||||||
case MoveUp:
|
case MoveUp:
|
||||||
if (current.row() > 0)
|
if (current.row() > 0)
|
||||||
@ -341,11 +356,13 @@ void PieView::paintEvent(QPaintEvent *event)
|
|||||||
double startAngle = 0.0;
|
double startAngle = 0.0;
|
||||||
int row;
|
int row;
|
||||||
|
|
||||||
for (row = 0; row < model()->rowCount(rootIndex()); ++row) {
|
for (row = 0; row < model()->rowCount(rootIndex()); ++row)
|
||||||
|
{
|
||||||
QModelIndex index = model()->index(row, 1, rootIndex());
|
QModelIndex index = model()->index(row, 1, rootIndex());
|
||||||
double value = model()->data(index).toDouble();
|
double value = model()->data(index).toDouble();
|
||||||
|
|
||||||
if (value > 0.0) {
|
if (value > 0.0)
|
||||||
|
{
|
||||||
double angle = 360 * value / totalValue;
|
double angle = 360 * value / totalValue;
|
||||||
|
|
||||||
QModelIndex colorIndex = model()->index(row, 0, rootIndex());
|
QModelIndex colorIndex = model()->index(row, 0, rootIndex());
|
||||||
@ -387,11 +404,13 @@ int PieView::rows(const QModelIndex &index) const
|
|||||||
|
|
||||||
void PieView::rowsInserted(const QModelIndex &parent, int start, int end)
|
void PieView::rowsInserted(const QModelIndex &parent, int start, int end)
|
||||||
{
|
{
|
||||||
for (int row = start; row <= end; ++row) {
|
for (int row = start; row <= end; ++row)
|
||||||
|
{
|
||||||
QModelIndex index = model()->index(row, 1, rootIndex());
|
QModelIndex index = model()->index(row, 1, rootIndex());
|
||||||
double value = model()->data(index).toDouble();
|
double value = model()->data(index).toDouble();
|
||||||
|
|
||||||
if (value > 0.0) {
|
if (value > 0.0)
|
||||||
|
{
|
||||||
totalValue += value;
|
totalValue += value;
|
||||||
++validItems;
|
++validItems;
|
||||||
}
|
}
|
||||||
@ -402,10 +421,12 @@ void PieView::rowsInserted(const QModelIndex &parent, int start, int end)
|
|||||||
|
|
||||||
void PieView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
void PieView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
|
||||||
{
|
{
|
||||||
for (int row = start; row <= end; ++row) {
|
for (int row = start; row <= end; ++row)
|
||||||
|
{
|
||||||
QModelIndex index = model()->index(row, 1, rootIndex());
|
QModelIndex index = model()->index(row, 1, rootIndex());
|
||||||
double value = model()->data(index).toDouble();
|
double value = model()->data(index).toDouble();
|
||||||
if (value > 0.0) {
|
if (value > 0.0)
|
||||||
|
{
|
||||||
totalValue -= value;
|
totalValue -= value;
|
||||||
--validItems;
|
--validItems;
|
||||||
}
|
}
|
||||||
@ -424,19 +445,25 @@ void PieView::scrollTo(const QModelIndex &index, ScrollHint)
|
|||||||
QRect area = viewport()->rect();
|
QRect area = viewport()->rect();
|
||||||
QRect rect = visualRect(index);
|
QRect rect = visualRect(index);
|
||||||
|
|
||||||
if (rect.left() < area.left()) {
|
if (rect.left() < area.left())
|
||||||
|
{
|
||||||
horizontalScrollBar()->setValue(
|
horizontalScrollBar()->setValue(
|
||||||
horizontalScrollBar()->value() + rect.left() - area.left());
|
horizontalScrollBar()->value() + rect.left() - area.left());
|
||||||
} else if (rect.right() > area.right()) {
|
}
|
||||||
|
else if (rect.right() > area.right())
|
||||||
|
{
|
||||||
horizontalScrollBar()->setValue(
|
horizontalScrollBar()->setValue(
|
||||||
horizontalScrollBar()->value() + qMin(
|
horizontalScrollBar()->value() + qMin(
|
||||||
rect.right() - area.right(), rect.left() - area.left()));
|
rect.right() - area.right(), rect.left() - area.left()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rect.top() < area.top()) {
|
if (rect.top() < area.top())
|
||||||
|
{
|
||||||
verticalScrollBar()->setValue(
|
verticalScrollBar()->setValue(
|
||||||
verticalScrollBar()->value() + rect.top() - area.top());
|
verticalScrollBar()->value() + rect.top() - area.top());
|
||||||
} else if (rect.bottom() > area.bottom()) {
|
}
|
||||||
|
else if (rect.bottom() > area.bottom())
|
||||||
|
{
|
||||||
verticalScrollBar()->setValue(
|
verticalScrollBar()->setValue(
|
||||||
verticalScrollBar()->value() + qMin(
|
verticalScrollBar()->value() + qMin(
|
||||||
rect.bottom() - area.bottom(), rect.top() - area.top()));
|
rect.bottom() - area.bottom(), rect.top() - area.top()));
|
||||||
@ -464,8 +491,10 @@ void PieView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlag
|
|||||||
int columns = model()->columnCount(rootIndex());
|
int columns = model()->columnCount(rootIndex());
|
||||||
QModelIndexList indexes;
|
QModelIndexList indexes;
|
||||||
|
|
||||||
for (int row = 0; row < rows; ++row) {
|
for (int row = 0; row < rows; ++row)
|
||||||
for (int column = 0; column < columns; ++column) {
|
{
|
||||||
|
for (int column = 0; column < columns; ++column)
|
||||||
|
{
|
||||||
QModelIndex index = model()->index(row, column, rootIndex());
|
QModelIndex index = model()->index(row, column, rootIndex());
|
||||||
QRegion region = itemRegion(index);
|
QRegion region = itemRegion(index);
|
||||||
if (region.intersects(contentsRect))
|
if (region.intersects(contentsRect))
|
||||||
@ -473,13 +502,15 @@ void PieView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexes.size() > 0) {
|
if (indexes.size() > 0)
|
||||||
|
{
|
||||||
int firstRow = indexes[0].row();
|
int firstRow = indexes[0].row();
|
||||||
int lastRow = indexes[0].row();
|
int lastRow = indexes[0].row();
|
||||||
int firstColumn = indexes[0].column();
|
int firstColumn = indexes[0].column();
|
||||||
int lastColumn = indexes[0].column();
|
int lastColumn = indexes[0].column();
|
||||||
|
|
||||||
for (int i = 1; i < indexes.size(); ++i) {
|
for (int i = 1; i < indexes.size(); ++i)
|
||||||
|
{
|
||||||
firstRow = qMin(firstRow, indexes[i].row());
|
firstRow = qMin(firstRow, indexes[i].row());
|
||||||
lastRow = qMax(lastRow, indexes[i].row());
|
lastRow = qMax(lastRow, indexes[i].row());
|
||||||
firstColumn = qMin(firstColumn, indexes[i].column());
|
firstColumn = qMin(firstColumn, indexes[i].column());
|
||||||
@ -490,7 +521,9 @@ void PieView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlag
|
|||||||
model()->index(firstRow, firstColumn, rootIndex()),
|
model()->index(firstRow, firstColumn, rootIndex()),
|
||||||
model()->index(lastRow, lastColumn, rootIndex()));
|
model()->index(lastRow, lastColumn, rootIndex()));
|
||||||
selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QModelIndex noIndex;
|
QModelIndex noIndex;
|
||||||
QItemSelection selection(noIndex, noIndex);
|
QItemSelection selection(noIndex, noIndex);
|
||||||
selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||||
@ -543,10 +576,13 @@ QRegion PieView::visualRegionForSelection(const QItemSelection &selection) const
|
|||||||
return QRect();
|
return QRect();
|
||||||
|
|
||||||
QRegion region;
|
QRegion region;
|
||||||
for (int i = 0; i < ranges; ++i) {
|
for (int i = 0; i < ranges; ++i)
|
||||||
|
{
|
||||||
QItemSelectionRange range = selection.at(i);
|
QItemSelectionRange range = selection.at(i);
|
||||||
for (int row = range.top(); row <= range.bottom(); ++row) {
|
for (int row = range.top(); row <= range.bottom(); ++row)
|
||||||
for (int col = range.left(); col <= range.right(); ++col) {
|
{
|
||||||
|
for (int col = range.left(); col <= range.right(); ++col)
|
||||||
|
{
|
||||||
QModelIndex index = model()->index(row, col, rootIndex());
|
QModelIndex index = model()->index(row, col, rootIndex());
|
||||||
region += visualRect(index);
|
region += visualRect(index);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class RelocsWidget;
|
class RelocsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,8 @@ void SdbDock::reload(QString path)
|
|||||||
QList<QString> keys;
|
QList<QString> keys;
|
||||||
/* key-values */
|
/* key-values */
|
||||||
keys = main->core->sdbListKeys(path);
|
keys = main->core->sdbListKeys(path);
|
||||||
foreach (QString key, keys) {
|
foreach (QString key, keys)
|
||||||
|
{
|
||||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||||
tempItem->setText(0, key);
|
tempItem->setText(0, key);
|
||||||
tempItem->setText(1, main->core->sdbGet(path, key));
|
tempItem->setText(1, main->core->sdbGet(path, key));
|
||||||
@ -37,7 +38,8 @@ void SdbDock::reload(QString path)
|
|||||||
/* namespaces */
|
/* namespaces */
|
||||||
keys = main->core->sdbList(path);
|
keys = main->core->sdbList(path);
|
||||||
keys.append("..");
|
keys.append("..");
|
||||||
foreach (QString key, keys) {
|
foreach (QString key, keys)
|
||||||
|
{
|
||||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||||
tempItem->setText(0, key + "/");
|
tempItem->setText(0, key + "/");
|
||||||
tempItem->setText(1, "");
|
tempItem->setText(1, "");
|
||||||
@ -52,27 +54,37 @@ void SdbDock::on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
|||||||
{
|
{
|
||||||
QString newpath;
|
QString newpath;
|
||||||
|
|
||||||
if (column == 0) {
|
if (column == 0)
|
||||||
if (item->text(0) == "../") {
|
{
|
||||||
|
if (item->text(0) == "../")
|
||||||
|
{
|
||||||
int idx = path.lastIndexOf("/");
|
int idx = path.lastIndexOf("/");
|
||||||
if (idx != -1) {
|
if (idx != -1)
|
||||||
|
{
|
||||||
newpath = path.mid(0, idx);
|
newpath = path.mid(0, idx);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
newpath = "";
|
newpath = "";
|
||||||
}
|
}
|
||||||
reload(newpath);
|
reload(newpath);
|
||||||
|
|
||||||
} else
|
}
|
||||||
if (item->text(0).indexOf("/")!=-1) {
|
else if (item->text(0).indexOf("/") != -1)
|
||||||
if (path != "") {
|
{
|
||||||
|
if (path != "")
|
||||||
|
{
|
||||||
newpath = path + "/" + item->text(0).replace("/", "");
|
newpath = path + "/" + item->text(0).replace("/", "");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
newpath = path + item->text(0).replace("/", "");
|
newpath = path + item->text(0).replace("/", "");
|
||||||
}
|
}
|
||||||
// enter directory
|
// enter directory
|
||||||
reload(newpath);
|
reload(newpath);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
//__alert ("TODO: change value");
|
//__alert ("TODO: change value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +101,9 @@ void SdbDock::on_lockButton_clicked()
|
|||||||
{
|
{
|
||||||
this->setAllowedAreas(Qt::NoDockWidgetArea);
|
this->setAllowedAreas(Qt::NoDockWidgetArea);
|
||||||
ui->lockButton->setIcon(QIcon(":/new/prefix1/lock"));
|
ui->lockButton->setIcon(QIcon(":/new/prefix1/lock"));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->setAllowedAreas(Qt::AllDockWidgetAreas);
|
this->setAllowedAreas(Qt::AllDockWidgetAreas);
|
||||||
ui->lockButton->setIcon(QIcon(":/new/prefix1/unlock"));
|
ui->lockButton->setIcon(QIcon(":/new/prefix1/unlock"));
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class SdbDock;
|
class SdbDock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,24 +89,32 @@ void SectionsWidget::fillSections(int row, const QString &str, const QString &st
|
|||||||
this->tree->insertTopLevelItem(0, tempItem);
|
this->tree->insertTopLevelItem(0, tempItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SectionsWidget::adjustColumns() {
|
void SectionsWidget::adjustColumns()
|
||||||
|
{
|
||||||
int count = 4;
|
int count = 4;
|
||||||
for (int i = 0; i != count; ++i) {
|
for (int i = 0; i != count; ++i)
|
||||||
|
{
|
||||||
this->tree->resizeColumnToContents(i);
|
this->tree->resizeColumnToContents(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SectionsWidget::eventFilter(QObject *obj, QEvent *event) {
|
bool SectionsWidget::eventFilter(QObject *obj, QEvent *event)
|
||||||
if (this->main->responsive) {
|
{
|
||||||
if (event->type() == QEvent::Resize && obj == this && this->isVisible()) {
|
if (this->main->responsive)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::Resize && obj == this && this->isVisible())
|
||||||
|
{
|
||||||
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event);
|
||||||
//qDebug("Dock Resized (New Size) - Width: %d Height: %d",
|
//qDebug("Dock Resized (New Size) - Width: %d Height: %d",
|
||||||
// resizeEvent->size().width(),
|
// resizeEvent->size().width(),
|
||||||
// resizeEvent->size().height());
|
// resizeEvent->size().height());
|
||||||
if (resizeEvent->size().width() >= resizeEvent->size().height()) {
|
if (resizeEvent->size().width() >= resizeEvent->size().height())
|
||||||
|
{
|
||||||
// Set horizontal view (list)
|
// Set horizontal view (list)
|
||||||
this->main->on_actionSectionsHorizontal_triggered();
|
this->main->on_actionSectionsHorizontal_triggered();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Set vertical view (Tree)
|
// Set vertical view (Tree)
|
||||||
this->main->on_actionSectionsVertical_triggered();
|
this->main->on_actionSectionsVertical_triggered();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,8 @@ class QItemSelectionModel;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class SectionsWidget;
|
class SectionsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,14 +14,20 @@ SideBar::SideBar(MainWindow *main) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
if (settings.value("responsive").toBool()) {
|
if (settings.value("responsive").toBool())
|
||||||
|
{
|
||||||
ui->respButton->setChecked(true);
|
ui->respButton->setChecked(true);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->respButton->setChecked(false);
|
ui->respButton->setChecked(false);
|
||||||
}
|
}
|
||||||
if (settings.value("dark").toBool()) {
|
if (settings.value("dark").toBool())
|
||||||
|
{
|
||||||
ui->themesButton->setChecked(true);
|
ui->themesButton->setChecked(true);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->themesButton->setChecked(false);
|
ui->themesButton->setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,9 +45,12 @@ void SideBar::on_tabsButton_clicked()
|
|||||||
void SideBar::on_consoleButton_clicked()
|
void SideBar::on_consoleButton_clicked()
|
||||||
{
|
{
|
||||||
this->main->on_actionhide_bottomPannel_triggered();
|
this->main->on_actionhide_bottomPannel_triggered();
|
||||||
if (ui->consoleButton->isChecked()) {
|
if (ui->consoleButton->isChecked())
|
||||||
|
{
|
||||||
ui->consoleButton->setIcon(QIcon(":/new/prefix1/img/icons/up_white.png"));
|
ui->consoleButton->setIcon(QIcon(":/new/prefix1/img/icons/up_white.png"));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->consoleButton->setIcon(QIcon(":/new/prefix1/img/icons/down_white.png"));
|
ui->consoleButton->setIcon(QIcon(":/new/prefix1/img/icons/down_white.png"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,25 +62,32 @@ void SideBar::on_webServerButton_clicked()
|
|||||||
|
|
||||||
void SideBar::on_lockButton_clicked()
|
void SideBar::on_lockButton_clicked()
|
||||||
{
|
{
|
||||||
if(ui->lockButton->isChecked()) {
|
if (ui->lockButton->isChecked())
|
||||||
|
{
|
||||||
ui->lockButton->setIcon(QIcon(":/new/prefix1/img/icons/unlock_white.png"));
|
ui->lockButton->setIcon(QIcon(":/new/prefix1/img/icons/unlock_white.png"));
|
||||||
this->main->lockUnlock_Docks(1);
|
this->main->lockUnlock_Docks(1);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->lockButton->setIcon(QIcon(":/new/prefix1/img/icons/lock_white.png"));
|
ui->lockButton->setIcon(QIcon(":/new/prefix1/img/icons/lock_white.png"));
|
||||||
this->main->lockUnlock_Docks(0);
|
this->main->lockUnlock_Docks(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBar::themesButtonToggle() {
|
void SideBar::themesButtonToggle()
|
||||||
|
{
|
||||||
ui->themesButton->click();
|
ui->themesButton->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBar::on_themesButton_clicked()
|
void SideBar::on_themesButton_clicked()
|
||||||
{
|
{
|
||||||
if (ui->themesButton->isChecked() ) {
|
if (ui->themesButton->isChecked())
|
||||||
|
{
|
||||||
// Dark theme
|
// Dark theme
|
||||||
this->main->dark();
|
this->main->dark();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Clear theme
|
// Clear theme
|
||||||
this->main->def_theme();
|
this->main->def_theme();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class SideBar;
|
class SideBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class StringsWidget;
|
class StringsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,9 +17,11 @@ SymbolsWidget::~SymbolsWidget()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SymbolsWidget::fillSymbols() {
|
void SymbolsWidget::fillSymbols()
|
||||||
|
{
|
||||||
this->symbolsTreeWidget->clear();
|
this->symbolsTreeWidget->clear();
|
||||||
for (auto i: this->main->core->getList ("bin", "symbols")) {
|
for (auto i : this->main->core->getList("bin", "symbols"))
|
||||||
|
{
|
||||||
QStringList pieces = i.split(",");
|
QStringList pieces = i.split(",");
|
||||||
if (pieces.length() == 3)
|
if (pieces.length() == 3)
|
||||||
this->main->appendRow(this->symbolsTreeWidget, pieces[0], pieces[1], pieces[2]);
|
this->main->appendRow(this->symbolsTreeWidget, pieces[0], pieces[1], pieces[2]);
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui
|
||||||
|
{
|
||||||
class SymbolsWidget;
|
class SymbolsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user