mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-20 13:46:06 +00:00
Code cleaning
This commit is contained in:
parent
12e64cf052
commit
84d63ef363
@ -519,6 +519,7 @@ void MainWindow::updateFrames()
|
||||
{
|
||||
for (auto W : dockWidgets)
|
||||
{
|
||||
// Temporary hack
|
||||
DockWidget* w = dynamic_cast<DockWidget*>(W);
|
||||
if (w) {
|
||||
w->setup();
|
||||
@ -531,6 +532,7 @@ void MainWindow::updateFrames()
|
||||
{
|
||||
for (auto W : dockWidgets)
|
||||
{
|
||||
// Temporary hack
|
||||
DockWidget* w = dynamic_cast<DockWidget*>(W);
|
||||
if (w) {
|
||||
w->refresh();
|
||||
@ -712,11 +714,12 @@ void MainWindow::setCursorAddress(RVA addr)
|
||||
|
||||
void MainWindow::backButton_clicked()
|
||||
{
|
||||
QList<RVA> seek_history = core->getSeekHistory();
|
||||
this->core->cmd("s-");
|
||||
RVA offset = this->core->getOffset();
|
||||
//QString fcn = this->core->cmdFunctionAt(QString::number(offset));
|
||||
core->seek(offset);
|
||||
core->cmd("s-");
|
||||
}
|
||||
|
||||
void MainWindow::on_actionForward_triggered()
|
||||
{
|
||||
core->cmd("s+");
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCalculator_triggered()
|
||||
@ -754,15 +757,15 @@ void MainWindow::on_actionDisasAdd_comment_triggered()
|
||||
|
||||
void MainWindow::restoreDocks()
|
||||
{
|
||||
addDockWidget(Qt::LeftDockWidgetArea, this->functionsDock);
|
||||
addDockWidget(Qt::RightDockWidgetArea, this->sectionsDock);
|
||||
addDockWidget(Qt::TopDockWidgetArea, this->dashboardDock);
|
||||
this->tabifyDockWidget(this->sectionsDock, this->commentsDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->disassemblyDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->sidebarDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->hexdumpDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->graphDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->hexdumpDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->previewDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->sidebarDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->functionsDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->entrypointDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->flagsDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->stringsDock);
|
||||
@ -773,9 +776,9 @@ void MainWindow::restoreDocks()
|
||||
this->tabifyDockWidget(this->dashboardDock, this->notepadDock);
|
||||
this->dashboardDock->raise();
|
||||
this->sectionsDock->raise();
|
||||
this->functionsDock->raise();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionDefaut_triggered()
|
||||
{
|
||||
hideAllDocks();
|
||||
@ -877,8 +880,6 @@ void MainWindow::on_actionRun_Script_triggered()
|
||||
fileName = dialog.getOpenFileName(this, tr("Select radare2 script"));
|
||||
if (!fileName.length()) //cancel was pressed
|
||||
return;
|
||||
|
||||
qDebug() << "Meow: " + fileName;
|
||||
this->core->cmd(". " + fileName);
|
||||
}
|
||||
|
||||
@ -932,14 +933,6 @@ void MainWindow::on_actionDashboard_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionForward_triggered()
|
||||
{
|
||||
this->core->cmd("s+");
|
||||
RVA offset = core->getOffset();
|
||||
this->addDebugOutput(QString::number(offset));
|
||||
core->seek(offset);
|
||||
}
|
||||
|
||||
void MainWindow::toggleResponsive(bool maybe)
|
||||
{
|
||||
this->responsive = maybe;
|
||||
@ -974,22 +967,25 @@ void MainWindow::on_actionQuit_triggered()
|
||||
|
||||
void MainWindow::refreshVisibleDockWidgets()
|
||||
{
|
||||
/* TODO Just send a signal no?
|
||||
* // There seems to be no convenience function to check if a QDockWidget
|
||||
/* TODO Just send a signal no? */
|
||||
// There seems to be no convenience function to check if a QDockWidget
|
||||
// is really visible or hidden in a tabbed dock. So:
|
||||
auto isDockVisible = [](const QDockWidget * const pWidget)
|
||||
{
|
||||
return pWidget != nullptr && !pWidget->visibleRegion().isEmpty();
|
||||
};
|
||||
|
||||
for (auto w : dockWidgets)
|
||||
for (auto W : dockWidgets)
|
||||
{
|
||||
if (isDockVisible(w))
|
||||
if (isDockVisible(W))
|
||||
{
|
||||
w->refresh();
|
||||
// Temporary hack
|
||||
DockWidget* w = dynamic_cast<DockWidget*>(W);
|
||||
if (w) {
|
||||
w->setup();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void MainWindow::on_actionRefresh_contents_triggered()
|
||||
|
@ -287,6 +287,7 @@ void DisassemblyWidget::refreshDisasm()
|
||||
connect(mDisasTextEdit->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(disasmScrolled()));
|
||||
connect(mDisasTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(on_mDisasTextEdit_cursorPositionChanged()));
|
||||
//this->on_mDisasTextEdit_cursorPositionChanged();
|
||||
|
||||
this->highlightDisasms();
|
||||
}
|
||||
|
||||
@ -397,13 +398,12 @@ void DisassemblyWidget::on_seekChanged(RVA offset)
|
||||
|
||||
void DisassemblyWidget::highlightDisasms()
|
||||
{
|
||||
// Syntax Highliting
|
||||
// TODO doing new all the time
|
||||
// TODO Seems very very heavy -- merge it with Graph one
|
||||
Highlighter *highlighter = new Highlighter(mDisasTextEdit->document());
|
||||
Highlighter *highlighter_5 = new Highlighter(mDisasTextEdit->document());
|
||||
AsciiHighlighter *ascii_highlighter = new AsciiHighlighter(mDisasTextEdit->document());
|
||||
HexHighlighter *hex_highlighter = new HexHighlighter(mDisasTextEdit->document());
|
||||
Highlighter *preview_highlighter = new Highlighter(mDisasTextEdit->document());
|
||||
Highlighter *deco_highlighter = new Highlighter(mDisasTextEdit->document());
|
||||
// TODO Improve this syntax Highlighting
|
||||
// TODO Must be usable for the graph view
|
||||
//Highlighter *highlighter = new Highlighter(mDisasTextEdit->document());
|
||||
//Highlighter *highlighter_5 = new Highlighter(mDisasTextEdit->document());
|
||||
//AsciiHighlighter *ascii_highlighter = new AsciiHighlighter(mDisasTextEdit->document());
|
||||
//HexHighlighter *hex_highlighter = new HexHighlighter(mDisasTextEdit->document());
|
||||
//Highlighter *preview_highlighter = new Highlighter(mDisasTextEdit->document());
|
||||
//Highlighter *deco_highlighter = new Highlighter(mDisasTextEdit->document());
|
||||
}
|
||||
|
@ -122,11 +122,11 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case 0:
|
||||
return RAddressString(function.offset);
|
||||
return function.name;
|
||||
case 1:
|
||||
return RSizeString(function.size);
|
||||
case 3:
|
||||
return function.name;
|
||||
return RAddressString(function.offset);
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -184,13 +184,13 @@ QVariant FunctionModel::headerData(int section, Qt::Orientation orientation, int
|
||||
switch (section)
|
||||
{
|
||||
case 0:
|
||||
return tr("Offset");
|
||||
return tr("Name");
|
||||
case 1:
|
||||
return tr("Size");
|
||||
case 2:
|
||||
return tr("Imp.");
|
||||
case 3:
|
||||
return tr("Name");
|
||||
return tr("Offset");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user