diff options
Diffstat (limited to 'application/KonamiCode.cpp')
-rw-r--r-- | application/KonamiCode.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/application/KonamiCode.cpp b/application/KonamiCode.cpp deleted file mode 100644 index 46a2a0b2..00000000 --- a/application/KonamiCode.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "KonamiCode.h" - -#include <array> -#include <QDebug> - -namespace { -const std::array<Qt::Key, 10> konamiCode = -{ - { - Qt::Key_Up, Qt::Key_Up, - Qt::Key_Down, Qt::Key_Down, - Qt::Key_Left, Qt::Key_Right, - Qt::Key_Left, Qt::Key_Right, - Qt::Key_B, Qt::Key_A - } -}; -} - -KonamiCode::KonamiCode(QObject* parent) : QObject(parent) -{ -} - - -void KonamiCode::input(QEvent* event) -{ - if( event->type() == QEvent::KeyPress ) - { - QKeyEvent *keyEvent = static_cast<QKeyEvent*>( event ); - auto key = Qt::Key(keyEvent->key()); - if(key == konamiCode[m_progress]) - { - m_progress ++; - } - else - { - m_progress = 0; - } - if(m_progress == static_cast<int>(konamiCode.size())) - { - m_progress = 0; - emit triggered(); - } - } -} |