From e61097b8881bc7e72a5499816cb1199ea274a3ca Mon Sep 17 00:00:00 2001 From: Sebastien Braun Date: Thu, 7 Oct 2010 22:54:10 +0200 Subject: 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 --- src/input/magicSysRqHandler.h | 52 ++++++------------------------------------- 1 file changed, 7 insertions(+), 45 deletions(-) (limited to 'src/input/magicSysRqHandler.h') 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 +class MagicSysRqHandler : public InputEventHandler< + input_policy::Match, + input_policy::Require > { public: - void handle(InputEvent const& evt, InputEventContext const* ctx); + void doHandle(InputEvent const& evt, InputEventContext const* ctx); - static void describeInto(QList& 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& list) +// { +// } }; #endif /* MAGICSYSRQHANDLER_H_ */ -- cgit v1.2.3-55-g7522