I've done a relatively significant refactoring of some code related to the animation Timeline Docker with the goal of minimizing code duplication, generalizing functions, and slightly simplifying the right-click context menu options.
I've created a enum called TimelineDirection that represents the concept of LEFT and RIGHT (with optional aliases BEFORE and AFTER). The purpose of this is to pass direction as a parameter to more general functions instead of relying on xLeft and xRight functions with similar code. Some parameter-less xLeft and xRight slots still exist (for the sake of easily hooking up to action trigger signals), but in most cases these functions are simply forwarding a one-line call to one of the more general-use functions.
TimelineDirection parameters also allow us to simplify the right-click context menus. While things like "Insert Frame Left" and "Insert Column Right" still exist, a new "Side" option in the InsertKeyFrameDialog when inserting multiple frames/columns has made the "N Keyframes Left" and "N Keyframes Right" menu actions redundant. As such, the "N" options have been combined into "Insert Multiple Keyframes", and "Insert Multiple Columns" respectively, and the user can set Left or Right side along with Count and Timing within the dialog menu.
Known Bug: For some reason the context menus aren't drawing properly for me. The menu items work as intended, but aren't visible. I've looked through the code a few times and I can't quite determine what the cause of this error is. Any idea what might cause this?
Question: Dmitry, how do you feel about single-line function member function calls being in the header file? For example, in the header:
void slotInsertKeyframeLeft() {insertKeyframes(1, 1, TimelineDirection::LEFT, false);}
Personally I think it's quite clean, but I can also understand if it's a policy to keep all function definitions in the source files even if they're just single-liners. Let me know if I should change them!
Anyway, if this refactor is unhelpful/unwanted/too drastic, then I understand and no hard feelings or anything!