Commit Graph

110 Commits

Author SHA1 Message Date
Zheng, Lei
2cb2fa5626 Gui: fix GroupCommand icon setup 2022-11-10 23:20:18 +01:00
Zheng, Lei
775452cbc0 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
ff1b4eff05 Gui: Replace C cast 2022-09-18 11:06:51 -05:00
berniev
ae53c9b0a4 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
23961706be Gui: modernize C++: replace 'typedef' with 'using' 2022-08-29 14:09:18 +02:00
berniev
3d1f70765a Gui: redundant void 2 2022-08-08 10:21:44 +02:00
berniev
2db561561e Gui: use empty 2022-08-06 16:35:45 +02:00
wmayer
85bd6b5c6b 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
7886d3cbf4 Remove unused code into GUI 2022-07-17 03:53:11 +02:00
wmayer
ab6c75fad9 Core: replace PyObject_IsTrue with Base::asBoolean 2022-07-16 14:04:05 +02:00
wmayer
55828c22c0 Py: make FreeCAD to compile with Py3.11 2022-07-01 17:54:50 +02:00
Chris Hennes
cc1315dae1 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
88fb277481 Gui: Fix crash when invoke command with sMenuText equal to nullptr 2022-05-16 13:47:29 +02:00
Zheng, Lei
8bec44934b Fix mixed line endings 2022-04-26 12:52:55 -05:00
Chris Hennes
5df3dbae6f Gui: PR6497 move return statement to new line 2022-03-29 12:33:50 -05:00
wmayer
1178df06b4 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
Uwe
4f5c29edd6 [Gui] Quarter: remove unused includes 2022-03-09 01:12:15 +01:00
wmayer
8f786ea6ef Gui: Optimize includes to reduce compile time 2022-03-07 20:29:18 +01:00
Uwe
c104c83f37 [Gui] remove some more unused headers 2022-02-19 04:31:27 +01:00
Uwe
36b3ac81d2 [Gui] remove more unused headers 2022-02-19 04:04:14 +01:00
Chris Hennes
019d1588a6 Gui: Correct generation of macro pref name 2022-02-17 10:23:32 -06:00
Chris Hennes
93836b89a5 GUI: Add Python interface to create custom command 2022-02-14 09:56:24 -06:00
wmayer
f36126770c 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
6f20e3e4d8 Gui: remove QT_TR_NOOP from command group names and use "CommandGroup" as context string 2021-09-29 16:31:55 +02:00
wmayer
f1431f06c9 Gui: [skip ci] support different context in Command::translatedGroupName 2021-09-29 15:44:44 +02:00
wmayer
76da77f80e Gui: add convenience function Command::translatedGroupName() 2021-09-29 15:25:46 +02:00
Yorik van Havre
4cab702b00 Merge pull request #5000 from chennes/checkForConflictingAccelerators
[Core] Add checks for conflicting accelerators
2021-08-30 11:46:38 +02:00
carlopav
e36b8f458f 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
767bc22948 [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
f194ca7425 [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
072fc9f0fe 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
17ffa8255b Gui: remove py2 code 2021-04-25 11:27:48 +02:00
wmayer
3fd643d3ee fixes #0003844: PVS: The pointer was not released in destructor. A memory leak is possible. 2021-04-21 21:46:14 +02:00
wmayer
7babbb9825 Gui: fix Command::_invoke to avoid build failure 2021-03-29 11:06:16 +02:00
wmayer
ca83354bf9 Gui: [skip ci] refactor Command::invoke 2021-03-28 20:04:31 +02:00
wmayer
44c444bf2f Gui: Running a command with Gui.runCommand() must always be considered as Gui command 2021-03-28 18:40:16 +02:00
Zheng, Lei
cc44089782 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
38815b9550 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
033e4d900b Base: [skip ci] Coverity: Uncaught exception 2020-09-14 18:34:25 +02:00
Zheng, Lei
f67d960146 App: record transaction on non DocumentObject
Related #0004265
2020-09-04 16:01:21 +02:00
wmayer
a455927d4a 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
7b72dcb062 Qt5: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
501b11a03d 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
Zheng, Lei
3b1aa19f05 Gui: add class GroupCommand help with grouped command
As an example usage, changed StdCmdTreeViewActions to be derived from
GroupCommand
2019-10-08 10:16:00 +02:00
Zheng, Lei
2fe15c87cf Gui: output Cmt type macro line as comment in python console 2019-10-08 10:15:18 +02:00
luz.paz
fb32601746 Fix various (doxy) typos and whitespace issues
Found via `codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,currenty,dof,doubleclick,dum,eiter,elemente,feld,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml`
2019-10-03 07:57:13 +02:00
wmayer
9fa56345cf core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
Zheng, Lei
f1b569621a Split App::AutoTransaction into its own file 2019-09-10 14:17:07 +02:00
wmayer
1c234373d6 fix MSVC compiler warnings 2019-08-17 19:35:21 +02:00
Zheng, Lei
f36714974a Command: disable auto transaction if triggering editing
Each command will create an App::AutoTransaction to auto create and
commit a transaction for proper undo/redo. But if the command starts
editing, the current transaction may be required to out live the current
command.

Note that the command can only detect editing if the code calls
Gui::Document::setEdit(). There are objects that starts editing by
calling its own ViewProvider::setEdit(), e.g. various TechDraw
ViewProviders. In this case, to avoid auto committing, one can call
App::Application::setActiveTransaction() with the second argument set to
true, or call App::AutoTransaction::setEnable(false).
2019-08-17 15:32:51 +02:00