diff options
| author | Sebastien Braun | 2010-10-07 22:54:10 +0200 |
|---|---|---|
| committer | Sebastien Braun | 2010-10-07 22:54:10 +0200 |
| commit | e61097b8881bc7e72a5499816cb1199ea274a3ca (patch) | |
| tree | bcfa9f3fe3f43af02845bc21367de395b248600c /src/input/magicSysRqHandler.h | |
| parent | Make behaviour on lookup failures configurable (diff) | |
| download | pvs-e61097b8881bc7e72a5499816cb1199ea274a3ca.tar.gz pvs-e61097b8881bc7e72a5499816cb1199ea274a3ca.tar.xz pvs-e61097b8881bc7e72a5499816cb1199ea274a3ca.zip | |
Rework template meta-magic
- No more implicit dependency on Boost.MPL
- Better documentation for template magic
- Move input handler policies to handler definitions where they belong
- Separate out event descriptions from handlers
Diffstat (limited to 'src/input/magicSysRqHandler.h')
| -rw-r--r-- | src/input/magicSysRqHandler.h | 52 |
1 files changed, 7 insertions, 45 deletions
diff --git a/src/input/magicSysRqHandler.h b/src/input/magicSysRqHandler.h index 563d091..ba02997 100644 --- a/src/input/magicSysRqHandler.h +++ b/src/input/magicSysRqHandler.h @@ -19,54 +19,16 @@ #include "inputEventHandler.h" -class MagicSysRqHandler : public DefaultInputEventHandler<InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ> +class MagicSysRqHandler : public InputEventHandler< + input_policy::Match<InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ>, + input_policy::Require<input_policy::LinuxSystem> > { public: - void handle(InputEvent const& evt, InputEventContext const* ctx); + void doHandle(InputEvent const& evt, InputEventContext const* ctx); - static void describeInto(QList<SpecialInputEventDescription>& list) - { - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Reboot immediately"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'b'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Crash system"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'c'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Show all held logs"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'd'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Send SIGTERM to all"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'e'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Activate OOM killer"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'f'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Send SIGKILL to all"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'i'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Force thaw filesystems"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'j'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Kill all on terminal"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'k'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Show stack traces"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'l'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Dump memory info"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'm'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Make real-time tasks niceable"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'n'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Power off immediately"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'o'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Dump registers and flags"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'p'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Dump timers and clockevents"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'q'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Turn off raw keyboard mode"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'r'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Sync all mounted filesystems"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 's'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Dump task list"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 't'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Remount all read-only"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'u'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Dump uninterruptible tasks"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'w'); - list << SpecialInputEventDescription(QCoreApplication::translate("InputEventHandler", "Dump ftrace buffer"), - InputEvent::ET_SPECIAL, InputEvent::EC_SYSRQ, 'z'); - } +// static void describeInto(QList<SpecialInputEventDescription>& list) +// { +// } }; #endif /* MAGICSYSRQHANDLER_H_ */ |
