dolphin/Source/Core/DolphinQt/GCMemcardManager.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

108 lines
3 KiB
C
Raw Normal View History

2018-01-25 19:54:50 +01:00
// Copyright 2018 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2018-01-25 19:54:50 +01:00
#pragma once
#include <map>
2018-01-25 19:54:50 +01:00
#include <memory>
#include <span>
2018-01-25 19:54:50 +01:00
#include <vector>
#include <QDialog>
#include "Common/CommonTypes.h"
2022-01-11 22:02:50 +01:00
#include "Common/EnumMap.h"
#include "Core/HW/EXI/EXI.h"
namespace Memcard
{
2018-01-25 19:54:50 +01:00
class GCMemcard;
class GCMemcardErrorCode;
struct Savefile;
enum class ReadSavefileErrorCode;
enum class SavefileFormat;
} // namespace Memcard
2018-01-25 19:54:50 +01:00
class QAction;
2018-01-25 19:54:50 +01:00
class QDialogButtonBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QMenu;
2019-02-25 20:59:49 +01:00
class QPixmap;
2018-01-25 19:54:50 +01:00
class QPushButton;
class QString;
2018-01-25 19:54:50 +01:00
class QTableWidget;
class QTimer;
class QToolButton;
2018-01-25 19:54:50 +01:00
class GCMemcardManager : public QDialog
{
Q_OBJECT
2018-01-25 19:54:50 +01:00
public:
explicit GCMemcardManager(QWidget* parent = nullptr);
~GCMemcardManager();
static QString GetErrorMessagesForErrorCode(const Memcard::GCMemcardErrorCode& code);
static QString GetErrorMessageForErrorCode(Memcard::ReadSavefileErrorCode code);
2018-01-25 19:54:50 +01:00
private:
struct IconAnimationData;
2018-01-25 19:54:50 +01:00
void CreateWidgets();
void ConnectWidgets();
void LoadDefaultMemcards();
2018-01-25 19:54:50 +01:00
void UpdateActions();
2022-01-11 22:02:50 +01:00
void UpdateSlotTable(ExpansionInterface::Slot slot);
void SetSlotFile(ExpansionInterface::Slot slot, QString path);
void SetSlotFileInteractive(ExpansionInterface::Slot slot);
void SetActiveSlot(ExpansionInterface::Slot slot);
2018-01-25 19:54:50 +01:00
std::vector<u8> GetSelectedFileIndices();
void ImportFiles(ExpansionInterface::Slot slot, std::span<const Memcard::Savefile> savefiles);
2018-01-25 19:54:50 +01:00
void CopyFiles();
void ImportFile();
void DeleteFiles();
void ExportFiles(Memcard::SavefileFormat format);
2018-01-25 19:54:50 +01:00
void FixChecksums();
2022-01-11 22:02:50 +01:00
void CreateNewCard(ExpansionInterface::Slot slot);
2018-01-25 19:54:50 +01:00
void DrawIcons();
2022-01-11 22:02:50 +01:00
QPixmap GetBannerFromSaveFile(int file_index, ExpansionInterface::Slot slot);
2022-01-11 22:02:50 +01:00
IconAnimationData GetIconFromSaveFile(int file_index, ExpansionInterface::Slot slot);
2018-01-25 19:54:50 +01:00
// Actions
QPushButton* m_select_button;
QPushButton* m_copy_button;
QToolButton* m_export_button;
QMenu* m_export_menu;
QAction* m_export_gci_action;
QAction* m_export_gcs_action;
QAction* m_export_sav_action;
2018-01-25 19:54:50 +01:00
QPushButton* m_import_button;
QPushButton* m_delete_button;
QPushButton* m_fix_checksums_button;
// Slots
2022-01-11 22:02:50 +01:00
Common::EnumMap<std::map<u8, IconAnimationData>, ExpansionInterface::MAX_MEMCARD_SLOT>
m_slot_active_icons;
Common::EnumMap<std::unique_ptr<Memcard::GCMemcard>, ExpansionInterface::MAX_MEMCARD_SLOT>
m_slot_memcard;
Common::EnumMap<QGroupBox*, ExpansionInterface::MAX_MEMCARD_SLOT> m_slot_group;
Common::EnumMap<QLineEdit*, ExpansionInterface::MAX_MEMCARD_SLOT> m_slot_file_edit;
Common::EnumMap<QPushButton*, ExpansionInterface::MAX_MEMCARD_SLOT> m_slot_open_button;
Common::EnumMap<QPushButton*, ExpansionInterface::MAX_MEMCARD_SLOT> m_slot_create_button;
Common::EnumMap<QTableWidget*, ExpansionInterface::MAX_MEMCARD_SLOT> m_slot_table;
Common::EnumMap<QLabel*, ExpansionInterface::MAX_MEMCARD_SLOT> m_slot_stat_label;
ExpansionInterface::Slot m_active_slot;
u64 m_current_frame = 0;
2018-01-25 19:54:50 +01:00
QDialogButtonBox* m_button_box;
QTimer* m_timer;
};