DolphinQt: Allow converting to same format

Mainly useful for WIA and RVZ, but also has some use for GCZ.
This commit is contained in:
JosJuice 2020-06-17 12:44:16 +02:00
parent 7cdd0e2430
commit ec3ea6c1df
2 changed files with 7 additions and 14 deletions

View File

@ -55,8 +55,13 @@ ConvertDialog::ConvertDialog(QList<std::shared_ptr<const UICommon::GameFile>> fi
grid_layout->setColumnStretch(1, 1);
m_format = new QComboBox;
AddToFormatComboBox(QStringLiteral("ISO"), DiscIO::BlobType::PLAIN);
AddToFormatComboBox(QStringLiteral("GCZ"), DiscIO::BlobType::GCZ);
m_format->addItem(QStringLiteral("ISO"), static_cast<int>(DiscIO::BlobType::PLAIN));
m_format->addItem(QStringLiteral("GCZ"), static_cast<int>(DiscIO::BlobType::GCZ));
if (std::all_of(m_files.begin(), m_files.end(),
[](const auto& file) { return file->GetBlobType() == DiscIO::BlobType::PLAIN; }))
{
m_format->setCurrentIndex(m_format->count() - 1);
}
grid_layout->addWidget(new QLabel(tr("Format:")), 0, 0);
grid_layout->addWidget(m_format, 0, 1);
@ -104,17 +109,6 @@ ConvertDialog::ConvertDialog(QList<std::shared_ptr<const UICommon::GameFile>> fi
OnFormatChanged();
}
void ConvertDialog::AddToFormatComboBox(const QString& name, DiscIO::BlobType format)
{
if (std::all_of(m_files.begin(), m_files.end(),
[format](const auto& file) { return file->GetBlobType() == format; }))
{
return;
}
m_format->addItem(name, static_cast<int>(format));
}
void ConvertDialog::AddToBlockSizeComboBox(int size)
{
m_block_size->addItem(QString::fromStdString(UICommon::FormatSize(size, 0)), size);

View File

@ -32,7 +32,6 @@ private slots:
void Convert();
private:
void AddToFormatComboBox(const QString& name, DiscIO::BlobType format);
void AddToBlockSizeComboBox(int size);
bool ShowAreYouSureDialog(const QString& text);