mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 02:25:26 +00:00
Fix many warnings and remove waste code (#81)
* Fixed a lot of warnings and removed waste code * Fixed more warnings and removed more waste code * restore XrefsDialog::updateLabels This function is used in memorywidget.cpp
This commit is contained in:
parent
95ca3d5d5b
commit
7c63a67575
@ -65,7 +65,6 @@ void createNewDialog::on_buttonCreate_clicked()
|
||||
bool created = false;
|
||||
|
||||
QString arch = ui->comboArch->currentText();
|
||||
int bits = atoi (ui->comboBits->currentText().toUtf8().constData());
|
||||
int fsize = r_num_math (NULL, ui->entrySize->text().toUtf8().constData());
|
||||
QString format = ui->comboFormat->currentText();
|
||||
|
||||
|
@ -64,6 +64,8 @@ void XrefsDialog::fillRefs(QList<QStringList> refs, QList<QStringList> xrefs) {
|
||||
|
||||
void XrefsDialog::on_fromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
QString offset = item->text(0);
|
||||
RAnalFunction *fcn = this->main->core->functionAt(offset.toLongLong(0, 16));
|
||||
//this->add_debug_output( fcn->name );
|
||||
@ -73,6 +75,8 @@ void XrefsDialog::on_fromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int
|
||||
|
||||
void XrefsDialog::on_toTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
QString offset = item->text(0);
|
||||
RAnalFunction *fcn = this->main->core->functionAt(offset.toLongLong(0, 16));
|
||||
//this->add_debug_output( fcn->name );
|
||||
@ -118,7 +122,8 @@ void XrefsDialog::on_fromTreeWidget_itemSelectionChanged()
|
||||
QString offset = item->text(0);
|
||||
ui->previewTextEdit->setPlainText( this->main->core->cmd("pdf @ " + offset).trimmed() );
|
||||
ui->previewTextEdit->moveCursor(QTextCursor::End);
|
||||
int pos = ui->previewTextEdit->find( this->normalizeAddr(offset), QTextDocument::FindBackward);
|
||||
// Does it make any sense?
|
||||
ui->previewTextEdit->find( this->normalizeAddr(offset), QTextDocument::FindBackward);
|
||||
ui->previewTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
|
||||
}
|
||||
|
||||
@ -128,7 +133,9 @@ void XrefsDialog::on_toTreeWidget_itemSelectionChanged()
|
||||
QString offset = item->text(0);
|
||||
ui->previewTextEdit->setPlainText( this->main->core->cmd("pdf @ " + offset).trimmed() );
|
||||
ui->previewTextEdit->moveCursor(QTextCursor::End);
|
||||
int pos = ui->previewTextEdit->find( this->normalizeAddr(offset), QTextDocument::FindBackward);
|
||||
// Again, does it make any sense?
|
||||
// Also, this code should be refactored and shared instead of copied & pasted
|
||||
ui->previewTextEdit->find( this->normalizeAddr(offset), QTextDocument::FindBackward);
|
||||
ui->previewTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,7 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace
|
||||
{
|
||||
void registerCustomFonts()
|
||||
static void registerCustomFonts()
|
||||
{
|
||||
int ret = QFontDatabase::addApplicationFont(":/new/prefix1/fonts/Anonymous Pro.ttf");
|
||||
assert(-1 != ret && "unable to register Anonymous Pro.ttf");
|
||||
@ -49,8 +47,6 @@ namespace
|
||||
// do not issue a warning in release
|
||||
Q_UNUSED(ret)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent, QRCore *kore) :
|
||||
QMainWindow(parent),
|
||||
@ -752,26 +748,27 @@ void MainWindow::on_consoleInputLineEdit_returnPressed()
|
||||
ui->consoleOutputTextEdit->verticalScrollBar()->setValue(ui->consoleOutputTextEdit->verticalScrollBar()->maximum());
|
||||
// Add new command to history
|
||||
QCompleter *completer = ui->consoleInputLineEdit->completer();
|
||||
/*
|
||||
* TODO: FIXME: Crashed the fucking app
|
||||
* ballessay: yes this will crash if no completer is set -> nullptr
|
||||
*/
|
||||
//QStringListModel *completerModel = (QStringListModel*)(completer->model());
|
||||
//completerModel->setStringList(completerModel->stringList() << input);
|
||||
if ( completer != NULL ) {
|
||||
QStringListModel *completerModel = (QStringListModel*)(completer->model());
|
||||
if ( completerModel != NULL )
|
||||
completerModel->setStringList(completerModel->stringList() << input);
|
||||
}
|
||||
|
||||
ui->consoleInputLineEdit->setText("");
|
||||
// TODO: add checkbox to enable/disable updating the whole ui or just update the list widgets, not disasm/hex
|
||||
//this->updateFrames();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_showHistoToolButton_clicked()
|
||||
{
|
||||
if (ui->showHistoToolButton->isChecked()) {
|
||||
QCompleter *completer = ui->consoleInputLineEdit->completer();
|
||||
if (completer == NULL)
|
||||
return;
|
||||
|
||||
if (ui->showHistoToolButton->isChecked()) {
|
||||
completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
|
||||
// Uhm... shouldn't it be called always?
|
||||
completer->complete();
|
||||
} else {
|
||||
QCompleter *completer = ui->consoleInputLineEdit->completer();
|
||||
completer->setCompletionMode(QCompleter::PopupCompletion);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@
|
||||
const int NewFileDialog::MaxRecentFiles;
|
||||
|
||||
static QColor getColorFor(QString str, int pos) {
|
||||
QNOTUSED(str);
|
||||
|
||||
QList<QColor> Colors;
|
||||
Colors << QColor(29, 188, 156); // Turquoise
|
||||
Colors << QColor(52, 152, 219); // Blue
|
||||
|
@ -149,6 +149,10 @@ QString QRCore::cmd(const QString &str) {
|
||||
}
|
||||
|
||||
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(idx);
|
||||
|
||||
RCoreFile *f;
|
||||
if (va==0 || va == 2)
|
||||
r_config_set_i (core->config, "io.va", va);
|
||||
@ -455,9 +459,9 @@ int QRCore::fcnEndBbs(QString addr) {
|
||||
QString endbbs = tmp.split(": ")[1];
|
||||
return endbbs.toInt();
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString QRCore::itoa(ut64 num, int rdx) {
|
||||
@ -483,6 +487,8 @@ int QRCore::config(const QString &k, int v) {
|
||||
}
|
||||
|
||||
void QRCore::setOptions(QString key) {
|
||||
QNOTUSED(key);
|
||||
|
||||
// va
|
||||
// lowercase
|
||||
// show bytes
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define __alert(x) QMessageBox::question (this, "Alert", QString(x), QMessageBox::Ok)
|
||||
#define __question(x) (QMessageBox::Yes==QMessageBox::question (this, "Alert", QString(x), QMessageBox::Yes| QMessageBox::No))
|
||||
|
||||
#define QNOTUSED(x) do { (void)(x); } while ( 0 );
|
||||
|
||||
class QRCore : public QObject
|
||||
{
|
||||
|
@ -9,6 +9,10 @@ QRDisasm::QRDisasm(QRCore *core)
|
||||
}
|
||||
|
||||
bool QRDisasm::disassembleAt (ut64 addr, QRDisasmOption opt, QRDisasmRow &dr) {
|
||||
QNOTUSED(addr);
|
||||
QNOTUSED(opt);
|
||||
QNOTUSED(dr);
|
||||
|
||||
printf ("FUCK\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
GraphicsBar::GraphicsBar(MainWindow *main, QWidget *parent) :
|
||||
QToolBar(main)
|
||||
{
|
||||
QNOTUSED(parent);
|
||||
|
||||
setObjectName("codeGraphics");
|
||||
setWindowTitle("Code bar");
|
||||
// setMovable(false);
|
||||
@ -40,6 +42,8 @@ GraphicsBar::GraphicsBar(MainWindow *main, QWidget *parent) :
|
||||
}
|
||||
|
||||
void GraphicsBar::paintEvent(QPaintEvent *event) {
|
||||
QNOTUSED(event);
|
||||
|
||||
QPainter painter(this);
|
||||
this->fillData();
|
||||
}
|
||||
@ -61,7 +65,6 @@ void GraphicsBar::fillData() {
|
||||
|
||||
// Parse JSON data
|
||||
QString jsonData = this->main->core->cmd("p-j");
|
||||
QJsonParseError *err = new QJsonParseError();
|
||||
QJsonDocument doc = QJsonDocument::fromJson(jsonData.toUtf8());
|
||||
|
||||
if (doc.isNull()) {
|
||||
|
@ -38,6 +38,8 @@ CommentsWidget::~CommentsWidget()
|
||||
|
||||
void CommentsWidget::on_commentsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
// Get offset and name of item double clicked
|
||||
// TODO: use this info to change disasm contents
|
||||
QString offset = item->text(1);
|
||||
|
@ -133,9 +133,6 @@ void Dashboard::updateContents() {
|
||||
// Get stats for the graphs
|
||||
QStringList stats = this->main->core->getStats();
|
||||
|
||||
// Calculate total amount flags all + imports
|
||||
int total = stats[6].toInt() + stats[1].toInt();
|
||||
|
||||
// Add data to HTML graphs (stats)
|
||||
QFile html(":/html/stats.html");
|
||||
if(!html.open(QIODevice::ReadOnly)) {
|
||||
|
@ -23,6 +23,8 @@ FlagsWidget::~FlagsWidget()
|
||||
|
||||
void FlagsWidget::on_flagsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
QString offset = item->text(2);
|
||||
QString name = item->text(3);
|
||||
this->main->seek(offset, name);
|
||||
@ -30,5 +32,7 @@ void FlagsWidget::on_flagsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, in
|
||||
|
||||
void FlagsWidget::on_flagspaceCombo_currentTextChanged(const QString &arg1)
|
||||
{
|
||||
QNOTUSED(arg1);
|
||||
|
||||
this->main->refreshFlags();
|
||||
}
|
||||
|
@ -94,6 +94,8 @@ void FunctionsWidget::fillFunctions() {
|
||||
|
||||
void FunctionsWidget::on_functionsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
QString offset = item->text(1);
|
||||
QString name = item->text(3);
|
||||
this->main->seek(offset, name);
|
||||
@ -281,7 +283,6 @@ void FunctionsWidget::on_action_References_triggered()
|
||||
x->setWindowTitle("X-Refs for function " + QString::fromUtf8(fcn->name));
|
||||
|
||||
// Get Refs and Xrefs
|
||||
bool ok;
|
||||
QList<QStringList> ret_refs;
|
||||
QList<QStringList> ret_xrefs;
|
||||
|
||||
@ -353,6 +354,8 @@ void FunctionsWidget::on_actionVertical_triggered()
|
||||
|
||||
void FunctionsWidget::on_nestedFunctionsTree_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
//QString offset = item->text(1);
|
||||
QString name = item->text(0);
|
||||
QString offset = item->child(0)->text(0).split(":")[1];
|
||||
|
@ -147,8 +147,6 @@ void Notepad::on_searchEdit_returnPressed()
|
||||
QString searchString = ui->searchEdit->text();
|
||||
QTextDocument *document = ui->notepadTextEdit->document();
|
||||
|
||||
bool found = false;
|
||||
|
||||
if (isFirstTime == false)
|
||||
document->undo();
|
||||
|
||||
@ -167,7 +165,6 @@ void Notepad::on_searchEdit_returnPressed()
|
||||
highlightCursor = document->find(searchString, highlightCursor, QTextDocument::FindWholeWords);
|
||||
|
||||
if (!highlightCursor.isNull()) {
|
||||
found = true;
|
||||
highlightCursor.movePosition(QTextCursor::WordRight,
|
||||
QTextCursor::KeepAnchor);
|
||||
highlightCursor.mergeCharFormat(colorFormat);
|
||||
@ -176,23 +173,16 @@ void Notepad::on_searchEdit_returnPressed()
|
||||
|
||||
cursor.endEditBlock();
|
||||
isFirstTime = false;
|
||||
|
||||
/*
|
||||
if (found == false) {
|
||||
QMessageBox::information(this, tr("Word Not Found"),
|
||||
"Sorry, the word cannot be found.");
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void Notepad::on_searchEdit_textEdited(const QString &arg1)
|
||||
{
|
||||
QNOTUSED(arg1);
|
||||
|
||||
QString searchString = ui->searchEdit->text();
|
||||
QTextDocument *document = ui->notepadTextEdit->document();
|
||||
|
||||
bool found = false;
|
||||
|
||||
if (isFirstTime == false)
|
||||
document->undo();
|
||||
|
||||
@ -211,7 +201,6 @@ void Notepad::on_searchEdit_textEdited(const QString &arg1)
|
||||
highlightCursor = document->find(searchString, highlightCursor);
|
||||
|
||||
if (!highlightCursor.isNull()) {
|
||||
found = true;
|
||||
//highlightCursor.movePosition(QTextCursor::WordRight,
|
||||
// QTextCursor::KeepAnchor);
|
||||
highlightCursor.mergeCharFormat(colorFormat);
|
||||
@ -225,11 +214,11 @@ void Notepad::on_searchEdit_textEdited(const QString &arg1)
|
||||
|
||||
void Notepad::on_searchEdit_textChanged(const QString &arg1)
|
||||
{
|
||||
QNOTUSED(arg1);
|
||||
|
||||
QString searchString = ui->searchEdit->text();
|
||||
QTextDocument *document = ui->notepadTextEdit->document();
|
||||
|
||||
bool found = false;
|
||||
|
||||
if (isFirstTime == false)
|
||||
document->undo();
|
||||
|
||||
@ -248,7 +237,6 @@ void Notepad::on_searchEdit_textChanged(const QString &arg1)
|
||||
highlightCursor = document->find(searchString, highlightCursor);
|
||||
|
||||
if (!highlightCursor.isNull()) {
|
||||
found = true;
|
||||
//highlightCursor.movePosition(QTextCursor::WordRight,
|
||||
// QTextCursor::KeepAnchor);
|
||||
highlightCursor.mergeCharFormat(colorFormat);
|
||||
|
@ -92,7 +92,7 @@ void Omnibar::clearContents() {
|
||||
void Omnibar::on_gotoEntry_returnPressed()
|
||||
{
|
||||
QString str = this->text();
|
||||
if (str.length()>0)
|
||||
if (str.length()>0) {
|
||||
if (str.contains(": ")) {
|
||||
if (str.contains("Lock")){
|
||||
this->main->on_actionLock_triggered();
|
||||
@ -128,6 +128,8 @@ void Omnibar::on_gotoEntry_returnPressed()
|
||||
QString off = this->main->core->cmd("afo " + this->text());
|
||||
this->main->seek(off.trimmed(), this->text());
|
||||
}
|
||||
}
|
||||
|
||||
// check which tab is open? update all tabs? hex, graph?
|
||||
//refreshMem( this->gotoEntry->text() );
|
||||
this->setText("");
|
||||
|
@ -46,6 +46,7 @@
|
||||
#define M_PI 3.1415927
|
||||
#endif
|
||||
|
||||
#include "qrcore.h"
|
||||
#include "pieview.h"
|
||||
|
||||
PieView::PieView(QWidget *parent)
|
||||
@ -450,6 +451,8 @@ void PieView::scrollTo(const QModelIndex &index, ScrollHint)
|
||||
|
||||
void PieView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)
|
||||
{
|
||||
QNOTUSED(command);
|
||||
|
||||
// Use content widget coordinates because we will use the itemRegion()
|
||||
// function to check for intersections.
|
||||
|
||||
|
@ -21,6 +21,8 @@ RelocsWidget::~RelocsWidget()
|
||||
|
||||
void RelocsWidget::on_relocsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
// Get offset and name of item double clicked
|
||||
// TODO: use this info to change disasm contents
|
||||
QString offset = item->text(1);
|
||||
|
@ -9,6 +9,8 @@
|
||||
SectionsWidget::SectionsWidget(MainWindow *main, QWidget *parent) :
|
||||
QSplitter(main)
|
||||
{
|
||||
QNOTUSED(parent);
|
||||
|
||||
this->main = main;
|
||||
//setupModel();
|
||||
setupViews();
|
||||
|
@ -22,6 +22,8 @@ StringsWidget::~StringsWidget()
|
||||
|
||||
void StringsWidget::on_stringsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
// Get offset and name of item double clicked
|
||||
// TODO: use this info to change disasm contents
|
||||
QString offset = item->text(1);
|
||||
|
@ -29,6 +29,8 @@ void SymbolsWidget::fillSymbols() {
|
||||
|
||||
void SymbolsWidget::on_symbolsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
||||
{
|
||||
QNOTUSED(column);
|
||||
|
||||
// Get offset and name of item double clicked
|
||||
// TODO: use this info to change disasm contents
|
||||
QString offset = item->text(1);
|
||||
|
Loading…
Reference in New Issue
Block a user