#include "inputoverwatcher.h" #include #include "soundplayer.h" #include "backlight.h" #include "config.h" InputOverwatcher::InputOverwatcher(QObject *parent) : QObject(parent) { Define::config_item item = Config::getInstance()->getConfigValue(Define::config_set_auto_darkness); timer.setSingleShot(true); timer.setInterval(item.d32 * 60000); connect(&timer, SIGNAL(timeout()), SLOT(lowerBacklight())); } bool InputOverwatcher::eventFilter(QObject */*watched*/, QEvent *event) { switch (event->type()) { case QEvent::KeyPress: case QEvent::KeyRelease: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseMove: Backlight::restore(); timer.start(); break; default: break; } return false; } void InputOverwatcher::setDelay(int mins) { timer.setInterval(mins * 60000); timer.start(); } void InputOverwatcher::lowerBacklight() { Backlight::lower(); }