chore: reformat

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-08-02 18:35:35 +02:00
parent ce2ca13815
commit 1d468ac35a
594 changed files with 16040 additions and 16536 deletions

View File

@ -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();
}