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

GUI file view displays most relevant view #516

Open
whyitfor opened this issue Nov 14, 2024 · 1 comment
Open

GUI file view displays most relevant view #516

whyitfor opened this issue Nov 14, 2024 · 1 comment

Comments

@whyitfor
Copy link
Contributor

whyitfor commented Nov 14, 2024

What is the use case for the feature?
As an OFRAK user, I would like for the GUI file display to default to the most relevant view.

Something like this:

  1. By default, hex view is shown.
  2. If a file is a textfile, then it defaults to the "Text" view
  3. For a complex block, default view is either disassembler or decompilation, if it exists

The current behavior seems to default to the most recent view used for the previously-viewed resource.

Does the feature contain any proprietary information about another company's intellectual property?
No.

How would you implement this feature?
Agnostic.

Are there any (reasonable) alternative approaches?
Probably. The goal is showing the user the most useful view FIRST.

Are you interested in implementing it yourself?
Yes, with a bit of guidance.

@rbs-jacob
Copy link
Member

Probably the easiest way to do this is to update the code here to not just update the tabs list, but also to set the tabId as well.

hasTextView = ["ofrak.core.binary.GenericText"].some((tag) =>
$selectedResource.has_tag(tag)
);
hasAsmView = [
"ofrak.core.complex_block.ComplexBlock",
"ofrak.core.basic_block.BasicBlock",
"ofrak.core.instruction.Instruction",
"ofrak.core.data.DataWord",
].some((tag) => $selectedResource.has_tag(tag));
hasDecompView = ["ofrak.core.decompilation.DecompilationAnalysis"].some(
(tag) => $selectedResource.has_tag(tag)
);
if (hasTextView) {
tabs.push(textTab);
}
if (hasAsmView) {
tabs.push(asmTab);
}
if (hasDecompView) {
tabs.push(decompTab);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants