Repository navigation
refactor: turn Emotes into EmoteController - #6516
Conversation
pajlada
left a comment
There was a problem hiding this comment.
In Chatterino, "controller" is technically a euphemism for "singleton". One practical difference is that controllers have subdirectories (e.g. controllers/hotkeys) as opposed to singletons.
In Chatterino, singletons are something that are created & accessed statically, we just haven't renamed/moved classes out of that directory. Controllers are meant as Application-owned once-constructed "backends" for data.
Removed IEmotes in favor of a virtual initialize() that subclasses can reimplement. This way, the accessors don't need to be virtual anymore.
This removes the ability for us to mock the members of the emote controller (I know we haven't taken advantage of this). Do you foresee mocking of Emojis/TwitchEmotes or EmoteController to not be necessary?
When you say "...that subclasses can reimplement", what subclasses do you have in mind?
6274d3f to
ac88010
Compare
I don't think we need to mock the members. The closest would be
The only subclass is the mock that omits initialization. |
* refactor: turn `Emotes` into `EmoteController` * changelog * why does clang-format do this??? * nit: remove unused include from EmoteController.hpp --------- Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
In Chatterino, "controller" is technically a euphemism for "singleton". One practical difference is that controllers have subdirectories (e.g.
controllers/hotkeys) as opposed to singletons.In #6436, I want to add some other classes related to emotes. Since they're semantically related, they should also be physically related by being in the same directory. Hence, this PR turns
Emotesinto anEmoteController. The controller has the following differences:IEmotesin favor of a virtualinitialize()that subclasses can reimplement. This way, the accessors don't need to be virtual anymore.getprefix of trivial accessors.unique_ptrfor all members to avoid including too many files (e.g.TwitchEmotes.hpp).