예제 #1
0
void MemoryCardManagerDialog::on_import_saves_button_clicked()
{
    QFileDialog dialog(this);
    dialog.setFileMode(QFileDialog::ExistingFiles);
    dialog.setNameFilter(tr("All Supported types (*.psu *.sps *.xps *.max);;EMS Memory Adapter Save Dumps (*.psu);;Sharkport/X-Port Save Dumps (*.sps; *.xps);;Action Replay MAX Save Dumps (*.max);;All files (*.*)"));
    if (dialog.exec())
    {
        QString fileName = dialog.selectedFiles().first();


        try
        {
            auto input(Framework::CStdStream(fileName.toStdString().c_str(), "r"));
            CSaveImporter::ImportSave(input, m_pCurrentMemoryCard->GetBasePath(),
                                      std::bind(&MemoryCardManagerDialog::OnImportOverwrite, this, std::placeholders::_1));
        }
        catch(const std::exception& Exception)
        {
            QString msg("Couldn't import save(s):\n\n%1");
            QMessageBox messageBox;
            messageBox.critical(this,"Error",msg.arg(Exception.what()));
            messageBox.show();
            return;
        }

        m_pCurrentMemoryCard->RefreshContents();
        populateSaveList();
    }
}
예제 #2
0
MemoryCardManagerDialog::MemoryCardManagerDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MemoryCardManagerDialog),
    m_MemoryCard0(CAppConfig::GetInstance().GetPreferenceString("ps2.mc0.directory")),
    m_MemoryCard1(CAppConfig::GetInstance().GetPreferenceString("ps2.mc1.directory"))
{
    ui->setupUi(this);

    m_pMemoryCard[0] = &m_MemoryCard0;
    m_pMemoryCard[1] = &m_MemoryCard1;

    m_pCurrentMemoryCard = m_pMemoryCard[0];

    populateSaveList();

    ui->label_name->setWordWrap(true);
}
예제 #3
0
MemoryCardManagerDialog::MemoryCardManagerDialog(QWidget* parent)
    : QDialog(parent)
    , ui(new Ui::MemoryCardManagerDialog)
    , m_MemoryCard0(CAppConfig::GetInstance().GetPreferencePath(PREF_PS2_MC0_DIRECTORY))
    , m_MemoryCard1(CAppConfig::GetInstance().GetPreferencePath(PREF_PS2_MC1_DIRECTORY))
{
	ui->setupUi(this);

	m_pMemoryCard[0] = &m_MemoryCard0;
	m_pMemoryCard[1] = &m_MemoryCard1;

	m_pCurrentMemoryCard = m_pMemoryCard[0];

	populateSaveList();

	ui->label_name->setWordWrap(true);
}
예제 #4
0
void MemoryCardManagerDialog::on_delete_save_button_clicked()
{
    QMessageBox::StandardButton resBtn = QMessageBox::question(this, "Overwrite?",
                                                               "Are you sure you want to delete the currently selected entry",
                                                               QMessageBox::Yes | QMessageBox::No,
                                                               QMessageBox::Yes);
    if (resBtn == QMessageBox::Yes)
    {
        int currentRow = ui->savelistWidget->currentRow();
        int nItemCount = static_cast<int>(m_pCurrentMemoryCard->GetSaveCount() - 1);
        if (currentRow >= 0  && currentRow <= nItemCount)
        {
            const CSave *save = m_pCurrentMemoryCard->GetSaveByIndex(currentRow);
            boost::filesystem::remove_all(save->GetPath());
            m_pCurrentMemoryCard->RefreshContents();
            populateSaveList();
        }
    }
}
예제 #5
0
void MemoryCardManagerDialog::on_comboBox_currentIndexChanged(int index)
{

    m_pCurrentMemoryCard = m_pMemoryCard[index];
    populateSaveList();
}