2018-01-25 11:54:50 -07:00
|
|
|
// Copyright 2018 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <memory>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
2019-08-08 08:28:30 -06:00
|
|
|
#include "Common/CommonTypes.h"
|
|
|
|
|
2020-06-14 18:09:37 -06:00
|
|
|
namespace Memcard
|
|
|
|
{
|
2018-01-25 11:54:50 -07:00
|
|
|
class GCMemcard;
|
2019-08-14 20:08:20 -06:00
|
|
|
class GCMemcardErrorCode;
|
2020-06-14 18:09:37 -06:00
|
|
|
} // namespace Memcard
|
2018-01-25 11:54:50 -07:00
|
|
|
|
|
|
|
class QDialogButtonBox;
|
|
|
|
class QGroupBox;
|
|
|
|
class QLabel;
|
|
|
|
class QLineEdit;
|
2019-02-25 12:59:49 -07:00
|
|
|
class QPixmap;
|
2018-01-25 11:54:50 -07:00
|
|
|
class QPushButton;
|
2019-08-14 20:08:20 -06:00
|
|
|
class QString;
|
2018-01-25 11:54:50 -07:00
|
|
|
class QTableWidget;
|
|
|
|
class QTimer;
|
|
|
|
|
|
|
|
class GCMemcardManager : public QDialog
|
|
|
|
{
|
2018-05-13 14:16:20 -06:00
|
|
|
Q_OBJECT
|
2018-01-25 11:54:50 -07:00
|
|
|
public:
|
|
|
|
explicit GCMemcardManager(QWidget* parent = nullptr);
|
|
|
|
~GCMemcardManager();
|
|
|
|
|
2020-06-14 18:09:37 -06:00
|
|
|
static QString GetErrorMessagesForErrorCode(const Memcard::GCMemcardErrorCode& code);
|
2019-08-14 20:08:20 -06:00
|
|
|
|
2018-01-25 11:54:50 -07:00
|
|
|
private:
|
2019-08-08 08:28:30 -06:00
|
|
|
struct IconAnimationData;
|
|
|
|
|
2018-01-25 11:54:50 -07:00
|
|
|
void CreateWidgets();
|
|
|
|
void ConnectWidgets();
|
2019-06-15 21:26:28 -06:00
|
|
|
void LoadDefaultMemcards();
|
2018-01-25 11:54:50 -07:00
|
|
|
|
|
|
|
void UpdateActions();
|
|
|
|
void UpdateSlotTable(int slot);
|
|
|
|
void SetSlotFile(int slot, QString path);
|
|
|
|
void SetSlotFileInteractive(int slot);
|
|
|
|
void SetActiveSlot(int slot);
|
|
|
|
|
|
|
|
void CopyFiles();
|
|
|
|
void ImportFile();
|
|
|
|
void DeleteFiles();
|
|
|
|
void ExportFiles(bool prompt);
|
|
|
|
void ExportAllFiles();
|
|
|
|
void FixChecksums();
|
2019-11-20 13:47:10 -07:00
|
|
|
void CreateNewCard(int slot);
|
2018-01-25 11:54:50 -07:00
|
|
|
void DrawIcons();
|
|
|
|
|
2018-08-24 04:39:43 -06:00
|
|
|
QPixmap GetBannerFromSaveFile(int file_index, int slot);
|
2019-08-08 08:28:30 -06:00
|
|
|
|
|
|
|
IconAnimationData GetIconFromSaveFile(int file_index, int slot);
|
2018-01-25 11:54:50 -07:00
|
|
|
|
|
|
|
// Actions
|
|
|
|
QPushButton* m_select_button;
|
|
|
|
QPushButton* m_copy_button;
|
|
|
|
QPushButton* m_export_button;
|
|
|
|
QPushButton* m_export_all_button;
|
|
|
|
QPushButton* m_import_button;
|
|
|
|
QPushButton* m_delete_button;
|
|
|
|
QPushButton* m_fix_checksums_button;
|
|
|
|
|
|
|
|
// Slots
|
|
|
|
static constexpr int SLOT_COUNT = 2;
|
2019-08-08 08:28:30 -06:00
|
|
|
std::array<std::vector<IconAnimationData>, SLOT_COUNT> m_slot_active_icons;
|
2020-06-14 18:09:37 -06:00
|
|
|
std::array<std::unique_ptr<Memcard::GCMemcard>, SLOT_COUNT> m_slot_memcard;
|
2018-01-25 11:54:50 -07:00
|
|
|
std::array<QGroupBox*, SLOT_COUNT> m_slot_group;
|
|
|
|
std::array<QLineEdit*, SLOT_COUNT> m_slot_file_edit;
|
2019-11-20 13:47:10 -07:00
|
|
|
std::array<QPushButton*, SLOT_COUNT> m_slot_open_button;
|
|
|
|
std::array<QPushButton*, SLOT_COUNT> m_slot_create_button;
|
2018-01-25 11:54:50 -07:00
|
|
|
std::array<QTableWidget*, SLOT_COUNT> m_slot_table;
|
|
|
|
std::array<QLabel*, SLOT_COUNT> m_slot_stat_label;
|
|
|
|
|
|
|
|
int m_active_slot;
|
2019-08-08 08:28:30 -06:00
|
|
|
u64 m_current_frame = 0;
|
2018-01-25 11:54:50 -07:00
|
|
|
|
|
|
|
QDialogButtonBox* m_button_box;
|
|
|
|
QTimer* m_timer;
|
|
|
|
};
|