DolphinQt: Make scrubbing configurable in convert dialog
This commit is contained in:
parent
6ffcbcee70
commit
acd00723ad
|
@ -5,10 +5,12 @@
|
|||
#include "DolphinQt/ConvertDialog.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QErrorMessage>
|
||||
#include <QFileDialog>
|
||||
|
@ -56,6 +58,12 @@ ConvertDialog::ConvertDialog(QList<std::shared_ptr<const UICommon::GameFile>> fi
|
|||
grid_layout->addWidget(new QLabel(tr("Format:")), 0, 0);
|
||||
grid_layout->addWidget(m_format, 0, 1);
|
||||
|
||||
m_scrub = new QCheckBox;
|
||||
grid_layout->addWidget(new QLabel(tr("Remove Junk Data (Irreversible):")), 1, 0);
|
||||
grid_layout->addWidget(m_scrub, 1, 1);
|
||||
m_scrub->setEnabled(
|
||||
std::none_of(m_files.begin(), m_files.end(), std::mem_fn(&UICommon::GameFile::IsDatelDisc)));
|
||||
|
||||
QPushButton* convert_button = new QPushButton(tr("Convert"));
|
||||
|
||||
QVBoxLayout* main_layout = new QVBoxLayout;
|
||||
|
@ -78,27 +86,44 @@ void ConvertDialog::AddToFormatComboBox(const QString& name, DiscIO::BlobType fo
|
|||
m_format->addItem(name, static_cast<int>(format));
|
||||
}
|
||||
|
||||
bool ConvertDialog::ShowAreYouSureDialog(const QString& text)
|
||||
{
|
||||
ModalMessageBox warning(this);
|
||||
warning.setIcon(QMessageBox::Warning);
|
||||
warning.setWindowTitle(tr("Confirm"));
|
||||
warning.setText(tr("Are you sure?"));
|
||||
warning.setInformativeText(text);
|
||||
warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
return warning.exec() == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
void ConvertDialog::Convert()
|
||||
{
|
||||
const DiscIO::BlobType format = static_cast<DiscIO::BlobType>(m_format->currentData().toInt());
|
||||
const bool scrub = m_scrub->isChecked();
|
||||
|
||||
const bool scrub_wii = format == DiscIO::BlobType::GCZ;
|
||||
if (scrub && format == DiscIO::BlobType::PLAIN)
|
||||
{
|
||||
if (!ShowAreYouSureDialog(tr("Removing junk data does not save any space when converting to "
|
||||
"ISO (unless you package the ISO file in a compressed file format "
|
||||
"such as ZIP afterwards). Do you want to continue anyway?")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (scrub_wii && std::any_of(m_files.begin(), m_files.end(), [](const auto& file) {
|
||||
return file->GetPlatform() == DiscIO::Platform::WiiDisc;
|
||||
if (!scrub && format == DiscIO::BlobType::GCZ &&
|
||||
std::any_of(m_files.begin(), m_files.end(), [](const auto& file) {
|
||||
return file->GetPlatform() == DiscIO::Platform::WiiDisc && !file->IsDatelDisc();
|
||||
}))
|
||||
{
|
||||
ModalMessageBox wii_warning(this);
|
||||
wii_warning.setIcon(QMessageBox::Warning);
|
||||
wii_warning.setWindowTitle(tr("Confirm"));
|
||||
wii_warning.setText(tr("Are you sure?"));
|
||||
wii_warning.setInformativeText(
|
||||
tr("Compressing a Wii disc image will irreversibly change the compressed copy by removing "
|
||||
"padding data. Your disc image will still work. Continue?"));
|
||||
wii_warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (wii_warning.exec() == QMessageBox::No)
|
||||
if (!ShowAreYouSureDialog(tr("Converting Wii disc images to GCZ without removing junk data "
|
||||
"does not save any noticeable amount of space compared to "
|
||||
"converting to ISO. Do you want to continue anyway?")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString extension;
|
||||
|
@ -182,7 +207,7 @@ void ConvertDialog::Convert()
|
|||
}
|
||||
|
||||
std::unique_ptr<DiscIO::BlobReader> blob_reader;
|
||||
bool scrub_current_file = scrub_wii && file->GetPlatform() == DiscIO::Platform::WiiDisc;
|
||||
bool scrub_current_file = scrub;
|
||||
|
||||
if (scrub_current_file)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "DiscIO/Blob.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
|
||||
namespace UICommon
|
||||
|
@ -32,6 +33,9 @@ private slots:
|
|||
private:
|
||||
void AddToFormatComboBox(const QString& name, DiscIO::BlobType format);
|
||||
|
||||
bool ShowAreYouSureDialog(const QString& text);
|
||||
|
||||
QComboBox* m_format;
|
||||
QCheckBox* m_scrub;
|
||||
QList<std::shared_ptr<const UICommon::GameFile>> m_files;
|
||||
};
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "Core/TitleDatabase.h"
|
||||
|
||||
#include "DiscIO/Blob.h"
|
||||
#include "DiscIO/DiscExtractor.h"
|
||||
#include "DiscIO/Enums.h"
|
||||
#include "DiscIO/Volume.h"
|
||||
#include "DiscIO/WiiSaveBanner.h"
|
||||
|
@ -117,6 +118,8 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
|
|||
m_file_size = volume->GetRawSize();
|
||||
m_volume_size = volume->GetSize();
|
||||
m_volume_size_is_accurate = volume->IsSizeAccurate();
|
||||
m_is_datel_disc = DiscIO::IsDisc(m_platform) &&
|
||||
!DiscIO::GetBootDOLOffset(*volume, volume->GetGamePartition());
|
||||
|
||||
m_internal_name = volume->GetInternalName();
|
||||
m_game_id = volume->GetGameID();
|
||||
|
@ -138,6 +141,7 @@ GameFile::GameFile(std::string path) : m_file_path(std::move(path))
|
|||
m_valid = true;
|
||||
m_file_size = m_volume_size = File::GetSize(m_file_path);
|
||||
m_volume_size_is_accurate = true;
|
||||
m_is_datel_disc = false;
|
||||
m_platform = DiscIO::Platform::ELFOrDOL;
|
||||
m_blob_type = DiscIO::BlobType::DIRECTORY;
|
||||
}
|
||||
|
@ -299,6 +303,7 @@ void GameFile::DoState(PointerWrap& p)
|
|||
p.Do(m_file_size);
|
||||
p.Do(m_volume_size);
|
||||
p.Do(m_volume_size_is_accurate);
|
||||
p.Do(m_is_datel_disc);
|
||||
|
||||
p.Do(m_short_names);
|
||||
p.Do(m_long_names);
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
u64 GetFileSize() const { return m_file_size; }
|
||||
u64 GetVolumeSize() const { return m_volume_size; }
|
||||
bool IsVolumeSizeAccurate() const { return m_volume_size_is_accurate; }
|
||||
bool IsDatelDisc() const { return m_is_datel_disc; }
|
||||
const GameBanner& GetBannerImage() const;
|
||||
const GameCover& GetCoverImage() const;
|
||||
void DoState(PointerWrap& p);
|
||||
|
@ -126,6 +127,7 @@ private:
|
|||
u64 m_file_size{};
|
||||
u64 m_volume_size{};
|
||||
bool m_volume_size_is_accurate{};
|
||||
bool m_is_datel_disc{};
|
||||
|
||||
std::map<DiscIO::Language, std::string> m_short_names;
|
||||
std::map<DiscIO::Language, std::string> m_long_names;
|
||||
|
|
Loading…
Reference in New Issue