Commit Graph

117 Commits

Author SHA1 Message Date
wmayer
d150fa7164 modernize C++: avoid bind
In many cases std::bind() is kept because the code is much simpler
2023-08-08 21:10:16 +02:00
wmayer
68d22d864b modernize C++: move from boost::bind to std::bind 2023-08-08 17:36:13 +02:00
wmayer
0af4990817 modernize C++: make unique 2023-08-07 19:51:30 -06:00
marioalexis
60ae9f35b6 Gui: Add CommandAction descriptor object to access commands action 2023-04-10 16:53:51 +02:00
wmayer
5ba1f1f5d4 Gui: refactor MacroManager 2023-03-26 18:41:56 +02:00
luzpaz
69e5359bfa Gui: [skip ci] fix typo 2023-02-06 06:23:27 +01:00
Zheng, Lei
362c781553 Gui: fix Customize -> Keyboard shortcut priroity list
Add API Command::initAction() to force create action for all commands
with shortcut in order to register with ShortcutManager to obtain a
complete list of actions with the same shortcut.
2022-11-10 23:20:18 +01:00
Zheng, Lei
02e0af2f1d Gui: fix GroupCommand icon setup 2022-11-10 23:20:18 +01:00
Zheng, Lei
2328284884 Gui: add ShortcutManager to unify shortcut handling
Support longest key sequence match with user defined delay (configurable
through 'Customize -> Keyboard -> Key sequence delay').

Support user defined priority to resolve shortcut conflict through
'Customize -> Keyboard')

Add 'All' category in 'Customize -> Keyboard' to list all command and
showing their shortcuts

Unify macro command shortcut setting (BaseApp/Preferences/Shortcut).
2022-11-10 23:20:18 +01:00
marioalexis
0382f276a2 Gui: Replace C cast 2022-09-18 11:06:51 -05:00
berniev
75acacd1b7 Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. 
* When possible use a ranged for loop instead of begin() and end() iterators
2022-09-14 13:25:13 -05:00
wmayer
ba8d5ab055 Gui: modernize C++: replace 'typedef' with 'using' 2022-08-29 14:09:18 +02:00
berniev
656ef8961f Gui: redundant void 2 2022-08-08 10:21:44 +02:00
berniev
d88729d2c4 Gui: use empty 2022-08-06 16:35:45 +02:00
wmayer
6ee2c7f865 Fix several clazy issues:
* C++11 range-loop might detach Qt container [-Wclazy-range-loop-detach]
2022-07-24 23:48:37 +02:00
andrea
3018985f80 Remove unused code into GUI 2022-07-17 03:53:11 +02:00
wmayer
201f4c9a5a Core: replace PyObject_IsTrue with Base::asBoolean 2022-07-16 14:04:05 +02:00
wmayer
1ae55905ba Py: make FreeCAD to compile with Py3.11 2022-07-01 17:54:50 +02:00
Chris Hennes
a4b2bf584d Gui: Fix display of tooltips for GroupCommand
Fixes https://github.com/FreeCAD/FreeCAD-translations/issues/88 and https://github.com/FreeCAD/FreeCAD-translations/issues/72
2022-06-01 14:21:17 -05:00
marioalexis
52b1d11e59 Gui: Fix crash when invoke command with sMenuText equal to nullptr 2022-05-16 13:47:29 +02:00
Zheng, Lei
3ef438eaf0 Fix mixed line endings 2022-04-26 12:52:55 -05:00
Chris Hennes
bedf920702 Gui: PR6497 move return statement to new line 2022-03-29 12:33:50 -05:00
wmayer
96adb98f46 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
Uwe
9654786c67 [Gui] Quarter: remove unused includes 2022-03-09 01:12:15 +01:00
wmayer
1ca7429705 Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
Uwe
281b70db58 [Gui] remove some more unused headers 2022-02-19 04:31:27 +01:00
Uwe
3f4e7e7df7 [Gui] remove more unused headers 2022-02-19 04:04:14 +01:00
Chris Hennes
621c0b31e1 Gui: Correct generation of macro pref name 2022-02-17 10:23:32 -06:00
Chris Hennes
c9240fbb4a GUI: Add Python interface to create custom command 2022-02-14 09:56:24 -06:00
wmayer
09da245af9 App: harmonize API of App::Application
* make getHomePath() static and return a std::string
* make getExecutableName() static and return a std::string
2021-11-04 10:50:09 +01:00
wmayer
fe7f4c4be7 Gui: remove QT_TR_NOOP from command group names and use "CommandGroup" as context string 2021-09-29 16:31:55 +02:00
wmayer
d2f3cd1e70 Gui: [skip ci] support different context in Command::translatedGroupName 2021-09-29 15:44:44 +02:00
wmayer
bc57ba6027 Gui: add convenience function Command::translatedGroupName() 2021-09-29 15:25:46 +02:00
Yorik van Havre
52a6558dfb Merge pull request #5000 from chennes/checkForConflictingAccelerators
[Core] Add checks for conflicting accelerators
2021-08-30 11:46:38 +02:00
carlopav
01df25866c Gui: Improved tooltips for grouped commands
Following previous improvements, this fix allows also Grouped Actions to have the new tooltip.
2021-08-29 23:30:58 +02:00
Chris Hennes
af9690ec06 [Core] Add checks for conflicting accelerators
When compiled in debug mode, this PR adds code to check for conflicting
accelerator keys when a command is created. This can help developers
ensure that their default accelerator key selections don't conflict.

Replace partial match algorithm

Co-authored-by: 0penBrain <48731257+0penBrain@users.noreply.github.com>
2021-08-29 16:13:59 -05:00
Chris Hennes
44ce401a53 [GUI] Refactor tooltip code to rebuild shortcut
When the shortcut/accelerator key is changed, the tooltip should be
recalculated using the same code that calculated the original. Also
ensure this happens when the accelerator preferences are loaded.

Fixes #4664.
2021-08-25 14:24:17 -05:00
carlopav
b5a5a6cd70 Gui: Improved tooltips
Improved tooltips showing:
- the command name as an <h3> title,
- the tooltip text,
- the (What's this).

the title is build from translated getMenuText() and can contain a "&" character. This commit search and remove the "&" characters. It should be better not to use the "&" character in the command name, but if it is necessary it has to be done with "&&".

ref forum discussion: https://forum.freecadweb.org/viewtopic.php?f=34&t=58747
.
2021-08-19 10:24:00 +02:00
luz paz
81918da613 Gui: remove py2 code 2021-04-25 11:27:48 +02:00
wmayer
b7aee7bfa1 fixes #0003844: PVS: The pointer was not released in destructor. A memory leak is possible. 2021-04-21 21:46:14 +02:00
wmayer
4c6c1af016 Gui: fix Command::_invoke to avoid build failure 2021-03-29 11:06:16 +02:00
wmayer
b55cc8aec1 Gui: [skip ci] refactor Command::invoke 2021-03-28 20:04:31 +02:00
wmayer
ffb196b1b7 Gui: Running a command with Gui.runCommand() must always be considered as Gui command 2021-03-28 18:40:16 +02:00
Zheng, Lei
0e2ab08121 Gui: temporary fix of preference menu in macos
QAction defaults menu role to TextHeuristicRole, which causes qt to
guess the menu role based on action title. And titles start with
'Config', 'Options', 'Settings', etc. will be considered as preference
menu. It seems some non-english translation causes the wrong action be
chosen as preference, such as 'Treeview actions'.

This commit just applied a temporary fix to default to QAction::NoRole
for GroupCommand. If there is ever some GroupCommand need to be a
system menu item on macos, we could add some command bit flag for that
purpose.
2020-12-24 16:58:18 +01:00
luz paz
298c677873 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
6199fbb25e Base: [skip ci] Coverity: Uncaught exception 2020-09-14 18:34:25 +02:00
Zheng, Lei
2fbac59d4f App: record transaction on non DocumentObject
Related #0004265
2020-09-04 16:01:21 +02:00
wmayer
c535881459 Qt5: Replace deprecated functions of QString:
'QString& QString::vsprintf(const char*, __va_list_tag*)' is deprecated: Use vasprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
2020-06-12 17:51:33 +02:00
wmayer
c814eb1a50 Qt5: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
f900bdf115 Gui: [skip ci] fixes #0004330: The Std_WhatsThis command does not work for 2 submenus of the View menu. 2020-04-30 14:53:37 +02:00