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