From ec3ea6c1df19c1e7b28aa78df12a4d21c746394a Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 17 Jun 2020 12:44:16 +0200 Subject: [PATCH] DolphinQt: Allow converting to same format Mainly useful for WIA and RVZ, but also has some use for GCZ. --- Source/Core/DolphinQt/ConvertDialog.cpp | 20 +++++++------------- Source/Core/DolphinQt/ConvertDialog.h | 1 - 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Source/Core/DolphinQt/ConvertDialog.cpp b/Source/Core/DolphinQt/ConvertDialog.cpp index aa0a519c26..a359f48f03 100644 --- a/Source/Core/DolphinQt/ConvertDialog.cpp +++ b/Source/Core/DolphinQt/ConvertDialog.cpp @@ -55,8 +55,13 @@ ConvertDialog::ConvertDialog(QList> 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(DiscIO::BlobType::PLAIN)); + m_format->addItem(QStringLiteral("GCZ"), static_cast(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> 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(format)); -} - void ConvertDialog::AddToBlockSizeComboBox(int size) { m_block_size->addItem(QString::fromStdString(UICommon::FormatSize(size, 0)), size); diff --git a/Source/Core/DolphinQt/ConvertDialog.h b/Source/Core/DolphinQt/ConvertDialog.h index 1ff80b4a07..1a3a9bbf4a 100644 --- a/Source/Core/DolphinQt/ConvertDialog.h +++ b/Source/Core/DolphinQt/ConvertDialog.h @@ -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);