Introduce actions hash table
ClosedPublic

Authored by wojnilowicz on Jun 25 2017, 12:53 PM.

Details

Summary

The purpose of this patch is to make actions handling in KMyMoney easier.

Advantages:

  1. Action names are defined in one place, so no multiple and unconnected definitions of the same action name.
  2. Action names are now QStringLiterals, so no allocation of QStrings occurs.
  3. Use of KStandardAction::name to get standard action names instead of hardcoded strings subject to change.
  4. Use of actionCollection()->action(QString) instead of action(char *) because the second makes internal QString allocation anyway.
  5. No use of KToggleAction because everything can be done with QAction.
  6. QKeySequence uses Qt::CTRL + Qt::Key_F rather than "Ctrl+F", so less processing power and memory is used.
  7. No multiple QAction pointers in KMyMoneyApp::initActions.
  8. Actions are connected using new signal-slot syntax, so errors are easy to spot.
  9. Actions are initialized through one loop from struct, so every action is initialized the same way and with little error probability.
  10. Through initialization lists it's easier to see what action has got what icon, signal, text, and shortcut.
  11. Easier to change icon theme on the fly.

Diff Detail

Repository
R261 KMyMoney
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
wojnilowicz created this revision.Jun 25 2017, 12:53 PM
tbaumgart accepted this revision as: tbaumgart.Jul 6 2017, 11:47 AM
tbaumgart added a subscriber: tbaumgart.

Very nice and clean.

This revision is now accepted and ready to land.Jul 6 2017, 11:47 AM
This revision was automatically updated to reflect the committed changes.