mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-06 08:39:06 +00:00
Really properly be per-monitor DPI aware
This is so hard...
This commit is contained in:
@@ -9,6 +9,8 @@ endif()
|
|||||||
file(GLOB_RECURSE THEMES ${PROJECT_SOURCE_DIR}/dist/themes/*)
|
file(GLOB_RECURSE THEMES ${PROJECT_SOURCE_DIR}/dist/themes/*)
|
||||||
|
|
||||||
add_executable(threeSD
|
add_executable(threeSD
|
||||||
|
helpers/dpi_aware_dialog.cpp
|
||||||
|
helpers/dpi_aware_dialog.h
|
||||||
helpers/frontend_common.cpp
|
helpers/frontend_common.cpp
|
||||||
helpers/frontend_common.h
|
helpers/frontend_common.h
|
||||||
helpers/multi_job.cpp
|
helpers/multi_job.cpp
|
||||||
|
|||||||
@@ -12,12 +12,11 @@
|
|||||||
|
|
||||||
CIABuildDialog::CIABuildDialog(QWidget* parent, bool is_dir_, bool is_nand, bool enable_legit,
|
CIABuildDialog::CIABuildDialog(QWidget* parent, bool is_dir_, bool is_nand, bool enable_legit,
|
||||||
const QString& default_path)
|
const QString& default_path)
|
||||||
: QDialog(parent), ui(std::make_unique<Ui::CIABuildDialog>()), is_dir(is_dir_) {
|
: DPIAwareDialog(parent, 510, 260), ui(std::make_unique<Ui::CIABuildDialog>()),
|
||||||
ui->setupUi(this);
|
is_dir(is_dir_) {
|
||||||
|
|
||||||
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
|
|
||||||
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
|
|
||||||
|
|
||||||
if (is_dir) {
|
if (is_dir) {
|
||||||
setWindowTitle(tr("Batch Build CIA"));
|
setWindowTitle(tr("Batch Build CIA"));
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <QDialog>
|
|
||||||
#include "core/file_sys/cia_common.h"
|
#include "core/file_sys/cia_common.h"
|
||||||
|
#include "frontend/helpers/dpi_aware_dialog.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CIABuildDialog;
|
class CIABuildDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CIABuildDialog : public QDialog {
|
class CIABuildDialog : public DPIAwareDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2,14 +2,6 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CIABuildDialog</class>
|
<class>CIABuildDialog</class>
|
||||||
<widget class="QDialog" name="CIABuildDialog">
|
<widget class="QDialog" name="CIABuildDialog">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>510</width>
|
|
||||||
<height>260</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Build CIA</string>
|
<string>Build CIA</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -59,9 +51,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel">
|
<widget class="QLabel">
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Recommended for general use.<br>Decrypted CIA with decrypted contents and standard ticket.</string>
|
<string>Recommended for general use.<br>Decrypted CIA with decrypted contents and standard ticket.</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -76,9 +65,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="pirateLegitLabel">
|
<widget class="QLabel" name="pirateLegitLabel">
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Encrypted CIA with legit TMD, encrypted contents and standard ticket.</string>
|
<string>Encrypted CIA with legit TMD, encrypted contents and standard ticket.</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -93,9 +79,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="legitLabel">
|
<widget class="QLabel" name="legitLabel">
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Encrypted CIA with legit TMD, encrypted contents and legit ticket.<br>WARNING: Legit ticket may include console identifying information!</string>
|
<string>Encrypted CIA with legit TMD, encrypted contents and legit ticket.<br>WARNING: Legit ticket may include console identifying information!</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
// Copyright 2021 threeSD Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <QScreen>
|
||||||
|
#include <QWindow>
|
||||||
|
#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<int>(scaleX * width() / previous_scaleX);
|
||||||
|
const int new_height = static_cast<int>(scaleY * height() / previous_scaleY);
|
||||||
|
setMinimumSize(0, 0); // Enforce this resize
|
||||||
|
resize(new_width, new_height);
|
||||||
|
} else {
|
||||||
|
const int new_width = static_cast<int>(original_width * scaleX);
|
||||||
|
const int new_height = static_cast<int>(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
|
||||||
@@ -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 <QDialog>
|
||||||
|
|
||||||
|
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{};
|
||||||
|
};
|
||||||
@@ -82,17 +82,14 @@ static QPixmap GetContentIcon(const Core::ContentSpecifier& specifier,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImportDialog::ImportDialog(QWidget* parent, const Core::Config& config_)
|
ImportDialog::ImportDialog(QWidget* parent, const Core::Config& config_)
|
||||||
: QDialog(parent), ui(std::make_unique<Ui::ImportDialog>()), config(config_) {
|
: DPIAwareDialog(parent, 560, 320), ui(std::make_unique<Ui::ImportDialog>()), config(config_) {
|
||||||
|
|
||||||
qRegisterMetaType<u64>("u64");
|
qRegisterMetaType<u64>("u64");
|
||||||
qRegisterMetaType<std::size_t>("std::size_t");
|
qRegisterMetaType<std::size_t>("std::size_t");
|
||||||
qRegisterMetaType<Core::ContentSpecifier>();
|
qRegisterMetaType<Core::ContentSpecifier>();
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
|
|
||||||
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
|
|
||||||
|
|
||||||
RelistContent();
|
RelistContent();
|
||||||
UpdateSizeDisplay();
|
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->title_view_button, &QRadioButton::toggled, this, &ImportDialog::RepopulateContent);
|
||||||
connect(ui->advanced_button, &QPushButton::clicked, this, &ImportDialog::ShowAdvancedMenu);
|
connect(ui->advanced_button, &QPushButton::clicked, this, &ImportDialog::ShowAdvancedMenu);
|
||||||
|
|
||||||
// Set up column widths.
|
ui->main->header()->setStretchLastSection(false);
|
||||||
// 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);
|
|
||||||
|
|
||||||
connect(ui->main, &QTreeWidget::customContextMenuRequested, this, &ImportDialog::OnContextMenu);
|
connect(ui->main, &QTreeWidget::customContextMenuRequested, this, &ImportDialog::OnContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportDialog::~ImportDialog() = default;
|
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() {
|
void ImportDialog::RelistContent() {
|
||||||
auto* dialog = new QProgressDialog(tr("Loading Contents..."), tr("Cancel"), 0, 0, this);
|
auto* dialog = new QProgressDialog(tr("Loading Contents..."), tr("Cancel"), 0, 0, this);
|
||||||
dialog->setWindowFlags(dialog->windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
dialog->setWindowFlags(dialog->windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <QDialog>
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include "core/file_sys/ncch_container.h"
|
#include "core/file_sys/ncch_container.h"
|
||||||
#include "core/importer.h"
|
#include "core/importer.h"
|
||||||
|
#include "helpers/dpi_aware_dialog.h"
|
||||||
|
|
||||||
class AdvancedMenu;
|
class AdvancedMenu;
|
||||||
class MultiJob;
|
class MultiJob;
|
||||||
@@ -21,7 +21,7 @@ namespace Ui {
|
|||||||
class ImportDialog;
|
class ImportDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImportDialog : public QDialog {
|
class ImportDialog final : public DPIAwareDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -29,6 +29,8 @@ public:
|
|||||||
~ImportDialog() override;
|
~ImportDialog() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SetContentSizes(int previous_width, int previous_height) override;
|
||||||
|
|
||||||
void RelistContent();
|
void RelistContent();
|
||||||
void RepopulateContent();
|
void RepopulateContent();
|
||||||
void UpdateSizeDisplay();
|
void UpdateSizeDisplay();
|
||||||
|
|||||||
@@ -2,14 +2,6 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ImportDialog</class>
|
<class>ImportDialog</class>
|
||||||
<widget class="QDialog" name="ImportDialog">
|
<widget class="QDialog" name="ImportDialog">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>560</width>
|
|
||||||
<height>320</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Select Contents</string>
|
<string>Select Contents</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
+15
-8
@@ -5,7 +5,6 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QStorageInfo>
|
#include <QStorageInfo>
|
||||||
@@ -37,12 +36,11 @@ bool IsConfigGood(const Core::Config& config) {
|
|||||||
!config.movable_sed_path.empty() && !config.bootrom_path.empty();
|
!config.movable_sed_path.empty() && !config.bootrom_path.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<Ui::MainDialog>()) {
|
MainDialog::MainDialog(QWidget* parent)
|
||||||
ui->setupUi(this);
|
: DPIAwareDialog(parent, 640, 256), ui(std::make_unique<Ui::MainDialog>()) {
|
||||||
|
|
||||||
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
|
|
||||||
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
|
|
||||||
|
|
||||||
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(false);
|
ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok)->setEnabled(false);
|
||||||
ui->buttonBox->button(QDialogButtonBox::StandardButton::Reset)->setText(tr("Refresh"));
|
ui->buttonBox->button(QDialogButtonBox::StandardButton::Reset)->setText(tr("Refresh"));
|
||||||
@@ -89,9 +87,6 @@ MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<U
|
|||||||
});
|
});
|
||||||
|
|
||||||
ui->main->setIndentation(4);
|
ui->main->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
|
// Set up device watcher
|
||||||
auto* device_watcher = new QDeviceWatcher(this);
|
auto* device_watcher = new QDeviceWatcher(this);
|
||||||
@@ -103,6 +98,18 @@ MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<U
|
|||||||
|
|
||||||
MainDialog::~MainDialog() = default;
|
MainDialog::~MainDialog() = default;
|
||||||
|
|
||||||
|
void MainDialog::SetContentSizes(int previous_width, int previous_height) {
|
||||||
|
const int current_width = width();
|
||||||
|
if (previous_width == 0) { // first time
|
||||||
|
ui->main->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})/"};
|
static const std::regex sdmc_path_regex{"(.+)([/\\\\])Nintendo 3DS/([0-9a-f]{32})/([0-9a-f]{32})/"};
|
||||||
|
|
||||||
void MainDialog::LoadPresetConfig() {
|
void MainDialog::LoadPresetConfig() {
|
||||||
|
|||||||
+4
-2
@@ -5,14 +5,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QDialog>
|
|
||||||
#include "core/importer.h"
|
#include "core/importer.h"
|
||||||
|
#include "frontend/helpers/dpi_aware_dialog.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainDialog;
|
class MainDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainDialog : public QDialog {
|
class MainDialog final : public DPIAwareDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -20,6 +20,8 @@ public:
|
|||||||
~MainDialog() override;
|
~MainDialog() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void SetContentSizes(int previous_width, int previous_height) override;
|
||||||
|
|
||||||
void LoadPresetConfig();
|
void LoadPresetConfig();
|
||||||
void LaunchImportDialog();
|
void LaunchImportDialog();
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,6 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>MainDialog</class>
|
<class>MainDialog</class>
|
||||||
<widget class="QDialog" name="MainDialog">
|
<widget class="QDialog" name="MainDialog">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>640</width>
|
|
||||||
<height>256</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>threeSD</string>
|
<string>threeSD</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -9,14 +9,11 @@
|
|||||||
#include "ui_select_files_dialog.h"
|
#include "ui_select_files_dialog.h"
|
||||||
|
|
||||||
SelectFilesDialog::SelectFilesDialog(QWidget* parent, bool source_is_dir_, bool destination_is_dir_)
|
SelectFilesDialog::SelectFilesDialog(QWidget* parent, bool source_is_dir_, bool destination_is_dir_)
|
||||||
: QDialog(parent), ui(std::make_unique<Ui::SelectFilesDialog>()), source_is_dir(source_is_dir_),
|
: DPIAwareDialog(parent, 480, 96), ui(std::make_unique<Ui::SelectFilesDialog>()),
|
||||||
destination_is_dir(destination_is_dir_) {
|
source_is_dir(source_is_dir_), destination_is_dir(destination_is_dir_) {
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
|
|
||||||
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
|
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, [this] {
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, [this] {
|
||||||
if (ui->source->text().isEmpty() || ui->destination->text().isEmpty()) {
|
if (ui->source->text().isEmpty() || ui->destination->text().isEmpty()) {
|
||||||
|
|||||||
@@ -5,15 +5,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QDialog>
|
#include "frontend/helpers/dpi_aware_dialog.h"
|
||||||
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SelectFilesDialog;
|
class SelectFilesDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SelectFilesDialog : public QDialog {
|
class SelectFilesDialog : public DPIAwareDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2,14 +2,6 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>SelectFilesDialog</class>
|
<class>SelectFilesDialog</class>
|
||||||
<widget class="QDialog" name="SelectFilesDialog">
|
<widget class="QDialog" name="SelectFilesDialog">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>480</width>
|
|
||||||
<height>96</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Select Files</string>
|
<string>Select Files</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -20,14 +20,11 @@
|
|||||||
|
|
||||||
TitleInfoDialog::TitleInfoDialog(QWidget* parent, Core::SDMCImporter& importer_,
|
TitleInfoDialog::TitleInfoDialog(QWidget* parent, Core::SDMCImporter& importer_,
|
||||||
Core::ContentSpecifier specifier_)
|
Core::ContentSpecifier specifier_)
|
||||||
: QDialog(parent), ui(std::make_unique<Ui::TitleInfoDialog>()), importer(importer_),
|
: DPIAwareDialog(parent, 500, 360), ui(std::make_unique<Ui::TitleInfoDialog>()),
|
||||||
specifier(std::move(specifier_)) {
|
importer(importer_), specifier(std::move(specifier_)) {
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
|
|
||||||
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
|
|
||||||
|
|
||||||
LoadInfo();
|
LoadInfo();
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QDialog>
|
|
||||||
#include "core/file_sys/smdh.h"
|
#include "core/file_sys/smdh.h"
|
||||||
|
#include "frontend/helpers/dpi_aware_dialog.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
struct Config;
|
struct Config;
|
||||||
@@ -18,7 +18,7 @@ namespace Ui {
|
|||||||
class TitleInfoDialog;
|
class TitleInfoDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TitleInfoDialog : public QDialog {
|
class TitleInfoDialog : public DPIAwareDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2,14 +2,6 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>TitleInfoDialog</class>
|
<class>TitleInfoDialog</class>
|
||||||
<widget class="QDialog" name="TitleInfoDialog">
|
<widget class="QDialog" name="TitleInfoDialog">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>500</width>
|
|
||||||
<height>360</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Title Info</string>
|
<string>Title Info</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -19,13 +19,10 @@
|
|||||||
#include "ui_utilities.h"
|
#include "ui_utilities.h"
|
||||||
|
|
||||||
UtilitiesDialog::UtilitiesDialog(QWidget* parent)
|
UtilitiesDialog::UtilitiesDialog(QWidget* parent)
|
||||||
: QDialog(parent), ui(std::make_unique<Ui::UtilitiesDialog>()) {
|
: DPIAwareDialog(parent, 640, 384), ui(std::make_unique<Ui::UtilitiesDialog>()) {
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
const double scale = qApp->desktop()->logicalDpiX() / 96.0;
|
|
||||||
resize(static_cast<int>(width() * scale), static_cast<int>(height() * scale));
|
|
||||||
|
|
||||||
connect(ui->useSdDecryption, &QCheckBox::clicked, [this] {
|
connect(ui->useSdDecryption, &QCheckBox::clicked, [this] {
|
||||||
const bool checked = ui->useSdDecryption->isChecked();
|
const bool checked = ui->useSdDecryption->isChecked();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QDialog>
|
#include "frontend/helpers/dpi_aware_dialog.h"
|
||||||
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ namespace Ui {
|
|||||||
class UtilitiesDialog;
|
class UtilitiesDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class UtilitiesDialog : public QDialog {
|
class UtilitiesDialog : public DPIAwareDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2,14 +2,6 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>UtilitiesDialog</class>
|
<class>UtilitiesDialog</class>
|
||||||
<widget class="QDialog" name="UtilitiesDialog">
|
<widget class="QDialog" name="UtilitiesDialog">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>640</width>
|
|
||||||
<height>384</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>threeSD Utilities</string>
|
<string>threeSD Utilities</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -44,12 +36,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QToolButton" name="boot9PathExplore">
|
<widget class="QToolButton" name="boot9PathExplore">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -67,12 +53,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<widget class="QToolButton" name="movableSedPathExplore">
|
<widget class="QToolButton" name="movableSedPathExplore">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -93,12 +73,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QToolButton" name="sdmcPathExplore">
|
<widget class="QToolButton" name="sdmcPathExplore">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user