summaryrefslogtreecommitdiffstats
path: root/application/KonamiCode.cpp
diff options
context:
space:
mode:
authorThomas Groman <tgroman@nuegia.net>2019-09-19 00:41:48 -0700
committerThomas Groman <tgroman@nuegia.net>2019-09-19 00:41:48 -0700
commit32b3ed0a1362a4b0798ad71fac3450fb77cb7e41 (patch)
tree7be7a2f602e6a5af7bc2db86bef9cf2a659c3d3d /application/KonamiCode.cpp
parent5fb2c6334e7d5237db11695b4c0ec0f2d1e47c88 (diff)
downloadMultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.tar
MultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.tar.gz
MultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.tar.lz
MultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.tar.xz
MultiMC-32b3ed0a1362a4b0798ad71fac3450fb77cb7e41.zip
merged from 0.6.7 codebase
Diffstat (limited to 'application/KonamiCode.cpp')
-rw-r--r--application/KonamiCode.cpp48
1 files changed, 25 insertions, 23 deletions
diff --git a/application/KonamiCode.cpp b/application/KonamiCode.cpp
index 07c285bc..4c5af837 100644
--- a/application/KonamiCode.cpp
+++ b/application/KonamiCode.cpp
@@ -6,11 +6,13 @@
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
+ {
+ 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
+ }
};
}
@@ -21,22 +23,22 @@ 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 == konamiCode.size())
- {
- m_progress = 0;
- emit triggered();
- }
- }
+ 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 == konamiCode.size())
+ {
+ m_progress = 0;
+ emit triggered();
+ }
+ }
}