From 0cf7e8a84a6343df58b930547fed94dc898ca8c1 Mon Sep 17 00:00:00 2001 From: Pengfei Date: Tue, 17 Aug 2021 00:30:08 +0800 Subject: [PATCH] Really properly be per-monitor DPI aware This is so hard... --- src/frontend/CMakeLists.txt | 2 + src/frontend/cia_build_dialog.cpp | 7 +- src/frontend/cia_build_dialog.h | 4 +- src/frontend/cia_build_dialog.ui | 17 - src/frontend/helpers/dpi_aware_dialog.cpp | 68 +++ src/frontend/helpers/dpi_aware_dialog.h | 36 ++ src/frontend/import_dialog.cpp | 27 +- src/frontend/import_dialog.h | 6 +- src/frontend/import_dialog.ui | 8 - src/frontend/main.cpp | 23 +- src/frontend/main.h | 58 +-- src/frontend/main.ui | 164 ++++--- src/frontend/select_files_dialog.cpp | 7 +- src/frontend/select_files_dialog.h | 56 ++- src/frontend/select_files_dialog.ui | 144 +++--- src/frontend/title_info_dialog.cpp | 7 +- src/frontend/title_info_dialog.h | 4 +- src/frontend/title_info_dialog.ui | 8 - src/frontend/utilities.cpp | 5 +- src/frontend/utilities.h | 98 ++-- src/frontend/utilities.ui | 528 ++++++++++------------ 21 files changed, 656 insertions(+), 621 deletions(-) create mode 100644 src/frontend/helpers/dpi_aware_dialog.cpp create mode 100644 src/frontend/helpers/dpi_aware_dialog.h diff --git a/src/frontend/CMakeLists.txt b/src/frontend/CMakeLists.txt index 13e5cb5..00632fe 100644 --- a/src/frontend/CMakeLists.txt +++ b/src/frontend/CMakeLists.txt @@ -9,6 +9,8 @@ endif() file(GLOB_RECURSE THEMES ${PROJECT_SOURCE_DIR}/dist/themes/*) add_executable(threeSD + helpers/dpi_aware_dialog.cpp + helpers/dpi_aware_dialog.h helpers/frontend_common.cpp helpers/frontend_common.h helpers/multi_job.cpp diff --git a/src/frontend/cia_build_dialog.cpp b/src/frontend/cia_build_dialog.cpp index 44f2a37..2a7aba0 100644 --- a/src/frontend/cia_build_dialog.cpp +++ b/src/frontend/cia_build_dialog.cpp @@ -12,12 +12,11 @@ CIABuildDialog::CIABuildDialog(QWidget* parent, bool is_dir_, bool is_nand, bool enable_legit, const QString& default_path) - : QDialog(parent), ui(std::make_unique()), is_dir(is_dir_) { - ui->setupUi(this); + : DPIAwareDialog(parent, 510, 260), ui(std::make_unique()), + is_dir(is_dir_) { + ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); - const double scale = qApp->desktop()->logicalDpiX() / 96.0; - resize(static_cast(width() * scale), static_cast(height() * scale)); if (is_dir) { setWindowTitle(tr("Batch Build CIA")); diff --git a/src/frontend/cia_build_dialog.h b/src/frontend/cia_build_dialog.h index 0f51023..03d6c7f 100644 --- a/src/frontend/cia_build_dialog.h +++ b/src/frontend/cia_build_dialog.h @@ -6,14 +6,14 @@ #include #include -#include #include "core/file_sys/cia_common.h" +#include "frontend/helpers/dpi_aware_dialog.h" namespace Ui { class CIABuildDialog; } -class CIABuildDialog : public QDialog { +class CIABuildDialog : public DPIAwareDialog { Q_OBJECT public: diff --git a/src/frontend/cia_build_dialog.ui b/src/frontend/cia_build_dialog.ui index c8da2b6..519b87a 100644 --- a/src/frontend/cia_build_dialog.ui +++ b/src/frontend/cia_build_dialog.ui @@ -2,14 +2,6 @@ CIABuildDialog - - - 0 - 0 - 510 - 260 - - Build CIA @@ -59,9 +51,6 @@ - - true - Recommended for general use.<br>Decrypted CIA with decrypted contents and standard ticket. @@ -76,9 +65,6 @@ - - true - Encrypted CIA with legit TMD, encrypted contents and standard ticket. @@ -93,9 +79,6 @@ - - true - Encrypted CIA with legit TMD, encrypted contents and legit ticket.<br>WARNING: Legit ticket may include console identifying information! diff --git a/src/frontend/helpers/dpi_aware_dialog.cpp b/src/frontend/helpers/dpi_aware_dialog.cpp new file mode 100644 index 0000000..92114d2 --- /dev/null +++ b/src/frontend/helpers/dpi_aware_dialog.cpp @@ -0,0 +1,68 @@ +// Copyright 2021 threeSD Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include +#include +#include "common/logging/log.h" +#include "frontend/helpers/dpi_aware_dialog.h" + +DPIAwareDialog::DPIAwareDialog(QWidget* parent, int width, int height) + : QDialog(parent), original_width(width), original_height(height) {} + +DPIAwareDialog::~DPIAwareDialog() = default; + +void DPIAwareDialog::showEvent(QShowEvent* event) { + QDialog::showEvent(event); + if (window_handle) { + return; + } + + // Initialize window_handle and connections + window_handle = windowHandle(); + if (!window_handle) { + return; + } + +#ifdef __APPLE__ + // Note: macOS implements system level virtualization, so there's no need to connect here. + // but we still need to call SetContentSizes() at least once to set up the UI + resize(original_width, original_height); + SetContentSizes(); +#else + resized = false; + connect(window_handle, &QWindow::screenChanged, this, &DPIAwareDialog::OnScreenChanged); + OnScreenChanged(); +#endif +} + +void DPIAwareDialog::resizeEvent(QResizeEvent* event) { + QDialog::resizeEvent(event); + resized = true; +} + +#ifndef __APPLE__ +void DPIAwareDialog::OnScreenChanged() { + // Resize according to DPI + const double scaleX = window_handle->screen()->logicalDotsPerInchX() / 96.0; + const double scaleY = window_handle->screen()->logicalDotsPerInchY() / 96.0; + if (resized) { + const int new_width = static_cast(scaleX * width() / previous_scaleX); + const int new_height = static_cast(scaleY * height() / previous_scaleY); + setMinimumSize(0, 0); // Enforce this resize + resize(new_width, new_height); + } else { + const int new_width = static_cast(original_width * scaleX); + const int new_height = static_cast(original_height * scaleY); + setMinimumSize(new_width, new_height); + adjustSize(); + resized = false; // This resize isn't user-initiated + } + + SetContentSizes(previous_width, previous_height); + previous_scaleX = scaleX; + previous_scaleY = scaleY; + previous_width = width(); + previous_height = height(); +} +#endif diff --git a/src/frontend/helpers/dpi_aware_dialog.h b/src/frontend/helpers/dpi_aware_dialog.h new file mode 100644 index 0000000..76bf409 --- /dev/null +++ b/src/frontend/helpers/dpi_aware_dialog.h @@ -0,0 +1,36 @@ +// Copyright 2021 threeSD Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include + +class DPIAwareDialog : public QDialog { +public: + explicit DPIAwareDialog(QWidget* parent, int width, int height); + ~DPIAwareDialog() override; + +protected: + void showEvent(QShowEvent* event) override; + void resizeEvent(QResizeEvent* event) override; + + // Called with two zeroes to set up content sizes that are relative to dialog size. Also called + // when screen is changed, to update those sizes. + virtual void SetContentSizes(int previous_width, int previous_height){}; + +private: +#ifndef __APPLE__ + void OnScreenChanged(); +#endif + + QWindow* window_handle{}; + const int original_width{}; + const int original_height{}; + + bool resized = false; // whether this dialog has been manually resized + double previous_scaleX{}; + double previous_scaleY{}; + int previous_width{}; + int previous_height{}; +}; diff --git a/src/frontend/import_dialog.cpp b/src/frontend/import_dialog.cpp index c671c12..e62f72e 100644 --- a/src/frontend/import_dialog.cpp +++ b/src/frontend/import_dialog.cpp @@ -82,17 +82,14 @@ static QPixmap GetContentIcon(const Core::ContentSpecifier& specifier, } ImportDialog::ImportDialog(QWidget* parent, const Core::Config& config_) - : QDialog(parent), ui(std::make_unique()), config(config_) { + : DPIAwareDialog(parent, 560, 320), ui(std::make_unique()), config(config_) { qRegisterMetaType("u64"); qRegisterMetaType("std::size_t"); qRegisterMetaType(); ui->setupUi(this); - setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); - const double scale = qApp->desktop()->logicalDpiX() / 96.0; - resize(static_cast(width() * scale), static_cast(height() * scale)); RelistContent(); UpdateSizeDisplay(); @@ -113,18 +110,26 @@ ImportDialog::ImportDialog(QWidget* parent, const Core::Config& config_) connect(ui->title_view_button, &QRadioButton::toggled, this, &ImportDialog::RepopulateContent); connect(ui->advanced_button, &QPushButton::clicked, this, &ImportDialog::ShowAdvancedMenu); - // Set up column widths. - // These values are tweaked with regard to the default dialog size. - ui->main->setColumnWidth(0, width() * 0.11); - ui->main->setColumnWidth(1, width() * 0.525); - ui->main->setColumnWidth(2, width() * 0.18); - ui->main->setColumnWidth(3, width() * 0.10); - + ui->main->header()->setStretchLastSection(false); connect(ui->main, &QTreeWidget::customContextMenuRequested, this, &ImportDialog::OnContextMenu); } ImportDialog::~ImportDialog() = default; +void ImportDialog::SetContentSizes(int previous_width, int previous_height) { + const int current_width = width(); + if (previous_width == 0) { // first time + ui->main->setColumnWidth(0, current_width * 0.11); + ui->main->setColumnWidth(1, current_width * 0.55); + ui->main->setColumnWidth(2, current_width * 0.15); + ui->main->setColumnWidth(3, current_width * 0.1); + } else { // proportionally update column widths + for (int i : {0, 1, 2, 3}) { + ui->main->setColumnWidth(i, ui->main->columnWidth(i) * current_width / previous_width); + } + } +} + void ImportDialog::RelistContent() { auto* dialog = new QProgressDialog(tr("Loading Contents..."), tr("Cancel"), 0, 0, this); dialog->setWindowFlags(dialog->windowFlags() & (~Qt::WindowContextHelpButtonHint)); diff --git a/src/frontend/import_dialog.h b/src/frontend/import_dialog.h index 74b5096..87f7190 100644 --- a/src/frontend/import_dialog.h +++ b/src/frontend/import_dialog.h @@ -7,10 +7,10 @@ #include #include #include -#include #include #include "core/file_sys/ncch_container.h" #include "core/importer.h" +#include "helpers/dpi_aware_dialog.h" class AdvancedMenu; class MultiJob; @@ -21,7 +21,7 @@ namespace Ui { class ImportDialog; } -class ImportDialog : public QDialog { +class ImportDialog final : public DPIAwareDialog { Q_OBJECT public: @@ -29,6 +29,8 @@ public: ~ImportDialog() override; private: + void SetContentSizes(int previous_width, int previous_height) override; + void RelistContent(); void RepopulateContent(); void UpdateSizeDisplay(); diff --git a/src/frontend/import_dialog.ui b/src/frontend/import_dialog.ui index 13c53ee..03b7fba 100644 --- a/src/frontend/import_dialog.ui +++ b/src/frontend/import_dialog.ui @@ -2,14 +2,6 @@ ImportDialog - - - 0 - 0 - 560 - 320 - - Select Contents diff --git a/src/frontend/main.cpp b/src/frontend/main.cpp index 599f7d7..4c87190 100644 --- a/src/frontend/main.cpp +++ b/src/frontend/main.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -37,12 +36,11 @@ bool IsConfigGood(const Core::Config& config) { !config.movable_sed_path.empty() && !config.bootrom_path.empty(); } -MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique()) { - ui->setupUi(this); +MainDialog::MainDialog(QWidget* parent) + : DPIAwareDialog(parent, 640, 256), ui(std::make_unique()) { + ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); - const double scale = qApp->desktop()->logicalDpiX() / 96.0; - resize(static_cast(width() * scale), static_cast(height() * scale)); ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(false); ui->buttonBox->button(QDialogButtonBox::StandardButton::Reset)->setText(tr("Refresh")); @@ -89,9 +87,6 @@ MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_uniquemain->setIndentation(4); - ui->main->setColumnWidth(0, 0.3 * width()); - ui->main->setColumnWidth(1, 0.4 * width()); - ui->main->setColumnWidth(2, 0.2 * width()); // Set up device watcher auto* device_watcher = new QDeviceWatcher(this); @@ -103,6 +98,18 @@ MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_uniquemain->setColumnWidth(0, 0.3 * current_width); + ui->main->setColumnWidth(1, 0.4 * current_width); + } else { // proportionally update column widths + for (int i : {0, 1}) { + ui->main->setColumnWidth(i, ui->main->columnWidth(i) * current_width / previous_width); + } + } +} + static const std::regex sdmc_path_regex{"(.+)([/\\\\])Nintendo 3DS/([0-9a-f]{32})/([0-9a-f]{32})/"}; void MainDialog::LoadPresetConfig() { diff --git a/src/frontend/main.h b/src/frontend/main.h index 3e8bb0d..4199b3e 100644 --- a/src/frontend/main.h +++ b/src/frontend/main.h @@ -1,28 +1,30 @@ -// Copyright 2019 threeSD Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include -#include -#include "core/importer.h" - -namespace Ui { -class MainDialog; -} - -class MainDialog : public QDialog { - Q_OBJECT - -public: - explicit MainDialog(QWidget* parent = nullptr); - ~MainDialog() override; - -private: - void LoadPresetConfig(); - void LaunchImportDialog(); - - std::vector preset_config_list; - std::unique_ptr ui; -}; +// Copyright 2019 threeSD Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include "core/importer.h" +#include "frontend/helpers/dpi_aware_dialog.h" + +namespace Ui { +class MainDialog; +} + +class MainDialog final : public DPIAwareDialog { + Q_OBJECT + +public: + explicit MainDialog(QWidget* parent = nullptr); + ~MainDialog() override; + +private: + void SetContentSizes(int previous_width, int previous_height) override; + + void LoadPresetConfig(); + void LaunchImportDialog(); + + std::vector preset_config_list; + std::unique_ptr ui; +}; diff --git a/src/frontend/main.ui b/src/frontend/main.ui index 51dd96f..40cc3c4 100644 --- a/src/frontend/main.ui +++ b/src/frontend/main.ui @@ -1,86 +1,78 @@ - - - MainDialog - - - - 0 - 0 - 640 - 256 - - - - threeSD - - - - - - - - Select your SD card root, or manually browse when not detected. - - - - - - - Qt::Horizontal - - - - - - - Utilities... - - - - - - - - - - Path - - - - - ID - - - - - Status - - - - - - - - - - - - - Qt::Horizontal - - - - - - - - - QDialogButtonBox::Ok|QDialogButtonBox::Reset - - - - - - - - + + + MainDialog + + + threeSD + + + + + + + + Select your SD card root, or manually browse when not detected. + + + + + + + Qt::Horizontal + + + + + + + Utilities... + + + + + + + + + + Path + + + + + ID + + + + + Status + + + + + + + + + + + + + Qt::Horizontal + + + + + + + + + QDialogButtonBox::Ok|QDialogButtonBox::Reset + + + + + + + + diff --git a/src/frontend/select_files_dialog.cpp b/src/frontend/select_files_dialog.cpp index 0bcc87b..2be182d 100644 --- a/src/frontend/select_files_dialog.cpp +++ b/src/frontend/select_files_dialog.cpp @@ -9,14 +9,11 @@ #include "ui_select_files_dialog.h" SelectFilesDialog::SelectFilesDialog(QWidget* parent, bool source_is_dir_, bool destination_is_dir_) - : QDialog(parent), ui(std::make_unique()), source_is_dir(source_is_dir_), - destination_is_dir(destination_is_dir_) { + : DPIAwareDialog(parent, 480, 96), ui(std::make_unique()), + source_is_dir(source_is_dir_), destination_is_dir(destination_is_dir_) { ui->setupUi(this); - setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); - const double scale = qApp->desktop()->logicalDpiX() / 96.0; - resize(static_cast(width() * scale), static_cast(height() * scale)); connect(ui->buttonBox, &QDialogButtonBox::accepted, [this] { if (ui->source->text().isEmpty() || ui->destination->text().isEmpty()) { diff --git a/src/frontend/select_files_dialog.h b/src/frontend/select_files_dialog.h index ebc4510..403a44e 100644 --- a/src/frontend/select_files_dialog.h +++ b/src/frontend/select_files_dialog.h @@ -1,29 +1,27 @@ -// Copyright 2020 threeSD Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include -#include - -class QWidget; - -namespace Ui { -class SelectFilesDialog; -} - -class SelectFilesDialog : public QDialog { - Q_OBJECT - -public: - explicit SelectFilesDialog(QWidget* parent, bool source_is_dir, bool destination_is_dir); - ~SelectFilesDialog() override; - - std::pair GetResults() const; - -private: - std::unique_ptr ui; - bool source_is_dir; // Whether Source should be a directory - bool destination_is_dir; // Whether Destination should be a directory -}; +// Copyright 2020 threeSD Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include "frontend/helpers/dpi_aware_dialog.h" + +namespace Ui { +class SelectFilesDialog; +} + +class SelectFilesDialog : public DPIAwareDialog { + Q_OBJECT + +public: + explicit SelectFilesDialog(QWidget* parent, bool source_is_dir, bool destination_is_dir); + ~SelectFilesDialog() override; + + std::pair GetResults() const; + +private: + std::unique_ptr ui; + bool source_is_dir; // Whether Source should be a directory + bool destination_is_dir; // Whether Destination should be a directory +}; diff --git a/src/frontend/select_files_dialog.ui b/src/frontend/select_files_dialog.ui index 9436e0a..467f20d 100644 --- a/src/frontend/select_files_dialog.ui +++ b/src/frontend/select_files_dialog.ui @@ -1,76 +1,68 @@ - - - SelectFilesDialog - - - - 0 - 0 - 480 - 96 - - - - Select Files - - - - - - - - Source: - - - - - - - - - - - 0 - 0 - - - - ... - - - - - - - Destination: - - - - - - - - - - - 0 - 0 - - - - ... - - - - - - - - - QDialogButtonBox::Ok|QDialogButtonBox::Cancel - - - - - - + + + SelectFilesDialog + + + Select Files + + + + + + + + Source: + + + + + + + + + + + 0 + 0 + + + + ... + + + + + + + Destination: + + + + + + + + + + + 0 + 0 + + + + ... + + + + + + + + + QDialogButtonBox::Ok|QDialogButtonBox::Cancel + + + + + + diff --git a/src/frontend/title_info_dialog.cpp b/src/frontend/title_info_dialog.cpp index 823add1..4e85153 100644 --- a/src/frontend/title_info_dialog.cpp +++ b/src/frontend/title_info_dialog.cpp @@ -20,14 +20,11 @@ TitleInfoDialog::TitleInfoDialog(QWidget* parent, Core::SDMCImporter& importer_, Core::ContentSpecifier specifier_) - : QDialog(parent), ui(std::make_unique()), importer(importer_), - specifier(std::move(specifier_)) { + : DPIAwareDialog(parent, 500, 360), ui(std::make_unique()), + importer(importer_), specifier(std::move(specifier_)) { ui->setupUi(this); - setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); - const double scale = qApp->desktop()->logicalDpiX() / 96.0; - resize(static_cast(width() * scale), static_cast(height() * scale)); LoadInfo(); diff --git a/src/frontend/title_info_dialog.h b/src/frontend/title_info_dialog.h index 19c8f9d..e4b18a9 100644 --- a/src/frontend/title_info_dialog.h +++ b/src/frontend/title_info_dialog.h @@ -3,8 +3,8 @@ // Refer to the license.txt file included. #include -#include #include "core/file_sys/smdh.h" +#include "frontend/helpers/dpi_aware_dialog.h" namespace Core { struct Config; @@ -18,7 +18,7 @@ namespace Ui { class TitleInfoDialog; } -class TitleInfoDialog : public QDialog { +class TitleInfoDialog : public DPIAwareDialog { Q_OBJECT public: diff --git a/src/frontend/title_info_dialog.ui b/src/frontend/title_info_dialog.ui index 9fbfb73..79525ea 100644 --- a/src/frontend/title_info_dialog.ui +++ b/src/frontend/title_info_dialog.ui @@ -2,14 +2,6 @@ TitleInfoDialog - - - 0 - 0 - 500 - 360 - - Title Info diff --git a/src/frontend/utilities.cpp b/src/frontend/utilities.cpp index 0a5055c..bf7cc1a 100644 --- a/src/frontend/utilities.cpp +++ b/src/frontend/utilities.cpp @@ -19,13 +19,10 @@ #include "ui_utilities.h" UtilitiesDialog::UtilitiesDialog(QWidget* parent) - : QDialog(parent), ui(std::make_unique()) { + : DPIAwareDialog(parent, 640, 384), ui(std::make_unique()) { ui->setupUi(this); - setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); - const double scale = qApp->desktop()->logicalDpiX() / 96.0; - resize(static_cast(width() * scale), static_cast(height() * scale)); connect(ui->useSdDecryption, &QCheckBox::clicked, [this] { const bool checked = ui->useSdDecryption->isChecked(); diff --git a/src/frontend/utilities.h b/src/frontend/utilities.h index d84a53e..a420695 100644 --- a/src/frontend/utilities.h +++ b/src/frontend/utilities.h @@ -1,49 +1,49 @@ -// Copyright 2020 threeSD Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include -#include -#include - -class QWidget; - -namespace Ui { -class UtilitiesDialog; -} - -class UtilitiesDialog : public QDialog { - Q_OBJECT - -public: - explicit UtilitiesDialog(QWidget* parent); - ~UtilitiesDialog() override; - -private: - /** - * Open a dialog to ask the user for source and destination paths. - * @return {source, destination} - */ - std::pair GetFilePaths(bool source_is_dir, bool destination_is_dir); - - bool LoadSDKeys(); - - void ShowProgressDialog(std::function operation); - - /** - * Gets SDMC root, and relative source path. - * @return {success, sdmc root, relative source path} - */ - std::tuple GetSDMCRoot(const QString& source); - - void SDDecryptionTool(); - void SaveDataExtractionTool(); - void ExtdataExtractionTool(); - void RomFSExtractionTool(); - void ShowResult(); - - bool result = false; /// Result of the last operation. - std::unique_ptr ui; -}; +// Copyright 2020 threeSD Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include +#include "frontend/helpers/dpi_aware_dialog.h" + +class QWidget; + +namespace Ui { +class UtilitiesDialog; +} + +class UtilitiesDialog : public DPIAwareDialog { + Q_OBJECT + +public: + explicit UtilitiesDialog(QWidget* parent); + ~UtilitiesDialog() override; + +private: + /** + * Open a dialog to ask the user for source and destination paths. + * @return {source, destination} + */ + std::pair GetFilePaths(bool source_is_dir, bool destination_is_dir); + + bool LoadSDKeys(); + + void ShowProgressDialog(std::function operation); + + /** + * Gets SDMC root, and relative source path. + * @return {success, sdmc root, relative source path} + */ + std::tuple GetSDMCRoot(const QString& source); + + void SDDecryptionTool(); + void SaveDataExtractionTool(); + void ExtdataExtractionTool(); + void RomFSExtractionTool(); + void ShowResult(); + + bool result = false; /// Result of the last operation. + std::unique_ptr ui; +}; diff --git a/src/frontend/utilities.ui b/src/frontend/utilities.ui index a7eead6..6e42eed 100644 --- a/src/frontend/utilities.ui +++ b/src/frontend/utilities.ui @@ -1,277 +1,251 @@ - - - UtilitiesDialog - - - - 0 - 0 - 640 - 384 - - - - threeSD Utilities - - - - - - Encryption - - - - - - Use SD Decryption (check this when your files are directly from SD Card) - - - true - - - - - - - - - boot9.bin - - - - - - - - - - - 0 - 0 - - - - ... - - - - - - - movable.sed - - - - - - - - - - - 0 - 0 - - - - ... - - - - - - - SDMC Root - - - Path to "Nintendo 3DS/<ID0>/<ID1>" folder. - - - - - - - - - - - 0 - 0 - - - - ... - - - - - - - - - - - - SD Decryption - - - - - - Decrypt files from your SD Card. - - - - - - - SD Decryption must be enabled to use this tool. - - - false - - - - - - - Qt::Horizontal - - - - - - - Open... - - - - - - - - - - Save Data Extraction - - - - - - Extract 3DS SD Savegames. - - - - - - - SD Decryption must be enabled to use this tool. - - - false - - - - - - - Qt::Horizontal - - - - - - - Open... - - - - - - - - - - Extdata Extraction - - - - - - Extract 3DS Extra Data. - - - - - - - SD Decryption must be enabled to use this tool. - - - false - - - - - - - Qt::Horizontal - - - - - - - Open... - - - - - - - - - - RomFS Extraction - - - - - - Extract shared RomFS from NCCH. Useful for System Archives. - - - false - - - - - - - SD Decryption must be disabled to use this tool. - - - - - - - Qt::Horizontal - - - - - - - Open... - - - false - - - - - - - - - + + + UtilitiesDialog + + + threeSD Utilities + + + + + + Encryption + + + + + + Use SD Decryption (check this when your files are directly from SD Card) + + + true + + + + + + + + + boot9.bin + + + + + + + + + + ... + + + + + + + movable.sed + + + + + + + + + + ... + + + + + + + SDMC Root + + + Path to "Nintendo 3DS/<ID0>/<ID1>" folder. + + + + + + + + + + ... + + + + + + + + + + + + SD Decryption + + + + + + Decrypt files from your SD Card. + + + + + + + SD Decryption must be enabled to use this tool. + + + false + + + + + + + Qt::Horizontal + + + + + + + Open... + + + + + + + + + + Save Data Extraction + + + + + + Extract 3DS SD Savegames. + + + + + + + SD Decryption must be enabled to use this tool. + + + false + + + + + + + Qt::Horizontal + + + + + + + Open... + + + + + + + + + + Extdata Extraction + + + + + + Extract 3DS Extra Data. + + + + + + + SD Decryption must be enabled to use this tool. + + + false + + + + + + + Qt::Horizontal + + + + + + + Open... + + + + + + + + + + RomFS Extraction + + + + + + Extract shared RomFS from NCCH. Useful for System Archives. + + + false + + + + + + + SD Decryption must be disabled to use this tool. + + + + + + + Qt::Horizontal + + + + + + + Open... + + + false + + + + + + + + +