aboutsummaryrefslogtreecommitdiff
path: root/launcher/KonamiCode.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-04 19:42:36 +0200
committerGitHub <noreply@github.com>2023-08-04 19:42:36 +0200
commitae793f6cf11658c9abc5111e82d5ba7b3e6af127 (patch)
treeed41f30e2c0f02e4be1d42324b3f05fbab75b2cd /launcher/KonamiCode.cpp
parent50c7d39e082f0a7dbd977401e16d5adf534d9770 (diff)
parent1d638e018ac40fbfb35dd117f9a948c0cf35eadd (diff)
downloadPrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.tar.gz
PrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.tar.bz2
PrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.zip
Merge pull request #1459 from Scrumplex/format
Diffstat (limited to 'launcher/KonamiCode.cpp')
-rw-r--r--launcher/KonamiCode.cpp36
1 files changed, 10 insertions, 26 deletions
diff --git a/launcher/KonamiCode.cpp b/launcher/KonamiCode.cpp
index 46a2a0b2..f9ec3b89 100644
--- a/launcher/KonamiCode.cpp
+++ b/launcher/KonamiCode.cpp
@@ -1,42 +1,26 @@
#include "KonamiCode.h"
-#include <array>
#include <QDebug>
+#include <array>
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)
-{
+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 );
+ 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
- {
+ if (key == konamiCode[m_progress]) {
+ m_progress++;
+ } else {
m_progress = 0;
}
- if(m_progress == static_cast<int>(konamiCode.size()))
- {
+ if (m_progress == static_cast<int>(konamiCode.size())) {
m_progress = 0;
emit triggered();
}