chore: drop KonamiCode

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-10-01 22:52:31 +02:00
parent f85683cb3b
commit cde45e5e11
No known key found for this signature in database
GPG Key ID: C10411294912A422
5 changed files with 0 additions and 82 deletions

View File

@ -588,10 +588,6 @@ SET(LAUNCHER_SOURCES
VersionProxyModel.cpp
HoeDown.h
# Super secret!
KonamiCode.h
KonamiCode.cpp
# Bundled resources
resources/backgrounds/backgrounds.qrc
resources/multimc/multimc.qrc

View File

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

View File

@ -1,17 +0,0 @@
#pragma once
#include <QKeyEvent>
class KonamiCode : public QObject
{
Q_OBJECT
public:
KonamiCode(QObject *parent = 0);
void input(QEvent *event);
signals:
void triggered();
private:
int m_progress = 0;
};

View File

@ -105,7 +105,6 @@
#include "ui/dialogs/ExportInstanceDialog.h"
#include "UpdateController.h"
#include "KonamiCode.h"
#include "InstanceImportTask.h"
#include "InstanceCopyTask.h"
@ -848,12 +847,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
connect(q, SIGNAL(activated()), qApp, SLOT(quit()));
}
// Konami Code
{
secretEventFilter = new KonamiCode(this);
connect(secretEventFilter, &KonamiCode::triggered, this, &MainWindow::konamiTriggered);
}
// Add the news label to the news toolbar.
{
m_newsChecker.reset(new NewsChecker(APPLICATION->network(), BuildConfig.NEWS_RSS_URL));
@ -1040,11 +1033,6 @@ QMenu * MainWindow::createPopupMenu()
return filteredMenu;
}
void MainWindow::konamiTriggered()
{
qDebug() << "Super Secret Mode ACTIVATED!";
}
void MainWindow::showInstanceContextMenu(const QPoint &pos, InstancePtr inst)
{
QList<QAction *> actions;
@ -1330,7 +1318,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *ev)
{
if (ev->type() == QEvent::KeyPress)
{
secretEventFilter->input(ev);
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
switch (keyEvent->key())
{

View File

@ -59,7 +59,6 @@ class QLabel;
class InstanceView;
class MinecraftLauncher;
class BaseProfilerFactory;
class KonamiCode;
class InstanceTask;
class MainWindow : public QMainWindow
@ -197,8 +196,6 @@ private slots:
*/
void downloadUpdates(GoUpdate::Status status);
void konamiTriggered();
void globalSettingsClosed();
#ifndef Q_OS_MAC
@ -230,7 +227,6 @@ private:
QLabel *m_statusCenter = nullptr;
QMenu *accountMenu = nullptr;
QToolButton *accountMenuButton = nullptr;
KonamiCode * secretEventFilter = nullptr;
unique_qobject_ptr<NewsChecker> m_newsChecker;