Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus on visible disasm or graph #1444

Merged
merged 7 commits into from Apr 12, 2019
Merged
Diff settings

Always

Just for now

@@ -588,6 +588,18 @@ void MainWindow::finalizeOpen()
// Add fortune message
core->message("\n" + core->cmd("fo"));
showMaximized();

// Set focus to disasm or graph widget
const QString disasmWidgetClassName = disassemblyDock->metaObject()->className();
const QString graphWidgetClassName = graphDock->metaObject()->className();
for (auto dockWidget : dockWidgets) {
This conversation was marked as resolved by optizone

This comment has been minimized.

Copy link
@xarkes

xarkes Apr 10, 2019

Member

I think the for loop is not necessary as you should already have a pointer to the graph and disassembly view as an attribute of MainWindow, am I wrong?

This comment has been minimized.

Copy link
@optizone

optizone Apr 10, 2019

Author Contributor

It is for cases when there are two or more disasm/graph widgets. So if second widget is visible Cutter focuses on it and not on first(non-visible) one

This comment has been minimized.

Copy link
@xarkes

xarkes Apr 10, 2019

Member

Ok then it's probably worth adding a comment to tell why you used a for loop ;)

This conversation was marked as resolved by optizone

This comment has been minimized.

Copy link
@ITAYC0HEN

ITAYC0HEN Apr 10, 2019

Member

This for loop won't stop even when found Graph or Disas widgets

const QString className = dockWidget->metaObject()->className();
if ((className == disasmWidgetClassName ||
This conversation was marked as resolved by optizone

This comment has been minimized.

Copy link
@ITAYC0HEN

ITAYC0HEN Apr 10, 2019

Member

I believe that Graph widget should get priority over Disassembly widget (in case that there is a function to show there)

className == graphWidgetClassName) &&
!dockWidget->visibleRegion().isNull()) {
dockWidget->setFocus();
}
}
}

bool MainWindow::saveProject(bool quit)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.