aboutsummaryrefslogtreecommitdiff
path: root/launcher/KonamiCode.cpp
diff options
context:
space:
mode:
authorTayou <31988415+TayouVR@users.noreply.github.com>2023-08-07 10:32:38 +0200
committerGitHub <noreply@github.com>2023-08-07 10:32:38 +0200
commit9afa7cc91fd889b146c609c6a59f7f7b3d995d9f (patch)
tree20ef3bd30beedca4995875485e468ee323d52096 /launcher/KonamiCode.cpp
parentb572f75dbaad61cf305f1fd4f60ba94d74bfa3fa (diff)
parent75c7df46a7022a46d447bb96fbde619e5d65db05 (diff)
downloadPrismLauncher-9afa7cc91fd889b146c609c6a59f7f7b3d995d9f.tar.gz
PrismLauncher-9afa7cc91fd889b146c609c6a59f7f7b3d995d9f.tar.bz2
PrismLauncher-9afa7cc91fd889b146c609c6a59f7f7b3d995d9f.zip
Merge branch 'develop' into icon-indexing
Signed-off-by: Tayou <31988415+TayouVR@users.noreply.github.com>
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();
}