Commit Graph

29 Commits

Author SHA1 Message Date
patrick96 4f8f076714 Remove atomic members from static modules 2021-09-30 15:38:18 +02:00
Patrick Ziegler 26be83f893
module: Implement action router (#2336)
* module: Implement proof of concept action router

Action implementation inside module becomes much cleaner because each
module just registers action names together with a callback (pointer to
member function) and the action router does the rest.

* Make input function final

This forces all modules to use the action router

* modules: Catch exceptions in action handlers

* Use action router for all modules

* Use action_ prefix for function names

The mpd module's 'stop' action overwrote the base module's stop function
which caused difficult to debug behavior.

To prevent this in the future we now prefix each function that is
responsible for an action with 'action_'

* Cleanup

* actions: Throw exception when re-registering action

Action names are unique inside modules. Unfortunately there is no way to
ensure this statically, the next best thing is to crash the module and
let the user know that this is a bug.

* Formatting

* actions: Ignore data for actions without data

This is the same behavior as before.

* action_router: Write tests
2021-01-04 10:25:52 +01:00
patrick96 9fb75779f3 Incorporate reviews 2020-11-26 20:53:53 +01:00
patrick96 ef8f7c9d94 feat(menu): Add exec action to menu module
Can be used to execute menu actions through ipc and will also be used to
make sure the menu closes when an action on it is clicked.
2020-11-26 20:53:53 +01:00
patrick96 bc1b86c584 actions: Separate data from action string
Modules now no longer need to manually parse the action string and
extract data from it.
2020-11-26 20:53:53 +01:00
patrick96 ae2350167b actions: Switch all modules over to new system
All modules now expose their actions as public static constants

Issues: The menu module no longer closes when an item is clicked (before
it would intercept any executed command and look if it matches one of
its exec commands)
2020-11-26 20:53:53 +01:00
patrick96 d592eea966 refactor: Move module type string into modules
This allows us to identify module by their type and it is also better to
store the module type as part of the module instead of having it
hardcoded in factory.hpp
2020-11-26 20:53:53 +01:00
patrick96 4b5007294b refactor(modules): Make all modules input handlers
By default they will return false for calls to `input`
2020-11-26 20:53:53 +01:00
Patrick Ziegler 8c1ba8358d feat(menu): Add expand-right option (#658)
expand-right defaults to true to preserve the current functionality
If set to false, the items in the menu will be added to the left of the
toggle label (instead of the right side)

Should resolve the issue discussed in #655
2017-08-29 13:25:41 -07:00
Michael Carlberg b422d1d1a4 refactor(modules): Input handling 2016-12-23 20:43:52 +01:00
Michael Carlberg 97fa7052fe refactor(clang-tidy): Apply fixes 2016-12-23 15:54:06 +01:00
Michael Carlberg 7979f5b3d4 refactor(modules): Handle events using signal_receiver 2016-12-21 08:38:44 +01:00
Michael Carlberg c01f111e34 refactor(modules): Move setup to constructor 2016-12-21 08:00:09 +01:00
Michael Carlberg ff9be848c7 refactor(clang-tidy): Apply fixes 2016-11-25 21:58:49 +01:00
Michael Carlberg c6d85b2b92 refactor: Optimize build 2016-11-20 23:04:31 +01:00
Michael Carlberg 88c8bbd940 refactor: Fwd declare drawtypes
Ref #164
2016-11-19 15:49:06 +01:00
Michael Carlberg fd57ab0f3d fix: project rename 2016-11-19 06:26:07 +01:00
Michael Carlberg e7cb345cec wip: Separate source from definitions 2016-11-03 12:54:32 +01:00
Michael Carlberg d2187f44e0 refactor(drawtypes): Cleanup and fixes 2016-10-25 07:10:05 +02:00
Michael Carlberg 68f72d69cc refactor: Drop tokenized labels
Handle placeholder tokens inside each label
instead of cloning into a new instance each time
2016-10-19 01:31:17 +02:00
Michael Carlberg 2af0d0845d fix(docs): Updated README and configs
Use dash instead of underscore as parameter name separator
Will break alot of configs but people like to work!
2016-10-12 05:19:31 +02:00
Michael Carlberg e5d981faf9 refactor(menu): Menu module logic 2016-10-11 15:28:14 +02:00
Michael Carlberg c687b07cd0 fix: Handle mouse button click/scroll events 2016-10-10 18:05:58 +02:00
Michael Carlberg d359ab6057 refactor: Application rewrite 2016-10-10 14:52:57 +02:00
Michael Carlberg f406f1eb9f Cleanup and compiler check fixes 2016-06-29 11:06:44 +02:00
Michael Carlberg e1f8c001dd refactor: Pass by value 2016-06-21 04:23:23 +02:00
Michael Carlberg 2c74cb06de task(dsl): Replace colons with dashes
Colons break ini syntax highlighters and linters.
2016-06-11 07:49:14 +02:00
Michael Carlberg 39d3f61497 refactor(core): Clean-up
- use "#pragma once" instead of the regular include guard
- fix errors and warnings reported by cppcheck
2016-06-02 01:32:06 +02:00
Michael Carlberg eeefb3c610 init(git): Base commit 2016-05-19 20:23:45 +02:00