Merge pull request #8881 from JosJuice/convert-same-format

DolphinQt: Allow converting to same format
This commit is contained in:
Tilka 2020-06-17 11:56:49 +01:00 committed by GitHub
commit 3411802fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);