edb-debugger icon indicating copy to clipboard operation
edb-debugger copied to clipboard

RFC attempt to fix #744

Open sorokin opened this issue 5 years ago • 7 comments

This is more like a request for comments than a real pull request.

Basically what I did is I passed QMenu* parent to all plugin functions that create menus. Full description is in the commit message.

What do you think?

sorokin avatar Feb 18 '20 00:02 sorokin

The idea of threading the main window's pointer to the plugin so it can be set as the parent seems reasonable at first blush, I've been pretty busy at work, but I'll try to take a closer look asap.

eteran avatar Feb 20 '20 02:02 eteran

Thank you for the response.

I've been pretty busy at work, but I'll try to take a closer look asap.

That's totally fine. I don't mind if the PR is reviewed later and is reviewed better. There is no rush in doing this at all. Take your time. Thanks!

sorokin avatar Feb 20 '20 06:02 sorokin

I started to look at this PR, as I said, threading the parent to the plugins seems like a generally good solution. Though I'm unsure about the globalShortcuts concept. I see what you're going for with it, but it kinda makes sense that shortcuts which happen to have a shortcut will "just work" and not need to be part of a separate list that could be forgotten to get updated.

eteran avatar Feb 26 '20 19:02 eteran

Though I'm unsure about the globalShortcuts concept.

That's why I'm not sure about it either. But I don't know better solution. The problem I had was the following. Conceptually there are 2 types of actions: ones that are created at plugin initialization time and they live while the plugin is loaded, others that are created when menu is invoked and are destroyed when menu is dismissed. For action to have a global shortcut it must be of the first type. Unfortunately the previous interface doesn't allow getting only these global actions. That's why I invented this globalShortcuts function.

Let me know if you have any other ideas. As I said I'm not sure about the concept, but I don't have any better ideas.

sorokin avatar Feb 27 '20 20:02 sorokin

I'll think about it, and see if we can come up with a better solution. :+1:

eteran avatar Feb 28 '20 14:02 eteran

I updated the PR by removing unneeded usage of std::cerr that I used for debug.

diff --git a/src/Debugger.cpp b/src/Debugger.cpp
index e3590e70..0acb725e 100644
--- a/src/Debugger.cpp
+++ b/src/Debugger.cpp
@@ -863,7 +863,6 @@ void Debugger::finishPluginSetup() {
                        for (QAction *action : actions) {
                                QKeySequence shortcut = action->shortcut();
                                if (!shortcut.isEmpty()) {
-                                       std::cerr << shortcut.toString().toUtf8().constData() << std::endl;
                                        connect(new QShortcut(shortcut, this), &QShortcut::activated, action, &QAction::trigger);
                                }
                        }

sorokin avatar Feb 29 '20 17:02 sorokin

@sorokin as you can imagine, it's been a hectic and sometimes very unproductive year. But I'm getting back into a groove and plan to work on this issue in the near future!

Thanks for your contribution :-).

eteran avatar Dec 14 '20 01:12 eteran