From cde45e5e1144edca234626c98dc15ab67b983a98 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sat, 1 Oct 2022 22:52:31 +0200 Subject: [PATCH] chore: drop KonamiCode Signed-off-by: Sefa Eyeoglu --- launcher/CMakeLists.txt | 4 ---- launcher/KonamiCode.cpp | 44 -------------------------------------- launcher/KonamiCode.h | 17 --------------- launcher/ui/MainWindow.cpp | 13 ----------- launcher/ui/MainWindow.h | 4 ---- 5 files changed, 82 deletions(-) delete mode 100644 launcher/KonamiCode.cpp delete mode 100644 launcher/KonamiCode.h diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 8981ba394..75f1f4b82 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -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 diff --git a/launcher/KonamiCode.cpp b/launcher/KonamiCode.cpp deleted file mode 100644 index 46a2a0b2e..000000000 --- a/launcher/KonamiCode.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "KonamiCode.h" - -#include -#include - -namespace { -const std::array 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( event ); - auto key = Qt::Key(keyEvent->key()); - if(key == konamiCode[m_progress]) - { - m_progress ++; - } - else - { - m_progress = 0; - } - if(m_progress == static_cast(konamiCode.size())) - { - m_progress = 0; - emit triggered(); - } - } -} diff --git a/launcher/KonamiCode.h b/launcher/KonamiCode.h deleted file mode 100644 index 3d320ae7f..000000000 --- a/launcher/KonamiCode.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include - -class KonamiCode : public QObject -{ - Q_OBJECT -public: - KonamiCode(QObject *parent = 0); - void input(QEvent *event); - -signals: - void triggered(); - -private: - int m_progress = 0; -}; diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp index 4fea1529c..cf9da69c1 100644 --- a/launcher/ui/MainWindow.cpp +++ b/launcher/ui/MainWindow.cpp @@ -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 actions; @@ -1330,7 +1318,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *ev) { if (ev->type() == QEvent::KeyPress) { - secretEventFilter->input(ev); QKeyEvent *keyEvent = static_cast(ev); switch (keyEvent->key()) { diff --git a/launcher/ui/MainWindow.h b/launcher/ui/MainWindow.h index 511967105..5510b0c84 100644 --- a/launcher/ui/MainWindow.h +++ b/launcher/ui/MainWindow.h @@ -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 m_newsChecker;