suyu/src/yuzu/applets/qt_amiibo_settings.h

86 lines
2.4 KiB
C++
Raw Normal View History

2022-11-13 22:14:08 +01:00
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <array>
#include <memory>
#include <QDialog>
#include "core/frontend/applets/cabinet.h"
class GMainWindow;
class QCheckBox;
class QComboBox;
class QDialogButtonBox;
class QGroupBox;
class QLabel;
namespace InputCommon {
class InputSubsystem;
}
namespace Ui {
class QtAmiiboSettingsDialog;
}
namespace Service::NFC {
class NfcDevice;
} // namespace Service::NFC
2022-11-13 22:14:08 +01:00
class QtAmiiboSettingsDialog final : public QDialog {
Q_OBJECT
public:
explicit QtAmiiboSettingsDialog(QWidget* parent, Core::Frontend::CabinetParameters parameters_,
InputCommon::InputSubsystem* input_subsystem_,
std::shared_ptr<Service::NFC::NfcDevice> nfp_device_);
2022-11-13 22:14:08 +01:00
~QtAmiiboSettingsDialog() override;
int exec() override;
std::string GetName() const;
private:
void LoadInfo();
void LoadAmiiboInfo();
void LoadAmiiboApiInfo(std::string_view amiibo_id);
void LoadAmiiboData();
void LoadAmiiboGameInfo();
void SetGameDataName(u32 application_area_id);
void SetSettingsDescription();
std::unique_ptr<Ui::QtAmiiboSettingsDialog> ui;
InputCommon::InputSubsystem* input_subsystem;
std::shared_ptr<Service::NFC::NfcDevice> nfp_device;
2022-11-13 22:14:08 +01:00
// Parameters sent in from the backend HLE applet.
Core::Frontend::CabinetParameters parameters;
// If false amiibo settings failed to load
bool is_initalized{};
};
class QtAmiiboSettings final : public QObject, public Core::Frontend::CabinetApplet {
Q_OBJECT
public:
explicit QtAmiiboSettings(GMainWindow& parent);
~QtAmiiboSettings() override;
2023-03-25 18:29:08 +01:00
void Close() const override;
2022-11-13 22:14:08 +01:00
void ShowCabinetApplet(const Core::Frontend::CabinetCallback& callback_,
const Core::Frontend::CabinetParameters& parameters,
std::shared_ptr<Service::NFC::NfcDevice> nfp_device) const override;
2022-11-13 22:14:08 +01:00
signals:
void MainWindowShowAmiiboSettings(const Core::Frontend::CabinetParameters& parameters,
std::shared_ptr<Service::NFC::NfcDevice> nfp_device) const;
2023-03-25 18:29:08 +01:00
void MainWindowRequestExit() const;
2022-11-13 22:14:08 +01:00
private:
void MainWindowFinished(bool is_success, const std::string& name);
mutable Core::Frontend::CabinetCallback callback;
};